From: Andrea Bianco Date: Fri, 9 Oct 2020 09:04:53 +0000 (+0200) Subject: Built motion from commit (unavailable).|2.5.4 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=27e31c3f325216fde6e7b01136b3668484745068;p=motion2.git Built motion from commit (unavailable).|2.5.4 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index a949667..25eca72 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-09T08:34:37.298Z", + "time": "2020-10-09T08:53:55.786Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 6b2983e..4c4ad69 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-09T08:34:37.298Z", + "time": "2020-10-09T08:53:55.786Z", "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 729df11..fdc1e6d 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 _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 +var _0x8c6c=['getDataValue','action','STRING','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','VIRTUAL'];(function(_0x2636fd,_0x7fd208){var _0x555539=function(_0x491dad){while(--_0x491dad){_0x2636fd['push'](_0x2636fd['shift']());}};_0x555539(++_0x7fd208);}(_0x8c6c,0xde));var _0xc8c6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8c6c[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xc8c6('0x0'));module['exports']={'name':{'type':Sequelize[_0xc8c6('0x1')],'get':function(_0x28db7c){return this[_0xc8c6('0x2')](_0xc8c6('0x3'));}},'action':{'type':Sequelize[_0xc8c6('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0xc8c6('0x5'),_0xc8c6('0x6'),_0xc8c6('0x7'),_0xc8c6('0x8'),_0xc8c6('0x9'),_0xc8c6('0xa'),_0xc8c6('0xb')]],'msg':_0xc8c6('0xc')}},'comment':_0xc8c6('0xc')},'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[_0xc8c6('0x4')](0x1000),'comment':_0xc8c6('0xd')},'data3':{'type':Sequelize[_0xc8c6('0x4')](0x1000),'comment':_0xc8c6('0xe')},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize[_0xc8c6('0x4')](0x1000)},'data6':{'type':Sequelize[_0xc8c6('0x4')]},'data7':{'type':Sequelize[_0xc8c6('0xf')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 9810d4a..4bf4a9c 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 _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 +var _0xb171=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','body','Action','find','params','catch','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','squel','crypto','jsforce'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb171,0x122));var _0x1b17=function(_0x1229f1,_0x229bd6){_0x1229f1=_0x1229f1-0x0;var _0x481b53=_0xb171[_0x1229f1];return _0x481b53;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1b17('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1b17('0x1'));var jsonpatch=require(_0x1b17('0x2'));var rp=require(_0x1b17('0x3'));var moment=require(_0x1b17('0x4'));var BPromise=require(_0x1b17('0x5'));var Mustache=require('mustache');var util=require(_0x1b17('0x6'));var path=require('path');var sox=require(_0x1b17('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1b17('0x8'));var crypto=require(_0x1b17('0x9'));var jsforce=require(_0x1b17('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1b17('0xb'));var Papa=require(_0x1b17('0xc'));var Redis=require('ioredis');var authService=require(_0x1b17('0xd'));var qs=require(_0x1b17('0xe'));var as=require(_0x1b17('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1b17('0x10'))('api');var utils=require(_0x1b17('0x11'));var config=require(_0x1b17('0x12'));var db=require(_0x1b17('0x13'))['db'];function respondWithStatusCode(_0x169ab1,_0x27aaa3){_0x27aaa3=_0x27aaa3||0xcc;return function(_0x140881){if(_0x140881){return _0x169ab1[_0x1b17('0x14')](_0x27aaa3);}return _0x169ab1['status'](_0x27aaa3)[_0x1b17('0x15')]();};}function respondWithResult(_0x5d16fe,_0x37493b){_0x37493b=_0x37493b||0xc8;return function(_0x5a83d1){if(_0x5a83d1){return _0x5d16fe[_0x1b17('0x16')](_0x37493b)[_0x1b17('0x17')](_0x5a83d1);}};}function respondWithFilteredResult(_0x220d51,_0x11e70b){return function(_0x35c486){if(_0x35c486){var _0x26572b=_0x35c486[_0x1b17('0x18')],_0x2928c6=_0x11e70b[_0x1b17('0x19')],_0x117550=_0x11e70b[_0x1b17('0x19')]+_0x11e70b[_0x1b17('0x1a')],_0x256610;if(_0x117550>=_0x26572b){_0x117550=_0x26572b;_0x256610=0xc8;}else{_0x256610=0xce;}_0x220d51[_0x1b17('0x16')](_0x256610);return _0x220d51[_0x1b17('0x1b')](_0x1b17('0x1c'),_0x2928c6+'-'+_0x117550+'/'+_0x26572b)[_0x1b17('0x17')](_0x35c486);}return null;};}function patchUpdates(_0x11629f){return function(_0x3441e3){try{jsonpatch[_0x1b17('0x1d')](_0x3441e3,_0x11629f,!![]);}catch(_0x205839){return BPromise['reject'](_0x205839);}return _0x3441e3[_0x1b17('0x1e')]();};}function saveUpdates(_0x235943,_0x5494bb){return function(_0x10a646){if(_0x10a646){return _0x10a646[_0x1b17('0x1f')](_0x235943)[_0x1b17('0x20')](function(_0x596c2f){return _0x596c2f;});}return null;};}function removeEntity(_0x3abeb0,_0x56f3ce){return function(_0x10486b){if(_0x10486b){return _0x10486b['destroy']()[_0x1b17('0x20')](function(){_0x3abeb0[_0x1b17('0x16')](0xcc)[_0x1b17('0x15')]();});}};}function handleEntityNotFound(_0x5321e8,_0x342623){return function(_0x194c1c){if(!_0x194c1c){_0x5321e8[_0x1b17('0x14')](0x194);}return _0x194c1c;};}function handleError(_0x227a45,_0x3d7339){_0x3d7339=_0x3d7339||0x1f4;return function(_0x3b5afd){logger[_0x1b17('0x21')](_0x3b5afd[_0x1b17('0x22')]);if(_0x3b5afd[_0x1b17('0x23')]){delete _0x3b5afd[_0x1b17('0x23')];}_0x227a45['status'](_0x3d7339)[_0x1b17('0x24')](_0x3b5afd);};}exports[_0x1b17('0x1f')]=function(_0x30cf28,_0x5d95c9){if(_0x30cf28[_0x1b17('0x25')]['id']){delete _0x30cf28[_0x1b17('0x25')]['id'];}return db[_0x1b17('0x26')][_0x1b17('0x27')]({'where':{'id':_0x30cf28[_0x1b17('0x28')]['id']}})[_0x1b17('0x20')](handleEntityNotFound(_0x5d95c9,null))['then'](saveUpdates(_0x30cf28[_0x1b17('0x25')],null))[_0x1b17('0x20')](respondWithResult(_0x5d95c9,null))[_0x1b17('0x29')](handleError(_0x5d95c9,null));};exports[_0x1b17('0x2a')]=function(_0x539370,_0x41c48b){return db[_0x1b17('0x26')]['find']({'where':{'id':_0x539370[_0x1b17('0x28')]['id']}})['then'](handleEntityNotFound(_0x41c48b,null))[_0x1b17('0x20')](removeEntity(_0x41c48b,null))[_0x1b17('0x29')](handleError(_0x41c48b,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 2be0ffa..cf531bf 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 _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 +var _0xed9d=['rimraf','./action.attributes','exports','define','Action','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x310504,_0x26ad95){var _0x5b36d0=function(_0x253f28){while(--_0x253f28){_0x310504['push'](_0x310504['shift']());}};_0x5b36d0(++_0x26ad95);}(_0xed9d,0x155));var _0xded9=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xed9d[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xded9('0x0'));var util=require(_0xded9('0x1'));var logger=require(_0xded9('0x2'))(_0xded9('0x3'));var moment=require(_0xded9('0x4'));var BPromise=require(_0xded9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xded9('0x6'));var rimraf=require(_0xded9('0x7'));var config=require('../../config/environment');var attributes=require(_0xded9('0x8'));module[_0xded9('0x9')]=function(_0x55066a,_0x1f8843){return _0x55066a[_0xded9('0xa')](_0xded9('0xb'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 75d4b8f..dae7794 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 _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 +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x14914a,_0x3eae81){var _0x3766ec=function(_0x2d6c73){while(--_0x2d6c73){_0x14914a['push'](_0x14914a['shift']());}};_0x3766ec(++_0x3eae81);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 2d6c7c6..9ab3348 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 _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 +var _0xaf7b=['./action.controller','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5e9c85,_0x461674){var _0xcbdcf7=function(_0x2680d9){while(--_0x2680d9){_0x5e9c85['push'](_0x5e9c85['shift']());}};_0xcbdcf7(++_0x461674);}(_0xaf7b,0x1f1));var _0xbaf7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaf7b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xbaf7('0x0'));var util=require(_0xbaf7('0x1'));var path=require('path');var timeout=require(_0xbaf7('0x2'));var express=require(_0xbaf7('0x3'));var router=express[_0xbaf7('0x4')]();var auth=require(_0xbaf7('0x5'));var interaction=require(_0xbaf7('0x6'));var config=require('../../config/environment');var controller=require(_0xbaf7('0x7'));router[_0xbaf7('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xbaf7('0x9')]);router[_0xbaf7('0xa')](_0xbaf7('0xb'),auth['isAuthenticated'](),controller[_0xbaf7('0xc')]);module[_0xbaf7('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index cec26b9..ef4a69f 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 _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 +var _0x2bb9=['STRING','TEXT','exports'];(function(_0x56b820,_0x35e4fe){var _0xc74e1a=function(_0x1b9023){while(--_0x1b9023){_0x56b820['push'](_0x56b820['shift']());}};_0xc74e1a(++_0x35e4fe);}(_0x2bb9,0x16a));var _0x92bb=function(_0x592416,_0x2c75e9){_0x592416=_0x592416-0x0;var _0x3005fa=_0x2bb9[_0x592416];return _0x3005fa;};'use strict';var Sequelize=require('sequelize');module[_0x92bb('0x0')]={'name':{'type':Sequelize[_0x92bb('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x92bb('0x1')]},'table':{'type':Sequelize[_0x92bb('0x1')]},'conditions':{'type':Sequelize[_0x92bb('0x2')]},'joins':{'type':Sequelize[_0x92bb('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index cd1f7ac..ebd1180 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 _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 +var _0x8e0d=['sendStatus','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','keys','length','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','autoAssociation','UserProfileResource','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','toString','sequelize','QueryTypes','SELECT','COUNT(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','Please\x20insert\x20at\x20least\x20one\x20field','groupBy','DESC','%s.%s\x20=\x20%s.%s','Limited\x20Query:','No\x20available\x20data','output','fullPath','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','../../components/export/','../../files/reports','countTable','COUNT(*)','run','runReport','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','dbH','end','status','json','count','offset','limit','set','Content-Range','then','destroy','get'];(function(_0x6ea106,_0x181b3d){var _0x49ecfe=function(_0x750f7b){while(--_0x750f7b){_0x6ea106['push'](_0x6ea106['shift']());}};_0x49ecfe(++_0x181b3d);}(_0x8e0d,0x82));var _0xd8e0=function(_0x35fabd,_0x825452){_0x35fabd=_0x35fabd-0x0;var _0x61a8ee=_0x8e0d[_0x35fabd];return _0x61a8ee;};'use strict';var pdf=require(_0xd8e0('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd8e0('0x1'));var jsonpatch=require(_0xd8e0('0x2'));var rp=require('request-promise');var moment=require(_0xd8e0('0x3'));var BPromise=require(_0xd8e0('0x4'));var Mustache=require(_0xd8e0('0x5'));var util=require(_0xd8e0('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd8e0('0x7'));var ejs=require(_0xd8e0('0x8'));var fs=require('fs');var _=require(_0xd8e0('0x9'));var squel=require(_0xd8e0('0xa'));var crypto=require('crypto');var jsforce=require(_0xd8e0('0xb'));var deskjs=require(_0xd8e0('0xc'));var toCsv=require(_0xd8e0('0x7'));var querystring=require(_0xd8e0('0xd'));var Papa=require(_0xd8e0('0xe'));var Redis=require('ioredis');var authService=require(_0xd8e0('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd8e0('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd8e0('0x11'));var utils=require(_0xd8e0('0x12'));var config=require(_0xd8e0('0x13'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xd8e0('0x14')];function respondWithStatusCode(_0x4d968a,_0x11cf8d){_0x11cf8d=_0x11cf8d||0xcc;return function(_0x582b8f){if(_0x582b8f){return _0x4d968a['sendStatus'](_0x11cf8d);}return _0x4d968a['status'](_0x11cf8d)[_0xd8e0('0x15')]();};}function respondWithResult(_0x5c983a,_0x34f992){_0x34f992=_0x34f992||0xc8;return function(_0x29f681){if(_0x29f681){return _0x5c983a[_0xd8e0('0x16')](_0x34f992)[_0xd8e0('0x17')](_0x29f681);}};}function respondWithFilteredResult(_0x2689d3,_0x28f3e0){return function(_0xe5d019){if(_0xe5d019){var _0x345e21=_0xe5d019[_0xd8e0('0x18')],_0x1ce603=_0x28f3e0[_0xd8e0('0x19')],_0x488ed9=_0x28f3e0[_0xd8e0('0x19')]+_0x28f3e0[_0xd8e0('0x1a')],_0x107c63;if(_0x488ed9>=_0x345e21){_0x488ed9=_0x345e21;_0x107c63=0xc8;}else{_0x107c63=0xce;}_0x2689d3[_0xd8e0('0x16')](_0x107c63);return _0x2689d3[_0xd8e0('0x1b')](_0xd8e0('0x1c'),_0x1ce603+'-'+_0x488ed9+'/'+_0x345e21)['json'](_0xe5d019);}return null;};}function patchUpdates(_0x371136){return function(_0x4e41d4){try{jsonpatch['apply'](_0x4e41d4,_0x371136,!![]);}catch(_0x8755ce){return BPromise['reject'](_0x8755ce);}return _0x4e41d4['save']();};}function saveUpdates(_0x50c2a2,_0x19894c){return function(_0x29c413){if(_0x29c413){return _0x29c413['update'](_0x50c2a2)[_0xd8e0('0x1d')](function(_0x4209fb){return _0x4209fb;});}return null;};}function removeEntity(_0x1d31de,_0x40f098){return function(_0x471a5c){if(_0x471a5c){return _0x471a5c[_0xd8e0('0x1e')]()['then'](function(){var _0x1757f3=_0x471a5c[_0xd8e0('0x1f')]({'plain':!![]});var _0x54c515='CustomReports';return db['UserProfileResource'][_0xd8e0('0x1e')]({'where':{'type':_0x54c515,'resourceId':_0x1757f3['id']}})[_0xd8e0('0x1d')](function(){return _0x471a5c;});})[_0xd8e0('0x1d')](function(){_0x1d31de[_0xd8e0('0x16')](0xcc)[_0xd8e0('0x15')]();});}};}function handleEntityNotFound(_0x5b0525,_0x5a156c){return function(_0x1a29c7){if(!_0x1a29c7){_0x5b0525[_0xd8e0('0x20')](0x194);}return _0x1a29c7;};}function handleError(_0x15f15b,_0x169373){_0x169373=_0x169373||0x1f4;return function(_0x51c7b6){logger[_0xd8e0('0x21')](_0x51c7b6[_0xd8e0('0x22')]);if(_0x51c7b6[_0xd8e0('0x23')]){delete _0x51c7b6[_0xd8e0('0x23')];}_0x15f15b['status'](_0x169373)[_0xd8e0('0x24')](_0x51c7b6);};}exports[_0xd8e0('0x25')]=function(_0x1a9364,_0x2ab62b){var _0x276665={},_0x345bf3={},_0x16c203={'count':0x0,'rows':[]};var _0x559d97=_[_0xd8e0('0x26')](db[_0xd8e0('0x27')][_0xd8e0('0x28')],function(_0x53e220){return{'name':_0x53e220[_0xd8e0('0x29')],'type':_0x53e220[_0xd8e0('0x2a')][_0xd8e0('0x2b')]};});_0x345bf3[_0xd8e0('0x2c')]=_[_0xd8e0('0x26')](_0x559d97,_0xd8e0('0x23'));_0x345bf3[_0xd8e0('0x2d')]=_['keys'](_0x1a9364[_0xd8e0('0x2d')]);_0x345bf3[_0xd8e0('0x2e')]=_[_0xd8e0('0x2f')](_0x345bf3[_0xd8e0('0x2c')],_0x345bf3[_0xd8e0('0x2d')]);_0x276665[_0xd8e0('0x30')]=_['intersection'](_0x345bf3[_0xd8e0('0x2c')],qs[_0xd8e0('0x31')](_0x1a9364[_0xd8e0('0x2d')][_0xd8e0('0x31')]));_0x276665[_0xd8e0('0x30')]=_0x276665[_0xd8e0('0x30')]['length']?_0x276665[_0xd8e0('0x30')]:_0x345bf3[_0xd8e0('0x2c')];if(!_0x1a9364[_0xd8e0('0x2d')]['hasOwnProperty'](_0xd8e0('0x32'))){_0x276665['limit']=qs[_0xd8e0('0x1a')](_0x1a9364[_0xd8e0('0x2d')][_0xd8e0('0x1a')]);_0x276665[_0xd8e0('0x19')]=qs[_0xd8e0('0x19')](_0x1a9364[_0xd8e0('0x2d')]['offset']);}_0x276665[_0xd8e0('0x33')]=qs[_0xd8e0('0x34')](_0x1a9364[_0xd8e0('0x2d')][_0xd8e0('0x34')]);_0x276665[_0xd8e0('0x35')]=qs['filters'](_[_0xd8e0('0x36')](_0x1a9364[_0xd8e0('0x2d')],_0x345bf3[_0xd8e0('0x2e')]),_0x559d97);if(_0x1a9364[_0xd8e0('0x2d')][_0xd8e0('0x37')]){_0x276665[_0xd8e0('0x35')]=_[_0xd8e0('0x38')](_0x276665[_0xd8e0('0x35')],{'$or':_[_0xd8e0('0x26')](_0x559d97,function(_0x4b3d02){if(_0x4b3d02[_0xd8e0('0x2a')]!==_0xd8e0('0x39')){var _0x19b066={};_0x19b066[_0x4b3d02[_0xd8e0('0x23')]]={'$like':'%'+_0x1a9364[_0xd8e0('0x2d')][_0xd8e0('0x37')]+'%'};return _0x19b066;}})});}_0x276665=_[_0xd8e0('0x38')]({},_0x276665,_0x1a9364['options']);var _0x24a506={'where':_0x276665[_0xd8e0('0x35')]};return db[_0xd8e0('0x27')][_0xd8e0('0x18')](_0x24a506)[_0xd8e0('0x1d')](function(_0x1d5130){_0x16c203['count']=_0x1d5130;if(_0x1a9364[_0xd8e0('0x2d')][_0xd8e0('0x3a')]){_0x276665['include']=[{'all':!![]}];}return db[_0xd8e0('0x27')][_0xd8e0('0x3b')](_0x276665);})[_0xd8e0('0x1d')](function(_0x45fd12){_0x16c203[_0xd8e0('0x3c')]=_0x45fd12;return _0x16c203;})[_0xd8e0('0x1d')](respondWithFilteredResult(_0x2ab62b,_0x276665))[_0xd8e0('0x3d')](handleError(_0x2ab62b,null));};exports[_0xd8e0('0x3e')]=function(_0xf808a,_0xc48f59){var _0x8bfe97={'raw':![],'where':{'id':_0xf808a[_0xd8e0('0x3f')]['id']}},_0xcada28={};_0xcada28['model']=_['keys'](db[_0xd8e0('0x27')]['rawAttributes']);_0xcada28[_0xd8e0('0x2d')]=_[_0xd8e0('0x40')](_0xf808a['query']);_0xcada28[_0xd8e0('0x2e')]=_[_0xd8e0('0x2f')](_0xcada28[_0xd8e0('0x2c')],_0xcada28[_0xd8e0('0x2d')]);_0x8bfe97[_0xd8e0('0x30')]=_['intersection'](_0xcada28[_0xd8e0('0x2c')],qs[_0xd8e0('0x31')](_0xf808a[_0xd8e0('0x2d')]['fields']));_0x8bfe97['attributes']=_0x8bfe97['attributes'][_0xd8e0('0x41')]?_0x8bfe97[_0xd8e0('0x30')]:_0xcada28[_0xd8e0('0x2c')];if(_0xf808a[_0xd8e0('0x2d')][_0xd8e0('0x3a')]){_0x8bfe97[_0xd8e0('0x42')]=[{'all':!![]}];}_0x8bfe97=_['merge']({},_0x8bfe97,_0xf808a[_0xd8e0('0x43')]);return db[_0xd8e0('0x27')][_0xd8e0('0x44')](_0x8bfe97)[_0xd8e0('0x1d')](handleEntityNotFound(_0xc48f59,null))[_0xd8e0('0x1d')](respondWithResult(_0xc48f59,null))[_0xd8e0('0x3d')](handleError(_0xc48f59,null));};exports[_0xd8e0('0x45')]=function(_0x45be94,_0x4e3667){return db[_0xd8e0('0x27')][_0xd8e0('0x45')](_0x45be94['body'],{})['then'](function(_0x3cec45){var _0x33ce72=_0x45be94[_0xd8e0('0x46')][_0xd8e0('0x1f')]({'plain':!![]});if(!_0x33ce72)throw new Error(_0xd8e0('0x47'));if(_0x33ce72[_0xd8e0('0x48')]===_0xd8e0('0x46')){var _0x3c647d=_0x3cec45[_0xd8e0('0x1f')]({'plain':!![]});var _0x593c8f=_0xd8e0('0x49');return db[_0xd8e0('0x4a')][_0xd8e0('0x44')]({'where':{'name':_0x593c8f,'userProfileId':_0x33ce72['userProfileId']},'raw':!![]})[_0xd8e0('0x1d')](function(_0x3fed9d){if(_0x3fed9d&&_0x3fed9d[_0xd8e0('0x4b')]===0x0){return db[_0xd8e0('0x4c')]['create']({'name':_0x3c647d[_0xd8e0('0x23')],'resourceId':_0x3c647d['id'],'type':_0xd8e0('0x4d'),'sectionId':_0x3fed9d['id']},{})[_0xd8e0('0x1d')](function(){return _0x3cec45;});}else{return _0x3cec45;}})[_0xd8e0('0x3d')](function(_0x393634){logger[_0xd8e0('0x21')](_0xd8e0('0x4e'),_0x393634);throw _0x393634;});}return _0x3cec45;})[_0xd8e0('0x1d')](respondWithResult(_0x4e3667,0xc9))[_0xd8e0('0x3d')](handleError(_0x4e3667,null));};exports['update']=function(_0x36b381,_0x56bd41){if(_0x36b381[_0xd8e0('0x4f')]['id']){delete _0x36b381['body']['id'];}return db['AnalyticCustomReport'][_0xd8e0('0x44')]({'where':{'id':_0x36b381[_0xd8e0('0x3f')]['id']}})[_0xd8e0('0x1d')](handleEntityNotFound(_0x56bd41,null))[_0xd8e0('0x1d')](saveUpdates(_0x36b381[_0xd8e0('0x4f')],null))[_0xd8e0('0x1d')](respondWithResult(_0x56bd41,null))[_0xd8e0('0x3d')](handleError(_0x56bd41,null));};exports['destroy']=function(_0x1b6440,_0x295569){return db[_0xd8e0('0x27')][_0xd8e0('0x44')]({'where':{'id':_0x1b6440['params']['id']}})[_0xd8e0('0x1d')](handleEntityNotFound(_0x295569,null))[_0xd8e0('0x1d')](removeEntity(_0x295569,null))[_0xd8e0('0x3d')](handleError(_0x295569,null));};exports[_0xd8e0('0x50')]=function(_0x17b64f,_0x3e4793){var _0x2847c0=0xa;var _0x562cb9=[_0xd8e0('0x51'),_0xd8e0('0x52'),_0xd8e0('0x53'),_0xd8e0('0x54')];var _0x26c3de={'SUM':_0xd8e0('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd8e0('0x56'),'MAX':_0xd8e0('0x57'),'MIN':_0xd8e0('0x58'),'AVG':_0xd8e0('0x59'),'GROUP_CONCAT':_0xd8e0('0x5a'),'GROUP_CONCAT ASC':_0xd8e0('0x5b'),'GROUP_CONCAT DESC':_0xd8e0('0x5c')};var _0x52a5bd={'SEC_TO_TIME':_0xd8e0('0x5d'),'DATE':_0xd8e0('0x5e'),'HOUR':_0xd8e0('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xd8e0('0x60')};var _0x221f91=function(_0x104e56){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0xd8e0('0x61')],_0x104e56);};var _0x223b5e=function(_0x86c247){if(!_0x86c247||!_0x86c247[_0xd8e0('0x62')][_0xd8e0('0x41')]){return'';}for(var _0x2c4b45='(',_0x476656=0x0;_0x476656<_0x86c247['rules'][_0xd8e0('0x41')];_0x476656+=0x1){_0x476656>0x0&&(_0x2c4b45+='\x20'+_0x86c247[_0xd8e0('0x63')]+'\x20');_0x2c4b45+=_0x86c247[_0xd8e0('0x62')][_0x476656][_0xd8e0('0x64')]?_0x223b5e(_0x86c247['rules'][_0x476656][_0xd8e0('0x64')]):_0x86c247[_0xd8e0('0x62')][_0x476656][_0xd8e0('0x65')]+'\x20'+_0x86c247['rules'][_0x476656][_0xd8e0('0x66')]+(_0x221f91(_0x86c247['rules'][_0x476656]['condition'])?'\x20'+_0x86c247[_0xd8e0('0x62')][_0x476656][_0xd8e0('0x67')]:'');}return _0x2c4b45+')';};var _0x1a4bba={'where':{'id':_0x17b64f['params']['id']}},_0x54330f,_0x2dc97f,_0x1bed54,_0x40b9c5,_0x1182b;_0x1a4bba=_[_0xd8e0('0x38')]({},_0x1a4bba,_0x17b64f[_0xd8e0('0x43')]);return db['AnalyticCustomReport'][_0xd8e0('0x44')](_0x1a4bba)[_0xd8e0('0x1d')](function(_0x5cedde){if(_0x5cedde){_0x54330f=_0x5cedde;return _0x5cedde[_0xd8e0('0x68')]();}return null;})[_0xd8e0('0x1d')](function(_0x2001c2){if(_0x2001c2){if(!_0x2001c2['length']){throw new db[(_0xd8e0('0x69'))][(_0xd8e0('0x6a'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2dc97f=_0x2001c2;return db[_0xd8e0('0x6b')][_0xd8e0('0x3b')]({'raw':!![]});}return null;})[_0xd8e0('0x1d')](function(_0x250f02){if(_0x250f02){_0x1bed54=_[_0xd8e0('0x6c')](_0x250f02,'id');var _0xfd9f7e;var _0xe68ba2=squel[_0xd8e0('0x6d')]();_0xe68ba2[_0xd8e0('0x6e')](_0x54330f[_0xd8e0('0x6f')]);for(var _0x1c8ee9=0x0;_0x1c8ee9<_0x2dc97f[_0xd8e0('0x41')];_0x1c8ee9+=0x1){_0xfd9f7e=_0x2dc97f[_0x1c8ee9][_0xd8e0('0x70')]?_0x1bed54[_0x2dc97f[_0x1c8ee9][_0xd8e0('0x70')]][_0xd8e0('0x71')]:_0x2dc97f[_0x1c8ee9][_0xd8e0('0x65')];_0xfd9f7e=_0x2dc97f[_0x1c8ee9][_0xd8e0('0x72')]?_[_0xd8e0('0x73')](_0x26c3de[_0x2dc97f[_0x1c8ee9][_0xd8e0('0x72')]],'%s',_0xfd9f7e):_0xfd9f7e;_0xfd9f7e=_0x2dc97f[_0x1c8ee9][_0xd8e0('0x74')]?_['replace'](_0x52a5bd[_0x2dc97f[_0x1c8ee9][_0xd8e0('0x74')]],'%s',_0xfd9f7e):_0xfd9f7e;if(_0x2dc97f[_0x1c8ee9]['groupBy']){_0xe68ba2[_0xd8e0('0x64')](_0xfd9f7e);}_0x2dc97f[_0x1c8ee9][_0xd8e0('0x75')]&&_0xe68ba2[_0xd8e0('0x33')](_0xfd9f7e,_0x2dc97f[_0x1c8ee9][_0xd8e0('0x75')]==='DESC'?![]:!![]);_0xe68ba2[_0xd8e0('0x65')](_0xfd9f7e,_0x2dc97f[_0x1c8ee9][_0xd8e0('0x76')]||_0xfd9f7e);}if(_0x54330f[_0xd8e0('0x77')]){_0x54330f['joins']=JSON[_0xd8e0('0x78')](_0x54330f[_0xd8e0('0x77')]);for(var _0xe2502e=0x0;_0xe2502e<_0x54330f[_0xd8e0('0x77')][_0xd8e0('0x41')];_0xe2502e+=0x1){if(_0x54330f[_0xd8e0('0x77')][_0xe2502e][_0xd8e0('0x2a')]&&_['includes'](_0x562cb9,_0x54330f[_0xd8e0('0x77')][_0xe2502e][_0xd8e0('0x2a')])&&_0x54330f[_0xd8e0('0x77')][_0xe2502e][_0xd8e0('0x79')]&&_0x54330f[_0xd8e0('0x77')][_0xe2502e][_0xd8e0('0x7a')]&&_0x54330f[_0xd8e0('0x77')][_0xe2502e]['foreignKey']){_0xe68ba2[_0x54330f[_0xd8e0('0x77')][_0xe2502e]['type']](_0x54330f[_0xd8e0('0x77')][_0xe2502e][_0xd8e0('0x7a')],null,util[_0xd8e0('0x74')]('%s.%s\x20=\x20%s.%s',_0x54330f['table'],_0x54330f[_0xd8e0('0x77')][_0xe2502e]['parentKey'],_0x54330f[_0xd8e0('0x77')][_0xe2502e][_0xd8e0('0x7a')],_0x54330f[_0xd8e0('0x77')][_0xe2502e][_0xd8e0('0x7b')]));}}}if(_0x54330f['conditions']){_0x54330f[_0xd8e0('0x7c')]=JSON[_0xd8e0('0x78')](_0x54330f[_0xd8e0('0x7c')]);_0xe68ba2[_0xd8e0('0x35')](_0x223b5e(_0x54330f[_0xd8e0('0x7c')][_0xd8e0('0x64')]));}_0x1182b=_0xe68ba2[_0xd8e0('0x7d')]();_0xe68ba2['limit'](_0x2847c0);_0xe68ba2[_0xd8e0('0x19')](0x0);logger[_0xd8e0('0x7e')]('Limited\x20Query:',_0xe68ba2[_0xd8e0('0x7f')]());return db[_0xd8e0('0x80')][_0xd8e0('0x2d')](_0xe68ba2[_0xd8e0('0x7f')](),{'type':db[_0xd8e0('0x80')][_0xd8e0('0x81')][_0xd8e0('0x82')]});}})[_0xd8e0('0x1d')](respondWithResult(_0x3e4793,null))['catch'](handleError(_0x3e4793,null));};function runReport(_0x5d8fdc,_0x3d7f52,_0x1cadec){var _0x7fc8a=_0x3d7f52[_0xd8e0('0x23')];var _0x25e8c0=0xa;var _0x3fa7b4=[_0xd8e0('0x51'),_0xd8e0('0x52'),_0xd8e0('0x53'),_0xd8e0('0x54')];var _0x359d84={'SUM':'SUM(%s)','COUNT':_0xd8e0('0x83'),'COUNT DISTINCT':_0xd8e0('0x56'),'MAX':_0xd8e0('0x57'),'MIN':_0xd8e0('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xd8e0('0x5a'),'GROUP_CONCAT ASC':_0xd8e0('0x5b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3caee5={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd8e0('0x5e'),'HOUR':_0xd8e0('0x5f'),'ROUND':_0xd8e0('0x84'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x509539=function(_0x1a6d11){return!_[_0xd8e0('0x85')]([_0xd8e0('0x86'),_0xd8e0('0x87'),_0xd8e0('0x88'),_0xd8e0('0x61')],_0x1a6d11);};var _0x37d2e4=function(_0x26c610){if(!_0x26c610||!_0x26c610[_0xd8e0('0x62')][_0xd8e0('0x41')]){return'';}for(var _0x1b722c='(',_0x490ac2=0x0;_0x490ac2<_0x26c610[_0xd8e0('0x62')][_0xd8e0('0x41')];_0x490ac2+=0x1){_0x490ac2>0x0&&(_0x1b722c+='\x20'+_0x26c610[_0xd8e0('0x63')]+'\x20');_0x1b722c+=_0x26c610[_0xd8e0('0x62')][_0x490ac2][_0xd8e0('0x64')]?_0x37d2e4(_0x26c610[_0xd8e0('0x62')][_0x490ac2]['group']):_0x26c610[_0xd8e0('0x62')][_0x490ac2][_0xd8e0('0x65')]+'\x20'+_0x26c610[_0xd8e0('0x62')][_0x490ac2]['condition']+(_0x509539(_0x26c610[_0xd8e0('0x62')][_0x490ac2][_0xd8e0('0x66')])?'\x20'+_0x26c610[_0xd8e0('0x62')][_0x490ac2][_0xd8e0('0x67')]:'');}return _0x1b722c+')';};var _0x1021f6={'where':{'id':_0x5d8fdc['id']}},_0x5bb7c9,_0x4161c7,_0x40512e,_0x3366f3,_0x3f1c69;_0x1021f6=_['merge']({},_0x1021f6,_0x1cadec);return db['AnalyticCustomReport'][_0xd8e0('0x44')](_0x1021f6)[_0xd8e0('0x1d')](function(_0x26eff1){if(_0x26eff1){_0x5bb7c9=_0x26eff1;return _0x26eff1['getFields']();}return null;})['then'](function(_0x487c6d){if(_0x487c6d){if(!_0x487c6d[_0xd8e0('0x41')]){throw new db[(_0xd8e0('0x69'))][(_0xd8e0('0x6a'))](_0xd8e0('0x89'),0x193);}_0x4161c7=_0x487c6d;return db[_0xd8e0('0x6b')]['findAll']({'raw':!![]});}return null;})[_0xd8e0('0x1d')](function(_0x3bf51c){if(_0x3bf51c){_0x40512e=_[_0xd8e0('0x6c')](_0x3bf51c,'id');var _0x5ac881;var _0x58203e=squel[_0xd8e0('0x6d')]();_0x58203e[_0xd8e0('0x6e')](_0x5bb7c9[_0xd8e0('0x6f')]);for(var _0x2e06c9=0x0;_0x2e06c9<_0x4161c7[_0xd8e0('0x41')];_0x2e06c9+=0x1){_0x5ac881=_0x4161c7[_0x2e06c9][_0xd8e0('0x70')]?_0x40512e[_0x4161c7[_0x2e06c9][_0xd8e0('0x70')]][_0xd8e0('0x71')]:_0x4161c7[_0x2e06c9][_0xd8e0('0x65')];_0x5ac881=_0x4161c7[_0x2e06c9][_0xd8e0('0x72')]?_[_0xd8e0('0x73')](_0x359d84[_0x4161c7[_0x2e06c9][_0xd8e0('0x72')]],'%s',_0x5ac881):_0x5ac881;_0x5ac881=_0x4161c7[_0x2e06c9][_0xd8e0('0x74')]?_['replace'](_0x3caee5[_0x4161c7[_0x2e06c9][_0xd8e0('0x74')]],'%s',_0x5ac881):_0x5ac881;if(_0x4161c7[_0x2e06c9][_0xd8e0('0x8a')]){_0x58203e[_0xd8e0('0x64')](_0x5ac881);}_0x4161c7[_0x2e06c9][_0xd8e0('0x75')]&&_0x58203e['order'](_0x5ac881,_0x4161c7[_0x2e06c9]['orderBy']===_0xd8e0('0x8b')?![]:!![]);_0x58203e[_0xd8e0('0x65')](_0x5ac881,_0x4161c7[_0x2e06c9][_0xd8e0('0x76')]||_0x5ac881);}if(_0x5bb7c9[_0xd8e0('0x77')]){_0x5bb7c9['joins']=JSON[_0xd8e0('0x78')](_0x5bb7c9[_0xd8e0('0x77')]);for(var _0x5c5be3=0x0;_0x5c5be3<_0x5bb7c9['joins'][_0xd8e0('0x41')];_0x5c5be3+=0x1){if(_0x5bb7c9[_0xd8e0('0x77')][_0x5c5be3][_0xd8e0('0x2a')]&&_['includes'](_0x3fa7b4,_0x5bb7c9['joins'][_0x5c5be3][_0xd8e0('0x2a')])&&_0x5bb7c9[_0xd8e0('0x77')][_0x5c5be3][_0xd8e0('0x79')]&&_0x5bb7c9['joins'][_0x5c5be3][_0xd8e0('0x7a')]&&_0x5bb7c9['joins'][_0x5c5be3][_0xd8e0('0x7b')]){_0x58203e[_0x5bb7c9[_0xd8e0('0x77')][_0x5c5be3][_0xd8e0('0x2a')]](_0x5bb7c9[_0xd8e0('0x77')][_0x5c5be3][_0xd8e0('0x7a')],null,util[_0xd8e0('0x74')](_0xd8e0('0x8c'),_0x5bb7c9[_0xd8e0('0x6f')],_0x5bb7c9[_0xd8e0('0x77')][_0x5c5be3]['parentKey'],_0x5bb7c9['joins'][_0x5c5be3][_0xd8e0('0x7a')],_0x5bb7c9[_0xd8e0('0x77')][_0x5c5be3]['foreignKey']));}}}if(_0x5bb7c9[_0xd8e0('0x7c')]){_0x5bb7c9['conditions']=JSON['parse'](_0x5bb7c9[_0xd8e0('0x7c')]);_0x58203e[_0xd8e0('0x35')](_0x37d2e4(_0x5bb7c9[_0xd8e0('0x7c')][_0xd8e0('0x64')]));}_0x3f1c69=_0x58203e[_0xd8e0('0x7d')]();_0x58203e[_0xd8e0('0x1a')](_0x25e8c0);_0x58203e[_0xd8e0('0x19')](0x0);logger['debug'](_0xd8e0('0x8d'),_0x58203e['toString']());return db[_0xd8e0('0x80')][_0xd8e0('0x2d')](_0x58203e['toString'](),{'type':db[_0xd8e0('0x80')][_0xd8e0('0x81')][_0xd8e0('0x82')]});}})[_0xd8e0('0x1d')](function(_0x24e471){if(!_0x24e471[_0xd8e0('0x41')]){throw new db[(_0xd8e0('0x69'))][(_0xd8e0('0x6a'))](_0xd8e0('0x8e'),0xcc);}if(_0x3d7f52[_0xd8e0('0x8f')]==='web'){return null;}var _0x51a720=_[_0xd8e0('0x38')](_0x3d7f52,{'name':_0x3d7f52[_0xd8e0('0x90')]||_0x3d7f52[_0xd8e0('0x23')]||_0x5bb7c9['name'],'basename':_0x7fc8a,'savename':util[_0xd8e0('0x74')]('%s-%s.%s',_0x3d7f52['name']||_0x5bb7c9[_0xd8e0('0x23')],require('randomstring')[_0xd8e0('0x91')](0x4),_0x3d7f52[_0xd8e0('0x8f')]||_0xd8e0('0x92')),'reportId':_0x5bb7c9['id'],'reportType':_0xd8e0('0x93')});return db[_0xd8e0('0x94')][_0xd8e0('0x45')](_0x51a720,{'raw':!![]});})['then'](function(_0x368bb8){if(_0x5bb7c9[_0xd8e0('0x6f')]===_0xd8e0('0x95')){_0x3f1c69['where'](_0x5bb7c9['table']+_0xd8e0('0x96'),_0x3d7f52[_0xd8e0('0x97')],_0x3d7f52[_0xd8e0('0x98')]);}else{_0x3f1c69[_0xd8e0('0x35')](_0x5bb7c9[_0xd8e0('0x6f')]+_0xd8e0('0x99'),_0x3d7f52['startDate'],_0x3d7f52[_0xd8e0('0x98')]);}if(_0x368bb8){logger[_0xd8e0('0x9a')](_0xd8e0('0x9b'),_0x3f1c69['toString']());require('child_process')['fork'](path[_0xd8e0('0x51')](__dirname,_0xd8e0('0x9c'),_0x368bb8['output']),[_0x368bb8['id'],_0x3f1c69[_0xd8e0('0x7f')](),path[_0xd8e0('0x51')](__dirname,_0xd8e0('0x9d'),_0x368bb8['savename']),_0x7fc8a]);return _0x368bb8;}else{var _0x591780=squel[_0xd8e0('0x6d')]();_0x591780['from']('('+_0x3f1c69['toString']()+')',_0xd8e0('0x9e'));_0x591780[_0xd8e0('0x65')](_0xd8e0('0x9f'),_0xd8e0('0x18'));_0x3f1c69[_0xd8e0('0x1a')](_0x3d7f52[_0xd8e0('0x1a')]||_0x25e8c0);_0x3f1c69[_0xd8e0('0x19')](_0x3d7f52['offset']||0x0);return dbH['sequelize'][_0xd8e0('0x2d')](_0x591780[_0xd8e0('0x7f')](),{'type':dbH[_0xd8e0('0x80')][_0xd8e0('0x81')][_0xd8e0('0x82')]})['then'](function(_0x320303){if(!_0x320303[_0xd8e0('0x41')]){_0x3366f3=0x0;}else{_0x3366f3=_0x320303[0x0][_0xd8e0('0x18')]||0x0;}return dbH[_0xd8e0('0x80')][_0xd8e0('0x2d')](_0x3f1c69[_0xd8e0('0x7f')](),{'type':dbH[_0xd8e0('0x80')][_0xd8e0('0x81')]['SELECT']});})[_0xd8e0('0x1d')](function(_0xbf0c31){return{'rows':_0xbf0c31||[],'count':_0x3366f3};});}});}exports[_0xd8e0('0xa0')]=function(_0x20c411,_0x57b114){return runReport(_0x20c411[_0xd8e0('0x3f')],_0x20c411['query'],_0x20c411[_0xd8e0('0x43')])[_0xd8e0('0x1d')](respondWithResult(_0x57b114,null))[_0xd8e0('0x3d')](handleError(_0x57b114,null));};exports[_0xd8e0('0xa1')]=runReport;exports[_0xd8e0('0x2d')]=function(_0x2770a2,_0x4e810c){var _0x459f7b=0xa;var _0x145785=[_0xd8e0('0x51'),_0xd8e0('0x52'),_0xd8e0('0x53'),_0xd8e0('0x54')];var _0x3cdc5f={'SUM':_0xd8e0('0x55'),'COUNT':_0xd8e0('0x83'),'COUNT DISTINCT':_0xd8e0('0x56'),'MAX':_0xd8e0('0x57'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd8e0('0x5a'),'GROUP_CONCAT ASC':_0xd8e0('0x5b'),'GROUP_CONCAT DESC':_0xd8e0('0x5c')};var _0x61e492={'SEC_TO_TIME':_0xd8e0('0x5d'),'DATE':_0xd8e0('0x5e'),'HOUR':'HOUR(%s)','ROUND':_0xd8e0('0x84'),'UNIX_TIMESTAMP':_0xd8e0('0x60')};var _0x7771a9=function(_0x482707){return!_['includes'](['IS\x20NULL',_0xd8e0('0x87'),_0xd8e0('0x88'),_0xd8e0('0x61')],_0x482707);};var _0x233b9f=function(_0x4a072f){if(!_0x4a072f||!_0x4a072f[_0xd8e0('0x62')][_0xd8e0('0x41')]){return'';}for(var _0x367099='(',_0x2d5365=0x0;_0x2d5365<_0x4a072f[_0xd8e0('0x62')][_0xd8e0('0x41')];_0x2d5365+=0x1){_0x2d5365>0x0&&(_0x367099+='\x20'+_0x4a072f[_0xd8e0('0x63')]+'\x20');_0x367099+=_0x4a072f[_0xd8e0('0x62')][_0x2d5365]['group']?_0x233b9f(_0x4a072f[_0xd8e0('0x62')][_0x2d5365][_0xd8e0('0x64')]):_0x4a072f['rules'][_0x2d5365][_0xd8e0('0x65')]+'\x20'+_0x4a072f[_0xd8e0('0x62')][_0x2d5365][_0xd8e0('0x66')]+(_0x7771a9(_0x4a072f['rules'][_0x2d5365][_0xd8e0('0x66')])?'\x20'+_0x4a072f[_0xd8e0('0x62')][_0x2d5365]['value']:'');}return _0x367099+')';};var _0x3ea9d3={'where':{'id':_0x2770a2[_0xd8e0('0x3f')]['id']}},_0x138f59,_0x56bda6,_0x295dab,_0x173df0,_0x445d8e;_0x3ea9d3=_[_0xd8e0('0x38')]({},_0x3ea9d3,_0x2770a2[_0xd8e0('0x43')]);return db[_0xd8e0('0x27')][_0xd8e0('0x44')](_0x3ea9d3)[_0xd8e0('0x1d')](function(_0x11a2be){if(_0x11a2be){_0x138f59=_0x11a2be;return _0x11a2be[_0xd8e0('0x68')]();}return null;})[_0xd8e0('0x1d')](function(_0x4bb230){if(_0x4bb230){if(!_0x4bb230[_0xd8e0('0x41')]){throw new db[(_0xd8e0('0x69'))][(_0xd8e0('0x6a'))](_0xd8e0('0x89'),0x193);}_0x56bda6=_0x4bb230;return db[_0xd8e0('0x6b')][_0xd8e0('0x3b')]({'raw':!![]});}return null;})[_0xd8e0('0x1d')](function(_0x3f8fae){if(_0x3f8fae){_0x295dab=_[_0xd8e0('0x6c')](_0x3f8fae,'id');var _0x163e4c;var _0x56a015=squel[_0xd8e0('0x6d')]();_0x56a015['from'](_0x138f59[_0xd8e0('0x6f')]);for(var _0x39ff98=0x0;_0x39ff98<_0x56bda6[_0xd8e0('0x41')];_0x39ff98+=0x1){_0x163e4c=_0x56bda6[_0x39ff98][_0xd8e0('0x70')]?_0x295dab[_0x56bda6[_0x39ff98][_0xd8e0('0x70')]][_0xd8e0('0x71')]:_0x56bda6[_0x39ff98][_0xd8e0('0x65')];_0x163e4c=_0x56bda6[_0x39ff98][_0xd8e0('0x72')]?_[_0xd8e0('0x73')](_0x3cdc5f[_0x56bda6[_0x39ff98][_0xd8e0('0x72')]],'%s',_0x163e4c):_0x163e4c;_0x163e4c=_0x56bda6[_0x39ff98][_0xd8e0('0x74')]?_['replace'](_0x61e492[_0x56bda6[_0x39ff98]['format']],'%s',_0x163e4c):_0x163e4c;if(_0x56bda6[_0x39ff98][_0xd8e0('0x8a')]){_0x56a015[_0xd8e0('0x64')](_0x163e4c);}_0x56bda6[_0x39ff98][_0xd8e0('0x75')]&&_0x56a015[_0xd8e0('0x33')](_0x163e4c,_0x56bda6[_0x39ff98][_0xd8e0('0x75')]===_0xd8e0('0x8b')?![]:!![]);_0x56a015[_0xd8e0('0x65')](_0x163e4c,_0x56bda6[_0x39ff98]['alias']||_0x163e4c);}if(_0x138f59[_0xd8e0('0x77')]){_0x138f59[_0xd8e0('0x77')]=JSON[_0xd8e0('0x78')](_0x138f59[_0xd8e0('0x77')]);for(var _0x388feb=0x0;_0x388feb<_0x138f59[_0xd8e0('0x77')][_0xd8e0('0x41')];_0x388feb+=0x1){if(_0x138f59['joins'][_0x388feb][_0xd8e0('0x2a')]&&_[_0xd8e0('0x85')](_0x145785,_0x138f59['joins'][_0x388feb]['type'])&&_0x138f59[_0xd8e0('0x77')][_0x388feb][_0xd8e0('0x79')]&&_0x138f59[_0xd8e0('0x77')][_0x388feb][_0xd8e0('0x7a')]&&_0x138f59[_0xd8e0('0x77')][_0x388feb][_0xd8e0('0x7b')]){_0x56a015[_0x138f59[_0xd8e0('0x77')][_0x388feb][_0xd8e0('0x2a')]](_0x138f59[_0xd8e0('0x77')][_0x388feb][_0xd8e0('0x7a')],null,util['format'](_0xd8e0('0x8c'),_0x138f59[_0xd8e0('0x6f')],_0x138f59[_0xd8e0('0x77')][_0x388feb]['parentKey'],_0x138f59[_0xd8e0('0x77')][_0x388feb][_0xd8e0('0x7a')],_0x138f59['joins'][_0x388feb][_0xd8e0('0x7b')]));}}}if(_0x138f59[_0xd8e0('0x7c')]){_0x138f59['conditions']=JSON[_0xd8e0('0x78')](_0x138f59[_0xd8e0('0x7c')]);_0x56a015['where'](_0x233b9f(_0x138f59[_0xd8e0('0x7c')][_0xd8e0('0x64')]));}_0x445d8e=_0x56a015[_0xd8e0('0x7d')]();_0x56a015['limit'](_0x459f7b);_0x56a015['offset'](0x0);logger['debug']('Limited\x20Query:',_0x56a015[_0xd8e0('0x7f')]());return db[_0xd8e0('0x80')]['query'](_0x56a015[_0xd8e0('0x7f')](),{'type':db['sequelize'][_0xd8e0('0x81')][_0xd8e0('0x82')]});}})[_0xd8e0('0x1d')](function(){return{'sql':_0x445d8e[_0xd8e0('0x7f')]()};})[_0xd8e0('0x1d')](respondWithResult(_0x4e810c,null))[_0xd8e0('0x3d')](handleError(_0x4e810c,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 4c85c32..8ba13af 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 _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 +var _0x69f1=['exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./analyticCustomReport.attributes'];(function(_0x4f0456,_0x795c81){var _0x52caea=function(_0x23930b){while(--_0x23930b){_0x4f0456['push'](_0x4f0456['shift']());}};_0x52caea(++_0x795c81);}(_0x69f1,0x79));var _0x169f=function(_0x304864,_0x5a31da){_0x304864=_0x304864-0x0;var _0x526409=_0x69f1[_0x304864];return _0x526409;};'use strict';var _=require(_0x169f('0x0'));var util=require(_0x169f('0x1'));var logger=require('../../config/logger')(_0x169f('0x2'));var moment=require(_0x169f('0x3'));var BPromise=require(_0x169f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x169f('0x5'));var rimraf=require(_0x169f('0x6'));var config=require(_0x169f('0x7'));var attributes=require(_0x169f('0x8'));module[_0x169f('0x9')]=function(_0xeb48a6,_0x103207){return _0xeb48a6[_0x169f('0xa')](_0x169f('0xb'),attributes,{'tableName':_0x169f('0xc'),'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 cbbbd9c..fe96c0a 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 _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 +var _0x4b36=['info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x4b36,0xcb));var _0x64b3=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x4b36[_0x24f31b];return _0x488401;};'use strict';var _=require(_0x64b3('0x0'));var util=require('util');var moment=require(_0x64b3('0x1'));var BPromise=require(_0x64b3('0x2'));var rs=require(_0x64b3('0x3'));var fs=require('fs');var Redis=require(_0x64b3('0x4'));var db=require(_0x64b3('0x5'))['db'];var utils=require(_0x64b3('0x6'));var logger=require(_0x64b3('0x7'))(_0x64b3('0x8'));var config=require('../../config/environment');var jayson=require(_0x64b3('0x9'));var client=jayson[_0x64b3('0xa')][_0x64b3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4facfd,_0x2fa542,_0x1f86bc){return new BPromise(function(_0x1ad797,_0x58ba8b){return client[_0x64b3('0xc')](_0x4facfd,_0x1f86bc)[_0x64b3('0xd')](function(_0x2bb4f4){logger['info'](_0x64b3('0xe'),_0x2fa542,_0x64b3('0xf'));logger[_0x64b3('0x10')](_0x64b3('0x11'),_0x2fa542,_0x64b3('0xf'),JSON[_0x64b3('0x12')](_0x2bb4f4));if(_0x2bb4f4[_0x64b3('0x13')]){if(_0x2bb4f4[_0x64b3('0x13')][_0x64b3('0x14')]===0x1f4){logger[_0x64b3('0x13')](_0x64b3('0xe'),_0x2fa542,_0x2bb4f4[_0x64b3('0x13')][_0x64b3('0x15')]);return _0x58ba8b(_0x2bb4f4['error'][_0x64b3('0x15')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x2fa542,_0x2bb4f4['error'][_0x64b3('0x15')]);return _0x1ad797(_0x2bb4f4[_0x64b3('0x13')][_0x64b3('0x15')]);}else{logger[_0x64b3('0x16')](_0x64b3('0xe'),_0x2fa542,_0x64b3('0xf'));_0x1ad797(_0x2bb4f4[_0x64b3('0x17')][_0x64b3('0x15')]);}})[_0x64b3('0x18')](function(_0x62d4ac){logger[_0x64b3('0x13')](_0x64b3('0xe'),_0x2fa542,_0x62d4ac);_0x58ba8b(_0x62d4ac);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index ab5abb0..3a85f02 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 _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 +var _0x8adc=['/:id','isAuthenticated','/:id/preview','preview','run','/:id/query','query','post','create','update','delete','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x32c404,_0x41095d){var _0x82035f=function(_0x4fbf6f){while(--_0x4fbf6f){_0x32c404['push'](_0x32c404['shift']());}};_0x82035f(++_0x41095d);}(_0x8adc,0x13b));var _0xc8ad=function(_0x13e300,_0x1bcb41){_0x13e300=_0x13e300-0x0;var _0x5a3eea=_0x8adc[_0x13e300];return _0x5a3eea;};'use strict';var multer=require('multer');var util=require(_0xc8ad('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc8ad('0x1'));var router=express[_0xc8ad('0x2')]();var auth=require(_0xc8ad('0x3'));var interaction=require(_0xc8ad('0x4'));var config=require(_0xc8ad('0x5'));var controller=require('./analyticCustomReport.controller');router[_0xc8ad('0x6')]('/',auth['isAuthenticated'](),controller[_0xc8ad('0x7')]);router[_0xc8ad('0x6')](_0xc8ad('0x8'),auth[_0xc8ad('0x9')](),controller['show']);router[_0xc8ad('0x6')](_0xc8ad('0xa'),auth[_0xc8ad('0x9')](),controller[_0xc8ad('0xb')]);router[_0xc8ad('0x6')]('/:id/run',auth[_0xc8ad('0x9')](),controller[_0xc8ad('0xc')]);router['get'](_0xc8ad('0xd'),auth[_0xc8ad('0x9')](),controller[_0xc8ad('0xe')]);router[_0xc8ad('0xf')]('/',auth[_0xc8ad('0x9')](),controller[_0xc8ad('0x10')]);router['put'](_0xc8ad('0x8'),auth['isAuthenticated'](),controller[_0xc8ad('0x11')]);router[_0xc8ad('0x12')](_0xc8ad('0x8'),auth[_0xc8ad('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 173eb06..7e48df9 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 _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 +var _0x98bd=['sequelize','exports','STRING','TEXT'];(function(_0x221404,_0x5cf2b0){var _0x4fc2d3=function(_0x3e49d5){while(--_0x3e49d5){_0x221404['push'](_0x221404['shift']());}};_0x4fc2d3(++_0x5cf2b0);}(_0x98bd,0xf8));var _0xd98b=function(_0x568afc,_0x458749){_0x568afc=_0x568afc-0x0;var _0x24999b=_0x98bd[_0x568afc];return _0x24999b;};'use strict';var Sequelize=require(_0xd98b('0x0'));module[_0xd98b('0x1')]={'name':{'type':Sequelize[_0xd98b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd98b('0x2')]},'parent':{'type':Sequelize[_0xd98b('0x2')]},'table':{'type':Sequelize[_0xd98b('0x2')]},'conditions':{'type':Sequelize[_0xd98b('0x3')]},'joins':{'type':Sequelize[_0xd98b('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 9b91556..adedcfa 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 _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 +var _0x8232=['find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','parse','debug','toString','QueryTypes','SELECT','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','IS\x20NOT\x20NULL','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','DESC','offset','sequelize','No\x20available\x20data','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','startDate','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','savename','COUNT(*)','run','runReport','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','UNIX_TIMESTAMP(%s)','clone','Limited\x20Query:','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','dbH','end','status','json','count','limit','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','options','AnalyticDefaultReport','includeAll','findAll','rows','catch','show','params','include','create','user','role','Reports','UserProfileSection'];(function(_0x190912,_0x3595f0){var _0x4d6ddc=function(_0x418944){while(--_0x418944){_0x190912['push'](_0x190912['shift']());}};_0x4d6ddc(++_0x3595f0);}(_0x8232,0x19f));var _0x2823=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x8232[_0x28d18d];return _0x470640;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2823('0x0'));var rimraf=require(_0x2823('0x1'));var zipdir=require(_0x2823('0x2'));var jsonpatch=require(_0x2823('0x3'));var rp=require('request-promise');var moment=require(_0x2823('0x4'));var BPromise=require(_0x2823('0x5'));var Mustache=require('mustache');var util=require(_0x2823('0x6'));var path=require(_0x2823('0x7'));var sox=require(_0x2823('0x8'));var csv=require(_0x2823('0x9'));var ejs=require(_0x2823('0xa'));var fs=require('fs');var _=require(_0x2823('0xb'));var squel=require(_0x2823('0xc'));var crypto=require(_0x2823('0xd'));var jsforce=require(_0x2823('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2823('0x9'));var querystring=require(_0x2823('0xf'));var Papa=require(_0x2823('0x10'));var Redis=require(_0x2823('0x11'));var authService=require(_0x2823('0x12'));var qs=require(_0x2823('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2823('0x14'));var logger=require(_0x2823('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x2823('0x16'));var db=require(_0x2823('0x17'))['db'];var dbH=require(_0x2823('0x17'))[_0x2823('0x18')];function respondWithStatusCode(_0x40f8f1,_0x5dc089){_0x5dc089=_0x5dc089||0xcc;return function(_0x50666f){if(_0x50666f){return _0x40f8f1['sendStatus'](_0x5dc089);}return _0x40f8f1['status'](_0x5dc089)[_0x2823('0x19')]();};}function respondWithResult(_0x46846b,_0x2f8d04){_0x2f8d04=_0x2f8d04||0xc8;return function(_0x4bfb0e){if(_0x4bfb0e){return _0x46846b[_0x2823('0x1a')](_0x2f8d04)[_0x2823('0x1b')](_0x4bfb0e);}};}function respondWithFilteredResult(_0x46a909,_0x4c73bf){return function(_0x2eb638){if(_0x2eb638){var _0x204b32=_0x2eb638[_0x2823('0x1c')],_0x58ef56=_0x4c73bf['offset'],_0x500fb3=_0x4c73bf['offset']+_0x4c73bf[_0x2823('0x1d')],_0x27eefe;if(_0x500fb3>=_0x204b32){_0x500fb3=_0x204b32;_0x27eefe=0xc8;}else{_0x27eefe=0xce;}_0x46a909[_0x2823('0x1a')](_0x27eefe);return _0x46a909['set']('Content-Range',_0x58ef56+'-'+_0x500fb3+'/'+_0x204b32)[_0x2823('0x1b')](_0x2eb638);}return null;};}function patchUpdates(_0x155005){return function(_0x31e9f0){try{jsonpatch['apply'](_0x31e9f0,_0x155005,!![]);}catch(_0x2eb8a7){return BPromise[_0x2823('0x1e')](_0x2eb8a7);}return _0x31e9f0[_0x2823('0x1f')]();};}function saveUpdates(_0x169c77,_0x5455ec){return function(_0x51b2d4){if(_0x51b2d4){return _0x51b2d4[_0x2823('0x20')](_0x169c77)['then'](function(_0x33d5c8){return _0x33d5c8;});}return null;};}function removeEntity(_0x24334a,_0x4c8a72){return function(_0x2c1f88){if(_0x2c1f88){return _0x2c1f88['destroy']()[_0x2823('0x21')](function(){var _0x5295f6=_0x2c1f88[_0x2823('0x22')]({'plain':!![]});var _0x9ab20e=_0x2823('0x23');return db[_0x2823('0x24')][_0x2823('0x25')]({'where':{'type':_0x9ab20e,'resourceId':_0x5295f6['id']}})['then'](function(){return _0x2c1f88;});})['then'](function(){_0x24334a[_0x2823('0x1a')](0xcc)[_0x2823('0x19')]();});}};}function handleEntityNotFound(_0x2b9cab,_0x8aa7f6){return function(_0x387d48){if(!_0x387d48){_0x2b9cab['sendStatus'](0x194);}return _0x387d48;};}function handleError(_0x478ed0,_0x285dda){_0x285dda=_0x285dda||0x1f4;return function(_0x744227){logger[_0x2823('0x26')](_0x744227[_0x2823('0x27')]);if(_0x744227[_0x2823('0x28')]){delete _0x744227[_0x2823('0x28')];}_0x478ed0['status'](_0x285dda)[_0x2823('0x29')](_0x744227);};}exports['index']=function(_0x3a8d76,_0x33cac3){var _0x32e8ad={},_0x16d509={},_0xa22c4={'count':0x0,'rows':[]};var _0xeb805f=_[_0x2823('0x2a')](db['AnalyticDefaultReport'][_0x2823('0x2b')],function(_0x389ca1){return{'name':_0x389ca1[_0x2823('0x2c')],'type':_0x389ca1['type'][_0x2823('0x2d')]};});_0x16d509['model']=_[_0x2823('0x2a')](_0xeb805f,_0x2823('0x28'));_0x16d509[_0x2823('0x2e')]=_[_0x2823('0x2f')](_0x3a8d76[_0x2823('0x2e')]);_0x16d509['filters']=_['intersection'](_0x16d509[_0x2823('0x30')],_0x16d509['query']);_0x32e8ad['attributes']=_[_0x2823('0x31')](_0x16d509[_0x2823('0x30')],qs[_0x2823('0x32')](_0x3a8d76[_0x2823('0x2e')]['fields']));_0x32e8ad[_0x2823('0x33')]=_0x32e8ad['attributes'][_0x2823('0x34')]?_0x32e8ad['attributes']:_0x16d509[_0x2823('0x30')];if(!_0x3a8d76[_0x2823('0x2e')][_0x2823('0x35')](_0x2823('0x36'))){_0x32e8ad[_0x2823('0x1d')]=qs['limit'](_0x3a8d76[_0x2823('0x2e')][_0x2823('0x1d')]);_0x32e8ad['offset']=qs['offset'](_0x3a8d76[_0x2823('0x2e')]['offset']);}_0x32e8ad[_0x2823('0x37')]=qs[_0x2823('0x38')](_0x3a8d76[_0x2823('0x2e')][_0x2823('0x38')]);_0x32e8ad[_0x2823('0x39')]=qs[_0x2823('0x3a')](_[_0x2823('0x3b')](_0x3a8d76['query'],_0x16d509[_0x2823('0x3a')]),_0xeb805f);if(_0x3a8d76[_0x2823('0x2e')]['filter']){_0x32e8ad[_0x2823('0x39')]=_[_0x2823('0x3c')](_0x32e8ad['where'],{'$or':_[_0x2823('0x2a')](_0xeb805f,function(_0x2078b2){if(_0x2078b2[_0x2823('0x3d')]!==_0x2823('0x3e')){var _0x38c591={};_0x38c591[_0x2078b2[_0x2823('0x28')]]={'$like':'%'+_0x3a8d76[_0x2823('0x2e')]['filter']+'%'};return _0x38c591;}})});}_0x32e8ad=_[_0x2823('0x3c')]({},_0x32e8ad,_0x3a8d76[_0x2823('0x3f')]);var _0x3ae043={'where':_0x32e8ad[_0x2823('0x39')]};return db[_0x2823('0x40')][_0x2823('0x1c')](_0x3ae043)[_0x2823('0x21')](function(_0x120b67){_0xa22c4[_0x2823('0x1c')]=_0x120b67;if(_0x3a8d76[_0x2823('0x2e')][_0x2823('0x41')]){_0x32e8ad['include']=[{'all':!![]}];}return db[_0x2823('0x40')][_0x2823('0x42')](_0x32e8ad);})[_0x2823('0x21')](function(_0x18f853){_0xa22c4[_0x2823('0x43')]=_0x18f853;return _0xa22c4;})[_0x2823('0x21')](respondWithFilteredResult(_0x33cac3,_0x32e8ad))[_0x2823('0x44')](handleError(_0x33cac3,null));};exports[_0x2823('0x45')]=function(_0x58f1a8,_0x3db0da){var _0x4e525d={'raw':!![],'where':{'id':_0x58f1a8[_0x2823('0x46')]['id']}},_0x358716={};_0x358716['model']=_[_0x2823('0x2f')](db['AnalyticDefaultReport'][_0x2823('0x2b')]);_0x358716[_0x2823('0x2e')]=_[_0x2823('0x2f')](_0x58f1a8['query']);_0x358716[_0x2823('0x3a')]=_[_0x2823('0x31')](_0x358716[_0x2823('0x30')],_0x358716[_0x2823('0x2e')]);_0x4e525d[_0x2823('0x33')]=_[_0x2823('0x31')](_0x358716['model'],qs[_0x2823('0x32')](_0x58f1a8[_0x2823('0x2e')]['fields']));_0x4e525d[_0x2823('0x33')]=_0x4e525d[_0x2823('0x33')][_0x2823('0x34')]?_0x4e525d[_0x2823('0x33')]:_0x358716[_0x2823('0x30')];if(_0x58f1a8[_0x2823('0x2e')]['includeAll']){_0x4e525d[_0x2823('0x47')]=[{'all':!![]}];}_0x4e525d=_[_0x2823('0x3c')]({},_0x4e525d,_0x58f1a8[_0x2823('0x3f')]);return db['AnalyticDefaultReport']['find'](_0x4e525d)[_0x2823('0x21')](handleEntityNotFound(_0x3db0da,null))[_0x2823('0x21')](respondWithResult(_0x3db0da,null))[_0x2823('0x44')](handleError(_0x3db0da,null));};exports['create']=function(_0x3c31bb,_0x412722){return db[_0x2823('0x40')][_0x2823('0x48')](_0x3c31bb['body'],{})[_0x2823('0x21')](function(_0x2b391f){var _0x262bcf=_0x3c31bb[_0x2823('0x49')][_0x2823('0x22')]({'plain':!![]});if(!_0x262bcf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x262bcf[_0x2823('0x4a')]===_0x2823('0x49')){var _0x20bfc7=_0x2b391f[_0x2823('0x22')]({'plain':!![]});var _0x472759=_0x2823('0x4b');return db[_0x2823('0x4c')][_0x2823('0x4d')]({'where':{'name':_0x472759,'userProfileId':_0x262bcf[_0x2823('0x4e')]},'raw':!![]})['then'](function(_0x5c010c){if(_0x5c010c&&_0x5c010c[_0x2823('0x4f')]===0x0){return db[_0x2823('0x24')]['create']({'name':_0x20bfc7[_0x2823('0x28')],'resourceId':_0x20bfc7['id'],'type':_0x2823('0x23'),'sectionId':_0x5c010c['id']},{})['then'](function(){return _0x2b391f;});}else{return _0x2b391f;}})[_0x2823('0x44')](function(_0x5dbbcf){logger['error'](_0x2823('0x50'),_0x5dbbcf);throw _0x5dbbcf;});}return _0x2b391f;})['then'](respondWithResult(_0x412722,0xc9))[_0x2823('0x44')](handleError(_0x412722,null));};exports[_0x2823('0x20')]=function(_0x90f72f,_0x2ab438){if(_0x90f72f[_0x2823('0x51')]['id']){delete _0x90f72f[_0x2823('0x51')]['id'];}return db[_0x2823('0x40')][_0x2823('0x4d')]({'where':{'id':_0x90f72f[_0x2823('0x46')]['id']}})['then'](handleEntityNotFound(_0x2ab438,null))[_0x2823('0x21')](saveUpdates(_0x90f72f[_0x2823('0x51')],null))[_0x2823('0x21')](respondWithResult(_0x2ab438,null))[_0x2823('0x44')](handleError(_0x2ab438,null));};exports[_0x2823('0x25')]=function(_0x114849,_0x4d3521){return db[_0x2823('0x40')]['find']({'where':{'id':_0x114849[_0x2823('0x46')]['id']}})['then'](handleEntityNotFound(_0x4d3521,null))['then'](removeEntity(_0x4d3521,null))['catch'](handleError(_0x4d3521,null));};exports[_0x2823('0x52')]=function(_0x817b00,_0x5a57ec){var _0x35d6ed=0xa;var _0xcb4623=[_0x2823('0x53'),_0x2823('0x54'),_0x2823('0x55'),_0x2823('0x56')];var _0x4c92d7={'SUM':_0x2823('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x2823('0x58'),'MAX':_0x2823('0x59'),'MIN':'MIN(%s)','AVG':_0x2823('0x5a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x350845={'SEC_TO_TIME':_0x2823('0x5b'),'DATE':'DATE(%s)','HOUR':_0x2823('0x5c'),'ROUND':_0x2823('0x5d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2f10e8=function(_0x20c037){return!_[_0x2823('0x5e')]([_0x2823('0x5f'),'IS\x20NOT\x20NULL',_0x2823('0x60'),_0x2823('0x61')],_0x20c037);};var _0x32bdf7=function(_0x59ac77){if(!_0x59ac77||!_0x59ac77['rules']['length']){return'';}for(var _0x36bd15='(',_0x5dbbf8=0x0;_0x5dbbf8<_0x59ac77[_0x2823('0x62')]['length'];_0x5dbbf8+=0x1){_0x5dbbf8>0x0&&(_0x36bd15+='\x20'+_0x59ac77[_0x2823('0x63')]+'\x20');_0x36bd15+=_0x59ac77['rules'][_0x5dbbf8]['group']?_0x32bdf7(_0x59ac77['rules'][_0x5dbbf8][_0x2823('0x64')]):_0x59ac77[_0x2823('0x62')][_0x5dbbf8][_0x2823('0x65')]+'\x20'+_0x59ac77[_0x2823('0x62')][_0x5dbbf8]['condition']+(_0x2f10e8(_0x59ac77[_0x2823('0x62')][_0x5dbbf8][_0x2823('0x66')])?'\x20'+_0x59ac77[_0x2823('0x62')][_0x5dbbf8][_0x2823('0x67')]:'');}return _0x36bd15+')';};var _0xa6b798={'where':{'id':_0x817b00[_0x2823('0x46')]['id']}},_0x3dec3c,_0x322b37,_0x56a22b,_0x3b9ffd,_0x211759;_0xa6b798=_[_0x2823('0x3c')]({},_0xa6b798,_0x817b00['options']);return db[_0x2823('0x40')][_0x2823('0x4d')](_0xa6b798)['then'](function(_0x10bc59){if(_0x10bc59){_0x3dec3c=_0x10bc59;return _0x10bc59['getFields']();}return null;})[_0x2823('0x21')](function(_0x53b9da){if(_0x53b9da){if(!_0x53b9da[_0x2823('0x34')]){throw new db[(_0x2823('0x68'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x322b37=_0x53b9da;return db['AnalyticMetric'][_0x2823('0x42')]({'raw':!![]});}return null;})[_0x2823('0x21')](function(_0xe58dc1){if(_0xe58dc1){_0x56a22b=_[_0x2823('0x69')](_0xe58dc1,'id');var _0x275980;var _0x2a2e56=squel[_0x2823('0x6a')]();_0x2a2e56[_0x2823('0x6b')](_0x3dec3c[_0x2823('0x6c')]);for(var _0x32a2c5=0x0;_0x32a2c5<_0x322b37[_0x2823('0x34')];_0x32a2c5+=0x1){_0x275980=_0x322b37[_0x32a2c5]['MetricId']?_0x56a22b[_0x322b37[_0x32a2c5][_0x2823('0x6d')]][_0x2823('0x6e')]:_0x322b37[_0x32a2c5][_0x2823('0x65')];_0x275980=_0x322b37[_0x32a2c5][_0x2823('0x6f')]?_[_0x2823('0x70')](_0x4c92d7[_0x322b37[_0x32a2c5][_0x2823('0x6f')]],'%s',_0x275980):_0x275980;_0x275980=_0x322b37[_0x32a2c5][_0x2823('0x71')]?_[_0x2823('0x70')](_0x350845[_0x322b37[_0x32a2c5][_0x2823('0x71')]],'%s',_0x275980):_0x275980;if(_0x322b37[_0x32a2c5][_0x2823('0x72')]){_0x2a2e56[_0x2823('0x64')](_0x275980);}_0x322b37[_0x32a2c5]['orderBy']&&_0x2a2e56['order'](_0x275980,_0x322b37[_0x32a2c5][_0x2823('0x73')]==='DESC'?![]:!![]);_0x2a2e56[_0x2823('0x65')](_0x275980,_0x322b37[_0x32a2c5][_0x2823('0x74')]||_0x275980);}if(_0x3dec3c[_0x2823('0x75')]){_0x3dec3c[_0x2823('0x75')]=JSON['parse'](_0x3dec3c[_0x2823('0x75')]);for(var _0x26cb97=0x0;_0x26cb97<_0x3dec3c[_0x2823('0x75')][_0x2823('0x34')];_0x26cb97+=0x1){if(_0x3dec3c[_0x2823('0x75')][_0x26cb97][_0x2823('0x3d')]&&_[_0x2823('0x5e')](_0xcb4623,_0x3dec3c[_0x2823('0x75')][_0x26cb97][_0x2823('0x3d')])&&_0x3dec3c[_0x2823('0x75')][_0x26cb97]['parentKey']&&_0x3dec3c[_0x2823('0x75')][_0x26cb97][_0x2823('0x76')]&&_0x3dec3c[_0x2823('0x75')][_0x26cb97][_0x2823('0x77')]){_0x2a2e56[_0x3dec3c[_0x2823('0x75')][_0x26cb97][_0x2823('0x3d')]](_0x3dec3c[_0x2823('0x75')][_0x26cb97][_0x2823('0x76')],null,util['format'](_0x2823('0x78'),_0x3dec3c[_0x2823('0x6c')],_0x3dec3c['joins'][_0x26cb97][_0x2823('0x79')],_0x3dec3c['joins'][_0x26cb97]['foreignTable'],_0x3dec3c['joins'][_0x26cb97]['foreignKey']));}}}if(_0x3dec3c[_0x2823('0x7a')]){_0x3dec3c[_0x2823('0x7a')]=JSON[_0x2823('0x7b')](_0x3dec3c[_0x2823('0x7a')]);_0x2a2e56['where'](_0x32bdf7(_0x3dec3c[_0x2823('0x7a')]['group']));}_0x211759=_0x2a2e56['clone']();_0x2a2e56[_0x2823('0x1d')](_0x35d6ed);_0x2a2e56['offset'](0x0);logger[_0x2823('0x7c')]('Limited\x20Query:',_0x2a2e56['toString']());return db['sequelize'][_0x2823('0x2e')](_0x2a2e56[_0x2823('0x7d')](),{'type':db['sequelize'][_0x2823('0x7e')][_0x2823('0x7f')]});}})[_0x2823('0x21')](respondWithResult(_0x5a57ec,null))['catch'](handleError(_0x5a57ec,null));};function runReport(_0x472838,_0x4c5729,_0x6f11b){var _0x4d00c9=_0x4c5729['name'];var _0x415aeb=0xa;var _0x65883b=[_0x2823('0x53'),_0x2823('0x54'),_0x2823('0x55'),_0x2823('0x56')];var _0x35e96f={'SUM':_0x2823('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x2823('0x58'),'MAX':_0x2823('0x59'),'MIN':_0x2823('0x80'),'AVG':_0x2823('0x5a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x2823('0x81')};var _0x187525={'SEC_TO_TIME':_0x2823('0x5b'),'DATE':_0x2823('0x82'),'HOUR':_0x2823('0x5c'),'ROUND':_0x2823('0x5d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5e32c4=function(_0x11fe53){return!_[_0x2823('0x5e')]([_0x2823('0x5f'),_0x2823('0x83'),_0x2823('0x60'),'IS\x20NOT\x20EMPTY'],_0x11fe53);};var _0x1ab2a4=function(_0x4f287d){if(!_0x4f287d||!_0x4f287d[_0x2823('0x62')]['length']){return'';}for(var _0x36f68d='(',_0x3d36a6=0x0;_0x3d36a6<_0x4f287d[_0x2823('0x62')][_0x2823('0x34')];_0x3d36a6+=0x1){_0x3d36a6>0x0&&(_0x36f68d+='\x20'+_0x4f287d[_0x2823('0x63')]+'\x20');_0x36f68d+=_0x4f287d[_0x2823('0x62')][_0x3d36a6][_0x2823('0x64')]?_0x1ab2a4(_0x4f287d[_0x2823('0x62')][_0x3d36a6][_0x2823('0x64')]):_0x4f287d[_0x2823('0x62')][_0x3d36a6][_0x2823('0x65')]+'\x20'+_0x4f287d['rules'][_0x3d36a6]['condition']+(_0x5e32c4(_0x4f287d[_0x2823('0x62')][_0x3d36a6][_0x2823('0x66')])?'\x20'+_0x4f287d[_0x2823('0x62')][_0x3d36a6][_0x2823('0x67')]:'');}return _0x36f68d+')';};var _0x7bd8e={'where':{'id':_0x472838['id']}},_0x4aa4a3,_0x262350,_0x5415cc,_0x561545,_0x479f96;_0x7bd8e=_[_0x2823('0x3c')]({},_0x7bd8e,_0x6f11b);return db['AnalyticDefaultReport'][_0x2823('0x4d')](_0x7bd8e)[_0x2823('0x21')](function(_0x1af446){if(_0x1af446){_0x4aa4a3=_0x1af446;return _0x1af446[_0x2823('0x84')]();}return null;})['then'](function(_0x26b4e){if(_0x26b4e){if(!_0x26b4e['length']){throw new db[(_0x2823('0x68'))][(_0x2823('0x85'))](_0x2823('0x86'),0x193);}_0x262350=_0x26b4e;return db[_0x2823('0x87')][_0x2823('0x42')]({'raw':!![]});}return null;})['then'](function(_0x588178){if(_0x588178){_0x5415cc=_[_0x2823('0x69')](_0x588178,'id');var _0x28aa09;var _0x14da38=squel[_0x2823('0x6a')]();_0x14da38[_0x2823('0x6b')](_0x4aa4a3[_0x2823('0x6c')]);for(var _0x33565a=0x0;_0x33565a<_0x262350[_0x2823('0x34')];_0x33565a+=0x1){_0x28aa09=_0x262350[_0x33565a][_0x2823('0x6d')]?_0x5415cc[_0x262350[_0x33565a]['MetricId']][_0x2823('0x6e')]:_0x262350[_0x33565a]['field'];_0x28aa09=_0x262350[_0x33565a][_0x2823('0x6f')]?_[_0x2823('0x70')](_0x35e96f[_0x262350[_0x33565a][_0x2823('0x6f')]],'%s',_0x28aa09):_0x28aa09;_0x28aa09=_0x262350[_0x33565a][_0x2823('0x71')]?_[_0x2823('0x70')](_0x187525[_0x262350[_0x33565a][_0x2823('0x71')]],'%s',_0x28aa09):_0x28aa09;if(_0x262350[_0x33565a][_0x2823('0x72')]){_0x14da38[_0x2823('0x64')](_0x28aa09);}_0x262350[_0x33565a][_0x2823('0x73')]&&_0x14da38[_0x2823('0x37')](_0x28aa09,_0x262350[_0x33565a][_0x2823('0x73')]===_0x2823('0x88')?![]:!![]);_0x14da38[_0x2823('0x65')](_0x28aa09,_0x262350[_0x33565a][_0x2823('0x74')]||_0x28aa09);}if(_0x4aa4a3[_0x2823('0x75')]){_0x4aa4a3[_0x2823('0x75')]=JSON[_0x2823('0x7b')](_0x4aa4a3['joins']);for(var _0x1a9ba1=0x0;_0x1a9ba1<_0x4aa4a3['joins'][_0x2823('0x34')];_0x1a9ba1+=0x1){if(_0x4aa4a3[_0x2823('0x75')][_0x1a9ba1][_0x2823('0x3d')]&&_[_0x2823('0x5e')](_0x65883b,_0x4aa4a3['joins'][_0x1a9ba1][_0x2823('0x3d')])&&_0x4aa4a3[_0x2823('0x75')][_0x1a9ba1][_0x2823('0x79')]&&_0x4aa4a3[_0x2823('0x75')][_0x1a9ba1][_0x2823('0x76')]&&_0x4aa4a3[_0x2823('0x75')][_0x1a9ba1][_0x2823('0x77')]){_0x14da38[_0x4aa4a3['joins'][_0x1a9ba1]['type']](_0x4aa4a3[_0x2823('0x75')][_0x1a9ba1][_0x2823('0x76')],null,util[_0x2823('0x71')](_0x2823('0x78'),_0x4aa4a3['table'],_0x4aa4a3[_0x2823('0x75')][_0x1a9ba1][_0x2823('0x79')],_0x4aa4a3[_0x2823('0x75')][_0x1a9ba1][_0x2823('0x76')],_0x4aa4a3[_0x2823('0x75')][_0x1a9ba1][_0x2823('0x77')]));}}}if(_0x4aa4a3[_0x2823('0x7a')]){_0x4aa4a3[_0x2823('0x7a')]=JSON[_0x2823('0x7b')](_0x4aa4a3['conditions']);_0x14da38[_0x2823('0x39')](_0x1ab2a4(_0x4aa4a3[_0x2823('0x7a')]['group']));}_0x479f96=_0x14da38['clone']();_0x14da38[_0x2823('0x1d')](_0x415aeb);_0x14da38[_0x2823('0x89')](0x0);logger[_0x2823('0x7c')]('Limited\x20Query:',_0x14da38[_0x2823('0x7d')]());return db[_0x2823('0x8a')][_0x2823('0x2e')](_0x14da38[_0x2823('0x7d')](),{'type':db[_0x2823('0x8a')]['QueryTypes']['SELECT']});}})[_0x2823('0x21')](function(_0x532b78){if(!_0x532b78[_0x2823('0x34')]){throw new db[(_0x2823('0x68'))]['ValidationErrorItem'](_0x2823('0x8b'),0xcc);}if(_0x4c5729[_0x2823('0x8c')]==='web'){return null;}var _0x465660=_[_0x2823('0x3c')](_0x4c5729,{'name':_0x4c5729[_0x2823('0x8d')]||_0x4c5729['name']||_0x4aa4a3[_0x2823('0x28')],'basename':_0x4d00c9,'savename':util[_0x2823('0x71')](_0x2823('0x8e'),_0x4c5729[_0x2823('0x28')]||_0x4aa4a3[_0x2823('0x28')],require(_0x2823('0x8f'))[_0x2823('0x90')](0x4),_0x4c5729['output']||_0x2823('0x91')),'reportId':_0x4aa4a3['id'],'reportType':_0x2823('0x92')});return db['AnalyticExtractedReport'][_0x2823('0x48')](_0x465660,{'raw':!![]});})[_0x2823('0x21')](function(_0x5679a1){if(_0x4aa4a3[_0x2823('0x6c')]===_0x2823('0x93')){_0x479f96['where'](_0x4aa4a3[_0x2823('0x6c')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x4c5729[_0x2823('0x94')],_0x4c5729[_0x2823('0x95')]);}else{_0x479f96[_0x2823('0x39')](_0x4aa4a3['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4c5729[_0x2823('0x94')],_0x4c5729[_0x2823('0x95')]);}if(_0x5679a1){logger[_0x2823('0x96')](_0x2823('0x97'),_0x479f96['toString']());require(_0x2823('0x98'))[_0x2823('0x99')](path[_0x2823('0x53')](__dirname,_0x2823('0x9a'),_0x5679a1[_0x2823('0x8c')]),[_0x5679a1['id'],_0x479f96['toString'](),path[_0x2823('0x53')](__dirname,'../../files/reports',_0x5679a1[_0x2823('0x9b')]),_0x4d00c9]);return _0x5679a1;}else{var _0x56cfc5=squel[_0x2823('0x6a')]();_0x56cfc5[_0x2823('0x6b')]('('+_0x479f96['toString']()+')','countTable');_0x56cfc5[_0x2823('0x65')](_0x2823('0x9c'),_0x2823('0x1c'));_0x479f96[_0x2823('0x1d')](_0x4c5729[_0x2823('0x1d')]||_0x415aeb);_0x479f96['offset'](_0x4c5729[_0x2823('0x89')]||0x0);return dbH[_0x2823('0x8a')][_0x2823('0x2e')](_0x56cfc5['toString'](),{'type':dbH['sequelize'][_0x2823('0x7e')]['SELECT']})[_0x2823('0x21')](function(_0x1809e7){if(!_0x1809e7[_0x2823('0x34')]){_0x561545=0x0;}else{_0x561545=_0x1809e7[0x0][_0x2823('0x1c')]||0x0;}return dbH[_0x2823('0x8a')][_0x2823('0x2e')](_0x479f96['toString'](),{'type':dbH[_0x2823('0x8a')][_0x2823('0x7e')][_0x2823('0x7f')]});})['then'](function(_0x2cec5f){return{'rows':_0x2cec5f||[],'count':_0x561545};});}});}exports[_0x2823('0x9d')]=function(_0x178cca,_0x47aca5){return runReport(_0x178cca[_0x2823('0x46')],_0x178cca[_0x2823('0x2e')],_0x178cca[_0x2823('0x3f')])[_0x2823('0x21')](respondWithResult(_0x47aca5,null))[_0x2823('0x44')](handleError(_0x47aca5,null));};exports[_0x2823('0x9e')]=runReport;exports[_0x2823('0x2e')]=function(_0x31520c,_0x3f7920){var _0x2a3dc9=0xa;var _0x44e418=[_0x2823('0x53'),'left_join','right_join',_0x2823('0x56')];var _0x1b1733={'SUM':_0x2823('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x2823('0x59'),'MIN':_0x2823('0x80'),'AVG':_0x2823('0x5a'),'GROUP_CONCAT':_0x2823('0x9f'),'GROUP_CONCAT ASC':_0x2823('0xa0'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x55e604={'SEC_TO_TIME':_0x2823('0x5b'),'DATE':_0x2823('0x82'),'HOUR':'HOUR(%s)','ROUND':_0x2823('0x5d'),'UNIX_TIMESTAMP':_0x2823('0xa1')};var _0x5a0399=function(_0x16ecc4){return!_[_0x2823('0x5e')]([_0x2823('0x5f'),'IS\x20NOT\x20NULL',_0x2823('0x60'),_0x2823('0x61')],_0x16ecc4);};var _0x47d6e0=function(_0x3e417){if(!_0x3e417||!_0x3e417[_0x2823('0x62')][_0x2823('0x34')]){return'';}for(var _0x51278c='(',_0x473241=0x0;_0x473241<_0x3e417[_0x2823('0x62')]['length'];_0x473241+=0x1){_0x473241>0x0&&(_0x51278c+='\x20'+_0x3e417['operator']+'\x20');_0x51278c+=_0x3e417['rules'][_0x473241][_0x2823('0x64')]?_0x47d6e0(_0x3e417['rules'][_0x473241][_0x2823('0x64')]):_0x3e417[_0x2823('0x62')][_0x473241][_0x2823('0x65')]+'\x20'+_0x3e417[_0x2823('0x62')][_0x473241][_0x2823('0x66')]+(_0x5a0399(_0x3e417[_0x2823('0x62')][_0x473241][_0x2823('0x66')])?'\x20'+_0x3e417[_0x2823('0x62')][_0x473241][_0x2823('0x67')]:'');}return _0x51278c+')';};var _0x36c06b={'where':{'id':_0x31520c[_0x2823('0x46')]['id']}},_0xd8a6f0,_0x4813c8,_0xf9f00d,_0x151217,_0x1e44e4;_0x36c06b=_[_0x2823('0x3c')]({},_0x36c06b,_0x31520c['options']);return db['AnalyticDefaultReport'][_0x2823('0x4d')](_0x36c06b)[_0x2823('0x21')](function(_0x4e5c99){if(_0x4e5c99){_0xd8a6f0=_0x4e5c99;return _0x4e5c99[_0x2823('0x84')]();}return null;})[_0x2823('0x21')](function(_0x2b01f5){if(_0x2b01f5){if(!_0x2b01f5['length']){throw new db[(_0x2823('0x68'))][(_0x2823('0x85'))](_0x2823('0x86'),0x193);}_0x4813c8=_0x2b01f5;return db['AnalyticMetric'][_0x2823('0x42')]({'raw':!![]});}return null;})[_0x2823('0x21')](function(_0x2b535){if(_0x2b535){_0xf9f00d=_[_0x2823('0x69')](_0x2b535,'id');var _0x30ece0;var _0x3d9ab6=squel[_0x2823('0x6a')]();_0x3d9ab6[_0x2823('0x6b')](_0xd8a6f0[_0x2823('0x6c')]);for(var _0x560f9b=0x0;_0x560f9b<_0x4813c8[_0x2823('0x34')];_0x560f9b+=0x1){_0x30ece0=_0x4813c8[_0x560f9b][_0x2823('0x6d')]?_0xf9f00d[_0x4813c8[_0x560f9b][_0x2823('0x6d')]][_0x2823('0x6e')]:_0x4813c8[_0x560f9b][_0x2823('0x65')];_0x30ece0=_0x4813c8[_0x560f9b][_0x2823('0x6f')]?_['replace'](_0x1b1733[_0x4813c8[_0x560f9b][_0x2823('0x6f')]],'%s',_0x30ece0):_0x30ece0;_0x30ece0=_0x4813c8[_0x560f9b][_0x2823('0x71')]?_[_0x2823('0x70')](_0x55e604[_0x4813c8[_0x560f9b]['format']],'%s',_0x30ece0):_0x30ece0;if(_0x4813c8[_0x560f9b][_0x2823('0x72')]){_0x3d9ab6[_0x2823('0x64')](_0x30ece0);}_0x4813c8[_0x560f9b][_0x2823('0x73')]&&_0x3d9ab6['order'](_0x30ece0,_0x4813c8[_0x560f9b][_0x2823('0x73')]===_0x2823('0x88')?![]:!![]);_0x3d9ab6[_0x2823('0x65')](_0x30ece0,_0x4813c8[_0x560f9b][_0x2823('0x74')]||_0x30ece0);}if(_0xd8a6f0[_0x2823('0x75')]){_0xd8a6f0[_0x2823('0x75')]=JSON[_0x2823('0x7b')](_0xd8a6f0[_0x2823('0x75')]);for(var _0x272f97=0x0;_0x272f97<_0xd8a6f0[_0x2823('0x75')][_0x2823('0x34')];_0x272f97+=0x1){if(_0xd8a6f0[_0x2823('0x75')][_0x272f97]['type']&&_[_0x2823('0x5e')](_0x44e418,_0xd8a6f0['joins'][_0x272f97]['type'])&&_0xd8a6f0[_0x2823('0x75')][_0x272f97]['parentKey']&&_0xd8a6f0[_0x2823('0x75')][_0x272f97][_0x2823('0x76')]&&_0xd8a6f0[_0x2823('0x75')][_0x272f97][_0x2823('0x77')]){_0x3d9ab6[_0xd8a6f0[_0x2823('0x75')][_0x272f97]['type']](_0xd8a6f0['joins'][_0x272f97][_0x2823('0x76')],null,util[_0x2823('0x71')](_0x2823('0x78'),_0xd8a6f0[_0x2823('0x6c')],_0xd8a6f0[_0x2823('0x75')][_0x272f97][_0x2823('0x79')],_0xd8a6f0[_0x2823('0x75')][_0x272f97][_0x2823('0x76')],_0xd8a6f0[_0x2823('0x75')][_0x272f97]['foreignKey']));}}}if(_0xd8a6f0[_0x2823('0x7a')]){_0xd8a6f0[_0x2823('0x7a')]=JSON[_0x2823('0x7b')](_0xd8a6f0[_0x2823('0x7a')]);_0x3d9ab6[_0x2823('0x39')](_0x47d6e0(_0xd8a6f0['conditions'][_0x2823('0x64')]));}_0x1e44e4=_0x3d9ab6[_0x2823('0xa2')]();_0x3d9ab6[_0x2823('0x1d')](_0x2a3dc9);_0x3d9ab6['offset'](0x0);logger[_0x2823('0x7c')](_0x2823('0xa3'),_0x3d9ab6[_0x2823('0x7d')]());return db[_0x2823('0x8a')]['query'](_0x3d9ab6[_0x2823('0x7d')](),{'type':db[_0x2823('0x8a')][_0x2823('0x7e')]['SELECT']});}})[_0x2823('0x21')](function(){return{'sql':_0x1e44e4['toString']()};})['then'](respondWithResult(_0x3f7920,null))[_0x2823('0x44')](handleError(_0x3f7920,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 26cbc65..3dd34d2 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 _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 +var _0x94ff=['bluebird','request-promise','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment'];(function(_0x43b2b7,_0x5d7590){var _0x27c8ef=function(_0x2118d4){while(--_0x2118d4){_0x43b2b7['push'](_0x43b2b7['shift']());}};_0x27c8ef(++_0x5d7590);}(_0x94ff,0x181));var _0xf94f=function(_0x283bad,_0x30ec3d){_0x283bad=_0x283bad-0x0;var _0x6ec8dd=_0x94ff[_0x283bad];return _0x6ec8dd;};'use strict';var _=require(_0xf94f('0x0'));var util=require(_0xf94f('0x1'));var logger=require(_0xf94f('0x2'))(_0xf94f('0x3'));var moment=require(_0xf94f('0x4'));var BPromise=require(_0xf94f('0x5'));var rp=require(_0xf94f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf94f('0x7'));var config=require(_0xf94f('0x8'));var attributes=require(_0xf94f('0x9'));module[_0xf94f('0xa')]=function(_0x71edb,_0x1f3100){return _0x71edb['define'](_0xf94f('0xb'),attributes,{'tableName':_0xf94f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 6320c7e..e41aa1b 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 _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 +var _0x3013=['../../config/logger','rpc','../../config/environment','client','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x2d364e,_0x301c5e){var _0x1b9312=function(_0x1b05bb){while(--_0x1b05bb){_0x2d364e['push'](_0x2d364e['shift']());}};_0x1b9312(++_0x301c5e);}(_0x3013,0xea));var _0x3301=function(_0x2e6be0,_0x260a60){_0x2e6be0=_0x2e6be0-0x0;var _0x2c0ca9=_0x3013[_0x2e6be0];return _0x2c0ca9;};'use strict';var _=require(_0x3301('0x0'));var util=require(_0x3301('0x1'));var moment=require(_0x3301('0x2'));var BPromise=require(_0x3301('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3301('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3301('0x5'));var logger=require(_0x3301('0x6'))(_0x3301('0x7'));var config=require(_0x3301('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3301('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41dd5b,_0x3d7e08,_0x4299f9){return new BPromise(function(_0x1b1d66,_0x224cea){return client['request'](_0x41dd5b,_0x4299f9)[_0x3301('0xa')](function(_0x744189){logger[_0x3301('0xb')](_0x3301('0xc'),_0x3d7e08,_0x3301('0xd'));logger['debug'](_0x3301('0xe'),_0x3d7e08,_0x3301('0xd'),JSON[_0x3301('0xf')](_0x744189));if(_0x744189[_0x3301('0x10')]){if(_0x744189[_0x3301('0x10')][_0x3301('0x11')]===0x1f4){logger[_0x3301('0x10')](_0x3301('0xc'),_0x3d7e08,_0x744189[_0x3301('0x10')][_0x3301('0x12')]);return _0x224cea(_0x744189[_0x3301('0x10')][_0x3301('0x12')]);}logger[_0x3301('0x10')](_0x3301('0xc'),_0x3d7e08,_0x744189['error'][_0x3301('0x12')]);return _0x1b1d66(_0x744189[_0x3301('0x10')]['message']);}else{logger['info'](_0x3301('0xc'),_0x3d7e08,_0x3301('0xd'));_0x1b1d66(_0x744189['result'][_0x3301('0x12')]);}})[_0x3301('0x13')](function(_0x4a3915){logger[_0x3301('0x10')](_0x3301('0xc'),_0x3d7e08,_0x4a3915);_0x224cea(_0x4a3915);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 0b2c069..68d8744 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 _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 +var _0xc225=['index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','create','put','delete','destroy','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4e09a3,_0x34c0de){var _0x2a611f=function(_0x55c4d2){while(--_0x55c4d2){_0x4e09a3['push'](_0x4e09a3['shift']());}};_0x2a611f(++_0x34c0de);}(_0xc225,0x92));var _0x5c22=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xc225[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x5c22('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5c22('0x1'));var express=require('express');var router=express[_0x5c22('0x2')]();var auth=require(_0x5c22('0x3'));var interaction=require(_0x5c22('0x4'));var config=require(_0x5c22('0x5'));var controller=require('./analyticDefaultReport.controller');router[_0x5c22('0x6')]('/',auth[_0x5c22('0x7')](),controller[_0x5c22('0x8')]);router[_0x5c22('0x6')](_0x5c22('0x9'),auth['isAuthenticated'](),controller[_0x5c22('0xa')]);router[_0x5c22('0x6')](_0x5c22('0xb'),auth[_0x5c22('0x7')](),controller[_0x5c22('0xc')]);router[_0x5c22('0x6')](_0x5c22('0xd'),auth[_0x5c22('0x7')](),controller[_0x5c22('0xe')]);router[_0x5c22('0x6')](_0x5c22('0xf'),auth[_0x5c22('0x7')](),controller[_0x5c22('0x10')]);router['post']('/',auth[_0x5c22('0x7')](),controller[_0x5c22('0x11')]);router[_0x5c22('0x12')](_0x5c22('0x9'),auth[_0x5c22('0x7')](),controller['update']);router[_0x5c22('0x13')]('/:id',auth[_0x5c22('0x7')](),controller[_0x5c22('0x14')]);module[_0x5c22('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 7aa69e0..a400750 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 _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 +var _0x5078=['DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf'];(function(_0x2e5fd2,_0x4a7ad7){var _0x4b7242=function(_0x741123){while(--_0x741123){_0x2e5fd2['push'](_0x2e5fd2['shift']());}};_0x4b7242(++_0x4a7ad7);}(_0x5078,0x199));var _0x8507=function(_0x4bc4ab,_0x2c1bad){_0x4bc4ab=_0x4bc4ab-0x0;var _0x368014=_0x5078[_0x4bc4ab];return _0x368014;};'use strict';var Sequelize=require(_0x8507('0x0'));var moment=require(_0x8507('0x1'));module[_0x8507('0x2')]={'name':{'type':Sequelize[_0x8507('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x8507('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x8507('0x4')](_0x8507('0x5'),_0x8507('0x6'),'xlsx'),'allowNull':![],'defaultValue':_0x8507('0x5')},'savename':{'type':Sequelize[_0x8507('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x8507('0x7')]},'endDate':{'type':Sequelize[_0x8507('0x7')]},'status':{'type':Sequelize[_0x8507('0x3')],'defaultValue':_0x8507('0x8')},'type':{'type':Sequelize['ENUM'](_0x8507('0x9'),_0x8507('0xa')),'allowNull':![],'defaultValue':_0x8507('0x9')},'reportId':{'type':Sequelize[_0x8507('0xb')](0xb)[_0x8507('0xc')]},'reportType':{'type':Sequelize[_0x8507('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 708bb01..df7aec6 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 _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 +var _0xc79b=['fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','show','params','keys','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','join','%s.%s','output','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes'];(function(_0x2341c6,_0x3af092){var _0x54c34d=function(_0x3091f9){while(--_0x3091f9){_0x2341c6['push'](_0x2341c6['shift']());}};_0x54c34d(++_0x3af092);}(_0xc79b,0x8c));var _0xbc79=function(_0x97357,_0x515a33){_0x97357=_0x97357-0x0;var _0x1a9f76=_0xc79b[_0x97357];return _0x1a9f76;};'use strict';var pdf=require(_0xbc79('0x0'));var emlformat=require(_0xbc79('0x1'));var rimraf=require(_0xbc79('0x2'));var zipdir=require(_0xbc79('0x3'));var jsonpatch=require(_0xbc79('0x4'));var rp=require(_0xbc79('0x5'));var moment=require(_0xbc79('0x6'));var BPromise=require(_0xbc79('0x7'));var Mustache=require(_0xbc79('0x8'));var util=require('util');var path=require(_0xbc79('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbc79('0xa'));var fs=require('fs');var _=require(_0xbc79('0xb'));var squel=require('squel');var crypto=require(_0xbc79('0xc'));var jsforce=require(_0xbc79('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbc79('0xe'));var Redis=require(_0xbc79('0xf'));var authService=require(_0xbc79('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbc79('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbc79('0x12'))('api');var utils=require(_0xbc79('0x13'));var config=require('../../config/environment');var db=require(_0xbc79('0x14'))['db'];function respondWithStatusCode(_0x3f55c,_0x5290dc){_0x5290dc=_0x5290dc||0xcc;return function(_0xf5a22f){if(_0xf5a22f){return _0x3f55c[_0xbc79('0x15')](_0x5290dc);}return _0x3f55c['status'](_0x5290dc)[_0xbc79('0x16')]();};}function respondWithResult(_0x935586,_0x2af900){_0x2af900=_0x2af900||0xc8;return function(_0x4baeb2){if(_0x4baeb2){return _0x935586[_0xbc79('0x17')](_0x2af900)[_0xbc79('0x18')](_0x4baeb2);}};}function respondWithFilteredResult(_0x62a5c5,_0x3b8f5d){return function(_0x22a0b1){if(_0x22a0b1){var _0x1c2f89=_0x22a0b1[_0xbc79('0x19')],_0x22abc8=_0x3b8f5d[_0xbc79('0x1a')],_0xc16ffa=_0x3b8f5d[_0xbc79('0x1a')]+_0x3b8f5d[_0xbc79('0x1b')],_0x37c136;if(_0xc16ffa>=_0x1c2f89){_0xc16ffa=_0x1c2f89;_0x37c136=0xc8;}else{_0x37c136=0xce;}_0x62a5c5[_0xbc79('0x17')](_0x37c136);return _0x62a5c5[_0xbc79('0x1c')]('Content-Range',_0x22abc8+'-'+_0xc16ffa+'/'+_0x1c2f89)[_0xbc79('0x18')](_0x22a0b1);}return null;};}function patchUpdates(_0x18f941){return function(_0x3e2512){try{jsonpatch[_0xbc79('0x1d')](_0x3e2512,_0x18f941,!![]);}catch(_0xd4f7d1){return BPromise[_0xbc79('0x1e')](_0xd4f7d1);}return _0x3e2512[_0xbc79('0x1f')]();};}function saveUpdates(_0x31363d,_0x17ec8b){return function(_0x38dc68){if(_0x38dc68){return _0x38dc68[_0xbc79('0x20')](_0x31363d)[_0xbc79('0x21')](function(_0x4c41cc){return _0x4c41cc;});}return null;};}function removeEntity(_0x514921,_0x554ab1){return function(_0x51d828){if(_0x51d828){return _0x51d828[_0xbc79('0x22')]()[_0xbc79('0x21')](function(){var _0x5bc029=_0x51d828[_0xbc79('0x23')]({'plain':!![]});var _0x43b4d0=_0xbc79('0x24');return db[_0xbc79('0x25')]['destroy']({'where':{'type':_0x43b4d0,'resourceId':_0x5bc029['id']}})['then'](function(){return _0x51d828;});})[_0xbc79('0x21')](function(){_0x514921[_0xbc79('0x17')](0xcc)[_0xbc79('0x16')]();});}};}function handleEntityNotFound(_0x4cd0a6,_0x65dd4f){return function(_0x3c0a68){if(!_0x3c0a68){_0x4cd0a6[_0xbc79('0x15')](0x194);}return _0x3c0a68;};}function handleError(_0x27129b,_0x1ee7c9){_0x1ee7c9=_0x1ee7c9||0x1f4;return function(_0x4ac011){logger[_0xbc79('0x26')](_0x4ac011[_0xbc79('0x27')]);if(_0x4ac011[_0xbc79('0x28')]){delete _0x4ac011[_0xbc79('0x28')];}_0x27129b[_0xbc79('0x17')](_0x1ee7c9)[_0xbc79('0x29')](_0x4ac011);};}exports[_0xbc79('0x2a')]=function(_0x802b33,_0x6436bc){var _0x4a5293={},_0x5621b4={},_0x28e3ae={'count':0x0,'rows':[]};var _0x28fee0=_[_0xbc79('0x2b')](db[_0xbc79('0x2c')][_0xbc79('0x2d')],function(_0x209bb4){return{'name':_0x209bb4[_0xbc79('0x2e')],'type':_0x209bb4[_0xbc79('0x2f')][_0xbc79('0x30')]};});_0x5621b4[_0xbc79('0x31')]=_[_0xbc79('0x2b')](_0x28fee0,_0xbc79('0x28'));_0x5621b4[_0xbc79('0x32')]=_['keys'](_0x802b33[_0xbc79('0x32')]);_0x5621b4[_0xbc79('0x33')]=_[_0xbc79('0x34')](_0x5621b4[_0xbc79('0x31')],_0x5621b4[_0xbc79('0x32')]);_0x4a5293[_0xbc79('0x35')]=_[_0xbc79('0x34')](_0x5621b4[_0xbc79('0x31')],qs['fields'](_0x802b33[_0xbc79('0x32')][_0xbc79('0x36')]));_0x4a5293[_0xbc79('0x35')]=_0x4a5293[_0xbc79('0x35')]['length']?_0x4a5293['attributes']:_0x5621b4[_0xbc79('0x31')];if(!_0x802b33[_0xbc79('0x32')]['hasOwnProperty'](_0xbc79('0x37'))){_0x4a5293[_0xbc79('0x1b')]=qs[_0xbc79('0x1b')](_0x802b33[_0xbc79('0x32')]['limit']);_0x4a5293[_0xbc79('0x1a')]=qs['offset'](_0x802b33['query'][_0xbc79('0x1a')]);}_0x4a5293[_0xbc79('0x38')]=qs[_0xbc79('0x39')](_0x802b33['query'][_0xbc79('0x39')]);_0x4a5293[_0xbc79('0x3a')]=qs[_0xbc79('0x33')](_[_0xbc79('0x3b')](_0x802b33[_0xbc79('0x32')],_0x5621b4['filters']),_0x28fee0);if(_0x802b33['query'][_0xbc79('0x3c')]){_0x4a5293[_0xbc79('0x3a')]=_['merge'](_0x4a5293[_0xbc79('0x3a')],{'$or':_[_0xbc79('0x2b')](_0x28fee0,function(_0x53fd81){if(_0x53fd81[_0xbc79('0x2f')]!==_0xbc79('0x3d')){var _0x4141e0={};_0x4141e0[_0x53fd81['name']]={'$like':'%'+_0x802b33[_0xbc79('0x32')][_0xbc79('0x3c')]+'%'};return _0x4141e0;}})});}_0x4a5293=_[_0xbc79('0x3e')]({},_0x4a5293,_0x802b33[_0xbc79('0x3f')]);var _0x49321a={'where':_0x4a5293['where']};return db[_0xbc79('0x2c')][_0xbc79('0x19')](_0x49321a)['then'](function(_0x254f34){_0x28e3ae['count']=_0x254f34;if(_0x802b33[_0xbc79('0x32')]['includeAll']){_0x4a5293[_0xbc79('0x40')]=[{'all':!![]}];}return db[_0xbc79('0x2c')][_0xbc79('0x41')](_0x4a5293);})[_0xbc79('0x21')](function(_0x1a8e81){_0x28e3ae['rows']=_0x1a8e81;return _0x28e3ae;})[_0xbc79('0x21')](respondWithFilteredResult(_0x6436bc,_0x4a5293))[_0xbc79('0x42')](handleError(_0x6436bc,null));};exports[_0xbc79('0x43')]=function(_0x5617c8,_0x3c2605){var _0x37acfa={'raw':!![],'where':{'id':_0x5617c8[_0xbc79('0x44')]['id']}},_0x30de87={};_0x30de87[_0xbc79('0x31')]=_['keys'](db[_0xbc79('0x2c')][_0xbc79('0x2d')]);_0x30de87[_0xbc79('0x32')]=_[_0xbc79('0x45')](_0x5617c8[_0xbc79('0x32')]);_0x30de87['filters']=_[_0xbc79('0x34')](_0x30de87[_0xbc79('0x31')],_0x30de87[_0xbc79('0x32')]);_0x37acfa[_0xbc79('0x35')]=_[_0xbc79('0x34')](_0x30de87[_0xbc79('0x31')],qs[_0xbc79('0x36')](_0x5617c8[_0xbc79('0x32')]['fields']));_0x37acfa[_0xbc79('0x35')]=_0x37acfa[_0xbc79('0x35')][_0xbc79('0x46')]?_0x37acfa['attributes']:_0x30de87[_0xbc79('0x31')];if(_0x5617c8[_0xbc79('0x32')][_0xbc79('0x47')]){_0x37acfa[_0xbc79('0x40')]=[{'all':!![]}];}_0x37acfa=_[_0xbc79('0x3e')]({},_0x37acfa,_0x5617c8[_0xbc79('0x3f')]);return db['AnalyticExtractedReport'][_0xbc79('0x48')](_0x37acfa)[_0xbc79('0x21')](handleEntityNotFound(_0x3c2605,null))[_0xbc79('0x21')](respondWithResult(_0x3c2605,null))[_0xbc79('0x42')](handleError(_0x3c2605,null));};exports[_0xbc79('0x49')]=function(_0x351ceb,_0x421469){return db['AnalyticExtractedReport']['create'](_0x351ceb[_0xbc79('0x4a')],{})[_0xbc79('0x21')](function(_0x250d89){var _0x2894af=_0x351ceb[_0xbc79('0x4b')][_0xbc79('0x23')]({'plain':!![]});if(!_0x2894af)throw new Error(_0xbc79('0x4c'));if(_0x2894af[_0xbc79('0x4d')]===_0xbc79('0x4b')){var _0x3f1f8e=_0x250d89['get']({'plain':!![]});var _0x27bdb7=_0xbc79('0x24');return db[_0xbc79('0x4e')][_0xbc79('0x48')]({'where':{'name':_0x27bdb7,'userProfileId':_0x2894af[_0xbc79('0x4f')]},'raw':!![]})['then'](function(_0x224aa3){if(_0x224aa3&&_0x224aa3[_0xbc79('0x50')]===0x0){return db[_0xbc79('0x25')][_0xbc79('0x49')]({'name':_0x3f1f8e[_0xbc79('0x28')],'resourceId':_0x3f1f8e['id'],'type':_0x224aa3[_0xbc79('0x28')],'sectionId':_0x224aa3['id']},{})[_0xbc79('0x21')](function(){return _0x250d89;});}else{return _0x250d89;}})[_0xbc79('0x42')](function(_0x22e3dd){logger[_0xbc79('0x26')](_0xbc79('0x51'),_0x22e3dd);throw _0x22e3dd;});}return _0x250d89;})[_0xbc79('0x21')](respondWithResult(_0x421469,0xc9))[_0xbc79('0x42')](handleError(_0x421469,null));};exports[_0xbc79('0x20')]=function(_0x3d375f,_0x2789de){if(_0x3d375f[_0xbc79('0x4a')]['id']){delete _0x3d375f[_0xbc79('0x4a')]['id'];}return db[_0xbc79('0x2c')][_0xbc79('0x48')]({'where':{'id':_0x3d375f[_0xbc79('0x44')]['id']}})['then'](handleEntityNotFound(_0x2789de,null))[_0xbc79('0x21')](saveUpdates(_0x3d375f[_0xbc79('0x4a')],null))[_0xbc79('0x21')](respondWithResult(_0x2789de,null))[_0xbc79('0x42')](handleError(_0x2789de,null));};exports[_0xbc79('0x22')]=function(_0x1e2a63,_0x2f2fbb){return db[_0xbc79('0x2c')]['find']({'where':{'id':_0x1e2a63[_0xbc79('0x44')]['id']}})[_0xbc79('0x21')](handleEntityNotFound(_0x2f2fbb,null))['then'](removeEntity(_0x2f2fbb,null))[_0xbc79('0x42')](handleError(_0x2f2fbb,null));};exports[_0xbc79('0x52')]=function(_0x270be1,_0x1ec6c2,_0x15588e){return db['AnalyticExtractedReport'][_0xbc79('0x48')]({'where':{'id':_0x270be1[_0xbc79('0x44')]['id']},'attributes':[_0xbc79('0x28'),_0xbc79('0x53'),_0xbc79('0x54'),'output'],'raw':!![]})[_0xbc79('0x21')](handleEntityNotFound(_0x1ec6c2,null))[_0xbc79('0x21')](function(_0x45deec){if(_0x45deec){if(!fs['existsSync'](path['join'](config[_0xbc79('0x55')],_0xbc79('0x56'),_0x45deec['savename']))){throw new db['Sequelize'][(_0xbc79('0x57'))](_0xbc79('0x58'));}if(_0x270be1[_0xbc79('0x32')][_0xbc79('0x59')]){return _0x1ec6c2['sendStatus'](0xc8);}return _0x1ec6c2[_0xbc79('0x52')](path[_0xbc79('0x5a')](config[_0xbc79('0x55')],_0xbc79('0x56'),_0x45deec['savename']),util['format'](_0xbc79('0x5b'),_0x45deec[_0xbc79('0x53')]||_0x45deec[_0xbc79('0x28')],_0x45deec[_0xbc79('0x5c')]['toLowerCase']()));}})[_0xbc79('0x42')](handleError(_0x1ec6c2,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 3c2a34d..5cb5594 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 _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 +var _0x40eb=['define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports'];(function(_0x3b37df,_0x4e2a15){var _0x19a97e=function(_0x17d5d4){while(--_0x17d5d4){_0x3b37df['push'](_0x3b37df['shift']());}};_0x19a97e(++_0x4e2a15);}(_0x40eb,0x148));var _0xb40e=function(_0x37065a,_0xd1f059){_0x37065a=_0x37065a-0x0;var _0x293d11=_0x40eb[_0x37065a];return _0x293d11;};'use strict';var _=require(_0xb40e('0x0'));var util=require(_0xb40e('0x1'));var logger=require('../../config/logger')(_0xb40e('0x2'));var moment=require(_0xb40e('0x3'));var BPromise=require(_0xb40e('0x4'));var rp=require(_0xb40e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb40e('0x6'));var config=require(_0xb40e('0x7'));var attributes=require(_0xb40e('0x8'));module[_0xb40e('0x9')]=function(_0x91eafd,_0x1e5138){return _0x91eafd[_0xb40e('0xa')](_0xb40e('0xb'),attributes,{'tableName':_0xb40e('0xc'),'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 7f63b52..299517f 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 _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 +var _0xd8b3=['stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s'];(function(_0x4d3d1c,_0x50772d){var _0x359cb0=function(_0x3daf29){while(--_0x3daf29){_0x4d3d1c['push'](_0x4d3d1c['shift']());}};_0x359cb0(++_0x50772d);}(_0xd8b3,0x1be));var _0x3d8b=function(_0x2053ea,_0x1ab2d4){_0x2053ea=_0x2053ea-0x0;var _0x2232c4=_0xd8b3[_0x2053ea];return _0x2232c4;};'use strict';var _=require('lodash');var util=require(_0x3d8b('0x0'));var moment=require(_0x3d8b('0x1'));var BPromise=require('bluebird');var rs=require(_0x3d8b('0x2'));var fs=require('fs');var Redis=require(_0x3d8b('0x3'));var db=require(_0x3d8b('0x4'))['db'];var utils=require(_0x3d8b('0x5'));var logger=require(_0x3d8b('0x6'))(_0x3d8b('0x7'));var config=require(_0x3d8b('0x8'));var jayson=require(_0x3d8b('0x9'));var client=jayson['client'][_0x3d8b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc3ee4d,_0x317067,_0x32ccd4){return new BPromise(function(_0x519a4a,_0x1e95a4){return client[_0x3d8b('0xb')](_0xc3ee4d,_0x32ccd4)['then'](function(_0x224a2f){logger[_0x3d8b('0xc')](_0x3d8b('0xd'),_0x317067,_0x3d8b('0xe'));logger['debug'](_0x3d8b('0xf'),_0x317067,'request\x20sent',JSON[_0x3d8b('0x10')](_0x224a2f));if(_0x224a2f['error']){if(_0x224a2f[_0x3d8b('0x11')][_0x3d8b('0x12')]===0x1f4){logger[_0x3d8b('0x11')](_0x3d8b('0xd'),_0x317067,_0x224a2f['error'][_0x3d8b('0x13')]);return _0x1e95a4(_0x224a2f['error']['message']);}logger[_0x3d8b('0x11')](_0x3d8b('0xd'),_0x317067,_0x224a2f[_0x3d8b('0x11')][_0x3d8b('0x13')]);return _0x519a4a(_0x224a2f[_0x3d8b('0x11')][_0x3d8b('0x13')]);}else{logger[_0x3d8b('0xc')](_0x3d8b('0xd'),_0x317067,'request\x20sent');_0x519a4a(_0x224a2f[_0x3d8b('0x14')][_0x3d8b('0x13')]);}})[_0x3d8b('0x15')](function(_0x528192){logger[_0x3d8b('0x11')](_0x3d8b('0xd'),_0x317067,_0x528192);_0x1e95a4(_0x528192);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index c575d11..2e961de 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 _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 +var _0xe451=['update','delete','exports','multer','path','Router','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','show','/:id/download','download','/:id'];(function(_0x57a313,_0x4da781){var _0x287e45=function(_0x2f2678){while(--_0x2f2678){_0x57a313['push'](_0x57a313['shift']());}};_0x287e45(++_0x4da781);}(_0xe451,0x143));var _0x1e45=function(_0x58e994,_0xe962b4){_0x58e994=_0x58e994-0x0;var _0x196334=_0xe451[_0x58e994];return _0x196334;};'use strict';var multer=require(_0x1e45('0x0'));var util=require('util');var path=require(_0x1e45('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1e45('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x1e45('0x3'));var config=require(_0x1e45('0x4'));var controller=require(_0x1e45('0x5'));router[_0x1e45('0x6')]('/',auth[_0x1e45('0x7')](),controller[_0x1e45('0x8')]);router[_0x1e45('0x6')]('/:id',auth[_0x1e45('0x7')](),controller[_0x1e45('0x9')]);router[_0x1e45('0x6')](_0x1e45('0xa'),auth['isAuthenticated'](),controller[_0x1e45('0xb')]);router['post']('/',auth[_0x1e45('0x7')](),controller['create']);router['put'](_0x1e45('0xc'),auth[_0x1e45('0x7')](),controller[_0x1e45('0xd')]);router[_0x1e45('0xe')](_0x1e45('0xc'),auth[_0x1e45('0x7')](),controller['destroy']);module[_0x1e45('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 9327638..066e4d4 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 _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 +var _0x814b=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x1fd437,_0x2c0b47){var _0x40d9e6=function(_0x1668a1){while(--_0x1668a1){_0x1fd437['push'](_0x1fd437['shift']());}};_0x40d9e6(++_0x2c0b47);}(_0x814b,0x1a2));var _0xb814=function(_0x17a647,_0x2bbe12){_0x17a647=_0x17a647-0x0;var _0x219a38=_0x814b[_0x17a647];return _0x219a38;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'field':{'type':Sequelize[_0xb814('0x2')]},'alias':{'type':Sequelize[_0xb814('0x3')]},'function':{'type':Sequelize[_0xb814('0x3')]},'format':{'type':Sequelize[_0xb814('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xb814('0x3')]},'custom':{'type':Sequelize[_0xb814('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 614023b..cf40997 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 _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 +var _0x2bff=['fields','length','hasOwnProperty','offset','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','count','include','findAll','rows','catch','params','includeAll','find','create','body','bulkCreate','update','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','set','Content-Range','apply','reject','then','destroy','error','name','send','index','map','AnalyticFieldReport','rawAttributes','type','model','query','keys','intersection','attributes'];(function(_0x2ff497,_0x49f42f){var _0x3b9766=function(_0x3b8c21){while(--_0x3b8c21){_0x2ff497['push'](_0x2ff497['shift']());}};_0x3b9766(++_0x49f42f);}(_0x2bff,0x1b6));var _0xf2bf=function(_0x17c6ed,_0x1480d3){_0x17c6ed=_0x17c6ed-0x0;var _0x4ac84f=_0x2bff[_0x17c6ed];return _0x4ac84f;};'use strict';var pdf=require(_0xf2bf('0x0'));var emlformat=require(_0xf2bf('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf2bf('0x2'));var jsonpatch=require(_0xf2bf('0x3'));var rp=require(_0xf2bf('0x4'));var moment=require(_0xf2bf('0x5'));var BPromise=require(_0xf2bf('0x6'));var Mustache=require('mustache');var util=require(_0xf2bf('0x7'));var path=require('path');var sox=require(_0xf2bf('0x8'));var csv=require(_0xf2bf('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf2bf('0xa'));var squel=require(_0xf2bf('0xb'));var crypto=require(_0xf2bf('0xc'));var jsforce=require(_0xf2bf('0xd'));var deskjs=require(_0xf2bf('0xe'));var toCsv=require(_0xf2bf('0x9'));var querystring=require(_0xf2bf('0xf'));var Papa=require(_0xf2bf('0x10'));var Redis=require('ioredis');var authService=require(_0xf2bf('0x11'));var qs=require(_0xf2bf('0x12'));var as=require(_0xf2bf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf2bf('0x14'))('api');var utils=require(_0xf2bf('0x15'));var config=require(_0xf2bf('0x16'));var db=require(_0xf2bf('0x17'))['db'];function respondWithStatusCode(_0x318d26,_0xdfe717){_0xdfe717=_0xdfe717||0xcc;return function(_0x49d9fb){if(_0x49d9fb){return _0x318d26[_0xf2bf('0x18')](_0xdfe717);}return _0x318d26[_0xf2bf('0x19')](_0xdfe717)[_0xf2bf('0x1a')]();};}function respondWithResult(_0x1e0a2a,_0x48065d){_0x48065d=_0x48065d||0xc8;return function(_0x321ba2){if(_0x321ba2){return _0x1e0a2a['status'](_0x48065d)[_0xf2bf('0x1b')](_0x321ba2);}};}function respondWithFilteredResult(_0x1e6d63,_0x310b43){return function(_0x4ce487){if(_0x4ce487){var _0x458c33=_0x4ce487['count'],_0x5efa9e=_0x310b43['offset'],_0x46aa5e=_0x310b43['offset']+_0x310b43[_0xf2bf('0x1c')],_0x183681;if(_0x46aa5e>=_0x458c33){_0x46aa5e=_0x458c33;_0x183681=0xc8;}else{_0x183681=0xce;}_0x1e6d63['status'](_0x183681);return _0x1e6d63[_0xf2bf('0x1d')](_0xf2bf('0x1e'),_0x5efa9e+'-'+_0x46aa5e+'/'+_0x458c33)[_0xf2bf('0x1b')](_0x4ce487);}return null;};}function patchUpdates(_0x306eb3){return function(_0x856a84){try{jsonpatch[_0xf2bf('0x1f')](_0x856a84,_0x306eb3,!![]);}catch(_0x1b6614){return BPromise[_0xf2bf('0x20')](_0x1b6614);}return _0x856a84['save']();};}function saveUpdates(_0x267ac5,_0x49e8d3){return function(_0x1e04a2){if(_0x1e04a2){return _0x1e04a2['update'](_0x267ac5)[_0xf2bf('0x21')](function(_0x5cee87){return _0x5cee87;});}return null;};}function removeEntity(_0x19a27e,_0xb7c71e){return function(_0x2a083f){if(_0x2a083f){return _0x2a083f[_0xf2bf('0x22')]()[_0xf2bf('0x21')](function(){_0x19a27e[_0xf2bf('0x19')](0xcc)[_0xf2bf('0x1a')]();});}};}function handleEntityNotFound(_0x60905b,_0x28333d){return function(_0x40b5f0){if(!_0x40b5f0){_0x60905b[_0xf2bf('0x18')](0x194);}return _0x40b5f0;};}function handleError(_0x2d330d,_0xcb9486){_0xcb9486=_0xcb9486||0x1f4;return function(_0x136740){logger[_0xf2bf('0x23')](_0x136740['stack']);if(_0x136740['name']){delete _0x136740[_0xf2bf('0x24')];}_0x2d330d[_0xf2bf('0x19')](_0xcb9486)[_0xf2bf('0x25')](_0x136740);};}exports[_0xf2bf('0x26')]=function(_0x24a857,_0x469199){var _0x2c19dc={},_0xc865d5={},_0x2d3d19={'count':0x0,'rows':[]};var _0x1cf851=_[_0xf2bf('0x27')](db[_0xf2bf('0x28')][_0xf2bf('0x29')],function(_0x3e3c0a){return{'name':_0x3e3c0a['fieldName'],'type':_0x3e3c0a[_0xf2bf('0x2a')]['key']};});_0xc865d5[_0xf2bf('0x2b')]=_['map'](_0x1cf851,'name');_0xc865d5[_0xf2bf('0x2c')]=_[_0xf2bf('0x2d')](_0x24a857[_0xf2bf('0x2c')]);_0xc865d5['filters']=_[_0xf2bf('0x2e')](_0xc865d5[_0xf2bf('0x2b')],_0xc865d5['query']);_0x2c19dc[_0xf2bf('0x2f')]=_[_0xf2bf('0x2e')](_0xc865d5[_0xf2bf('0x2b')],qs[_0xf2bf('0x30')](_0x24a857['query'][_0xf2bf('0x30')]));_0x2c19dc[_0xf2bf('0x2f')]=_0x2c19dc[_0xf2bf('0x2f')][_0xf2bf('0x31')]?_0x2c19dc[_0xf2bf('0x2f')]:_0xc865d5['model'];if(!_0x24a857[_0xf2bf('0x2c')][_0xf2bf('0x32')]('nolimit')){_0x2c19dc[_0xf2bf('0x1c')]=qs[_0xf2bf('0x1c')](_0x24a857[_0xf2bf('0x2c')][_0xf2bf('0x1c')]);_0x2c19dc[_0xf2bf('0x33')]=qs[_0xf2bf('0x33')](_0x24a857[_0xf2bf('0x2c')][_0xf2bf('0x33')]);}_0x2c19dc[_0xf2bf('0x34')]=qs[_0xf2bf('0x35')](_0x24a857['query']['sort']);_0x2c19dc['where']=qs[_0xf2bf('0x36')](_[_0xf2bf('0x37')](_0x24a857[_0xf2bf('0x2c')],_0xc865d5[_0xf2bf('0x36')]),_0x1cf851);if(_0x24a857[_0xf2bf('0x2c')][_0xf2bf('0x38')]){_0x2c19dc[_0xf2bf('0x39')]=_[_0xf2bf('0x3a')](_0x2c19dc['where'],{'$or':_['map'](_0x1cf851,function(_0x545a0a){if(_0x545a0a[_0xf2bf('0x2a')]!==_0xf2bf('0x3b')){var _0x3145e6={};_0x3145e6[_0x545a0a['name']]={'$like':'%'+_0x24a857[_0xf2bf('0x2c')]['filter']+'%'};return _0x3145e6;}})});}_0x2c19dc=_[_0xf2bf('0x3a')]({},_0x2c19dc,_0x24a857[_0xf2bf('0x3c')]);var _0xe263cd={'where':_0x2c19dc[_0xf2bf('0x39')]};return db[_0xf2bf('0x28')][_0xf2bf('0x3d')](_0xe263cd)['then'](function(_0x25be3c){_0x2d3d19[_0xf2bf('0x3d')]=_0x25be3c;if(_0x24a857[_0xf2bf('0x2c')]['includeAll']){_0x2c19dc[_0xf2bf('0x3e')]=[{'all':!![]}];}return db[_0xf2bf('0x28')][_0xf2bf('0x3f')](_0x2c19dc);})[_0xf2bf('0x21')](function(_0xb6e3d0){_0x2d3d19[_0xf2bf('0x40')]=_0xb6e3d0;return _0x2d3d19;})[_0xf2bf('0x21')](respondWithFilteredResult(_0x469199,_0x2c19dc))[_0xf2bf('0x41')](handleError(_0x469199,null));};exports['show']=function(_0xe109f3,_0x48905d){var _0x47c868={'raw':![],'where':{'id':_0xe109f3[_0xf2bf('0x42')]['id']}},_0x12bfac={};_0x12bfac['model']=_['keys'](db[_0xf2bf('0x28')]['rawAttributes']);_0x12bfac[_0xf2bf('0x2c')]=_['keys'](_0xe109f3[_0xf2bf('0x2c')]);_0x12bfac['filters']=_[_0xf2bf('0x2e')](_0x12bfac[_0xf2bf('0x2b')],_0x12bfac[_0xf2bf('0x2c')]);_0x47c868[_0xf2bf('0x2f')]=_[_0xf2bf('0x2e')](_0x12bfac[_0xf2bf('0x2b')],qs[_0xf2bf('0x30')](_0xe109f3[_0xf2bf('0x2c')][_0xf2bf('0x30')]));_0x47c868[_0xf2bf('0x2f')]=_0x47c868[_0xf2bf('0x2f')][_0xf2bf('0x31')]?_0x47c868['attributes']:_0x12bfac['model'];if(_0xe109f3[_0xf2bf('0x2c')][_0xf2bf('0x43')]){_0x47c868[_0xf2bf('0x3e')]=[{'all':!![]}];}_0x47c868=_[_0xf2bf('0x3a')]({},_0x47c868,_0xe109f3[_0xf2bf('0x3c')]);return db[_0xf2bf('0x28')][_0xf2bf('0x44')](_0x47c868)[_0xf2bf('0x21')](handleEntityNotFound(_0x48905d,null))['then'](respondWithResult(_0x48905d,null))[_0xf2bf('0x41')](handleError(_0x48905d,null));};exports[_0xf2bf('0x45')]=function(_0x53c85a,_0x4d9fd3){return db[_0xf2bf('0x28')]['create'](_0x53c85a[_0xf2bf('0x46')],{})[_0xf2bf('0x21')](respondWithResult(_0x4d9fd3,0xc9))['catch'](handleError(_0x4d9fd3,null));};exports[_0xf2bf('0x47')]=function(_0x34c43e,_0x2f0675){return db[_0xf2bf('0x28')][_0xf2bf('0x47')](_0x34c43e[_0xf2bf('0x46')],{'raw':![],'individualHooks':!![]})[_0xf2bf('0x21')](respondWithResult(_0x2f0675,0xc9))[_0xf2bf('0x41')](handleError(_0x2f0675,null));};exports[_0xf2bf('0x48')]=function(_0x5c7c26,_0x102a7b){if(_0x5c7c26[_0xf2bf('0x46')]['id']){delete _0x5c7c26[_0xf2bf('0x46')]['id'];}return db[_0xf2bf('0x28')][_0xf2bf('0x44')]({'where':{'id':_0x5c7c26[_0xf2bf('0x42')]['id']}})[_0xf2bf('0x21')](handleEntityNotFound(_0x102a7b,null))['then'](saveUpdates(_0x5c7c26['body'],null))[_0xf2bf('0x21')](respondWithResult(_0x102a7b,null))[_0xf2bf('0x41')](handleError(_0x102a7b,null));};exports[_0xf2bf('0x22')]=function(_0x34220e,_0x41b095){return db[_0xf2bf('0x28')][_0xf2bf('0x44')]({'where':{'id':_0x34220e[_0xf2bf('0x42')]['id']}})[_0xf2bf('0x21')](handleEntityNotFound(_0x41b095,null))[_0xf2bf('0x21')](removeEntity(_0x41b095,null))[_0xf2bf('0x41')](handleError(_0x41b095,null));};exports[_0xf2bf('0x49')]=function(_0x134657,_0x37e507){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x134657[_0xf2bf('0x2c')][_0xf2bf('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0xf2bf('0x21')](respondWithResult(_0x37e507,0xcc))[_0xf2bf('0x41')](handleError(_0x37e507,null));};exports[_0xf2bf('0x4b')]=function(_0x4fa20a,_0x11a31d,_0x221421){return db[_0xf2bf('0x4c')][_0xf2bf('0x4d')]({'where':{'id':_0x4fa20a[_0xf2bf('0x42')]['id']}})[_0xf2bf('0x21')](handleEntityNotFound(_0x11a31d,null))[_0xf2bf('0x21')](function(_0x438e70){if(_0x438e70){return db[_0xf2bf('0x4e')][_0xf2bf('0x4f')](function(_0x21b801){return db[_0xf2bf('0x28')]['destroy']({'where':{'CustomReportId':_0x4fa20a[_0xf2bf('0x42')]['id']},'transaction':_0x21b801})['then'](function(_0x55ea02){var _0x148c14=_[_0xf2bf('0x27')](_0x4fa20a[_0xf2bf('0x46')],function(_0xa1e507){delete _0xa1e507['id'];_0xa1e507[_0xf2bf('0x50')]=_0x4fa20a['params']['id'];return _0xa1e507;});return db[_0xf2bf('0x28')][_0xf2bf('0x47')](_0x148c14,{'transaction':_0x21b801});});})[_0xf2bf('0x21')](function(){return db[_0xf2bf('0x28')]['findAll']({'where':{'CustomReportId':_0x4fa20a[_0xf2bf('0x42')]['id']}});});}})[_0xf2bf('0x21')](respondWithResult(_0x11a31d,null))['catch'](handleError(_0x11a31d,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index cbcb0dc..fd8a7fa 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 _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 +var _0xd6e2=['define','AnalyticFieldReport','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports'];(function(_0x19fe39,_0x47226c){var _0x5105c7=function(_0x18d280){while(--_0x18d280){_0x19fe39['push'](_0x19fe39['shift']());}};_0x5105c7(++_0x47226c);}(_0xd6e2,0x1c9));var _0x2d6e=function(_0x3d05d8,_0x35abf9){_0x3d05d8=_0x3d05d8-0x0;var _0x45df3e=_0xd6e2[_0x3d05d8];return _0x45df3e;};'use strict';var _=require(_0x2d6e('0x0'));var util=require(_0x2d6e('0x1'));var logger=require(_0x2d6e('0x2'))('api');var moment=require(_0x2d6e('0x3'));var BPromise=require(_0x2d6e('0x4'));var rp=require(_0x2d6e('0x5'));var fs=require('fs');var path=require(_0x2d6e('0x6'));var rimraf=require(_0x2d6e('0x7'));var config=require(_0x2d6e('0x8'));var attributes=require(_0x2d6e('0x9'));module[_0x2d6e('0xa')]=function(_0x2f6bd3,_0xd6a0e6){return _0x2f6bd3[_0x2d6e('0xb')](_0x2d6e('0xc'),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 d9b9456..56ab0a7 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 _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 +var _0x5770=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result'];(function(_0x190385,_0x55a652){var _0x435e42=function(_0x5488a8){while(--_0x5488a8){_0x190385['push'](_0x190385['shift']());}};_0x435e42(++_0x55a652);}(_0x5770,0xb4));var _0x0577=function(_0x401ba4,_0x380ce1){_0x401ba4=_0x401ba4-0x0;var _0x2b1614=_0x5770[_0x401ba4];return _0x2b1614;};'use strict';var _=require(_0x0577('0x0'));var util=require('util');var moment=require(_0x0577('0x1'));var BPromise=require('bluebird');var rs=require(_0x0577('0x2'));var fs=require('fs');var Redis=require(_0x0577('0x3'));var db=require(_0x0577('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0577('0x5'))(_0x0577('0x6'));var config=require(_0x0577('0x7'));var jayson=require(_0x0577('0x8'));var client=jayson['client'][_0x0577('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f5748,_0x585621,_0x282d19){return new BPromise(function(_0x49bded,_0x2beff4){return client[_0x0577('0xa')](_0x1f5748,_0x282d19)[_0x0577('0xb')](function(_0x198285){logger['info'](_0x0577('0xc'),_0x585621,_0x0577('0xd'));logger[_0x0577('0xe')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x585621,_0x0577('0xd'),JSON['stringify'](_0x198285));if(_0x198285[_0x0577('0xf')]){if(_0x198285[_0x0577('0xf')][_0x0577('0x10')]===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x585621,_0x198285['error'][_0x0577('0x11')]);return _0x2beff4(_0x198285['error']['message']);}logger[_0x0577('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x585621,_0x198285['error']['message']);return _0x49bded(_0x198285[_0x0577('0xf')]['message']);}else{logger[_0x0577('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x585621,_0x0577('0xd'));_0x49bded(_0x198285[_0x0577('0x13')][_0x0577('0x11')]);}})['catch'](function(_0x581d12){logger['error'](_0x0577('0xc'),_0x585621,_0x581d12);_0x2beff4(_0x581d12);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index fa727f6..3a74ef3 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 _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 +var _0xe14b=['addFields','update','delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','/create_many','bulkCreate'];(function(_0x454d24,_0x749d57){var _0x311b2c=function(_0x5b6392){while(--_0x5b6392){_0x454d24['push'](_0x454d24['shift']());}};_0x311b2c(++_0x749d57);}(_0xe14b,0x93));var _0xbe14=function(_0x3d55d1,_0x4de14a){_0x3d55d1=_0x3d55d1-0x0;var _0x27a5a0=_0xe14b[_0x3d55d1];return _0x27a5a0;};'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('./analyticFieldReport.controller');router[_0xbe14('0x5')]('/',auth[_0xbe14('0x6')](),controller[_0xbe14('0x7')]);router[_0xbe14('0x5')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x9')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xbe14('0xa')](_0xbe14('0xb'),auth[_0xbe14('0x6')](),controller[_0xbe14('0xc')]);router['post']('/:id/create_many',auth[_0xbe14('0x6')](),controller[_0xbe14('0xd')]);router['put'](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0xe')]);router[_0xbe14('0xf')](_0xbe14('0x10'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x11')]);router[_0xbe14('0xf')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x12')]);module[_0xbe14('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 70b1e66..580c842 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 _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 +var _0xe0dd=['sequelize','exports','name','STRING','TEXT'];(function(_0x9ae07c,_0x4cba11){var _0x837b1f=function(_0x4f30a7){while(--_0x4f30a7){_0x9ae07c['push'](_0x9ae07c['shift']());}};_0x837b1f(++_0x4cba11);}(_0xe0dd,0x163));var _0xde0d=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0xe0dd[_0x4d1ee9];return _0x9a5456;};'use strict';var Sequelize=require(_0xde0d('0x0'));module[_0xde0d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xde0d('0x2')},'table':{'type':Sequelize[_0xde0d('0x3')]},'metric':{'type':Sequelize[_0xde0d('0x4')]},'description':{'type':Sequelize[_0xde0d('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 92b7555..63a9241 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 _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 +var _0xd7a0=['fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','count','includeAll','include','findAll','catch','params','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','Content-Range','save','update','then','destroy','get','Metrics','UserProfileResource','end','error','stack','name','send','map','AnalyticMetric','rawAttributes'];(function(_0x3874ce,_0x307d61){var _0x1c71b8=function(_0x4a8837){while(--_0x4a8837){_0x3874ce['push'](_0x3874ce['shift']());}};_0x1c71b8(++_0x307d61);}(_0xd7a0,0x163));var _0x0d7a=function(_0x8eab8e,_0x5a21f6){_0x8eab8e=_0x8eab8e-0x0;var _0x43574f=_0xd7a0[_0x8eab8e];return _0x43574f;};'use strict';var pdf=require(_0x0d7a('0x0'));var emlformat=require(_0x0d7a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0d7a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0d7a('0x3'));var moment=require(_0x0d7a('0x4'));var BPromise=require(_0x0d7a('0x5'));var Mustache=require(_0x0d7a('0x6'));var util=require(_0x0d7a('0x7'));var path=require('path');var sox=require(_0x0d7a('0x8'));var csv=require(_0x0d7a('0x9'));var ejs=require(_0x0d7a('0xa'));var fs=require('fs');var _=require(_0x0d7a('0xb'));var squel=require(_0x0d7a('0xc'));var crypto=require(_0x0d7a('0xd'));var jsforce=require(_0x0d7a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0d7a('0x9'));var querystring=require(_0x0d7a('0xf'));var Papa=require(_0x0d7a('0x10'));var Redis=require(_0x0d7a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0d7a('0x12'));var as=require(_0x0d7a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d7a('0x14'))(_0x0d7a('0x15'));var utils=require(_0x0d7a('0x16'));var config=require(_0x0d7a('0x17'));var db=require(_0x0d7a('0x18'))['db'];function respondWithStatusCode(_0x4fe358,_0x5432bb){_0x5432bb=_0x5432bb||0xcc;return function(_0x30b43e){if(_0x30b43e){return _0x4fe358[_0x0d7a('0x19')](_0x5432bb);}return _0x4fe358[_0x0d7a('0x1a')](_0x5432bb)['end']();};}function respondWithResult(_0x2f2449,_0x4d2c9d){_0x4d2c9d=_0x4d2c9d||0xc8;return function(_0x51b844){if(_0x51b844){return _0x2f2449[_0x0d7a('0x1a')](_0x4d2c9d)['json'](_0x51b844);}};}function respondWithFilteredResult(_0x42f5b0,_0x84d9a4){return function(_0xfd77c){if(_0xfd77c){var _0x1a06b1=_0xfd77c['count'],_0x4bb62c=_0x84d9a4[_0x0d7a('0x1b')],_0x1999d7=_0x84d9a4[_0x0d7a('0x1b')]+_0x84d9a4[_0x0d7a('0x1c')],_0x5f5c18;if(_0x1999d7>=_0x1a06b1){_0x1999d7=_0x1a06b1;_0x5f5c18=0xc8;}else{_0x5f5c18=0xce;}_0x42f5b0[_0x0d7a('0x1a')](_0x5f5c18);return _0x42f5b0['set'](_0x0d7a('0x1d'),_0x4bb62c+'-'+_0x1999d7+'/'+_0x1a06b1)['json'](_0xfd77c);}return null;};}function patchUpdates(_0x569285){return function(_0x4e7ec4){try{jsonpatch['apply'](_0x4e7ec4,_0x569285,!![]);}catch(_0x3a55c6){return BPromise['reject'](_0x3a55c6);}return _0x4e7ec4[_0x0d7a('0x1e')]();};}function saveUpdates(_0x2264c3,_0x4c997f){return function(_0x884472){if(_0x884472){return _0x884472[_0x0d7a('0x1f')](_0x2264c3)[_0x0d7a('0x20')](function(_0x1b0dd8){return _0x1b0dd8;});}return null;};}function removeEntity(_0x542a24,_0x4291b8){return function(_0x2c11b6){if(_0x2c11b6){return _0x2c11b6[_0x0d7a('0x21')]()['then'](function(){var _0x5437d7=_0x2c11b6[_0x0d7a('0x22')]({'plain':!![]});var _0xbd4e67=_0x0d7a('0x23');return db[_0x0d7a('0x24')][_0x0d7a('0x21')]({'where':{'type':_0xbd4e67,'resourceId':_0x5437d7['id']}})['then'](function(){return _0x2c11b6;});})[_0x0d7a('0x20')](function(){_0x542a24[_0x0d7a('0x1a')](0xcc)[_0x0d7a('0x25')]();});}};}function handleEntityNotFound(_0x34a258,_0x53fe77){return function(_0x59dc3a){if(!_0x59dc3a){_0x34a258[_0x0d7a('0x19')](0x194);}return _0x59dc3a;};}function handleError(_0x2d34fe,_0x760faa){_0x760faa=_0x760faa||0x1f4;return function(_0x2815f9){logger[_0x0d7a('0x26')](_0x2815f9[_0x0d7a('0x27')]);if(_0x2815f9[_0x0d7a('0x28')]){delete _0x2815f9[_0x0d7a('0x28')];}_0x2d34fe['status'](_0x760faa)[_0x0d7a('0x29')](_0x2815f9);};}exports['index']=function(_0x33ce6c,_0x18f651){var _0x365924={},_0x1ca942={},_0x2035a0={'count':0x0,'rows':[]};var _0x5791b4=_[_0x0d7a('0x2a')](db[_0x0d7a('0x2b')][_0x0d7a('0x2c')],function(_0x5b8be9){return{'name':_0x5b8be9[_0x0d7a('0x2d')],'type':_0x5b8be9[_0x0d7a('0x2e')]['key']};});_0x1ca942[_0x0d7a('0x2f')]=_[_0x0d7a('0x2a')](_0x5791b4,_0x0d7a('0x28'));_0x1ca942['query']=_[_0x0d7a('0x30')](_0x33ce6c['query']);_0x1ca942[_0x0d7a('0x31')]=_[_0x0d7a('0x32')](_0x1ca942['model'],_0x1ca942[_0x0d7a('0x33')]);_0x365924[_0x0d7a('0x34')]=_[_0x0d7a('0x32')](_0x1ca942[_0x0d7a('0x2f')],qs[_0x0d7a('0x35')](_0x33ce6c[_0x0d7a('0x33')][_0x0d7a('0x35')]));_0x365924['attributes']=_0x365924[_0x0d7a('0x34')][_0x0d7a('0x36')]?_0x365924['attributes']:_0x1ca942[_0x0d7a('0x2f')];if(!_0x33ce6c['query']['hasOwnProperty'](_0x0d7a('0x37'))){_0x365924[_0x0d7a('0x1c')]=qs[_0x0d7a('0x1c')](_0x33ce6c['query'][_0x0d7a('0x1c')]);_0x365924[_0x0d7a('0x1b')]=qs[_0x0d7a('0x1b')](_0x33ce6c[_0x0d7a('0x33')][_0x0d7a('0x1b')]);}_0x365924[_0x0d7a('0x38')]=qs[_0x0d7a('0x39')](_0x33ce6c[_0x0d7a('0x33')][_0x0d7a('0x39')]);_0x365924[_0x0d7a('0x3a')]=qs[_0x0d7a('0x31')](_[_0x0d7a('0x3b')](_0x33ce6c[_0x0d7a('0x33')],_0x1ca942['filters']),_0x5791b4);if(_0x33ce6c['query'][_0x0d7a('0x3c')]){_0x365924[_0x0d7a('0x3a')]=_['merge'](_0x365924[_0x0d7a('0x3a')],{'$or':_[_0x0d7a('0x2a')](_0x5791b4,function(_0x5d1ff8){if(_0x5d1ff8[_0x0d7a('0x2e')]!==_0x0d7a('0x3d')){var _0x4d1987={};_0x4d1987[_0x5d1ff8[_0x0d7a('0x28')]]={'$like':'%'+_0x33ce6c['query'][_0x0d7a('0x3c')]+'%'};return _0x4d1987;}})});}_0x365924=_['merge']({},_0x365924,_0x33ce6c['options']);var _0xafc2d0={'where':_0x365924['where']};return db['AnalyticMetric'][_0x0d7a('0x3e')](_0xafc2d0)[_0x0d7a('0x20')](function(_0x322d2b){_0x2035a0['count']=_0x322d2b;if(_0x33ce6c[_0x0d7a('0x33')][_0x0d7a('0x3f')]){_0x365924[_0x0d7a('0x40')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x0d7a('0x41')](_0x365924);})[_0x0d7a('0x20')](function(_0x524712){_0x2035a0['rows']=_0x524712;return _0x2035a0;})[_0x0d7a('0x20')](respondWithFilteredResult(_0x18f651,_0x365924))[_0x0d7a('0x42')](handleError(_0x18f651,null));};exports['show']=function(_0x1ee972,_0x13b4a3){var _0x2b52f7={'raw':!![],'where':{'id':_0x1ee972[_0x0d7a('0x43')]['id']}},_0x422f99={};_0x422f99[_0x0d7a('0x2f')]=_[_0x0d7a('0x30')](db[_0x0d7a('0x2b')][_0x0d7a('0x2c')]);_0x422f99[_0x0d7a('0x33')]=_[_0x0d7a('0x30')](_0x1ee972[_0x0d7a('0x33')]);_0x422f99[_0x0d7a('0x31')]=_[_0x0d7a('0x32')](_0x422f99[_0x0d7a('0x2f')],_0x422f99[_0x0d7a('0x33')]);_0x2b52f7['attributes']=_[_0x0d7a('0x32')](_0x422f99[_0x0d7a('0x2f')],qs['fields'](_0x1ee972['query']['fields']));_0x2b52f7[_0x0d7a('0x34')]=_0x2b52f7[_0x0d7a('0x34')][_0x0d7a('0x36')]?_0x2b52f7['attributes']:_0x422f99[_0x0d7a('0x2f')];if(_0x1ee972[_0x0d7a('0x33')][_0x0d7a('0x3f')]){_0x2b52f7['include']=[{'all':!![]}];}_0x2b52f7=_[_0x0d7a('0x44')]({},_0x2b52f7,_0x1ee972[_0x0d7a('0x45')]);return db[_0x0d7a('0x2b')][_0x0d7a('0x46')](_0x2b52f7)[_0x0d7a('0x20')](handleEntityNotFound(_0x13b4a3,null))[_0x0d7a('0x20')](respondWithResult(_0x13b4a3,null))['catch'](handleError(_0x13b4a3,null));};exports[_0x0d7a('0x47')]=function(_0x4ec6d0,_0x47c1fe){return db[_0x0d7a('0x2b')][_0x0d7a('0x47')](_0x4ec6d0[_0x0d7a('0x48')],{})[_0x0d7a('0x20')](function(_0x240fb8){var _0x538827=_0x4ec6d0[_0x0d7a('0x49')][_0x0d7a('0x22')]({'plain':!![]});if(!_0x538827)throw new Error(_0x0d7a('0x4a'));if(_0x538827[_0x0d7a('0x4b')]==='user'){var _0x11fb70=_0x240fb8[_0x0d7a('0x22')]({'plain':!![]});var _0x40a0d8=_0x0d7a('0x23');return db[_0x0d7a('0x4c')][_0x0d7a('0x46')]({'where':{'name':_0x40a0d8,'userProfileId':_0x538827[_0x0d7a('0x4d')]},'raw':!![]})['then'](function(_0x13637d){if(_0x13637d&&_0x13637d[_0x0d7a('0x4e')]===0x0){return db[_0x0d7a('0x24')][_0x0d7a('0x47')]({'name':_0x11fb70['name'],'resourceId':_0x11fb70['id'],'type':_0x13637d[_0x0d7a('0x28')],'sectionId':_0x13637d['id']},{})[_0x0d7a('0x20')](function(){return _0x240fb8;});}else{return _0x240fb8;}})[_0x0d7a('0x42')](function(_0xf6629e){logger[_0x0d7a('0x26')](_0x0d7a('0x4f'),_0xf6629e);throw _0xf6629e;});}return _0x240fb8;})[_0x0d7a('0x20')](respondWithResult(_0x47c1fe,0xc9))[_0x0d7a('0x42')](handleError(_0x47c1fe,null));};exports[_0x0d7a('0x1f')]=function(_0x4a8861,_0x134ba8){if(_0x4a8861[_0x0d7a('0x48')]['id']){delete _0x4a8861[_0x0d7a('0x48')]['id'];}return db['AnalyticMetric'][_0x0d7a('0x46')]({'where':{'id':_0x4a8861[_0x0d7a('0x43')]['id']}})[_0x0d7a('0x20')](handleEntityNotFound(_0x134ba8,null))[_0x0d7a('0x20')](saveUpdates(_0x4a8861[_0x0d7a('0x48')],null))[_0x0d7a('0x20')](respondWithResult(_0x134ba8,null))[_0x0d7a('0x42')](handleError(_0x134ba8,null));};exports[_0x0d7a('0x21')]=function(_0x174271,_0x48398d){return db[_0x0d7a('0x2b')][_0x0d7a('0x46')]({'where':{'id':_0x174271['params']['id']}})['then'](handleEntityNotFound(_0x48398d,null))[_0x0d7a('0x20')](removeEntity(_0x48398d,null))[_0x0d7a('0x42')](handleError(_0x48398d,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index f0240f2..4f86547 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 _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 +var _0x67ed=['bluebird','path','rimraf','../../config/environment','./analyticMetric.attributes','define','util','../../config/logger','api','moment'];(function(_0x527770,_0x2c5048){var _0x58dfbc=function(_0x7f2ea1){while(--_0x7f2ea1){_0x527770['push'](_0x527770['shift']());}};_0x58dfbc(++_0x2c5048);}(_0x67ed,0xba));var _0xd67e=function(_0x5bb745,_0x7e5420){_0x5bb745=_0x5bb745-0x0;var _0x22082e=_0x67ed[_0x5bb745];return _0x22082e;};'use strict';var _=require('lodash');var util=require(_0xd67e('0x0'));var logger=require(_0xd67e('0x1'))(_0xd67e('0x2'));var moment=require(_0xd67e('0x3'));var BPromise=require(_0xd67e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd67e('0x5'));var rimraf=require(_0xd67e('0x6'));var config=require(_0xd67e('0x7'));var attributes=require(_0xd67e('0x8'));module['exports']=function(_0x1255b6,_0x18b91b){return _0x1255b6[_0xd67e('0x9')]('AnalyticMetric',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 c7c3a1a..2020943 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 _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 +var _0xf4bb=['code','message','AnalyticMetric,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','then','info','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0xf4bb,0xf6));var _0xbf4b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xf4bb[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xbf4b('0x0'));var util=require(_0xbf4b('0x1'));var moment=require(_0xbf4b('0x2'));var BPromise=require(_0xbf4b('0x3'));var rs=require(_0xbf4b('0x4'));var fs=require('fs');var Redis=require(_0xbf4b('0x5'));var db=require(_0xbf4b('0x6'))['db'];var utils=require(_0xbf4b('0x7'));var logger=require('../../config/logger')(_0xbf4b('0x8'));var config=require(_0xbf4b('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbf4b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x170c6b,_0x372325,_0xac01c9){return new BPromise(function(_0x1103a8,_0x1f86b8){return client['request'](_0x170c6b,_0xac01c9)[_0xbf4b('0xb')](function(_0x436a1d){logger[_0xbf4b('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x372325,'request\x20sent');logger[_0xbf4b('0xd')](_0xbf4b('0xe'),_0x372325,_0xbf4b('0xf'),JSON[_0xbf4b('0x10')](_0x436a1d));if(_0x436a1d[_0xbf4b('0x11')]){if(_0x436a1d[_0xbf4b('0x11')][_0xbf4b('0x12')]===0x1f4){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x372325,_0x436a1d[_0xbf4b('0x11')][_0xbf4b('0x13')]);return _0x1f86b8(_0x436a1d[_0xbf4b('0x11')][_0xbf4b('0x13')]);}logger[_0xbf4b('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x372325,_0x436a1d[_0xbf4b('0x11')]['message']);return _0x1103a8(_0x436a1d[_0xbf4b('0x11')][_0xbf4b('0x13')]);}else{logger['info'](_0xbf4b('0x14'),_0x372325,_0xbf4b('0xf'));_0x1103a8(_0x436a1d['result'][_0xbf4b('0x13')]);}})[_0xbf4b('0x15')](function(_0x23b747){logger[_0xbf4b('0x11')](_0xbf4b('0x14'),_0x372325,_0x23b747);_0x1f86b8(_0x23b747);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 55495d1..9d28aba 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 _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 +var _0x4137=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','/:id','show','create','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x165563,_0x382703){var _0x1c72a9=function(_0x27e64c){while(--_0x27e64c){_0x165563['push'](_0x165563['shift']());}};_0x1c72a9(++_0x382703);}(_0x4137,0xf8));var _0x7413=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4137[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var auth=require(_0x7413('0x6'));var interaction=require(_0x7413('0x7'));var config=require(_0x7413('0x8'));var controller=require(_0x7413('0x9'));router[_0x7413('0xa')]('/',auth[_0x7413('0xb')](),controller['index']);router[_0x7413('0xa')](_0x7413('0xc'),auth[_0x7413('0xb')](),controller[_0x7413('0xd')]);router['post']('/',auth[_0x7413('0xb')](),controller[_0x7413('0xe')]);router['put'](_0x7413('0xc'),auth[_0x7413('0xb')](),controller['update']);router[_0x7413('0xf')](_0x7413('0xc'),auth[_0x7413('0xb')](),controller[_0x7413('0x10')]);module[_0x7413('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index d26aa0a..4290de7 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 _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 +var _0x5502=['TEXT','sequelize'];(function(_0x3df223,_0x1740fc){var _0x562d11=function(_0x343009){while(--_0x343009){_0x3df223['push'](_0x3df223['shift']());}};_0x562d11(++_0x1740fc);}(_0x5502,0x133));var _0x2550=function(_0x1c2acb,_0x106166){_0x1c2acb=_0x1c2acb-0x0;var _0x3e2cd6=_0x5502[_0x1c2acb];return _0x3e2cd6;};'use strict';var Sequelize=require(_0x2550('0x0'));module['exports']={'tree':{'type':Sequelize[_0x2550('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 7797c03..fdca73c 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 _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 +var _0xad6b=['options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','update','destroy','then','sendStatus','error','stack','name','send','AnalyticTreeReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','map'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xad6b,0x113));var _0xbad6=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xad6b[_0x4ff09b];return _0x3f5c2e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbad6('0x0'));var rimraf=require(_0xbad6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbad6('0x2'));var rp=require(_0xbad6('0x3'));var moment=require(_0xbad6('0x4'));var BPromise=require(_0xbad6('0x5'));var Mustache=require(_0xbad6('0x6'));var util=require('util');var path=require(_0xbad6('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xbad6('0x8'));var squel=require('squel');var crypto=require(_0xbad6('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbad6('0xa'));var querystring=require(_0xbad6('0xb'));var Papa=require(_0xbad6('0xc'));var Redis=require(_0xbad6('0xd'));var authService=require(_0xbad6('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbad6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbad6('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xbad6('0x11'));var db=require(_0xbad6('0x12'))['db'];function respondWithStatusCode(_0x444b63,_0x2d9580){_0x2d9580=_0x2d9580||0xcc;return function(_0x484ea9){if(_0x484ea9){return _0x444b63['sendStatus'](_0x2d9580);}return _0x444b63[_0xbad6('0x13')](_0x2d9580)[_0xbad6('0x14')]();};}function respondWithResult(_0x5b9c31,_0x1fd2ab){_0x1fd2ab=_0x1fd2ab||0xc8;return function(_0x77f00a){if(_0x77f00a){return _0x5b9c31[_0xbad6('0x13')](_0x1fd2ab)[_0xbad6('0x15')](_0x77f00a);}};}function respondWithFilteredResult(_0x567a1c,_0x5a33ca){return function(_0x28ddfa){if(_0x28ddfa){var _0x5ec1d6=_0x28ddfa[_0xbad6('0x16')],_0x464d55=_0x5a33ca[_0xbad6('0x17')],_0x339cba=_0x5a33ca[_0xbad6('0x17')]+_0x5a33ca[_0xbad6('0x18')],_0xd6599f;if(_0x339cba>=_0x5ec1d6){_0x339cba=_0x5ec1d6;_0xd6599f=0xc8;}else{_0xd6599f=0xce;}_0x567a1c[_0xbad6('0x13')](_0xd6599f);return _0x567a1c[_0xbad6('0x19')](_0xbad6('0x1a'),_0x464d55+'-'+_0x339cba+'/'+_0x5ec1d6)[_0xbad6('0x15')](_0x28ddfa);}return null;};}function patchUpdates(_0xae8c97){return function(_0x1bb97a){try{jsonpatch[_0xbad6('0x1b')](_0x1bb97a,_0xae8c97,!![]);}catch(_0x4001f0){return BPromise['reject'](_0x4001f0);}return _0x1bb97a['save']();};}function saveUpdates(_0x5241c4,_0x4c96c8){return function(_0x41c4a4){if(_0x41c4a4){return _0x41c4a4[_0xbad6('0x1c')](_0x5241c4)['then'](function(_0x1a39d8){return _0x1a39d8;});}return null;};}function removeEntity(_0x3056d6,_0x2a5501){return function(_0x518ce1){if(_0x518ce1){return _0x518ce1[_0xbad6('0x1d')]()[_0xbad6('0x1e')](function(){_0x3056d6['status'](0xcc)[_0xbad6('0x14')]();});}};}function handleEntityNotFound(_0xf145ee,_0x7cc8c){return function(_0x5aa9ca){if(!_0x5aa9ca){_0xf145ee[_0xbad6('0x1f')](0x194);}return _0x5aa9ca;};}function handleError(_0x51c27b,_0x2f504d){_0x2f504d=_0x2f504d||0x1f4;return function(_0x4329bd){logger[_0xbad6('0x20')](_0x4329bd[_0xbad6('0x21')]);if(_0x4329bd[_0xbad6('0x22')]){delete _0x4329bd[_0xbad6('0x22')];}_0x51c27b['status'](_0x2f504d)[_0xbad6('0x23')](_0x4329bd);};}exports['index']=function(_0x547718,_0x18cace){var _0x4bc543={},_0x403813={},_0x54efd8={'count':0x0,'rows':[]};var _0x295aec=_['map'](db[_0xbad6('0x24')][_0xbad6('0x25')],function(_0x10cc58){return{'name':_0x10cc58[_0xbad6('0x26')],'type':_0x10cc58[_0xbad6('0x27')]['key']};});_0x403813[_0xbad6('0x28')]=_['map'](_0x295aec,_0xbad6('0x22'));_0x403813['query']=_[_0xbad6('0x29')](_0x547718[_0xbad6('0x2a')]);_0x403813[_0xbad6('0x2b')]=_[_0xbad6('0x2c')](_0x403813['model'],_0x403813['query']);_0x4bc543[_0xbad6('0x2d')]=_[_0xbad6('0x2c')](_0x403813[_0xbad6('0x28')],qs['fields'](_0x547718['query'][_0xbad6('0x2e')]));_0x4bc543['attributes']=_0x4bc543['attributes'][_0xbad6('0x2f')]?_0x4bc543[_0xbad6('0x2d')]:_0x403813['model'];if(!_0x547718[_0xbad6('0x2a')]['hasOwnProperty']('nolimit')){_0x4bc543[_0xbad6('0x18')]=qs['limit'](_0x547718[_0xbad6('0x2a')][_0xbad6('0x18')]);_0x4bc543[_0xbad6('0x17')]=qs[_0xbad6('0x17')](_0x547718[_0xbad6('0x2a')][_0xbad6('0x17')]);}_0x4bc543[_0xbad6('0x30')]=qs[_0xbad6('0x31')](_0x547718[_0xbad6('0x2a')][_0xbad6('0x31')]);_0x4bc543[_0xbad6('0x32')]=qs[_0xbad6('0x2b')](_[_0xbad6('0x33')](_0x547718['query'],_0x403813[_0xbad6('0x2b')]),_0x295aec);if(_0x547718[_0xbad6('0x2a')][_0xbad6('0x34')]){_0x4bc543[_0xbad6('0x32')]=_[_0xbad6('0x35')](_0x4bc543[_0xbad6('0x32')],{'$or':_[_0xbad6('0x36')](_0x295aec,function(_0x1baa70){if(_0x1baa70['type']!=='VIRTUAL'){var _0x8240f8={};_0x8240f8[_0x1baa70['name']]={'$like':'%'+_0x547718['query'][_0xbad6('0x34')]+'%'};return _0x8240f8;}})});}_0x4bc543=_[_0xbad6('0x35')]({},_0x4bc543,_0x547718[_0xbad6('0x37')]);var _0x34d327={'where':_0x4bc543[_0xbad6('0x32')]};return db['AnalyticTreeReport'][_0xbad6('0x16')](_0x34d327)[_0xbad6('0x1e')](function(_0x5e833b){_0x54efd8[_0xbad6('0x16')]=_0x5e833b;if(_0x547718[_0xbad6('0x2a')][_0xbad6('0x38')]){_0x4bc543[_0xbad6('0x39')]=[{'all':!![]}];}return db[_0xbad6('0x24')][_0xbad6('0x3a')](_0x4bc543);})['then'](function(_0x78b7e0){_0x54efd8[_0xbad6('0x3b')]=_0x78b7e0;return _0x54efd8;})[_0xbad6('0x1e')](respondWithFilteredResult(_0x18cace,_0x4bc543))[_0xbad6('0x3c')](handleError(_0x18cace,null));};exports[_0xbad6('0x3d')]=function(_0x227fb,_0x3d0980){var _0x2fb816={'raw':!![],'where':{'id':_0x227fb[_0xbad6('0x3e')]['id']}},_0x293d97={};_0x293d97[_0xbad6('0x28')]=_[_0xbad6('0x29')](db['AnalyticTreeReport'][_0xbad6('0x25')]);_0x293d97[_0xbad6('0x2a')]=_[_0xbad6('0x29')](_0x227fb[_0xbad6('0x2a')]);_0x293d97[_0xbad6('0x2b')]=_[_0xbad6('0x2c')](_0x293d97[_0xbad6('0x28')],_0x293d97['query']);_0x2fb816[_0xbad6('0x2d')]=_[_0xbad6('0x2c')](_0x293d97[_0xbad6('0x28')],qs[_0xbad6('0x2e')](_0x227fb[_0xbad6('0x2a')][_0xbad6('0x2e')]));_0x2fb816[_0xbad6('0x2d')]=_0x2fb816[_0xbad6('0x2d')][_0xbad6('0x2f')]?_0x2fb816[_0xbad6('0x2d')]:_0x293d97[_0xbad6('0x28')];if(_0x227fb[_0xbad6('0x2a')][_0xbad6('0x38')]){_0x2fb816['include']=[{'all':!![]}];}_0x2fb816=_['merge']({},_0x2fb816,_0x227fb[_0xbad6('0x37')]);return db['AnalyticTreeReport'][_0xbad6('0x3f')](_0x2fb816)[_0xbad6('0x1e')](handleEntityNotFound(_0x3d0980,null))['then'](respondWithResult(_0x3d0980,null))[_0xbad6('0x3c')](handleError(_0x3d0980,null));};exports['create']=function(_0x11b96e,_0x1529cf){return db[_0xbad6('0x24')][_0xbad6('0x40')](_0x11b96e[_0xbad6('0x41')],{})['then'](respondWithResult(_0x1529cf,0xc9))[_0xbad6('0x3c')](handleError(_0x1529cf,null));};exports[_0xbad6('0x1c')]=function(_0x60edbe,_0x32caba){if(_0x60edbe['body']['id']){delete _0x60edbe['body']['id'];}return db[_0xbad6('0x24')][_0xbad6('0x3f')]({'where':{'id':_0x60edbe['params']['id']}})[_0xbad6('0x1e')](handleEntityNotFound(_0x32caba,null))['then'](saveUpdates(_0x60edbe['body'],null))[_0xbad6('0x1e')](respondWithResult(_0x32caba,null))[_0xbad6('0x3c')](handleError(_0x32caba,null));};exports[_0xbad6('0x1d')]=function(_0x5b3b38,_0x1f513f){return db['AnalyticTreeReport'][_0xbad6('0x3f')]({'where':{'id':_0x5b3b38[_0xbad6('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1f513f,null))[_0xbad6('0x1e')](removeEntity(_0x1f513f,null))[_0xbad6('0x3c')](handleError(_0x1f513f,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 3eeb3af..e89afc2 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 _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 +var _0x5bc1=['../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xfea8e0,_0x38fd6c){var _0x14f501=function(_0x249b87){while(--_0x249b87){_0xfea8e0['push'](_0xfea8e0['shift']());}};_0x14f501(++_0x38fd6c);}(_0x5bc1,0xb5));var _0x15bc=function(_0x54b8e9,_0x55a1e3){_0x54b8e9=_0x54b8e9-0x0;var _0x26fbbf=_0x5bc1[_0x54b8e9];return _0x26fbbf;};'use strict';var _=require('lodash');var util=require(_0x15bc('0x0'));var logger=require(_0x15bc('0x1'))(_0x15bc('0x2'));var moment=require(_0x15bc('0x3'));var BPromise=require(_0x15bc('0x4'));var rp=require(_0x15bc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x15bc('0x6'));var attributes=require(_0x15bc('0x7'));module[_0x15bc('0x8')]=function(_0x52766f,_0x109031){return _0x52766f['define'](_0x15bc('0x9'),attributes,{'tableName':_0x15bc('0xa'),'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 28805de..e2eabdf 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 _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 +var _0xbcf1=['request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s'];(function(_0x1c4c24,_0x154c79){var _0x1c033d=function(_0x155415){while(--_0x155415){_0x1c4c24['push'](_0x1c4c24['shift']());}};_0x1c033d(++_0x154c79);}(_0xbcf1,0x1f3));var _0x1bcf=function(_0x35fb56,_0x5dadff){_0x35fb56=_0x35fb56-0x0;var _0x2fd52c=_0xbcf1[_0x35fb56];return _0x2fd52c;};'use strict';var _=require('lodash');var util=require(_0x1bcf('0x0'));var moment=require(_0x1bcf('0x1'));var BPromise=require(_0x1bcf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1bcf('0x3'))['db'];var utils=require(_0x1bcf('0x4'));var logger=require(_0x1bcf('0x5'))('rpc');var config=require(_0x1bcf('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1bcf('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x57db25,_0x18b44b,_0x388dfe){return new BPromise(function(_0x214c6d,_0xb6dcfc){return client['request'](_0x57db25,_0x388dfe)[_0x1bcf('0x8')](function(_0x139758){logger['info'](_0x1bcf('0x9'),_0x18b44b,'request\x20sent');logger['debug'](_0x1bcf('0xa'),_0x18b44b,_0x1bcf('0xb'),JSON[_0x1bcf('0xc')](_0x139758));if(_0x139758[_0x1bcf('0xd')]){if(_0x139758[_0x1bcf('0xd')][_0x1bcf('0xe')]===0x1f4){logger[_0x1bcf('0xd')](_0x1bcf('0x9'),_0x18b44b,_0x139758[_0x1bcf('0xd')]['message']);return _0xb6dcfc(_0x139758[_0x1bcf('0xd')]['message']);}logger[_0x1bcf('0xd')](_0x1bcf('0x9'),_0x18b44b,_0x139758[_0x1bcf('0xd')][_0x1bcf('0xf')]);return _0x214c6d(_0x139758[_0x1bcf('0xd')][_0x1bcf('0xf')]);}else{logger['info'](_0x1bcf('0x9'),_0x18b44b,_0x1bcf('0xb'));_0x214c6d(_0x139758['result'][_0x1bcf('0xf')]);}})[_0x1bcf('0x10')](function(_0x48eae0){logger['error'](_0x1bcf('0x9'),_0x18b44b,_0x48eae0);_0xb6dcfc(_0x48eae0);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 2300f98..7118aa2 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 _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 +var _0x197a=['multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x197a,0x198));var _0xa197=function(_0x3b18e6,_0x35e310){_0x3b18e6=_0x3b18e6-0x0;var _0xaf05b7=_0x197a[_0x3b18e6];return _0xaf05b7;};'use strict';var multer=require(_0xa197('0x0'));var util=require(_0xa197('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa197('0x2'));var router=express[_0xa197('0x3')]();var auth=require(_0xa197('0x4'));var interaction=require(_0xa197('0x5'));var config=require(_0xa197('0x6'));var controller=require(_0xa197('0x7'));router[_0xa197('0x8')]('/',auth[_0xa197('0x9')](),controller[_0xa197('0xa')]);router['get'](_0xa197('0xb'),auth['isAuthenticated'](),controller[_0xa197('0xc')]);router[_0xa197('0xd')]('/',auth[_0xa197('0x9')](),controller[_0xa197('0xe')]);router[_0xa197('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xa197('0x9')](),controller[_0xa197('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 0930ca7..e7e6655 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 _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 +var _0xb5e2=['STRING','exports'];(function(_0x5e4079,_0x1a8dd6){var _0x5a4df1=function(_0xb9d3a7){while(--_0xb9d3a7){_0x5e4079['push'](_0x5e4079['shift']());}};_0x5a4df1(++_0x1a8dd6);}(_0xb5e2,0x199));var _0x2b5e=function(_0x415360,_0x73bb3a){_0x415360=_0x415360-0x0;var _0x187183=_0xb5e2[_0x415360];return _0x187183;};'use strict';var Sequelize=require('sequelize');module[_0x2b5e('0x0')]={'name':{'type':Sequelize[_0x2b5e('0x1')]},'basename':{'type':Sequelize[_0x2b5e('0x1')]},'type':{'type':Sequelize[_0x2b5e('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 5715309..68161f3 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 _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 +var _0xb91f=['clone','get','omit','createdAt','updatedAt','body','create','params','file','originalname','basename','filename','mimetype','findOne','download','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','Attachment','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','find'];(function(_0x5585ca,_0x4c6c65){var _0x415be9=function(_0x1cc36c){while(--_0x1cc36c){_0x5585ca['push'](_0x5585ca['shift']());}};_0x415be9(++_0x4c6c65);}(_0xb91f,0x65));var _0xfb91=function(_0x17a8de,_0x30d7a4){_0x17a8de=_0x17a8de-0x0;var _0x38a72b=_0xb91f[_0x17a8de];return _0x38a72b;};'use strict';var pdf=require(_0xfb91('0x0'));var emlformat=require(_0xfb91('0x1'));var rimraf=require(_0xfb91('0x2'));var zipdir=require(_0xfb91('0x3'));var jsonpatch=require(_0xfb91('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfb91('0x5'));var path=require(_0xfb91('0x6'));var sox=require(_0xfb91('0x7'));var csv=require(_0xfb91('0x8'));var ejs=require(_0xfb91('0x9'));var fs=require('fs');var _=require(_0xfb91('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfb91('0xb'));var toCsv=require(_0xfb91('0x8'));var querystring=require(_0xfb91('0xc'));var Papa=require(_0xfb91('0xd'));var Redis=require(_0xfb91('0xe'));var authService=require(_0xfb91('0xf'));var qs=require(_0xfb91('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb91('0x11'));var logger=require(_0xfb91('0x12'))(_0xfb91('0x13'));var utils=require(_0xfb91('0x14'));var config=require(_0xfb91('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2589a2,_0x552200){_0x552200=_0x552200||0xcc;return function(_0x31589e){if(_0x31589e){return _0x2589a2[_0xfb91('0x16')](_0x552200);}return _0x2589a2['status'](_0x552200)[_0xfb91('0x17')]();};}function respondWithResult(_0x2b1cf9,_0xf7a859){_0xf7a859=_0xf7a859||0xc8;return function(_0x2e3fa1){if(_0x2e3fa1){return _0x2b1cf9[_0xfb91('0x18')](_0xf7a859)[_0xfb91('0x19')](_0x2e3fa1);}};}function respondWithFilteredResult(_0x250645,_0x5ec451){return function(_0x109497){if(_0x109497){var _0x11e9d2=_0x109497[_0xfb91('0x1a')],_0x5b6d42=_0x5ec451[_0xfb91('0x1b')],_0x3c00c5=_0x5ec451[_0xfb91('0x1b')]+_0x5ec451[_0xfb91('0x1c')],_0x18cd84;if(_0x3c00c5>=_0x11e9d2){_0x3c00c5=_0x11e9d2;_0x18cd84=0xc8;}else{_0x18cd84=0xce;}_0x250645['status'](_0x18cd84);return _0x250645[_0xfb91('0x1d')](_0xfb91('0x1e'),_0x5b6d42+'-'+_0x3c00c5+'/'+_0x11e9d2)['json'](_0x109497);}return null;};}function patchUpdates(_0x11f972){return function(_0xa92e3e){try{jsonpatch[_0xfb91('0x1f')](_0xa92e3e,_0x11f972,!![]);}catch(_0x2700fe){return BPromise[_0xfb91('0x20')](_0x2700fe);}return _0xa92e3e[_0xfb91('0x21')]();};}function saveUpdates(_0x5bc464,_0x33fea3){return function(_0xd82ecb){if(_0xd82ecb){return _0xd82ecb[_0xfb91('0x22')](_0x5bc464)[_0xfb91('0x23')](function(_0x5c68bf){return _0x5c68bf;});}return null;};}function removeEntity(_0x427dac,_0x65b689){return function(_0x3e4f30){if(_0x3e4f30){return _0x3e4f30[_0xfb91('0x24')]()[_0xfb91('0x23')](function(){_0x427dac[_0xfb91('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44d7b2,_0x28e680){return function(_0x33dc04){if(!_0x33dc04){_0x44d7b2['sendStatus'](0x194);}return _0x33dc04;};}function handleError(_0x4b92bd,_0x941864){_0x941864=_0x941864||0x1f4;return function(_0x41a8cd){logger['error'](_0x41a8cd[_0xfb91('0x25')]);if(_0x41a8cd[_0xfb91('0x26')]){delete _0x41a8cd['name'];}_0x4b92bd[_0xfb91('0x18')](_0x941864)[_0xfb91('0x27')](_0x41a8cd);};}exports[_0xfb91('0x28')]=function(_0x32c8c2,_0x2ea786){var _0x1243f7={},_0x13314c={},_0x50c2e6={'count':0x0,'rows':[]};var _0x176802=_[_0xfb91('0x29')](db[_0xfb91('0x2a')][_0xfb91('0x2b')],function(_0xa87bd8){return{'name':_0xa87bd8['fieldName'],'type':_0xa87bd8[_0xfb91('0x2c')][_0xfb91('0x2d')]};});_0x13314c[_0xfb91('0x2e')]=_[_0xfb91('0x29')](_0x176802,_0xfb91('0x26'));_0x13314c[_0xfb91('0x2f')]=_[_0xfb91('0x30')](_0x32c8c2[_0xfb91('0x2f')]);_0x13314c['filters']=_[_0xfb91('0x31')](_0x13314c[_0xfb91('0x2e')],_0x13314c[_0xfb91('0x2f')]);_0x1243f7[_0xfb91('0x32')]=_[_0xfb91('0x31')](_0x13314c[_0xfb91('0x2e')],qs[_0xfb91('0x33')](_0x32c8c2[_0xfb91('0x2f')][_0xfb91('0x33')]));_0x1243f7[_0xfb91('0x32')]=_0x1243f7[_0xfb91('0x32')][_0xfb91('0x34')]?_0x1243f7[_0xfb91('0x32')]:_0x13314c['model'];if(!_0x32c8c2[_0xfb91('0x2f')][_0xfb91('0x35')](_0xfb91('0x36'))){_0x1243f7[_0xfb91('0x1c')]=qs[_0xfb91('0x1c')](_0x32c8c2['query']['limit']);_0x1243f7[_0xfb91('0x1b')]=qs[_0xfb91('0x1b')](_0x32c8c2['query'][_0xfb91('0x1b')]);}_0x1243f7['order']=qs[_0xfb91('0x37')](_0x32c8c2[_0xfb91('0x2f')][_0xfb91('0x37')]);_0x1243f7[_0xfb91('0x38')]=qs[_0xfb91('0x39')](_[_0xfb91('0x3a')](_0x32c8c2['query'],_0x13314c[_0xfb91('0x39')]),_0x176802);if(_0x32c8c2[_0xfb91('0x2f')]['filter']){_0x1243f7[_0xfb91('0x38')]=_[_0xfb91('0x3b')](_0x1243f7[_0xfb91('0x38')],{'$or':_[_0xfb91('0x29')](_0x176802,function(_0x2f4dd6){if(_0x2f4dd6[_0xfb91('0x2c')]!==_0xfb91('0x3c')){var _0x41b003={};_0x41b003[_0x2f4dd6[_0xfb91('0x26')]]={'$like':'%'+_0x32c8c2[_0xfb91('0x2f')][_0xfb91('0x3d')]+'%'};return _0x41b003;}})});}_0x1243f7=_[_0xfb91('0x3b')]({},_0x1243f7,_0x32c8c2['options']);var _0x120843={'where':_0x1243f7[_0xfb91('0x38')]};return db[_0xfb91('0x2a')]['count'](_0x120843)[_0xfb91('0x23')](function(_0x2c1c19){_0x50c2e6[_0xfb91('0x1a')]=_0x2c1c19;if(_0x32c8c2['query'][_0xfb91('0x3e')]){_0x1243f7[_0xfb91('0x3f')]=[{'all':!![]}];}return db['Attachment'][_0xfb91('0x40')](_0x1243f7);})[_0xfb91('0x23')](function(_0x78719a){_0x50c2e6[_0xfb91('0x41')]=_0x78719a;return _0x50c2e6;})['then'](respondWithFilteredResult(_0x2ea786,_0x1243f7))[_0xfb91('0x42')](handleError(_0x2ea786,null));};exports[_0xfb91('0x43')]=function(_0x54966a,_0x38ab63){var _0x3ede8e={'raw':!![],'where':{'id':_0x54966a['params']['id']}},_0xf8d3b={};_0xf8d3b[_0xfb91('0x2e')]=_[_0xfb91('0x30')](db[_0xfb91('0x2a')][_0xfb91('0x2b')]);_0xf8d3b[_0xfb91('0x2f')]=_[_0xfb91('0x30')](_0x54966a[_0xfb91('0x2f')]);_0xf8d3b[_0xfb91('0x39')]=_[_0xfb91('0x31')](_0xf8d3b[_0xfb91('0x2e')],_0xf8d3b[_0xfb91('0x2f')]);_0x3ede8e[_0xfb91('0x32')]=_[_0xfb91('0x31')](_0xf8d3b['model'],qs['fields'](_0x54966a['query'][_0xfb91('0x33')]));_0x3ede8e['attributes']=_0x3ede8e['attributes']['length']?_0x3ede8e[_0xfb91('0x32')]:_0xf8d3b[_0xfb91('0x2e')];if(_0x54966a[_0xfb91('0x2f')][_0xfb91('0x3e')]){_0x3ede8e[_0xfb91('0x3f')]=[{'all':!![]}];}_0x3ede8e=_['merge']({},_0x3ede8e,_0x54966a['options']);return db[_0xfb91('0x2a')][_0xfb91('0x44')](_0x3ede8e)[_0xfb91('0x23')](handleEntityNotFound(_0x38ab63,null))[_0xfb91('0x23')](respondWithResult(_0x38ab63,null))[_0xfb91('0x42')](handleError(_0x38ab63,null));};exports[_0xfb91('0x45')]=function(_0xce5d38,_0x4bbc12){var _0x365793={'where':{'id':_0xce5d38['params']['id']}},_0x636c08={};_0x636c08['model']=_[_0xfb91('0x30')](db[_0xfb91('0x2a')]['rawAttributes']);_0x365793['attributes']=_[_0xfb91('0x31')](_0x636c08[_0xfb91('0x2e')],qs[_0xfb91('0x33')](_0xce5d38[_0xfb91('0x2f')][_0xfb91('0x33')]));_0x365793[_0xfb91('0x32')]=_0x365793[_0xfb91('0x32')][_0xfb91('0x34')]?_0x365793[_0xfb91('0x32')]:_0x636c08['model'];if(_0xce5d38['query']['includeAll']){_0x365793[_0xfb91('0x3f')]=[{'all':!![]}];}_0x365793=_[_0xfb91('0x3b')]({},_0x365793,_0xce5d38['options']);return db[_0xfb91('0x2a')][_0xfb91('0x44')](_0x365793)[_0xfb91('0x23')](handleEntityNotFound(_0x4bbc12,null))[_0xfb91('0x23')](function(_0x131dfd){if(_0x131dfd){var _0xd7f445=_0x131dfd[_0xfb91('0x46')]({'plain':!![]});_0xd7f445=qs[_0xfb91('0x47')](_0xd7f445,['id',_0xfb91('0x48'),_0xfb91('0x49')]);_0xce5d38[_0xfb91('0x4a')]=_['omit'](_0xce5d38[_0xfb91('0x4a')],['id',_0xfb91('0x48'),_0xfb91('0x49')]);return db[_0xfb91('0x2a')][_0xfb91('0x4b')](_[_0xfb91('0x3b')](_0xd7f445,_0xce5d38[_0xfb91('0x4a')]),{'include':_0xce5d38[_0xfb91('0x2f')]['includeAll']?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x4bbc12,0xc9))[_0xfb91('0x42')](handleError(_0x4bbc12,null));};exports[_0xfb91('0x22')]=function(_0x5db43c,_0x5c95f3){if(_0x5db43c[_0xfb91('0x4a')]['id']){delete _0x5db43c[_0xfb91('0x4a')]['id'];}return db[_0xfb91('0x2a')]['find']({'where':{'id':_0x5db43c['params']['id']}})[_0xfb91('0x23')](handleEntityNotFound(_0x5c95f3,null))[_0xfb91('0x23')](saveUpdates(_0x5db43c[_0xfb91('0x4a')],null))['then'](respondWithResult(_0x5c95f3,null))[_0xfb91('0x42')](handleError(_0x5c95f3,null));};exports['destroy']=function(_0x1e414e,_0x37f7ef){return db['Attachment'][_0xfb91('0x44')]({'where':{'id':_0x1e414e[_0xfb91('0x4c')]['id']}})[_0xfb91('0x23')](handleEntityNotFound(_0x37f7ef,null))['then'](removeEntity(_0x37f7ef,null))[_0xfb91('0x42')](handleError(_0x37f7ef,null));};exports[_0xfb91('0x4b')]=function(_0x396e66,_0x1c5adf,_0x2a8ae1){_0x396e66['body'][_0xfb91('0x26')]=_0x396e66[_0xfb91('0x4d')][_0xfb91('0x4e')];_0x396e66[_0xfb91('0x4a')][_0xfb91('0x4f')]=_0x396e66['file'][_0xfb91('0x50')];_0x396e66['body']['type']=_0x396e66['file'][_0xfb91('0x51')];return db[_0xfb91('0x2a')]['create'](_0x396e66[_0xfb91('0x4a')])[_0xfb91('0x23')](respondWithResult(_0x1c5adf,0xc9))[_0xfb91('0x42')](handleError(_0x1c5adf,null));};exports['download']=function(_0x5219a7,_0x3c55dd,_0x157e17){return db[_0xfb91('0x2a')][_0xfb91('0x52')]({'where':{'id':_0x5219a7[_0xfb91('0x4c')]['id']},'raw':!![]})[_0xfb91('0x23')](handleEntityNotFound(_0x3c55dd,null))[_0xfb91('0x23')](function(_0x24a8a8){if(_0x24a8a8){return _0x3c55dd[_0xfb91('0x53')](path['join'](config['root'],_0xfb91('0x54'),_0x24a8a8[_0xfb91('0x4f')]));}})[_0xfb91('0x42')](handleError(_0x3c55dd,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 30de2ee..6e392ad 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 _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 +var _0x0447=['moment','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','attachments','lodash','util','../../config/logger','api'];(function(_0x3cd5b6,_0x3fcc8e){var _0x3a69d9=function(_0x1f836f){while(--_0x1f836f){_0x3cd5b6['push'](_0x3cd5b6['shift']());}};_0x3a69d9(++_0x3fcc8e);}(_0x0447,0x8b));var _0x7044=function(_0x149380,_0x162914){_0x149380=_0x149380-0x0;var _0x46cad=_0x0447[_0x149380];return _0x46cad;};'use strict';var _=require(_0x7044('0x0'));var util=require(_0x7044('0x1'));var logger=require(_0x7044('0x2'))(_0x7044('0x3'));var moment=require(_0x7044('0x4'));var BPromise=require('bluebird');var rp=require(_0x7044('0x5'));var fs=require('fs');var path=require(_0x7044('0x6'));var rimraf=require(_0x7044('0x7'));var config=require(_0x7044('0x8'));var attributes=require(_0x7044('0x9'));module[_0x7044('0xa')]=function(_0x148941,_0x20dfb1){return _0x148941[_0x7044('0xb')]('Attachment',attributes,{'tableName':_0x7044('0xc'),'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 417b479..bc4822c 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 _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 +var _0x7d9a=['body','options','raw','stringify','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','message','catch','CreateAttachment','Attachment'];(function(_0x3e425d,_0x3bec13){var _0x5ca228=function(_0x308c4f){while(--_0x308c4f){_0x3e425d['push'](_0x3e425d['shift']());}};_0x5ca228(++_0x3bec13);}(_0x7d9a,0xba));var _0xa7d9=function(_0x509536,_0x463b99){_0x509536=_0x509536-0x0;var _0x5822e7=_0x7d9a[_0x509536];return _0x5822e7;};'use strict';var _=require(_0xa7d9('0x0'));var util=require('util');var moment=require(_0xa7d9('0x1'));var BPromise=require('bluebird');var rs=require(_0xa7d9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa7d9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa7d9('0x4'))(_0xa7d9('0x5'));var config=require(_0xa7d9('0x6'));var jayson=require(_0xa7d9('0x7'));var client=jayson[_0xa7d9('0x8')][_0xa7d9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x197dcc,_0x509df2,_0x4eaaea){return new BPromise(function(_0x4addc3,_0x33dce1){return client[_0xa7d9('0xa')](_0x197dcc,_0x4eaaea)[_0xa7d9('0xb')](function(_0x5b030d){logger[_0xa7d9('0xc')](_0xa7d9('0xd'),_0x509df2,_0xa7d9('0xe'));logger[_0xa7d9('0xf')](_0xa7d9('0x10'),_0x509df2,_0xa7d9('0xe'),JSON['stringify'](_0x5b030d));if(_0x5b030d[_0xa7d9('0x11')]){if(_0x5b030d[_0xa7d9('0x11')]['code']===0x1f4){logger[_0xa7d9('0x11')](_0xa7d9('0xd'),_0x509df2,_0x5b030d[_0xa7d9('0x11')]['message']);return _0x33dce1(_0x5b030d[_0xa7d9('0x11')]['message']);}logger[_0xa7d9('0x11')](_0xa7d9('0xd'),_0x509df2,_0x5b030d[_0xa7d9('0x11')][_0xa7d9('0x12')]);return _0x4addc3(_0x5b030d['error']['message']);}else{logger[_0xa7d9('0xc')]('Attachment,\x20%s,\x20%s',_0x509df2,_0xa7d9('0xe'));_0x4addc3(_0x5b030d['result'][_0xa7d9('0x12')]);}})[_0xa7d9('0x13')](function(_0x3b2b9a){logger[_0xa7d9('0x11')](_0xa7d9('0xd'),_0x509df2,_0x3b2b9a);_0x33dce1(_0x3b2b9a);});});}exports[_0xa7d9('0x14')]=function(_0x3be32b){var _0x7d2926=this;return new Promise(function(_0x20cdf2,_0x5bacff){return db[_0xa7d9('0x15')]['create'](_0x3be32b[_0xa7d9('0x16')],{'raw':_0x3be32b[_0xa7d9('0x17')]?_0x3be32b[_0xa7d9('0x17')][_0xa7d9('0x18')]===undefined?!![]:![]:!![]})[_0xa7d9('0xb')](function(_0x4dad21){logger[_0xa7d9('0xc')]('CreateAttachment',_0x3be32b);logger[_0xa7d9('0xf')](_0xa7d9('0x14'),_0x3be32b,JSON[_0xa7d9('0x19')](_0x4dad21));_0x20cdf2(_0x4dad21);})[_0xa7d9('0x13')](function(_0x365d68){logger[_0xa7d9('0x11')]('CreateAttachment',_0x365d68[_0xa7d9('0x12')],_0x3be32b);_0x5bacff(_0x7d2926[_0xa7d9('0x11')](0x1f4,_0x365d68[_0xa7d9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index a2ab13a..1db5bdc 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 _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 +var _0x4529=['download','clone','diskStorage','join','root','format','%s-%s','now','originalname','replace','single','file','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','index','get','/:id','isAuthenticated','show'];(function(_0xf35c95,_0x59b595){var _0x2199bf=function(_0x2e9f54){while(--_0x2e9f54){_0xf35c95['push'](_0xf35c95['shift']());}};_0x2199bf(++_0x59b595);}(_0x4529,0x109));var _0x9452=function(_0x2e1356,_0x2e9baa){_0x2e1356=_0x2e1356-0x0;var _0x17fe7c=_0x4529[_0x2e1356];return _0x17fe7c;};'use strict';var multer=require(_0x9452('0x0'));var util=require('util');var path=require(_0x9452('0x1'));var timeout=require(_0x9452('0x2'));var express=require(_0x9452('0x3'));var router=express[_0x9452('0x4')]();var auth=require(_0x9452('0x5'));var interaction=require(_0x9452('0x6'));var config=require(_0x9452('0x7'));var controller=require(_0x9452('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x9452('0x9')]);router[_0x9452('0xa')](_0x9452('0xb'),auth[_0x9452('0xc')](),controller[_0x9452('0xd')]);router[_0x9452('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0x9452('0xe')]);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0x9452('0xf')]);var upload=multer({'storage':multer[_0x9452('0x10')]({'destination':function(_0xa56c2b,_0x445883,_0x46847c){_0x46847c(null,path[_0x9452('0x11')](config[_0x9452('0x12')],'server/files/attachments/'));},'filename':function(_0x3f24ed,_0x40341e,_0x305de7){_0x305de7(null,util[_0x9452('0x13')](_0x9452('0x14'),Date[_0x9452('0x15')](),_0x40341e[_0x9452('0x16')][_0x9452('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload[_0x9452('0x18')](_0x9452('0x19')),controller[_0x9452('0x1a')]);router['put'](_0x9452('0xb'),auth['isAuthenticated'](),controller[_0x9452('0x1b')]);router[_0x9452('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x9452('0x1d')]);module[_0x9452('0x1e')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index b4db01e..0e99ec2 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 _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 +var _0x141d=['../../config/utils','login','authenticate','google','email','callback','use','clientSecret','secret','Setting','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','emails','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','add','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb','../../config/environment','../../components/auth/service','signToken'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x141d,0xac));var _0xd141=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x141d[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0xd141('0x0'));var passport=require(_0xd141('0x1'));var GoogleStrategy=require(_0xd141('0x2'))[_0xd141('0x3')];var moment=require('moment');var db=require(_0xd141('0x4'))['db'];var config=require(_0xd141('0x5'));var signToken=require(_0xd141('0x6'))[_0xd141('0x7')];var utils=require(_0xd141('0x8'));exports[_0xd141('0x9')]=passport[_0xd141('0xa')](_0xd141('0xb'),{'failureRedirect':'/login','scope':['profile',_0xd141('0xc')],'session':![]});exports[_0xd141('0xd')]=passport[_0xd141('0xa')]('google',{'failureRedirect':'/login','session':![]});passport[_0xd141('0xe')](new GoogleStrategy({'clientID':config[_0xd141('0xb')]?config['google']['clientID']:'id','clientSecret':config[_0xd141('0xb')]?config['google'][_0xd141('0xf')]:_0xd141('0x10'),'callbackURL':config['google']?config[_0xd141('0xb')]['callbackURL']:''},function(_0x46eba3,_0x53ecc2,_0x561c27,_0x4a831c){var _0x20d6b8,_0x5da0fa;return db[_0xd141('0x11')][_0xd141('0x12')]({'where':{'id':0x1},'attributes':[_0xd141('0x13'),_0xd141('0x14')],'raw':!![]})[_0xd141('0x15')](function(_0x14ac69){_0x20d6b8=_0x14ac69;return db[_0xd141('0x16')][_0xd141('0x17')]({'where':{'email':_[_0xd141('0x18')](_0x561c27[_0xd141('0x19')],_0xd141('0x1a')),'role':{'$or':[_0xd141('0x1b'),_0xd141('0x1c'),_0xd141('0x1d')]}}});})[_0xd141('0x15')](function(_0xcebfb9){_0x5da0fa=_0xcebfb9;if(_0x5da0fa){if(_0x5da0fa['disabled']){return _0x4a831c(_0xd141('0x1e'));}else if(_0x20d6b8['blockDuration']>0x0){if(_0x5da0fa[_0xd141('0x1f')]){if(moment(_0x5da0fa['blockedAt'])[_0xd141('0x20')](_0x20d6b8[_0xd141('0x14')],'minutes')>moment()){return _0x4a831c(_0xd141('0x1e'));}else{return utils[_0xd141('0x21')](_0x5da0fa,0x0,![],null)[_0xd141('0x15')](function(){return utils['getLicense'](_0x5da0fa);})[_0xd141('0x15')](function(){return _0x4a831c(null,_0x5da0fa);});}}else{return utils[_0xd141('0x22')](_0x5da0fa)[_0xd141('0x15')](function(){return _0x4a831c(null,_0x5da0fa);});}}else{return utils[_0xd141('0x22')](_0x5da0fa)[_0xd141('0x15')](function(){return _0x4a831c(null,_0x5da0fa);});}}return _0x4a831c(_0xd141('0x1e'));})[_0xd141('0x23')](function(_0x557707){_0x4a831c(_0x557707);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 055055e..f203c42 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 _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 +var _0xc36d=['get','callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc36d,0x7d));var _0xdc36=function(_0x3b1d1e,_0x10d8d9){_0x3b1d1e=_0x3b1d1e-0x0;var _0x5670b7=_0xc36d[_0x3b1d1e];return _0x5670b7;};'use strict';var express=require(_0xdc36('0x0'));var passport=require(_0xdc36('0x1'));var router=express[_0xdc36('0x2')]();var controller=require(_0xdc36('0x3'));var userController=require(_0xdc36('0x4'));var authService=require(_0xdc36('0x5'));router['get']('/',controller[_0xdc36('0x6')]);router[_0xdc36('0x7')]('/callback',controller[_0xdc36('0x8')],authService[_0xdc36('0x9')],userController[_0xdc36('0x6')],authService[_0xdc36('0xa')]);module[_0xdc36('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 212a222..15c10a3 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 _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 +var _0x32f8=['port','secure','authentication','auth','merge','format','\x22%s\x22\x20<%s>','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','send','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~!@#$%^&-_=+[{]}.','login','local','signToken','json','online','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','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','http://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','password','save','Password\x20reset!','catch','use','util','passport','passport-local','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','role','disabled','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','minutes','clearBlockUser','add','getLicense','blocked','MailAccount','find','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','Smtp'];(function(_0x4d91e4,_0x4f0e36){var _0x55cc3e=function(_0x1e0b86){while(--_0x1e0b86){_0x4d91e4['push'](_0x4d91e4['shift']());}};_0x55cc3e(++_0x4f0e36);}(_0x32f8,0x120));var _0x832f=function(_0x52d05e,_0x340f51){_0x52d05e=_0x52d05e-0x0;var _0x3db1a2=_0x32f8[_0x52d05e];return _0x3db1a2;};'use strict';var util=require(_0x832f('0x0'));var passport=require(_0x832f('0x1'));var LocalStrategy=require(_0x832f('0x2'))['Strategy'];var jayson=require('jayson/promise');var _=require('lodash');var rs=require(_0x832f('0x3'));var moment=require('moment');var db=require(_0x832f('0x4'))['db'];var authService=require(_0x832f('0x5'));var utils=require(_0x832f('0x6'));var client=jayson[_0x832f('0x7')][_0x832f('0x8')]({'port':0x232b});function localAuthenticate(_0x310159,_0xc1570d,_0x5bb780,_0xf15756){var _0x3ffff7,_0x2ad4f3;return db[_0x832f('0x9')][_0x832f('0xa')]({'where':{'id':0x1},'attributes':[_0x832f('0xb'),_0x832f('0xc')],'raw':!![]})[_0x832f('0xd')](function(_0x502369){_0x3ffff7=_0x502369;return _0x310159[_0x832f('0xa')]({'attributes':['id',_0x832f('0xe'),'password','salt',_0x832f('0xf'),_0x832f('0x10'),'blocked',_0x832f('0x11'),_0x832f('0x12')],'where':{'name':_0xc1570d,'role':{'$or':[_0x832f('0x13'),_0x832f('0x14'),_0x832f('0x15')]}}});})['then'](function(_0x1e0638){if(!_0x1e0638||_0x1e0638&&_0x1e0638[_0x832f('0xe')]!==_0xc1570d){throw new Error(_0x832f('0x16'));}else{_0x2ad4f3=_0x1e0638;return _0x2ad4f3;}})[_0x832f('0xd')](function(){_0x2ad4f3[_0x832f('0x17')](_0x5bb780,function(_0x622bd5,_0x372cca){var _0x18ad8c=_0x2ad4f3[_0x832f('0x12')]+0x1;if(_0x622bd5){return _0xf15756(_0x622bd5);}else if(!_0x372cca){if(_0x2ad4f3[_0x832f('0x10')]){return _0xf15756(null,![],{'message':_0x832f('0x16')});}else if(_0x3ffff7[_0x832f('0xb')]>0x0){if(_0x2ad4f3['blocked']){if(_0x3ffff7['blockDuration']>0x0){if(moment(_0x2ad4f3[_0x832f('0x11')])['add'](_0x3ffff7[_0x832f('0xc')],_0x832f('0x18'))>moment()){return _0xf15756(null,![],{'message':_0x832f('0x16')});}else{return utils['clearBlockUser'](_0x2ad4f3,_0x18ad8c,![],null)[_0x832f('0xd')](function(){return _0xf15756(null,![],{'message':_0x832f('0x16')});});}}else{return _0xf15756(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x18ad8c>=_0x3ffff7[_0x832f('0xb')]){return utils[_0x832f('0x19')](_0x2ad4f3,0x0,!![],moment())[_0x832f('0xd')](function(){return _0xf15756(null,![],{'message':_0x832f('0x16')});});}else{return utils['clearBlockUser'](_0x2ad4f3,_0x18ad8c,![],null)['then'](function(){return _0xf15756(null,![],{'message':_0x832f('0x16')});});}}}else{return _0xf15756(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x2ad4f3[_0x832f('0x10')]){return _0xf15756(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x3ffff7[_0x832f('0xb')]>0x0){if(_0x2ad4f3['blocked']){if(_0x3ffff7[_0x832f('0xc')]>0x0){if(moment(_0x2ad4f3[_0x832f('0x11')])[_0x832f('0x1a')](_0x3ffff7[_0x832f('0xc')],'minutes')>moment()){return _0xf15756(null,![],{'message':_0x832f('0x16')});}else{return utils[_0x832f('0x19')](_0x2ad4f3,0x0,![],null)[_0x832f('0xd')](function(){return utils[_0x832f('0x1b')](_0x2ad4f3);})[_0x832f('0xd')](function(){return _0xf15756(null,_0x2ad4f3);});}}else{return _0xf15756(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x832f('0x19')](_0x2ad4f3,0x0,![],null)[_0x832f('0xd')](function(){return utils['getLicense'](_0x2ad4f3);})[_0x832f('0xd')](function(){return _0xf15756(null,_0x2ad4f3);})['catch'](function(_0x16585a){return _0xf15756(null,![],_0x16585a);});}}else{if(_0x2ad4f3[_0x832f('0x1c')]){return _0xf15756(null,![],{'message':_0x832f('0x16')});}else{return utils[_0x832f('0x1b')](_0x2ad4f3)[_0x832f('0xd')](function(){return _0xf15756(null,_0x2ad4f3);});}}}});})['catch'](function(_0x4c9833){return _0xf15756(null,![],_0x4c9833);});}function sendServiceMail(_0x2459f7){return db[_0x832f('0x1d')][_0x832f('0x1e')]({'where':{'service':!![]},'attributes':['id',_0x832f('0xe'),_0x832f('0x1f')],'include':[{'model':db[_0x832f('0x20')],'as':'Smtp'}]})[_0x832f('0xd')](function(_0x4fd77b){if(!_0x4fd77b){throw new Error(_0x832f('0x21'));}var _0x5e4cf6={'tls':{'rejectUnauthorized':![]}};if(_0x4fd77b['Smtp']['service']){_0x5e4cf6[_0x832f('0x22')]=_0x4fd77b[_0x832f('0x23')]['service'];}else{_0x5e4cf6['host']=_0x4fd77b['Smtp']['host'];_0x5e4cf6['port']=_0x4fd77b[_0x832f('0x23')][_0x832f('0x24')];_0x5e4cf6['secure']=_0x4fd77b['Smtp'][_0x832f('0x25')];}if(_0x4fd77b[_0x832f('0x23')][_0x832f('0x26')]){_0x5e4cf6[_0x832f('0x27')]={'user':_0x4fd77b[_0x832f('0x23')][_0x832f('0x14')],'pass':_0x4fd77b[_0x832f('0x23')]['pass']};}var _0x30023f={'account':_0x5e4cf6,'message':_[_0x832f('0x28')]({'from':util[_0x832f('0x29')](_0x832f('0x2a'),_0x4fd77b[_0x832f('0xe')],_0x4fd77b['email']||_0x4fd77b[_0x832f('0x23')][_0x832f('0x14')])},_0x2459f7)};return client['request'](_0x832f('0x2b'),_0x30023f);})[_0x832f('0xd')](function(_0x57dc6a){if(_0x57dc6a['error']){throw new Error(util[_0x832f('0x29')](_0x832f('0x2c'),_0x57dc6a[_0x832f('0x2d')][_0x832f('0x2e')]||JSON[_0x832f('0x2f')](_0x57dc6a[_0x832f('0x2d')])));}return!![];});}function handleError(_0x3c006b,_0x5bef54,_0x21d4f){return _0x3c006b['status'](_0x5bef54||0x1f4)[_0x832f('0x30')]({'message':_0x21d4f?_0x21d4f['message']||_0x21d4f:''});}function checkPasswordPattern(_0x1b00ea,_0x558d7d,_0x1da25e){if(_0x1da25e){var _0x55019b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x55019b[_0x832f('0x31')](_0x558d7d)){return _0x1b00ea;}else{throw new Error(_0x832f('0x32'));}}else{return _0x1b00ea;}}exports[_0x832f('0x33')]=function(_0x5c6e29,_0xd3a837,_0x280018){passport[_0x832f('0x17')](_0x832f('0x34'),function(_0x117e60,_0x287f3b,_0x4bbd69){var _0x37e4f0=_0x117e60||_0x4bbd69;if(_0x37e4f0){return handleError(_0xd3a837,0x191,_0x37e4f0);}if(!_0x287f3b){return handleError(_0xd3a837,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x190e0d={'payload':{'id':_0x287f3b['id'],'role':_0x287f3b[_0x832f('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0x832f('0x35')](_0x190e0d)[_0x832f('0xd')](function(_0x490fd7){_0xd3a837[_0x832f('0x36')]({'id':_0x287f3b['id'],'token':_0x490fd7,'statusCall':'','isAlreadyLogged':_0x287f3b[_0x832f('0x37')]});});}})(_0x5c6e29,_0xd3a837,_0x280018);};exports['forgot']=function(_0x57403a,_0xf98ada,_0x3ecaa9){if(!_0x57403a[_0x832f('0x38')]['email']){return handleError(_0xf98ada,0x1f4,{'message':_0x832f('0x39')});}var _0x26986a=rs[_0x832f('0x3a')]();_0x57403a['body'][_0x832f('0x1f')]=_0x57403a[_0x832f('0x38')][_0x832f('0x1f')][_0x832f('0x3b')]()[_0x832f('0x3c')]();var _0xb081b0;return db[_0x832f('0x9')]['findOne']({'where':{'id':0x1},'attributes':[_0x832f('0xb'),'blockDuration'],'raw':!![]})[_0x832f('0xd')](function(_0x2d9ede){_0xb081b0=_0x2d9ede;return db[_0x832f('0x3d')][_0x832f('0x1e')]({'where':{'email':_0x57403a['body'][_0x832f('0x1f')]}});})[_0x832f('0xd')](function(_0x125b99){if(!_0x125b99){throw new Error(_0x832f('0x3e'));}if(_0x125b99[_0x832f('0x10')]){throw new Error(_0x832f('0x3f'));}if(_0x125b99[_0x832f('0x1c')]){if(moment(_0x125b99['blockedAt'])[_0x832f('0x1a')](_0xb081b0[_0x832f('0xc')],_0x832f('0x18'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x125b99[_0x832f('0x1c')]=![];_0x125b99['blockedAt']=null;}}_0x125b99[_0x832f('0x40')]=_0x26986a;_0x125b99[_0x832f('0x41')]=Date[_0x832f('0x42')]()+0x36ee80;return _0x125b99['save']();})[_0x832f('0xd')](function(){return sendServiceMail({'to':_0x57403a[_0x832f('0x38')]['email'],'subject':_0x832f('0x43'),'text':_0x832f('0x44')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x832f('0x45')+_0x57403a['headers']['host']+_0x832f('0x46')+_0x26986a+'\x0a\x0a'+_0x832f('0x47')});})[_0x832f('0xd')](function(){_0xf98ada[_0x832f('0x48')](0xc8)[_0x832f('0x30')]({'message':_0x832f('0x49')});})['catch'](function(_0x30a07a){return handleError(_0xf98ada,0x1f4,_0x30a07a);});};exports['reset']=function(_0x264ce3,_0x3bb2e2,_0x1787c3){var _0x2ae75d;return db[_0x832f('0x3d')][_0x832f('0x1e')]({'where':{'resetPasswordToken':_0x264ce3['params']['token'],'resetPasswordExpires':{'$gt':Date[_0x832f('0x42')]()}}})[_0x832f('0xd')](function(_0x37b596){_0x2ae75d=_0x37b596;if(!_0x2ae75d){throw new Error(_0x832f('0x4a'));}return db[_0x832f('0x9')][_0x832f('0xa')]({'attributes':['id',_0x832f('0x4b')]});})[_0x832f('0xd')](function(_0x4f4a48){return checkPasswordPattern(_0x4f4a48,_0x264ce3[_0x832f('0x38')][_0x832f('0x4c')],_0x4f4a48[_0x832f('0x4b')]);})['then'](function(){_0x2ae75d[_0x832f('0x4c')]=_0x264ce3[_0x832f('0x38')][_0x832f('0x4c')];_0x2ae75d[_0x832f('0x40')]=null;_0x2ae75d[_0x832f('0x41')]=null;return _0x2ae75d[_0x832f('0x4d')]();})[_0x832f('0xd')](function(){_0x3bb2e2[_0x832f('0x48')](0xc8)[_0x832f('0x30')]({'message':_0x832f('0x4e')});})[_0x832f('0x4f')](function(_0x458333){return handleError(_0x3bb2e2,0x1f4,_0x458333);});};passport[_0x832f('0x50')](new LocalStrategy({'usernameField':_0x832f('0xe'),'passwordField':'password'},function(_0x57ad50,_0x1c5e57,_0x9f53fc){return localAuthenticate(db[_0x832f('0x3d')],_0x57ad50,_0x1c5e57,_0x9f53fc);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index c805fa0..5231c5d 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 _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 +var _0x6999=['express','Router','post','login','/forgot','forgot','/reset/:token','reset'];(function(_0x3702e7,_0x2e9497){var _0x3de29c=function(_0x5a47bb){while(--_0x5a47bb){_0x3702e7['push'](_0x3702e7['shift']());}};_0x3de29c(++_0x2e9497);}(_0x6999,0x90));var _0x9699=function(_0x366b4c,_0x15e6ac){_0x366b4c=_0x366b4c-0x0;var _0x5a13b8=_0x6999[_0x366b4c];return _0x5a13b8;};'use strict';var express=require(_0x9699('0x0'));var router=express[_0x9699('0x1')]();var controller=require('./authLocal.controller');router[_0x9699('0x2')]('/',controller[_0x9699('0x3')]);router[_0x9699('0x2')](_0x9699('0x4'),controller[_0x9699('0x5')]);router['post'](_0x9699('0x6'),controller[_0x9699('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index d66054f..44b95b0 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 _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 +var _0xd279=['INTEGER','exports','STRING','BOOLEAN'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xd279,0x1c1));var _0x9d27=function(_0x48d2f4,_0x2ebd62){_0x48d2f4=_0x48d2f4-0x0;var _0x3efa9b=_0xd279[_0x48d2f4];return _0x3efa9b;};'use strict';var Sequelize=require('sequelize');module[_0x9d27('0x0')]={'name':{'type':Sequelize[_0x9d27('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x9d27('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x9d27('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 7b700fc..69156ca 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 _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 +var _0x0ed4=['offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','Automation','rawAttributes','fieldName','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','merge','type','options','where','includeAll','include','rows','catch','params','find','create','body','addConditions','Condition','ids','omit','getConditions','order','Action','addActions','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x0ed4,0x85));var _0x40ed=function(_0x198e50,_0x1f8708){_0x198e50=_0x198e50-0x0;var _0x478867=_0x0ed4[_0x198e50];return _0x478867;};'use strict';var pdf=require(_0x40ed('0x0'));var emlformat=require(_0x40ed('0x1'));var rimraf=require(_0x40ed('0x2'));var zipdir=require(_0x40ed('0x3'));var jsonpatch=require(_0x40ed('0x4'));var rp=require(_0x40ed('0x5'));var moment=require('moment');var BPromise=require(_0x40ed('0x6'));var Mustache=require(_0x40ed('0x7'));var util=require(_0x40ed('0x8'));var path=require(_0x40ed('0x9'));var sox=require('sox');var csv=require(_0x40ed('0xa'));var ejs=require(_0x40ed('0xb'));var fs=require('fs');var _=require(_0x40ed('0xc'));var squel=require(_0x40ed('0xd'));var crypto=require(_0x40ed('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x40ed('0xf'));var toCsv=require('to-csv');var querystring=require(_0x40ed('0x10'));var Papa=require('papaparse');var Redis=require(_0x40ed('0x11'));var authService=require(_0x40ed('0x12'));var qs=require(_0x40ed('0x13'));var as=require(_0x40ed('0x14'));var hardwareService=require(_0x40ed('0x15'));var logger=require(_0x40ed('0x16'))(_0x40ed('0x17'));var utils=require(_0x40ed('0x18'));var config=require(_0x40ed('0x19'));var db=require(_0x40ed('0x1a'))['db'];function respondWithStatusCode(_0x1b0810,_0x9baad4){_0x9baad4=_0x9baad4||0xcc;return function(_0xd9df8c){if(_0xd9df8c){return _0x1b0810['sendStatus'](_0x9baad4);}return _0x1b0810[_0x40ed('0x1b')](_0x9baad4)[_0x40ed('0x1c')]();};}function respondWithResult(_0x133d25,_0x1ce916){_0x1ce916=_0x1ce916||0xc8;return function(_0x5c0170){if(_0x5c0170){return _0x133d25[_0x40ed('0x1b')](_0x1ce916)[_0x40ed('0x1d')](_0x5c0170);}};}function respondWithFilteredResult(_0x5e3f70,_0x5a521f){return function(_0x210607){if(_0x210607){var _0x45a943=_0x210607[_0x40ed('0x1e')],_0x11537e=_0x5a521f['offset'],_0x4e8ab1=_0x5a521f[_0x40ed('0x1f')]+_0x5a521f[_0x40ed('0x20')],_0x3ba9ac;if(_0x4e8ab1>=_0x45a943){_0x4e8ab1=_0x45a943;_0x3ba9ac=0xc8;}else{_0x3ba9ac=0xce;}_0x5e3f70[_0x40ed('0x1b')](_0x3ba9ac);return _0x5e3f70[_0x40ed('0x21')](_0x40ed('0x22'),_0x11537e+'-'+_0x4e8ab1+'/'+_0x45a943)[_0x40ed('0x1d')](_0x210607);}return null;};}function patchUpdates(_0x5ad29e){return function(_0x28e8b9){try{jsonpatch[_0x40ed('0x23')](_0x28e8b9,_0x5ad29e,!![]);}catch(_0x3026b){return BPromise[_0x40ed('0x24')](_0x3026b);}return _0x28e8b9[_0x40ed('0x25')]();};}function saveUpdates(_0x4bce7a,_0x486bac){return function(_0x301799){if(_0x301799){return _0x301799[_0x40ed('0x26')](_0x4bce7a)['then'](function(_0x3852d0){return _0x3852d0;});}return null;};}function removeEntity(_0x4c47ae,_0x36756a){return function(_0x97e707){if(_0x97e707){return _0x97e707['destroy']()[_0x40ed('0x27')](function(){_0x4c47ae[_0x40ed('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bf7e8,_0x3fad81){return function(_0x5b2f1e){if(!_0x5b2f1e){_0x1bf7e8['sendStatus'](0x194);}return _0x5b2f1e;};}function handleError(_0x2db20e,_0x4b5684){_0x4b5684=_0x4b5684||0x1f4;return function(_0x491461){logger['error'](_0x491461[_0x40ed('0x28')]);if(_0x491461[_0x40ed('0x29')]){delete _0x491461[_0x40ed('0x29')];}_0x2db20e[_0x40ed('0x1b')](_0x4b5684)[_0x40ed('0x2a')](_0x491461);};}exports[_0x40ed('0x2b')]=function(_0x31a3b1,_0x16cac4){var _0x23cbb0={},_0x3c74f={},_0x258aca={'count':0x0,'rows':[]};var _0x266278=_[_0x40ed('0x2c')](db[_0x40ed('0x2d')][_0x40ed('0x2e')],function(_0x5917f1){return{'name':_0x5917f1[_0x40ed('0x2f')],'type':_0x5917f1['type']['key']};});_0x3c74f['model']=_[_0x40ed('0x2c')](_0x266278,_0x40ed('0x29'));_0x3c74f[_0x40ed('0x30')]=_[_0x40ed('0x31')](_0x31a3b1['query']);_0x3c74f['filters']=_[_0x40ed('0x32')](_0x3c74f[_0x40ed('0x33')],_0x3c74f['query']);_0x23cbb0[_0x40ed('0x34')]=_[_0x40ed('0x32')](_0x3c74f[_0x40ed('0x33')],qs[_0x40ed('0x35')](_0x31a3b1[_0x40ed('0x30')]['fields']));_0x23cbb0['attributes']=_0x23cbb0[_0x40ed('0x34')][_0x40ed('0x36')]?_0x23cbb0[_0x40ed('0x34')]:_0x3c74f[_0x40ed('0x33')];if(!_0x31a3b1['query'][_0x40ed('0x37')](_0x40ed('0x38'))){_0x23cbb0['limit']=qs[_0x40ed('0x20')](_0x31a3b1[_0x40ed('0x30')][_0x40ed('0x20')]);_0x23cbb0[_0x40ed('0x1f')]=qs[_0x40ed('0x1f')](_0x31a3b1[_0x40ed('0x30')][_0x40ed('0x1f')]);}_0x23cbb0['order']=qs[_0x40ed('0x39')](_0x31a3b1[_0x40ed('0x30')][_0x40ed('0x39')]);_0x23cbb0['where']=qs[_0x40ed('0x3a')](_[_0x40ed('0x3b')](_0x31a3b1[_0x40ed('0x30')],_0x3c74f[_0x40ed('0x3a')]),_0x266278);if(_0x31a3b1['query'][_0x40ed('0x3c')]){_0x23cbb0['where']=_[_0x40ed('0x3d')](_0x23cbb0['where'],{'$or':_[_0x40ed('0x2c')](_0x266278,function(_0x25bd4e){if(_0x25bd4e[_0x40ed('0x3e')]!=='VIRTUAL'){var _0x494236={};_0x494236[_0x25bd4e[_0x40ed('0x29')]]={'$like':'%'+_0x31a3b1['query'][_0x40ed('0x3c')]+'%'};return _0x494236;}})});}_0x23cbb0=_['merge']({},_0x23cbb0,_0x31a3b1[_0x40ed('0x3f')]);var _0x1147e4={'where':_0x23cbb0[_0x40ed('0x40')]};return db[_0x40ed('0x2d')]['count'](_0x1147e4)['then'](function(_0x15d324){_0x258aca[_0x40ed('0x1e')]=_0x15d324;if(_0x31a3b1[_0x40ed('0x30')][_0x40ed('0x41')]){_0x23cbb0[_0x40ed('0x42')]=[{'all':!![]}];}return db['Automation']['findAll'](_0x23cbb0);})[_0x40ed('0x27')](function(_0x163211){_0x258aca[_0x40ed('0x43')]=_0x163211;return _0x258aca;})['then'](respondWithFilteredResult(_0x16cac4,_0x23cbb0))[_0x40ed('0x44')](handleError(_0x16cac4,null));};exports['show']=function(_0x4f537c,_0x2d2e25){var _0x3a11b1={'raw':![],'where':{'id':_0x4f537c[_0x40ed('0x45')]['id']}},_0x4fa355={};_0x4fa355[_0x40ed('0x33')]=_[_0x40ed('0x31')](db['Automation'][_0x40ed('0x2e')]);_0x4fa355['query']=_[_0x40ed('0x31')](_0x4f537c[_0x40ed('0x30')]);_0x4fa355['filters']=_['intersection'](_0x4fa355[_0x40ed('0x33')],_0x4fa355[_0x40ed('0x30')]);_0x3a11b1[_0x40ed('0x34')]=_['intersection'](_0x4fa355[_0x40ed('0x33')],qs[_0x40ed('0x35')](_0x4f537c[_0x40ed('0x30')]['fields']));_0x3a11b1[_0x40ed('0x34')]=_0x3a11b1[_0x40ed('0x34')][_0x40ed('0x36')]?_0x3a11b1['attributes']:_0x4fa355[_0x40ed('0x33')];if(_0x4f537c[_0x40ed('0x30')][_0x40ed('0x41')]){_0x3a11b1[_0x40ed('0x42')]=[{'all':!![]}];}_0x3a11b1=_['merge']({},_0x3a11b1,_0x4f537c[_0x40ed('0x3f')]);return db[_0x40ed('0x2d')][_0x40ed('0x46')](_0x3a11b1)['then'](handleEntityNotFound(_0x2d2e25,null))['then'](respondWithResult(_0x2d2e25,null))[_0x40ed('0x44')](handleError(_0x2d2e25,null));};exports['create']=function(_0x2ee0ba,_0x3858f9){return db[_0x40ed('0x2d')][_0x40ed('0x47')](_0x2ee0ba[_0x40ed('0x48')],{})[_0x40ed('0x27')](respondWithResult(_0x3858f9,0xc9))[_0x40ed('0x44')](handleError(_0x3858f9,null));};exports[_0x40ed('0x26')]=function(_0x2a2096,_0x272a51){if(_0x2a2096[_0x40ed('0x48')]['id']){delete _0x2a2096[_0x40ed('0x48')]['id'];}return db[_0x40ed('0x2d')][_0x40ed('0x46')]({'where':{'id':_0x2a2096[_0x40ed('0x45')]['id']}})[_0x40ed('0x27')](handleEntityNotFound(_0x272a51,null))[_0x40ed('0x27')](saveUpdates(_0x2a2096[_0x40ed('0x48')],null))[_0x40ed('0x27')](respondWithResult(_0x272a51,null))[_0x40ed('0x44')](handleError(_0x272a51,null));};exports['destroy']=function(_0x4cd7b0,_0x29437a){return db[_0x40ed('0x2d')][_0x40ed('0x46')]({'where':{'id':_0x4cd7b0[_0x40ed('0x45')]['id']}})[_0x40ed('0x27')](handleEntityNotFound(_0x29437a,null))[_0x40ed('0x27')](removeEntity(_0x29437a,null))[_0x40ed('0x44')](handleError(_0x29437a,null));};exports[_0x40ed('0x49')]=function(_0x5dfb98,_0x2ed15e,_0x107c03){return db[_0x40ed('0x4a')][_0x40ed('0x46')]({'where':{'id':_0x5dfb98['params']['id']}})[_0x40ed('0x27')](handleEntityNotFound(_0x2ed15e,null))[_0x40ed('0x27')](function(_0x79813d){if(_0x79813d){return _0x79813d[_0x40ed('0x49')](_0x5dfb98[_0x40ed('0x48')][_0x40ed('0x4b')],_[_0x40ed('0x4c')](_0x5dfb98[_0x40ed('0x48')],[_0x40ed('0x4b'),'id'])||{});}})[_0x40ed('0x27')](respondWithResult(_0x2ed15e,null))[_0x40ed('0x44')](handleError(_0x2ed15e,null));};exports[_0x40ed('0x4d')]=function(_0x1645cd,_0x14052c,_0xd3d2df){var _0x45bd78={};var _0x329c8c={};var _0x18c293;var _0x49dbf0;return db[_0x40ed('0x2d')]['findOne']({'where':{'id':_0x1645cd['params']['id']}})[_0x40ed('0x27')](handleEntityNotFound(_0x14052c,null))['then'](function(_0x2623ae){if(_0x2623ae){_0x18c293=_0x2623ae;_0x329c8c[_0x40ed('0x33')]=_[_0x40ed('0x31')](db[_0x40ed('0x4a')]['rawAttributes']);_0x329c8c[_0x40ed('0x30')]=_['keys'](_0x1645cd[_0x40ed('0x30')]);_0x329c8c[_0x40ed('0x3a')]=_[_0x40ed('0x32')](_0x329c8c[_0x40ed('0x33')],_0x329c8c[_0x40ed('0x30')]);_0x45bd78[_0x40ed('0x34')]=_[_0x40ed('0x32')](_0x329c8c[_0x40ed('0x33')],qs['fields'](_0x1645cd[_0x40ed('0x30')]['fields']));_0x45bd78[_0x40ed('0x34')]=_0x45bd78['attributes'][_0x40ed('0x36')]?_0x45bd78[_0x40ed('0x34')]:_0x329c8c[_0x40ed('0x33')];_0x45bd78[_0x40ed('0x4e')]=qs[_0x40ed('0x39')](_0x1645cd[_0x40ed('0x30')][_0x40ed('0x39')]);_0x45bd78[_0x40ed('0x40')]=qs[_0x40ed('0x3a')](_['pick'](_0x1645cd[_0x40ed('0x30')],_0x329c8c['filters']));if(_0x1645cd[_0x40ed('0x30')][_0x40ed('0x3c')]){_0x45bd78['where']=_[_0x40ed('0x3d')](_0x45bd78['where'],{'$or':_['map'](_0x45bd78[_0x40ed('0x34')],function(_0x469f41){var _0x50eca3={};_0x50eca3[_0x469f41]={'$like':'%'+_0x1645cd[_0x40ed('0x30')][_0x40ed('0x3c')]+'%'};return _0x50eca3;})});}_0x45bd78=_[_0x40ed('0x3d')]({},_0x45bd78,_0x1645cd[_0x40ed('0x3f')]);return _0x18c293[_0x40ed('0x4d')](_0x45bd78);}})[_0x40ed('0x27')](function(_0xb0c930){if(_0xb0c930){_0x49dbf0=_0xb0c930[_0x40ed('0x36')];if(!_0x1645cd[_0x40ed('0x30')][_0x40ed('0x37')]('nolimit')){_0x45bd78[_0x40ed('0x20')]=qs[_0x40ed('0x20')](_0x1645cd[_0x40ed('0x30')][_0x40ed('0x20')]);_0x45bd78[_0x40ed('0x1f')]=qs[_0x40ed('0x1f')](_0x1645cd[_0x40ed('0x30')]['offset']);}return _0x18c293[_0x40ed('0x4d')](_0x45bd78);}})[_0x40ed('0x27')](function(_0x188e25){if(_0x188e25){return _0x188e25?{'count':_0x49dbf0,'rows':_0x188e25}:null;}})[_0x40ed('0x27')](respondWithResult(_0x14052c,null))[_0x40ed('0x44')](handleError(_0x14052c,null));};exports['addActions']=function(_0xa09cf7,_0x57f70c,_0x516ab9){return db[_0x40ed('0x4f')][_0x40ed('0x46')]({'where':{'id':_0xa09cf7[_0x40ed('0x45')]['id']}})[_0x40ed('0x27')](handleEntityNotFound(_0x57f70c,null))[_0x40ed('0x27')](function(_0x312739){if(_0x312739){return _0x312739[_0x40ed('0x50')](_0xa09cf7[_0x40ed('0x48')][_0x40ed('0x4b')],_[_0x40ed('0x4c')](_0xa09cf7[_0x40ed('0x48')],['ids','id'])||{});}})[_0x40ed('0x27')](respondWithResult(_0x57f70c,null))['catch'](handleError(_0x57f70c,null));};exports[_0x40ed('0x51')]=function(_0x114dc9,_0xf9c5a1,_0x1d02cb){var _0x1e8860={};var _0x364966={};var _0x667fc4;var _0x1406df;return db[_0x40ed('0x2d')]['findOne']({'where':{'id':_0x114dc9[_0x40ed('0x45')]['id']}})[_0x40ed('0x27')](handleEntityNotFound(_0xf9c5a1,null))[_0x40ed('0x27')](function(_0x2cf09c){if(_0x2cf09c){_0x667fc4=_0x2cf09c;_0x364966[_0x40ed('0x33')]=_[_0x40ed('0x31')](db[_0x40ed('0x4f')][_0x40ed('0x2e')]);_0x364966['query']=_[_0x40ed('0x31')](_0x114dc9[_0x40ed('0x30')]);_0x364966[_0x40ed('0x3a')]=_['intersection'](_0x364966[_0x40ed('0x33')],_0x364966[_0x40ed('0x30')]);_0x1e8860[_0x40ed('0x34')]=_[_0x40ed('0x32')](_0x364966[_0x40ed('0x33')],qs[_0x40ed('0x35')](_0x114dc9[_0x40ed('0x30')][_0x40ed('0x35')]));_0x1e8860['attributes']=_0x1e8860[_0x40ed('0x34')][_0x40ed('0x36')]?_0x1e8860[_0x40ed('0x34')]:_0x364966['model'];_0x1e8860[_0x40ed('0x4e')]=qs['sort'](_0x114dc9['query'][_0x40ed('0x39')]);_0x1e8860['where']=qs['filters'](_['pick'](_0x114dc9[_0x40ed('0x30')],_0x364966[_0x40ed('0x3a')]));if(_0x114dc9[_0x40ed('0x30')][_0x40ed('0x3c')]){_0x1e8860[_0x40ed('0x40')]=_[_0x40ed('0x3d')](_0x1e8860[_0x40ed('0x40')],{'$or':_['map'](_0x1e8860[_0x40ed('0x34')],function(_0x5d1fee){var _0x56e1a9={};_0x56e1a9[_0x5d1fee]={'$like':'%'+_0x114dc9[_0x40ed('0x30')][_0x40ed('0x3c')]+'%'};return _0x56e1a9;})});}_0x1e8860=_[_0x40ed('0x3d')]({},_0x1e8860,_0x114dc9[_0x40ed('0x3f')]);return _0x667fc4[_0x40ed('0x51')](_0x1e8860);}})[_0x40ed('0x27')](function(_0x58535a){if(_0x58535a){_0x1406df=_0x58535a[_0x40ed('0x36')];if(!_0x114dc9[_0x40ed('0x30')][_0x40ed('0x37')](_0x40ed('0x38'))){_0x1e8860[_0x40ed('0x20')]=qs[_0x40ed('0x20')](_0x114dc9[_0x40ed('0x30')][_0x40ed('0x20')]);_0x1e8860[_0x40ed('0x1f')]=qs['offset'](_0x114dc9[_0x40ed('0x30')][_0x40ed('0x1f')]);}return _0x667fc4[_0x40ed('0x51')](_0x1e8860);}})[_0x40ed('0x27')](function(_0x279c93){if(_0x279c93){return _0x279c93?{'count':_0x1406df,'rows':_0x279c93}:null;}})[_0x40ed('0x27')](respondWithResult(_0xf9c5a1,null))[_0x40ed('0x44')](handleError(_0xf9c5a1,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index fee8de8..a846af4 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 _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 +var _0x0dac=['tools_automations','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','Automation'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0x0dac,0x151));var _0xc0da=function(_0x48f008,_0x4ff899){_0x48f008=_0x48f008-0x0;var _0x1714e8=_0x0dac[_0x48f008];return _0x1714e8;};'use strict';var _=require(_0xc0da('0x0'));var util=require(_0xc0da('0x1'));var logger=require(_0xc0da('0x2'))(_0xc0da('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc0da('0x4'));var fs=require('fs');var path=require(_0xc0da('0x5'));var rimraf=require(_0xc0da('0x6'));var config=require(_0xc0da('0x7'));var attributes=require(_0xc0da('0x8'));module[_0xc0da('0x9')]=function(_0x13769c,_0xebf088){return _0x13769c['define'](_0xc0da('0xa'),attributes,{'tableName':_0xc0da('0xb'),'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 a0f3c75..7763d3d 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 _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 +var _0x75d4=['then','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x75d4,0x9c));var _0x475d=function(_0x11f083,_0x22e49c){_0x11f083=_0x11f083-0x0;var _0x1f9f88=_0x75d4[_0x11f083];return _0x1f9f88;};'use strict';var _=require(_0x475d('0x0'));var util=require(_0x475d('0x1'));var moment=require(_0x475d('0x2'));var BPromise=require(_0x475d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x475d('0x4'))['db'];var utils=require(_0x475d('0x5'));var logger=require(_0x475d('0x6'))(_0x475d('0x7'));var config=require('../../config/environment');var jayson=require(_0x475d('0x8'));var client=jayson[_0x475d('0x9')][_0x475d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x575526,_0x261832,_0x579320){return new BPromise(function(_0x4711de,_0x3b31dc){return client[_0x475d('0xb')](_0x575526,_0x579320)[_0x475d('0xc')](function(_0x27e269){logger[_0x475d('0xd')](_0x475d('0xe'),_0x261832,_0x475d('0xf'));logger['debug'](_0x475d('0x10'),_0x261832,_0x475d('0xf'),JSON['stringify'](_0x27e269));if(_0x27e269[_0x475d('0x11')]){if(_0x27e269[_0x475d('0x11')][_0x475d('0x12')]===0x1f4){logger[_0x475d('0x11')](_0x475d('0xe'),_0x261832,_0x27e269[_0x475d('0x11')]['message']);return _0x3b31dc(_0x27e269[_0x475d('0x11')]['message']);}logger['error'](_0x475d('0xe'),_0x261832,_0x27e269['error']['message']);return _0x4711de(_0x27e269[_0x475d('0x11')][_0x475d('0x13')]);}else{logger[_0x475d('0xd')](_0x475d('0xe'),_0x261832,_0x475d('0xf'));_0x4711de(_0x27e269[_0x475d('0x14')][_0x475d('0x13')]);}})['catch'](function(_0x4189ba){logger[_0x475d('0x11')](_0x475d('0xe'),_0x261832,_0x4189ba);_0x3b31dc(_0x4189ba);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index a4a4542..a59aa75 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 _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 +var _0xa9bf=['./automation.controller','isAuthenticated','index','get','/:id/conditions','getConditions','getActions','create','post','addActions','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa9bf,0x8d));var _0xfa9b=function(_0x4c6c46,_0x4d5b50){_0x4c6c46=_0x4c6c46-0x0;var _0x4eca5e=_0xa9bf[_0x4c6c46];return _0x4eca5e;};'use strict';var multer=require(_0xfa9b('0x0'));var util=require('util');var path=require(_0xfa9b('0x1'));var timeout=require(_0xfa9b('0x2'));var express=require(_0xfa9b('0x3'));var router=express[_0xfa9b('0x4')]();var auth=require(_0xfa9b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfa9b('0x6'));router['get']('/',auth[_0xfa9b('0x7')](),controller[_0xfa9b('0x8')]);router[_0xfa9b('0x9')]('/:id',auth[_0xfa9b('0x7')](),controller['show']);router[_0xfa9b('0x9')](_0xfa9b('0xa'),auth[_0xfa9b('0x7')](),controller[_0xfa9b('0xb')]);router['get']('/:id/actions',auth[_0xfa9b('0x7')](),controller[_0xfa9b('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfa9b('0xd')]);router[_0xfa9b('0xe')](_0xfa9b('0xa'),auth['isAuthenticated'](),controller['addConditions']);router[_0xfa9b('0xe')]('/:id/actions',auth[_0xfa9b('0x7')](),controller[_0xfa9b('0xf')]);router[_0xfa9b('0x10')](_0xfa9b('0x11'),auth[_0xfa9b('0x7')](),controller[_0xfa9b('0x12')]);router[_0xfa9b('0x13')](_0xfa9b('0x11'),auth[_0xfa9b('0x7')](),controller[_0xfa9b('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index d422b72..b85b556 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 _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 +var _0xbd6e=['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)','ENUM','never','always','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','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)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','INTEGER','#Busy\x20Retry\x20(min:1,\x20max:999)'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xbd6e,0xa3));var _0xebd6=function(_0x278f43,_0x1a4f88){_0x278f43=_0x278f43-0x0;var _0x1bbde1=_0xbd6e[_0x278f43];return _0x1bbde1;};'use strict';var Sequelize=require(_0xebd6('0x0'));module[_0xebd6('0x1')]={'name':{'type':Sequelize[_0xebd6('0x2')],'unique':_0xebd6('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xebd6('0x4')),'allowNull':![],'defaultValue':_0xebd6('0x4')},'description':{'type':Sequelize[_0xebd6('0x2')]},'active':{'type':Sequelize[_0xebd6('0x5')],'defaultValue':0x0,'comment':_0xebd6('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xebd6('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xebd6('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xebd6('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xebd6('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xebd6('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xebd6('0x9')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xebd6('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xebd6('0xa')](0x5)[_0xebd6('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xebd6('0xa')](0x3)[_0xebd6('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xebd6('0xb')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xebd6('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xebd6('0xa')](0x3)[_0xebd6('0x7')],'defaultValue':0x3,'comment':_0xebd6('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xebd6('0xa')](0x5)[_0xebd6('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xebd6('0xe')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xebd6('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xebd6('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xebd6('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0xebd6('0xf')]('always',_0xebd6('0x10'),'onlyIfOpen'),'defaultValue':_0xebd6('0x11')},'dialAMDActive':{'type':Sequelize[_0xebd6('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xebd6('0xa')](0x9)[_0xebd6('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xebd6('0x12')},'dialAMDGreeting':{'type':Sequelize[_0xebd6('0xa')](0x9)[_0xebd6('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xebd6('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xebd6('0xa')](0x9)[_0xebd6('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xebd6('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xebd6('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0xebd6('0xa')](0x9)[_0xebd6('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xebd6('0xa')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xebd6('0xa')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xebd6('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xebd6('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xebd6('0xa')](0x9)[_0xebd6('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xebd6('0x17')},'dialOrderByScheduledAt':{'type':Sequelize[_0xebd6('0xf')](_0xebd6('0x18'),_0xebd6('0x19')),'defaultValue':_0xebd6('0x18')},'dialPrefix':{'type':Sequelize[_0xebd6('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xebd6('0xa')](0x3)[_0xebd6('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xebd6('0x1a')},'dialCutDigit':{'type':Sequelize[_0xebd6('0xa')](0x3)[_0xebd6('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xebd6('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xebd6('0x1b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xebd6('0xa')](0x5)[_0xebd6('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xebd6('0x1c')},'dialDropMaxRetry':{'type':Sequelize[_0xebd6('0xa')](0x3)[_0xebd6('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xebd6('0x1d')},'dialDropRetryFrequency':{'type':Sequelize[_0xebd6('0xa')](0x5)[_0xebd6('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xebd6('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xebd6('0xa')](0x3)[_0xebd6('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xebd6('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xebd6('0xa')](0x5)[_0xebd6('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xebd6('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xebd6('0x20')},'dialMachineRetryFrequency':{'type':Sequelize[_0xebd6('0xa')](0x5)[_0xebd6('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xebd6('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xebd6('0xa')](0x3)[_0xebd6('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xebd6('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xebd6('0x22')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 9ddf5f3..895f291 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 _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 +var _0x7906=['phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','sequelize','all','removeLists','getBlackLists','addBlackLists','push','removeBlackLists','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','set','Content-Range','reject','save','update','then','destroy','UserProfileResource','stack','name','send','index','map','Campaign','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','offset','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','rawAttributes','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','IvrCampaigns','UserProfileSection','find','userProfileId','autoAssociation','error','clone','params','omit','updatedAt','createdAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','CmHopper','hasOwnProperty','CampaignId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','CmList','getLists','addLists','ids','spread','dialCheckDuplicateType','insert','phone','scheduledAt','ContactId','ListId','select','field','CmListId','toString','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','cm_hopper','CampaignId\x20=\x20?','onlyIfOpen','into','fromQuery'];(function(_0x3cad98,_0x3a6539){var _0x53f43c=function(_0x44ff9c){while(--_0x44ff9c){_0x3cad98['push'](_0x3cad98['shift']());}};_0x53f43c(++_0x3a6539);}(_0x7906,0x90));var _0x6790=function(_0x264e92,_0x3bd031){_0x264e92=_0x264e92-0x0;var _0x4a5a54=_0x7906[_0x264e92];return _0x4a5a54;};'use strict';var pdf=require(_0x6790('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6790('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6790('0x2'));var rp=require(_0x6790('0x3'));var moment=require(_0x6790('0x4'));var BPromise=require(_0x6790('0x5'));var Mustache=require(_0x6790('0x6'));var util=require(_0x6790('0x7'));var path=require(_0x6790('0x8'));var sox=require(_0x6790('0x9'));var csv=require('to-csv');var ejs=require(_0x6790('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6790('0xb'));var deskjs=require(_0x6790('0xc'));var toCsv=require(_0x6790('0xd'));var querystring=require('querystring');var Papa=require(_0x6790('0xe'));var Redis=require(_0x6790('0xf'));var authService=require(_0x6790('0x10'));var qs=require(_0x6790('0x11'));var as=require(_0x6790('0x12'));var hardwareService=require(_0x6790('0x13'));var logger=require('../../config/logger')(_0x6790('0x14'));var utils=require(_0x6790('0x15'));var config=require(_0x6790('0x16'));var db=require(_0x6790('0x17'))['db'];function respondWithStatusCode(_0x447e63,_0x53249d){_0x53249d=_0x53249d||0xcc;return function(_0x2a48b5){if(_0x2a48b5){return _0x447e63[_0x6790('0x18')](_0x53249d);}return _0x447e63[_0x6790('0x19')](_0x53249d)[_0x6790('0x1a')]();};}function respondWithResult(_0x13c30a,_0x2b71ac){_0x2b71ac=_0x2b71ac||0xc8;return function(_0x30e6c4){if(_0x30e6c4){return _0x13c30a[_0x6790('0x19')](_0x2b71ac)['json'](_0x30e6c4);}};}function respondWithFilteredResult(_0x1271fc,_0x136c63){return function(_0x39d9ed){if(_0x39d9ed){var _0x1d48e2=_0x39d9ed[_0x6790('0x1b')],_0x59e388=_0x136c63['offset'],_0x2cf674=_0x136c63['offset']+_0x136c63['limit'],_0x34c35b;if(_0x2cf674>=_0x1d48e2){_0x2cf674=_0x1d48e2;_0x34c35b=0xc8;}else{_0x34c35b=0xce;}_0x1271fc[_0x6790('0x19')](_0x34c35b);return _0x1271fc[_0x6790('0x1c')](_0x6790('0x1d'),_0x59e388+'-'+_0x2cf674+'/'+_0x1d48e2)['json'](_0x39d9ed);}return null;};}function patchUpdates(_0x43b148){return function(_0x4ac478){try{jsonpatch['apply'](_0x4ac478,_0x43b148,!![]);}catch(_0x2ac7ef){return BPromise[_0x6790('0x1e')](_0x2ac7ef);}return _0x4ac478[_0x6790('0x1f')]();};}function saveUpdates(_0x3e9263,_0x5229a8){return function(_0xf00853){if(_0xf00853){return _0xf00853[_0x6790('0x20')](_0x3e9263)[_0x6790('0x21')](function(_0x2f0bd3){return _0x2f0bd3;});}return null;};}function removeEntity(_0x187599,_0x27e9e6){return function(_0x47f512){if(_0x47f512){return _0x47f512[_0x6790('0x22')]()[_0x6790('0x21')](function(){var _0x3869b0=_0x47f512['get']({'plain':!![]});var _0x41de1f='IvrCampaigns';return db[_0x6790('0x23')][_0x6790('0x22')]({'where':{'type':_0x41de1f,'resourceId':_0x3869b0['id']}})['then'](function(){return _0x47f512;});})[_0x6790('0x21')](function(){_0x187599['status'](0xcc)[_0x6790('0x1a')]();});}};}function handleEntityNotFound(_0x2e4125,_0x1615e7){return function(_0x74c186){if(!_0x74c186){_0x2e4125['sendStatus'](0x194);}return _0x74c186;};}function handleError(_0x16cc76,_0x4f49b2){_0x4f49b2=_0x4f49b2||0x1f4;return function(_0x637ec5){logger['error'](_0x637ec5[_0x6790('0x24')]);if(_0x637ec5['name']){delete _0x637ec5[_0x6790('0x25')];}_0x16cc76[_0x6790('0x19')](_0x4f49b2)[_0x6790('0x26')](_0x637ec5);};}exports[_0x6790('0x27')]=function(_0x2c7715,_0x2fe675){var _0x2eed33={},_0x350cfb={},_0x5e361f={'count':0x0,'rows':[]};var _0xee51b1=_[_0x6790('0x28')](db[_0x6790('0x29')]['rawAttributes'],function(_0x396a1a){return{'name':_0x396a1a[_0x6790('0x2a')],'type':_0x396a1a[_0x6790('0x2b')][_0x6790('0x2c')]};});_0x350cfb[_0x6790('0x2d')]=_['map'](_0xee51b1,_0x6790('0x25'));_0x350cfb[_0x6790('0x2e')]=_[_0x6790('0x2f')](_0x2c7715[_0x6790('0x2e')]);_0x350cfb[_0x6790('0x30')]=_[_0x6790('0x31')](_0x350cfb[_0x6790('0x2d')],_0x350cfb[_0x6790('0x2e')]);_0x2eed33[_0x6790('0x32')]=_['intersection'](_0x350cfb[_0x6790('0x2d')],qs['fields'](_0x2c7715[_0x6790('0x2e')][_0x6790('0x33')]));_0x2eed33[_0x6790('0x32')]=_0x2eed33['attributes'][_0x6790('0x34')]?_0x2eed33[_0x6790('0x32')]:_0x350cfb[_0x6790('0x2d')];if(!_0x2c7715[_0x6790('0x2e')]['hasOwnProperty'](_0x6790('0x35'))){_0x2eed33[_0x6790('0x36')]=qs[_0x6790('0x36')](_0x2c7715[_0x6790('0x2e')][_0x6790('0x36')]);_0x2eed33[_0x6790('0x37')]=qs[_0x6790('0x37')](_0x2c7715[_0x6790('0x2e')]['offset']);}_0x2eed33[_0x6790('0x38')]=qs[_0x6790('0x39')](_0x2c7715[_0x6790('0x2e')][_0x6790('0x39')]);_0x2eed33[_0x6790('0x3a')]=qs['filters'](_[_0x6790('0x3b')](_0x2c7715[_0x6790('0x2e')],_0x350cfb[_0x6790('0x30')]),_0xee51b1);if(_0x2c7715[_0x6790('0x2e')][_0x6790('0x3c')]){_0x2eed33[_0x6790('0x3a')]=_[_0x6790('0x3d')](_0x2eed33[_0x6790('0x3a')],{'$or':_['map'](_0xee51b1,function(_0x1c8e8a){if(_0x1c8e8a['type']!==_0x6790('0x3e')){var _0x1650c7={};_0x1650c7[_0x1c8e8a['name']]={'$like':'%'+_0x2c7715[_0x6790('0x2e')]['filter']+'%'};return _0x1650c7;}})});}_0x2eed33=_[_0x6790('0x3d')]({},_0x2eed33,_0x2c7715['options']);var _0x95d820={'where':_0x2eed33[_0x6790('0x3a')]};return db['Campaign']['count'](_0x95d820)['then'](function(_0x3cc50d){_0x5e361f[_0x6790('0x1b')]=_0x3cc50d;if(_0x2c7715[_0x6790('0x2e')][_0x6790('0x3f')]){_0x2eed33[_0x6790('0x40')]=[{'all':!![]}];}return db[_0x6790('0x29')]['findAll'](_0x2eed33);})[_0x6790('0x21')](function(_0x4b1ea4){_0x5e361f[_0x6790('0x41')]=_0x4b1ea4;return _0x5e361f;})['then'](respondWithFilteredResult(_0x2fe675,_0x2eed33))[_0x6790('0x42')](handleError(_0x2fe675,null));};exports[_0x6790('0x43')]=function(_0x1f7744,_0x57ce8b){var _0x1e524f={'raw':![],'where':{'id':_0x1f7744['params']['id']}},_0x459a2e={};_0x459a2e[_0x6790('0x2d')]=_[_0x6790('0x2f')](db[_0x6790('0x29')][_0x6790('0x44')]);_0x459a2e[_0x6790('0x2e')]=_[_0x6790('0x2f')](_0x1f7744[_0x6790('0x2e')]);_0x459a2e[_0x6790('0x30')]=_[_0x6790('0x31')](_0x459a2e[_0x6790('0x2d')],_0x459a2e['query']);_0x1e524f['attributes']=_[_0x6790('0x31')](_0x459a2e[_0x6790('0x2d')],qs[_0x6790('0x33')](_0x1f7744['query']['fields']));_0x1e524f[_0x6790('0x32')]=_0x1e524f['attributes'][_0x6790('0x34')]?_0x1e524f[_0x6790('0x32')]:_0x459a2e[_0x6790('0x2d')];if(_0x1f7744['query'][_0x6790('0x3f')]){_0x1e524f[_0x6790('0x40')]=[{'all':!![]}];}_0x1e524f=_[_0x6790('0x3d')]({},_0x1e524f,_0x1f7744[_0x6790('0x45')]);return db[_0x6790('0x29')]['find'](_0x1e524f)[_0x6790('0x21')](handleEntityNotFound(_0x57ce8b,null))[_0x6790('0x21')](respondWithResult(_0x57ce8b,null))['catch'](handleError(_0x57ce8b,null));};exports[_0x6790('0x46')]=function(_0x402207,_0x338b24){return db[_0x6790('0x29')][_0x6790('0x46')](_0x402207[_0x6790('0x47')],{})[_0x6790('0x21')](function(_0x3683d1){var _0x5ea41b=_0x402207['user'][_0x6790('0x48')]({'plain':!![]});if(!_0x5ea41b)throw new Error(_0x6790('0x49'));if(_0x5ea41b[_0x6790('0x4a')]===_0x6790('0x4b')){var _0x5b309d=_0x3683d1[_0x6790('0x48')]({'plain':!![]});var _0xcc851f=_0x6790('0x4c');return db[_0x6790('0x4d')][_0x6790('0x4e')]({'where':{'name':_0xcc851f,'userProfileId':_0x5ea41b[_0x6790('0x4f')]},'raw':!![]})['then'](function(_0x3c1635){if(_0x3c1635&&_0x3c1635[_0x6790('0x50')]===0x0){return db[_0x6790('0x23')]['create']({'name':_0x5b309d['name'],'resourceId':_0x5b309d['id'],'type':_0x3c1635[_0x6790('0x25')],'sectionId':_0x3c1635['id']},{})['then'](function(){return _0x3683d1;});}else{return _0x3683d1;}})[_0x6790('0x42')](function(_0x35d8e0){logger[_0x6790('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x35d8e0);throw _0x35d8e0;});}return _0x3683d1;})[_0x6790('0x21')](respondWithResult(_0x338b24,0xc9))['catch'](handleError(_0x338b24,null));};exports[_0x6790('0x52')]=function(_0x5bba8e,_0x386793){var _0x3a7644={'where':{'id':_0x5bba8e[_0x6790('0x53')]['id']}},_0x5c76fc={};_0x5c76fc[_0x6790('0x2d')]=_[_0x6790('0x2f')](db[_0x6790('0x29')][_0x6790('0x44')]);_0x3a7644[_0x6790('0x32')]=_[_0x6790('0x31')](_0x5c76fc[_0x6790('0x2d')],qs['fields'](_0x5bba8e[_0x6790('0x2e')][_0x6790('0x33')]));_0x3a7644['attributes']=_0x3a7644['attributes'][_0x6790('0x34')]?_0x3a7644[_0x6790('0x32')]:_0x5c76fc[_0x6790('0x2d')];if(_0x5bba8e['query'][_0x6790('0x3f')]){_0x3a7644[_0x6790('0x40')]=[{'all':!![]}];}_0x3a7644=_[_0x6790('0x3d')]({},_0x3a7644,_0x5bba8e[_0x6790('0x45')]);return db['Campaign']['find'](_0x3a7644)[_0x6790('0x21')](handleEntityNotFound(_0x386793,null))['then'](function(_0x3f86a3){if(_0x3f86a3){var _0x176e6f=_0x3f86a3[_0x6790('0x48')]({'plain':!![]});_0x176e6f=qs[_0x6790('0x54')](_0x176e6f,['id','createdAt',_0x6790('0x55')]);_0x5bba8e['body']=_[_0x6790('0x54')](_0x5bba8e[_0x6790('0x47')],['id',_0x6790('0x56'),'updatedAt']);return db[_0x6790('0x29')][_0x6790('0x46')](_['merge'](_0x176e6f,_0x5bba8e['body']),{'include':_0x5bba8e[_0x6790('0x2e')][_0x6790('0x3f')]?[{'all':!![]}]:undefined})['then'](function(_0x5bd9a1){var _0x7b84b9=_0x5bba8e[_0x6790('0x4b')][_0x6790('0x48')]({'plain':!![]});if(!_0x7b84b9)throw new Error(_0x6790('0x49'));if(_0x7b84b9[_0x6790('0x4a')]===_0x6790('0x4b')){var _0x52a76e=_0x5bd9a1[_0x6790('0x48')]({'plain':!![]});var _0x5c6adf=_0x6790('0x4c');return db['UserProfileSection'][_0x6790('0x4e')]({'where':{'name':_0x5c6adf,'userProfileId':_0x7b84b9[_0x6790('0x4f')]},'raw':!![]})['then'](function(_0x4362ed){if(_0x4362ed&&_0x4362ed[_0x6790('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x52a76e[_0x6790('0x25')],'resourceId':_0x52a76e['id'],'type':_0x4362ed[_0x6790('0x25')],'sectionId':_0x4362ed['id']},{})['then'](function(){return _0x5bd9a1;});}else{return _0x5bd9a1;}})[_0x6790('0x42')](function(_0x3ccf66){logger[_0x6790('0x51')](_0x6790('0x57'),_0x3ccf66);throw _0x3ccf66;});}return _0x5bd9a1;});}})['then'](respondWithResult(_0x386793,0xc9))['catch'](handleError(_0x386793,null));};exports[_0x6790('0x20')]=function(_0x5377bc,_0xc66b08){if(_0x5377bc[_0x6790('0x47')]['id']){delete _0x5377bc['body']['id'];}return db['Campaign'][_0x6790('0x4e')]({'where':{'id':_0x5377bc[_0x6790('0x53')]['id']}})['then'](handleEntityNotFound(_0xc66b08,null))['then'](saveUpdates(_0x5377bc[_0x6790('0x47')],null))[_0x6790('0x21')](respondWithResult(_0xc66b08,null))[_0x6790('0x42')](handleError(_0xc66b08,null));};exports['destroy']=function(_0x757657,_0x4e4de7){return db[_0x6790('0x29')]['find']({'where':{'id':_0x757657[_0x6790('0x53')]['id']}})['then'](handleEntityNotFound(_0x4e4de7,null))['then'](removeEntity(_0x4e4de7,null))[_0x6790('0x42')](handleError(_0x4e4de7,null));};exports['getHoppers']=function(_0x25f03d,_0x78c952,_0x43b41e){var _0x59ecba={'raw':!![],'where':{}};var _0x189cd7={};var _0x412232={'count':0x0,'rows':[]};return db['Campaign'][_0x6790('0x58')]({'where':{'id':_0x25f03d[_0x6790('0x53')]['id']}})['then'](handleEntityNotFound(_0x78c952,null))[_0x6790('0x21')](function(_0x20ef0d){if(_0x20ef0d){_0x189cd7[_0x6790('0x2d')]=_[_0x6790('0x2f')](db[_0x6790('0x59')][_0x6790('0x44')]);_0x189cd7[_0x6790('0x2e')]=_[_0x6790('0x2f')](_0x25f03d[_0x6790('0x2e')]);_0x189cd7['filters']=_[_0x6790('0x31')](_0x189cd7[_0x6790('0x2d')],_0x189cd7[_0x6790('0x2e')]);_0x59ecba[_0x6790('0x32')]=_[_0x6790('0x31')](_0x189cd7['model'],qs[_0x6790('0x33')](_0x25f03d[_0x6790('0x2e')][_0x6790('0x33')]));_0x59ecba[_0x6790('0x32')]=_0x59ecba['attributes'][_0x6790('0x34')]?_0x59ecba[_0x6790('0x32')]:_0x189cd7[_0x6790('0x2d')];if(!_0x25f03d[_0x6790('0x2e')][_0x6790('0x5a')](_0x6790('0x35'))){_0x59ecba[_0x6790('0x36')]=qs[_0x6790('0x36')](_0x25f03d[_0x6790('0x2e')][_0x6790('0x36')]);_0x59ecba[_0x6790('0x37')]=qs['offset'](_0x25f03d[_0x6790('0x2e')][_0x6790('0x37')]);}_0x59ecba[_0x6790('0x38')]=qs['sort'](_0x25f03d['query'][_0x6790('0x39')]);_0x59ecba['where']=qs[_0x6790('0x30')](_['pick'](_0x25f03d[_0x6790('0x2e')],_0x189cd7[_0x6790('0x30')]));_0x59ecba['where'][_0x6790('0x5b')]=_0x20ef0d['id'];if(_0x25f03d['query']['filter']){_0x59ecba[_0x6790('0x3a')]=_[_0x6790('0x3d')](_0x59ecba[_0x6790('0x3a')],{'$or':_[_0x6790('0x28')](_0x59ecba[_0x6790('0x32')],function(_0x119d4b){var _0x55d856={};_0x55d856[_0x119d4b]={'$like':'%'+_0x25f03d[_0x6790('0x2e')]['filter']+'%'};return _0x55d856;})});}_0x59ecba=_[_0x6790('0x3d')]({},_0x59ecba,_0x25f03d['options']);return db['CmHopper'][_0x6790('0x1b')]({'where':_0x59ecba['where']})[_0x6790('0x21')](function(_0x4cc82b){_0x412232[_0x6790('0x1b')]=_0x4cc82b;if(_0x25f03d[_0x6790('0x2e')]['includeAll']){_0x59ecba[_0x6790('0x40')]=[{'all':!![]}];}return db['CmHopper'][_0x6790('0x5c')](_0x59ecba);})[_0x6790('0x21')](function(_0x2d1c48){_0x412232[_0x6790('0x41')]=_0x2d1c48;return _0x412232;});}})[_0x6790('0x21')](respondWithFilteredResult(_0x78c952,_0x59ecba))[_0x6790('0x42')](handleError(_0x78c952,null));};exports[_0x6790('0x5d')]=function(_0x258e1c,_0x21e0c2,_0x5b42f0){var _0x3dabdf={'raw':!![],'where':{}};var _0x41a139={};var _0x2778d1={'count':0x0,'rows':[]};return db[_0x6790('0x29')][_0x6790('0x58')]({'where':{'id':_0x258e1c[_0x6790('0x53')]['id']}})[_0x6790('0x21')](handleEntityNotFound(_0x21e0c2,null))['then'](function(_0x10eb69){if(_0x10eb69){_0x41a139[_0x6790('0x2d')]=_[_0x6790('0x2f')](db[_0x6790('0x5e')]['rawAttributes']);_0x41a139[_0x6790('0x2e')]=_[_0x6790('0x2f')](_0x258e1c[_0x6790('0x2e')]);_0x41a139[_0x6790('0x30')]=_[_0x6790('0x31')](_0x41a139[_0x6790('0x2d')],_0x41a139['query']);_0x3dabdf[_0x6790('0x32')]=_[_0x6790('0x31')](_0x41a139[_0x6790('0x2d')],qs['fields'](_0x258e1c[_0x6790('0x2e')][_0x6790('0x33')]));_0x3dabdf[_0x6790('0x32')]=_0x3dabdf[_0x6790('0x32')][_0x6790('0x34')]?_0x3dabdf[_0x6790('0x32')]:_0x41a139[_0x6790('0x2d')];if(!_0x258e1c[_0x6790('0x2e')][_0x6790('0x5a')]('nolimit')){_0x3dabdf[_0x6790('0x36')]=qs[_0x6790('0x36')](_0x258e1c[_0x6790('0x2e')][_0x6790('0x36')]);_0x3dabdf['offset']=qs[_0x6790('0x37')](_0x258e1c[_0x6790('0x2e')]['offset']);}_0x3dabdf[_0x6790('0x38')]=qs['sort'](_0x258e1c[_0x6790('0x2e')]['sort']);_0x3dabdf[_0x6790('0x3a')]=qs[_0x6790('0x30')](_['pick'](_0x258e1c['query'],_0x41a139[_0x6790('0x30')]));_0x3dabdf[_0x6790('0x3a')][_0x6790('0x5b')]=_0x10eb69['id'];if(_0x258e1c[_0x6790('0x2e')][_0x6790('0x3c')]){_0x3dabdf[_0x6790('0x3a')]=_[_0x6790('0x3d')](_0x3dabdf['where'],{'$or':_[_0x6790('0x28')](_0x3dabdf[_0x6790('0x32')],function(_0x1d55c3){var _0x2caf26={};_0x2caf26[_0x1d55c3]={'$like':'%'+_0x258e1c[_0x6790('0x2e')][_0x6790('0x3c')]+'%'};return _0x2caf26;})});}_0x3dabdf=_[_0x6790('0x3d')]({},_0x3dabdf,_0x258e1c[_0x6790('0x45')]);return db[_0x6790('0x5e')][_0x6790('0x1b')]({'where':_0x3dabdf[_0x6790('0x3a')]})[_0x6790('0x21')](function(_0x578f86){_0x2778d1[_0x6790('0x1b')]=_0x578f86;if(_0x258e1c[_0x6790('0x2e')]['includeAll']){_0x3dabdf[_0x6790('0x40')]=[{'all':!![]}];}return db[_0x6790('0x5e')]['findAll'](_0x3dabdf);})['then'](function(_0x37c0b9){_0x2778d1[_0x6790('0x41')]=_0x37c0b9;return _0x2778d1;});}})[_0x6790('0x21')](respondWithFilteredResult(_0x21e0c2,_0x3dabdf))[_0x6790('0x42')](handleError(_0x21e0c2,null));};exports[_0x6790('0x5f')]=function(_0x3c91eb,_0x415234,_0x686e24){var _0x265a9b={'raw':!![],'where':{}};var _0x2145da={};var _0x386056={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x3c91eb[_0x6790('0x53')]['id']}})[_0x6790('0x21')](handleEntityNotFound(_0x415234,null))[_0x6790('0x21')](function(_0x1fb73a){if(_0x1fb73a){_0x2145da[_0x6790('0x2d')]=_['keys'](db['CmHopperFinal'][_0x6790('0x44')]);_0x2145da[_0x6790('0x2e')]=_[_0x6790('0x2f')](_0x3c91eb[_0x6790('0x2e')]);_0x2145da[_0x6790('0x30')]=_[_0x6790('0x31')](_0x2145da[_0x6790('0x2d')],_0x2145da[_0x6790('0x2e')]);_0x265a9b[_0x6790('0x32')]=_[_0x6790('0x31')](_0x2145da[_0x6790('0x2d')],qs['fields'](_0x3c91eb[_0x6790('0x2e')][_0x6790('0x33')]));_0x265a9b[_0x6790('0x32')]=_0x265a9b[_0x6790('0x32')]['length']?_0x265a9b[_0x6790('0x32')]:_0x2145da[_0x6790('0x2d')];if(!_0x3c91eb['query']['hasOwnProperty']('nolimit')){_0x265a9b[_0x6790('0x36')]=qs[_0x6790('0x36')](_0x3c91eb[_0x6790('0x2e')][_0x6790('0x36')]);_0x265a9b['offset']=qs[_0x6790('0x37')](_0x3c91eb[_0x6790('0x2e')][_0x6790('0x37')]);}_0x265a9b[_0x6790('0x38')]=qs['sort'](_0x3c91eb[_0x6790('0x2e')]['sort']);_0x265a9b[_0x6790('0x3a')]=qs[_0x6790('0x30')](_[_0x6790('0x3b')](_0x3c91eb[_0x6790('0x2e')],_0x2145da[_0x6790('0x30')]));_0x265a9b[_0x6790('0x3a')]['CampaignId']=_0x1fb73a['id'];if(_0x3c91eb[_0x6790('0x2e')][_0x6790('0x3c')]){_0x265a9b['where']=_[_0x6790('0x3d')](_0x265a9b['where'],{'$or':_[_0x6790('0x28')](_0x265a9b[_0x6790('0x32')],function(_0xa7a09a){var _0x2b3bf8={};_0x2b3bf8[_0xa7a09a]={'$like':'%'+_0x3c91eb['query'][_0x6790('0x3c')]+'%'};return _0x2b3bf8;})});}_0x265a9b=_[_0x6790('0x3d')]({},_0x265a9b,_0x3c91eb[_0x6790('0x45')]);return db[_0x6790('0x60')][_0x6790('0x1b')]({'where':_0x265a9b[_0x6790('0x3a')]})[_0x6790('0x21')](function(_0x26e36a){_0x386056[_0x6790('0x1b')]=_0x26e36a;if(_0x3c91eb[_0x6790('0x2e')][_0x6790('0x3f')]){_0x265a9b[_0x6790('0x40')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x265a9b);})[_0x6790('0x21')](function(_0x561153){_0x386056[_0x6790('0x41')]=_0x561153;return _0x386056;});}})[_0x6790('0x21')](respondWithFilteredResult(_0x415234,_0x265a9b))[_0x6790('0x42')](handleError(_0x415234,null));};exports['getHopperBlacks']=function(_0x3fd29d,_0x33bc7a,_0x14afda){var _0x48d7e6={'raw':!![],'where':{}};var _0x5d73f8={};var _0x279712={'count':0x0,'rows':[]};return db[_0x6790('0x29')][_0x6790('0x58')]({'where':{'id':_0x3fd29d[_0x6790('0x53')]['id']}})[_0x6790('0x21')](handleEntityNotFound(_0x33bc7a,null))['then'](function(_0x235e29){if(_0x235e29){_0x5d73f8[_0x6790('0x2d')]=_['keys'](db[_0x6790('0x61')]['rawAttributes']);_0x5d73f8[_0x6790('0x2e')]=_[_0x6790('0x2f')](_0x3fd29d[_0x6790('0x2e')]);_0x5d73f8[_0x6790('0x30')]=_['intersection'](_0x5d73f8[_0x6790('0x2d')],_0x5d73f8[_0x6790('0x2e')]);_0x48d7e6['attributes']=_[_0x6790('0x31')](_0x5d73f8[_0x6790('0x2d')],qs[_0x6790('0x33')](_0x3fd29d[_0x6790('0x2e')][_0x6790('0x33')]));_0x48d7e6[_0x6790('0x32')]=_0x48d7e6[_0x6790('0x32')][_0x6790('0x34')]?_0x48d7e6[_0x6790('0x32')]:_0x5d73f8['model'];if(!_0x3fd29d[_0x6790('0x2e')]['hasOwnProperty']('nolimit')){_0x48d7e6[_0x6790('0x36')]=qs[_0x6790('0x36')](_0x3fd29d[_0x6790('0x2e')]['limit']);_0x48d7e6['offset']=qs[_0x6790('0x37')](_0x3fd29d[_0x6790('0x2e')][_0x6790('0x37')]);}_0x48d7e6[_0x6790('0x38')]=qs['sort'](_0x3fd29d['query'][_0x6790('0x39')]);_0x48d7e6['where']=qs[_0x6790('0x30')](_['pick'](_0x3fd29d[_0x6790('0x2e')],_0x5d73f8[_0x6790('0x30')]));_0x48d7e6['where']['CampaignId']=_0x235e29['id'];if(_0x3fd29d[_0x6790('0x2e')][_0x6790('0x3c')]){_0x48d7e6['where']=_[_0x6790('0x3d')](_0x48d7e6['where'],{'$or':_[_0x6790('0x28')](_0x48d7e6[_0x6790('0x32')],function(_0x1996fb){var _0x3c0c29={};_0x3c0c29[_0x1996fb]={'$like':'%'+_0x3fd29d['query']['filter']+'%'};return _0x3c0c29;})});}_0x48d7e6=_['merge']({},_0x48d7e6,_0x3fd29d['options']);return db[_0x6790('0x61')]['count']({'where':_0x48d7e6['where']})[_0x6790('0x21')](function(_0x46a192){_0x279712[_0x6790('0x1b')]=_0x46a192;if(_0x3fd29d[_0x6790('0x2e')]['includeAll']){_0x48d7e6[_0x6790('0x40')]=[{'all':!![]}];}return db[_0x6790('0x61')][_0x6790('0x5c')](_0x48d7e6);})[_0x6790('0x21')](function(_0x2a0393){_0x279712[_0x6790('0x41')]=_0x2a0393;return _0x279712;});}})[_0x6790('0x21')](respondWithFilteredResult(_0x33bc7a,_0x48d7e6))[_0x6790('0x42')](handleError(_0x33bc7a,null));};exports['getLists']=function(_0x2b246c,_0x546e94,_0x55edfd){var _0x4b1615={};var _0x38f935={};var _0x3b2119;var _0x497274;return db['Campaign'][_0x6790('0x58')]({'where':{'id':_0x2b246c[_0x6790('0x53')]['id']}})[_0x6790('0x21')](handleEntityNotFound(_0x546e94,null))[_0x6790('0x21')](function(_0x41b08b){if(_0x41b08b){_0x3b2119=_0x41b08b;_0x38f935[_0x6790('0x2d')]=_[_0x6790('0x2f')](db[_0x6790('0x62')]['rawAttributes']);_0x38f935[_0x6790('0x2e')]=_[_0x6790('0x2f')](_0x2b246c['query']);_0x38f935[_0x6790('0x30')]=_[_0x6790('0x31')](_0x38f935['model'],_0x38f935[_0x6790('0x2e')]);_0x4b1615[_0x6790('0x32')]=_[_0x6790('0x31')](_0x38f935[_0x6790('0x2d')],qs['fields'](_0x2b246c[_0x6790('0x2e')][_0x6790('0x33')]));_0x4b1615[_0x6790('0x32')]=_0x4b1615[_0x6790('0x32')][_0x6790('0x34')]?_0x4b1615[_0x6790('0x32')]:_0x38f935[_0x6790('0x2d')];_0x4b1615[_0x6790('0x38')]=qs[_0x6790('0x39')](_0x2b246c[_0x6790('0x2e')][_0x6790('0x39')]);_0x4b1615[_0x6790('0x3a')]=qs[_0x6790('0x30')](_[_0x6790('0x3b')](_0x2b246c[_0x6790('0x2e')],_0x38f935[_0x6790('0x30')]));if(_0x2b246c['query'][_0x6790('0x3c')]){_0x4b1615['where']=_[_0x6790('0x3d')](_0x4b1615[_0x6790('0x3a')],{'$or':_['map'](_0x4b1615[_0x6790('0x32')],function(_0x3b90a6){var _0x2d8868={};_0x2d8868[_0x3b90a6]={'$like':'%'+_0x2b246c[_0x6790('0x2e')][_0x6790('0x3c')]+'%'};return _0x2d8868;})});}_0x4b1615=_['merge']({},_0x4b1615,_0x2b246c[_0x6790('0x45')]);return _0x3b2119[_0x6790('0x63')](_0x4b1615);}})[_0x6790('0x21')](function(_0xb7b91a){if(_0xb7b91a){_0x497274=_0xb7b91a[_0x6790('0x34')];if(!_0x2b246c['query'][_0x6790('0x5a')](_0x6790('0x35'))){_0x4b1615[_0x6790('0x36')]=qs[_0x6790('0x36')](_0x2b246c['query'][_0x6790('0x36')]);_0x4b1615['offset']=qs[_0x6790('0x37')](_0x2b246c[_0x6790('0x2e')][_0x6790('0x37')]);}return _0x3b2119[_0x6790('0x63')](_0x4b1615);}})['then'](function(_0x19621a){if(_0x19621a){return _0x19621a?{'count':_0x497274,'rows':_0x19621a}:null;}})[_0x6790('0x21')](respondWithResult(_0x546e94,null))[_0x6790('0x42')](handleError(_0x546e94,null));};exports[_0x6790('0x64')]=function(_0x290eaf,_0x8c9d57,_0xfdf74c){var _0x1e69a4,_0x52ba3d;return db[_0x6790('0x29')][_0x6790('0x4e')]({'where':{'id':_0x290eaf['params']['id']}})[_0x6790('0x21')](handleEntityNotFound(_0x8c9d57,null))[_0x6790('0x21')](function(_0x56613c){if(_0x56613c){_0x52ba3d=_0x56613c;return _0x56613c['addLists'](_0x290eaf[_0x6790('0x47')][_0x6790('0x65')],_[_0x6790('0x54')](_0x290eaf[_0x6790('0x47')],['ids','id'])||{});}return null;})[_0x6790('0x66')](function(_0x9463c0){var _0x27bcf5;_0x1e69a4=_0x9463c0||[];var _0x4f7054=[];if(_0x9463c0){for(var _0x25f201=0x0;_0x25f201<_0x9463c0[_0x6790('0x34')];_0x25f201+=0x1){var _0x59fcde=_0x9463c0[_0x25f201][_0x6790('0x48')]({'plain':!![]});_0x52ba3d['dialCheckDuplicateType']=_0x290eaf[_0x6790('0x47')][_0x6790('0x67')]?_0x290eaf[_0x6790('0x47')]['dialCheckDuplicateType']:_0x52ba3d['dialCheckDuplicateType'];switch(_0x52ba3d['dialCheckDuplicateType']){case'always':_0x27bcf5=squel[_0x6790('0x68')]()['into']('cm_hopper')['fromQuery']([_0x6790('0x69'),_0x6790('0x6a'),_0x6790('0x6b'),_0x6790('0x6c'),_0x6790('0x5b'),'createdAt','updatedAt'],squel[_0x6790('0x6d')]()[_0x6790('0x6e')](_0x6790('0x69'),_0x6790('0x69'))[_0x6790('0x6e')]('NOW()','scheduledAt')[_0x6790('0x6e')]('id',_0x6790('0x6b'))['field'](_0x59fcde[_0x6790('0x6f')][_0x6790('0x70')](),'ListId')['field'](_0x290eaf[_0x6790('0x53')]['id']['toString'](),'CampaignId')[_0x6790('0x6e')]('NOW()',_0x6790('0x56'))[_0x6790('0x6e')](_0x6790('0x71'),_0x6790('0x55'))[_0x6790('0x72')](_0x6790('0x73'))['where'](_0x6790('0x74'))['where'](_0x6790('0x75'),_0x59fcde['CmListId']['toString']())['where']('phone\x20IS\x20NOT\x20NULL')[_0x6790('0x3a')](_0x6790('0x76'),squel[_0x6790('0x6d')]()[_0x6790('0x6e')](_0x6790('0x77'))[_0x6790('0x72')](_0x6790('0x78'))[_0x6790('0x3a')]('CampaignId\x20=\x20?',_0x290eaf[_0x6790('0x53')]['id'][_0x6790('0x70')]()))['where'](_0x6790('0x76'),squel[_0x6790('0x6d')]()[_0x6790('0x6e')]('COALESCE(phone,\x27\x27)')['from'](_0x6790('0x79'))[_0x6790('0x3a')](_0x6790('0x7a'),_0x290eaf[_0x6790('0x53')]['id'][_0x6790('0x70')]())))['toString']();break;case _0x6790('0x7b'):_0x27bcf5=squel[_0x6790('0x68')]()[_0x6790('0x7c')](_0x6790('0x79'))[_0x6790('0x7d')]([_0x6790('0x69'),_0x6790('0x6a'),_0x6790('0x6b'),_0x6790('0x6c'),_0x6790('0x5b'),_0x6790('0x56'),_0x6790('0x55')],squel[_0x6790('0x6d')]()[_0x6790('0x6e')](_0x6790('0x69'),_0x6790('0x69'))[_0x6790('0x6e')](_0x6790('0x71'),_0x6790('0x6a'))[_0x6790('0x6e')]('id','ContactId')[_0x6790('0x6e')](_0x59fcde[_0x6790('0x6f')][_0x6790('0x70')](),_0x6790('0x6c'))[_0x6790('0x6e')](_0x290eaf[_0x6790('0x53')]['id'][_0x6790('0x70')](),'CampaignId')[_0x6790('0x6e')](_0x6790('0x71'),_0x6790('0x56'))['field'](_0x6790('0x71'),_0x6790('0x55'))['from'](_0x6790('0x73'))[_0x6790('0x3a')](_0x6790('0x74'))[_0x6790('0x3a')](_0x6790('0x75'),_0x59fcde['CmListId'][_0x6790('0x70')]())[_0x6790('0x3a')](_0x6790('0x7e'))[_0x6790('0x3a')](_0x6790('0x76'),squel[_0x6790('0x6d')]()[_0x6790('0x6e')](_0x6790('0x7f'))[_0x6790('0x72')](_0x6790('0x79'))[_0x6790('0x3a')](_0x6790('0x7a'),_0x290eaf[_0x6790('0x53')]['id'][_0x6790('0x70')]())))[_0x6790('0x70')]();break;default:_0x27bcf5=squel[_0x6790('0x68')]()['into'](_0x6790('0x79'))[_0x6790('0x7d')]([_0x6790('0x69'),_0x6790('0x6a'),_0x6790('0x6b'),'ListId',_0x6790('0x5b'),'createdAt',_0x6790('0x55')],squel[_0x6790('0x6d')]()[_0x6790('0x6e')](_0x6790('0x69'),_0x6790('0x69'))[_0x6790('0x6e')](_0x6790('0x71'),_0x6790('0x6a'))['field']('id',_0x6790('0x6b'))[_0x6790('0x6e')](_0x59fcde[_0x6790('0x6f')][_0x6790('0x70')](),_0x6790('0x6c'))[_0x6790('0x6e')](_0x290eaf[_0x6790('0x53')]['id'][_0x6790('0x70')](),'CampaignId')[_0x6790('0x6e')](_0x6790('0x71'),_0x6790('0x56'))['field'](_0x6790('0x71'),'updatedAt')[_0x6790('0x72')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x6790('0x3a')](_0x6790('0x75'),_0x59fcde['CmListId']['toString']())[_0x6790('0x3a')](_0x6790('0x7e')))[_0x6790('0x70')]();}_0x4f7054['push'](db[_0x6790('0x80')][_0x6790('0x2e')](_0x27bcf5));}return BPromise[_0x6790('0x81')](_0x4f7054);}})[_0x6790('0x21')](function(){return _0x1e69a4;})[_0x6790('0x21')](respondWithResult(_0x8c9d57,null))[_0x6790('0x42')](handleError(_0x8c9d57,null));};exports['removeLists']=function(_0x11b69d,_0x3ec8a2,_0x5af5de){return db['Campaign']['find']({'where':{'id':_0x11b69d[_0x6790('0x53')]['id']}})[_0x6790('0x21')](handleEntityNotFound(_0x3ec8a2,null))[_0x6790('0x21')](function(_0x3eb597){if(_0x3eb597){return _0x3eb597[_0x6790('0x82')](_0x11b69d[_0x6790('0x2e')][_0x6790('0x65')]);}})[_0x6790('0x21')](function(_0x299522){if(_0x299522){return db[_0x6790('0x59')][_0x6790('0x22')]({'where':{'ListId':_0x11b69d[_0x6790('0x2e')]['ids'],'CampaignId':_0x11b69d['params']['id']}})['then'](function(){return _0x299522;});}})[_0x6790('0x21')](respondWithStatusCode(_0x3ec8a2,null))[_0x6790('0x42')](handleError(_0x3ec8a2,null));};exports[_0x6790('0x83')]=function(_0x1c762a,_0x24c8af,_0x5d4cd5){var _0x1e746d={'raw':!![],'where':{}};var _0x33e3f0={};var _0x3c2d3f={'count':0x0,'rows':[]};return db[_0x6790('0x29')][_0x6790('0x58')]({'where':{'id':_0x1c762a['params']['id']}})[_0x6790('0x21')](handleEntityNotFound(_0x24c8af,null))[_0x6790('0x21')](function(_0x1b3d7c){if(_0x1b3d7c){_0x33e3f0[_0x6790('0x2d')]=_['keys'](db[_0x6790('0x62')]['rawAttributes']);_0x33e3f0[_0x6790('0x2e')]=_[_0x6790('0x2f')](_0x1c762a[_0x6790('0x2e')]);_0x33e3f0[_0x6790('0x30')]=_[_0x6790('0x31')](_0x33e3f0[_0x6790('0x2d')],_0x33e3f0[_0x6790('0x2e')]);_0x1e746d[_0x6790('0x32')]=_[_0x6790('0x31')](_0x33e3f0[_0x6790('0x2d')],qs[_0x6790('0x33')](_0x1c762a['query'][_0x6790('0x33')]));_0x1e746d[_0x6790('0x32')]=_0x1e746d[_0x6790('0x32')][_0x6790('0x34')]?_0x1e746d['attributes']:_0x33e3f0[_0x6790('0x2d')];if(!_0x1c762a[_0x6790('0x2e')]['hasOwnProperty'](_0x6790('0x35'))){_0x1e746d['limit']=qs[_0x6790('0x36')](_0x1c762a[_0x6790('0x2e')][_0x6790('0x36')]);_0x1e746d[_0x6790('0x37')]=qs[_0x6790('0x37')](_0x1c762a[_0x6790('0x2e')][_0x6790('0x37')]);}_0x1e746d[_0x6790('0x38')]=qs[_0x6790('0x39')](_0x1c762a[_0x6790('0x2e')]['sort']);_0x1e746d[_0x6790('0x3a')]=qs['filters'](_['pick'](_0x1c762a[_0x6790('0x2e')],_0x33e3f0[_0x6790('0x30')]));_0x1e746d[_0x6790('0x3a')][_0x6790('0x5b')]=_0x1b3d7c['id'];if(_0x1c762a[_0x6790('0x2e')][_0x6790('0x3c')]){_0x1e746d[_0x6790('0x3a')]=_[_0x6790('0x3d')](_0x1e746d[_0x6790('0x3a')],{'$or':_['map'](_0x1e746d[_0x6790('0x32')],function(_0x5f01ea){var _0x15101a={};_0x15101a[_0x5f01ea]={'$like':'%'+_0x1c762a[_0x6790('0x2e')][_0x6790('0x3c')]+'%'};return _0x15101a;})});}_0x1e746d=_['merge']({},_0x1e746d,_0x1c762a['options']);return db[_0x6790('0x62')][_0x6790('0x1b')]({'where':_0x1e746d[_0x6790('0x3a')]})[_0x6790('0x21')](function(_0x478a93){_0x3c2d3f['count']=_0x478a93;if(_0x1c762a[_0x6790('0x2e')][_0x6790('0x3f')]){_0x1e746d[_0x6790('0x40')]=[{'all':!![]}];}return db[_0x6790('0x62')]['findAll'](_0x1e746d);})[_0x6790('0x21')](function(_0x8cac4){_0x3c2d3f['rows']=_0x8cac4;return _0x3c2d3f;});}})[_0x6790('0x21')](respondWithFilteredResult(_0x24c8af,_0x1e746d))['catch'](handleError(_0x24c8af,null));};exports[_0x6790('0x84')]=function(_0x51f5e6,_0x3e5af4,_0x42e6bf){var _0x5ce890,_0xc5b874;return db['Campaign'][_0x6790('0x4e')]({'where':{'id':_0x51f5e6[_0x6790('0x53')]['id']}})[_0x6790('0x21')](handleEntityNotFound(_0x3e5af4,null))['then'](function(_0x7b752c){if(_0x7b752c){_0xc5b874=_0x7b752c;return _0x7b752c[_0x6790('0x84')](_0x51f5e6[_0x6790('0x47')][_0x6790('0x65')],_[_0x6790('0x54')](_0x51f5e6['body'],[_0x6790('0x65'),'id'])||{});}return null;})[_0x6790('0x66')](function(_0x3b8928){var _0x513907;_0x5ce890=_0x3b8928||[];var _0x4409f9=[];if(_0x3b8928){for(var _0xba1ad5=0x0;_0xba1ad5<_0x3b8928['length'];_0xba1ad5+=0x1){var _0x1fdef6=_0x3b8928[_0xba1ad5]['get']({'plain':!![]});_0x513907=squel[_0x6790('0x68')]()[_0x6790('0x7c')]('cm_hopper_black')[_0x6790('0x7d')]([_0x6790('0x69'),_0x6790('0x6b'),_0x6790('0x6c'),_0x6790('0x5b'),_0x6790('0x56'),_0x6790('0x55')],squel['select']()[_0x6790('0x6e')]('phone',_0x6790('0x69'))[_0x6790('0x6e')]('id',_0x6790('0x6b'))[_0x6790('0x6e')](_0x1fdef6[_0x6790('0x6f')]['toString'](),'ListId')['field'](_0x51f5e6[_0x6790('0x53')]['id'][_0x6790('0x70')](),_0x6790('0x5b'))[_0x6790('0x6e')]('NOW()',_0x6790('0x56'))[_0x6790('0x6e')](_0x6790('0x71'),'updatedAt')[_0x6790('0x72')](_0x6790('0x73'))['where'](_0x6790('0x74'))[_0x6790('0x3a')](_0x6790('0x75'),_0x1fdef6[_0x6790('0x6f')][_0x6790('0x70')]())[_0x6790('0x3a')](_0x6790('0x7e')))[_0x6790('0x70')]();_0x4409f9[_0x6790('0x85')](db[_0x6790('0x80')]['query'](_0x513907));}return BPromise[_0x6790('0x81')](_0x4409f9);}})[_0x6790('0x21')](function(){return _0x5ce890;})[_0x6790('0x21')](respondWithResult(_0x3e5af4,null))['catch'](handleError(_0x3e5af4,null));};exports[_0x6790('0x86')]=function(_0x1cf408,_0x41ce1c,_0x2c19aa){return db[_0x6790('0x29')]['find']({'where':{'id':_0x1cf408[_0x6790('0x53')]['id']}})[_0x6790('0x21')](handleEntityNotFound(_0x41ce1c,null))[_0x6790('0x21')](function(_0x14a9d2){if(_0x14a9d2){return _0x14a9d2['removeBlackLists'](_0x1cf408['query'][_0x6790('0x65')]);}})[_0x6790('0x21')](function(_0x192432){if(_0x192432){return db[_0x6790('0x61')][_0x6790('0x22')]({'where':{'ListId':_0x1cf408[_0x6790('0x2e')][_0x6790('0x65')],'CampaignId':_0x1cf408[_0x6790('0x53')]['id']}})['then'](function(){return _0x192432;});}})[_0x6790('0x21')](respondWithStatusCode(_0x41ce1c,null))['catch'](handleError(_0x41ce1c,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index f2e1f62..d253355 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 _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 +var _0x8886=['lodash','bluebird','request-promise','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns'];(function(_0x41b197,_0x45e597){var _0x351e61=function(_0x54d4f4){while(--_0x54d4f4){_0x41b197['push'](_0x41b197['shift']());}};_0x351e61(++_0x45e597);}(_0x8886,0xd2));var _0x6888=function(_0x411cc8,_0x571c20){_0x411cc8=_0x411cc8-0x0;var _0x2dc97f=_0x8886[_0x411cc8];return _0x2dc97f;};'use strict';var _=require(_0x6888('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x6888('0x1'));var rp=require(_0x6888('0x2'));var fs=require('fs');var path=require(_0x6888('0x3'));var rimraf=require(_0x6888('0x4'));var config=require(_0x6888('0x5'));var attributes=require(_0x6888('0x6'));module[_0x6888('0x7')]=function(_0x26deb6,_0x59af86){return _0x26deb6['define'](_0x6888('0x8'),attributes,{'tableName':_0x6888('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 03a44dc..22cfa8a 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(_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 +var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x126e97,_0x122139){var _0x11d788=function(_0x2411a5){while(--_0x2411a5){_0x126e97['push'](_0x126e97['shift']());}};_0x11d788(++_0x122139);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index bda3f7e..b4201ce 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 _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 +var _0xc1d6=['../../config/environment','./campaign.controller','get','isAuthenticated','/:id','show','getHoppers','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','addBlackLists','put','update','delete','removeLists','removeBlackLists','exports','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5ebc04,_0x14a363){var _0x17845c=function(_0x360850){while(--_0x360850){_0x5ebc04['push'](_0x5ebc04['shift']());}};_0x17845c(++_0x14a363);}(_0xc1d6,0x14c));var _0x6c1d=function(_0x3a6d52,_0x11d25a){_0x3a6d52=_0x3a6d52-0x0;var _0x2ae3f7=_0xc1d6[_0x3a6d52];return _0x2ae3f7;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6c1d('0x0'));var router=express[_0x6c1d('0x1')]();var auth=require(_0x6c1d('0x2'));var interaction=require(_0x6c1d('0x3'));var config=require(_0x6c1d('0x4'));var controller=require(_0x6c1d('0x5'));router[_0x6c1d('0x6')]('/',auth[_0x6c1d('0x7')](),controller['index']);router[_0x6c1d('0x6')](_0x6c1d('0x8'),auth[_0x6c1d('0x7')](),controller[_0x6c1d('0x9')]);router[_0x6c1d('0x6')]('/:id/hoppers',auth[_0x6c1d('0x7')](),controller[_0x6c1d('0xa')]);router[_0x6c1d('0x6')]('/:id/hopper_histories',auth[_0x6c1d('0x7')](),controller['getHopperHistories']);router[_0x6c1d('0x6')](_0x6c1d('0xb'),auth[_0x6c1d('0x7')](),controller[_0x6c1d('0xc')]);router['get']('/:id/hopper_black',auth[_0x6c1d('0x7')](),controller[_0x6c1d('0xd')]);router[_0x6c1d('0x6')](_0x6c1d('0xe'),auth[_0x6c1d('0x7')](),controller['getLists']);router[_0x6c1d('0x6')](_0x6c1d('0xf'),auth[_0x6c1d('0x7')](),controller[_0x6c1d('0x10')]);router['post']('/',auth[_0x6c1d('0x7')](),controller[_0x6c1d('0x11')]);router[_0x6c1d('0x12')](_0x6c1d('0x13'),auth[_0x6c1d('0x7')](),controller[_0x6c1d('0x14')]);router['post'](_0x6c1d('0xe'),auth[_0x6c1d('0x7')](),controller['addLists']);router[_0x6c1d('0x12')](_0x6c1d('0xf'),auth['isAuthenticated'](),controller[_0x6c1d('0x15')]);router[_0x6c1d('0x16')](_0x6c1d('0x8'),auth[_0x6c1d('0x7')](),controller[_0x6c1d('0x17')]);router[_0x6c1d('0x18')](_0x6c1d('0x8'),auth[_0x6c1d('0x7')](),controller['destroy']);router['delete']('/:id/lists',auth[_0x6c1d('0x7')](),controller[_0x6c1d('0x19')]);router[_0x6c1d('0x18')](_0x6c1d('0xf'),auth[_0x6c1d('0x7')](),controller[_0x6c1d('0x1a')]);module[_0x6c1d('0x1b')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index be8a6ce..6bb34a1 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 _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 +var _0x6c89=['VIRTUAL','sequelize','exports','TEXT','STRING'];(function(_0x106337,_0x1d8b2e){var _0x3bc29f=function(_0x3404b6){while(--_0x3404b6){_0x106337['push'](_0x106337['shift']());}};_0x3bc29f(++_0x1d8b2e);}(_0x6c89,0x15a));var _0x96c8=function(_0x19edc6,_0x2834e2){_0x19edc6=_0x19edc6-0x0;var _0x23ad78=_0x6c89[_0x19edc6];return _0x23ad78;};'use strict';var Sequelize=require(_0x96c8('0x0'));module[_0x96c8('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x96c8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x96c8('0x3')]},'name':{'type':Sequelize[_0x96c8('0x4')],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 5a7f6c6..ec68c2f 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 _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 +var _0xfa7a=['lodash','crypto','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','count','offset','limit','json','apply','reject','save','then','destroy','get','CannedAnswers','UserProfileResource','end','error','stack','name','map','CannedAnswer','rawAttributes','type','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filter','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xfa7a,0x18a));var _0xafa7=function(_0x191d63,_0x45830a){_0x191d63=_0x191d63-0x0;var _0x39cbea=_0xfa7a[_0x191d63];return _0x39cbea;};'use strict';var pdf=require(_0xafa7('0x0'));var emlformat=require(_0xafa7('0x1'));var rimraf=require(_0xafa7('0x2'));var zipdir=require(_0xafa7('0x3'));var jsonpatch=require(_0xafa7('0x4'));var rp=require(_0xafa7('0x5'));var moment=require(_0xafa7('0x6'));var BPromise=require(_0xafa7('0x7'));var Mustache=require(_0xafa7('0x8'));var util=require(_0xafa7('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0xafa7('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xafa7('0xb'));var squel=require('squel');var crypto=require(_0xafa7('0xc'));var jsforce=require(_0xafa7('0xd'));var deskjs=require(_0xafa7('0xe'));var toCsv=require(_0xafa7('0xa'));var querystring=require(_0xafa7('0xf'));var Papa=require(_0xafa7('0x10'));var Redis=require(_0xafa7('0x11'));var authService=require(_0xafa7('0x12'));var qs=require(_0xafa7('0x13'));var as=require(_0xafa7('0x14'));var hardwareService=require(_0xafa7('0x15'));var logger=require(_0xafa7('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xafa7('0x17'));var db=require(_0xafa7('0x18'))['db'];function respondWithStatusCode(_0x2063d3,_0x58e2a2){_0x58e2a2=_0x58e2a2||0xcc;return function(_0x171a71){if(_0x171a71){return _0x2063d3[_0xafa7('0x19')](_0x58e2a2);}return _0x2063d3['status'](_0x58e2a2)['end']();};}function respondWithResult(_0x3571a9,_0x23a4a1){_0x23a4a1=_0x23a4a1||0xc8;return function(_0x131ee4){if(_0x131ee4){return _0x3571a9[_0xafa7('0x1a')](_0x23a4a1)['json'](_0x131ee4);}};}function respondWithFilteredResult(_0x1f7b5b,_0x1b3d91){return function(_0x40e3b2){if(_0x40e3b2){var _0x1fffcb=_0x40e3b2[_0xafa7('0x1b')],_0x1ad171=_0x1b3d91[_0xafa7('0x1c')],_0x434604=_0x1b3d91[_0xafa7('0x1c')]+_0x1b3d91[_0xafa7('0x1d')],_0x1697bd;if(_0x434604>=_0x1fffcb){_0x434604=_0x1fffcb;_0x1697bd=0xc8;}else{_0x1697bd=0xce;}_0x1f7b5b[_0xafa7('0x1a')](_0x1697bd);return _0x1f7b5b['set']('Content-Range',_0x1ad171+'-'+_0x434604+'/'+_0x1fffcb)[_0xafa7('0x1e')](_0x40e3b2);}return null;};}function patchUpdates(_0x14084a){return function(_0x5e9c02){try{jsonpatch[_0xafa7('0x1f')](_0x5e9c02,_0x14084a,!![]);}catch(_0x39d50d){return BPromise[_0xafa7('0x20')](_0x39d50d);}return _0x5e9c02[_0xafa7('0x21')]();};}function saveUpdates(_0x2a91a4,_0x5d7488){return function(_0x203ee2){if(_0x203ee2){return _0x203ee2['update'](_0x2a91a4)[_0xafa7('0x22')](function(_0x34f31){return _0x34f31;});}return null;};}function removeEntity(_0x2a9e98,_0x544848){return function(_0x3ee374){if(_0x3ee374){return _0x3ee374[_0xafa7('0x23')]()[_0xafa7('0x22')](function(){var _0x4ff5c8=_0x3ee374[_0xafa7('0x24')]({'plain':!![]});var _0x196db3=_0xafa7('0x25');return db[_0xafa7('0x26')]['destroy']({'where':{'type':_0x196db3,'resourceId':_0x4ff5c8['id']}})['then'](function(){return _0x3ee374;});})[_0xafa7('0x22')](function(){_0x2a9e98[_0xafa7('0x1a')](0xcc)[_0xafa7('0x27')]();});}};}function handleEntityNotFound(_0x580d73,_0x5e30d8){return function(_0x11c3c8){if(!_0x11c3c8){_0x580d73[_0xafa7('0x19')](0x194);}return _0x11c3c8;};}function handleError(_0x154de8,_0x141066){_0x141066=_0x141066||0x1f4;return function(_0x315a26){logger[_0xafa7('0x28')](_0x315a26[_0xafa7('0x29')]);if(_0x315a26[_0xafa7('0x2a')]){delete _0x315a26[_0xafa7('0x2a')];}_0x154de8['status'](_0x141066)['send'](_0x315a26);};}exports['index']=function(_0x18ad3a,_0x3a8769){var _0x2470fb={},_0x806fb4={},_0x476cf5={'count':0x0,'rows':[]};var _0x5a4c42=_[_0xafa7('0x2b')](db[_0xafa7('0x2c')][_0xafa7('0x2d')],function(_0x10a3d1){return{'name':_0x10a3d1['fieldName'],'type':_0x10a3d1[_0xafa7('0x2e')]['key']};});_0x806fb4['model']=_[_0xafa7('0x2b')](_0x5a4c42,_0xafa7('0x2a'));_0x806fb4['query']=_[_0xafa7('0x2f')](_0x18ad3a[_0xafa7('0x30')]);_0x806fb4[_0xafa7('0x31')]=_[_0xafa7('0x32')](_0x806fb4['model'],_0x806fb4[_0xafa7('0x30')]);_0x2470fb['attributes']=_[_0xafa7('0x32')](_0x806fb4[_0xafa7('0x33')],qs[_0xafa7('0x34')](_0x18ad3a['query'][_0xafa7('0x34')]));_0x2470fb[_0xafa7('0x35')]=_0x2470fb[_0xafa7('0x35')][_0xafa7('0x36')]?_0x2470fb[_0xafa7('0x35')]:_0x806fb4[_0xafa7('0x33')];if(!_0x18ad3a[_0xafa7('0x30')][_0xafa7('0x37')]('nolimit')){_0x2470fb['limit']=qs[_0xafa7('0x1d')](_0x18ad3a[_0xafa7('0x30')][_0xafa7('0x1d')]);_0x2470fb[_0xafa7('0x1c')]=qs[_0xafa7('0x1c')](_0x18ad3a[_0xafa7('0x30')][_0xafa7('0x1c')]);}_0x2470fb[_0xafa7('0x38')]=qs[_0xafa7('0x39')](_0x18ad3a[_0xafa7('0x30')][_0xafa7('0x39')]);_0x2470fb[_0xafa7('0x3a')]=qs[_0xafa7('0x31')](_['pick'](_0x18ad3a[_0xafa7('0x30')],_0x806fb4[_0xafa7('0x31')]),_0x5a4c42);if(_0x18ad3a[_0xafa7('0x30')][_0xafa7('0x3b')]){_0x2470fb[_0xafa7('0x3a')]=_['merge'](_0x2470fb['where'],{'$or':_[_0xafa7('0x2b')](_0x5a4c42,function(_0x1faf0d){if(_0x1faf0d[_0xafa7('0x2e')]!=='VIRTUAL'){var _0xd48925={};_0xd48925[_0x1faf0d['name']]={'$like':'%'+_0x18ad3a[_0xafa7('0x30')][_0xafa7('0x3b')]+'%'};return _0xd48925;}})});}_0x2470fb=_['merge']({},_0x2470fb,_0x18ad3a[_0xafa7('0x3c')]);var _0x3054d4={'where':_0x2470fb[_0xafa7('0x3a')]};return db[_0xafa7('0x2c')][_0xafa7('0x1b')](_0x3054d4)[_0xafa7('0x22')](function(_0x3996c1){_0x476cf5['count']=_0x3996c1;if(_0x18ad3a[_0xafa7('0x30')][_0xafa7('0x3d')]){_0x2470fb[_0xafa7('0x3e')]=[{'all':!![]}];}return db['CannedAnswer'][_0xafa7('0x3f')](_0x2470fb);})[_0xafa7('0x22')](function(_0x586785){_0x476cf5[_0xafa7('0x40')]=_0x586785;return _0x476cf5;})[_0xafa7('0x22')](respondWithFilteredResult(_0x3a8769,_0x2470fb))[_0xafa7('0x41')](handleError(_0x3a8769,null));};exports[_0xafa7('0x42')]=function(_0x41bb17,_0x4db334){var _0x1290cf={'raw':!![],'where':{'id':_0x41bb17[_0xafa7('0x43')]['id']}},_0x4f6dc1={};_0x4f6dc1[_0xafa7('0x33')]=_[_0xafa7('0x2f')](db['CannedAnswer'][_0xafa7('0x2d')]);_0x4f6dc1[_0xafa7('0x30')]=_['keys'](_0x41bb17[_0xafa7('0x30')]);_0x4f6dc1[_0xafa7('0x31')]=_['intersection'](_0x4f6dc1[_0xafa7('0x33')],_0x4f6dc1[_0xafa7('0x30')]);_0x1290cf[_0xafa7('0x35')]=_[_0xafa7('0x32')](_0x4f6dc1['model'],qs[_0xafa7('0x34')](_0x41bb17[_0xafa7('0x30')][_0xafa7('0x34')]));_0x1290cf[_0xafa7('0x35')]=_0x1290cf[_0xafa7('0x35')][_0xafa7('0x36')]?_0x1290cf[_0xafa7('0x35')]:_0x4f6dc1['model'];if(_0x41bb17['query'][_0xafa7('0x3d')]){_0x1290cf['include']=[{'all':!![]}];}_0x1290cf=_['merge']({},_0x1290cf,_0x41bb17[_0xafa7('0x3c')]);return db[_0xafa7('0x2c')][_0xafa7('0x44')](_0x1290cf)[_0xafa7('0x22')](handleEntityNotFound(_0x4db334,null))[_0xafa7('0x22')](respondWithResult(_0x4db334,null))[_0xafa7('0x41')](handleError(_0x4db334,null));};exports[_0xafa7('0x45')]=function(_0x128025,_0x3eecb2){if(_0x128025[_0xafa7('0x46')]['id']){delete _0x128025[_0xafa7('0x46')]['id'];}return db[_0xafa7('0x2c')][_0xafa7('0x44')]({'where':{'id':_0x128025[_0xafa7('0x43')]['id']}})[_0xafa7('0x22')](handleEntityNotFound(_0x3eecb2,null))[_0xafa7('0x22')](saveUpdates(_0x128025[_0xafa7('0x46')],null))['then'](respondWithResult(_0x3eecb2,null))['catch'](handleError(_0x3eecb2,null));};exports[_0xafa7('0x23')]=function(_0x2591a6,_0x5a58fa){return db['CannedAnswer'][_0xafa7('0x44')]({'where':{'id':_0x2591a6[_0xafa7('0x43')]['id']}})[_0xafa7('0x22')](handleEntityNotFound(_0x5a58fa,null))[_0xafa7('0x22')](removeEntity(_0x5a58fa,null))[_0xafa7('0x41')](handleError(_0x5a58fa,null));};exports[_0xafa7('0x47')]=function(_0x38f6ed,_0x34bdf4){var _0x802ebb={'key':_0x38f6ed[_0xafa7('0x46')]['key']};if(_0x38f6ed[_0xafa7('0x46')][_0xafa7('0x48')]){_0x802ebb[_0xafa7('0x48')]=_0x38f6ed[_0xafa7('0x46')][_0xafa7('0x48')];}else if(_0x38f6ed[_0xafa7('0x46')][_0xafa7('0x49')]){_0x802ebb['SmsAccountId']=_0x38f6ed[_0xafa7('0x46')][_0xafa7('0x49')];}else if(_0x38f6ed[_0xafa7('0x46')]['OpenchannelAccountId']){_0x802ebb[_0xafa7('0x4a')]=_0x38f6ed[_0xafa7('0x46')]['OpenchannelAccountId'];}else if(_0x38f6ed[_0xafa7('0x46')][_0xafa7('0x4b')]){_0x802ebb[_0xafa7('0x4b')]=_0x38f6ed[_0xafa7('0x46')][_0xafa7('0x4b')];}return db[_0xafa7('0x2c')]['find']({'where':_0x802ebb})['then'](function(_0xe0d968){if(_0xe0d968){throw new db['Sequelize']['ValidationError'](_0xafa7('0x4c'));}return db['CannedAnswer'][_0xafa7('0x47')](_0x38f6ed[_0xafa7('0x46')]);})['then'](function(_0x437573){var _0x27a9b5=_0x38f6ed[_0xafa7('0x4d')]['get']({'plain':!![]});if(!_0x27a9b5)throw new Error(_0xafa7('0x4e'));if(_0x27a9b5[_0xafa7('0x4f')]==='user'){var _0x5d82dd=_0x437573[_0xafa7('0x24')]({'plain':!![]});return db['UserProfileSection'][_0xafa7('0x44')]({'where':{'name':_0xafa7('0x25'),'userProfileId':_0x27a9b5[_0xafa7('0x50')]},'raw':!![]})[_0xafa7('0x22')](function(_0x28588b){if(_0x28588b&&_0x28588b['autoAssociation']===0x0){return db[_0xafa7('0x26')][_0xafa7('0x47')]({'name':_0x5d82dd[_0xafa7('0x2a')],'resourceId':_0x5d82dd['id'],'type':_0x28588b[_0xafa7('0x2a')],'sectionId':_0x28588b['id']},{})['then'](function(){return _0x437573;});}else{return _0x437573;}})[_0xafa7('0x41')](function(_0x491fc3){logger[_0xafa7('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x491fc3);throw _0x491fc3;});}return _0x437573;})[_0xafa7('0x22')](respondWithResult(_0x34bdf4,0xc9))['catch'](handleError(_0x34bdf4,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index e665155..9d70c19 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 _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 +var _0xac0b=['path','rimraf','../../config/environment','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird'];(function(_0xd578cb,_0x2167a3){var _0x775533=function(_0x1c340d){while(--_0x1c340d){_0xd578cb['push'](_0xd578cb['shift']());}};_0x775533(++_0x2167a3);}(_0xac0b,0x164));var _0xbac0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xac0b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xbac0('0x0'));var util=require(_0xbac0('0x1'));var logger=require(_0xbac0('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbac0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbac0('0x4'));var rimraf=require(_0xbac0('0x5'));var config=require(_0xbac0('0x6'));var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x4ada50,_0x3f73f9){return _0x4ada50[_0xbac0('0x7')](_0xbac0('0x8'),attributes,{'tableName':_0xbac0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbac0('0xa'),'collate':_0xbac0('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 0ef97ac..e386c25 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 _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 +var _0xf0fb=['debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','CannedAnswer,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','request','then','info'];(function(_0x2b81b5,_0x485df9){var _0x275868=function(_0x1412ea){while(--_0x1412ea){_0x2b81b5['push'](_0x2b81b5['shift']());}};_0x275868(++_0x485df9);}(_0xf0fb,0x134));var _0xbf0f=function(_0xb2120f,_0x1e23c1){_0xb2120f=_0xb2120f-0x0;var _0x3b8dd9=_0xf0fb[_0xb2120f];return _0x3b8dd9;};'use strict';var _=require('lodash');var util=require(_0xbf0f('0x0'));var moment=require(_0xbf0f('0x1'));var BPromise=require(_0xbf0f('0x2'));var rs=require(_0xbf0f('0x3'));var fs=require('fs');var Redis=require(_0xbf0f('0x4'));var db=require(_0xbf0f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf0f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbf0f('0x7')][_0xbf0f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x48ca69,_0x1f3bcd,_0x647b3b){return new BPromise(function(_0x2df22e,_0x1001ef){return client[_0xbf0f('0x9')](_0x48ca69,_0x647b3b)[_0xbf0f('0xa')](function(_0x1cce1f){logger[_0xbf0f('0xb')]('CannedAnswer,\x20%s,\x20%s',_0x1f3bcd,'request\x20sent');logger[_0xbf0f('0xc')](_0xbf0f('0xd'),_0x1f3bcd,'request\x20sent',JSON[_0xbf0f('0xe')](_0x1cce1f));if(_0x1cce1f[_0xbf0f('0xf')]){if(_0x1cce1f[_0xbf0f('0xf')][_0xbf0f('0x10')]===0x1f4){logger[_0xbf0f('0xf')](_0xbf0f('0x11'),_0x1f3bcd,_0x1cce1f[_0xbf0f('0xf')][_0xbf0f('0x12')]);return _0x1001ef(_0x1cce1f['error'][_0xbf0f('0x12')]);}logger['error'](_0xbf0f('0x11'),_0x1f3bcd,_0x1cce1f[_0xbf0f('0xf')][_0xbf0f('0x12')]);return _0x2df22e(_0x1cce1f[_0xbf0f('0xf')][_0xbf0f('0x12')]);}else{logger[_0xbf0f('0xb')](_0xbf0f('0x11'),_0x1f3bcd,'request\x20sent');_0x2df22e(_0x1cce1f[_0xbf0f('0x13')][_0xbf0f('0x12')]);}})['catch'](function(_0xa9920f){logger[_0xbf0f('0xf')](_0xbf0f('0x11'),_0x1f3bcd,_0xa9920f);_0x1001ef(_0xa9920f);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 76ae81d..edc7b38 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 _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 +var _0x4111=['destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','/:id','isAuthenticated','show','post','put','update','delete'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x4111,0x91));var _0x1411=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4111[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x1411('0x0'));var util=require(_0x1411('0x1'));var path=require(_0x1411('0x2'));var timeout=require(_0x1411('0x3'));var express=require('express');var router=express[_0x1411('0x4')]();var auth=require(_0x1411('0x5'));var interaction=require(_0x1411('0x6'));var config=require(_0x1411('0x7'));var controller=require(_0x1411('0x8'));router[_0x1411('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1411('0x9')](_0x1411('0xa'),auth[_0x1411('0xb')](),controller[_0x1411('0xc')]);router[_0x1411('0xd')]('/',auth[_0x1411('0xb')](),controller['create']);router[_0x1411('0xe')](_0x1411('0xa'),auth[_0x1411('0xb')](),controller[_0x1411('0xf')]);router[_0x1411('0x10')](_0x1411('0xa'),auth[_0x1411('0xb')](),controller[_0x1411('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index f48a609..6703268 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 _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 +var _0x9c6a=['STRING','INTEGER','exports','1970-01-01\x2000:00:01'];(function(_0x56b04a,_0x1a28e8){var _0x33b980=function(_0x577095){while(--_0x577095){_0x56b04a['push'](_0x56b04a['shift']());}};_0x33b980(++_0x1a28e8);}(_0x9c6a,0x8a));var _0xa9c6=function(_0xd17f74,_0x1ff030){_0xd17f74=_0xd17f74-0x0;var _0x103861=_0x9c6a[_0xd17f74];return _0x103861;};'use strict';var Sequelize=require('sequelize');module[_0xa9c6('0x0')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xa9c6('0x1')},'clid':{'type':Sequelize[_0xa9c6('0x2')]},'src':{'type':Sequelize[_0xa9c6('0x2')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa9c6('0x2')]},'dstchannel':{'type':Sequelize[_0xa9c6('0x2')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xa9c6('0x2')]},'duration':{'type':Sequelize[_0xa9c6('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xa9c6('0x2')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xa9c6('0x2')]},'userfield':{'type':Sequelize[_0xa9c6('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xa9c6('0x2')]},'peeraccount':{'type':Sequelize[_0xa9c6('0x2')]},'type':{'type':Sequelize[_0xa9c6('0x2')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 4be57e2..e55182b 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 _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 +var _0x16da=['where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','length','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','error','stack','send','index','Cdr','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x16da,0xaa));var _0xa16d=function(_0x174f86,_0x39e952){_0x174f86=_0x174f86-0x0;var _0x5c12e9=_0x16da[_0x174f86];return _0x5c12e9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa16d('0x0'));var rimraf=require(_0xa16d('0x1'));var zipdir=require(_0xa16d('0x2'));var jsonpatch=require(_0xa16d('0x3'));var rp=require(_0xa16d('0x4'));var moment=require(_0xa16d('0x5'));var BPromise=require(_0xa16d('0x6'));var Mustache=require(_0xa16d('0x7'));var util=require(_0xa16d('0x8'));var path=require(_0xa16d('0x9'));var sox=require(_0xa16d('0xa'));var csv=require(_0xa16d('0xb'));var ejs=require(_0xa16d('0xc'));var fs=require('fs');var _=require(_0xa16d('0xd'));var squel=require(_0xa16d('0xe'));var crypto=require(_0xa16d('0xf'));var jsforce=require(_0xa16d('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xa16d('0xb'));var querystring=require(_0xa16d('0x11'));var Papa=require(_0xa16d('0x12'));var Redis=require(_0xa16d('0x13'));var authService=require(_0xa16d('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa16d('0x15'));var logger=require(_0xa16d('0x16'))('api');var utils=require(_0xa16d('0x17'));var config=require(_0xa16d('0x18'));var db=require(_0xa16d('0x19'))['db'];function respondWithStatusCode(_0x59a5e3,_0x237649){_0x237649=_0x237649||0xcc;return function(_0x32b6b1){if(_0x32b6b1){return _0x59a5e3[_0xa16d('0x1a')](_0x237649);}return _0x59a5e3[_0xa16d('0x1b')](_0x237649)[_0xa16d('0x1c')]();};}function respondWithResult(_0x506e98,_0x31e31b){_0x31e31b=_0x31e31b||0xc8;return function(_0x3e3583){if(_0x3e3583){return _0x506e98['status'](_0x31e31b)[_0xa16d('0x1d')](_0x3e3583);}};}function respondWithFilteredResult(_0x1c20a8,_0x1a8301){return function(_0x508027){if(_0x508027){var _0x335fbd=_0x508027[_0xa16d('0x1e')],_0x132f60=_0x1a8301[_0xa16d('0x1f')],_0x5bb209=_0x1a8301['offset']+_0x1a8301[_0xa16d('0x20')],_0x1545ab;if(_0x5bb209>=_0x335fbd){_0x5bb209=_0x335fbd;_0x1545ab=0xc8;}else{_0x1545ab=0xce;}_0x1c20a8[_0xa16d('0x1b')](_0x1545ab);return _0x1c20a8[_0xa16d('0x21')](_0xa16d('0x22'),_0x132f60+'-'+_0x5bb209+'/'+_0x335fbd)[_0xa16d('0x1d')](_0x508027);}return null;};}function patchUpdates(_0x536fdb){return function(_0x5eefd5){try{jsonpatch['apply'](_0x5eefd5,_0x536fdb,!![]);}catch(_0x32c1ee){return BPromise[_0xa16d('0x23')](_0x32c1ee);}return _0x5eefd5['save']();};}function saveUpdates(_0x5c316a,_0x1352dc){return function(_0x138533){if(_0x138533){return _0x138533[_0xa16d('0x24')](_0x5c316a)[_0xa16d('0x25')](function(_0x2532b3){return _0x2532b3;});}return null;};}function removeEntity(_0x42257a,_0x252e11){return function(_0xe5db5b){if(_0xe5db5b){return _0xe5db5b[_0xa16d('0x26')]()['then'](function(){_0x42257a['status'](0xcc)[_0xa16d('0x1c')]();});}};}function handleEntityNotFound(_0x20e1d6,_0x36915f){return function(_0x5b1c99){if(!_0x5b1c99){_0x20e1d6[_0xa16d('0x1a')](0x194);}return _0x5b1c99;};}function handleError(_0x5230ef,_0x2dc34b){_0x2dc34b=_0x2dc34b||0x1f4;return function(_0x111238){logger[_0xa16d('0x27')](_0x111238[_0xa16d('0x28')]);if(_0x111238['name']){delete _0x111238['name'];}_0x5230ef['status'](_0x2dc34b)[_0xa16d('0x29')](_0x111238);};}exports[_0xa16d('0x2a')]=function(_0x11425e,_0x1d5507){var _0x50d4df={},_0x2efec8={},_0xfdc029={'count':0x0,'rows':[]};var _0x57b7cc=_['map'](db[_0xa16d('0x2b')]['rawAttributes'],function(_0x5c4571){return{'name':_0x5c4571[_0xa16d('0x2c')],'type':_0x5c4571[_0xa16d('0x2d')][_0xa16d('0x2e')]};});_0x2efec8[_0xa16d('0x2f')]=_['map'](_0x57b7cc,_0xa16d('0x30'));_0x2efec8[_0xa16d('0x31')]=_[_0xa16d('0x32')](_0x11425e['query']);_0x2efec8[_0xa16d('0x33')]=_[_0xa16d('0x34')](_0x2efec8['model'],_0x2efec8[_0xa16d('0x31')]);_0x50d4df[_0xa16d('0x35')]=_['intersection'](_0x2efec8['model'],qs[_0xa16d('0x36')](_0x11425e[_0xa16d('0x31')][_0xa16d('0x36')]));_0x50d4df[_0xa16d('0x35')]=_0x50d4df[_0xa16d('0x35')]['length']?_0x50d4df['attributes']:_0x2efec8[_0xa16d('0x2f')];if(!_0x11425e[_0xa16d('0x31')][_0xa16d('0x37')](_0xa16d('0x38'))){_0x50d4df['limit']=qs['limit'](_0x11425e[_0xa16d('0x31')][_0xa16d('0x20')]);_0x50d4df[_0xa16d('0x1f')]=qs[_0xa16d('0x1f')](_0x11425e[_0xa16d('0x31')]['offset']);}_0x50d4df['order']=qs[_0xa16d('0x39')](_0x11425e[_0xa16d('0x31')][_0xa16d('0x39')]);_0x50d4df[_0xa16d('0x3a')]=qs[_0xa16d('0x33')](_[_0xa16d('0x3b')](_0x11425e[_0xa16d('0x31')],_0x2efec8[_0xa16d('0x33')]),_0x57b7cc);if(_0x11425e[_0xa16d('0x31')][_0xa16d('0x3c')]){_0x50d4df[_0xa16d('0x3a')]=_[_0xa16d('0x3d')](_0x50d4df[_0xa16d('0x3a')],{'$or':_[_0xa16d('0x3e')](_0x57b7cc,function(_0x575c75){if(_0x575c75[_0xa16d('0x2d')]!==_0xa16d('0x3f')){var _0x5cb27e={};_0x5cb27e[_0x575c75['name']]={'$like':'%'+_0x11425e[_0xa16d('0x31')][_0xa16d('0x3c')]+'%'};return _0x5cb27e;}})});}_0x50d4df=_[_0xa16d('0x3d')]({},_0x50d4df,_0x11425e[_0xa16d('0x40')]);var _0x3c6c38={'where':_0x50d4df[_0xa16d('0x3a')]};return db[_0xa16d('0x2b')][_0xa16d('0x1e')](_0x3c6c38)['then'](function(_0x250417){_0xfdc029['count']=_0x250417;if(_0x11425e[_0xa16d('0x31')][_0xa16d('0x41')]){_0x50d4df[_0xa16d('0x42')]=[{'all':!![]}];}return db[_0xa16d('0x2b')]['findAll'](_0x50d4df);})[_0xa16d('0x25')](function(_0x537dfc){_0xfdc029[_0xa16d('0x43')]=_0x537dfc;return _0xfdc029;})[_0xa16d('0x25')](respondWithFilteredResult(_0x1d5507,_0x50d4df))['catch'](handleError(_0x1d5507,null));};exports[_0xa16d('0x44')]=function(_0x22a90c,_0xa22f5a){var _0x160bbb={'raw':!![],'where':{'id':_0x22a90c[_0xa16d('0x45')]['id']}},_0x24ae8f={};_0x24ae8f[_0xa16d('0x2f')]=_['keys'](db[_0xa16d('0x2b')][_0xa16d('0x46')]);_0x24ae8f['query']=_[_0xa16d('0x32')](_0x22a90c[_0xa16d('0x31')]);_0x24ae8f['filters']=_[_0xa16d('0x34')](_0x24ae8f[_0xa16d('0x2f')],_0x24ae8f[_0xa16d('0x31')]);_0x160bbb['attributes']=_[_0xa16d('0x34')](_0x24ae8f[_0xa16d('0x2f')],qs[_0xa16d('0x36')](_0x22a90c[_0xa16d('0x31')]['fields']));_0x160bbb['attributes']=_0x160bbb[_0xa16d('0x35')][_0xa16d('0x47')]?_0x160bbb['attributes']:_0x24ae8f[_0xa16d('0x2f')];if(_0x22a90c['query'][_0xa16d('0x41')]){_0x160bbb[_0xa16d('0x42')]=[{'all':!![]}];}_0x160bbb=_[_0xa16d('0x3d')]({},_0x160bbb,_0x22a90c[_0xa16d('0x40')]);return db[_0xa16d('0x2b')][_0xa16d('0x48')](_0x160bbb)[_0xa16d('0x25')](handleEntityNotFound(_0xa22f5a,null))[_0xa16d('0x25')](respondWithResult(_0xa22f5a,null))[_0xa16d('0x49')](handleError(_0xa22f5a,null));};exports['create']=function(_0x2f5d3f,_0x5c30d6){return db[_0xa16d('0x2b')][_0xa16d('0x4a')](_0x2f5d3f[_0xa16d('0x4b')],{})['then'](respondWithResult(_0x5c30d6,0xc9))[_0xa16d('0x49')](handleError(_0x5c30d6,null));};exports[_0xa16d('0x24')]=function(_0x9729cb,_0x58cb11){if(_0x9729cb['body']['id']){delete _0x9729cb[_0xa16d('0x4b')]['id'];}return db[_0xa16d('0x2b')]['find']({'where':{'id':_0x9729cb['params']['id']}})[_0xa16d('0x25')](handleEntityNotFound(_0x58cb11,null))[_0xa16d('0x25')](saveUpdates(_0x9729cb['body'],null))[_0xa16d('0x25')](respondWithResult(_0x58cb11,null))['catch'](handleError(_0x58cb11,null));};exports['destroy']=function(_0x28e011,_0x7698bb){return db[_0xa16d('0x2b')]['find']({'where':{'id':_0x28e011['params']['id']}})['then'](handleEntityNotFound(_0x7698bb,null))[_0xa16d('0x25')](removeEntity(_0x7698bb,null))[_0xa16d('0x49')](handleError(_0x7698bb,null));};exports['describe']=function(_0x4dd685,_0x5726c4){return db['Cdr']['describe']()[_0xa16d('0x25')](respondWithResult(_0x5726c4,null))[_0xa16d('0x49')](handleError(_0x5726c4,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 63403d5..7a1c38b 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 _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 +var _0x687b=['accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports','define','Cdr'];(function(_0x18d631,_0x4376d2){var _0x50d708=function(_0x3b6ab5){while(--_0x3b6ab5){_0x18d631['push'](_0x18d631['shift']());}};_0x50d708(++_0x4376d2);}(_0x687b,0x14a));var _0xb687=function(_0x1cd726,_0x2bf581){_0x1cd726=_0x1cd726-0x0;var _0x179932=_0x687b[_0x1cd726];return _0x179932;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));module[_0xb687('0x9')]=function(_0x16ccf3,_0xf43a1f){return _0x16ccf3[_0xb687('0xa')](_0xb687('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0xb687('0xc'),'fields':[_0xb687('0xc')]},{'name':'calldate','fields':[_0xb687('0xd')]},{'name':_0xb687('0xe'),'fields':[_0xb687('0xe')]},{'name':_0xb687('0xf'),'fields':[_0xb687('0xf')]},{'name':_0xb687('0x10'),'fields':[_0xb687('0x10')]},{'name':_0xb687('0x11'),'fields':[_0xb687('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 71fb031..ed937d3 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 _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 +var _0xde7b=['debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent'];(function(_0x1feb3a,_0x2187c5){var _0x26ea1f=function(_0x4fecab){while(--_0x4fecab){_0x1feb3a['push'](_0x1feb3a['shift']());}};_0x26ea1f(++_0x2187c5);}(_0xde7b,0xe3));var _0xbde7=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xde7b[_0x4792c8];return _0x35edb1;};'use strict';var _=require('lodash');var util=require(_0xbde7('0x0'));var moment=require(_0xbde7('0x1'));var BPromise=require('bluebird');var rs=require(_0xbde7('0x2'));var fs=require('fs');var Redis=require(_0xbde7('0x3'));var db=require(_0xbde7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbde7('0x5'))(_0xbde7('0x6'));var config=require(_0xbde7('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c9fad,_0x8b1c55,_0x5416bc){return new BPromise(function(_0x1b64e6,_0x6e9e44){return client[_0xbde7('0x8')](_0x2c9fad,_0x5416bc)[_0xbde7('0x9')](function(_0x330cc4){logger[_0xbde7('0xa')](_0xbde7('0xb'),_0x8b1c55,_0xbde7('0xc'));logger[_0xbde7('0xd')](_0xbde7('0xe'),_0x8b1c55,_0xbde7('0xc'),JSON[_0xbde7('0xf')](_0x330cc4));if(_0x330cc4[_0xbde7('0x10')]){if(_0x330cc4['error']['code']===0x1f4){logger[_0xbde7('0x10')](_0xbde7('0xb'),_0x8b1c55,_0x330cc4[_0xbde7('0x10')][_0xbde7('0x11')]);return _0x6e9e44(_0x330cc4[_0xbde7('0x10')]['message']);}logger[_0xbde7('0x10')](_0xbde7('0xb'),_0x8b1c55,_0x330cc4[_0xbde7('0x10')][_0xbde7('0x11')]);return _0x1b64e6(_0x330cc4[_0xbde7('0x10')][_0xbde7('0x11')]);}else{logger[_0xbde7('0xa')](_0xbde7('0xb'),_0x8b1c55,_0xbde7('0xc'));_0x1b64e6(_0x330cc4[_0xbde7('0x12')][_0xbde7('0x11')]);}})[_0xbde7('0x13')](function(_0x2ee807){logger['error'](_0xbde7('0xb'),_0x8b1c55,_0x2ee807);_0x6e9e44(_0x2ee807);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 6e11759..9518ac1 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 _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 +var _0xf7ea=['/:id','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','index','/describe','describe','show','post','create','put'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf7ea,0x111));var _0xaf7e=function(_0x4dade6,_0x48ee92){_0x4dade6=_0x4dade6-0x0;var _0x269f90=_0xf7ea[_0x4dade6];return _0x269f90;};'use strict';var multer=require(_0xaf7e('0x0'));var util=require(_0xaf7e('0x1'));var path=require('path');var timeout=require(_0xaf7e('0x2'));var express=require(_0xaf7e('0x3'));var router=express[_0xaf7e('0x4')]();var auth=require(_0xaf7e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cdr.controller');router[_0xaf7e('0x6')]('/',auth[_0xaf7e('0x7')](),controller[_0xaf7e('0x8')]);router[_0xaf7e('0x6')](_0xaf7e('0x9'),auth[_0xaf7e('0x7')](),controller[_0xaf7e('0xa')]);router[_0xaf7e('0x6')]('/:id',auth[_0xaf7e('0x7')](),controller[_0xaf7e('0xb')]);router[_0xaf7e('0xc')]('/',auth[_0xaf7e('0x7')](),controller[_0xaf7e('0xd')]);router[_0xaf7e('0xe')](_0xaf7e('0xf'),auth[_0xaf7e('0x7')](),controller['update']);router[_0xaf7e('0x10')](_0xaf7e('0xf'),auth['isAuthenticated'](),controller[_0xaf7e('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 44186ce..fb99abc 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 _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 +var _0x84bc=['INTEGER','noop','TEXT','STRING','sequelize','exports'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x84bc,0x1ae));var _0xc84b=function(_0x3fdbd8,_0x6b3c42){_0x3fdbd8=_0x3fdbd8-0x0;var _0x14adb3=_0x84bc[_0x3fdbd8];return _0x14adb3;};'use strict';var Sequelize=require(_0xc84b('0x0'));module[_0xc84b('0x1')]={'priority':{'type':Sequelize[_0xc84b('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc84b('0x3')},'appdata':{'type':Sequelize[_0xc84b('0x4')]()},'description':{'type':Sequelize[_0xc84b('0x5')]},'interval':{'type':Sequelize[_0xc84b('0x5')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index d4c7ee0..1424b36 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 _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 +var _0x25ea=['then','destroy','error','stack','name','show','model','keys','ChatApplication','query','filters','intersection','attributes','fields','length','includeAll','include','options','find','body','params','catch','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x25ea,0x1ce));var _0xa25e=function(_0x58c20f,_0x4cdb1b){_0x58c20f=_0x58c20f-0x0;var _0x3b0318=_0x25ea[_0x58c20f];return _0x3b0318;};'use strict';var pdf=require(_0xa25e('0x0'));var emlformat=require(_0xa25e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa25e('0x2'));var jsonpatch=require(_0xa25e('0x3'));var rp=require(_0xa25e('0x4'));var moment=require(_0xa25e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa25e('0x6'));var util=require('util');var path=require(_0xa25e('0x7'));var sox=require(_0xa25e('0x8'));var csv=require('to-csv');var ejs=require(_0xa25e('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa25e('0xa'));var toCsv=require(_0xa25e('0xb'));var querystring=require(_0xa25e('0xc'));var Papa=require(_0xa25e('0xd'));var Redis=require('ioredis');var authService=require(_0xa25e('0xe'));var qs=require(_0xa25e('0xf'));var as=require(_0xa25e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa25e('0x11'))(_0xa25e('0x12'));var utils=require(_0xa25e('0x13'));var config=require('../../config/environment');var db=require(_0xa25e('0x14'))['db'];function respondWithStatusCode(_0x988294,_0x3157a4){_0x3157a4=_0x3157a4||0xcc;return function(_0x4cc552){if(_0x4cc552){return _0x988294[_0xa25e('0x15')](_0x3157a4);}return _0x988294['status'](_0x3157a4)[_0xa25e('0x16')]();};}function respondWithResult(_0x4c7d63,_0x47104f){_0x47104f=_0x47104f||0xc8;return function(_0x279d39){if(_0x279d39){return _0x4c7d63[_0xa25e('0x17')](_0x47104f)[_0xa25e('0x18')](_0x279d39);}};}function respondWithFilteredResult(_0x3bf412,_0x17f90f){return function(_0x1d2f4e){if(_0x1d2f4e){var _0x27a453=_0x1d2f4e[_0xa25e('0x19')],_0x3e52a4=_0x17f90f[_0xa25e('0x1a')],_0x3bce6b=_0x17f90f[_0xa25e('0x1a')]+_0x17f90f[_0xa25e('0x1b')],_0xe8754a;if(_0x3bce6b>=_0x27a453){_0x3bce6b=_0x27a453;_0xe8754a=0xc8;}else{_0xe8754a=0xce;}_0x3bf412[_0xa25e('0x17')](_0xe8754a);return _0x3bf412['set'](_0xa25e('0x1c'),_0x3e52a4+'-'+_0x3bce6b+'/'+_0x27a453)[_0xa25e('0x18')](_0x1d2f4e);}return null;};}function patchUpdates(_0x2f2981){return function(_0x575ecb){try{jsonpatch[_0xa25e('0x1d')](_0x575ecb,_0x2f2981,!![]);}catch(_0x3b3c28){return BPromise[_0xa25e('0x1e')](_0x3b3c28);}return _0x575ecb[_0xa25e('0x1f')]();};}function saveUpdates(_0x474d1b,_0x49562){return function(_0x2bb8f6){if(_0x2bb8f6){return _0x2bb8f6[_0xa25e('0x20')](_0x474d1b)[_0xa25e('0x21')](function(_0x261275){return _0x261275;});}return null;};}function removeEntity(_0x24d1c6,_0x41557b){return function(_0x54d267){if(_0x54d267){return _0x54d267[_0xa25e('0x22')]()['then'](function(){_0x24d1c6[_0xa25e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30d6da,_0x319154){return function(_0x498144){if(!_0x498144){_0x30d6da[_0xa25e('0x15')](0x194);}return _0x498144;};}function handleError(_0x48fe4b,_0x4f57a2){_0x4f57a2=_0x4f57a2||0x1f4;return function(_0x1b57f6){logger[_0xa25e('0x23')](_0x1b57f6[_0xa25e('0x24')]);if(_0x1b57f6[_0xa25e('0x25')]){delete _0x1b57f6[_0xa25e('0x25')];}_0x48fe4b['status'](_0x4f57a2)['send'](_0x1b57f6);};}exports[_0xa25e('0x26')]=function(_0xa965cf,_0x5e77ce){var _0x3cc36d={'raw':!![],'where':{'id':_0xa965cf['params']['id']}},_0x359ca0={};_0x359ca0[_0xa25e('0x27')]=_[_0xa25e('0x28')](db[_0xa25e('0x29')]['rawAttributes']);_0x359ca0[_0xa25e('0x2a')]=_['keys'](_0xa965cf['query']);_0x359ca0[_0xa25e('0x2b')]=_[_0xa25e('0x2c')](_0x359ca0[_0xa25e('0x27')],_0x359ca0[_0xa25e('0x2a')]);_0x3cc36d[_0xa25e('0x2d')]=_[_0xa25e('0x2c')](_0x359ca0['model'],qs[_0xa25e('0x2e')](_0xa965cf[_0xa25e('0x2a')][_0xa25e('0x2e')]));_0x3cc36d['attributes']=_0x3cc36d[_0xa25e('0x2d')][_0xa25e('0x2f')]?_0x3cc36d[_0xa25e('0x2d')]:_0x359ca0[_0xa25e('0x27')];if(_0xa965cf[_0xa25e('0x2a')][_0xa25e('0x30')]){_0x3cc36d[_0xa25e('0x31')]=[{'all':!![]}];}_0x3cc36d=_['merge']({},_0x3cc36d,_0xa965cf[_0xa25e('0x32')]);return db[_0xa25e('0x29')][_0xa25e('0x33')](_0x3cc36d)['then'](handleEntityNotFound(_0x5e77ce,null))[_0xa25e('0x21')](respondWithResult(_0x5e77ce,null))['catch'](handleError(_0x5e77ce,null));};exports[_0xa25e('0x20')]=function(_0x47f2d4,_0x5f37e1){if(_0x47f2d4[_0xa25e('0x34')]['id']){delete _0x47f2d4[_0xa25e('0x34')]['id'];}return db[_0xa25e('0x29')]['find']({'where':{'id':_0x47f2d4[_0xa25e('0x35')]['id']}})[_0xa25e('0x21')](handleEntityNotFound(_0x5f37e1,null))['then'](saveUpdates(_0x47f2d4[_0xa25e('0x34')],null))[_0xa25e('0x21')](respondWithResult(_0x5f37e1,null))[_0xa25e('0x36')](handleError(_0x5f37e1,null));};exports[_0xa25e('0x22')]=function(_0x4a7134,_0x4fae04){return db['ChatApplication']['find']({'where':{'id':_0x4a7134['params']['id']}})[_0xa25e('0x21')](handleEntityNotFound(_0x4fae04,null))[_0xa25e('0x21')](removeEntity(_0x4fae04,null))[_0xa25e('0x36')](handleError(_0x4fae04,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index fa81c5b..6d045da 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(_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 +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 2f47ca0..9744107 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 _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 +var _0x6fb1=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','ChatApplication,\x20%s,\x20%s','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','util','moment','bluebird'];(function(_0x595775,_0x1d5665){var _0x5ad30f=function(_0xf245e3){while(--_0xf245e3){_0x595775['push'](_0x595775['shift']());}};_0x5ad30f(++_0x1d5665);}(_0x6fb1,0xc5));var _0x16fb=function(_0x522421,_0x909c38){_0x522421=_0x522421-0x0;var _0x8e418a=_0x6fb1[_0x522421];return _0x8e418a;};'use strict';var _=require('lodash');var util=require(_0x16fb('0x0'));var moment=require(_0x16fb('0x1'));var BPromise=require(_0x16fb('0x2'));var rs=require(_0x16fb('0x3'));var fs=require('fs');var Redis=require(_0x16fb('0x4'));var db=require(_0x16fb('0x5'))['db'];var utils=require(_0x16fb('0x6'));var logger=require(_0x16fb('0x7'))('rpc');var config=require(_0x16fb('0x8'));var jayson=require(_0x16fb('0x9'));var client=jayson['client'][_0x16fb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fad25,_0x597843,_0x253bbf){return new BPromise(function(_0x3d2eb3,_0x5b7b2b){return client['request'](_0x3fad25,_0x253bbf)[_0x16fb('0xb')](function(_0x96b30e){logger[_0x16fb('0xc')](_0x16fb('0xd'),_0x597843,'request\x20sent');logger['debug'](_0x16fb('0xe'),_0x597843,_0x16fb('0xf'),JSON['stringify'](_0x96b30e));if(_0x96b30e[_0x16fb('0x10')]){if(_0x96b30e[_0x16fb('0x10')][_0x16fb('0x11')]===0x1f4){logger[_0x16fb('0x10')](_0x16fb('0xd'),_0x597843,_0x96b30e[_0x16fb('0x10')][_0x16fb('0x12')]);return _0x5b7b2b(_0x96b30e[_0x16fb('0x10')][_0x16fb('0x12')]);}logger[_0x16fb('0x10')](_0x16fb('0xd'),_0x597843,_0x96b30e[_0x16fb('0x10')][_0x16fb('0x12')]);return _0x3d2eb3(_0x96b30e[_0x16fb('0x10')][_0x16fb('0x12')]);}else{logger[_0x16fb('0xc')](_0x16fb('0xd'),_0x597843,_0x16fb('0xf'));_0x3d2eb3(_0x96b30e['result']['message']);}})[_0x16fb('0x13')](function(_0x31c994){logger[_0x16fb('0x10')](_0x16fb('0xd'),_0x597843,_0x31c994);_0x5b7b2b(_0x31c994);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index b925ac1..34aca9d 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 _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 +var _0x0d53=['connect-timeout','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','multer','util','path'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x0d53,0x75));var _0x30d5=function(_0x46a08e,_0x321c81){_0x46a08e=_0x46a08e-0x0;var _0x38d2d0=_0x0d53[_0x46a08e];return _0x38d2d0;};'use strict';var multer=require(_0x30d5('0x0'));var util=require(_0x30d5('0x1'));var path=require(_0x30d5('0x2'));var timeout=require(_0x30d5('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x30d5('0x4'));var interaction=require(_0x30d5('0x5'));var config=require('../../config/environment');var controller=require(_0x30d5('0x6'));router[_0x30d5('0x7')](_0x30d5('0x8'),auth[_0x30d5('0x9')](),controller[_0x30d5('0xa')]);router[_0x30d5('0xb')](_0x30d5('0x8'),auth[_0x30d5('0x9')](),controller[_0x30d5('0xc')]);router[_0x30d5('0xd')]('/:id',auth[_0x30d5('0x9')](),controller[_0x30d5('0xe')]);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 3a0a663..97e7643 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 _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 +var _0xc88e=['BOOLEAN','sequelize','STRING'];(function(_0x93522d,_0x422c3a){var _0x7919c2=function(_0x245d45){while(--_0x245d45){_0x93522d['push'](_0x93522d['shift']());}};_0x7919c2(++_0x422c3a);}(_0xc88e,0xd3));var _0xec88=function(_0x139263,_0x43c8d9){_0x139263=_0x139263-0x0;var _0x5b6d02=_0xc88e[_0x139263];return _0x5b6d02;};'use strict';var Sequelize=require(_0xec88('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xec88('0x1')]},'write':{'type':Sequelize[_0xec88('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 40a8b25..77375e7 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 _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 +var _0x3262=['../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatGroup.socket','register','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','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','ChatGroup','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','merge','options','count','includeAll','include','rows','catch','show','find','create','body','params','describe','getUnread','ChatInternalMessage','toInteger','ids','omit','User','length','filter','getMembers','removeMembers','ChatGroupId','getMessages','findOne','order','$gte','split','format','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs'];(function(_0x312c5b,_0x43ffae){var _0x103722=function(_0x22f08a){while(--_0x22f08a){_0x312c5b['push'](_0x312c5b['shift']());}};_0x103722(++_0x43ffae);}(_0x3262,0x12a));var _0x2326=function(_0x399bd4,_0x3c84ab){_0x399bd4=_0x399bd4-0x0;var _0x12d41b=_0x3262[_0x399bd4];return _0x12d41b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2326('0x0'));var rimraf=require(_0x2326('0x1'));var zipdir=require(_0x2326('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2326('0x3'));var moment=require(_0x2326('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2326('0x5'));var util=require(_0x2326('0x6'));var path=require(_0x2326('0x7'));var sox=require('sox');var csv=require(_0x2326('0x8'));var ejs=require(_0x2326('0x9'));var fs=require('fs');var _=require(_0x2326('0xa'));var squel=require('squel');var crypto=require(_0x2326('0xb'));var jsforce=require(_0x2326('0xc'));var deskjs=require(_0x2326('0xd'));var toCsv=require(_0x2326('0x8'));var querystring=require('querystring');var Papa=require(_0x2326('0xe'));var Redis=require(_0x2326('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2326('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2326('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x2326('0x12'));var config=require(_0x2326('0x13'));var db=require(_0x2326('0x14'))['db'];config[_0x2326('0x15')]=_[_0x2326('0x16')](config[_0x2326('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x2326('0x17'))(new Redis(config[_0x2326('0x15')]));require(_0x2326('0x18'))[_0x2326('0x19')](socket);var jayson=require(_0x2326('0x1a'));var client=jayson[_0x2326('0x1b')][_0x2326('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x43c4a2,_0x220a6a,_0x542758){if(_0x542758){var _0x55ab94=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x55ab94[_0x2326('0x1d')](_0x220a6a)){return _0x43c4a2;}else{throw new db['Sequelize'][(_0x2326('0x1e'))](_0x2326('0x1f'));}}else{return _0x43c4a2;}}function respondWithRpcPromise(_0x8d385,_0x7ead34,_0x6a7ad1,_0x5397f0){return new BPromise(function(_0x495f95,_0x22acbb){var _0x14053f=_0x5397f0||client;return _0x14053f['request'](_0x8d385,_0x6a7ad1)[_0x2326('0x20')](function(_0x8951c9){logger[_0x2326('0x21')](_0x2326('0x22'),_0x7ead34,_0x2326('0x23'));logger['debug'](_0x2326('0x24'),_0x7ead34,_0x2326('0x23'),JSON['stringify'](_0x8951c9));if(_0x8951c9[_0x2326('0x25')]){if(_0x8951c9[_0x2326('0x25')][_0x2326('0x26')]===0x1f4){logger[_0x2326('0x25')](_0x2326('0x22'),_0x7ead34,_0x8951c9[_0x2326('0x25')][_0x2326('0x27')]);return _0x22acbb(_0x8951c9[_0x2326('0x25')][_0x2326('0x27')]);}logger[_0x2326('0x25')](_0x2326('0x22'),_0x7ead34,_0x8951c9[_0x2326('0x25')]['message']);return _0x495f95(_0x8951c9['error'][_0x2326('0x27')]);}else{logger[_0x2326('0x21')](_0x2326('0x22'),_0x7ead34,_0x2326('0x23'));_0x495f95(_0x8951c9['result']['message']);}})['catch'](function(_0x3293a7){logger[_0x2326('0x25')](_0x2326('0x22'),_0x7ead34,_0x3293a7);_0x22acbb(_0x3293a7);});});}function respondWithStatusCode(_0x46b9ec,_0x47cc5a){_0x47cc5a=_0x47cc5a||0xcc;return function(_0x5631e5){if(_0x5631e5){return _0x46b9ec[_0x2326('0x28')](_0x47cc5a);}return _0x46b9ec[_0x2326('0x29')](_0x47cc5a)[_0x2326('0x2a')]();};}function respondWithResult(_0x491c6e,_0x4c3f53){_0x4c3f53=_0x4c3f53||0xc8;return function(_0x19cded){if(_0x19cded){return _0x491c6e[_0x2326('0x29')](_0x4c3f53)['json'](_0x19cded);}};}function respondWithFilteredResult(_0xb26971,_0x162ace){return function(_0x5f231e){if(_0x5f231e){var _0x581f8e=_0x5f231e['count'],_0x4671f2=_0x162ace[_0x2326('0x2b')],_0x3e4126=_0x162ace[_0x2326('0x2b')]+_0x162ace[_0x2326('0x2c')],_0x236028;if(_0x3e4126>=_0x581f8e){_0x3e4126=_0x581f8e;_0x236028=0xc8;}else{_0x236028=0xce;}_0xb26971['status'](_0x236028);return _0xb26971[_0x2326('0x2d')](_0x2326('0x2e'),_0x4671f2+'-'+_0x3e4126+'/'+_0x581f8e)[_0x2326('0x2f')](_0x5f231e);}return null;};}function patchUpdates(_0x2ac193){return function(_0x31debe){try{jsonpatch[_0x2326('0x30')](_0x31debe,_0x2ac193,!![]);}catch(_0x387316){return BPromise[_0x2326('0x31')](_0x387316);}return _0x31debe[_0x2326('0x32')]();};}function saveUpdates(_0xec8acf,_0x437af9){return function(_0x59608c){if(_0x59608c){return _0x59608c[_0x2326('0x33')](_0xec8acf)['then'](function(_0xd412de){return _0xd412de;});}return null;};}function removeEntity(_0x3c49db,_0x1d151){return function(_0x561a04){if(_0x561a04){return _0x561a04[_0x2326('0x34')]()[_0x2326('0x20')](function(){_0x3c49db[_0x2326('0x29')](0xcc)[_0x2326('0x2a')]();});}};}function handleEntityNotFound(_0x11a430,_0x64e7cc){return function(_0x5ece27){if(!_0x5ece27){_0x11a430['sendStatus'](0x194);}return _0x5ece27;};}function handleError(_0x27b3e1,_0x321b3f){_0x321b3f=_0x321b3f||0x1f4;return function(_0x1733e3){logger[_0x2326('0x25')](_0x1733e3[_0x2326('0x35')]);if(_0x1733e3['name']){delete _0x1733e3[_0x2326('0x36')];}_0x27b3e1[_0x2326('0x29')](_0x321b3f)[_0x2326('0x37')](_0x1733e3);};}exports[_0x2326('0x38')]=function(_0x12eeda,_0x1ed2b2){var _0x1dd75d={},_0x2fa755={},_0x4c16b2={'count':0x0,'rows':[]};var _0x1bba06=_[_0x2326('0x39')](db[_0x2326('0x3a')][_0x2326('0x3b')],function(_0x5e487c){return{'name':_0x5e487c['fieldName'],'type':_0x5e487c[_0x2326('0x3c')][_0x2326('0x3d')]};});_0x2fa755[_0x2326('0x3e')]=_[_0x2326('0x39')](_0x1bba06,_0x2326('0x36'));_0x2fa755[_0x2326('0x3f')]=_[_0x2326('0x40')](_0x12eeda[_0x2326('0x3f')]);_0x2fa755[_0x2326('0x41')]=_[_0x2326('0x42')](_0x2fa755['model'],_0x2fa755['query']);_0x1dd75d['attributes']=_[_0x2326('0x42')](_0x2fa755[_0x2326('0x3e')],qs['fields'](_0x12eeda['query'][_0x2326('0x43')]));_0x1dd75d[_0x2326('0x44')]=_0x1dd75d[_0x2326('0x44')]['length']?_0x1dd75d[_0x2326('0x44')]:_0x2fa755[_0x2326('0x3e')];if(!_0x12eeda[_0x2326('0x3f')][_0x2326('0x45')](_0x2326('0x46'))){_0x1dd75d[_0x2326('0x2c')]=qs[_0x2326('0x2c')](_0x12eeda[_0x2326('0x3f')]['limit']);_0x1dd75d['offset']=qs['offset'](_0x12eeda[_0x2326('0x3f')][_0x2326('0x2b')]);}_0x1dd75d['order']=qs[_0x2326('0x47')](_0x12eeda[_0x2326('0x3f')]['sort']);_0x1dd75d[_0x2326('0x48')]=qs[_0x2326('0x41')](_[_0x2326('0x49')](_0x12eeda[_0x2326('0x3f')],_0x2fa755[_0x2326('0x41')]),_0x1bba06);if(_0x12eeda['query']['filter']){_0x1dd75d['where']=_['merge'](_0x1dd75d[_0x2326('0x48')],{'$or':_[_0x2326('0x39')](_0x1bba06,function(_0x5081e0){if(_0x5081e0[_0x2326('0x3c')]!==_0x2326('0x4a')){var _0x5a589a={};_0x5a589a[_0x5081e0['name']]={'$like':'%'+_0x12eeda[_0x2326('0x3f')]['filter']+'%'};return _0x5a589a;}})});}_0x1dd75d=_[_0x2326('0x4b')]({},_0x1dd75d,_0x12eeda[_0x2326('0x4c')]);var _0x4e8010={'where':_0x1dd75d[_0x2326('0x48')]};return db[_0x2326('0x3a')][_0x2326('0x4d')](_0x4e8010)[_0x2326('0x20')](function(_0x18dc8d){_0x4c16b2['count']=_0x18dc8d;if(_0x12eeda[_0x2326('0x3f')][_0x2326('0x4e')]){_0x1dd75d[_0x2326('0x4f')]=[{'all':!![]}];}return db[_0x2326('0x3a')]['findAll'](_0x1dd75d);})[_0x2326('0x20')](function(_0x5b8943){_0x4c16b2[_0x2326('0x50')]=_0x5b8943;return _0x4c16b2;})[_0x2326('0x20')](respondWithFilteredResult(_0x1ed2b2,_0x1dd75d))[_0x2326('0x51')](handleError(_0x1ed2b2,null));};exports[_0x2326('0x52')]=function(_0x766e84,_0x52857c){var _0x33981a={'raw':!![],'where':{'id':_0x766e84['params']['id']}},_0x599e2f={};_0x599e2f['model']=_[_0x2326('0x40')](db[_0x2326('0x3a')][_0x2326('0x3b')]);_0x599e2f['query']=_[_0x2326('0x40')](_0x766e84['query']);_0x599e2f[_0x2326('0x41')]=_[_0x2326('0x42')](_0x599e2f[_0x2326('0x3e')],_0x599e2f[_0x2326('0x3f')]);_0x33981a[_0x2326('0x44')]=_[_0x2326('0x42')](_0x599e2f[_0x2326('0x3e')],qs['fields'](_0x766e84[_0x2326('0x3f')]['fields']));_0x33981a[_0x2326('0x44')]=_0x33981a['attributes']['length']?_0x33981a[_0x2326('0x44')]:_0x599e2f[_0x2326('0x3e')];if(_0x766e84[_0x2326('0x3f')]['includeAll']){_0x33981a[_0x2326('0x4f')]=[{'all':!![]}];}_0x33981a=_[_0x2326('0x4b')]({},_0x33981a,_0x766e84[_0x2326('0x4c')]);return db[_0x2326('0x3a')][_0x2326('0x53')](_0x33981a)[_0x2326('0x20')](handleEntityNotFound(_0x52857c,null))['then'](respondWithResult(_0x52857c,null))['catch'](handleError(_0x52857c,null));};exports[_0x2326('0x54')]=function(_0x24d1af,_0xa41d73){return db['ChatGroup'][_0x2326('0x54')](_0x24d1af[_0x2326('0x55')],{})['then'](respondWithResult(_0xa41d73,0xc9))[_0x2326('0x51')](handleError(_0xa41d73,null));};exports[_0x2326('0x33')]=function(_0x1350e4,_0x1fbb2f){if(_0x1350e4[_0x2326('0x55')]['id']){delete _0x1350e4[_0x2326('0x55')]['id'];}return db[_0x2326('0x3a')][_0x2326('0x53')]({'where':{'id':_0x1350e4[_0x2326('0x56')]['id']}})[_0x2326('0x20')](handleEntityNotFound(_0x1fbb2f,null))[_0x2326('0x20')](saveUpdates(_0x1350e4[_0x2326('0x55')],null))[_0x2326('0x20')](respondWithResult(_0x1fbb2f,null))[_0x2326('0x51')](handleError(_0x1fbb2f,null));};exports[_0x2326('0x34')]=function(_0x5e6480,_0x30f070){return db[_0x2326('0x3a')][_0x2326('0x53')]({'where':{'id':_0x5e6480[_0x2326('0x56')]['id']}})['then'](handleEntityNotFound(_0x30f070,null))[_0x2326('0x20')](removeEntity(_0x30f070,null))[_0x2326('0x51')](handleError(_0x30f070,null));};exports['describe']=function(_0x51b5d5,_0x5d150c){return db[_0x2326('0x3a')][_0x2326('0x57')]()[_0x2326('0x20')](respondWithResult(_0x5d150c,null))[_0x2326('0x51')](handleError(_0x5d150c,null));};exports[_0x2326('0x58')]=function(_0x4b87fa,_0x43d6aa,_0x1d74f9){return db[_0x2326('0x59')][_0x2326('0x4d')]({'where':{'ChatGroupId':_0x4b87fa['params']['id'],'ToId':_0x4b87fa['user']['id'],'read':![]}})[_0x2326('0x20')](function(_0x566262){return{'id':_[_0x2326('0x5a')](_0x4b87fa['params']['id']),'count':_0x566262};})[_0x2326('0x20')](respondWithResult(_0x43d6aa,null))[_0x2326('0x51')](handleError(_0x43d6aa,null));};exports['addMembers']=function(_0x506a38,_0x4f192b,_0x454f7a){return db[_0x2326('0x3a')]['find']({'where':{'id':_0x506a38['params']['id']}})[_0x2326('0x20')](handleEntityNotFound(_0x4f192b,null))[_0x2326('0x20')](function(_0x566bec){if(_0x566bec){return _0x566bec['addMembers'](_0x506a38['body'][_0x2326('0x5b')],_[_0x2326('0x5c')](_0x506a38['body'],[_0x2326('0x5b'),'id'])||{});}})[_0x2326('0x20')](respondWithResult(_0x4f192b,null))['catch'](handleError(_0x4f192b,null));};exports['getMembers']=function(_0x2c18d7,_0x1c124a,_0x2100cc){var _0x30de99={};var _0x57efa4={};var _0x2eeb00;var _0x1a3b74;return db[_0x2326('0x3a')]['findOne']({'where':{'id':_0x2c18d7[_0x2326('0x56')]['id']}})[_0x2326('0x20')](handleEntityNotFound(_0x1c124a,null))[_0x2326('0x20')](function(_0x406f56){if(_0x406f56){_0x2eeb00=_0x406f56;_0x57efa4[_0x2326('0x3e')]=_[_0x2326('0x40')](db[_0x2326('0x5d')][_0x2326('0x3b')]);_0x57efa4[_0x2326('0x3f')]=_[_0x2326('0x40')](_0x2c18d7[_0x2326('0x3f')]);_0x57efa4[_0x2326('0x41')]=_[_0x2326('0x42')](_0x57efa4[_0x2326('0x3e')],_0x57efa4['query']);_0x30de99[_0x2326('0x44')]=_[_0x2326('0x42')](_0x57efa4['model'],qs[_0x2326('0x43')](_0x2c18d7[_0x2326('0x3f')][_0x2326('0x43')]));_0x30de99['attributes']=_0x30de99[_0x2326('0x44')][_0x2326('0x5e')]?_0x30de99[_0x2326('0x44')]:_0x57efa4['model'];_0x30de99['order']=qs[_0x2326('0x47')](_0x2c18d7[_0x2326('0x3f')]['sort']);_0x30de99[_0x2326('0x48')]=qs['filters'](_[_0x2326('0x49')](_0x2c18d7[_0x2326('0x3f')],_0x57efa4[_0x2326('0x41')]));if(_0x2c18d7[_0x2326('0x3f')][_0x2326('0x5f')]){_0x30de99[_0x2326('0x48')]=_[_0x2326('0x4b')](_0x30de99[_0x2326('0x48')],{'$or':_[_0x2326('0x39')](_0x30de99[_0x2326('0x44')],function(_0x3c7146){var _0x127c40={};_0x127c40[_0x3c7146]={'$like':'%'+_0x2c18d7['query'][_0x2326('0x5f')]+'%'};return _0x127c40;})});}_0x30de99=_[_0x2326('0x4b')]({},_0x30de99,_0x2c18d7[_0x2326('0x4c')]);return _0x2eeb00[_0x2326('0x60')](_0x30de99);}})['then'](function(_0x10043c){if(_0x10043c){_0x1a3b74=_0x10043c[_0x2326('0x5e')];if(!_0x2c18d7[_0x2326('0x3f')][_0x2326('0x45')]('nolimit')){_0x30de99[_0x2326('0x2c')]=qs[_0x2326('0x2c')](_0x2c18d7['query'][_0x2326('0x2c')]);_0x30de99[_0x2326('0x2b')]=qs[_0x2326('0x2b')](_0x2c18d7[_0x2326('0x3f')][_0x2326('0x2b')]);}return _0x2eeb00['getMembers'](_0x30de99);}})['then'](function(_0x5f5119){if(_0x5f5119){return _0x5f5119?{'count':_0x1a3b74,'rows':_0x5f5119}:null;}})['then'](respondWithResult(_0x1c124a,null))['catch'](handleError(_0x1c124a,null));};exports[_0x2326('0x61')]=function(_0x5da71a,_0x51adc0,_0x528d0e){return db['ChatGroup']['find']({'where':{'id':_0x5da71a['params']['id']}})[_0x2326('0x20')](handleEntityNotFound(_0x51adc0,null))[_0x2326('0x20')](function(_0x459d19){if(_0x459d19){return _0x459d19[_0x2326('0x61')](_0x5da71a[_0x2326('0x3f')][_0x2326('0x5b')]);}})[_0x2326('0x20')](respondWithStatusCode(_0x51adc0,null))[_0x2326('0x51')](handleError(_0x51adc0,null));};exports['addMessage']=function(_0x363533,_0x52d3f1,_0x700b72){if(_0x363533[_0x2326('0x55')]['id']){delete _0x363533[_0x2326('0x55')]['id'];}return db['ChatGroup'][_0x2326('0x53')]({'where':{'id':_0x363533[_0x2326('0x56')]['id']}})['then'](handleEntityNotFound(_0x52d3f1,null))[_0x2326('0x20')](function(_0x20a274){if(_0x20a274){_0x363533[_0x2326('0x55')][_0x2326('0x62')]=_0x20a274['id'];return db[_0x2326('0x59')][_0x2326('0x54')](_0x363533[_0x2326('0x55')]);}})[_0x2326('0x20')](respondWithResult(_0x52d3f1,null))[_0x2326('0x51')](handleError(_0x52d3f1,null));};exports[_0x2326('0x63')]=function(_0x296938,_0x14ebcf,_0x5e3afb){var _0x277ef8={};var _0x3f805c={};var _0x437600;var _0xc4def2;return db[_0x2326('0x3a')][_0x2326('0x64')]({'where':{'id':_0x296938[_0x2326('0x56')]['id']}})[_0x2326('0x20')](handleEntityNotFound(_0x14ebcf,null))[_0x2326('0x20')](function(_0x312ab5){if(_0x312ab5){_0x437600=_0x312ab5;_0x3f805c[_0x2326('0x3e')]=_[_0x2326('0x40')](db[_0x2326('0x59')][_0x2326('0x3b')]);_0x3f805c[_0x2326('0x3f')]=_[_0x2326('0x40')](_0x296938[_0x2326('0x3f')]);_0x3f805c[_0x2326('0x41')]=_[_0x2326('0x42')](_0x3f805c['model'],_0x3f805c[_0x2326('0x3f')]);_0x277ef8['attributes']=_[_0x2326('0x42')](_0x3f805c[_0x2326('0x3e')],qs[_0x2326('0x43')](_0x296938[_0x2326('0x3f')]['fields']));_0x277ef8[_0x2326('0x44')]=_0x277ef8['attributes'][_0x2326('0x5e')]?_0x277ef8[_0x2326('0x44')]:_0x3f805c[_0x2326('0x3e')];_0x277ef8[_0x2326('0x65')]=qs[_0x2326('0x47')](_0x296938[_0x2326('0x3f')]['sort']);_0x277ef8['where']=qs[_0x2326('0x41')](_[_0x2326('0x49')](_0x296938[_0x2326('0x3f')],_0x3f805c[_0x2326('0x41')]));if(_0x296938[_0x2326('0x3f')][_0x2326('0x5f')]){_0x277ef8[_0x2326('0x48')]=_[_0x2326('0x4b')](_0x277ef8[_0x2326('0x48')],{'$or':_[_0x2326('0x39')](_0x277ef8['attributes'],function(_0x5a2a33){var _0x292dde={};_0x292dde[_0x5a2a33]={'$like':'%'+_0x296938[_0x2326('0x3f')][_0x2326('0x5f')]+'%'};return _0x292dde;})});}if(_0x296938[_0x2326('0x3f')][_0x2326('0x66')]){var _0x346f6d=_0x296938['query'][_0x2326('0x66')][_0x2326('0x67')](',');var _0xd5558c={};_0xd5558c[_0x346f6d[0x0]]={'$gte':moment(_0x346f6d[0x1])[_0x2326('0x68')]('YYYY-MM-DD\x20HH:mm:ss')};_0x277ef8[_0x2326('0x48')]=_[_0x2326('0x4b')](_0x277ef8[_0x2326('0x48')],_0xd5558c);}_0x277ef8=_[_0x2326('0x4b')]({},_0x277ef8,_0x296938['options']);return _0x437600[_0x2326('0x63')](_0x277ef8);}})['then'](function(_0xb9f2b1){if(_0xb9f2b1){_0xc4def2=_0xb9f2b1[_0x2326('0x5e')];if(!_0x296938['query'][_0x2326('0x45')](_0x2326('0x46'))){_0x277ef8[_0x2326('0x2c')]=qs['limit'](_0x296938[_0x2326('0x3f')]['limit']);_0x277ef8[_0x2326('0x2b')]=qs[_0x2326('0x2b')](_0x296938[_0x2326('0x3f')]['offset']);}return _0x437600[_0x2326('0x63')](_0x277ef8);}})['then'](function(_0x2ce76a){if(_0x2ce76a){return _0x2ce76a?{'count':_0xc4def2,'rows':_0x2ce76a}:null;}})[_0x2326('0x20')](respondWithResult(_0x14ebcf,null))['catch'](handleError(_0x14ebcf,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 1dc3a15..1eed676 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 _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 +var _0x0b0e=['ChatGroup','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x176b86,_0x260b34){var _0x2ed0d5=function(_0x118618){while(--_0x118618){_0x176b86['push'](_0x176b86['shift']());}};_0x2ed0d5(++_0x260b34);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4880fd,_0x2cc70d){_0x4880fd=_0x4880fd-0x0;var _0x4a4b50=_0x0b0e[_0x4880fd];return _0x4a4b50;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xe0b0('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){ChatGroupEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);ChatGroupEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];ChatGroup[_0xe0b0('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 2fa129d..7e4e4ae 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 _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 +var _0xa4ba=['../../config/logger','api','moment','request-promise','../../config/environment','./chatGroup.attributes','exports','define','chat_groups','util'];(function(_0x1d1f81,_0x41029b){var _0x4e8d95=function(_0x391859){while(--_0x391859){_0x1d1f81['push'](_0x1d1f81['shift']());}};_0x4e8d95(++_0x41029b);}(_0xa4ba,0x1b7));var _0xaa4b=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xa4ba[_0x1b6186];return _0x186121;};'use strict';var _=require('lodash');var util=require(_0xaa4b('0x0'));var logger=require(_0xaa4b('0x1'))(_0xaa4b('0x2'));var moment=require(_0xaa4b('0x3'));var BPromise=require('bluebird');var rp=require(_0xaa4b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaa4b('0x5'));var attributes=require(_0xaa4b('0x6'));module[_0xaa4b('0x7')]=function(_0x146035,_0x4809a9){return _0x146035[_0xaa4b('0x8')]('ChatGroup',attributes,{'tableName':_0xaa4b('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 ce5e06b..be151fe 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 _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 +var _0xf767=['error','code','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf767,0x18d));var _0x7f76=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xf767[_0x21aec3];return _0x288bbc;};'use strict';var _=require('lodash');var util=require(_0x7f76('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7f76('0x1'));var fs=require('fs');var Redis=require(_0x7f76('0x2'));var db=require(_0x7f76('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7f76('0x4'))(_0x7f76('0x5'));var config=require(_0x7f76('0x6'));var jayson=require(_0x7f76('0x7'));var client=jayson[_0x7f76('0x8')][_0x7f76('0x9')]({'port':0x232a});config[_0x7f76('0xa')]=_[_0x7f76('0xb')](config['redis'],{'host':_0x7f76('0xc'),'port':0x18eb});var socket=require(_0x7f76('0xd'))(new Redis(config[_0x7f76('0xa')]));require(_0x7f76('0xe'))[_0x7f76('0xf')](socket);function respondWithRpcPromise(_0x4a4563,_0x11033e,_0x498427){return new BPromise(function(_0x417aea,_0x787a06){return client['request'](_0x4a4563,_0x498427)[_0x7f76('0x10')](function(_0x838873){logger[_0x7f76('0x11')](_0x7f76('0x12'),_0x11033e,_0x7f76('0x13'));logger[_0x7f76('0x14')](_0x7f76('0x15'),_0x11033e,_0x7f76('0x13'),JSON[_0x7f76('0x16')](_0x838873));if(_0x838873[_0x7f76('0x17')]){if(_0x838873[_0x7f76('0x17')][_0x7f76('0x18')]===0x1f4){logger[_0x7f76('0x17')](_0x7f76('0x12'),_0x11033e,_0x838873[_0x7f76('0x17')][_0x7f76('0x19')]);return _0x787a06(_0x838873[_0x7f76('0x17')][_0x7f76('0x19')]);}logger[_0x7f76('0x17')](_0x7f76('0x12'),_0x11033e,_0x838873[_0x7f76('0x17')][_0x7f76('0x19')]);return _0x417aea(_0x838873[_0x7f76('0x17')][_0x7f76('0x19')]);}else{logger[_0x7f76('0x11')](_0x7f76('0x12'),_0x11033e,_0x7f76('0x13'));_0x417aea(_0x838873[_0x7f76('0x1a')][_0x7f76('0x19')]);}})[_0x7f76('0x1b')](function(_0x27eeee){logger[_0x7f76('0x17')](_0x7f76('0x12'),_0x11033e,_0x27eeee);_0x787a06(_0x27eeee);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 299a3d6..20d0b10 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 _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 +var _0x8cca=['save','remove','emit','removeListener','register','./chatGroup.events'];(function(_0x15049e,_0x4e66bb){var _0x865413=function(_0x377558){while(--_0x377558){_0x15049e['push'](_0x15049e['shift']());}};_0x865413(++_0x4e66bb);}(_0x8cca,0xe9));var _0xa8cc=function(_0x42d861,_0x4f9b86){_0x42d861=_0x42d861-0x0;var _0x4c7bf6=_0x8cca[_0x42d861];return _0x4c7bf6;};'use strict';var ChatGroupEvents=require(_0xa8cc('0x0'));var events=[_0xa8cc('0x1'),_0xa8cc('0x2'),'update'];function createListener(_0x2e1e30,_0x37be13){return function(_0x338cda){_0x37be13[_0xa8cc('0x3')](_0x2e1e30,_0x338cda);};}function removeListener(_0x39d2c1,_0x3a00e8){return function(){ChatGroupEvents[_0xa8cc('0x4')](_0x39d2c1,_0x3a00e8);};}exports[_0xa8cc('0x5')]=function(_0x175d53){for(var _0x54e920=0x0,_0x55d95d=events['length'];_0x54e920<_0x55d95d;_0x54e920++){var _0x1f9b80=events[_0x54e920];var _0x4030ac=createListener('chatGroup:'+_0x1f9b80,_0x175d53);ChatGroupEvents['on'](_0x1f9b80,_0x4030ac);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 9b684db..a004758 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 _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 +var _0xd79d=['addMessage','put','/:id','update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','/describe','describe','get','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','create','post'];(function(_0x5cdc52,_0x33ce72){var _0x455283=function(_0x54070d){while(--_0x54070d){_0x5cdc52['push'](_0x5cdc52['shift']());}};_0x455283(++_0x33ce72);}(_0xd79d,0x14a));var _0xdd79=function(_0x17df1b,_0x4cf1d7){_0x17df1b=_0x17df1b-0x0;var _0x297263=_0xd79d[_0x17df1b];return _0x297263;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdd79('0x0'));var timeout=require(_0xdd79('0x1'));var express=require(_0xdd79('0x2'));var router=express[_0xdd79('0x3')]();var auth=require(_0xdd79('0x4'));var interaction=require(_0xdd79('0x5'));var config=require(_0xdd79('0x6'));var controller=require(_0xdd79('0x7'));router['get']('/',auth[_0xdd79('0x8')](),controller[_0xdd79('0x9')]);router['get'](_0xdd79('0xa'),auth[_0xdd79('0x8')](),controller[_0xdd79('0xb')]);router[_0xdd79('0xc')]('/:id',auth[_0xdd79('0x8')](),controller['show']);router[_0xdd79('0xc')](_0xdd79('0xd'),auth[_0xdd79('0x8')](),controller[_0xdd79('0xe')]);router[_0xdd79('0xc')](_0xdd79('0xf'),auth['isAuthenticated'](),controller[_0xdd79('0x10')]);router[_0xdd79('0xc')](_0xdd79('0x11'),auth[_0xdd79('0x8')](),controller[_0xdd79('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdd79('0x13')]);router[_0xdd79('0x14')](_0xdd79('0xf'),auth[_0xdd79('0x8')](),controller['addMembers']);router['post'](_0xdd79('0x11'),auth[_0xdd79('0x8')](),controller[_0xdd79('0x15')]);router[_0xdd79('0x16')](_0xdd79('0x17'),auth[_0xdd79('0x8')](),controller[_0xdd79('0x18')]);router[_0xdd79('0x19')](_0xdd79('0x17'),auth[_0xdd79('0x8')](),controller[_0xdd79('0x1a')]);router[_0xdd79('0x19')](_0xdd79('0xf'),auth['isAuthenticated'](),controller['removeMembers']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 720372b..d5dfbef 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 _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 +var _0x9343=['star','TEXT','STRING','DATE','long','sequelize','exports','INTEGER','ENUM','thumb'];(function(_0x12dcec,_0x593c61){var _0x995eda=function(_0x295e32){while(--_0x295e32){_0x12dcec['push'](_0x12dcec['shift']());}};_0x995eda(++_0x593c61);}(_0x9343,0xaf));var _0x3934=function(_0x55b8ae,_0x28def4){_0x55b8ae=_0x55b8ae-0x0;var _0x5aba2d=_0x9343[_0x55b8ae];return _0x5aba2d;};'use strict';var Sequelize=require(_0x3934('0x0'));module[_0x3934('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x3934('0x2')]},'ratingType':{'type':Sequelize[_0x3934('0x3')]('star',_0x3934('0x4')),'defaultValue':_0x3934('0x5')},'ratingMessage':{'type':Sequelize[_0x3934('0x6')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x3934('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x3934('0x8')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x3934('0x7')]},'browserName':{'type':Sequelize[_0x3934('0x7')]},'browserVersion':{'type':Sequelize[_0x3934('0x7')]},'osName':{'type':Sequelize[_0x3934('0x7')]},'osVersion':{'type':Sequelize[_0x3934('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x3934('0x6')]},'customerIp':{'type':Sequelize[_0x3934('0x7')]},'formData':{'type':Sequelize[_0x3934('0x6')](_0x3934('0x9'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x3934('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x3934('0x7')]},'customerPort':{'type':Sequelize[_0x3934('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x3934('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 160dde4..b0b63f5 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 _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 +var _0x2ef3=['find','ContactId','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','some','compact','isEmpty','ChatWebsiteId','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','\x27\x27\x27\x27','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','i.id','order','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','show','params','includeAll','include','merge','options','create','destroy','describe','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','disposition','AbandonInteraction','file','basename','attachId','download','join','root','server/files/attachments/','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','CmContact','%s%d','agentAlias','Visitor','System','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','SendMail','user','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','addTags','setTags','spread','Tag','emit','chatInteractionTags:save','removeTags','server','tmp','files','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','Attachment','secret','read','Account','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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','%s\x20#%d','YYYY-MM-DD','N.A.','closed','osName','referer','customerIp','customerPort','existsSync','createReadStream','pipe','renderFile','downloadInteraction.html','toFile','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','localhost','socket.io-emitter','register','client','http','test','Sequelize','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','set','apply','update','sendStatus','stack','name','send','map','fullname','TagIds','Tags','split','forEach','push','index','ChatInteraction','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','nolimit','limit','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','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','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','length','unreadMessages','value','having','`\x20=\x200','operator','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?'];(function(_0x3692d6,_0x36b5f5){var _0x49f104=function(_0x23c0bd){while(--_0x23c0bd){_0x3692d6['push'](_0x3692d6['shift']());}};_0x49f104(++_0x36b5f5);}(_0x2ef3,0xba));var _0x32ef=function(_0x556bb5,_0x4c317a){_0x556bb5=_0x556bb5-0x0;var _0x416342=_0x2ef3[_0x556bb5];return _0x416342;};'use strict';var pdf=require(_0x32ef('0x0'));var emlformat=require(_0x32ef('0x1'));var rimraf=require(_0x32ef('0x2'));var zipdir=require(_0x32ef('0x3'));var jsonpatch=require(_0x32ef('0x4'));var rp=require(_0x32ef('0x5'));var moment=require('moment');var BPromise=require(_0x32ef('0x6'));var Mustache=require(_0x32ef('0x7'));var util=require('util');var path=require(_0x32ef('0x8'));var sox=require(_0x32ef('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0xf'));var querystring=require(_0x32ef('0x10'));var Papa=require(_0x32ef('0x11'));var Redis=require(_0x32ef('0x12'));var authService=require(_0x32ef('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x14'));var logger=require(_0x32ef('0x15'))(_0x32ef('0x16'));var utils=require(_0x32ef('0x17'));var config=require('../../config/environment');var db=require(_0x32ef('0x18'))['db'];config['redis']=_[_0x32ef('0x19')](config['redis'],{'host':_0x32ef('0x1a'),'port':0x18eb});var socket=require(_0x32ef('0x1b'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0x32ef('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x32ef('0x1d')][_0x32ef('0x1e')]({'port':0x232b});var client9004=jayson[_0x32ef('0x1d')][_0x32ef('0x1e')]({'port':0x232c});function checkPasswordPattern(_0x57aff1,_0x55bf0b,_0x531e30){if(_0x531e30){var _0x13db1a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x13db1a[_0x32ef('0x1f')](_0x55bf0b)){return _0x57aff1;}else{throw new db[(_0x32ef('0x20'))]['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 _0x57aff1;}}function respondWithRpcPromise(_0x1eb468,_0x1a9476,_0x286bfb,_0x57863c){return new BPromise(function(_0xbe37f6,_0x33e230){var _0x4f4c98=_0x57863c||client;return _0x4f4c98[_0x32ef('0x21')](_0x1eb468,_0x286bfb)[_0x32ef('0x22')](function(_0x26aff3){logger[_0x32ef('0x23')](_0x32ef('0x24'),_0x1a9476,_0x32ef('0x25'));logger['debug'](_0x32ef('0x26'),_0x1a9476,'request\x20sent',JSON[_0x32ef('0x27')](_0x26aff3));if(_0x26aff3[_0x32ef('0x28')]){if(_0x26aff3['error'][_0x32ef('0x29')]===0x1f4){logger[_0x32ef('0x28')](_0x32ef('0x24'),_0x1a9476,_0x26aff3['error']['message']);return _0x33e230(_0x26aff3[_0x32ef('0x28')][_0x32ef('0x2a')]);}logger[_0x32ef('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x1a9476,_0x26aff3['error'][_0x32ef('0x2a')]);return _0xbe37f6(_0x26aff3['error']['message']);}else{logger[_0x32ef('0x23')](_0x32ef('0x24'),_0x1a9476,_0x32ef('0x25'));_0xbe37f6(_0x26aff3[_0x32ef('0x2b')][_0x32ef('0x2a')]);}})[_0x32ef('0x2c')](function(_0x1874ea){logger[_0x32ef('0x28')](_0x32ef('0x24'),_0x1a9476,_0x1874ea);_0x33e230(_0x1874ea);});});}function respondWithStatusCode(_0x2f52d7,_0x1335e2){_0x1335e2=_0x1335e2||0xcc;return function(_0xba4b3f){if(_0xba4b3f){return _0x2f52d7['sendStatus'](_0x1335e2);}return _0x2f52d7[_0x32ef('0x2d')](_0x1335e2)[_0x32ef('0x2e')]();};}function respondWithResult(_0x5a04cd,_0x12de1a){_0x12de1a=_0x12de1a||0xc8;return function(_0x3c569d){if(_0x3c569d){return _0x5a04cd[_0x32ef('0x2d')](_0x12de1a)[_0x32ef('0x2f')](_0x3c569d);}};}function respondWithFilteredResult(_0x50a95b,_0x10e38c){return function(_0x22bf86){if(_0x22bf86){var _0x31dbc3=_0x22bf86[_0x32ef('0x30')],_0x2ac686=_0x10e38c['offset'],_0x1b668a=_0x10e38c[_0x32ef('0x31')]+_0x10e38c['limit'],_0x1a6ed2;if(_0x1b668a>=_0x31dbc3){_0x1b668a=_0x31dbc3;_0x1a6ed2=0xc8;}else{_0x1a6ed2=0xce;}_0x50a95b[_0x32ef('0x2d')](_0x1a6ed2);return _0x50a95b[_0x32ef('0x32')]('Content-Range',_0x2ac686+'-'+_0x1b668a+'/'+_0x31dbc3)[_0x32ef('0x2f')](_0x22bf86);}return null;};}function patchUpdates(_0x17e4d1){return function(_0x3b00ad){try{jsonpatch[_0x32ef('0x33')](_0x3b00ad,_0x17e4d1,!![]);}catch(_0x120f30){return BPromise['reject'](_0x120f30);}return _0x3b00ad['save']();};}function saveUpdates(_0x2a5eb5,_0x5dadf7){return function(_0x643dc4){if(_0x643dc4){return _0x643dc4[_0x32ef('0x34')](_0x2a5eb5)[_0x32ef('0x22')](function(_0x390670){return _0x390670;});}return null;};}function removeEntity(_0x389583,_0x22fa1a){return function(_0x566b56){if(_0x566b56){return _0x566b56['destroy']()['then'](function(){_0x389583[_0x32ef('0x2d')](0xcc)[_0x32ef('0x2e')]();});}};}function handleEntityNotFound(_0x136b02,_0x5f2443){return function(_0x4fb402){if(!_0x4fb402){_0x136b02[_0x32ef('0x35')](0x194);}return _0x4fb402;};}function handleError(_0x2bd8a9,_0x410334){_0x410334=_0x410334||0x1f4;return function(_0x480348){logger['error'](_0x480348[_0x32ef('0x36')]);if(_0x480348[_0x32ef('0x37')]){delete _0x480348[_0x32ef('0x37')];}_0x2bd8a9[_0x32ef('0x2d')](_0x410334)[_0x32ef('0x38')](_0x480348);};}function getInteractionUsers(_0x211c79,_0x3223d5){return new BPromise(function(_0x21da90,_0x7f2319){try{if(_0x3223d5[_0x211c79['id']]){_0x211c79['Users']=_[_0x32ef('0x39')](_0x3223d5[_0x211c79['id']],function(_0x36e374){return{'id':_0x36e374['id'],'fullname':_0x36e374[_0x32ef('0x3a')]};});}}catch(_0x4b97dc){_0x7f2319(_0x4b97dc);}_0x21da90(_0x211c79);});}function getInteractionTags(_0x365125,_0x17e489){return new BPromise(function(_0x879e33,_0x393a89){try{if(_0x365125[_0x32ef('0x3b')]){_0x365125[_0x32ef('0x3c')]=[];_0x365125[_0x32ef('0x3b')][_0x32ef('0x3d')](',')[_0x32ef('0x3e')](function(_0x57a3c0){_0x365125[_0x32ef('0x3c')][_0x32ef('0x3f')](_0x17e489[_0x57a3c0]);});}delete _0x365125['TagIds'];}catch(_0x3cac2e){_0x393a89(_0x3cac2e);}_0x879e33(_0x365125);});}function updateChatInteraction(_0xc3a6d3,_0x26a40f,_0x1733e3){return new BPromise(function(_0x2f92f5,_0x2ca66b){return getInteractionUsers(_0xc3a6d3,_0x1733e3)[_0x32ef('0x22')](function(_0x596d5a){return getInteractionTags(_0x596d5a,_0x26a40f);})['then'](function(_0x399caa){_0x2f92f5(_0x399caa);})[_0x32ef('0x2c')](function(_0x2a33dd){_0x2ca66b(_0x2a33dd);});});}exports[_0x32ef('0x40')]=function(_0x5dca14,_0x2901a1){var _0x1f323a={},_0x5d2f06={},_0x4744ba={'count':0x0,'rows':[]};var _0x4bc5bc=_[_0x32ef('0x39')](db[_0x32ef('0x41')][_0x32ef('0x42')],function(_0x3be46d){return{'name':_0x3be46d[_0x32ef('0x43')],'type':_0x3be46d[_0x32ef('0x44')][_0x32ef('0x45')]};});_0x5d2f06[_0x32ef('0x46')]=_[_0x32ef('0x39')](_0x4bc5bc,_0x32ef('0x37'));_0x5d2f06['query']=_[_0x32ef('0x47')](_0x5dca14['query']);_0x5d2f06[_0x32ef('0x48')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x46')],_0x5d2f06['query']);_0x1f323a[_0x32ef('0x4a')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x46')],qs[_0x32ef('0x4b')](_0x5dca14[_0x32ef('0x4c')][_0x32ef('0x4b')]));_0x1f323a[_0x32ef('0x4a')]=_0x1f323a['attributes']['length']?_0x1f323a[_0x32ef('0x4a')]:_0x5d2f06[_0x32ef('0x46')];if(!_0x5dca14[_0x32ef('0x4c')][_0x32ef('0x4d')](_0x32ef('0x4e'))){_0x1f323a[_0x32ef('0x4f')]=qs[_0x32ef('0x4f')](_0x5dca14[_0x32ef('0x4c')][_0x32ef('0x4f')]);_0x1f323a[_0x32ef('0x31')]=qs[_0x32ef('0x31')](_0x5dca14[_0x32ef('0x4c')][_0x32ef('0x31')]);}_0x1f323a['order']=qs[_0x32ef('0x50')](_0x5dca14[_0x32ef('0x4c')][_0x32ef('0x50')]);_0x1f323a[_0x32ef('0x51')]=qs[_0x32ef('0x48')](_[_0x32ef('0x52')](_0x5dca14[_0x32ef('0x4c')],_0x5d2f06[_0x32ef('0x48')]),_0x4bc5bc);var _0x24d8b4=[];var _0x2a366b=squel[_0x32ef('0x53')]()[_0x32ef('0x54')]('id')[_0x32ef('0x54')](_0x32ef('0x37'))[_0x32ef('0x54')](_0x32ef('0x55'))[_0x32ef('0x56')](_0x32ef('0x57'));var _0x4e0d6b=squel['select']()[_0x32ef('0x54')](_0x32ef('0x58'))[_0x32ef('0x54')](_0x32ef('0x59'))[_0x32ef('0x54')](_0x32ef('0x5a'))[_0x32ef('0x56')](_0x32ef('0x5b'),'ui')[_0x32ef('0x5c')](_0x32ef('0x5d'),'u',_0x32ef('0x5e'));var _0x4a6fd2=squel[_0x32ef('0x53')]()[_0x32ef('0x56')](_0x32ef('0x5f'),'i')[_0x32ef('0x5c')](_0x32ef('0x60'),'c',_0x32ef('0x61'))['left_join'](_0x32ef('0x5d'),'o',_0x32ef('0x62'))[_0x32ef('0x5c')]('chat_websites','a',_0x32ef('0x63'))['left_join'](_0x32ef('0x64'),'me',_0x32ef('0x65'))['left_join'](_0x32ef('0x66'),'it','it.ChatInteractionId\x20=\x20i.id')[_0x32ef('0x5c')](_0x32ef('0x57'),'t',_0x32ef('0x67'));var _0x3a3513=squel[_0x32ef('0x68')]();var _0x30e377=[];var _0x42c7f4=squel['expr']();var _0x56cc75;if(_0x5dca14[_0x32ef('0x4c')]['search']){_0x56cc75=as['parseSearch'](_0x5dca14[_0x32ef('0x4c')][_0x32ef('0x69')]);var _0x2ef0f8=_0x56cc75[_0x32ef('0x6a')];for(var _0x2468e6=0x0;_0x2468e6<_0x56cc75[_0x32ef('0x6b')][_0x32ef('0x6c')];_0x2468e6++){var _0x4249c3=_0x56cc75[_0x32ef('0x6b')][_0x2468e6];var _0x123571='i';var _0x4c125c=_['find'](_0x4bc5bc,[_0x32ef('0x37'),_0x4249c3[_0x32ef('0x54')]]);if(!_0x4c125c){switch(_0x4249c3['field']){case _0x32ef('0x6d'):if(_0x4249c3[_0x32ef('0x6e')]==0x1){_0x4a6fd2[_0x32ef('0x6f')]('`'+_0x4249c3['field']+_0x32ef('0x70'));}else{_0x4a6fd2[_0x32ef('0x6f')]('`'+_0x4249c3[_0x32ef('0x54')]+'`\x20>\x200');}break;case'Contact':if(_0x4249c3[_0x32ef('0x71')]==='$substring'){if(_0x4249c3[_0x32ef('0x6e')]['split']('\x20')['length']>0x1){_0x3a3513[_0x2ef0f8](_0x32ef('0x72'),qs[_0x32ef('0x73')](_0x4249c3[_0x32ef('0x6e')]),null);}else{var _0x5dca6a='%'+_0x4249c3[_0x32ef('0x6e')]+'%';_0x3a3513[_0x2ef0f8](_0x32ef('0x74'),_0x5dca6a,_0x5dca6a,_0x5dca6a);}}else{_0x4c125c=_[_0x32ef('0x75')](_0x4bc5bc,['name',_0x32ef('0x76')]);_0x4249c3[_0x32ef('0x54')]='ContactId';_0x52b63b=as['buildExpression'](_0x123571,_0x4c125c[_0x32ef('0x44')],_0x4249c3);_0x3a3513[_0x2ef0f8](_0x52b63b[_0x32ef('0x77')],_0x52b63b[_0x32ef('0x6e')][_0x32ef('0x78')],_0x52b63b[_0x32ef('0x6e')][_0x32ef('0x2e')]);}break;case'Tag':var _0x285330=_0x4249c3[_0x32ef('0x6e')][_0x32ef('0x3d')](',')[_0x32ef('0x39')](function(_0x21e930){return Number(_0x21e930);});_0x285330[_0x32ef('0x3e')](function(_0x1dc755){_0x42c7f4['or'](_0x32ef('0x79'),'%,'+_0x1dc755+',%');});_0x30e377=_[_0x32ef('0x7a')](_0x30e377,_0x285330);break;case'User':if(_0x4249c3[_0x32ef('0x71')]===_0x32ef('0x7b')){_0x3a3513[_0x2ef0f8](_0x32ef('0x7c'),'%'+_0x4249c3[_0x32ef('0x6e')]+'%',null);}else{_0x4c125c=_[_0x32ef('0x75')](_0x4bc5bc,['name','UserId']);_0x4249c3[_0x32ef('0x54')]=_0x32ef('0x7d');_0x52b63b=as[_0x32ef('0x7e')](_0x123571,_0x4c125c[_0x32ef('0x44')],_0x4249c3);_0x3a3513[_0x2ef0f8](_0x52b63b[_0x32ef('0x77')],_0x52b63b['value'][_0x32ef('0x78')],_0x52b63b['value'][_0x32ef('0x2e')]);}break;case _0x32ef('0x7f'):_0x52b63b=as['buildExpression']('me',null,_0x4249c3);_0x3a3513[_0x2ef0f8](_0x52b63b['text'],_0x52b63b[_0x32ef('0x6e')][_0x32ef('0x78')],_0x52b63b[_0x32ef('0x6e')]['end']);break;}}else{var _0x52b63b=as[_0x32ef('0x7e')](_0x123571,_0x4c125c[_0x32ef('0x44')],_0x4249c3);_0x3a3513[_0x2ef0f8](_0x52b63b[_0x32ef('0x77')],_0x52b63b[_0x32ef('0x6e')]['start'],_0x52b63b[_0x32ef('0x6e')][_0x32ef('0x2e')]);}}}else{var _0x974974=_(_0x5dca14[_0x32ef('0x4c')])[_0x32ef('0x47')]()[_0x32ef('0x39')](function(_0x43b176){return _[_0x32ef('0x80')](_0x4bc5bc,[_0x32ef('0x37'),_0x43b176])?_0x43b176:undefined;})[_0x32ef('0x81')]()[_0x32ef('0x6e')]();if(!_[_0x32ef('0x82')](_0x974974)){_0x974974['forEach'](function(_0x4ab179){if(_0x4ab179===_0x32ef('0x83')){_0x4a6fd2[_0x32ef('0x51')]('i.ChatWebsiteId\x20IN\x20?',[][_0x32ef('0x84')](_0x5dca14['query'][_0x4ab179]));}else if(_0x4ab179===_0x32ef('0x85')){var _0x33845d=JSON[_0x32ef('0x86')](_0x5dca14['query'][_0x4ab179])[_0x32ef('0x87')];var _0x4978a6=JSON[_0x32ef('0x86')](_0x5dca14[_0x32ef('0x4c')][_0x4ab179])['$lte'];_0x4a6fd2['where'](_0x32ef('0x88'),_0x33845d,_0x4978a6);}else{if(_0x5dca14['query'][_0x4ab179]===_0x32ef('0x89')){_0x4a6fd2['where']('i.'+_0x4ab179+_0x32ef('0x8a'));}else{_0x4a6fd2[_0x32ef('0x51')]('i.'+_0x4ab179+_0x32ef('0x8b'),_0x5dca14['query'][_0x4ab179]);}}});}if(_0x5dca14['query']['read']){if(_0x5dca14[_0x32ef('0x4c')]['read']==0x1){_0x4a6fd2[_0x32ef('0x6f')](_0x32ef('0x8c'));}else{_0x4a6fd2[_0x32ef('0x6f')](_0x32ef('0x8d'));}}if(_0x5dca14[_0x32ef('0x4c')][_0x32ef('0x8e')]){_0x30e377=_['isArray'](_0x5dca14[_0x32ef('0x4c')]['tag'])?_0x5dca14['query'][_0x32ef('0x8e')]:new Array(_0x5dca14['query'][_0x32ef('0x8e')]);_0x30e377[_0x32ef('0x3e')](function(_0x4d64ec){_0x42c7f4['or'](_0x32ef('0x79'),'%,'+_0x4d64ec+',%');});}if(_0x5dca14[_0x32ef('0x4c')][_0x32ef('0x8f')]){var _0x4712dc=_0x5dca14[_0x32ef('0x4c')][_0x32ef('0x8f')]['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x32ef('0x90'));if(qs['isNumeric'](_0x4712dc)){_0x3a3513['or'](_0x32ef('0x91'),_0x4712dc+'%');}else{_0x3a3513['or'](_0x32ef('0x92'),qs[_0x32ef('0x73')](_0x4712dc))['or'](_0x32ef('0x93'),_0x4712dc+'%');}}}_0x4a6fd2[_0x32ef('0x51')](_0x3a3513);_0x4a6fd2[_0x32ef('0x94')]('i.id');var _0x3232ca={'type':db[_0x32ef('0x20')][_0x32ef('0x95')][_0x32ef('0x96')],'raw':!![]};var _0x2eda01=_0x4a6fd2['clone']();_0x2eda01['field'](_0x32ef('0x97'));_0x2eda01[_0x32ef('0x54')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x32ef('0x6d'));if(_0x1f323a[_0x32ef('0x98')]){_0x1f323a[_0x32ef('0x98')][_0x32ef('0x3e')](function(_0xc3664d){_0x4a6fd2[_0x32ef('0x98')]('i.'+_0xc3664d[0x0],_0xc3664d[0x1]===_0x32ef('0x99')?![]:!![]);});}if(!_[_0x32ef('0x82')](_0x30e377)){_0x4a6fd2[_0x32ef('0x6f')](_0x42c7f4);_0x2eda01['where'](_0x32ef('0x9a'),_0x30e377);}BPromise[_0x32ef('0x9b')]()['then'](function(){if(!_0x56cc75){if(_0x5dca14[_0x32ef('0x4c')]['ChatWebsiteId']||_0x5dca14[_0x32ef('0x4c')]['journey'])return;_0x2eda01[_0x32ef('0x51')](_0x32ef('0x9c'));_0x4a6fd2[_0x32ef('0x51')](_0x32ef('0x9c'));return;}return _0x5dca14['user'][_0x32ef('0x9d')]({'attributes':['id'],'raw':!![]})[_0x32ef('0x22')](function(_0x31f99f){if(_['isEmpty'](_0x31f99f)){_0x2eda01['where']('i.ChatWebsiteId\x20IS\x20NULL');_0x4a6fd2[_0x32ef('0x51')](_0x32ef('0x9e'));}else{_0x2eda01[_0x32ef('0x51')](_0x32ef('0x9f'),_[_0x32ef('0x39')](_0x31f99f,'id'));_0x4a6fd2['where'](_0x32ef('0x9f'),_['map'](_0x31f99f,'id'));}});})[_0x32ef('0x22')](function(){db[_0x32ef('0xa0')][_0x32ef('0x4c')](_0x2eda01['toString'](),_0x3232ca)[_0x32ef('0x22')](function(_0x42d2d4){_0x4744ba[_0x32ef('0x30')]=_0x42d2d4[_0x32ef('0x6c')];if(_0x4744ba[_0x32ef('0x30')]===0x0)return[];return db['sequelize'][_0x32ef('0x4c')](_0x2a366b['toString'](),_0x3232ca)[_0x32ef('0x22')](function(_0x42a57f){_0x24d8b4=_['keyBy'](_0x42a57f,'id');_0x3232ca=_['merge'](_0x3232ca,{'model':db[_0x32ef('0x41')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5dca14[_0x32ef('0x4c')][_0x32ef('0x4b')]){_0x1f323a[_0x32ef('0x4a')]['forEach'](function(_0x356fd4){_0x4a6fd2['field']('i.'+_0x356fd4);});}else{_0x4a6fd2['field'](_0x32ef('0xa1'),'unreadMessages');_0x4a6fd2[_0x32ef('0x54')](_0x32ef('0xa2'),_0x32ef('0xa3'));_0x4a6fd2['field']('a.mandatoryDisposition',_0x32ef('0xa4'));_0x4a6fd2[_0x32ef('0x54')](_0x32ef('0xa5'));_0x4a6fd2[_0x32ef('0x54')](_0x32ef('0xa6'),_0x32ef('0xa7'));_0x4a6fd2[_0x32ef('0x54')]('c.lastName',_0x32ef('0xa8'));_0x4a6fd2[_0x32ef('0x54')](_0x32ef('0xa9'),_0x32ef('0xaa'));_0x4a6fd2['field']('c.phone',_0x32ef('0xab'));_0x4a6fd2['field'](_0x32ef('0xac'),_0x32ef('0xad'));_0x4a6fd2['field']('c.fax','Contact.fax');_0x4a6fd2[_0x32ef('0x54')](_0x32ef('0xae'),_0x32ef('0xaf'));_0x4a6fd2[_0x32ef('0x54')]('o.internal',_0x32ef('0xb0'));_0x4a6fd2[_0x32ef('0x54')](_0x32ef('0xb1'),'TagIds');}if(_0x1f323a[_0x32ef('0x4f')])_0x4a6fd2['limit'](_0x1f323a[_0x32ef('0x4f')]);if(_0x1f323a[_0x32ef('0x31')])_0x4a6fd2['offset'](_0x1f323a['offset']);return db[_0x32ef('0xa0')][_0x32ef('0x4c')](_0x4a6fd2[_0x32ef('0xb2')](),_0x3232ca);})[_0x32ef('0x22')](function(_0xa58937){_0x4e0d6b[_0x32ef('0x51')](_0x32ef('0xb3'),_[_0x32ef('0x39')](_0xa58937,'id'));return db[_0x32ef('0xa0')]['query'](_0x4e0d6b[_0x32ef('0xb2')](),_0x3232ca)['then'](function(_0x22d657){var _0x7e47b9=_[_0x32ef('0xb4')](_0x22d657,_0x32ef('0xb5'));var _0x102f2f=[];_0xa58937['forEach'](function(_0x3ef09c){_0x102f2f[_0x32ef('0x3f')](updateChatInteraction(_0x3ef09c,_0x24d8b4,_0x7e47b9));});return BPromise[_0x32ef('0xb6')](_0x102f2f);});});})[_0x32ef('0x22')](function(_0x1db74d){_0x4744ba[_0x32ef('0xb7')]=_0x1db74d;return _0x4744ba;})[_0x32ef('0x22')](respondWithFilteredResult(_0x2901a1,_0x1f323a));})[_0x32ef('0x2c')](handleError(_0x2901a1,null));};exports[_0x32ef('0xb8')]=function(_0x59602f,_0x53dc9b){var _0x4fb09e={'raw':![],'where':{'id':_0x59602f[_0x32ef('0xb9')]['id']}},_0x2e01fa={};_0x2e01fa['model']=_[_0x32ef('0x47')](db['ChatInteraction'][_0x32ef('0x42')]);_0x2e01fa['query']=_['keys'](_0x59602f[_0x32ef('0x4c')]);_0x2e01fa[_0x32ef('0x48')]=_[_0x32ef('0x49')](_0x2e01fa[_0x32ef('0x46')],_0x2e01fa[_0x32ef('0x4c')]);_0x4fb09e['attributes']=_[_0x32ef('0x49')](_0x2e01fa['model'],qs[_0x32ef('0x4b')](_0x59602f['query']['fields']));_0x4fb09e['attributes']=_0x4fb09e['attributes']['length']?_0x4fb09e[_0x32ef('0x4a')]:_0x2e01fa[_0x32ef('0x46')];if(_0x59602f['query'][_0x32ef('0xba')]){_0x4fb09e[_0x32ef('0xbb')]=[{'all':!![]}];}_0x4fb09e=_[_0x32ef('0xbc')]({},_0x4fb09e,_0x59602f[_0x32ef('0xbd')]);return db[_0x32ef('0x41')][_0x32ef('0x75')](_0x4fb09e)['then'](handleEntityNotFound(_0x53dc9b,null))[_0x32ef('0x22')](respondWithResult(_0x53dc9b,null))['catch'](handleError(_0x53dc9b,null));};exports[_0x32ef('0xbe')]=function(_0x1be713,_0x536b3d){return db[_0x32ef('0x41')]['create'](_0x1be713[_0x32ef('0x7f')],{})[_0x32ef('0x22')](respondWithResult(_0x536b3d,0xc9))[_0x32ef('0x2c')](handleError(_0x536b3d,null));};exports[_0x32ef('0x34')]=function(_0x586ab4,_0x145fe3){if(_0x586ab4[_0x32ef('0x7f')]['id']){delete _0x586ab4[_0x32ef('0x7f')]['id'];}return db[_0x32ef('0x41')]['find']({'where':{'id':_0x586ab4[_0x32ef('0xb9')]['id']}})['then'](handleEntityNotFound(_0x145fe3,null))[_0x32ef('0x22')](saveUpdates(_0x586ab4[_0x32ef('0x7f')],null))[_0x32ef('0x22')](respondWithResult(_0x145fe3,null))[_0x32ef('0x2c')](handleError(_0x145fe3,null));};exports[_0x32ef('0xbf')]=function(_0x31481c,_0x5e2516){return db[_0x32ef('0x41')]['find']({'where':{'id':_0x31481c['params']['id']}})[_0x32ef('0x22')](handleEntityNotFound(_0x5e2516,null))[_0x32ef('0x22')](removeEntity(_0x5e2516,null))[_0x32ef('0x2c')](handleError(_0x5e2516,null));};exports[_0x32ef('0xc0')]=function(_0x4dd1f0,_0x8d3b24){return db[_0x32ef('0x41')][_0x32ef('0xc0')]()[_0x32ef('0x22')](respondWithResult(_0x8d3b24,null))['catch'](handleError(_0x8d3b24,null));};exports['createVidaooSession']=function(_0x4ed0c9,_0x9a5c92){var _0x7811a6=_0x4ed0c9[_0x32ef('0xb9')]['id'];var _0xc92dcc;var _0x3d18b9;var _0x9233cb;return db[_0x32ef('0x41')][_0x32ef('0xc1')]({'where':{'id':_0x7811a6}})[_0x32ef('0x22')](function(_0x2b0b07){_0xc92dcc=_0x2b0b07;return db[_0x32ef('0xc2')]['findOne']({'where':{'id':_0x2b0b07[_0x32ef('0x83')]},'attributes':['id',_0x32ef('0xc3'),_0x32ef('0xc4')],'raw':!![]});})[_0x32ef('0x22')](function(_0x766edf){if(_0x766edf&&_0x766edf[_0x32ef('0xc3')]&&_0x766edf['vidaooEscalation']){_0x3d18b9=_0x766edf;var _0x35edf1={'rejectUnauthorized':![],'method':_0x32ef('0xc5'),'uri':_0x32ef('0xc6'),'headers':{'X-APIKEY':_0x766edf[_0x32ef('0xc3')]},'body':{'name':_0x32ef('0xc7')+_0x7811a6},'redirect':_0x32ef('0xc8'),'json':!![]};return rp(_0x35edf1);}else{throw new db[(_0x32ef('0x20'))][(_0x32ef('0xc9'))](_0x32ef('0xca'));}})[_0x32ef('0x22')](function(_0x439146){_0x9233cb=_0x439146;if(_0x9233cb['id']){var _0x1bb4b2={'body':_0x9233cb[_0x32ef('0xcb')],'ChatWebsiteId':_0x3d18b9['id'],'ChatInteractionId':_0xc92dcc['id'],'direction':_0x32ef('0xcc'),'UserId':_0x4ed0c9['user']['id']};return db[_0x32ef('0xcd')][_0x32ef('0xbe')](_0x1bb4b2,{});}else{throw new db[(_0x32ef('0x20'))]['ValidationError'](_0x32ef('0xce'));}})['then'](function(){return _0xc92dcc[_0x32ef('0xcf')]({'vidaooSessionId':_0x9233cb['id']});})[_0x32ef('0x22')](respondWithResult(_0x9a5c92,null))[_0x32ef('0x2c')](handleError(_0x9a5c92,null));};exports['customUpdate']=function(_0x27aff9,_0x4c2d6f){if(_0x27aff9[_0x32ef('0x7f')]['id']){delete _0x27aff9[_0x32ef('0x7f')]['id'];}return db['ChatInteraction'][_0x32ef('0x75')]({'where':{'id':_0x27aff9[_0x32ef('0xb9')]['id']}})[_0x32ef('0x22')](handleEntityNotFound(_0x4c2d6f,null))[_0x32ef('0x22')](saveUpdates(_0x27aff9[_0x32ef('0x7f')],null))[_0x32ef('0x22')](respondWithResult(_0x4c2d6f,null))[_0x32ef('0x2c')](handleError(_0x4c2d6f,null));};exports['abandon']=function(_0x493ae9,_0x143d39,_0x497948){if(_0x493ae9[_0x32ef('0x7f')]['id']){delete _0x493ae9[_0x32ef('0x7f')]['id'];}return db['ChatInteraction'][_0x32ef('0x75')]({'where':{'id':_0x493ae9[_0x32ef('0xb9')]['id']}})['then'](function(_0x1200c9){if(!_0x1200c9){logger[_0x32ef('0x28')](_0x32ef('0xd0'),_0x32ef('0xd1'),0x194,_0x32ef('0xd2'));_0x143d39['sendStatus'](0x194);}else{if(_0x1200c9[_0x32ef('0x7d')]){throw new db[(_0x32ef('0x20'))]['ValidationError'](_0x32ef('0xd3'));}}return _0x1200c9;})[_0x32ef('0x22')](function(_0x55ad11){if(_0x55ad11){return _0x55ad11[_0x32ef('0x34')]({'closed':_0x493ae9[_0x32ef('0x7f')]['closed'],'disposition':_0x493ae9[_0x32ef('0x7f')][_0x32ef('0xd4')]})['then'](function(_0xb41a01){return _0xb41a01;});}})[_0x32ef('0x22')](function(_0x66718b){return respondWithRpcPromise(_0x32ef('0xd5'),_0x32ef('0xd1'),_0x493ae9[_0x32ef('0x7f')],client9004);})[_0x32ef('0x22')](respondWithResult(_0x143d39,null))['catch'](handleError(_0x143d39,null));};exports['attachmentUpload']=function(_0x18c29b,_0x41c38d,_0x32a533){_0x18c29b['body'][_0x32ef('0x37')]=_0x18c29b[_0x32ef('0xd6')]['originalname'];_0x18c29b[_0x32ef('0x7f')][_0x32ef('0xd7')]=_0x18c29b['file']['filename'];_0x18c29b[_0x32ef('0x7f')][_0x32ef('0x44')]=_0x18c29b[_0x32ef('0xd6')]['mimetype'];return db['Attachment']['create'](_0x18c29b[_0x32ef('0x7f')])[_0x32ef('0x22')](respondWithResult(_0x41c38d,0xc9))[_0x32ef('0x2c')](handleError(_0x41c38d,null));};exports['attachmentDownload']=function(_0x3c13f1,_0x223287,_0x30596b){return db['ChatInteraction'][_0x32ef('0xc1')]({'where':{'id':_0x3c13f1[_0x32ef('0xb9')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x223287,null))['then'](function(_0x46f599){if(_0x46f599){if(_0x46f599['closed']){return _0x223287[_0x32ef('0x2d')](0x193)[_0x32ef('0x2f')]({'status':0x193,'message':'Unauthorized'});}return db['Attachment'][_0x32ef('0xc1')]({'where':{'id':_0x3c13f1['query'][_0x32ef('0xd8')]},'raw':!![]})[_0x32ef('0x22')](handleEntityNotFound(_0x223287,null));}})[_0x32ef('0x22')](function(_0x193bb5){if(_0x193bb5){return _0x223287[_0x32ef('0xd9')](path[_0x32ef('0xda')](config[_0x32ef('0xdb')],_0x32ef('0xdc'),_0x193bb5[_0x32ef('0xd7')]));}})[_0x32ef('0x2c')](handleError(_0x223287,null));};exports['close']=function(_0x49fdd7,_0x1e8096){var _0x27a2f3=null;var _0x1ebebc=null;var _0x199880=null;var _0x28da62=null;if(_0x49fdd7[_0x32ef('0x7f')]['id']){delete _0x49fdd7[_0x32ef('0x7f')]['id'];}if(_0x49fdd7[_0x32ef('0x7f')][_0x32ef('0xdd')]){_0x28da62=path[_0x32ef('0xda')](config['root'],_0x32ef('0xde'),util[_0x32ef('0xdf')](_0x32ef('0xe0'),Date[_0x32ef('0xe1')]()));_0x49fdd7[_0x32ef('0x7f')][_0x32ef('0xe2')]=_0x28da62;}return db[_0x32ef('0x41')][_0x32ef('0x75')]({'where':{'id':_0x49fdd7[_0x32ef('0xb9')]['id']},'include':[{'model':db[_0x32ef('0xcd')],'as':_0x32ef('0xe3'),'include':[{'model':db[_0x32ef('0xe4')],'as':_0x32ef('0xe4')}]}]})['then'](handleEntityNotFound(_0x1e8096,null))[_0x32ef('0x22')](saveUpdates(_0x49fdd7[_0x32ef('0x7f')],null))[_0x32ef('0x22')](function(_0x245289){if(_0x245289){_0x27a2f3=_0x245289;return db[_0x32ef('0xc2')][_0x32ef('0x75')]({'where':{'id':_0x27a2f3[_0x32ef('0x83')]}});}})[_0x32ef('0x22')](function(_0xa734b){if(_0xa734b){_0x199880=_0xa734b;return db[_0x32ef('0xe5')]['find']({'where':{'id':_0x27a2f3[_0x32ef('0x76')]}});}})[_0x32ef('0x22')](function(_0x176d96){if(_0x176d96){_0x1ebebc=_0x176d96;if(_0x28da62){var _0x3b56e7=null;for(var _0x5176d3=0x1;_0x5176d3<_0x27a2f3[_0x32ef('0xe3')][_0x32ef('0x6c')];++_0x5176d3){_0x3b56e7=_0x27a2f3['Messages'][_0x5176d3];var _0x4da679=_0x3b56e7['UserId']?util[_0x32ef('0xdf')](_0x32ef('0xe6'),_0x199880[_0x32ef('0xe7')],_0x3b56e7[_0x32ef('0x7d')]):'System';var _0x5f2996=_0x49fdd7[_0x32ef('0x7f')]['customer']||util['format'](_0x32ef('0xe6'),_0x32ef('0xe8'),_0x3b56e7[_0x32ef('0x76')]);switch(_0x199880['agentIdentifier']){case'website_alias':_0x4da679=_0x3b56e7['UserId']?util[_0x32ef('0xdf')](_0x32ef('0xe6'),_0x199880[_0x32ef('0xe7')],_0x3b56e7[_0x32ef('0x7d')]):_0x32ef('0xe9');break;case _0x32ef('0xea'):_0x4da679=_0x3b56e7[_0x32ef('0x7d')]?_0x3b56e7[_0x32ef('0xe4')][_0x32ef('0xeb')]||_0x3b56e7['User']['fullname']:'System';break;case _0x32ef('0xec'):_0x4da679=_0x3b56e7[_0x32ef('0x7d')]?_0x3b56e7['User']['fullname']:_0x32ef('0xe9');break;default:_0x4da679=_0x3b56e7['UserId']?util[_0x32ef('0xdf')](_0x32ef('0xe6'),_0x199880[_0x32ef('0xe7')],_0x3b56e7[_0x32ef('0x7d')]):'System';}var _0xa6f073=util[_0x32ef('0xdf')](_0x32ef('0xed'),moment(_0x3b56e7[_0x32ef('0x85')])['format'](_0x32ef('0xee')),_0x3b56e7[_0x32ef('0xef')]==='in'?_0x5f2996:_0x4da679,_0x3b56e7['body']);if(!_0x3b56e7['secret']){fs[_0x32ef('0xf0')](_0x28da62,_0xa6f073);}}return db[_0x32ef('0xf1')][_0x32ef('0xc1')]({'where':{'service':!![]},'include':[{'model':db[_0x32ef('0xf2')],'as':_0x32ef('0xf3'),'raw':!![]}]});}}})[_0x32ef('0x22')](function(_0xbe674c){if(_0xbe674c&&_0xbe674c['Smtp']&&_0x49fdd7[_0x32ef('0x7f')]){var _0x326729={'tls':{'rejectUnauthorized':![]}};if(_0xbe674c[_0x32ef('0xf3')][_0x32ef('0xf4')]){_0x326729['service']=_0xbe674c['Smtp'][_0x32ef('0xf4')];}else{_0x326729['host']=_0xbe674c[_0x32ef('0xf3')][_0x32ef('0xf5')];_0x326729[_0x32ef('0xf6')]=_0xbe674c[_0x32ef('0xf3')][_0x32ef('0xf6')];_0x326729[_0x32ef('0xf7')]=_0xbe674c[_0x32ef('0xf3')][_0x32ef('0xf7')];}if(_0xbe674c['Smtp'][_0x32ef('0xf8')]){_0x326729['auth']={'user':_0xbe674c[_0x32ef('0xf3')]['user'],'pass':_0xbe674c['Smtp']['pass']};}return respondWithRpcPromise(_0x32ef('0xf9'),'sendMail',{'account':_0x326729,'message':{'from':util[_0x32ef('0xdf')]('\x22%s\x22\x20<%s>',_0xbe674c[_0x32ef('0x37')],_0xbe674c['email']||_0xbe674c[_0x32ef('0xf3')][_0x32ef('0xfa')]),'to':_0x49fdd7['body'][_0x32ef('0xdd')],'subject':'Mail\x20Transcript','text':util[_0x32ef('0xdf')](_0x32ef('0xfb'),_0x49fdd7[_0x32ef('0x7f')][_0x32ef('0xdd')]),'attachments':[{'path':_0x28da62}]}})[_0x32ef('0x22')](function(){return _0x27a2f3;})['catch'](function(_0x4340fd){console[_0x32ef('0x28')](_0x4340fd);});}else{return _0x27a2f3;}})[_0x32ef('0x22')](respondWithStatusCode(_0x1e8096,0xc8))[_0x32ef('0x2c')](handleError(_0x1e8096,null));};exports[_0x32ef('0xfc')]=function(_0x35aa0a,_0x14c3c4,_0x4255f5){return db['ChatMessage'][_0x32ef('0x75')]({'where':{'id':_0x35aa0a['params']['id']}})[_0x32ef('0x22')](handleEntityNotFound(_0x14c3c4,null))[_0x32ef('0x22')](function(_0x2c5250){if(_0x2c5250){return _0x2c5250['addMessage'](_0x35aa0a['body'][_0x32ef('0xfd')],_[_0x32ef('0xfe')](_0x35aa0a[_0x32ef('0x7f')],[_0x32ef('0xfd'),'id'])||{});}})[_0x32ef('0x22')](respondWithResult(_0x14c3c4,null))[_0x32ef('0x2c')](handleError(_0x14c3c4,null));};exports[_0x32ef('0xff')]=function(_0xa7f0b3,_0x73a49e,_0x156348){var _0x169a8e={'raw':![],'where':{}};var _0x4d0170={};var _0x153792={'count':0x0,'rows':[]};return db[_0x32ef('0x41')][_0x32ef('0xc1')]({'where':{'id':_0xa7f0b3[_0x32ef('0xb9')]['id']}})[_0x32ef('0x22')](handleEntityNotFound(_0x73a49e,null))[_0x32ef('0x22')](function(_0x2c5417){if(_0x2c5417){_0x4d0170[_0x32ef('0x46')]=_[_0x32ef('0x47')](db[_0x32ef('0xcd')]['rawAttributes']);_0x4d0170[_0x32ef('0x4c')]=_[_0x32ef('0x47')](_0xa7f0b3[_0x32ef('0x4c')]);_0x4d0170[_0x32ef('0x48')]=_[_0x32ef('0x49')](_0x4d0170['model'],_0x4d0170[_0x32ef('0x4c')]);_0x169a8e[_0x32ef('0x4a')]=_[_0x32ef('0x49')](_0x4d0170['model'],qs['fields'](_0xa7f0b3[_0x32ef('0x4c')]['fields']));_0x169a8e[_0x32ef('0x4a')]=_0x169a8e['attributes'][_0x32ef('0x6c')]?_0x169a8e[_0x32ef('0x4a')]:_0x4d0170[_0x32ef('0x46')];if(!_0xa7f0b3[_0x32ef('0x4c')][_0x32ef('0x4d')]('nolimit')){_0x169a8e[_0x32ef('0x4f')]=qs['limit'](_0xa7f0b3['query']['limit']);_0x169a8e[_0x32ef('0x31')]=qs[_0x32ef('0x31')](_0xa7f0b3[_0x32ef('0x4c')][_0x32ef('0x31')]);}_0x169a8e[_0x32ef('0x98')]=qs['sort'](_0xa7f0b3[_0x32ef('0x4c')]['sort']);_0x169a8e[_0x32ef('0x51')]=qs[_0x32ef('0x48')](_[_0x32ef('0x52')](_0xa7f0b3[_0x32ef('0x4c')],_0x4d0170['filters']));_0x169a8e['where'][_0x32ef('0xb5')]=_0x2c5417['id'];if(_0xa7f0b3[_0x32ef('0x4c')][_0x32ef('0x8f')]){_0x169a8e[_0x32ef('0x51')]=_[_0x32ef('0xbc')](_0x169a8e['where'],{'$or':_['map'](_0x169a8e[_0x32ef('0x4a')],function(_0x4b6c94){var _0x485bf8={};_0x485bf8[_0x4b6c94]={'$like':'%'+_0xa7f0b3[_0x32ef('0x4c')][_0x32ef('0x8f')]+'%'};return _0x485bf8;})});}if(_0xa7f0b3[_0x32ef('0x4c')][_0x32ef('0x87')]){var _0x5ef66d=_0xa7f0b3[_0x32ef('0x4c')][_0x32ef('0x87')]['split'](',');var _0x50fd30={};_0x50fd30[_0x5ef66d[0x0]]={'$gte':moment(_0x5ef66d[0x1])['format'](_0x32ef('0x100'))};_0x169a8e['where']=_[_0x32ef('0xbc')](_0x169a8e['where'],_0x50fd30);}_0x169a8e=_[_0x32ef('0xbc')]({},_0x169a8e,_0xa7f0b3[_0x32ef('0xbd')]);return db[_0x32ef('0xcd')][_0x32ef('0x30')]({'where':_0x169a8e[_0x32ef('0x51')]})[_0x32ef('0x22')](function(_0x950bc1){_0x153792[_0x32ef('0x30')]=_0x950bc1;if(_0xa7f0b3['query'][_0x32ef('0xba')]){_0x169a8e['include']=[{'all':!![]}];}return db[_0x32ef('0xcd')][_0x32ef('0x101')](_0x169a8e);})[_0x32ef('0x22')](function(_0x49129a){_0x153792[_0x32ef('0xb7')]=_0x49129a;return _0x153792;});}})[_0x32ef('0x22')](respondWithFilteredResult(_0x73a49e,_0x169a8e))[_0x32ef('0x2c')](handleError(_0x73a49e,null));};exports[_0x32ef('0x102')]=function(_0x4d7f2c,_0x17ba0f,_0x463610){var _0x27e130={'where':{}},_0x3d8fc7={},_0x1f6691={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x32ef('0xc1')]({'where':{'id':_0x4d7f2c[_0x32ef('0xb9')]['id']}})[_0x32ef('0x22')](handleEntityNotFound(_0x17ba0f,null))[_0x32ef('0x22')](function(_0x4ac273){if(_0x4ac273){_0x3d8fc7[_0x32ef('0x46')]=_['keys'](db[_0x32ef('0xcd')][_0x32ef('0x42')]);_0x3d8fc7['query']=_[_0x32ef('0x47')](_0x4d7f2c[_0x32ef('0x4c')]);_0x3d8fc7[_0x32ef('0x48')]=_[_0x32ef('0x49')](_0x3d8fc7[_0x32ef('0x46')],_0x3d8fc7[_0x32ef('0x4c')]);_0x27e130[_0x32ef('0x4a')]=_['intersection'](_0x3d8fc7[_0x32ef('0x46')],qs[_0x32ef('0x4b')](_0x4d7f2c['query'][_0x32ef('0x4b')]));_0x27e130['attributes']=_0x27e130['attributes']['length']?_0x27e130[_0x32ef('0x4a')]:_0x3d8fc7[_0x32ef('0x46')];if(!_0x4d7f2c[_0x32ef('0x4c')][_0x32ef('0x4d')](_0x32ef('0x4e'))){_0x27e130[_0x32ef('0x4f')]=qs[_0x32ef('0x4f')](_0x4d7f2c[_0x32ef('0x4c')][_0x32ef('0x4f')]);_0x27e130[_0x32ef('0x31')]=qs['offset'](_0x4d7f2c['query'][_0x32ef('0x31')]);}_0x27e130['order']=qs[_0x32ef('0x50')](_0x4d7f2c[_0x32ef('0x4c')]['sort']);_0x27e130['where']=qs[_0x32ef('0x48')](_['pick'](_0x4d7f2c[_0x32ef('0x4c')],_0x3d8fc7['filters']));_0x27e130[_0x32ef('0x51')][_0x32ef('0xb5')]=_0x4ac273['id'];if(_0x4d7f2c['query'][_0x32ef('0x8f')]){_0x27e130[_0x32ef('0x51')]=_[_0x32ef('0xbc')](_0x27e130['where'],{'$or':_[_0x32ef('0x39')](_0x27e130[_0x32ef('0x4a')],function(_0x485648){var _0x1ea426={};_0x1ea426[_0x485648]={'$like':'%'+_0x4d7f2c[_0x32ef('0x4c')][_0x32ef('0x8f')]+'%'};return _0x1ea426;})});}_0x27e130[_0x32ef('0x51')]['secret']=![];if(_0x4d7f2c['query']['id']){_0x27e130[_0x32ef('0x51')]['id']={'$gt':_0x4d7f2c[_0x32ef('0x4c')]['id']};}_0x27e130=_[_0x32ef('0xbc')]({},_0x27e130,_0x4d7f2c['options']);return db[_0x32ef('0xcd')][_0x32ef('0x30')]({'where':_0x27e130[_0x32ef('0x51')]})['then'](function(_0x1bc00e){_0x1f6691[_0x32ef('0x30')]=_0x1bc00e;_0x27e130[_0x32ef('0xbb')]=[];if(_0x4d7f2c[_0x32ef('0x4c')]['includeAgent']){_0x27e130[_0x32ef('0xbb')][_0x32ef('0x3f')]({'model':db[_0x32ef('0xe4')],'as':_0x32ef('0xe4'),'attributes':['id',_0x32ef('0x3a'),'alias']});}if(_0x4d7f2c[_0x32ef('0x4c')][_0x32ef('0xba')]){_0x27e130['include']=[{'all':!![]}];}return db[_0x32ef('0xcd')][_0x32ef('0x101')](_0x27e130);})[_0x32ef('0x22')](function(_0x89401f){_0x1f6691[_0x32ef('0xb7')]=_0x89401f;return _0x1f6691;});}})[_0x32ef('0x22')](respondWithFilteredResult(_0x17ba0f,_0x27e130))[_0x32ef('0x2c')](handleError(_0x17ba0f,null));};exports[_0x32ef('0x103')]=function(_0x466890,_0x17c36d,_0x3b7d43){return db[_0x32ef('0x41')][_0x32ef('0x75')]({'where':{'id':_0x466890[_0x32ef('0xb9')]['id']}})[_0x32ef('0x22')](handleEntityNotFound(_0x17c36d,null))[_0x32ef('0x22')](function(_0x44eeb5){if(_0x44eeb5){return _0x44eeb5[_0x32ef('0x104')](_0x466890[_0x32ef('0x7f')]['ids'],_['omit'](_0x466890[_0x32ef('0x7f')],[_0x32ef('0xfd'),'id'])||{})[_0x32ef('0x105')](function(){return db[_0x32ef('0x106')][_0x32ef('0x101')]({'attributes':['id',_0x32ef('0x37'),'color'],'where':{'id':_0x466890['body'][_0x32ef('0xfd')]}});})['then'](function(_0x2f7c05){socket[_0x32ef('0x107')](_0x32ef('0x108'),{'id':Number(_0x466890['params']['id']),'tags':_0x2f7c05||[]});return{'id':Number(_0x466890[_0x32ef('0xb9')]['id']),'tags':_0x2f7c05||[]};});}})[_0x32ef('0x22')](respondWithResult(_0x17c36d,null))[_0x32ef('0x2c')](handleError(_0x17c36d,null));};exports['removeTags']=function(_0x1dd122,_0x54f1f4,_0x3702b){return db[_0x32ef('0x41')]['find']({'where':{'id':_0x1dd122['params']['id']}})[_0x32ef('0x22')](handleEntityNotFound(_0x54f1f4,null))[_0x32ef('0x22')](function(_0x5c1de4){if(_0x5c1de4){return _0x5c1de4[_0x32ef('0x109')](_0x1dd122['query'][_0x32ef('0xfd')]);}})['then'](respondWithStatusCode(_0x54f1f4,null))[_0x32ef('0x2c')](handleError(_0x54f1f4,null));};exports['download']=function(_0x311be3,_0x382aed){var _0xb60be2=moment()['unix']()[_0x32ef('0xb2')]();var _0x4b3c9d=path[_0x32ef('0xda')](config['root'],_0x32ef('0x10a'),'files',_0x32ef('0x10b'));var _0x46bf2b=path['join'](config[_0x32ef('0xdb')],'server',_0x32ef('0x10c'),_0x32ef('0x10d'));var _0x1902ed=path[_0x32ef('0xda')](_0x4b3c9d,_0xb60be2);var _0x742a55=util[_0x32ef('0xdf')](_0x32ef('0x10e'),_0x311be3['params']['id'],_0xb60be2);var _0x42b669=path['join'](_0x4b3c9d,_0x742a55);var _0x47a574=[];_0x47a574[_0x32ef('0x3f')]({'model':db[_0x32ef('0xe4')],'as':_0x32ef('0xe4'),'attributes':['id',_0x32ef('0x3a')],'raw':!![]});_0x47a574[_0x32ef('0x3f')]({'model':db['CmContact'],'as':_0x32ef('0x10f'),'attributes':['id',_0x32ef('0x110'),_0x32ef('0x111')],'raw':!![]});if(_0x311be3[_0x32ef('0x4c')][_0x32ef('0x10d')]){_0x47a574[_0x32ef('0x3f')]({'model':db[_0x32ef('0x112')],'as':_0x32ef('0x112'),'raw':!![]});}var _0x2e08d0=[{'model':db[_0x32ef('0xcd')],'as':_0x32ef('0xe3'),'attributes':['id',_0x32ef('0x7f'),_0x32ef('0x85'),_0x32ef('0xef'),_0x32ef('0x113'),_0x32ef('0x114')],'include':_0x47a574}];_0x2e08d0[_0x32ef('0x3f')]({'model':db[_0x32ef('0xc2')],'as':_0x32ef('0x115'),'attributes':['id','name']});_0x2e08d0[_0x32ef('0x3f')]({'model':db[_0x32ef('0xe4')],'as':_0x32ef('0x116'),'attributes':['id',_0x32ef('0x3a')]});return db[_0x32ef('0x41')]['find']({'where':{'id':_0x311be3['params']['id']},'include':_0x2e08d0})[_0x32ef('0x22')](handleEntityNotFound(_0x382aed,null))[_0x32ef('0x22')](function(_0x18323f){if(_0x18323f){var _0x575325=_0x18323f[_0x32ef('0x117')]({'plain':!![]});fs[_0x32ef('0x118')](_0x1902ed);var _0x3548e0={'format':'A4','border':_0x32ef('0x119'),'header':{'height':_0x32ef('0x11a'),'contents':{'first':_0x32ef('0x11b')}},'footer':{'height':_0x32ef('0x11c'),'contents':{'default':util[_0x32ef('0xdf')]('\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[_0x32ef('0xdf')](_0x32ef('0x11d'),'Chat',_0x575325['id']),moment()[_0x32ef('0xdf')](_0x32ef('0x11e'))[_0x32ef('0xb2')]())}}};var _0x5efb3f={'channel':'Chat','account':_0x575325[_0x32ef('0x115')][_0x32ef('0x37')],'agent':_0x575325[_0x32ef('0x116')]?_0x575325[_0x32ef('0x116')][_0x32ef('0x3a')]:_0x32ef('0x11f'),'createdAt':moment(_0x575325['createdAt'])[_0x32ef('0xdf')](_0x32ef('0x100'))['toString'](),'closedAt':_0x575325[_0x32ef('0x120')]?moment(_0x575325['closedAt'])[_0x32ef('0xdf')](_0x32ef('0x100'))[_0x32ef('0xb2')]():'','disposition':_0x575325[_0x32ef('0xd4')],'chatInfo':{'browser':_0x575325['browserName'],'os':_0x575325[_0x32ef('0x121')],'referer':_0x575325[_0x32ef('0x122')],'customerIp':_0x575325[_0x32ef('0x123')],'customerPort':_0x575325['customerPort']?_0x575325[_0x32ef('0x124')]:_0x32ef('0x11f')},'messages':_(_0x575325[_0x32ef('0xe3')])['tail']()[_0x32ef('0x8f')]({'secret':![]})[_0x32ef('0x39')](function(_0x256eb5){if(_0x256eb5['Attachment']){var _0x1f2728=path[_0x32ef('0xda')](_0x46bf2b,_0x256eb5[_0x32ef('0x112')][_0x32ef('0xd7')]);if(fs[_0x32ef('0x125')](_0x1f2728)){fs[_0x32ef('0x126')](_0x1f2728)[_0x32ef('0x127')](fs['createWriteStream'](path['join'](_0x1902ed,_0x256eb5[_0x32ef('0x112')][_0x32ef('0xd7')])));}}return{'date':moment(_0x256eb5[_0x32ef('0x85')])[_0x32ef('0xdf')](_0x32ef('0x100'))[_0x32ef('0xb2')](),'sender':_0x256eb5[_0x32ef('0xef')]===_0x32ef('0xcc')?_0x256eb5[_0x32ef('0xe4')]?_0x256eb5['User'][_0x32ef('0x3a')]:_0x32ef('0xe9'):_0x256eb5[_0x32ef('0x10f')]['firstName']+(_0x256eb5['Contact'][_0x32ef('0x111')]?'\x20'+_0x256eb5['Contact']['lastName']:''),'body':_0x256eb5[_0x32ef('0x112')]?_0x256eb5['Attachment'][_0x32ef('0xd7')]:_0x256eb5['body'],'direction':_0x256eb5[_0x32ef('0xef')]===_0x32ef('0xcc')?'A':'C','secret':_0x256eb5['secret'],'read':_0x256eb5[_0x32ef('0x114')],'attachment':_0x256eb5[_0x32ef('0x112')]};})['value']()};return ejs[_0x32ef('0x128')](path[_0x32ef('0xda')](config[_0x32ef('0xdb')],'server','views',_0x32ef('0x129')),{'interaction':_0x5efb3f})[_0x32ef('0x22')](function(_0x205350){return new BPromise(function(_0x3c4bab,_0x201509){pdf['create'](_0x205350,_0x3548e0)[_0x32ef('0x12a')](path[_0x32ef('0xda')](_0x1902ed,'transcript-'+_0x575325['id']+'-'+_0xb60be2+_0x32ef('0x12b')),function(_0x2616c9,_0x12d8e6){if(_0x2616c9)return _0x201509(_0x2616c9);_0x3c4bab(_0x12d8e6);});});})['then'](function(){return new BPromise(function(_0x1d84bf,_0x12c87d){zipdir(_0x1902ed,{'saveTo':_0x42b669},function(_0x1743a0,_0x51401d){if(_0x1743a0)return _0x12c87d(_0x1743a0);return _0x1d84bf(_0x51401d);});})[_0x32ef('0x22')](function(){return new BPromise(function(_0xa89962,_0x2dabc4){rimraf(_0x1902ed,function(_0x37e862){if(_0x37e862)_0x2dabc4(_0x37e862);return _0xa89962();});});})[_0x32ef('0x22')](function(){return _0x382aed[_0x32ef('0xd9')](_0x42b669,_0x742a55,function(_0x144346){if(_0x144346){console[_0x32ef('0x12c')](_0x32ef('0x12d'),_0x144346);}else{fs[_0x32ef('0x12e')](_0x42b669);}});});});}else{return _0x382aed['sendStatus'](0xc8);}})[_0x32ef('0x2c')](handleError(_0x382aed,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index a5b5252..4d0702a 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 _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 +var _0xc4b8=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map'];(function(_0x2c5943,_0x56457d){var _0x74e029=function(_0x221da2){while(--_0x221da2){_0x2c5943['push'](_0x2c5943['shift']());}};_0x74e029(++_0x56457d);}(_0xc4b8,0x1ed));var _0x8c4b=function(_0x395f7a,_0x278639){_0x395f7a=_0x395f7a-0x0;var _0x16b589=_0xc4b8[_0x395f7a];return _0x16b589;};'use strict';var EventEmitter=require(_0x8c4b('0x0'));var ChatInteraction=require(_0x8c4b('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0x8c4b('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x8c4b('0x2')](0x0);var events={'afterCreate':_0x8c4b('0x3'),'afterUpdate':_0x8c4b('0x4'),'afterDestroy':_0x8c4b('0x5')};function emitEvent(_0x2f3e9d){return function(_0x36e7a2,_0x35c29a,_0x4ed730){_0x36e7a2[_0x8c4b('0x6')]({'attributes':['id'],'raw':!![]})[_0x8c4b('0x7')](function(_0x517038){_0x36e7a2[_0x8c4b('0x8')](_0x8c4b('0x9'),_0x517038[_0x8c4b('0xa')](function(_0x56934c){return{'id':_0x56934c['id']};}));return ChatMessage[_0x8c4b('0xb')]({'where':{'ChatInteractionId':_0x36e7a2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8c4b('0x7')](function(_0x4e7d04){_0x36e7a2[_0x8c4b('0x8')](_0x8c4b('0xc'),_0x4e7d04[_0x8c4b('0xd')]);ChatInteractionEvents[_0x8c4b('0xe')](_0x2f3e9d+':'+_0x36e7a2['id'],_0x36e7a2);ChatInteractionEvents[_0x8c4b('0xe')](_0x2f3e9d,_0x36e7a2);_0x4ed730(null);})[_0x8c4b('0xf')](_0x4ed730(null));};}for(var e in events){if(events[_0x8c4b('0x10')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x8c4b('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 5d91f65..fa3e78d 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 _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 +var _0xf3b6=['YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format'];(function(_0x3f9602,_0x115411){var _0xb22e48=function(_0x227c90){while(--_0x227c90){_0x3f9602['push'](_0x3f9602['shift']());}};_0xb22e48(++_0x115411);}(_0xf3b6,0x1c5));var _0x6f3b=function(_0x3b37cf,_0x4e6ddb){_0x3b37cf=_0x3b37cf-0x0;var _0x21a23e=_0xf3b6[_0x3b37cf];return _0x21a23e;};'use strict';var _=require(_0x6f3b('0x0'));var util=require(_0x6f3b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6f3b('0x2'));var BPromise=require(_0x6f3b('0x3'));var rp=require(_0x6f3b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6f3b('0x5'));var attributes=require(_0x6f3b('0x6'));module[_0x6f3b('0x7')]=function(_0x135712,_0x314e9c){return _0x135712[_0x6f3b('0x8')](_0x6f3b('0x9'),attributes,{'tableName':_0x6f3b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x338bdc,_0x1888dc,_0x5969d0){if(_0x338bdc[_0x6f3b('0xb')](_0x6f3b('0xc'))){_0x338bdc[_0x6f3b('0xd')]=moment()[_0x6f3b('0xe')](_0x6f3b('0xf'));}_0x5969d0(null,_0x338bdc);}},'charset':_0x6f3b('0x10'),'collate':_0x6f3b('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 3321abe..db18139 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 _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 +var _0xc99d=['ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','body','options','raw','attributes','then','debug','AddTagsToChatInteraction','find','where','addTags','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','info'];(function(_0x2ebea7,_0x5496c0){var _0x28ded4=function(_0x2e70d2){while(--_0x2e70d2){_0x2ebea7['push'](_0x2ebea7['shift']());}};_0x28ded4(++_0x5496c0);}(_0xc99d,0x1ea));var _0xdc99=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0xc99d[_0x710815];return _0x5b3b89;};'use strict';var _=require(_0xdc99('0x0'));var util=require('util');var moment=require(_0xdc99('0x1'));var BPromise=require(_0xdc99('0x2'));var rs=require(_0xdc99('0x3'));var fs=require('fs');var Redis=require(_0xdc99('0x4'));var db=require(_0xdc99('0x5'))['db'];var utils=require(_0xdc99('0x6'));var logger=require(_0xdc99('0x7'))(_0xdc99('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdc99('0x9')][_0xdc99('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xdc99('0xb')],{'host':_0xdc99('0xc'),'port':0x18eb});var socket=require(_0xdc99('0xd'))(new Redis(config[_0xdc99('0xb')]));require(_0xdc99('0xe'))[_0xdc99('0xf')](socket);function respondWithRpcPromise(_0x5f4d05,_0x1ec32c,_0x3779d4){return new BPromise(function(_0xfe3aed,_0xdbde02){return client['request'](_0x5f4d05,_0x3779d4)['then'](function(_0x2fb225){logger[_0xdc99('0x10')](_0xdc99('0x11'),_0x1ec32c,_0xdc99('0x12'));logger['debug'](_0xdc99('0x13'),_0x1ec32c,_0xdc99('0x12'),JSON[_0xdc99('0x14')](_0x2fb225));if(_0x2fb225[_0xdc99('0x15')]){if(_0x2fb225[_0xdc99('0x15')][_0xdc99('0x16')]===0x1f4){logger['error'](_0xdc99('0x11'),_0x1ec32c,_0x2fb225[_0xdc99('0x15')]['message']);return _0xdbde02(_0x2fb225[_0xdc99('0x15')]['message']);}logger[_0xdc99('0x15')](_0xdc99('0x11'),_0x1ec32c,_0x2fb225['error'][_0xdc99('0x17')]);return _0xfe3aed(_0x2fb225[_0xdc99('0x15')][_0xdc99('0x17')]);}else{logger['info'](_0xdc99('0x11'),_0x1ec32c,_0xdc99('0x12'));_0xfe3aed(_0x2fb225[_0xdc99('0x18')]['message']);}})[_0xdc99('0x19')](function(_0x38e330){logger['error'](_0xdc99('0x11'),_0x1ec32c,_0x38e330);_0xdbde02(_0x38e330);});});}exports[_0xdc99('0x1a')]=function(_0xb6e38d){var _0x146573=this;return new Promise(function(_0x2d7915,_0x569e27){return db[_0xdc99('0x1b')]['update'](_0xb6e38d[_0xdc99('0x1c')],{'raw':_0xb6e38d[_0xdc99('0x1d')]?_0xb6e38d[_0xdc99('0x1d')][_0xdc99('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb6e38d[_0xdc99('0x1d')]?_0xb6e38d[_0xdc99('0x1d')]['where']||null:null,'attributes':_0xb6e38d[_0xdc99('0x1d')]?_0xb6e38d['options'][_0xdc99('0x1f')]||null:null,'limit':_0xb6e38d[_0xdc99('0x1d')]?_0xb6e38d[_0xdc99('0x1d')]['limit']||null:null})[_0xdc99('0x20')](function(_0x8a2dfd){logger[_0xdc99('0x10')](_0xdc99('0x1a'),_0xb6e38d);logger[_0xdc99('0x21')](_0xdc99('0x1a'),_0xb6e38d,JSON[_0xdc99('0x14')](_0x8a2dfd));_0x2d7915(_0x8a2dfd);})['catch'](function(_0x209a59){logger[_0xdc99('0x15')](_0xdc99('0x1a'),_0x209a59[_0xdc99('0x17')],_0xb6e38d);_0x569e27(_0x146573['error'](0x1f4,_0x209a59[_0xdc99('0x17')]));});});};exports[_0xdc99('0x22')]=function(_0x396158){return new Promise(function(_0x17cbf7,_0x2811a6){return db['ChatInteraction'][_0xdc99('0x23')]({'where':_0x396158[_0xdc99('0x1d')]?_0x396158[_0xdc99('0x1d')][_0xdc99('0x24')]||null:null})[_0xdc99('0x20')](function(_0x4e48eb){if(_0x4e48eb){return _0x4e48eb[_0xdc99('0x25')](_0x396158[_0xdc99('0x1c')]['ids'],_['omit'](_0x396158[_0xdc99('0x1c')],['ids','id'])||{});}})['spread'](function(_0x305453){logger[_0xdc99('0x10')]('AddTags',_0x396158);logger[_0xdc99('0x21')](_0xdc99('0x26'),_0x396158,JSON[_0xdc99('0x14')](_0x305453));_0x17cbf7(_0x305453);})[_0xdc99('0x19')](function(_0xe2abf6){logger[_0xdc99('0x15')](_0xdc99('0x26'),_0xe2abf6['message'],_0x396158);_0x2811a6(_this['error'](0x1f4,_0xe2abf6[_0xdc99('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index f0656c6..5c5007c 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 _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 +var _0xe96b=['length','chatInteraction:','./chatInteraction.events','save','remove','emit','removeListener','register'];(function(_0x2df782,_0x524eeb){var _0x205b8a=function(_0x5e8162){while(--_0x5e8162){_0x2df782['push'](_0x2df782['shift']());}};_0x205b8a(++_0x524eeb);}(_0xe96b,0x132));var _0xbe96=function(_0x4ba259,_0x1766a8){_0x4ba259=_0x4ba259-0x0;var _0x4bb7a2=_0xe96b[_0x4ba259];return _0x4bb7a2;};'use strict';var ChatInteractionEvents=require(_0xbe96('0x0'));var events=[_0xbe96('0x1'),_0xbe96('0x2'),'update'];function createListener(_0x5de8b3,_0x2d6334){return function(_0x1d1c7d){_0x2d6334[_0xbe96('0x3')](_0x5de8b3,_0x1d1c7d);};}function removeListener(_0x1bb542,_0x5c4b20){return function(){ChatInteractionEvents[_0xbe96('0x4')](_0x1bb542,_0x5c4b20);};}exports[_0xbe96('0x5')]=function(_0x2cd35d){for(var _0x38ede2=0x0,_0x3642f2=events[_0xbe96('0x6')];_0x38ede2<_0x3642f2;_0x38ede2++){var _0xace869=events[_0x38ede2];var _0x4decb8=createListener(_0xbe96('0x7')+_0xace869,_0x2cd35d);ChatInteractionEvents['on'](_0xace869,_0x4decb8);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 79b8ef9..667a187 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 _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 +var _0xe820=['join','server/files/attachments/','%s-%s','now','originalname','replace','post','/:id/attachment_upload','single','file','attachmentUpload','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','/:id/custom_update','customUpdate','/:id/close','close','chatinteraction:destroy','destroy','removeTags','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','isAuthenticated','index','get','/describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMessages','getMyMessages','/:id/download','download','/:id/vidaoo'];(function(_0x586acc,_0x4a2779){var _0x3a214a=function(_0x32ad69){while(--_0x32ad69){_0x586acc['push'](_0x586acc['shift']());}};_0x3a214a(++_0x4a2779);}(_0xe820,0xd2));var _0x0e82=function(_0x1b8d39,_0x36a40b){_0x1b8d39=_0x1b8d39-0x0;var _0x12d867=_0xe820[_0x1b8d39];return _0x12d867;};'use strict';var multer=require(_0x0e82('0x0'));var util=require('util');var path=require(_0x0e82('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0e82('0x2')]();var auth=require(_0x0e82('0x3'));var interaction=require(_0x0e82('0x4'));var config=require('../../config/environment');var controller=require(_0x0e82('0x5'));router['get']('/',auth[_0x0e82('0x6')](),controller[_0x0e82('0x7')]);router[_0x0e82('0x8')](_0x0e82('0x9'),auth[_0x0e82('0x6')](),controller['describe']);router[_0x0e82('0x8')](_0x0e82('0xa'),auth[_0x0e82('0xb')](),controller[_0x0e82('0xc')]);router[_0x0e82('0x8')]('/:id/attachment_download',auth[_0x0e82('0xb')](),controller[_0x0e82('0xd')]);router[_0x0e82('0x8')](_0x0e82('0xe'),auth[_0x0e82('0x6')](),controller[_0x0e82('0xf')]);router[_0x0e82('0x8')]('/:id/my_messages',auth[_0x0e82('0xb')](),controller[_0x0e82('0x10')]);router[_0x0e82('0x8')](_0x0e82('0x11'),auth[_0x0e82('0x6')](),controller[_0x0e82('0x12')]);router['post']('/',auth[_0x0e82('0x6')](),controller['create']);router['post'](_0x0e82('0x13'),auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3298c7,_0x4d1aa0,_0x585b9b){_0x585b9b(null,path[_0x0e82('0x14')](config['root'],_0x0e82('0x15')));},'filename':function(_0x39cf23,_0x233c6d,_0x315ce4){_0x315ce4(null,util['format'](_0x0e82('0x16'),Date[_0x0e82('0x17')](),_0x233c6d[_0x0e82('0x18')][_0x0e82('0x19')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x0e82('0x1a')](_0x0e82('0x1b'),upload[_0x0e82('0x1c')](_0x0e82('0x1d')),controller[_0x0e82('0x1e')]);router[_0x0e82('0x1a')](_0x0e82('0xe'),auth['isChatInteractionAuthorized'](),controller['addMessage']);router[_0x0e82('0x1a')](_0x0e82('0x1f'),auth[_0x0e82('0x6')](),interaction[_0x0e82('0x20')](_0x0e82('0x21'),_0x0e82('0x22')),controller[_0x0e82('0x23')]);router[_0x0e82('0x24')]('/:id',auth[_0x0e82('0x6')](),interaction[_0x0e82('0x20')](_0x0e82('0x21'),_0x0e82('0x25')),controller['update']);router[_0x0e82('0x24')](_0x0e82('0x26'),controller[_0x0e82('0x27')]);router[_0x0e82('0x24')]('/:id/abandon',auth[_0x0e82('0xb')](),controller['abandon']);router['put'](_0x0e82('0x28'),controller[_0x0e82('0x29')]);router['delete'](_0x0e82('0xa'),auth[_0x0e82('0x6')](),interaction[_0x0e82('0x20')]('chat',_0x0e82('0x2a')),controller[_0x0e82('0x2b')]);router['delete'](_0x0e82('0x1f'),auth['isAuthenticated'](),controller[_0x0e82('0x2c')]);module[_0x0e82('0x2d')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index dfe0862..0500652 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 _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 +var _0x1a85=['BOOLEAN','TEXT','medium'];(function(_0x403115,_0x2d6d03){var _0x596ef3=function(_0x145d97){while(--_0x145d97){_0x403115['push'](_0x403115['shift']());}};_0x596ef3(++_0x2d6d03);}(_0x1a85,0x178));var _0x51a8=function(_0x100e36,_0x4da225){_0x100e36=_0x100e36-0x0;var _0x1df0c9=_0x1a85[_0x100e36];return _0x1df0c9;};'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 diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 1b1e877..c6f1b1d 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 _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 +var _0xd831=['ToId','read','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','count','offset','limit','json','apply','reject','save','update','then','destroy','error','name','send','index','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','ChatInternalMessage','includeAll','include','findAll','rows','catch','length','options','find','create','body','params','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','User','admin','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','agent','resourceId','push','FromId'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xd831,0x14c));var _0x1d83=function(_0x50c54d,_0x2c4f68){_0x50c54d=_0x50c54d-0x0;var _0x48c54f=_0xd831[_0x50c54d];return _0x48c54f;};'use strict';var pdf=require(_0x1d83('0x0'));var emlformat=require(_0x1d83('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1d83('0x2'));var jsonpatch=require(_0x1d83('0x3'));var rp=require('request-promise');var moment=require(_0x1d83('0x4'));var BPromise=require(_0x1d83('0x5'));var Mustache=require('mustache');var util=require(_0x1d83('0x6'));var path=require('path');var sox=require(_0x1d83('0x7'));var csv=require(_0x1d83('0x8'));var ejs=require(_0x1d83('0x9'));var fs=require('fs');var _=require(_0x1d83('0xa'));var squel=require(_0x1d83('0xb'));var crypto=require('crypto');var jsforce=require(_0x1d83('0xc'));var deskjs=require(_0x1d83('0xd'));var toCsv=require(_0x1d83('0x8'));var querystring=require(_0x1d83('0xe'));var Papa=require(_0x1d83('0xf'));var Redis=require('ioredis');var authService=require(_0x1d83('0x10'));var qs=require(_0x1d83('0x11'));var as=require(_0x1d83('0x12'));var hardwareService=require(_0x1d83('0x13'));var logger=require(_0x1d83('0x14'))(_0x1d83('0x15'));var utils=require('../../config/utils');var config=require(_0x1d83('0x16'));var db=require(_0x1d83('0x17'))['db'];config[_0x1d83('0x18')]=_[_0x1d83('0x19')](config[_0x1d83('0x18')],{'host':_0x1d83('0x1a'),'port':0x18eb});var socket=require(_0x1d83('0x1b'))(new Redis(config[_0x1d83('0x18')]));require('./chatInternalMessage.socket')[_0x1d83('0x1c')](socket);function respondWithStatusCode(_0x28028f,_0xa0717f){_0xa0717f=_0xa0717f||0xcc;return function(_0x594aac){if(_0x594aac){return _0x28028f[_0x1d83('0x1d')](_0xa0717f);}return _0x28028f['status'](_0xa0717f)[_0x1d83('0x1e')]();};}function respondWithResult(_0x5dda1b,_0x33672e){_0x33672e=_0x33672e||0xc8;return function(_0x135c5a){if(_0x135c5a){return _0x5dda1b[_0x1d83('0x1f')](_0x33672e)['json'](_0x135c5a);}};}function respondWithFilteredResult(_0x2f8493,_0x522239){return function(_0x2625bb){if(_0x2625bb){var _0x39c8ac=_0x2625bb[_0x1d83('0x20')],_0xd84050=_0x522239['offset'],_0x3e9c9f=_0x522239[_0x1d83('0x21')]+_0x522239[_0x1d83('0x22')],_0x1718b7;if(_0x3e9c9f>=_0x39c8ac){_0x3e9c9f=_0x39c8ac;_0x1718b7=0xc8;}else{_0x1718b7=0xce;}_0x2f8493[_0x1d83('0x1f')](_0x1718b7);return _0x2f8493['set']('Content-Range',_0xd84050+'-'+_0x3e9c9f+'/'+_0x39c8ac)[_0x1d83('0x23')](_0x2625bb);}return null;};}function patchUpdates(_0x105bc3){return function(_0x1af150){try{jsonpatch[_0x1d83('0x24')](_0x1af150,_0x105bc3,!![]);}catch(_0x1b6511){return BPromise[_0x1d83('0x25')](_0x1b6511);}return _0x1af150[_0x1d83('0x26')]();};}function saveUpdates(_0x281662,_0x50dd33){return function(_0x3bea4c){if(_0x3bea4c){return _0x3bea4c[_0x1d83('0x27')](_0x281662)[_0x1d83('0x28')](function(_0x5e2970){return _0x5e2970;});}return null;};}function removeEntity(_0x40533b,_0x3bd54c){return function(_0x436946){if(_0x436946){return _0x436946[_0x1d83('0x29')]()[_0x1d83('0x28')](function(){_0x40533b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x209ec5,_0x5ee5c3){return function(_0x369bcd){if(!_0x369bcd){_0x209ec5[_0x1d83('0x1d')](0x194);}return _0x369bcd;};}function handleError(_0x6e92bb,_0x587645){_0x587645=_0x587645||0x1f4;return function(_0x375c95){logger[_0x1d83('0x2a')](_0x375c95['stack']);if(_0x375c95[_0x1d83('0x2b')]){delete _0x375c95['name'];}_0x6e92bb[_0x1d83('0x1f')](_0x587645)[_0x1d83('0x2c')](_0x375c95);};}exports[_0x1d83('0x2d')]=function(_0x2f4ccc,_0x387ece){var _0x2f2db9={},_0x3dbcaa={},_0xc15e74={'count':0x0,'rows':[]};var _0xc02abe=_['map'](db['ChatInternalMessage'][_0x1d83('0x2e')],function(_0x513abc){return{'name':_0x513abc[_0x1d83('0x2f')],'type':_0x513abc[_0x1d83('0x30')]['key']};});_0x3dbcaa[_0x1d83('0x31')]=_[_0x1d83('0x32')](_0xc02abe,'name');_0x3dbcaa['query']=_[_0x1d83('0x33')](_0x2f4ccc[_0x1d83('0x34')]);_0x3dbcaa[_0x1d83('0x35')]=_[_0x1d83('0x36')](_0x3dbcaa[_0x1d83('0x31')],_0x3dbcaa[_0x1d83('0x34')]);_0x2f2db9[_0x1d83('0x37')]=_[_0x1d83('0x36')](_0x3dbcaa[_0x1d83('0x31')],qs[_0x1d83('0x38')](_0x2f4ccc['query'][_0x1d83('0x38')]));_0x2f2db9[_0x1d83('0x37')]=_0x2f2db9[_0x1d83('0x37')]['length']?_0x2f2db9['attributes']:_0x3dbcaa['model'];if(!_0x2f4ccc[_0x1d83('0x34')][_0x1d83('0x39')](_0x1d83('0x3a'))){_0x2f2db9[_0x1d83('0x22')]=qs[_0x1d83('0x22')](_0x2f4ccc['query'][_0x1d83('0x22')]);_0x2f2db9[_0x1d83('0x21')]=qs[_0x1d83('0x21')](_0x2f4ccc[_0x1d83('0x34')]['offset']);}_0x2f2db9['order']=qs[_0x1d83('0x3b')](_0x2f4ccc[_0x1d83('0x34')][_0x1d83('0x3b')]);_0x2f2db9['where']=qs[_0x1d83('0x35')](_['pick'](_0x2f4ccc[_0x1d83('0x34')],_0x3dbcaa[_0x1d83('0x35')]),_0xc02abe);if(_0x2f4ccc[_0x1d83('0x34')][_0x1d83('0x3c')]){_0x2f2db9[_0x1d83('0x3d')]=_[_0x1d83('0x3e')](_0x2f2db9[_0x1d83('0x3d')],{'$or':_[_0x1d83('0x32')](_0xc02abe,function(_0x922f4a){if(_0x922f4a[_0x1d83('0x30')]!==_0x1d83('0x3f')){var _0x271b9a={};_0x271b9a[_0x922f4a['name']]={'$like':'%'+_0x2f4ccc[_0x1d83('0x34')]['filter']+'%'};return _0x271b9a;}})});}_0x2f2db9=_[_0x1d83('0x3e')]({},_0x2f2db9,_0x2f4ccc['options']);var _0x2febd0={'where':_0x2f2db9[_0x1d83('0x3d')]};return db[_0x1d83('0x40')][_0x1d83('0x20')](_0x2febd0)[_0x1d83('0x28')](function(_0x412363){_0xc15e74['count']=_0x412363;if(_0x2f4ccc[_0x1d83('0x34')][_0x1d83('0x41')]){_0x2f2db9[_0x1d83('0x42')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x1d83('0x43')](_0x2f2db9);})[_0x1d83('0x28')](function(_0x41acfc){_0xc15e74[_0x1d83('0x44')]=_0x41acfc;return _0xc15e74;})['then'](respondWithFilteredResult(_0x387ece,_0x2f2db9))[_0x1d83('0x45')](handleError(_0x387ece,null));};exports['show']=function(_0x26c9f1,_0x2cdcd2){var _0x3c1c10={'raw':!![],'where':{'id':_0x26c9f1['params']['id']}},_0x2ae9e5={};_0x2ae9e5['model']=_[_0x1d83('0x33')](db[_0x1d83('0x40')]['rawAttributes']);_0x2ae9e5[_0x1d83('0x34')]=_[_0x1d83('0x33')](_0x26c9f1[_0x1d83('0x34')]);_0x2ae9e5[_0x1d83('0x35')]=_[_0x1d83('0x36')](_0x2ae9e5[_0x1d83('0x31')],_0x2ae9e5['query']);_0x3c1c10[_0x1d83('0x37')]=_['intersection'](_0x2ae9e5['model'],qs[_0x1d83('0x38')](_0x26c9f1[_0x1d83('0x34')][_0x1d83('0x38')]));_0x3c1c10[_0x1d83('0x37')]=_0x3c1c10[_0x1d83('0x37')][_0x1d83('0x46')]?_0x3c1c10[_0x1d83('0x37')]:_0x2ae9e5[_0x1d83('0x31')];if(_0x26c9f1[_0x1d83('0x34')]['includeAll']){_0x3c1c10[_0x1d83('0x42')]=[{'all':!![]}];}_0x3c1c10=_[_0x1d83('0x3e')]({},_0x3c1c10,_0x26c9f1[_0x1d83('0x47')]);return db['ChatInternalMessage'][_0x1d83('0x48')](_0x3c1c10)['then'](handleEntityNotFound(_0x2cdcd2,null))[_0x1d83('0x28')](respondWithResult(_0x2cdcd2,null))['catch'](handleError(_0x2cdcd2,null));};exports[_0x1d83('0x49')]=function(_0x146d01,_0x19d583){return db['ChatInternalMessage'][_0x1d83('0x49')](_0x146d01['body'],{})[_0x1d83('0x28')](respondWithResult(_0x19d583,0xc9))[_0x1d83('0x45')](handleError(_0x19d583,null));};exports[_0x1d83('0x27')]=function(_0x197899,_0x677d2b){if(_0x197899[_0x1d83('0x4a')]['id']){delete _0x197899[_0x1d83('0x4a')]['id'];}return db[_0x1d83('0x40')]['find']({'where':{'id':_0x197899[_0x1d83('0x4b')]['id']}})[_0x1d83('0x28')](handleEntityNotFound(_0x677d2b,null))[_0x1d83('0x28')](saveUpdates(_0x197899[_0x1d83('0x4a')],null))[_0x1d83('0x28')](respondWithResult(_0x677d2b,null))[_0x1d83('0x45')](handleError(_0x677d2b,null));};exports['destroy']=function(_0x464bd6,_0x2281b5){return db[_0x1d83('0x40')][_0x1d83('0x48')]({'where':{'id':_0x464bd6['params']['id']}})[_0x1d83('0x28')](handleEntityNotFound(_0x2281b5,null))[_0x1d83('0x28')](removeEntity(_0x2281b5,null))[_0x1d83('0x45')](handleError(_0x2281b5,null));};exports[_0x1d83('0x4c')]=function(_0x430c73,_0x4927f5){return db['ChatInternalMessage'][_0x1d83('0x4c')]()[_0x1d83('0x28')](respondWithResult(_0x4927f5,null))[_0x1d83('0x45')](handleError(_0x4927f5,null));};function wrapUser(_0x34a506){return function(_0x34d2be){var _0x302a82=_0x34a506[_0x1d83('0x4d')]({'plain':!![]});_0x302a82[_0x1d83('0x4e')]=[];if(_0x34d2be){_0x302a82[_0x1d83('0x4f')]=_0x34d2be[_0x1d83('0x50')];_0x302a82[_0x1d83('0x51')]=_0x34d2be;}else{_0x302a82[_0x1d83('0x4f')]=moment(0x0)[_0x1d83('0x52')](_0x1d83('0x53'));_0x302a82['lastMessage']={};}return _0x302a82;};}exports['getUsers']=function(_0x458c5a,_0x1eff18,_0x111aa0){var _0x52c2d0=[];return db[_0x1d83('0x54')][_0x1d83('0x43')]({'where':{'role':['agent',_0x1d83('0x55'),'user']},'attributes':['id',_0x1d83('0x56'),_0x1d83('0x2b'),_0x1d83('0x57'),_0x1d83('0x58'),_0x1d83('0x59'),_0x1d83('0x5a'),_0x1d83('0x5b'),_0x1d83('0x5c'),_0x1d83('0x5d')],'order':qs[_0x1d83('0x3b')](_0x1d83('0x5e')),'include':[{'model':db[_0x1d83('0x5f')],'as':_0x1d83('0x60'),'attributes':['id','name',_0x1d83('0x30')],'through':{'attributes':[]}}]})[_0x1d83('0x28')](function(_0x276dbe){if(_0x276dbe){var _0x460221=_0x458c5a[_0x1d83('0x61')]['get']({'plain':!![]});if(!_0x460221)throw new Error(_0x1d83('0x62'));if(_0x460221[_0x1d83('0x57')]==='user'){return db[_0x1d83('0x63')][_0x1d83('0x48')]({'where':{'name':_0x1d83('0x64'),'userProfileId':_0x460221['userProfileId']},'raw':!![]})[_0x1d83('0x28')](function(_0x33c126){if(_0x33c126){if(_0x33c126[_0x1d83('0x65')]===0x0){return db[_0x1d83('0x66')][_0x1d83('0x43')]({'where':{'sectionId':_0x33c126['id']},'raw':!![]})[_0x1d83('0x28')](function(_0x359366){var _0x3d6685=[];if(_[_0x1d83('0x67')](_0x359366)){_0x3d6685=_[_0x1d83('0x3c')](_0x276dbe,function(_0x142273){if(_0x142273[_0x1d83('0x57')]!==_0x1d83('0x68')){return _0x142273;}});return _0x3d6685;}else{for(var _0x2ab5d8=0x0;_0x2ab5d8<_0x276dbe[_0x1d83('0x46')];_0x2ab5d8++){var _0x145109=_0x276dbe[_0x2ab5d8];if(_0x145109[_0x1d83('0x57')]===_0x1d83('0x68')){var _0x94ac3a=_['find'](_0x359366,function(_0x47a939){return _0x47a939[_0x1d83('0x69')]===_0x145109['id'];});if(_0x94ac3a)_0x3d6685['push'](_0x145109);}else{_0x3d6685['push'](_0x145109);}}return _0x3d6685;}});}else{return _0x276dbe;}}else{var _0x1e1a2c=_[_0x1d83('0x3c')](_0x276dbe,function(_0x3afb6f){if(_0x3afb6f[_0x1d83('0x57')]!=='agent'){return _0x3afb6f;}});return _0x1e1a2c;}});}else{return _0x276dbe;}}})['then'](function(_0x3557a3){var _0x171b99=[];if(_0x3557a3){_0x52c2d0=_0x3557a3;for(var _0xa07389=0x0;_0xa07389<_0x3557a3['length'];_0xa07389+=0x1){_0x52c2d0[_0xa07389][_0x1d83('0x4e')]=[];_0x171b99[_0x1d83('0x6a')](db[_0x1d83('0x40')][_0x1d83('0x48')]({'where':{'FromId':[_0x458c5a[_0x1d83('0x61')]['id'],_0x3557a3[_0xa07389]['id']],'ToId':[_0x458c5a[_0x1d83('0x61')]['id'],_0x3557a3[_0xa07389]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x1d83('0x6b'),_0x1d83('0x6c'),_0x1d83('0x6d'),'body'],'order':qs[_0x1d83('0x3b')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x1d83('0x28')](wrapUser(_0x3557a3[_0xa07389])));}return BPromise['all'](_0x171b99);}return[];})[_0x1d83('0x28')](function(_0x598a33){return{'rows':_0x598a33,'count':_0x598a33[_0x1d83('0x46')]};})['then'](respondWithResult(_0x1eff18,null))[_0x1d83('0x45')](handleError(_0x1eff18,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index cf6d8e7..b885b82 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 _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 +var _0x142c=['setMaxListeners','save','remove','emit','hook','exports','events','ChatInternalMessage'];(function(_0xed9fea,_0x5ed774){var _0x198f12=function(_0xfb85f6){while(--_0xfb85f6){_0xed9fea['push'](_0xed9fea['shift']());}};_0x198f12(++_0x5ed774);}(_0x142c,0x86));var _0xc142=function(_0x184939,_0x274a91){_0x184939=_0x184939-0x0;var _0x4901b8=_0x142c[_0x184939];return _0x4901b8;};'use strict';var EventEmitter=require(_0xc142('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xc142('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xc142('0x2')](0x0);var events={'afterCreate':_0xc142('0x3'),'afterUpdate':'update','afterDestroy':_0xc142('0x4')};function emitEvent(_0x3d66ef){return function(_0x4fa56e,_0x47e43a,_0x110b14){ChatInternalMessageEvents['emit'](_0x3d66ef+':'+_0x4fa56e['id'],_0x4fa56e);ChatInternalMessageEvents[_0xc142('0x5')](_0x3d66ef,_0x4fa56e);_0x110b14(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xc142('0x6')](e,emitEvent(event));}}module[_0xc142('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 0a3a825..469cbf5 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 _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 +var _0x4fc2=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./chatInternalMessage.attributes','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x3893ea,_0x2e49ff){var _0x403f34=function(_0x4be820){while(--_0x4be820){_0x3893ea['push'](_0x3893ea['shift']());}};_0x403f34(++_0x2e49ff);}(_0x4fc2,0x111));var _0x24fc=function(_0x496af1,_0x2d5f59){_0x496af1=_0x496af1-0x0;var _0x5700b3=_0x4fc2[_0x496af1];return _0x5700b3;};'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':!![],'charset':_0x24fc('0xb'),'collate':_0x24fc('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index c952409..96b9954 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 _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 +var _0x7819=['socket.io-emitter','./chatInternalMessage.socket','register','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis'];(function(_0x5ef905,_0x564b87){var _0x367808=function(_0x14f487){while(--_0x14f487){_0x5ef905['push'](_0x5ef905['shift']());}};_0x367808(++_0x564b87);}(_0x7819,0x1db));var _0x9781=function(_0x560ce5,_0x2768fc){_0x560ce5=_0x560ce5-0x0;var _0xd3c885=_0x7819[_0x560ce5];return _0xd3c885;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9781('0x0'));var BPromise=require('bluebird');var rs=require(_0x9781('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9781('0x2'))['db'];var utils=require(_0x9781('0x3'));var logger=require('../../config/logger')(_0x9781('0x4'));var config=require('../../config/environment');var jayson=require(_0x9781('0x5'));var client=jayson[_0x9781('0x6')][_0x9781('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0x9781('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x9781('0x9'))(new Redis(config[_0x9781('0x8')]));require(_0x9781('0xa'))[_0x9781('0xb')](socket);function respondWithRpcPromise(_0x2ebea3,_0xe8927a,_0x23908c){return new BPromise(function(_0x2bd1d3,_0x2d8386){return client['request'](_0x2ebea3,_0x23908c)[_0x9781('0xc')](function(_0x1fc5c9){logger[_0x9781('0xd')](_0x9781('0xe'),_0xe8927a,'request\x20sent');logger[_0x9781('0xf')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0xe8927a,_0x9781('0x10'),JSON[_0x9781('0x11')](_0x1fc5c9));if(_0x1fc5c9[_0x9781('0x12')]){if(_0x1fc5c9[_0x9781('0x12')][_0x9781('0x13')]===0x1f4){logger[_0x9781('0x12')](_0x9781('0xe'),_0xe8927a,_0x1fc5c9[_0x9781('0x12')][_0x9781('0x14')]);return _0x2d8386(_0x1fc5c9['error'][_0x9781('0x14')]);}logger[_0x9781('0x12')](_0x9781('0xe'),_0xe8927a,_0x1fc5c9['error']['message']);return _0x2bd1d3(_0x1fc5c9[_0x9781('0x12')]['message']);}else{logger[_0x9781('0xd')]('ChatInternalMessage,\x20%s,\x20%s',_0xe8927a,_0x9781('0x10'));_0x2bd1d3(_0x1fc5c9[_0x9781('0x15')]['message']);}})['catch'](function(_0x3863b0){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0xe8927a,_0x3863b0);_0x2d8386(_0x3863b0);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index d159eb7..5f516bc 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 _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 +var _0xf53f=['update','emit','removeListener','register','chatInternalMessage:','./chatInternalMessage.events','save','remove'];(function(_0x48232d,_0x7c3808){var _0x32583c=function(_0x3e21a7){while(--_0x3e21a7){_0x48232d['push'](_0x48232d['shift']());}};_0x32583c(++_0x7c3808);}(_0xf53f,0x8d));var _0xff53=function(_0x8c71ee,_0x555cbd){_0x8c71ee=_0x8c71ee-0x0;var _0x53150f=_0xf53f[_0x8c71ee];return _0x53150f;};'use strict';var ChatInternalMessageEvents=require(_0xff53('0x0'));var events=[_0xff53('0x1'),_0xff53('0x2'),_0xff53('0x3')];function createListener(_0x3b48fc,_0x4afcd){return function(_0x492e12){_0x4afcd[_0xff53('0x4')](_0x3b48fc,_0x492e12);};}function removeListener(_0x18b504,_0x2077b9){return function(){ChatInternalMessageEvents[_0xff53('0x5')](_0x18b504,_0x2077b9);};}exports[_0xff53('0x6')]=function(_0x54d39c){for(var _0x54e637=0x0,_0x27b397=events['length'];_0x54e637<_0x27b397;_0x54e637++){var _0x1c27bb=events[_0x54e637];var _0x122746=createListener(_0xff53('0x7')+_0x1c27bb,_0x54d39c);ChatInternalMessageEvents['on'](_0x1c27bb,_0x122746);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index e631ce9..c53d541 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(_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 +var _0x9c44=['express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/users','getUsers','show','post','create','put','delete','/:id','destroy','exports','path','connect-timeout'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x9c44,0x178));var _0x49c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9c44[_0x465a0c];return _0x1e202e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./chatInternalMessage.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['get'](_0x49c4('0xb'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xc')]);router[_0x49c4('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0xd')]);router[_0x49c4('0xe')]('/',auth['isAuthenticated'](),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',controller['update']);router[_0x49c4('0x11')](_0x49c4('0x12'),auth['isAuthenticated'](),controller[_0x49c4('0x13')]);module[_0x49c4('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 81b7d8b..1c8d0a2 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 _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 +var _0x5e0a=['DATE','exports','medium','BOOLEAN','ENUM','out'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x5e0a,0x175));var _0xa5e0=function(_0x442984,_0x2937d1){_0x442984=_0x442984-0x0;var _0x420b17=_0x5e0a[_0x442984];return _0x420b17;};'use strict';var Sequelize=require('sequelize');module[_0xa5e0('0x0')]={'body':{'type':Sequelize['TEXT'](_0xa5e0('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xa5e0('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xa5e0('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa5e0('0x3')]('in','out'),'defaultValue':_0xa5e0('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xa5e0('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 738c91f..0597eb0 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 _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 +var _0xdb3e=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','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','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatMessage,\x20%s,\x20%s','message','info','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','options','find','create','body','update','describe','chat-interactions','accept','chat','read','readAt','UserId','user','CmContact','Contact','ChatInteraction','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','parse','formData','../../config/logger','reject','agent','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','interface','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis'];(function(_0x11ebac,_0x476a52){var _0x29ae69=function(_0x604176){while(--_0x604176){_0x11ebac['push'](_0x11ebac['shift']());}};_0x29ae69(++_0x476a52);}(_0xdb3e,0xef));var _0xedb3=function(_0x3ebac6,_0x2b849f){_0x3ebac6=_0x3ebac6-0x0;var _0xf36c9f=_0xdb3e[_0x3ebac6];return _0xf36c9f;};'use strict';var pdf=require(_0xedb3('0x0'));var emlformat=require(_0xedb3('0x1'));var rimraf=require(_0xedb3('0x2'));var zipdir=require(_0xedb3('0x3'));var jsonpatch=require(_0xedb3('0x4'));var rp=require(_0xedb3('0x5'));var moment=require(_0xedb3('0x6'));var BPromise=require(_0xedb3('0x7'));var Mustache=require(_0xedb3('0x8'));var util=require(_0xedb3('0x9'));var path=require(_0xedb3('0xa'));var sox=require('sox');var csv=require(_0xedb3('0xb'));var ejs=require(_0xedb3('0xc'));var fs=require('fs');var _=require(_0xedb3('0xd'));var squel=require(_0xedb3('0xe'));var crypto=require('crypto');var jsforce=require(_0xedb3('0xf'));var deskjs=require(_0xedb3('0x10'));var toCsv=require('to-csv');var querystring=require(_0xedb3('0x11'));var Papa=require('papaparse');var Redis=require(_0xedb3('0x12'));var authService=require(_0xedb3('0x13'));var qs=require(_0xedb3('0x14'));var as=require(_0xedb3('0x15'));var hardwareService=require(_0xedb3('0x16'));var logger=require('../../config/logger')(_0xedb3('0x17'));var utils=require(_0xedb3('0x18'));var config=require(_0xedb3('0x19'));var db=require(_0xedb3('0x1a'))['db'];config[_0xedb3('0x1b')]=_[_0xedb3('0x1c')](config[_0xedb3('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xedb3('0x1d'))(new Redis(config[_0xedb3('0x1b')]));require('./chatMessage.socket')['register'](socket);var jayson=require(_0xedb3('0x1e'));var client=jayson[_0xedb3('0x1f')][_0xedb3('0x20')]({'port':0x232c});var client9002=jayson[_0xedb3('0x1f')][_0xedb3('0x20')]({'port':0x232a});function checkPasswordPattern(_0x1edad4,_0x54500f,_0x479903){if(_0x479903){var _0x91e294=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x91e294[_0xedb3('0x21')](_0x54500f)){return _0x1edad4;}else{throw new db[(_0xedb3('0x22'))]['ValidationError'](_0xedb3('0x23'));}}else{return _0x1edad4;}}function respondWithRpcPromise(_0xe99431,_0xfb6039,_0x35a0f9,_0x51e8ae){return new BPromise(function(_0x449df9,_0x392d37){var _0x139a23=_0x51e8ae||client;return _0x139a23[_0xedb3('0x24')](_0xe99431,_0x35a0f9)[_0xedb3('0x25')](function(_0x27c3b4){logger['info']('ChatMessage,\x20%s,\x20%s',_0xfb6039,'request\x20sent');logger[_0xedb3('0x26')](_0xedb3('0x27'),_0xfb6039,_0xedb3('0x28'),JSON[_0xedb3('0x29')](_0x27c3b4));if(_0x27c3b4[_0xedb3('0x2a')]){if(_0x27c3b4['error']['code']===0x1f4){logger['error'](_0xedb3('0x2b'),_0xfb6039,_0x27c3b4[_0xedb3('0x2a')][_0xedb3('0x2c')]);return _0x392d37(_0x27c3b4[_0xedb3('0x2a')][_0xedb3('0x2c')]);}logger[_0xedb3('0x2a')](_0xedb3('0x2b'),_0xfb6039,_0x27c3b4[_0xedb3('0x2a')][_0xedb3('0x2c')]);return _0x449df9(_0x27c3b4[_0xedb3('0x2a')][_0xedb3('0x2c')]);}else{logger[_0xedb3('0x2d')](_0xedb3('0x2b'),_0xfb6039,_0xedb3('0x28'));_0x449df9(_0x27c3b4['result']['message']);}})['catch'](function(_0xe991a2){logger[_0xedb3('0x2a')](_0xedb3('0x2b'),_0xfb6039,_0xe991a2);_0x392d37(_0xe991a2);});});}function respondWithStatusCode(_0x4b27f3,_0x3f1e59){_0x3f1e59=_0x3f1e59||0xcc;return function(_0x33999b){if(_0x33999b){return _0x4b27f3[_0xedb3('0x2e')](_0x3f1e59);}return _0x4b27f3['status'](_0x3f1e59)[_0xedb3('0x2f')]();};}function respondWithResult(_0x376dbb,_0x2d3a3f){_0x2d3a3f=_0x2d3a3f||0xc8;return function(_0x55d259){if(_0x55d259){return _0x376dbb[_0xedb3('0x30')](_0x2d3a3f)[_0xedb3('0x31')](_0x55d259);}};}function respondWithFilteredResult(_0x4e6f2e,_0x1764ea){return function(_0x4ab026){if(_0x4ab026){var _0x188a0d=_0x4ab026[_0xedb3('0x32')],_0x5eccd2=_0x1764ea[_0xedb3('0x33')],_0x438988=_0x1764ea[_0xedb3('0x33')]+_0x1764ea[_0xedb3('0x34')],_0x40f3d2;if(_0x438988>=_0x188a0d){_0x438988=_0x188a0d;_0x40f3d2=0xc8;}else{_0x40f3d2=0xce;}_0x4e6f2e[_0xedb3('0x30')](_0x40f3d2);return _0x4e6f2e[_0xedb3('0x35')](_0xedb3('0x36'),_0x5eccd2+'-'+_0x438988+'/'+_0x188a0d)[_0xedb3('0x31')](_0x4ab026);}return null;};}function patchUpdates(_0x157115){return function(_0x12b503){try{jsonpatch[_0xedb3('0x37')](_0x12b503,_0x157115,!![]);}catch(_0x3debf5){return BPromise['reject'](_0x3debf5);}return _0x12b503[_0xedb3('0x38')]();};}function saveUpdates(_0x587195,_0x50a171){return function(_0x2545c6){if(_0x2545c6){return _0x2545c6['update'](_0x587195)['then'](function(_0x4988a7){return _0x4988a7;});}return null;};}function removeEntity(_0x5e4227,_0x14ac01){return function(_0x6d7e1e){if(_0x6d7e1e){return _0x6d7e1e[_0xedb3('0x39')]()[_0xedb3('0x25')](function(){_0x5e4227[_0xedb3('0x30')](0xcc)[_0xedb3('0x2f')]();});}};}function handleEntityNotFound(_0x48be24,_0x5a0676){return function(_0x5aac82){if(!_0x5aac82){_0x48be24[_0xedb3('0x2e')](0x194);}return _0x5aac82;};}function handleError(_0x2b7d66,_0x2e24de){_0x2e24de=_0x2e24de||0x1f4;return function(_0x54054b){logger[_0xedb3('0x2a')](_0x54054b[_0xedb3('0x3a')]);if(_0x54054b['name']){delete _0x54054b[_0xedb3('0x3b')];}_0x2b7d66['status'](_0x2e24de)[_0xedb3('0x3c')](_0x54054b);};}exports[_0xedb3('0x3d')]=function(_0x36ccb3,_0x1585dc){var _0x2d598f={},_0x322d47={},_0x1aded5={'count':0x0,'rows':[]};var _0x1197cf=_[_0xedb3('0x3e')](db[_0xedb3('0x3f')][_0xedb3('0x40')],function(_0x5b86db){return{'name':_0x5b86db['fieldName'],'type':_0x5b86db[_0xedb3('0x41')][_0xedb3('0x42')]};});_0x322d47['model']=_[_0xedb3('0x3e')](_0x1197cf,'name');_0x322d47[_0xedb3('0x43')]=_[_0xedb3('0x44')](_0x36ccb3[_0xedb3('0x43')]);_0x322d47[_0xedb3('0x45')]=_['intersection'](_0x322d47[_0xedb3('0x46')],_0x322d47[_0xedb3('0x43')]);_0x2d598f[_0xedb3('0x47')]=_[_0xedb3('0x48')](_0x322d47[_0xedb3('0x46')],qs[_0xedb3('0x49')](_0x36ccb3['query']['fields']));_0x2d598f[_0xedb3('0x47')]=_0x2d598f[_0xedb3('0x47')][_0xedb3('0x4a')]?_0x2d598f[_0xedb3('0x47')]:_0x322d47[_0xedb3('0x46')];if(!_0x36ccb3[_0xedb3('0x43')][_0xedb3('0x4b')]('nolimit')){_0x2d598f['limit']=qs[_0xedb3('0x34')](_0x36ccb3[_0xedb3('0x43')]['limit']);_0x2d598f[_0xedb3('0x33')]=qs[_0xedb3('0x33')](_0x36ccb3[_0xedb3('0x43')][_0xedb3('0x33')]);}_0x2d598f['order']=qs[_0xedb3('0x4c')](_0x36ccb3[_0xedb3('0x43')]['sort']);_0x2d598f[_0xedb3('0x4d')]=qs['filters'](_[_0xedb3('0x4e')](_0x36ccb3[_0xedb3('0x43')],_0x322d47[_0xedb3('0x45')]),_0x1197cf);if(_0x36ccb3[_0xedb3('0x43')][_0xedb3('0x4f')]){_0x2d598f['where']=_[_0xedb3('0x50')](_0x2d598f[_0xedb3('0x4d')],{'$or':_[_0xedb3('0x3e')](_0x1197cf,function(_0x4a05bb){if(_0x4a05bb[_0xedb3('0x41')]!=='VIRTUAL'){var _0x289f44={};_0x289f44[_0x4a05bb[_0xedb3('0x3b')]]={'$like':'%'+_0x36ccb3[_0xedb3('0x43')][_0xedb3('0x4f')]+'%'};return _0x289f44;}})});}_0x2d598f=_['merge']({},_0x2d598f,_0x36ccb3['options']);var _0x28f31c={'where':_0x2d598f[_0xedb3('0x4d')]};return db[_0xedb3('0x3f')][_0xedb3('0x32')](_0x28f31c)[_0xedb3('0x25')](function(_0x26e821){_0x1aded5['count']=_0x26e821;if(_0x36ccb3[_0xedb3('0x43')][_0xedb3('0x51')]){_0x2d598f[_0xedb3('0x52')]=[{'all':!![]}];}return db[_0xedb3('0x3f')]['findAll'](_0x2d598f);})[_0xedb3('0x25')](function(_0x43093e){_0x1aded5[_0xedb3('0x53')]=_0x43093e;return _0x1aded5;})['then'](respondWithFilteredResult(_0x1585dc,_0x2d598f))[_0xedb3('0x54')](handleError(_0x1585dc,null));};exports[_0xedb3('0x55')]=function(_0xcd4d55,_0x6b7fc3){var _0x5f36ef={'raw':!![],'where':{'id':_0xcd4d55[_0xedb3('0x56')]['id']}},_0x18613c={};_0x18613c[_0xedb3('0x46')]=_[_0xedb3('0x44')](db[_0xedb3('0x3f')][_0xedb3('0x40')]);_0x18613c['query']=_['keys'](_0xcd4d55[_0xedb3('0x43')]);_0x18613c[_0xedb3('0x45')]=_[_0xedb3('0x48')](_0x18613c[_0xedb3('0x46')],_0x18613c[_0xedb3('0x43')]);_0x5f36ef[_0xedb3('0x47')]=_[_0xedb3('0x48')](_0x18613c[_0xedb3('0x46')],qs[_0xedb3('0x49')](_0xcd4d55[_0xedb3('0x43')][_0xedb3('0x49')]));_0x5f36ef[_0xedb3('0x47')]=_0x5f36ef[_0xedb3('0x47')][_0xedb3('0x4a')]?_0x5f36ef[_0xedb3('0x47')]:_0x18613c[_0xedb3('0x46')];if(_0xcd4d55[_0xedb3('0x43')][_0xedb3('0x51')]){_0x5f36ef[_0xedb3('0x52')]=[{'all':!![]}];}_0x5f36ef=_[_0xedb3('0x50')]({},_0x5f36ef,_0xcd4d55[_0xedb3('0x57')]);return db[_0xedb3('0x3f')][_0xedb3('0x58')](_0x5f36ef)[_0xedb3('0x25')](handleEntityNotFound(_0x6b7fc3,null))['then'](respondWithResult(_0x6b7fc3,null))[_0xedb3('0x54')](handleError(_0x6b7fc3,null));};exports[_0xedb3('0x59')]=function(_0x1891a7,_0x279052){return db[_0xedb3('0x3f')][_0xedb3('0x59')](_0x1891a7[_0xedb3('0x5a')],{})[_0xedb3('0x25')](respondWithResult(_0x279052,0xc9))[_0xedb3('0x54')](handleError(_0x279052,null));};exports[_0xedb3('0x5b')]=function(_0x2637d6,_0x318be4){if(_0x2637d6[_0xedb3('0x5a')]['id']){delete _0x2637d6[_0xedb3('0x5a')]['id'];}return db['ChatMessage'][_0xedb3('0x58')]({'where':{'id':_0x2637d6[_0xedb3('0x56')]['id']}})[_0xedb3('0x25')](handleEntityNotFound(_0x318be4,null))[_0xedb3('0x25')](saveUpdates(_0x2637d6['body'],null))[_0xedb3('0x25')](respondWithResult(_0x318be4,null))['catch'](handleError(_0x318be4,null));};exports[_0xedb3('0x39')]=function(_0x272d67,_0x2a368f){return db[_0xedb3('0x3f')][_0xedb3('0x58')]({'where':{'id':_0x272d67[_0xedb3('0x56')]['id']}})[_0xedb3('0x25')](handleEntityNotFound(_0x2a368f,null))[_0xedb3('0x25')](removeEntity(_0x2a368f,null))['catch'](handleError(_0x2a368f,null));};exports[_0xedb3('0x5c')]=function(_0x11064e,_0xfeb8df){return db[_0xedb3('0x3f')]['describe']()['then'](respondWithResult(_0xfeb8df,null))[_0xedb3('0x54')](handleError(_0xfeb8df,null));};var interaction_log=require('../../config/logger')(_0xedb3('0x5d'));exports[_0xedb3('0x5e')]=function(_0x23c9ad,_0x258d43,_0x2d61ac){var _0x102e3f={'channel':_0xedb3('0x5f')};if(_0x23c9ad[_0xedb3('0x5a')]['id']){delete _0x23c9ad['body']['id'];}_0x23c9ad['body'][_0xedb3('0x60')]=!![];_0x23c9ad[_0xedb3('0x5a')][_0xedb3('0x61')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x23c9ad['body'][_0xedb3('0x62')]=_0x23c9ad['body'][_0xedb3('0x62')]||_0x23c9ad[_0xedb3('0x63')]['id'];return db[_0xedb3('0x3f')]['find']({'where':{'id':_0x23c9ad[_0xedb3('0x56')]['id'],'UserId':null},'include':[{'model':db[_0xedb3('0x64')],'as':_0xedb3('0x65')}]})['then'](handleEntityNotFound(_0x258d43,null))['then'](saveUpdates(_0x23c9ad['body'],null))[_0xedb3('0x25')](function(_0x5073fd){if(_0x5073fd){_0x102e3f[_0xedb3('0x2c')]=_0x5073fd['get']({'plain':!![]});return db[_0xedb3('0x66')][_0xedb3('0x58')]({'where':{'id':_0x5073fd['ChatInteractionId']}});}return null;})[_0xedb3('0x25')](handleEntityNotFound(_0x258d43,null))[_0xedb3('0x25')](function(_0x4d0426){if(_0x4d0426){return _0x4d0426[_0xedb3('0x5b')]({'UserId':_0x23c9ad['body'][_0xedb3('0x62')],'read1stAt':_[_0xedb3('0x67')](_0x4d0426[_0xedb3('0x68')])?moment()[_0xedb3('0x69')](_0xedb3('0x6a')):undefined});}return null;})[_0xedb3('0x25')](function(_0x49a32f){if(_0x49a32f){_0x102e3f[_0xedb3('0x6b')]=_0x49a32f[_0xedb3('0x6c')]({'plain':!![]});interaction_log[_0xedb3('0x2d')](_0xedb3('0x6d'),_0x23c9ad[_0xedb3('0x63')]['id'],_0x23c9ad['user'][_0xedb3('0x3b')],_0x23c9ad['user'][_0xedb3('0x6e')],_0x102e3f[_0xedb3('0x6b')]['id'],_0x23c9ad[_0xedb3('0x5a')]?JSON[_0xedb3('0x29')](_0x23c9ad[_0xedb3('0x5a')]):_0xedb3('0x6f'));return respondWithRpcPromise(_0xedb3('0x70'),_0xedb3('0x71'),_0x102e3f);}return null;})['then'](function(_0x24b815){if(_0x24b815){if(_0x23c9ad[_0xedb3('0x5a')][_0xedb3('0x72')]){_0x102e3f['message']['interface']=util[_0xedb3('0x69')](_0xedb3('0x73'),_0x23c9ad[_0xedb3('0x63')][_0xedb3('0x3b')]);_0x102e3f[_0xedb3('0x2c')]['channel']=_0x102e3f[_0xedb3('0x74')];_0x102e3f['message'][_0xedb3('0x75')]=_0xedb3('0x5e');return respondWithRpcPromise(_0xedb3('0x76'),_0xedb3('0x76'),{'event':'acceptmessage','message':_[_0xedb3('0x50')](_0x102e3f[_0xedb3('0x2c')],JSON[_0xedb3('0x77')](_0x102e3f[_0xedb3('0x6b')][_0xedb3('0x78')]))},client9002)[_0xedb3('0x25')](function(){return _0x102e3f;});}return _0x102e3f;}return null;})['then'](respondWithResult(_0x258d43,null))[_0xedb3('0x54')](handleError(_0x258d43,null));};var interaction_log=require(_0xedb3('0x79'))(_0xedb3('0x5d'));exports[_0xedb3('0x7a')]=function(_0x5afcdf,_0x1df5cf,_0x69536e){var _0xd4be04={'agent':{},'channel':_0xedb3('0x5f')};if(_0x5afcdf[_0xedb3('0x5a')]['id']){delete _0x5afcdf[_0xedb3('0x5a')]['id'];}_0x5afcdf['body']['UserId']=_0x5afcdf[_0xedb3('0x5a')][_0xedb3('0x62')]||_0x5afcdf[_0xedb3('0x63')]['id'];_0xd4be04[_0xedb3('0x7b')]['id']=_0x5afcdf['body']['UserId'];return db[_0xedb3('0x3f')][_0xedb3('0x58')]({'where':{'id':_0x5afcdf[_0xedb3('0x56')]['id'],'UserId':null}})[_0xedb3('0x25')](handleEntityNotFound(_0x1df5cf,null))[_0xedb3('0x25')](function(_0x4f21e6){if(_0x4f21e6){_0xd4be04[_0xedb3('0x2c')]=_0x4f21e6[_0xedb3('0x6c')]({'plain':!![]});return db['ChatInteraction'][_0xedb3('0x58')]({'where':{'id':_0x4f21e6[_0xedb3('0x7c')]}});}return null;})[_0xedb3('0x25')](handleEntityNotFound(_0x1df5cf,null))[_0xedb3('0x25')](function(_0xaf16c6){if(_0xaf16c6){_0xd4be04['interaction']=_0xaf16c6[_0xedb3('0x6c')]({'plain':!![]});interaction_log['info'](_0xedb3('0x7d'),_0x5afcdf['user']['id'],_0x5afcdf[_0xedb3('0x63')][_0xedb3('0x3b')],_0x5afcdf[_0xedb3('0x63')]['role'],_0xd4be04[_0xedb3('0x6b')]['id'],_0x5afcdf[_0xedb3('0x5a')]?JSON[_0xedb3('0x29')](_0x5afcdf[_0xedb3('0x5a')]):_0xedb3('0x6f'));return respondWithRpcPromise(_0xedb3('0x7e'),'rejectMessage',_0xd4be04);}return null;})[_0xedb3('0x25')](function(_0x45f4ee){if(_0x45f4ee){_0x45f4ee[_0xedb3('0x2c')][_0xedb3('0x7f')]=util[_0xedb3('0x69')](_0xedb3('0x73'),_0x5afcdf[_0xedb3('0x63')][_0xedb3('0x3b')]);_0x45f4ee[_0xedb3('0x2c')][_0xedb3('0x74')]=_0xd4be04[_0xedb3('0x74')];_0x45f4ee[_0xedb3('0x2c')][_0xedb3('0x75')]='reject';respondWithRpcPromise('EventManager',_0xedb3('0x76'),{'event':_0xedb3('0x80'),'message':_0x45f4ee['message']},client9002);return _0xd4be04;}return null;})[_0xedb3('0x25')](respondWithResult(_0x1df5cf,null))[_0xedb3('0x54')](handleError(_0x1df5cf,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index d0f80b4..8753872 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 _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 +var _0x3697=['exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','hasOwnProperty','hook'];(function(_0x37abe8,_0x59e65d){var _0x4c2670=function(_0x5c5595){while(--_0x5c5595){_0x37abe8['push'](_0x37abe8['shift']());}};_0x4c2670(++_0x59e65d);}(_0x3697,0x15f));var _0x7369=function(_0x8d5013,_0x36cc8d){_0x8d5013=_0x8d5013-0x0;var _0x3798e6=_0x3697[_0x8d5013];return _0x3798e6;};'use strict';var EventEmitter=require(_0x7369('0x0'));var ChatMessage=require(_0x7369('0x1'))['db'][_0x7369('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x7369('0x3')](0x0);var events={'afterCreate':_0x7369('0x4'),'afterUpdate':_0x7369('0x5'),'afterDestroy':_0x7369('0x6')};function emitEvent(_0x185bdd){return function(_0x163d0b,_0x5b47d1,_0x5e70e4){ChatMessageEvents['emit'](_0x185bdd+':'+_0x163d0b['id'],_0x163d0b);ChatMessageEvents['emit'](_0x185bdd,_0x163d0b);_0x5e70e4(null);};}for(var e in events){if(events[_0x7369('0x7')](e)){var event=events[e];ChatMessage[_0x7369('0x8')](e,emitEvent(event));}}module[_0x7369('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index a6bd4fe..4cbfe3d 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 _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 +var _0x0e4d=['ChatInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','ChatMessage','chat_messages','fti_chat_messages','models','toLowerCase','direction','out','isNil','UserId','ChatInteraction','findOne'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0e4d,0x157));var _0xd0e4=function(_0x3ad684,_0x2abdbb){_0x3ad684=_0x3ad684-0x0;var _0x32a22d=_0x0e4d[_0x3ad684];return _0x32a22d;};'use strict';var _=require(_0xd0e4('0x0'));var util=require('util');var logger=require(_0xd0e4('0x1'))(_0xd0e4('0x2'));var moment=require(_0xd0e4('0x3'));var BPromise=require(_0xd0e4('0x4'));var rp=require(_0xd0e4('0x5'));var fs=require('fs');var path=require(_0xd0e4('0x6'));var rimraf=require(_0xd0e4('0x7'));var config=require(_0xd0e4('0x8'));var attributes=require('./chatMessage.attributes');module[_0xd0e4('0x9')]=function(_0x2e3bfd,_0x3e9d25){return _0x2e3bfd['define'](_0xd0e4('0xa'),attributes,{'tableName':_0xd0e4('0xb'),'paranoid':![],'indexes':[{'name':_0xd0e4('0xc'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f8ef6,_0x1e8681,_0x142fc0){var _0x1cfd08=_0x2e3bfd[_0xd0e4('0xd')];var _0xc97924=_0x1f8ef6['get']({'plain':!![]});if(_0xc97924['direction'][_0xd0e4('0xe')]()==='in'||_0xc97924[_0xd0e4('0xf')][_0xd0e4('0xe')]()===_0xd0e4('0x10')&&!_0xc97924['secret']&&!_[_0xd0e4('0x11')](_0xc97924[_0xd0e4('0x12')])){_0x1cfd08[_0xd0e4('0x13')][_0xd0e4('0x14')]({'where':{'id':_0xc97924[_0xd0e4('0x15')]}})[_0xd0e4('0x16')](function(_0x46e0f4){if(_0x46e0f4){_0x46e0f4['update']({'lastMsgAt':_0xc97924[_0xd0e4('0x17')],'lastMsgDirection':_0xc97924['direction']['toLowerCase']()});}})[_0xd0e4('0x18')](function(_0x1b2102){console[_0xd0e4('0x19')](_0x1b2102);});}_0x142fc0();}},'charset':_0xd0e4('0x1a'),'collate':_0xd0e4('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 4061a0e..4664a1a 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 _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 +var _0xf7e9=['http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','catch','ChatMessage','create','body','options','raw','CreateChatMessage','lodash','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2bb92f,_0x2eb742){var _0x26a335=function(_0x2be158){while(--_0x2be158){_0x2bb92f['push'](_0x2bb92f['shift']());}};_0x26a335(++_0x2eb742);}(_0xf7e9,0x1a4));var _0x9f7e=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0xf7e9[_0x485b5a];return _0xd2b34d;};'use strict';var _=require(_0x9f7e('0x0'));var util=require(_0x9f7e('0x1'));var moment=require(_0x9f7e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9f7e('0x3'));var logger=require(_0x9f7e('0x4'))(_0x9f7e('0x5'));var config=require(_0x9f7e('0x6'));var jayson=require(_0x9f7e('0x7'));var client=jayson[_0x9f7e('0x8')][_0x9f7e('0x9')]({'port':0x232a});config[_0x9f7e('0xa')]=_[_0x9f7e('0xb')](config[_0x9f7e('0xa')],{'host':_0x9f7e('0xc'),'port':0x18eb});var socket=require(_0x9f7e('0xd'))(new Redis(config[_0x9f7e('0xa')]));require('./chatMessage.socket')[_0x9f7e('0xe')](socket);function respondWithRpcPromise(_0x1949d9,_0x1a3cac,_0xb23bcc){return new BPromise(function(_0x34f6bb,_0x25f047){return client[_0x9f7e('0xf')](_0x1949d9,_0xb23bcc)[_0x9f7e('0x10')](function(_0x5cd250){logger[_0x9f7e('0x11')]('ChatMessage,\x20%s,\x20%s',_0x1a3cac,_0x9f7e('0x12'));logger[_0x9f7e('0x13')](_0x9f7e('0x14'),_0x1a3cac,'request\x20sent',JSON[_0x9f7e('0x15')](_0x5cd250));if(_0x5cd250[_0x9f7e('0x16')]){if(_0x5cd250[_0x9f7e('0x16')][_0x9f7e('0x17')]===0x1f4){logger[_0x9f7e('0x16')](_0x9f7e('0x18'),_0x1a3cac,_0x5cd250[_0x9f7e('0x16')][_0x9f7e('0x19')]);return _0x25f047(_0x5cd250['error'][_0x9f7e('0x19')]);}logger[_0x9f7e('0x16')]('ChatMessage,\x20%s,\x20%s',_0x1a3cac,_0x5cd250[_0x9f7e('0x16')][_0x9f7e('0x19')]);return _0x34f6bb(_0x5cd250[_0x9f7e('0x16')][_0x9f7e('0x19')]);}else{logger[_0x9f7e('0x11')](_0x9f7e('0x18'),_0x1a3cac,_0x9f7e('0x12'));_0x34f6bb(_0x5cd250['result']['message']);}})[_0x9f7e('0x1a')](function(_0x5b6738){logger[_0x9f7e('0x16')](_0x9f7e('0x18'),_0x1a3cac,_0x5b6738);_0x25f047(_0x5b6738);});});}exports['CreateChatMessage']=function(_0x2ce78e){var _0x211e55=this;return new Promise(function(_0x5c412e,_0x286489){return db[_0x9f7e('0x1b')][_0x9f7e('0x1c')](_0x2ce78e[_0x9f7e('0x1d')],{'raw':_0x2ce78e[_0x9f7e('0x1e')]?_0x2ce78e[_0x9f7e('0x1e')][_0x9f7e('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x346484){logger[_0x9f7e('0x11')](_0x9f7e('0x20'),_0x2ce78e);logger[_0x9f7e('0x13')](_0x9f7e('0x20'),_0x2ce78e,JSON[_0x9f7e('0x15')](_0x346484));_0x5c412e(_0x346484);})[_0x9f7e('0x1a')](function(_0x23903c){logger[_0x9f7e('0x16')]('CreateChatMessage',_0x23903c[_0x9f7e('0x19')],_0x2ce78e);_0x286489(_0x211e55[_0x9f7e('0x16')](0x1f4,_0x23903c[_0x9f7e('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 7865472..4bb6d98 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 _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 +var _0x326f=['update','emit','removeListener','register','length','./chatMessage.events'];(function(_0x172a7b,_0x1e9c9f){var _0x1eeb0a=function(_0x326b31){while(--_0x326b31){_0x172a7b['push'](_0x172a7b['shift']());}};_0x1eeb0a(++_0x1e9c9f);}(_0x326f,0xd1));var _0xf326=function(_0x409c55,_0x468efe){_0x409c55=_0x409c55-0x0;var _0x4ac250=_0x326f[_0x409c55];return _0x4ac250;};'use strict';var ChatMessageEvents=require(_0xf326('0x0'));var events=['save','remove',_0xf326('0x1')];function createListener(_0x330ddb,_0x22aabf){return function(_0x408257){_0x22aabf[_0xf326('0x2')](_0x330ddb,_0x408257);};}function removeListener(_0x120a26,_0x9445c6){return function(){ChatMessageEvents[_0xf326('0x3')](_0x120a26,_0x9445c6);};}exports[_0xf326('0x4')]=function(_0x3ace29){for(var _0x4c2249=0x0,_0x3c254d=events[_0xf326('0x5')];_0x4c2249<_0x3c254d;_0x4c2249++){var _0x165f95=events[_0x4c2249];var _0x1e7b8a=createListener('chatMessage:'+_0x165f95,_0x3ace29);ChatMessageEvents['on'](_0x165f95,_0x1e7b8a);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 0fea2ba..add2783 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 _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 +var _0xcd0d=['/:id','show','post','tracked','chatmessage:create','create','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','/describe'];(function(_0x182fff,_0x568aee){var _0x1b4171=function(_0x212d46){while(--_0x212d46){_0x182fff['push'](_0x182fff['shift']());}};_0x1b4171(++_0x568aee);}(_0xcd0d,0xf8));var _0xdcd0=function(_0x362e87,_0x38d17c){_0x362e87=_0x362e87-0x0;var _0x334244=_0xcd0d[_0x362e87];return _0x334244;};'use strict';var multer=require(_0xdcd0('0x0'));var util=require(_0xdcd0('0x1'));var path=require(_0xdcd0('0x2'));var timeout=require('connect-timeout');var express=require(_0xdcd0('0x3'));var router=express[_0xdcd0('0x4')]();var auth=require(_0xdcd0('0x5'));var interaction=require(_0xdcd0('0x6'));var config=require(_0xdcd0('0x7'));var controller=require(_0xdcd0('0x8'));router[_0xdcd0('0x9')]('/',auth[_0xdcd0('0xa')](),controller['index']);router[_0xdcd0('0x9')](_0xdcd0('0xb'),auth[_0xdcd0('0xa')](),controller['describe']);router[_0xdcd0('0x9')](_0xdcd0('0xc'),auth['isAuthenticated'](),controller[_0xdcd0('0xd')]);router[_0xdcd0('0xe')]('/',auth[_0xdcd0('0xa')](),interaction[_0xdcd0('0xf')]('chat',_0xdcd0('0x10')),controller[_0xdcd0('0x11')]);router[_0xdcd0('0x12')]('/:id',controller[_0xdcd0('0x13')]);router[_0xdcd0('0x12')](_0xdcd0('0x14'),auth[_0xdcd0('0xa')](),controller['accept']);router[_0xdcd0('0x12')](_0xdcd0('0x15'),auth['isAuthenticated'](),controller[_0xdcd0('0x16')]);router[_0xdcd0('0x17')]('/:id',auth[_0xdcd0('0xa')](),controller[_0xdcd0('0x18')]);module[_0xdcd0('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 f37c9b6..332e5de 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 _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 +var _0x3586=['TEXT','sequelize','exports'];(function(_0x60337,_0x163a14){var _0x48e690=function(_0x570685){while(--_0x570685){_0x60337['push'](_0x60337['shift']());}};_0x48e690(++_0x163a14);}(_0x3586,0x1d2));var _0x6358=function(_0x370338,_0x4178ec){_0x370338=_0x370338-0x0;var _0x2e10df=_0x3586[_0x370338];return _0x2e10df;};'use strict';var Sequelize=require(_0x6358('0x0'));module[_0x6358('0x1')]={'body':{'type':Sequelize[_0x6358('0x2')]('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index e60ddfc..ba2568c 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 _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 +var _0x723e=['util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','end','stack','name','send','map','ChatOfflineMessage','fieldName','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x487f15,_0x1cf5fb){var _0x32c8a1=function(_0x255c2f){while(--_0x255c2f){_0x487f15['push'](_0x487f15['shift']());}};_0x32c8a1(++_0x1cf5fb);}(_0x723e,0x179));var _0xe723=function(_0xd4d369,_0x4f6ad2){_0xd4d369=_0xd4d369-0x0;var _0x293e5d=_0x723e[_0xd4d369];return _0x293e5d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe723('0x0'));var rimraf=require(_0xe723('0x1'));var zipdir=require(_0xe723('0x2'));var jsonpatch=require(_0xe723('0x3'));var rp=require(_0xe723('0x4'));var moment=require(_0xe723('0x5'));var BPromise=require(_0xe723('0x6'));var Mustache=require(_0xe723('0x7'));var util=require(_0xe723('0x8'));var path=require(_0xe723('0x9'));var sox=require('sox');var csv=require(_0xe723('0xa'));var ejs=require(_0xe723('0xb'));var fs=require('fs');var _=require(_0xe723('0xc'));var squel=require(_0xe723('0xd'));var crypto=require(_0xe723('0xe'));var jsforce=require(_0xe723('0xf'));var deskjs=require(_0xe723('0x10'));var toCsv=require(_0xe723('0xa'));var querystring=require('querystring');var Papa=require(_0xe723('0x11'));var Redis=require(_0xe723('0x12'));var authService=require(_0xe723('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe723('0x14'));var hardwareService=require(_0xe723('0x15'));var logger=require(_0xe723('0x16'))('api');var utils=require(_0xe723('0x17'));var config=require(_0xe723('0x18'));var db=require(_0xe723('0x19'))['db'];function respondWithStatusCode(_0x293f66,_0x236b69){_0x236b69=_0x236b69||0xcc;return function(_0x5c066c){if(_0x5c066c){return _0x293f66[_0xe723('0x1a')](_0x236b69);}return _0x293f66['status'](_0x236b69)['end']();};}function respondWithResult(_0x5201f2,_0x57bc0e){_0x57bc0e=_0x57bc0e||0xc8;return function(_0x75c12c){if(_0x75c12c){return _0x5201f2[_0xe723('0x1b')](_0x57bc0e)[_0xe723('0x1c')](_0x75c12c);}};}function respondWithFilteredResult(_0x2b010b,_0xf29a39){return function(_0x5aec97){if(_0x5aec97){var _0x23d0b2=_0x5aec97[_0xe723('0x1d')],_0xbf5ca3=_0xf29a39[_0xe723('0x1e')],_0xb8f1d=_0xf29a39[_0xe723('0x1e')]+_0xf29a39[_0xe723('0x1f')],_0x2ec702;if(_0xb8f1d>=_0x23d0b2){_0xb8f1d=_0x23d0b2;_0x2ec702=0xc8;}else{_0x2ec702=0xce;}_0x2b010b[_0xe723('0x1b')](_0x2ec702);return _0x2b010b[_0xe723('0x20')](_0xe723('0x21'),_0xbf5ca3+'-'+_0xb8f1d+'/'+_0x23d0b2)[_0xe723('0x1c')](_0x5aec97);}return null;};}function patchUpdates(_0x262a8d){return function(_0x367782){try{jsonpatch['apply'](_0x367782,_0x262a8d,!![]);}catch(_0x5b2308){return BPromise[_0xe723('0x22')](_0x5b2308);}return _0x367782[_0xe723('0x23')]();};}function saveUpdates(_0x487058,_0x28caca){return function(_0x2762e2){if(_0x2762e2){return _0x2762e2['update'](_0x487058)[_0xe723('0x24')](function(_0x52fe6e){return _0x52fe6e;});}return null;};}function removeEntity(_0x3296cc,_0x43ccfc){return function(_0x3b82b2){if(_0x3b82b2){return _0x3b82b2[_0xe723('0x25')]()[_0xe723('0x24')](function(){_0x3296cc[_0xe723('0x1b')](0xcc)[_0xe723('0x26')]();});}};}function handleEntityNotFound(_0x15196c,_0x1228f2){return function(_0x19bd0c){if(!_0x19bd0c){_0x15196c[_0xe723('0x1a')](0x194);}return _0x19bd0c;};}function handleError(_0x47dcf7,_0x5c4fb4){_0x5c4fb4=_0x5c4fb4||0x1f4;return function(_0x384786){logger['error'](_0x384786[_0xe723('0x27')]);if(_0x384786[_0xe723('0x28')]){delete _0x384786[_0xe723('0x28')];}_0x47dcf7[_0xe723('0x1b')](_0x5c4fb4)[_0xe723('0x29')](_0x384786);};}exports['index']=function(_0x2925bc,_0x52feb9){var _0x52f919={},_0x15911d={},_0x511c74={'count':0x0,'rows':[]};var _0x3e6bc0=_[_0xe723('0x2a')](db[_0xe723('0x2b')]['rawAttributes'],function(_0x1edbb2){return{'name':_0x1edbb2[_0xe723('0x2c')],'type':_0x1edbb2['type'][_0xe723('0x2d')]};});_0x15911d['model']=_['map'](_0x3e6bc0,_0xe723('0x28'));_0x15911d[_0xe723('0x2e')]=_[_0xe723('0x2f')](_0x2925bc[_0xe723('0x2e')]);_0x15911d['filters']=_['intersection'](_0x15911d[_0xe723('0x30')],_0x15911d['query']);_0x52f919[_0xe723('0x31')]=_[_0xe723('0x32')](_0x15911d[_0xe723('0x30')],qs[_0xe723('0x33')](_0x2925bc[_0xe723('0x2e')][_0xe723('0x33')]));_0x52f919[_0xe723('0x31')]=_0x52f919[_0xe723('0x31')][_0xe723('0x34')]?_0x52f919[_0xe723('0x31')]:_0x15911d[_0xe723('0x30')];if(!_0x2925bc[_0xe723('0x2e')][_0xe723('0x35')](_0xe723('0x36'))){_0x52f919['limit']=qs[_0xe723('0x1f')](_0x2925bc['query'][_0xe723('0x1f')]);_0x52f919[_0xe723('0x1e')]=qs['offset'](_0x2925bc['query'][_0xe723('0x1e')]);}_0x52f919[_0xe723('0x37')]=qs[_0xe723('0x38')](_0x2925bc[_0xe723('0x2e')][_0xe723('0x38')]);_0x52f919[_0xe723('0x39')]=qs['filters'](_[_0xe723('0x3a')](_0x2925bc[_0xe723('0x2e')],_0x15911d[_0xe723('0x3b')]),_0x3e6bc0);if(_0x2925bc[_0xe723('0x2e')][_0xe723('0x3c')]){_0x52f919[_0xe723('0x39')]=_[_0xe723('0x3d')](_0x52f919[_0xe723('0x39')],{'$or':_[_0xe723('0x2a')](_0x3e6bc0,function(_0x3dca81){if(_0x3dca81[_0xe723('0x3e')]!==_0xe723('0x3f')){var _0x22a4ea={};_0x22a4ea[_0x3dca81[_0xe723('0x28')]]={'$like':'%'+_0x2925bc[_0xe723('0x2e')][_0xe723('0x3c')]+'%'};return _0x22a4ea;}})});}_0x52f919=_['merge']({},_0x52f919,_0x2925bc[_0xe723('0x40')]);var _0x29c148={'where':_0x52f919[_0xe723('0x39')]};return db[_0xe723('0x2b')]['count'](_0x29c148)['then'](function(_0x105233){_0x511c74[_0xe723('0x1d')]=_0x105233;if(_0x2925bc[_0xe723('0x2e')][_0xe723('0x41')]){_0x52f919['include']=[{'all':!![]}];}return db['ChatOfflineMessage'][_0xe723('0x42')](_0x52f919);})[_0xe723('0x24')](function(_0x24909){_0x511c74[_0xe723('0x43')]=_0x24909;return _0x511c74;})[_0xe723('0x24')](respondWithFilteredResult(_0x52feb9,_0x52f919))[_0xe723('0x44')](handleError(_0x52feb9,null));};exports[_0xe723('0x45')]=function(_0x2b74d5,_0x637b5f){var _0x5b0c89={'raw':!![],'where':{'id':_0x2b74d5[_0xe723('0x46')]['id']}},_0x490993={};_0x490993['model']=_['keys'](db[_0xe723('0x2b')]['rawAttributes']);_0x490993[_0xe723('0x2e')]=_[_0xe723('0x2f')](_0x2b74d5[_0xe723('0x2e')]);_0x490993[_0xe723('0x3b')]=_[_0xe723('0x32')](_0x490993[_0xe723('0x30')],_0x490993[_0xe723('0x2e')]);_0x5b0c89['attributes']=_['intersection'](_0x490993[_0xe723('0x30')],qs['fields'](_0x2b74d5[_0xe723('0x2e')]['fields']));_0x5b0c89[_0xe723('0x31')]=_0x5b0c89[_0xe723('0x31')][_0xe723('0x34')]?_0x5b0c89[_0xe723('0x31')]:_0x490993[_0xe723('0x30')];if(_0x2b74d5[_0xe723('0x2e')][_0xe723('0x41')]){_0x5b0c89[_0xe723('0x47')]=[{'all':!![]}];}_0x5b0c89=_[_0xe723('0x3d')]({},_0x5b0c89,_0x2b74d5['options']);return db['ChatOfflineMessage'][_0xe723('0x48')](_0x5b0c89)[_0xe723('0x24')](handleEntityNotFound(_0x637b5f,null))[_0xe723('0x24')](respondWithResult(_0x637b5f,null))['catch'](handleError(_0x637b5f,null));};exports['create']=function(_0x5a4612,_0xf25d94){return db[_0xe723('0x2b')][_0xe723('0x49')](_0x5a4612['body'],{})[_0xe723('0x24')](respondWithResult(_0xf25d94,0xc9))[_0xe723('0x44')](handleError(_0xf25d94,null));};exports[_0xe723('0x4a')]=function(_0x38bd1a,_0x15bfd0){if(_0x38bd1a['body']['id']){delete _0x38bd1a[_0xe723('0x4b')]['id'];}return db['ChatOfflineMessage'][_0xe723('0x48')]({'where':{'id':_0x38bd1a['params']['id']}})['then'](handleEntityNotFound(_0x15bfd0,null))[_0xe723('0x24')](saveUpdates(_0x38bd1a[_0xe723('0x4b')],null))[_0xe723('0x24')](respondWithResult(_0x15bfd0,null))['catch'](handleError(_0x15bfd0,null));};exports[_0xe723('0x25')]=function(_0x505966,_0x467cbd){return db[_0xe723('0x2b')][_0xe723('0x48')]({'where':{'id':_0x505966[_0xe723('0x46')]['id']}})[_0xe723('0x24')](handleEntityNotFound(_0x467cbd,null))[_0xe723('0x24')](removeEntity(_0x467cbd,null))[_0xe723('0x44')](handleError(_0x467cbd,null));};exports[_0xe723('0x4c')]=function(_0x1bf58b,_0x51eaa2){return db[_0xe723('0x2b')][_0xe723('0x4c')]()['then'](respondWithResult(_0x51eaa2,null))[_0xe723('0x44')](handleError(_0x51eaa2,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 77dbc7c..514eaf5 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 _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 +var _0xf873=['bluebird','request-promise','path','rimraf','../../config/environment','exports','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf873,0xb2));var _0x3f87=function(_0x350c9d,_0x2b5aa3){_0x350c9d=_0x350c9d-0x0;var _0x3f5e8e=_0xf873[_0x350c9d];return _0x3f5e8e;};'use strict';var _=require('lodash');var util=require(_0x3f87('0x0'));var logger=require(_0x3f87('0x1'))(_0x3f87('0x2'));var moment=require(_0x3f87('0x3'));var BPromise=require(_0x3f87('0x4'));var rp=require(_0x3f87('0x5'));var fs=require('fs');var path=require(_0x3f87('0x6'));var rimraf=require(_0x3f87('0x7'));var config=require(_0x3f87('0x8'));var attributes=require('./chatOfflineMessage.attributes');module[_0x3f87('0x9')]=function(_0x43c8e4,_0x27c03e){return _0x43c8e4['define'](_0x3f87('0xa'),attributes,{'tableName':_0x3f87('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3f87('0xc'),'collate':_0x3f87('0xd')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 279f416..925ead6 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 _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 +var _0x7440=['catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7440,0xb5));var _0x0744=function(_0x431ddc,_0x50f976){_0x431ddc=_0x431ddc-0x0;var _0x461e22=_0x7440[_0x431ddc];return _0x461e22;};'use strict';var _=require(_0x0744('0x0'));var util=require(_0x0744('0x1'));var moment=require(_0x0744('0x2'));var BPromise=require('bluebird');var rs=require(_0x0744('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0744('0x4'))['db'];var utils=require(_0x0744('0x5'));var logger=require('../../config/logger')(_0x0744('0x6'));var config=require('../../config/environment');var jayson=require(_0x0744('0x7'));var client=jayson[_0x0744('0x8')][_0x0744('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ec06e,_0x3fbe38,_0x82ba73){return new BPromise(function(_0x6c6d8d,_0x220f23){return client['request'](_0x1ec06e,_0x82ba73)['then'](function(_0x377e5e){logger[_0x0744('0xa')](_0x0744('0xb'),_0x3fbe38,_0x0744('0xc'));logger['debug'](_0x0744('0xd'),_0x3fbe38,_0x0744('0xc'),JSON[_0x0744('0xe')](_0x377e5e));if(_0x377e5e[_0x0744('0xf')]){if(_0x377e5e['error']['code']===0x1f4){logger[_0x0744('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3fbe38,_0x377e5e[_0x0744('0xf')]['message']);return _0x220f23(_0x377e5e['error'][_0x0744('0x10')]);}logger[_0x0744('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3fbe38,_0x377e5e['error'][_0x0744('0x10')]);return _0x6c6d8d(_0x377e5e[_0x0744('0xf')][_0x0744('0x10')]);}else{logger[_0x0744('0xa')](_0x0744('0xb'),_0x3fbe38,_0x0744('0xc'));_0x6c6d8d(_0x377e5e['result'][_0x0744('0x10')]);}})[_0x0744('0x11')](function(_0x457d07){logger[_0x0744('0xf')](_0x0744('0xb'),_0x3fbe38,_0x457d07);_0x220f23(_0x457d07);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 2d183c5..9669b4b 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 _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 +var _0xb0eb=['../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','express','Router','../../components/auth/service'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xb0eb,0x151));var _0xbb0e=function(_0x2d0a25,_0x3d5ee0){_0x2d0a25=_0x2d0a25-0x0;var _0x5266ea=_0xb0eb[_0x2d0a25];return _0x5266ea;};'use strict';var multer=require(_0xbb0e('0x0'));var util=require(_0xbb0e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbb0e('0x2'));var router=express[_0xbb0e('0x3')]();var auth=require(_0xbb0e('0x4'));var interaction=require(_0xbb0e('0x5'));var config=require('../../config/environment');var controller=require(_0xbb0e('0x6'));router[_0xbb0e('0x7')]('/',auth[_0xbb0e('0x8')](),controller[_0xbb0e('0x9')]);router['get']('/describe',auth[_0xbb0e('0x8')](),controller[_0xbb0e('0xa')]);router[_0xbb0e('0x7')](_0xbb0e('0xb'),auth[_0xbb0e('0x8')](),controller[_0xbb0e('0xc')]);router[_0xbb0e('0xd')]('/',auth[_0xbb0e('0x8')](),controller[_0xbb0e('0xe')]);router[_0xbb0e('0xf')](_0xbb0e('0xb'),auth[_0xbb0e('0x8')](),controller[_0xbb0e('0x10')]);router['delete'](_0xbb0e('0xb'),auth['isAuthenticated'](),controller[_0xbb0e('0x11')]);module[_0xbb0e('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index a1f436d..3e1fdc0 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 _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 +var _0x14b9=['STRING','ENUM','timeout','mouseOver','INTEGER','sequelize','exports'];(function(_0x48c9fe,_0x5f0300){var _0x540658=function(_0x47cb66){while(--_0x47cb66){_0x48c9fe['push'](_0x48c9fe['shift']());}};_0x540658(++_0x5f0300);}(_0x14b9,0x98));var _0x914b=function(_0x157e57,_0x30b9f0){_0x157e57=_0x157e57-0x0;var _0x20db26=_0x14b9[_0x157e57];return _0x20db26;};'use strict';var Sequelize=require(_0x914b('0x0'));module[_0x914b('0x1')]={'name':{'type':Sequelize[_0x914b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x914b('0x3')]('mouseOver',_0x914b('0x4')),'defaultValue':_0x914b('0x5')},'selector':{'type':Sequelize[_0x914b('0x2')]},'timeout':{'type':Sequelize[_0x914b('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 76af0e1..95f2aa2 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 _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 +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(_0xc91ccd,_0x28f968){var _0x28c08e=function(_0x593eef){while(--_0x593eef){_0xc91ccd['push'](_0xc91ccd['shift']());}};_0x28c08e(++_0x28f968);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'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 diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 201eab6..d902ed7 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 _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 +var _0x2b10=['request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions','util','../../config/logger','api','moment','bluebird'];(function(_0x2ef608,_0x53a7b1){var _0x56aa07=function(_0x318e2b){while(--_0x318e2b){_0x2ef608['push'](_0x2ef608['shift']());}};_0x56aa07(++_0x53a7b1);}(_0x2b10,0xa4));var _0x02b1=function(_0x4d4c21,_0x1f8ed0){_0x4d4c21=_0x4d4c21-0x0;var _0x36e683=_0x2b10[_0x4d4c21];return _0x36e683;};'use strict';var _=require('lodash');var util=require(_0x02b1('0x0'));var logger=require(_0x02b1('0x1'))(_0x02b1('0x2'));var moment=require(_0x02b1('0x3'));var BPromise=require(_0x02b1('0x4'));var rp=require(_0x02b1('0x5'));var fs=require('fs');var path=require(_0x02b1('0x6'));var rimraf=require(_0x02b1('0x7'));var config=require(_0x02b1('0x8'));var attributes=require(_0x02b1('0x9'));module[_0x02b1('0xa')]=function(_0x121657,_0x54bfe1){return _0x121657['define'](_0x02b1('0xb'),attributes,{'tableName':_0x02b1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index d9b89d4..03a35f6 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 _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 +var _0xe0c0=['http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x381900,_0x2d2804){var _0x54da53=function(_0x56d214){while(--_0x56d214){_0x381900['push'](_0x381900['shift']());}};_0x54da53(++_0x2d2804);}(_0xe0c0,0xe8));var _0x0e0c=function(_0x1a91f8,_0xc4c9cc){_0x1a91f8=_0x1a91f8-0x0;var _0x466288=_0xe0c0[_0x1a91f8];return _0x466288;};'use strict';var _=require('lodash');var util=require(_0x0e0c('0x0'));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(_0x0e0c('0x5'))['db'];var utils=require(_0x0e0c('0x6'));var logger=require(_0x0e0c('0x7'))(_0x0e0c('0x8'));var config=require('../../config/environment');var jayson=require(_0x0e0c('0x9'));var client=jayson['client'][_0x0e0c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cbcc7,_0x443215,_0x3c7a95){return new BPromise(function(_0x514f5b,_0x30b4c7){return client[_0x0e0c('0xb')](_0x2cbcc7,_0x3c7a95)[_0x0e0c('0xc')](function(_0x44f6b4){logger[_0x0e0c('0xd')](_0x0e0c('0xe'),_0x443215,_0x0e0c('0xf'));logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x443215,'request\x20sent',JSON[_0x0e0c('0x10')](_0x44f6b4));if(_0x44f6b4[_0x0e0c('0x11')]){if(_0x44f6b4[_0x0e0c('0x11')][_0x0e0c('0x12')]===0x1f4){logger[_0x0e0c('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x443215,_0x44f6b4[_0x0e0c('0x11')][_0x0e0c('0x13')]);return _0x30b4c7(_0x44f6b4[_0x0e0c('0x11')]['message']);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x443215,_0x44f6b4[_0x0e0c('0x11')][_0x0e0c('0x13')]);return _0x514f5b(_0x44f6b4['error']['message']);}else{logger[_0x0e0c('0xd')](_0x0e0c('0xe'),_0x443215,'request\x20sent');_0x514f5b(_0x44f6b4[_0x0e0c('0x14')][_0x0e0c('0x13')]);}})[_0x0e0c('0x15')](function(_0x5d5f2c){logger[_0x0e0c('0x11')](_0x0e0c('0xe'),_0x443215,_0x5d5f2c);_0x30b4c7(_0x5d5f2c);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 9c2a3af..c7f3e77 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 _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 +var _0x544f=['get','/:id','isAuthenticated','show','create','delete','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5d951c,_0x22a120){var _0x4d2053=function(_0x1f1f8a){while(--_0x1f1f8a){_0x5d951c['push'](_0x5d951c['shift']());}};_0x4d2053(++_0x22a120);}(_0x544f,0xbc));var _0xf544=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x544f[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xf544('0x0'));var util=require(_0xf544('0x1'));var path=require(_0xf544('0x2'));var timeout=require('connect-timeout');var express=require(_0xf544('0x3'));var router=express[_0xf544('0x4')]();var auth=require(_0xf544('0x5'));var interaction=require(_0xf544('0x6'));var config=require('../../config/environment');var controller=require('./chatProactiveAction.controller');router[_0xf544('0x7')](_0xf544('0x8'),auth[_0xf544('0x9')](),controller[_0xf544('0xa')]);router['post']('/',auth[_0xf544('0x9')](),controller[_0xf544('0xb')]);router['put'](_0xf544('0x8'),auth[_0xf544('0x9')](),controller['update']);router[_0xf544('0xc')](_0xf544('0x8'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 8ce41e9..9e8c03f 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 _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 +var _0x1cb0=['rrmemory','beepall','roundrobin','exports','STRING','INTEGER','ENUM'];(function(_0x480849,_0x26e305){var _0x5e72fd=function(_0x46503b){while(--_0x46503b){_0x480849['push'](_0x480849['shift']());}};_0x5e72fd(++_0x26e305);}(_0x1cb0,0x1b5));var _0x01cb=function(_0x1b6ac8,_0x4c90f2){_0x1b6ac8=_0x1b6ac8-0x0;var _0x36bec8=_0x1cb0[_0x1b6ac8];return _0x36bec8;};'use strict';var Sequelize=require('sequelize');module[_0x01cb('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x01cb('0x1')]},'timeout':{'type':Sequelize[_0x01cb('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x01cb('0x3')](_0x01cb('0x4'),_0x01cb('0x5'),_0x01cb('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 370057a..98235b0 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 _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 +var _0x76de=['error','message','info','result','catch','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','destroy','get','ChatQueues','name','send','index','map','ChatQueue','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','nolimit','offset','order','sort','where','pick','merge','filter','options','rows','params','filters','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','describe','findOne','UserChatQueue','hasOwnProperty','ChatQueueId','findAll','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','forEach','emit','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','userChatQueue:remove','addAgents','spread','userChatQueue:save','getAgents','html-pdf','eml-format','rimraf','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','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','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1afabf,_0x56fdcc){var _0x497ff1=function(_0x2f6104){while(--_0x2f6104){_0x1afabf['push'](_0x1afabf['shift']());}};_0x497ff1(++_0x56fdcc);}(_0x76de,0x193));var _0xe76d=function(_0x137655,_0x2a8c11){_0x137655=_0x137655-0x0;var _0x4326ce=_0x76de[_0x137655];return _0x4326ce;};'use strict';var pdf=require(_0xe76d('0x0'));var emlformat=require(_0xe76d('0x1'));var rimraf=require(_0xe76d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe76d('0x3'));var path=require(_0xe76d('0x4'));var sox=require(_0xe76d('0x5'));var csv=require(_0xe76d('0x6'));var ejs=require(_0xe76d('0x7'));var fs=require('fs');var _=require(_0xe76d('0x8'));var squel=require(_0xe76d('0x9'));var crypto=require(_0xe76d('0xa'));var jsforce=require(_0xe76d('0xb'));var deskjs=require(_0xe76d('0xc'));var toCsv=require(_0xe76d('0x6'));var querystring=require('querystring');var Papa=require(_0xe76d('0xd'));var Redis=require(_0xe76d('0xe'));var authService=require(_0xe76d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe76d('0x10'));var hardwareService=require(_0xe76d('0x11'));var logger=require('../../config/logger')(_0xe76d('0x12'));var utils=require(_0xe76d('0x13'));var config=require(_0xe76d('0x14'));var db=require(_0xe76d('0x15'))['db'];config[_0xe76d('0x16')]=_['defaults'](config['redis'],{'host':_0xe76d('0x17'),'port':0x18eb});var socket=require(_0xe76d('0x18'))(new Redis(config[_0xe76d('0x16')]));require('./chatQueue.socket')[_0xe76d('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0xe76d('0x1a')][_0xe76d('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x10ba7c,_0x8e1802,_0x886490){if(_0x886490){var _0x26e193=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x26e193[_0xe76d('0x1c')](_0x8e1802)){return _0x10ba7c;}else{throw new db['Sequelize'][(_0xe76d('0x1d'))](_0xe76d('0x1e'));}}else{return _0x10ba7c;}}function respondWithRpcPromise(_0x4feb4d,_0x455b49,_0x6c52bf,_0x439a64){return new BPromise(function(_0xbe25e1,_0x51f6a6){var _0x373db5=_0x439a64||client;return _0x373db5[_0xe76d('0x1f')](_0x4feb4d,_0x6c52bf)[_0xe76d('0x20')](function(_0x3c97f8){logger['info'](_0xe76d('0x21'),_0x455b49,_0xe76d('0x22'));logger[_0xe76d('0x23')](_0xe76d('0x24'),_0x455b49,_0xe76d('0x22'),JSON[_0xe76d('0x25')](_0x3c97f8));if(_0x3c97f8[_0xe76d('0x26')]){if(_0x3c97f8[_0xe76d('0x26')]['code']===0x1f4){logger[_0xe76d('0x26')](_0xe76d('0x21'),_0x455b49,_0x3c97f8['error'][_0xe76d('0x27')]);return _0x51f6a6(_0x3c97f8[_0xe76d('0x26')][_0xe76d('0x27')]);}logger[_0xe76d('0x26')]('ChatQueue,\x20%s,\x20%s',_0x455b49,_0x3c97f8[_0xe76d('0x26')]['message']);return _0xbe25e1(_0x3c97f8[_0xe76d('0x26')]['message']);}else{logger[_0xe76d('0x28')]('ChatQueue,\x20%s,\x20%s',_0x455b49,_0xe76d('0x22'));_0xbe25e1(_0x3c97f8[_0xe76d('0x29')][_0xe76d('0x27')]);}})[_0xe76d('0x2a')](function(_0x40eb97){logger['error'](_0xe76d('0x21'),_0x455b49,_0x40eb97);_0x51f6a6(_0x40eb97);});});}function respondWithStatusCode(_0x23a0cd,_0x2a6b90){_0x2a6b90=_0x2a6b90||0xcc;return function(_0x2db5a7){if(_0x2db5a7){return _0x23a0cd[_0xe76d('0x2b')](_0x2a6b90);}return _0x23a0cd[_0xe76d('0x2c')](_0x2a6b90)[_0xe76d('0x2d')]();};}function respondWithResult(_0x31246d,_0x40a17e){_0x40a17e=_0x40a17e||0xc8;return function(_0x3a99b6){if(_0x3a99b6){return _0x31246d[_0xe76d('0x2c')](_0x40a17e)[_0xe76d('0x2e')](_0x3a99b6);}};}function respondWithFilteredResult(_0x2d6c15,_0x5827ec){return function(_0x3b9702){if(_0x3b9702){var _0x3719a2=_0x3b9702[_0xe76d('0x2f')],_0x2feedb=_0x5827ec['offset'],_0x52db50=_0x5827ec['offset']+_0x5827ec[_0xe76d('0x30')],_0x4b6811;if(_0x52db50>=_0x3719a2){_0x52db50=_0x3719a2;_0x4b6811=0xc8;}else{_0x4b6811=0xce;}_0x2d6c15['status'](_0x4b6811);return _0x2d6c15[_0xe76d('0x31')](_0xe76d('0x32'),_0x2feedb+'-'+_0x52db50+'/'+_0x3719a2)['json'](_0x3b9702);}return null;};}function patchUpdates(_0x57b163){return function(_0x3e8b49){try{jsonpatch[_0xe76d('0x33')](_0x3e8b49,_0x57b163,!![]);}catch(_0x1a53f3){return BPromise[_0xe76d('0x34')](_0x1a53f3);}return _0x3e8b49[_0xe76d('0x35')]();};}function saveUpdates(_0x305c2e,_0x1732e5){return function(_0x35d26){if(_0x35d26){return _0x35d26[_0xe76d('0x36')](_0x305c2e)['then'](function(_0x2604cb){return _0x2604cb;});}return null;};}function removeEntity(_0x34f1b9,_0x465744){return function(_0x2a5a7d){if(_0x2a5a7d){return _0x2a5a7d[_0xe76d('0x37')]()[_0xe76d('0x20')](function(){var _0x1b244a=_0x2a5a7d[_0xe76d('0x38')]({'plain':!![]});var _0x945bb6=_0xe76d('0x39');return db['UserProfileResource'][_0xe76d('0x37')]({'where':{'type':_0x945bb6,'resourceId':_0x1b244a['id']}})['then'](function(){return _0x2a5a7d;});})['then'](function(){_0x34f1b9['status'](0xcc)[_0xe76d('0x2d')]();});}};}function handleEntityNotFound(_0x20440d,_0x131e0e){return function(_0x1e9594){if(!_0x1e9594){_0x20440d[_0xe76d('0x2b')](0x194);}return _0x1e9594;};}function handleError(_0x609e43,_0x326c88){_0x326c88=_0x326c88||0x1f4;return function(_0x5e9840){logger[_0xe76d('0x26')](_0x5e9840['stack']);if(_0x5e9840['name']){delete _0x5e9840[_0xe76d('0x3a')];}_0x609e43[_0xe76d('0x2c')](_0x326c88)[_0xe76d('0x3b')](_0x5e9840);};}exports[_0xe76d('0x3c')]=function(_0x51ac93,_0x35f04a){var _0x58aa25={},_0x17af10={},_0x967d1c={'count':0x0,'rows':[]};var _0x4f9596=_[_0xe76d('0x3d')](db[_0xe76d('0x3e')][_0xe76d('0x3f')],function(_0x1d2d6e){return{'name':_0x1d2d6e['fieldName'],'type':_0x1d2d6e[_0xe76d('0x40')]['key']};});_0x17af10[_0xe76d('0x41')]=_[_0xe76d('0x3d')](_0x4f9596,_0xe76d('0x3a'));_0x17af10[_0xe76d('0x42')]=_[_0xe76d('0x43')](_0x51ac93[_0xe76d('0x42')]);_0x17af10['filters']=_[_0xe76d('0x44')](_0x17af10['model'],_0x17af10[_0xe76d('0x42')]);_0x58aa25[_0xe76d('0x45')]=_[_0xe76d('0x44')](_0x17af10[_0xe76d('0x41')],qs[_0xe76d('0x46')](_0x51ac93[_0xe76d('0x42')][_0xe76d('0x46')]));_0x58aa25[_0xe76d('0x45')]=_0x58aa25['attributes'][_0xe76d('0x47')]?_0x58aa25[_0xe76d('0x45')]:_0x17af10[_0xe76d('0x41')];if(!_0x51ac93[_0xe76d('0x42')]['hasOwnProperty'](_0xe76d('0x48'))){_0x58aa25['limit']=qs['limit'](_0x51ac93[_0xe76d('0x42')][_0xe76d('0x30')]);_0x58aa25[_0xe76d('0x49')]=qs[_0xe76d('0x49')](_0x51ac93[_0xe76d('0x42')][_0xe76d('0x49')]);}_0x58aa25[_0xe76d('0x4a')]=qs[_0xe76d('0x4b')](_0x51ac93[_0xe76d('0x42')][_0xe76d('0x4b')]);_0x58aa25[_0xe76d('0x4c')]=qs['filters'](_[_0xe76d('0x4d')](_0x51ac93[_0xe76d('0x42')],_0x17af10['filters']),_0x4f9596);if(_0x51ac93[_0xe76d('0x42')]['filter']){_0x58aa25[_0xe76d('0x4c')]=_[_0xe76d('0x4e')](_0x58aa25[_0xe76d('0x4c')],{'$or':_[_0xe76d('0x3d')](_0x4f9596,function(_0x289e5e){if(_0x289e5e[_0xe76d('0x40')]!=='VIRTUAL'){var _0x33e4d0={};_0x33e4d0[_0x289e5e[_0xe76d('0x3a')]]={'$like':'%'+_0x51ac93['query'][_0xe76d('0x4f')]+'%'};return _0x33e4d0;}})});}_0x58aa25=_[_0xe76d('0x4e')]({},_0x58aa25,_0x51ac93[_0xe76d('0x50')]);var _0x4ba507={'where':_0x58aa25[_0xe76d('0x4c')]};return db[_0xe76d('0x3e')][_0xe76d('0x2f')](_0x4ba507)[_0xe76d('0x20')](function(_0x3556ac){_0x967d1c['count']=_0x3556ac;if(_0x51ac93[_0xe76d('0x42')]['includeAll']){_0x58aa25['include']=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0x58aa25);})[_0xe76d('0x20')](function(_0x23e961){_0x967d1c[_0xe76d('0x51')]=_0x23e961;return _0x967d1c;})[_0xe76d('0x20')](respondWithFilteredResult(_0x35f04a,_0x58aa25))[_0xe76d('0x2a')](handleError(_0x35f04a,null));};exports['show']=function(_0x565280,_0x119423){var _0x52ef89={'raw':!![],'where':{'id':_0x565280[_0xe76d('0x52')]['id']}},_0x4b6d61={};_0x4b6d61[_0xe76d('0x41')]=_[_0xe76d('0x43')](db[_0xe76d('0x3e')][_0xe76d('0x3f')]);_0x4b6d61['query']=_[_0xe76d('0x43')](_0x565280[_0xe76d('0x42')]);_0x4b6d61[_0xe76d('0x53')]=_[_0xe76d('0x44')](_0x4b6d61[_0xe76d('0x41')],_0x4b6d61[_0xe76d('0x42')]);_0x52ef89['attributes']=_[_0xe76d('0x44')](_0x4b6d61[_0xe76d('0x41')],qs[_0xe76d('0x46')](_0x565280[_0xe76d('0x42')]['fields']));_0x52ef89[_0xe76d('0x45')]=_0x52ef89[_0xe76d('0x45')][_0xe76d('0x47')]?_0x52ef89['attributes']:_0x4b6d61['model'];if(_0x565280['query']['includeAll']){_0x52ef89[_0xe76d('0x54')]=[{'all':!![]}];}_0x52ef89=_[_0xe76d('0x4e')]({},_0x52ef89,_0x565280[_0xe76d('0x50')]);return db[_0xe76d('0x3e')][_0xe76d('0x55')](_0x52ef89)[_0xe76d('0x20')](handleEntityNotFound(_0x119423,null))[_0xe76d('0x20')](respondWithResult(_0x119423,null))[_0xe76d('0x2a')](handleError(_0x119423,null));};exports[_0xe76d('0x56')]=function(_0x535acc,_0x28c6a2){return db[_0xe76d('0x3e')]['create'](_0x535acc[_0xe76d('0x57')],{})[_0xe76d('0x20')](function(_0x1a16ab){var _0x1be1c0=_0x535acc[_0xe76d('0x58')][_0xe76d('0x38')]({'plain':!![]});if(!_0x1be1c0)throw new Error(_0xe76d('0x59'));if(_0x1be1c0[_0xe76d('0x5a')]==='user'){var _0x30ad30=_0x1a16ab['get']({'plain':!![]});var _0x250b28='ChatQueues';return db[_0xe76d('0x5b')]['find']({'where':{'name':_0x250b28,'userProfileId':_0x1be1c0[_0xe76d('0x5c')]},'raw':!![]})['then'](function(_0x36f821){if(_0x36f821&&_0x36f821['autoAssociation']===0x0){return db['UserProfileResource'][_0xe76d('0x56')]({'name':_0x30ad30[_0xe76d('0x3a')],'resourceId':_0x30ad30['id'],'type':_0x36f821['name'],'sectionId':_0x36f821['id']},{})[_0xe76d('0x20')](function(){return _0x1a16ab;});}else{return _0x1a16ab;}})[_0xe76d('0x2a')](function(_0x16dd70){logger[_0xe76d('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16dd70);throw _0x16dd70;});}return _0x1a16ab;})[_0xe76d('0x20')](respondWithResult(_0x28c6a2,0xc9))['catch'](handleError(_0x28c6a2,null));};exports[_0xe76d('0x36')]=function(_0x4a801a,_0x828b04){if(_0x4a801a['body']['id']){delete _0x4a801a[_0xe76d('0x57')]['id'];}return db[_0xe76d('0x3e')][_0xe76d('0x55')]({'where':{'id':_0x4a801a[_0xe76d('0x52')]['id']}})[_0xe76d('0x20')](handleEntityNotFound(_0x828b04,null))[_0xe76d('0x20')](saveUpdates(_0x4a801a[_0xe76d('0x57')],null))[_0xe76d('0x20')](respondWithResult(_0x828b04,null))[_0xe76d('0x2a')](handleError(_0x828b04,null));};exports['destroy']=function(_0xda9646,_0x418abd){return db[_0xe76d('0x3e')][_0xe76d('0x55')]({'where':{'id':_0xda9646[_0xe76d('0x52')]['id']}})[_0xe76d('0x20')](handleEntityNotFound(_0x418abd,null))[_0xe76d('0x20')](removeEntity(_0x418abd,null))[_0xe76d('0x2a')](handleError(_0x418abd,null));};exports[_0xe76d('0x5d')]=function(_0x46e313,_0x905bf8){return db[_0xe76d('0x3e')][_0xe76d('0x5d')]()[_0xe76d('0x20')](respondWithResult(_0x905bf8,null))[_0xe76d('0x2a')](handleError(_0x905bf8,null));};exports['getMembers']=function(_0x360b1a,_0x2171dc,_0xf66ffb){var _0x160c2c={'raw':!![],'where':{}},_0xece815={},_0x3439f9;return db['ChatQueue'][_0xe76d('0x5e')]({'where':{'id':_0x360b1a[_0xe76d('0x52')]['id']}})[_0xe76d('0x20')](handleEntityNotFound(_0x2171dc,null))[_0xe76d('0x20')](function(_0x5626a1){if(_0x5626a1){_0x3439f9=_0x5626a1[_0xe76d('0x38')]({'plain':!![]});_0xece815['model']=_['keys'](db[_0xe76d('0x5f')][_0xe76d('0x3f')]);_0xece815['query']=_[_0xe76d('0x43')](_0x360b1a[_0xe76d('0x42')]);_0xece815[_0xe76d('0x53')]=_['intersection'](_0xece815['model'],_0xece815[_0xe76d('0x42')]);_0x160c2c['attributes']=_[_0xe76d('0x44')](_0xece815['model'],qs['fields'](_0x360b1a[_0xe76d('0x42')]['fields']));_0x160c2c['attributes']=_0x160c2c[_0xe76d('0x45')]['length']?_0x160c2c[_0xe76d('0x45')]:_0xece815['model'];if(!_0x360b1a[_0xe76d('0x42')][_0xe76d('0x60')](_0xe76d('0x48'))){_0x160c2c[_0xe76d('0x30')]=qs[_0xe76d('0x30')](_0x360b1a[_0xe76d('0x42')][_0xe76d('0x30')]);_0x160c2c[_0xe76d('0x49')]=qs[_0xe76d('0x49')](_0x360b1a[_0xe76d('0x42')][_0xe76d('0x49')]);}_0x160c2c[_0xe76d('0x4a')]=qs[_0xe76d('0x4b')](_0x360b1a[_0xe76d('0x42')][_0xe76d('0x4b')]);_0x160c2c['where']=qs['filters'](_[_0xe76d('0x4d')](_0x360b1a[_0xe76d('0x42')],_0xece815[_0xe76d('0x53')]));_0x160c2c[_0xe76d('0x4c')][_0xe76d('0x61')]=_0x5626a1['id'];if(_0x360b1a['query']['filter']){_0x160c2c[_0xe76d('0x4c')]=_[_0xe76d('0x4e')](_0x160c2c[_0xe76d('0x4c')],{'$or':_[_0xe76d('0x3d')](_0x160c2c['attributes'],function(_0x5cbcc9){var _0x5a1d7c={};_0x5a1d7c[_0x5cbcc9]={'$like':'%'+_0x360b1a[_0xe76d('0x42')][_0xe76d('0x4f')]+'%'};return _0x5a1d7c;})});}_0x160c2c=_[_0xe76d('0x4e')]({},_0x160c2c,_0x360b1a[_0xe76d('0x50')]);return db[_0xe76d('0x5f')][_0xe76d('0x62')](_0x160c2c);}})['then'](function(_0x16e82a){if(_0x16e82a){return db[_0xe76d('0x63')][_0xe76d('0x64')]({'where':{'id':_[_0xe76d('0x3d')](_0x16e82a,_0xe76d('0x65')),'role':_0xe76d('0x66')},'attributes':['id',_0xe76d('0x3a'),_0xe76d('0x67'),_0xe76d('0x68'),_0xe76d('0x69')]});}})[_0xe76d('0x20')](function(_0x1bd729){if(_0x1bd729){return{'count':_0x1bd729[_0xe76d('0x2f')],'rows':_[_0xe76d('0x3d')](_0x1bd729['rows'],function(_0x4e4bfc){return{'membername':_0x4e4bfc['name'],'UserId':_0x4e4bfc['id'],'queue_name':_0x3439f9[_0xe76d('0x3a')],'ChatQueueId':_0x3439f9['id'],'interface':util['format'](_0xe76d('0x6a'),_0xe76d('0x6b'),_0x4e4bfc[_0xe76d('0x3a')]),'penalty':0x0,'paused':_0x4e4bfc[_0xe76d('0x67')],'createdAt':_0x4e4bfc[_0xe76d('0x69')],'updatedAt':_0x4e4bfc[_0xe76d('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe76d('0x20')](respondWithFilteredResult(_0x2171dc,_0x160c2c))['catch'](handleError(_0x2171dc,null));};exports[_0xe76d('0x6c')]=function(_0x3e9dc0,_0x216b94,_0x447fb9){var _0x63246f={};var _0x48c587={};var _0x3dd014;var _0x5b248c;return db[_0xe76d('0x3e')][_0xe76d('0x5e')]({'where':{'id':_0x3e9dc0[_0xe76d('0x52')]['id']}})[_0xe76d('0x20')](handleEntityNotFound(_0x216b94,null))[_0xe76d('0x20')](function(_0x2565a6){if(_0x2565a6){_0x3dd014=_0x2565a6;_0x48c587['model']=_['keys'](db[_0xe76d('0x6d')]['rawAttributes']);_0x48c587[_0xe76d('0x42')]=_['keys'](_0x3e9dc0[_0xe76d('0x42')]);_0x48c587[_0xe76d('0x53')]=_[_0xe76d('0x44')](_0x48c587[_0xe76d('0x41')],_0x48c587[_0xe76d('0x42')]);_0x63246f[_0xe76d('0x45')]=_[_0xe76d('0x44')](_0x48c587[_0xe76d('0x41')],qs[_0xe76d('0x46')](_0x3e9dc0['query'][_0xe76d('0x46')]));_0x63246f[_0xe76d('0x45')]=_0x63246f['attributes'][_0xe76d('0x47')]?_0x63246f['attributes']:_0x48c587[_0xe76d('0x41')];_0x63246f['order']=qs[_0xe76d('0x4b')](_0x3e9dc0[_0xe76d('0x42')][_0xe76d('0x4b')]);_0x63246f[_0xe76d('0x4c')]=qs[_0xe76d('0x53')](_['pick'](_0x3e9dc0[_0xe76d('0x42')],_0x48c587['filters']));if(_0x3e9dc0[_0xe76d('0x42')]['filter']){_0x63246f['where']=_[_0xe76d('0x4e')](_0x63246f[_0xe76d('0x4c')],{'$or':_['map'](_0x63246f[_0xe76d('0x45')],function(_0x502e14){var _0x4e5b36={};_0x4e5b36[_0x502e14]={'$like':'%'+_0x3e9dc0['query'][_0xe76d('0x4f')]+'%'};return _0x4e5b36;})});}_0x63246f=_[_0xe76d('0x4e')]({},_0x63246f,_0x3e9dc0[_0xe76d('0x50')]);return _0x3dd014[_0xe76d('0x6c')](_0x63246f);}})['then'](function(_0x4a42df){if(_0x4a42df){_0x5b248c=_0x4a42df['length'];if(!_0x3e9dc0[_0xe76d('0x42')][_0xe76d('0x60')](_0xe76d('0x48'))){_0x63246f[_0xe76d('0x30')]=qs[_0xe76d('0x30')](_0x3e9dc0[_0xe76d('0x42')]['limit']);_0x63246f[_0xe76d('0x49')]=qs[_0xe76d('0x49')](_0x3e9dc0[_0xe76d('0x42')][_0xe76d('0x49')]);}return _0x3dd014[_0xe76d('0x6c')](_0x63246f);}})[_0xe76d('0x20')](function(_0x1ac0f0){if(_0x1ac0f0){return _0x1ac0f0?{'count':_0x5b248c,'rows':_0x1ac0f0}:null;}})[_0xe76d('0x20')](respondWithResult(_0x216b94,null))['catch'](handleError(_0x216b94,null));};exports[_0xe76d('0x6e')]=function(_0x4ed1a4,_0x462d78,_0x5acc9c){var _0x1ea84e=_0x4ed1a4[_0xe76d('0x57')][_0xe76d('0x6f')];return db[_0xe76d('0x6d')][_0xe76d('0x62')]({'where':{'id':_0x1ea84e},'attributes':['id'],'include':[{'model':db[_0xe76d('0x63')],'as':_0xe76d('0x70'),'attributes':['id','name','online',_0xe76d('0x71'),_0xe76d('0x72')],'raw':!![]}]})[_0xe76d('0x20')](function(_0x2bade6){if(_0x2bade6){var _0x11ac23=_[_0xe76d('0x73')](_0x2bade6,function(_0x523e3d){var _0x43a016=_0x523e3d[_0xe76d('0x38')]({'plain':!![]});return _0x43a016[_0xe76d('0x70')];});return db[_0xe76d('0x3e')]['find']({'where':{'id':_0x4ed1a4['params']['id']}})['then'](function(_0x24c7e4){return db[_0xe76d('0x74')][_0xe76d('0x75')](function(_0x490b9d){return _0x24c7e4[_0xe76d('0x6e')](_0x1ea84e,{'transaction':_0x490b9d})[_0xe76d('0x20')](function(){return BPromise[_0xe76d('0x76')](_0x11ac23,function(_0x23ac6e){return db[_0xe76d('0x5f')]['findOrCreate']({'where':{'UserId':_0x23ac6e['id'],'ChatQueueId':_0x4ed1a4['params']['id']},'transaction':_0x490b9d});});})[_0xe76d('0x20')](function(){_0x11ac23[_0xe76d('0x77')](function(_0x328063){socket[_0xe76d('0x78')]('userChatQueue:save',{'UserId':_0x328063['id'],'ChatQueueId':_0x24c7e4['id']});});});});});}})['then'](respondWithStatusCode(_0x462d78,null))[_0xe76d('0x2a')](handleError(_0x462d78,null));};exports[_0xe76d('0x79')]=function(_0x5e9b26,_0x35b4d0,_0x32b27d){return db[_0xe76d('0x6d')][_0xe76d('0x62')]({'where':{'id':_0x5e9b26[_0xe76d('0x42')][_0xe76d('0x6f')]},'attributes':['id'],'include':[{'model':db[_0xe76d('0x63')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x35b4d0,null))[_0xe76d('0x20')](function(_0x29c8f9){var _0x5193c9=_['map'](_0x29c8f9,'id');var _0x302570=[];var _0x343057=[];var _0x5c8bfb=squel[_0xe76d('0x7a')]();_0x5c8bfb[_0xe76d('0x7b')](_0xe76d('0x7c'))[_0xe76d('0x7d')]('team_has_chat_queues','tq')[_0xe76d('0x7e')](_0xe76d('0x7f'),'ut',_0xe76d('0x80'))[_0xe76d('0x4c')](_0xe76d('0x81'),_0x5e9b26[_0xe76d('0x52')]['id']);for(var _0x12c55e=0x0;_0x12c55e<_0x29c8f9[_0xe76d('0x47')];_0x12c55e+=0x1){let _0x38ed25=_0x29c8f9[_0x12c55e];for(var _0x305563=0x0;_0x305563<_0x38ed25['Agents']['length'];_0x305563+=0x1){let _0x2d20e5=_0x38ed25['Agents'][_0x305563];var _0x40eecf=_0x5c8bfb[_0xe76d('0x82')]();_0x40eecf[_0xe76d('0x4c')]('ut.UserId\x20=\x20?',_0x2d20e5['id']);_0x343057['push'](db[_0xe76d('0x74')][_0xe76d('0x42')](_0x40eecf[_0xe76d('0x83')](),{'type':db[_0xe76d('0x74')][_0xe76d('0x84')][_0xe76d('0x85')]})[_0xe76d('0x20')](function(_0x1dcfdd){if(_0x1dcfdd['length']===0x1){return _0x2d20e5['id'];}else{var _0x45a316=_[_0xe76d('0x86')](_['map'](_0x1dcfdd,_0xe76d('0x87')),function(_0xd22d77){return _[_0xe76d('0x88')](_0x5193c9,_0xd22d77);});if(_0x45a316){return _0x2d20e5['id'];}}}));}}return BPromise[_0xe76d('0x89')](_0x343057)[_0xe76d('0x20')](function(_0x1e8934){_0x302570=_(_0x302570)[_0xe76d('0x8a')](_0x1e8934)[_0xe76d('0x8b')]()['value']();return db[_0xe76d('0x3e')]['find']({'where':{'id':_0x5e9b26[_0xe76d('0x52')]['id']}})[_0xe76d('0x20')](function(_0x302209){return db[_0xe76d('0x74')][_0xe76d('0x75')](function(_0x20c815){return _0x302209[_0xe76d('0x79')](_0x5e9b26['query']['ids'],{'transaction':_0x20c815})['then'](function(){if(!_[_0xe76d('0x8c')](_0x302570)){return _0x302209[_0xe76d('0x8d')](_0x302570,{'transaction':_0x20c815});}})[_0xe76d('0x20')](function(){_0x302570[_0xe76d('0x77')](function(_0x1c34da){socket[_0xe76d('0x78')](_0xe76d('0x8e'),{'UserId':_0x1c34da,'ChatQueueId':_0x302209['id']});});});});});});})[_0xe76d('0x20')](respondWithStatusCode(_0x35b4d0,null))['catch'](handleError(_0x35b4d0,null));};exports['addAgents']=function(_0x15110f,_0x1ed94f,_0x19a85a){return db[_0xe76d('0x3e')][_0xe76d('0x55')]({'where':{'id':_0x15110f[_0xe76d('0x52')]['id']}})[_0xe76d('0x20')](handleEntityNotFound(_0x1ed94f,null))[_0xe76d('0x20')](function(_0x1cf426){if(_0x1cf426){return _0x1cf426[_0xe76d('0x8f')](_0x15110f[_0xe76d('0x57')][_0xe76d('0x6f')],_['omit'](_0x15110f[_0xe76d('0x57')],['ids','id'])||{})[_0xe76d('0x90')](function(_0x5310f4){for(var _0x4fdcda=0x0;_0x4fdcda<_0x15110f[_0xe76d('0x57')]['ids'][_0xe76d('0x47')];_0x4fdcda+=0x1){socket['emit'](_0xe76d('0x91'),{'UserId':_0x15110f[_0xe76d('0x57')][_0xe76d('0x6f')][_0x4fdcda],'ChatQueueId':_0x15110f['params']['id']});}return _0x5310f4;});}})[_0xe76d('0x20')](respondWithResult(_0x1ed94f,null))[_0xe76d('0x2a')](handleError(_0x1ed94f,null));};exports[_0xe76d('0x8d')]=function(_0x2f1452,_0x24c0ae,_0x4ca438){return db['ChatQueue']['find']({'where':{'id':_0x2f1452['params']['id']}})[_0xe76d('0x20')](handleEntityNotFound(_0x24c0ae,null))['then'](function(_0x3e1e02){if(_0x3e1e02){return _0x3e1e02[_0xe76d('0x8d')](_0x2f1452[_0xe76d('0x42')][_0xe76d('0x6f')])['then'](function(){if(_['isArray'](_0x2f1452[_0xe76d('0x42')][_0xe76d('0x6f')])){for(var _0x9a9bc1=0x0;_0x9a9bc1<_0x2f1452[_0xe76d('0x42')]['ids'][_0xe76d('0x47')];_0x9a9bc1+=0x1){socket['emit'](_0xe76d('0x8e'),{'UserId':Number(_0x2f1452[_0xe76d('0x42')][_0xe76d('0x6f')][_0x9a9bc1]),'ChatQueueId':Number(_0x2f1452[_0xe76d('0x52')]['id'])});}}else{socket[_0xe76d('0x78')]('userChatQueue:remove',{'UserId':Number(_0x2f1452[_0xe76d('0x42')][_0xe76d('0x6f')]),'ChatQueueId':Number(_0x2f1452[_0xe76d('0x52')]['id'])});}});}})[_0xe76d('0x20')](respondWithStatusCode(_0x24c0ae,null))[_0xe76d('0x2a')](handleError(_0x24c0ae,null));};exports[_0xe76d('0x92')]=function(_0x4539c1,_0x44cae2,_0x1217f6){var _0x38dab2={};var _0x455af5={};var _0x59b22f;var _0x4a8547;return db[_0xe76d('0x3e')]['findOne']({'where':{'id':_0x4539c1['params']['id']}})[_0xe76d('0x20')](handleEntityNotFound(_0x44cae2,null))['then'](function(_0x22c21d){if(_0x22c21d){_0x59b22f=_0x22c21d;_0x455af5[_0xe76d('0x41')]=_['keys'](db[_0xe76d('0x63')]['rawAttributes']);_0x455af5[_0xe76d('0x42')]=_[_0xe76d('0x43')](_0x4539c1[_0xe76d('0x42')]);_0x455af5['filters']=_[_0xe76d('0x44')](_0x455af5[_0xe76d('0x41')],_0x455af5[_0xe76d('0x42')]);_0x38dab2[_0xe76d('0x45')]=_[_0xe76d('0x44')](_0x455af5['model'],qs[_0xe76d('0x46')](_0x4539c1['query'][_0xe76d('0x46')]));_0x38dab2[_0xe76d('0x45')]=_0x38dab2['attributes']['length']?_0x38dab2[_0xe76d('0x45')]:_0x455af5[_0xe76d('0x41')];_0x38dab2[_0xe76d('0x4a')]=qs[_0xe76d('0x4b')](_0x4539c1[_0xe76d('0x42')]['sort']);_0x38dab2[_0xe76d('0x4c')]=qs[_0xe76d('0x53')](_['pick'](_0x4539c1['query'],_0x455af5['filters']));if(_0x4539c1[_0xe76d('0x42')][_0xe76d('0x4f')]){_0x38dab2['where']=_[_0xe76d('0x4e')](_0x38dab2[_0xe76d('0x4c')],{'$or':_[_0xe76d('0x3d')](_0x38dab2[_0xe76d('0x45')],function(_0x45bd12){var _0xa8b07c={};_0xa8b07c[_0x45bd12]={'$like':'%'+_0x4539c1[_0xe76d('0x42')][_0xe76d('0x4f')]+'%'};return _0xa8b07c;})});}_0x38dab2=_[_0xe76d('0x4e')]({},_0x38dab2,_0x4539c1[_0xe76d('0x50')]);return _0x59b22f[_0xe76d('0x92')](_0x38dab2);}})[_0xe76d('0x20')](function(_0x32d5d7){if(_0x32d5d7){_0x4a8547=_0x32d5d7[_0xe76d('0x47')];if(!_0x4539c1[_0xe76d('0x42')][_0xe76d('0x60')](_0xe76d('0x48'))){_0x38dab2['limit']=qs[_0xe76d('0x30')](_0x4539c1[_0xe76d('0x42')]['limit']);_0x38dab2['offset']=qs[_0xe76d('0x49')](_0x4539c1[_0xe76d('0x42')][_0xe76d('0x49')]);}return _0x59b22f[_0xe76d('0x92')](_0x38dab2);}})['then'](function(_0xc8b38b){if(_0xc8b38b){return _0xc8b38b?{'count':_0x4a8547,'rows':_0xc8b38b}:null;}})['then'](respondWithResult(_0x44cae2,null))[_0xe76d('0x2a')](handleError(_0x44cae2,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 09ec5f6..53ecbec 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(_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 +var _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x37413b,_0x423b30){var _0x15b210=function(_0x34430e){while(--_0x34430e){_0x37413b['push'](_0x37413b['shift']());}};_0x15b210(++_0x423b30);}(_0xb10b,0x12a));var _0xbb10=function(_0x1017c3,_0x7127ba){_0x1017c3=_0x1017c3-0x0;var _0x335335=_0xb10b[_0x1017c3];return _0x335335;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatQueueEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatQueueEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatQueue[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 30c5602..5148cad 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 _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 +var _0xff31=['ChatQueue','chat_queues','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff31,0x1ee));var _0x1ff3=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xff31[_0x550d12];return _0x12103d;};'use strict';var _=require('lodash');var util=require(_0x1ff3('0x0'));var logger=require('../../config/logger')(_0x1ff3('0x1'));var moment=require(_0x1ff3('0x2'));var BPromise=require(_0x1ff3('0x3'));var rp=require(_0x1ff3('0x4'));var fs=require('fs');var path=require(_0x1ff3('0x5'));var rimraf=require(_0x1ff3('0x6'));var config=require(_0x1ff3('0x7'));var attributes=require('./chatQueue.attributes');module[_0x1ff3('0x8')]=function(_0x7fb586,_0x2bd987){return _0x7fb586[_0x1ff3('0x9')](_0x1ff3('0xa'),attributes,{'tableName':_0x1ff3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index c6614a5..a45c95e 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 _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 +var _0xd33c=['stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','include','model','map','ShowChatQueue','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x541095,_0x582b30){var _0x5a2c40=function(_0xb7650f){while(--_0xb7650f){_0x541095['push'](_0x541095['shift']());}};_0x5a2c40(++_0x582b30);}(_0xd33c,0x115));var _0xcd33=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0xd33c[_0x3826ad];return _0x17b900;};'use strict';var _=require(_0xcd33('0x0'));var util=require(_0xcd33('0x1'));var moment=require('moment');var BPromise=require(_0xcd33('0x2'));var rs=require(_0xcd33('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd33('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd33('0x5'))(_0xcd33('0x6'));var config=require(_0xcd33('0x7'));var jayson=require(_0xcd33('0x8'));var client=jayson[_0xcd33('0x9')]['http']({'port':0x232a});config[_0xcd33('0xa')]=_['defaults'](config[_0xcd33('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatQueue.socket')[_0xcd33('0xb')](socket);function respondWithRpcPromise(_0x1c9ad4,_0x3af2af,_0x193d37){return new BPromise(function(_0x303574,_0x2ed902){return client[_0xcd33('0xc')](_0x1c9ad4,_0x193d37)[_0xcd33('0xd')](function(_0x15a46d){logger[_0xcd33('0xe')](_0xcd33('0xf'),_0x3af2af,_0xcd33('0x10'));logger[_0xcd33('0x11')](_0xcd33('0x12'),_0x3af2af,_0xcd33('0x10'),JSON[_0xcd33('0x13')](_0x15a46d));if(_0x15a46d['error']){if(_0x15a46d[_0xcd33('0x14')][_0xcd33('0x15')]===0x1f4){logger[_0xcd33('0x14')]('ChatQueue,\x20%s,\x20%s',_0x3af2af,_0x15a46d['error'][_0xcd33('0x16')]);return _0x2ed902(_0x15a46d['error'][_0xcd33('0x16')]);}logger[_0xcd33('0x14')](_0xcd33('0xf'),_0x3af2af,_0x15a46d[_0xcd33('0x14')][_0xcd33('0x16')]);return _0x303574(_0x15a46d['error'][_0xcd33('0x16')]);}else{logger['info'](_0xcd33('0xf'),_0x3af2af,_0xcd33('0x10'));_0x303574(_0x15a46d[_0xcd33('0x17')][_0xcd33('0x16')]);}})[_0xcd33('0x18')](function(_0x20fe8e){logger[_0xcd33('0x14')](_0xcd33('0xf'),_0x3af2af,_0x20fe8e);_0x2ed902(_0x20fe8e);});});}exports[_0xcd33('0x19')]=function(_0x53069f){var _0x146a9a=this;return new Promise(function(_0x58a806,_0x52e5ed){return db[_0xcd33('0x1a')][_0xcd33('0x1b')]({'raw':_0x53069f[_0xcd33('0x1c')]?_0x53069f[_0xcd33('0x1c')][_0xcd33('0x1d')]===undefined?!![]:![]:!![],'where':_0x53069f[_0xcd33('0x1c')]?_0x53069f['options'][_0xcd33('0x1e')]||null:null,'attributes':_0x53069f[_0xcd33('0x1c')]?_0x53069f[_0xcd33('0x1c')][_0xcd33('0x1f')]||null:null,'limit':_0x53069f[_0xcd33('0x1c')]?_0x53069f[_0xcd33('0x1c')]['limit']||null:null,'include':_0x53069f[_0xcd33('0x1c')]?_0x53069f[_0xcd33('0x1c')]['include']?_['map'](_0x53069f[_0xcd33('0x1c')][_0xcd33('0x20')],function(_0x35701e){return{'model':db[_0x35701e[_0xcd33('0x21')]],'as':_0x35701e['as'],'attributes':_0x35701e[_0xcd33('0x1f')],'include':_0x35701e['include']?_[_0xcd33('0x22')](_0x35701e['include'],function(_0x1aad04){return{'model':db[_0x1aad04[_0xcd33('0x21')]],'as':_0x1aad04['as'],'attributes':_0x1aad04[_0xcd33('0x1f')],'include':_0x1aad04[_0xcd33('0x20')]?_[_0xcd33('0x22')](_0x1aad04[_0xcd33('0x20')],function(_0x2f7b04){return{'model':db[_0x2f7b04['model']],'as':_0x2f7b04['as'],'attributes':_0x2f7b04['attributes']};}):[]};}):[]};}):[]:[]})[_0xcd33('0xd')](function(_0x1b717b){logger[_0xcd33('0xe')]('GetChatQueue',_0x53069f);logger[_0xcd33('0x11')](_0xcd33('0x19'),_0x53069f,JSON[_0xcd33('0x13')](_0x1b717b));_0x58a806(_0x1b717b);})[_0xcd33('0x18')](function(_0x4b3ee1){logger[_0xcd33('0x14')](_0xcd33('0x19'),_0x4b3ee1['message'],_0x53069f);_0x52e5ed(_0x146a9a[_0xcd33('0x14')](0x1f4,_0x4b3ee1[_0xcd33('0x16')]));});});};exports[_0xcd33('0x23')]=function(_0x2489e7){var _0x3df27f=this;return new Promise(function(_0x18a2af,_0x1befb8){return db[_0xcd33('0x1a')][_0xcd33('0x24')]({'raw':_0x2489e7[_0xcd33('0x1c')]?_0x2489e7[_0xcd33('0x1c')][_0xcd33('0x1d')]===undefined?!![]:![]:!![],'where':_0x2489e7[_0xcd33('0x1c')]?_0x2489e7['options'][_0xcd33('0x1e')]||null:null,'attributes':_0x2489e7[_0xcd33('0x1c')]?_0x2489e7[_0xcd33('0x1c')][_0xcd33('0x1f')]||null:null,'include':_0x2489e7[_0xcd33('0x1c')]?_0x2489e7[_0xcd33('0x1c')][_0xcd33('0x20')]?_[_0xcd33('0x22')](_0x2489e7['options'][_0xcd33('0x20')],function(_0x2a72e8){return{'model':db[_0x2a72e8['model']],'as':_0x2a72e8['as'],'attributes':_0x2a72e8[_0xcd33('0x1f')],'include':_0x2a72e8['include']?_[_0xcd33('0x22')](_0x2a72e8[_0xcd33('0x20')],function(_0x2656fb){return{'model':db[_0x2656fb['model']],'as':_0x2656fb['as'],'attributes':_0x2656fb[_0xcd33('0x1f')],'include':_0x2656fb[_0xcd33('0x20')]?_[_0xcd33('0x22')](_0x2656fb['include'],function(_0x4e69c2){return{'model':db[_0x4e69c2['model']],'as':_0x4e69c2['as'],'attributes':_0x4e69c2[_0xcd33('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xcd33('0xd')](function(_0x39ce33){logger[_0xcd33('0xe')](_0xcd33('0x23'),_0x2489e7);logger[_0xcd33('0x11')]('ShowChatQueue',_0x2489e7,JSON[_0xcd33('0x13')](_0x39ce33));_0x18a2af(_0x39ce33);})[_0xcd33('0x18')](function(_0x3947a6){logger[_0xcd33('0x14')](_0xcd33('0x23'),_0x3947a6['message'],_0x2489e7);_0x1befb8(_0x3df27f[_0xcd33('0x14')](0x1f4,_0x3947a6[_0xcd33('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 626855a..fda7113 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 _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 +var _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0xf71ea6,_0x6891e9){var _0x3c271a=function(_0x936683){while(--_0x936683){_0xf71ea6['push'](_0xf71ea6['shift']());}};_0x3c271a(++_0x6891e9);}(_0x0b0e,0x187));var _0xe0b0=function(_0x47242d,_0x13f993){_0x47242d=_0x47242d-0x0;var _0x30273a=_0x0b0e[_0x47242d];return _0x30273a;};'use strict';var ChatQueueEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){ChatQueueEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);ChatQueueEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 66a388c..b7db145 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 _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 +var _0x9464=['../../components/interaction/service','./chatQueue.controller','get','index','describe','/:id','isAuthenticated','show','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','delete','destroy','removeAgents','exports','path','connect-timeout','../../components/auth/service'];(function(_0x48f2bc,_0x6af1fc){var _0x1ae4a3=function(_0x59ebb9){while(--_0x59ebb9){_0x48f2bc['push'](_0x48f2bc['shift']());}};_0x1ae4a3(++_0x6af1fc);}(_0x9464,0x11b));var _0x4946=function(_0x5e1b91,_0x236f17){_0x5e1b91=_0x5e1b91-0x0;var _0x59b52f=_0x9464[_0x5e1b91];return _0x59b52f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4946('0x0'));var timeout=require(_0x4946('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x4946('0x2'));var interaction=require(_0x4946('0x3'));var config=require('../../config/environment');var controller=require(_0x4946('0x4'));router[_0x4946('0x5')]('/',auth['isAuthenticated'](),controller[_0x4946('0x6')]);router[_0x4946('0x5')]('/describe',auth['isAuthenticated'](),controller[_0x4946('0x7')]);router['get'](_0x4946('0x8'),auth[_0x4946('0x9')](),controller[_0x4946('0xa')]);router[_0x4946('0x5')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0x4946('0x5')](_0x4946('0xb'),auth[_0x4946('0x9')](),controller[_0x4946('0xc')]);router[_0x4946('0x5')](_0x4946('0xd'),auth['isAuthenticated'](),controller[_0x4946('0xe')]);router[_0x4946('0xf')]('/',auth[_0x4946('0x9')](),controller[_0x4946('0x10')]);router[_0x4946('0xf')]('/:id/teams',auth[_0x4946('0x9')](),controller['addTeams']);router[_0x4946('0xf')](_0x4946('0xd'),auth['isAuthenticated'](),controller[_0x4946('0x11')]);router['put'](_0x4946('0x8'),auth[_0x4946('0x9')](),controller['update']);router[_0x4946('0x12')](_0x4946('0x8'),auth[_0x4946('0x9')](),controller[_0x4946('0x13')]);router[_0x4946('0x12')](_0x4946('0xb'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x4946('0x12')](_0x4946('0xd'),auth['isAuthenticated'](),controller[_0x4946('0x14')]);module[_0x4946('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 4dd8e0b..66ccd58 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 _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 +var _0x529b=['DATE','STRING','moment','sequelize','exports'];(function(_0x2d296c,_0x53da61){var _0xc59265=function(_0x21dc0f){while(--_0x21dc0f){_0x2d296c['push'](_0x2d296c['shift']());}};_0xc59265(++_0x53da61);}(_0x529b,0x70));var _0xb529=function(_0x4167b0,_0x245702){_0x4167b0=_0x4167b0-0x0;var _0x31b60e=_0x529b[_0x4167b0];return _0x31b60e;};'use strict';var moment=require(_0xb529('0x0'));var Sequelize=require(_0xb529('0x1'));module[_0xb529('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb529('0x3')]},'acceptAt':{'type':Sequelize[_0xb529('0x3')]},'exitAt':{'type':Sequelize[_0xb529('0x3')]},'reason':{'type':Sequelize[_0xb529('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index eff028b..7696749 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 _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 +var _0xb7e7=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../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','then','destroy','end','name','send','index','ChatQueueReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','create','body','describe','html-pdf','rimraf','fast-json-patch','moment','mustache','util','path','ejs','lodash','squel','jsforce'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb7e7,0x121));var _0x7b7e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xb7e7[_0xf71120];return _0xbe2fd3;};'use strict';var pdf=require(_0x7b7e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7b7e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b7e('0x2'));var rp=require('request-promise');var moment=require(_0x7b7e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7b7e('0x4'));var util=require(_0x7b7e('0x5'));var path=require(_0x7b7e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7b7e('0x7'));var fs=require('fs');var _=require(_0x7b7e('0x8'));var squel=require(_0x7b7e('0x9'));var crypto=require('crypto');var jsforce=require(_0x7b7e('0xa'));var deskjs=require(_0x7b7e('0xb'));var toCsv=require(_0x7b7e('0xc'));var querystring=require(_0x7b7e('0xd'));var Papa=require(_0x7b7e('0xe'));var Redis=require(_0x7b7e('0xf'));var authService=require(_0x7b7e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b7e('0x11'));var hardwareService=require(_0x7b7e('0x12'));var logger=require(_0x7b7e('0x13'))(_0x7b7e('0x14'));var utils=require(_0x7b7e('0x15'));var config=require(_0x7b7e('0x16'));var db=require(_0x7b7e('0x17'))['db'];function respondWithStatusCode(_0x55620b,_0xaadda){_0xaadda=_0xaadda||0xcc;return function(_0x54d8ce){if(_0x54d8ce){return _0x55620b[_0x7b7e('0x18')](_0xaadda);}return _0x55620b[_0x7b7e('0x19')](_0xaadda)['end']();};}function respondWithResult(_0x422d3a,_0x5976ac){_0x5976ac=_0x5976ac||0xc8;return function(_0x4c6011){if(_0x4c6011){return _0x422d3a[_0x7b7e('0x19')](_0x5976ac)[_0x7b7e('0x1a')](_0x4c6011);}};}function respondWithFilteredResult(_0xf067da,_0x457ec5){return function(_0x3d2fb2){if(_0x3d2fb2){var _0x5703fd=_0x3d2fb2[_0x7b7e('0x1b')],_0x51baf6=_0x457ec5[_0x7b7e('0x1c')],_0xc7f087=_0x457ec5[_0x7b7e('0x1c')]+_0x457ec5[_0x7b7e('0x1d')],_0x36444d;if(_0xc7f087>=_0x5703fd){_0xc7f087=_0x5703fd;_0x36444d=0xc8;}else{_0x36444d=0xce;}_0xf067da[_0x7b7e('0x19')](_0x36444d);return _0xf067da[_0x7b7e('0x1e')](_0x7b7e('0x1f'),_0x51baf6+'-'+_0xc7f087+'/'+_0x5703fd)[_0x7b7e('0x1a')](_0x3d2fb2);}return null;};}function patchUpdates(_0x12e8e9){return function(_0x14f4fe){try{jsonpatch[_0x7b7e('0x20')](_0x14f4fe,_0x12e8e9,!![]);}catch(_0x3bec7d){return BPromise[_0x7b7e('0x21')](_0x3bec7d);}return _0x14f4fe[_0x7b7e('0x22')]();};}function saveUpdates(_0x3a7b8b,_0x49eddb){return function(_0x69262b){if(_0x69262b){return _0x69262b[_0x7b7e('0x23')](_0x3a7b8b)[_0x7b7e('0x24')](function(_0x4c0647){return _0x4c0647;});}return null;};}function removeEntity(_0x313122,_0xbf0cb3){return function(_0x14243b){if(_0x14243b){return _0x14243b[_0x7b7e('0x25')]()[_0x7b7e('0x24')](function(){_0x313122[_0x7b7e('0x19')](0xcc)[_0x7b7e('0x26')]();});}};}function handleEntityNotFound(_0x10a66a,_0x53bbb3){return function(_0x5d6215){if(!_0x5d6215){_0x10a66a['sendStatus'](0x194);}return _0x5d6215;};}function handleError(_0x26ee14,_0x22598e){_0x22598e=_0x22598e||0x1f4;return function(_0x23bfa3){logger['error'](_0x23bfa3['stack']);if(_0x23bfa3['name']){delete _0x23bfa3[_0x7b7e('0x27')];}_0x26ee14[_0x7b7e('0x19')](_0x22598e)[_0x7b7e('0x28')](_0x23bfa3);};}exports[_0x7b7e('0x29')]=function(_0x3ceaf5,_0x48fad1){var _0x6a1e71={},_0x21a15={},_0x4c46b8={'count':0x0,'rows':[]};var _0x57b9da=_['map'](db[_0x7b7e('0x2a')][_0x7b7e('0x2b')],function(_0x503625){return{'name':_0x503625[_0x7b7e('0x2c')],'type':_0x503625['type'][_0x7b7e('0x2d')]};});_0x21a15[_0x7b7e('0x2e')]=_[_0x7b7e('0x2f')](_0x57b9da,'name');_0x21a15[_0x7b7e('0x30')]=_[_0x7b7e('0x31')](_0x3ceaf5[_0x7b7e('0x30')]);_0x21a15[_0x7b7e('0x32')]=_[_0x7b7e('0x33')](_0x21a15['model'],_0x21a15[_0x7b7e('0x30')]);_0x6a1e71['attributes']=_[_0x7b7e('0x33')](_0x21a15[_0x7b7e('0x2e')],qs[_0x7b7e('0x34')](_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x34')]));_0x6a1e71[_0x7b7e('0x35')]=_0x6a1e71[_0x7b7e('0x35')]['length']?_0x6a1e71['attributes']:_0x21a15[_0x7b7e('0x2e')];if(!_0x3ceaf5[_0x7b7e('0x30')]['hasOwnProperty'](_0x7b7e('0x36'))){_0x6a1e71[_0x7b7e('0x1d')]=qs[_0x7b7e('0x1d')](_0x3ceaf5['query'][_0x7b7e('0x1d')]);_0x6a1e71[_0x7b7e('0x1c')]=qs[_0x7b7e('0x1c')](_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x1c')]);}_0x6a1e71[_0x7b7e('0x37')]=qs[_0x7b7e('0x38')](_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x38')]);_0x6a1e71[_0x7b7e('0x39')]=qs[_0x7b7e('0x32')](_[_0x7b7e('0x3a')](_0x3ceaf5[_0x7b7e('0x30')],_0x21a15[_0x7b7e('0x32')]),_0x57b9da);if(_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x3b')]){_0x6a1e71['where']=_[_0x7b7e('0x3c')](_0x6a1e71[_0x7b7e('0x39')],{'$or':_[_0x7b7e('0x2f')](_0x57b9da,function(_0x242609){if(_0x242609[_0x7b7e('0x3d')]!==_0x7b7e('0x3e')){var _0x7f15={};_0x7f15[_0x242609[_0x7b7e('0x27')]]={'$like':'%'+_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x3b')]+'%'};return _0x7f15;}})});}_0x6a1e71=_['merge']({},_0x6a1e71,_0x3ceaf5[_0x7b7e('0x3f')]);var _0x1fa75b={'where':_0x6a1e71[_0x7b7e('0x39')]};return db[_0x7b7e('0x2a')]['count'](_0x1fa75b)[_0x7b7e('0x24')](function(_0x35b31a){_0x4c46b8[_0x7b7e('0x1b')]=_0x35b31a;if(_0x3ceaf5['query']['includeAll']){_0x6a1e71[_0x7b7e('0x40')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x7b7e('0x41')](_0x6a1e71);})[_0x7b7e('0x24')](function(_0x4de331){_0x4c46b8[_0x7b7e('0x42')]=_0x4de331;return _0x4c46b8;})[_0x7b7e('0x24')](respondWithFilteredResult(_0x48fad1,_0x6a1e71))[_0x7b7e('0x43')](handleError(_0x48fad1,null));};exports[_0x7b7e('0x44')]=function(_0x38d32f,_0x435de5){var _0xc888e4={'raw':!![],'where':{'id':_0x38d32f[_0x7b7e('0x45')]['id']}},_0x1d9bb9={};_0x1d9bb9['model']=_['keys'](db[_0x7b7e('0x2a')]['rawAttributes']);_0x1d9bb9[_0x7b7e('0x30')]=_['keys'](_0x38d32f['query']);_0x1d9bb9[_0x7b7e('0x32')]=_['intersection'](_0x1d9bb9[_0x7b7e('0x2e')],_0x1d9bb9['query']);_0xc888e4[_0x7b7e('0x35')]=_[_0x7b7e('0x33')](_0x1d9bb9[_0x7b7e('0x2e')],qs[_0x7b7e('0x34')](_0x38d32f['query'][_0x7b7e('0x34')]));_0xc888e4[_0x7b7e('0x35')]=_0xc888e4[_0x7b7e('0x35')][_0x7b7e('0x46')]?_0xc888e4[_0x7b7e('0x35')]:_0x1d9bb9[_0x7b7e('0x2e')];if(_0x38d32f['query']['includeAll']){_0xc888e4['include']=[{'all':!![]}];}_0xc888e4=_[_0x7b7e('0x3c')]({},_0xc888e4,_0x38d32f[_0x7b7e('0x3f')]);return db[_0x7b7e('0x2a')][_0x7b7e('0x47')](_0xc888e4)[_0x7b7e('0x24')](handleEntityNotFound(_0x435de5,null))[_0x7b7e('0x24')](respondWithResult(_0x435de5,null))['catch'](handleError(_0x435de5,null));};exports[_0x7b7e('0x48')]=function(_0x42e560,_0x5a0832){return db['ChatQueueReport'][_0x7b7e('0x48')](_0x42e560[_0x7b7e('0x49')],{})[_0x7b7e('0x24')](respondWithResult(_0x5a0832,0xc9))[_0x7b7e('0x43')](handleError(_0x5a0832,null));};exports[_0x7b7e('0x23')]=function(_0xb46776,_0x590154){if(_0xb46776[_0x7b7e('0x49')]['id']){delete _0xb46776['body']['id'];}return db[_0x7b7e('0x2a')][_0x7b7e('0x47')]({'where':{'id':_0xb46776[_0x7b7e('0x45')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x590154,null))['then'](saveUpdates(_0xb46776[_0x7b7e('0x49')],null))[_0x7b7e('0x24')](respondWithResult(_0x590154,null))[_0x7b7e('0x43')](handleError(_0x590154,null));};exports[_0x7b7e('0x25')]=function(_0x1f9d0f,_0x5cce7c){return db[_0x7b7e('0x2a')][_0x7b7e('0x47')]({'where':{'id':_0x1f9d0f[_0x7b7e('0x45')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x5cce7c,null))[_0x7b7e('0x24')](removeEntity(_0x5cce7c,null))['catch'](handleError(_0x5cce7c,null));};exports[_0x7b7e('0x4a')]=function(_0x29024e,_0x46d4ee){return db[_0x7b7e('0x2a')][_0x7b7e('0x4a')]()[_0x7b7e('0x24')](respondWithResult(_0x46d4ee,null))[_0x7b7e('0x43')](handleError(_0x46d4ee,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index a1855bf..cb3347a 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 _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 +var _0x7793=['lodash','util','moment','bluebird','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','uniqueid'];(function(_0x2111be,_0x286335){var _0x22e30b=function(_0x2bd146){while(--_0x2bd146){_0x2111be['push'](_0x2111be['shift']());}};_0x22e30b(++_0x286335);}(_0x7793,0x144));var _0x3779=function(_0x456099,_0x4e4265){_0x456099=_0x456099-0x0;var _0x33e673=_0x7793[_0x456099];return _0x33e673;};'use strict';var _=require(_0x3779('0x0'));var util=require(_0x3779('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3779('0x2'));var BPromise=require(_0x3779('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3779('0x4'));var rimraf=require(_0x3779('0x5'));var config=require(_0x3779('0x6'));var attributes=require(_0x3779('0x7'));module[_0x3779('0x8')]=function(_0x49b612,_0x261ddb){return _0x49b612[_0x3779('0x9')](_0x3779('0xa'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3779('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index fd258b5..f6f7005 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 _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 +var _0x04d3=['create','options','raw','UpdateChatQueueReport','update','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','request\x20sent','result','message','catch','CreateChatQueueReport','ChatQueueReport'];(function(_0xa67795,_0x426173){var _0x1e2dab=function(_0x442a02){while(--_0x442a02){_0xa67795['push'](_0xa67795['shift']());}};_0x1e2dab(++_0x426173);}(_0x04d3,0xb7));var _0x304d=function(_0x49d33f,_0x176755){_0x49d33f=_0x49d33f-0x0;var _0x297496=_0x04d3[_0x49d33f];return _0x297496;};'use strict';var _=require(_0x304d('0x0'));var util=require(_0x304d('0x1'));var moment=require('moment');var BPromise=require(_0x304d('0x2'));var rs=require(_0x304d('0x3'));var fs=require('fs');var Redis=require(_0x304d('0x4'));var db=require(_0x304d('0x5'))['db'];var utils=require(_0x304d('0x6'));var logger=require(_0x304d('0x7'))('rpc');var config=require(_0x304d('0x8'));var jayson=require(_0x304d('0x9'));var client=jayson[_0x304d('0xa')][_0x304d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2440ae,_0x32ed2b,_0x1b45e8){return new BPromise(function(_0x417489,_0x192404){return client[_0x304d('0xc')](_0x2440ae,_0x1b45e8)[_0x304d('0xd')](function(_0xde96bb){logger[_0x304d('0xe')](_0x304d('0xf'),_0x32ed2b,'request\x20sent');logger[_0x304d('0x10')](_0x304d('0x11'),_0x32ed2b,'request\x20sent',JSON[_0x304d('0x12')](_0xde96bb));if(_0xde96bb[_0x304d('0x13')]){if(_0xde96bb[_0x304d('0x13')][_0x304d('0x14')]===0x1f4){logger[_0x304d('0x13')](_0x304d('0xf'),_0x32ed2b,_0xde96bb['error']['message']);return _0x192404(_0xde96bb[_0x304d('0x13')]['message']);}logger[_0x304d('0x13')](_0x304d('0xf'),_0x32ed2b,_0xde96bb['error']['message']);return _0x417489(_0xde96bb[_0x304d('0x13')]['message']);}else{logger[_0x304d('0xe')](_0x304d('0xf'),_0x32ed2b,_0x304d('0x15'));_0x417489(_0xde96bb[_0x304d('0x16')][_0x304d('0x17')]);}})[_0x304d('0x18')](function(_0x376e76){logger[_0x304d('0x13')](_0x304d('0xf'),_0x32ed2b,_0x376e76);_0x192404(_0x376e76);});});}exports[_0x304d('0x19')]=function(_0x5621c6){var _0x3f9268=this;return new Promise(function(_0x1a5b81,_0x453603){return db[_0x304d('0x1a')][_0x304d('0x1b')](_0x5621c6['body'],{'raw':_0x5621c6[_0x304d('0x1c')]?_0x5621c6[_0x304d('0x1c')][_0x304d('0x1d')]===undefined?!![]:![]:!![]})[_0x304d('0xd')](function(_0x23dc4d){logger[_0x304d('0xe')](_0x304d('0x19'),_0x5621c6);logger[_0x304d('0x10')]('CreateChatQueueReport',_0x5621c6,JSON[_0x304d('0x12')](_0x23dc4d));_0x1a5b81(_0x23dc4d);})[_0x304d('0x18')](function(_0x29deff){logger['error'](_0x304d('0x19'),_0x29deff[_0x304d('0x17')],_0x5621c6);_0x453603(_0x3f9268['error'](0x1f4,_0x29deff[_0x304d('0x17')]));});});};exports[_0x304d('0x1e')]=function(_0x1fd750){var _0x5c16b4=this;return new Promise(function(_0x167593,_0x268a49){return db['ChatQueueReport'][_0x304d('0x1f')](_0x1fd750['body'],{'raw':_0x1fd750[_0x304d('0x1c')]?_0x1fd750[_0x304d('0x1c')][_0x304d('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fd750[_0x304d('0x1c')]?_0x1fd750['options'][_0x304d('0x20')]||null:null,'attributes':_0x1fd750[_0x304d('0x1c')]?_0x1fd750['options'][_0x304d('0x21')]||null:null,'limit':_0x1fd750['options']?_0x1fd750[_0x304d('0x1c')][_0x304d('0x22')]||null:null})[_0x304d('0xd')](function(_0xd60431){logger[_0x304d('0xe')](_0x304d('0x1e'),_0x1fd750);logger[_0x304d('0x10')](_0x304d('0x1e'),_0x1fd750,JSON['stringify'](_0xd60431));_0x167593(_0xd60431);})[_0x304d('0x18')](function(_0x46bcbb){logger[_0x304d('0x13')](_0x304d('0x1e'),_0x46bcbb['message'],_0x1fd750);_0x268a49(_0x5c16b4[_0x304d('0x13')](0x1f4,_0x46bcbb[_0x304d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index f6b7977..9b17267 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 _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 +var _0x0e40=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','destroy','exports','util','path','connect-timeout','express'];(function(_0x24e7d2,_0x3f1c78){var _0x1dbc44=function(_0x2ed288){while(--_0x2ed288){_0x24e7d2['push'](_0x24e7d2['shift']());}};_0x1dbc44(++_0x3f1c78);}(_0x0e40,0x10c));var _0x00e4=function(_0x4e4bf1,_0x54dcf9){_0x4e4bf1=_0x4e4bf1-0x0;var _0x3d067b=_0x0e40[_0x4e4bf1];return _0x3d067b;};'use strict';var multer=require('multer');var util=require(_0x00e4('0x0'));var path=require(_0x00e4('0x1'));var timeout=require(_0x00e4('0x2'));var express=require(_0x00e4('0x3'));var router=express[_0x00e4('0x4')]();var auth=require(_0x00e4('0x5'));var interaction=require(_0x00e4('0x6'));var config=require(_0x00e4('0x7'));var controller=require(_0x00e4('0x8'));router[_0x00e4('0x9')]('/',auth[_0x00e4('0xa')](),controller[_0x00e4('0xb')]);router['get']('/describe',auth[_0x00e4('0xa')](),controller[_0x00e4('0xc')]);router['get'](_0x00e4('0xd'),auth[_0x00e4('0xa')](),controller[_0x00e4('0xe')]);router['post']('/',auth[_0x00e4('0xa')](),controller['create']);router['put']('/:id',auth[_0x00e4('0xa')](),controller['update']);router['delete'](_0x00e4('0xd'),auth[_0x00e4('0xa')](),controller[_0x00e4('0xf')]);module[_0x00e4('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 f73b55d..af1813d 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 _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 +var _0x5dd0=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING','ENUM'];(function(_0x4ff46d,_0x26c3d9){var _0x1f0a58=function(_0x2091d3){while(--_0x2091d3){_0x4ff46d['push'](_0x4ff46d['shift']());}};_0x1f0a58(++_0x26c3d9);}(_0x5dd0,0x9b));var _0x05dd=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x5dd0[_0x4e676e];return _0x336a3c;};'use strict';var moment=require(_0x05dd('0x0'));var Sequelize=require(_0x05dd('0x1'));module[_0x05dd('0x2')]={'uniqueid':{'type':Sequelize[_0x05dd('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x05dd('0x4')](_0x05dd('0x5'),_0x05dd('0x6'),_0x05dd('0x7')),'allowNull':![],'defaultValue':_0x05dd('0x7')},'transferredAt':{'type':Sequelize[_0x05dd('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x05dd('0x9')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 53343d2..9f0d0da 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 _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 +var _0x5d9b=['apply','reject','save','then','error','name','index','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','count','include','rows','catch','params','ChatTransferReport','includeAll','options','create','update','body','find','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x5d9b,0x150));var _0xb5d9=function(_0x108ae1,_0x31fbb3){_0x108ae1=_0x108ae1-0x0;var _0x713c6d=_0x5d9b[_0x108ae1];return _0x713c6d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb5d9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb5d9('0x1'));var jsonpatch=require(_0xb5d9('0x2'));var rp=require(_0xb5d9('0x3'));var moment=require(_0xb5d9('0x4'));var BPromise=require(_0xb5d9('0x5'));var Mustache=require(_0xb5d9('0x6'));var util=require('util');var path=require(_0xb5d9('0x7'));var sox=require(_0xb5d9('0x8'));var csv=require(_0xb5d9('0x9'));var ejs=require(_0xb5d9('0xa'));var fs=require('fs');var _=require(_0xb5d9('0xb'));var squel=require(_0xb5d9('0xc'));var crypto=require(_0xb5d9('0xd'));var jsforce=require(_0xb5d9('0xe'));var deskjs=require(_0xb5d9('0xf'));var toCsv=require(_0xb5d9('0x9'));var querystring=require('querystring');var Papa=require(_0xb5d9('0x10'));var Redis=require('ioredis');var authService=require(_0xb5d9('0x11'));var qs=require(_0xb5d9('0x12'));var as=require(_0xb5d9('0x13'));var hardwareService=require(_0xb5d9('0x14'));var logger=require(_0xb5d9('0x15'))(_0xb5d9('0x16'));var utils=require(_0xb5d9('0x17'));var config=require(_0xb5d9('0x18'));var db=require(_0xb5d9('0x19'))['db'];function respondWithStatusCode(_0x38ff14,_0x28cc72){_0x28cc72=_0x28cc72||0xcc;return function(_0x464be9){if(_0x464be9){return _0x38ff14[_0xb5d9('0x1a')](_0x28cc72);}return _0x38ff14[_0xb5d9('0x1b')](_0x28cc72)[_0xb5d9('0x1c')]();};}function respondWithResult(_0x3dd574,_0x29a07d){_0x29a07d=_0x29a07d||0xc8;return function(_0x485591){if(_0x485591){return _0x3dd574[_0xb5d9('0x1b')](_0x29a07d)['json'](_0x485591);}};}function respondWithFilteredResult(_0x30d472,_0x49b37e){return function(_0x5a04c1){if(_0x5a04c1){var _0x37a482=_0x5a04c1['count'],_0x16e0db=_0x49b37e[_0xb5d9('0x1d')],_0x5b6d5b=_0x49b37e['offset']+_0x49b37e[_0xb5d9('0x1e')],_0x5b83d2;if(_0x5b6d5b>=_0x37a482){_0x5b6d5b=_0x37a482;_0x5b83d2=0xc8;}else{_0x5b83d2=0xce;}_0x30d472[_0xb5d9('0x1b')](_0x5b83d2);return _0x30d472[_0xb5d9('0x1f')](_0xb5d9('0x20'),_0x16e0db+'-'+_0x5b6d5b+'/'+_0x37a482)[_0xb5d9('0x21')](_0x5a04c1);}return null;};}function patchUpdates(_0x25976a){return function(_0x2db374){try{jsonpatch[_0xb5d9('0x22')](_0x2db374,_0x25976a,!![]);}catch(_0x13b9e0){return BPromise[_0xb5d9('0x23')](_0x13b9e0);}return _0x2db374[_0xb5d9('0x24')]();};}function saveUpdates(_0x5eeb3b,_0x19ddb5){return function(_0x518319){if(_0x518319){return _0x518319['update'](_0x5eeb3b)['then'](function(_0x39a88a){return _0x39a88a;});}return null;};}function removeEntity(_0x2fc751,_0x12e0b2){return function(_0x7a2389){if(_0x7a2389){return _0x7a2389['destroy']()[_0xb5d9('0x25')](function(){_0x2fc751['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xbe66a9,_0x46e279){return function(_0x56237e){if(!_0x56237e){_0xbe66a9[_0xb5d9('0x1a')](0x194);}return _0x56237e;};}function handleError(_0x25e1a5,_0x786025){_0x786025=_0x786025||0x1f4;return function(_0x123b7b){logger[_0xb5d9('0x26')](_0x123b7b['stack']);if(_0x123b7b[_0xb5d9('0x27')]){delete _0x123b7b['name'];}_0x25e1a5[_0xb5d9('0x1b')](_0x786025)['send'](_0x123b7b);};}exports[_0xb5d9('0x28')]=function(_0x4a542b,_0x49326b){var _0x5bfb03={},_0x298be7={},_0x555f67={'count':0x0,'rows':[]};var _0x558ef7=_[_0xb5d9('0x29')](db['ChatTransferReport'][_0xb5d9('0x2a')],function(_0x14b48b){return{'name':_0x14b48b['fieldName'],'type':_0x14b48b['type'][_0xb5d9('0x2b')]};});_0x298be7[_0xb5d9('0x2c')]=_[_0xb5d9('0x29')](_0x558ef7,_0xb5d9('0x27'));_0x298be7[_0xb5d9('0x2d')]=_[_0xb5d9('0x2e')](_0x4a542b[_0xb5d9('0x2d')]);_0x298be7[_0xb5d9('0x2f')]=_[_0xb5d9('0x30')](_0x298be7['model'],_0x298be7[_0xb5d9('0x2d')]);_0x5bfb03['attributes']=_['intersection'](_0x298be7['model'],qs[_0xb5d9('0x31')](_0x4a542b['query'][_0xb5d9('0x31')]));_0x5bfb03[_0xb5d9('0x32')]=_0x5bfb03['attributes'][_0xb5d9('0x33')]?_0x5bfb03[_0xb5d9('0x32')]:_0x298be7[_0xb5d9('0x2c')];if(!_0x4a542b[_0xb5d9('0x2d')][_0xb5d9('0x34')](_0xb5d9('0x35'))){_0x5bfb03['limit']=qs[_0xb5d9('0x1e')](_0x4a542b['query'][_0xb5d9('0x1e')]);_0x5bfb03[_0xb5d9('0x1d')]=qs[_0xb5d9('0x1d')](_0x4a542b['query']['offset']);}_0x5bfb03[_0xb5d9('0x36')]=qs[_0xb5d9('0x37')](_0x4a542b['query']['sort']);_0x5bfb03[_0xb5d9('0x38')]=qs[_0xb5d9('0x2f')](_['pick'](_0x4a542b[_0xb5d9('0x2d')],_0x298be7[_0xb5d9('0x2f')]),_0x558ef7);if(_0x4a542b[_0xb5d9('0x2d')][_0xb5d9('0x39')]){_0x5bfb03[_0xb5d9('0x38')]=_[_0xb5d9('0x3a')](_0x5bfb03['where'],{'$or':_['map'](_0x558ef7,function(_0x1089a8){if(_0x1089a8['type']!==_0xb5d9('0x3b')){var _0x96f2de={};_0x96f2de[_0x1089a8['name']]={'$like':'%'+_0x4a542b[_0xb5d9('0x2d')]['filter']+'%'};return _0x96f2de;}})});}_0x5bfb03=_[_0xb5d9('0x3a')]({},_0x5bfb03,_0x4a542b['options']);var _0x4126f0={'where':_0x5bfb03[_0xb5d9('0x38')]};return db['ChatTransferReport'][_0xb5d9('0x3c')](_0x4126f0)['then'](function(_0x525c60){_0x555f67[_0xb5d9('0x3c')]=_0x525c60;if(_0x4a542b[_0xb5d9('0x2d')]['includeAll']){_0x5bfb03[_0xb5d9('0x3d')]=[{'all':!![]}];}return db['ChatTransferReport']['findAll'](_0x5bfb03);})[_0xb5d9('0x25')](function(_0x585d97){_0x555f67[_0xb5d9('0x3e')]=_0x585d97;return _0x555f67;})[_0xb5d9('0x25')](respondWithFilteredResult(_0x49326b,_0x5bfb03))[_0xb5d9('0x3f')](handleError(_0x49326b,null));};exports['show']=function(_0x21afff,_0x514b16){var _0x38b77e={'raw':!![],'where':{'id':_0x21afff[_0xb5d9('0x40')]['id']}},_0x56e6c0={};_0x56e6c0[_0xb5d9('0x2c')]=_[_0xb5d9('0x2e')](db[_0xb5d9('0x41')][_0xb5d9('0x2a')]);_0x56e6c0[_0xb5d9('0x2d')]=_[_0xb5d9('0x2e')](_0x21afff[_0xb5d9('0x2d')]);_0x56e6c0[_0xb5d9('0x2f')]=_[_0xb5d9('0x30')](_0x56e6c0[_0xb5d9('0x2c')],_0x56e6c0[_0xb5d9('0x2d')]);_0x38b77e[_0xb5d9('0x32')]=_[_0xb5d9('0x30')](_0x56e6c0[_0xb5d9('0x2c')],qs[_0xb5d9('0x31')](_0x21afff[_0xb5d9('0x2d')][_0xb5d9('0x31')]));_0x38b77e[_0xb5d9('0x32')]=_0x38b77e[_0xb5d9('0x32')][_0xb5d9('0x33')]?_0x38b77e[_0xb5d9('0x32')]:_0x56e6c0[_0xb5d9('0x2c')];if(_0x21afff[_0xb5d9('0x2d')][_0xb5d9('0x42')]){_0x38b77e[_0xb5d9('0x3d')]=[{'all':!![]}];}_0x38b77e=_[_0xb5d9('0x3a')]({},_0x38b77e,_0x21afff[_0xb5d9('0x43')]);return db[_0xb5d9('0x41')]['find'](_0x38b77e)[_0xb5d9('0x25')](handleEntityNotFound(_0x514b16,null))[_0xb5d9('0x25')](respondWithResult(_0x514b16,null))[_0xb5d9('0x3f')](handleError(_0x514b16,null));};exports[_0xb5d9('0x44')]=function(_0x333e77,_0x27fef0){return db[_0xb5d9('0x41')][_0xb5d9('0x44')](_0x333e77['body'],{})['then'](respondWithResult(_0x27fef0,0xc9))[_0xb5d9('0x3f')](handleError(_0x27fef0,null));};exports[_0xb5d9('0x45')]=function(_0x432aea,_0x522162){if(_0x432aea[_0xb5d9('0x46')]['id']){delete _0x432aea[_0xb5d9('0x46')]['id'];}return db['ChatTransferReport'][_0xb5d9('0x47')]({'where':{'id':_0x432aea[_0xb5d9('0x40')]['id']}})[_0xb5d9('0x25')](handleEntityNotFound(_0x522162,null))[_0xb5d9('0x25')](saveUpdates(_0x432aea[_0xb5d9('0x46')],null))[_0xb5d9('0x25')](respondWithResult(_0x522162,null))[_0xb5d9('0x3f')](handleError(_0x522162,null));};exports[_0xb5d9('0x48')]=function(_0x192cf8,_0x406584){return db[_0xb5d9('0x41')]['find']({'where':{'id':_0x192cf8[_0xb5d9('0x40')]['id']}})['then'](handleEntityNotFound(_0x406584,null))['then'](removeEntity(_0x406584,null))[_0xb5d9('0x3f')](handleError(_0x406584,null));};exports[_0xb5d9('0x49')]=function(_0x41682f,_0x588bac){return db['ChatTransferReport'][_0xb5d9('0x49')]()[_0xb5d9('0x25')](respondWithResult(_0x588bac,null))[_0xb5d9('0x3f')](handleError(_0x588bac,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 0c0eff7..63e22f3 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 _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 +var _0x0b80=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer'];(function(_0x52246c,_0x32403f){var _0x3a690c=function(_0x182b60){while(--_0x182b60){_0x52246c['push'](_0x52246c['shift']());}};_0x3a690c(++_0x32403f);}(_0x0b80,0x196));var _0x00b8=function(_0x81a5f2,_0x271329){_0x81a5f2=_0x81a5f2-0x0;var _0x229abd=_0x0b80[_0x81a5f2];return _0x229abd;};'use strict';var _=require(_0x00b8('0x0'));var util=require(_0x00b8('0x1'));var logger=require(_0x00b8('0x2'))('api');var moment=require(_0x00b8('0x3'));var BPromise=require(_0x00b8('0x4'));var rp=require(_0x00b8('0x5'));var fs=require('fs');var path=require(_0x00b8('0x6'));var rimraf=require(_0x00b8('0x7'));var config=require(_0x00b8('0x8'));var attributes=require(_0x00b8('0x9'));module[_0x00b8('0xa')]=function(_0x40ddc6,_0x337508){return _0x40ddc6[_0x00b8('0xb')](_0x00b8('0xc'),attributes,{'tableName':_0x00b8('0xd'),'paranoid':![],'indexes':[{'name':_0x00b8('0xe'),'fields':[_0x00b8('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 1ac1790..a385d75 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 _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 +var _0x1f64=['result','lodash','util','bluebird','ioredis','../../config/utils','jayson/promise','client','http','request','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x3b1b23,_0x21bccd){var _0x1efc85=function(_0x102a95){while(--_0x102a95){_0x3b1b23['push'](_0x3b1b23['shift']());}};_0x1efc85(++_0x21bccd);}(_0x1f64,0xfd));var _0x41f6=function(_0x55db59,_0x4f7017){_0x55db59=_0x55db59-0x0;var _0x3a9298=_0x1f64[_0x55db59];return _0x3a9298;};'use strict';var _=require(_0x41f6('0x0'));var util=require(_0x41f6('0x1'));var moment=require('moment');var BPromise=require(_0x41f6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x41f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x41f6('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x41f6('0x5'));var client=jayson[_0x41f6('0x6')][_0x41f6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2a5f45,_0x1f2295,_0x4ab123){return new BPromise(function(_0xde7f0b,_0x231598){return client[_0x41f6('0x8')](_0x2a5f45,_0x4ab123)['then'](function(_0x26bb20){logger[_0x41f6('0x9')](_0x41f6('0xa'),_0x1f2295,'request\x20sent');logger[_0x41f6('0xb')](_0x41f6('0xc'),_0x1f2295,_0x41f6('0xd'),JSON['stringify'](_0x26bb20));if(_0x26bb20[_0x41f6('0xe')]){if(_0x26bb20[_0x41f6('0xe')][_0x41f6('0xf')]===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x1f2295,_0x26bb20[_0x41f6('0xe')]['message']);return _0x231598(_0x26bb20[_0x41f6('0xe')][_0x41f6('0x10')]);}logger[_0x41f6('0xe')](_0x41f6('0xa'),_0x1f2295,_0x26bb20['error']['message']);return _0xde7f0b(_0x26bb20[_0x41f6('0xe')]['message']);}else{logger[_0x41f6('0x9')](_0x41f6('0xa'),_0x1f2295,_0x41f6('0xd'));_0xde7f0b(_0x26bb20[_0x41f6('0x11')][_0x41f6('0x10')]);}})['catch'](function(_0x2c28fc){logger['error'](_0x41f6('0xa'),_0x1f2295,_0x2c28fc);_0x231598(_0x2c28fc);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 080fa45..645ef47 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 _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 +var _0xb10b=['../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x32c57d,_0x4b455a){var _0x353d7f=function(_0x15b980){while(--_0x15b980){_0x32c57d['push'](_0x32c57d['shift']());}};_0x353d7f(++_0x4b455a);}(_0xb10b,0x12a));var _0xbb10=function(_0x1a3fe2,_0x553b71){_0x1a3fe2=_0x1a3fe2-0x0;var _0x490ee2=_0xb10b[_0x1a3fe2];return _0x490ee2;};'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('0xe')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0xf')]);router['put']('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router[_0xbb10('0x11')]('/:id',auth[_0xbb10('0x9')](),controller['destroy']);module[_0xbb10('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 f174549..f954d88 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 _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 +var _0xbccd=['squared','We\x20are\x20here!','Chat','Send','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','stringify','input','name','text','getDataValue','parse','setDataValue','onlineForm','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','rounded'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xbccd,0x1b0));var _0xdbcc=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xbccd[_0x422905];return _0x33dc6c;};'use strict';var Sequelize=require(_0xdbcc('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xdbcc('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0xdbcc('0x1')],'allowNull':![],'unique':_0xdbcc('0x2')},'description':{'type':Sequelize[_0xdbcc('0x1')]},'mapKey':{'type':Sequelize[_0xdbcc('0x1')],'defaultValue':_0xdbcc('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xdbcc('0x3')},'key':{'type':Sequelize[_0xdbcc('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xdbcc('0x1')],'defaultValue':_0xdbcc('0x4')},'customerAlias':{'type':Sequelize[_0xdbcc('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xdbcc('0x1')],'allowNull':![],'defaultValue':_0xdbcc('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xdbcc('0x1')],'allowNull':![],'defaultValue':_0xdbcc('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xdbcc('0x1')],'allowNull':![],'defaultValue':_0xdbcc('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xdbcc('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xdbcc('0x8'),_0xdbcc('0x9')),'defaultValue':_0xdbcc('0x8')},'header_online':{'type':Sequelize[_0xdbcc('0x1')],'defaultValue':_0xdbcc('0xa')},'start_chat_button':{'type':Sequelize[_0xdbcc('0x1')],'defaultValue':_0xdbcc('0xb')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xdbcc('0xc')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xdbcc('0xd')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xdbcc('0x1')],'defaultValue':_0xdbcc('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0xdbcc('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xdbcc('0xf')]},'closingQuestion':{'type':Sequelize[_0xdbcc('0x1')],'defaultValue':_0xdbcc('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xdbcc('0x1')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0xdbcc('0x11')},'noteTitle':{'type':Sequelize[_0xdbcc('0x1')],'defaultValue':_0xdbcc('0x12')},'placeholderMessage':{'type':Sequelize[_0xdbcc('0x1')],'defaultValue':_0xdbcc('0x13')},'closingMessage':{'type':Sequelize[_0xdbcc('0x1')],'defaultValue':_0xdbcc('0x14')},'closingMessageButton':{'type':Sequelize[_0xdbcc('0x1')],'defaultValue':_0xdbcc('0xc')},'skipMessageButton':{'type':Sequelize[_0xdbcc('0x1')],'defaultValue':_0xdbcc('0x15')},'conditionAgreement':{'type':Sequelize[_0xdbcc('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xdbcc('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xdbcc('0x1')],'defaultValue':_0xdbcc('0x16')},'ratingType':{'type':Sequelize['ENUM'](_0xdbcc('0x17'),'thumb'),'defaultValue':_0xdbcc('0x17')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xdbcc('0x18')]({'items':[{'type':_0xdbcc('0x19'),'variable':null,'config':{'placeholder':_0xdbcc('0x1a'),'type':_0xdbcc('0x1b'),'required':!![]},'props':{'title':_0xdbcc('0x1a'),'helpText':''}},{'type':_0xdbcc('0x19'),'props':{'title':_0xdbcc('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xdbcc('0x3'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xdbcc('0x1c')]('onlineForm')?JSON[_0xdbcc('0x1d')](this[_0xdbcc('0x1c')]('onlineForm')):{};},'set':function(_0x18d76d){return this[_0xdbcc('0x1e')](_0xdbcc('0x1f'),JSON['stringify'](_0x18d76d));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xdbcc('0x18')]({'items':[{'type':_0xdbcc('0x19'),'props':{'title':_0xdbcc('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xdbcc('0x3')},'variable':null},{'type':_0xdbcc('0x20'),'config':{'placeholder':'Comments'},'props':{'title':_0xdbcc('0x21'),'helpText':_0xdbcc('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0xdbcc('0x1c')]('offlineForm')?JSON[_0xdbcc('0x1d')](this['getDataValue'](_0xdbcc('0x23'))):{};},'set':function(_0x57d722){return this[_0xdbcc('0x1e')]('offlineForm',JSON[_0xdbcc('0x18')](_0x57d722));}},'token':{'type':Sequelize[_0xdbcc('0x1')],'defaultValue':function(){return rs[_0xdbcc('0x24')]();}},'autoclose':{'type':Sequelize[_0xdbcc('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xdbcc('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xdbcc('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xdbcc('0x1')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xdbcc('0x1')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xdbcc('0x25')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xdbcc('0x1')],'defaultValue':_0xdbcc('0x26')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xdbcc('0x27')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xdbcc('0x1')],'defaultValue':_0xdbcc('0x28')},'skipUnmanaged':{'type':Sequelize[_0xdbcc('0x1')],'defaultValue':_0xdbcc('0x15')},'sendUnmanaged':{'type':Sequelize[_0xdbcc('0x1')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xdbcc('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xdbcc('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xdbcc('0xf')]},'showAgentAvatar':{'type':Sequelize[_0xdbcc('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xdbcc('0x29');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xdbcc('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xdbcc('0x1')],'defaultValue':_0xdbcc('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xdbcc('0x2b')},'verticalAlignment':{'type':Sequelize[_0xdbcc('0xd')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xdbcc('0x1')]},'customerAvatar':{'type':Sequelize[_0xdbcc('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0xdbcc('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xdbcc('0xd')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xdbcc('0x1')],'allowNull':![],'defaultValue':_0xdbcc('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xdbcc('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdbcc('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xdbcc('0x1')],'defaultValue':_0xdbcc('0x2d')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdbcc('0xd')],'comment':_0xdbcc('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0xdbcc('0x7')],'defaultValue':![],'comment':_0xdbcc('0x2f'),'set':function(_0x7f1b20){if(!_0x7f1b20)this[_0xdbcc('0x1e')](_0xdbcc('0x30'),null);this[_0xdbcc('0x1e')]('mandatoryDisposition',_0x7f1b20);}},'vidaooEscalation':{'type':Sequelize[_0xdbcc('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xdbcc('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 dc9034f..c669328 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 _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 +var _0x4d2e=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','ChatWebsiteId','Disposition','hasOwnProperty','order','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','../../config/license/util','custom','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','isNil','showCustomerAvatar','getSystemAvatar','headers','chat','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','DESC','ChatApplication','Applications','account','applications','list','orderBy','priority','asc','defaults','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','x-real-port','referer','browser','version','unknown','device','vendor','format','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','close','ChatMessage','AttachmentId','UserId','User','unshift','agent','*,*,*,*','forcedOwnership','Start','startRouting','notify','offline','CompanyId','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','MailAccount','findOne','MailServerOut','forwardOfflineAddress','Smtp','service','host','port','secure','authentication','auth','SendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','getInteractions','Contact','Owner','fullname','internal','Tags','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','ONLINE','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','getProactiveActions','virtual','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.js','utf8','remote','x-real-ip','connection','replace','alignment','color','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','omit','emit','userChatWebsite:save','isArray','userChatWebsite:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./chatWebsite.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','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','ChatWebsites','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','VIRTUAL','filter','merge','options','ChatWebsite','include','findAll','rows','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource'];(function(_0x52e994,_0x2d6434){var _0x1253e0=function(_0x1128e5){while(--_0x1128e5){_0x52e994['push'](_0x52e994['shift']());}};_0x1253e0(++_0x2d6434);}(_0x4d2e,0x1e0));var _0xe4d2=function(_0x4753db,_0x346fa7){_0x4753db=_0x4753db-0x0;var _0x1ee50d=_0x4d2e[_0x4753db];return _0x1ee50d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe4d2('0x0'));var zipdir=require(_0xe4d2('0x1'));var jsonpatch=require(_0xe4d2('0x2'));var rp=require(_0xe4d2('0x3'));var moment=require(_0xe4d2('0x4'));var BPromise=require(_0xe4d2('0x5'));var Mustache=require(_0xe4d2('0x6'));var util=require(_0xe4d2('0x7'));var path=require('path');var sox=require(_0xe4d2('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe4d2('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe4d2('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xe4d2('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe4d2('0xc'));var authService=require(_0xe4d2('0xd'));var qs=require(_0xe4d2('0xe'));var as=require(_0xe4d2('0xf'));var hardwareService=require(_0xe4d2('0x10'));var logger=require(_0xe4d2('0x11'))(_0xe4d2('0x12'));var utils=require(_0xe4d2('0x13'));var config=require(_0xe4d2('0x14'));var db=require('../../mysqldb')['db'];config[_0xe4d2('0x15')]=_['defaults'](config[_0xe4d2('0x15')],{'host':_0xe4d2('0x16'),'port':0x18eb});var socket=require(_0xe4d2('0x17'))(new Redis(config[_0xe4d2('0x15')]));require(_0xe4d2('0x18'))[_0xe4d2('0x19')](socket);var jayson=require(_0xe4d2('0x1a'));var client=jayson[_0xe4d2('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0xe4d2('0x1b')][_0xe4d2('0x1c')]({'port':0x232a});var client9003=jayson[_0xe4d2('0x1b')][_0xe4d2('0x1c')]({'port':0x232b});function checkPasswordPattern(_0x5b6736,_0x4863bc,_0x629087){if(_0x629087){var _0x38e509=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x38e509[_0xe4d2('0x1d')](_0x4863bc)){return _0x5b6736;}else{throw new db[(_0xe4d2('0x1e'))][(_0xe4d2('0x1f'))](_0xe4d2('0x20'));}}else{return _0x5b6736;}}function respondWithRpcPromise(_0x461f5c,_0x4ddec4,_0x32da1f,_0xdb8439){return new BPromise(function(_0x18b4ea,_0x3fa1ec){var _0x2687f5=_0xdb8439||client;return _0x2687f5[_0xe4d2('0x21')](_0x461f5c,_0x32da1f)[_0xe4d2('0x22')](function(_0x577268){logger[_0xe4d2('0x23')](_0xe4d2('0x24'),_0x4ddec4,'request\x20sent');logger[_0xe4d2('0x25')](_0xe4d2('0x26'),_0x4ddec4,_0xe4d2('0x27'),JSON['stringify'](_0x577268));if(_0x577268['error']){if(_0x577268[_0xe4d2('0x28')][_0xe4d2('0x29')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x4ddec4,_0x577268[_0xe4d2('0x28')][_0xe4d2('0x2a')]);return _0x3fa1ec(_0x577268[_0xe4d2('0x28')][_0xe4d2('0x2a')]);}logger['error'](_0xe4d2('0x24'),_0x4ddec4,_0x577268['error'][_0xe4d2('0x2a')]);return _0x18b4ea(_0x577268['error'][_0xe4d2('0x2a')]);}else{logger[_0xe4d2('0x23')](_0xe4d2('0x24'),_0x4ddec4,_0xe4d2('0x27'));_0x18b4ea(_0x577268[_0xe4d2('0x2b')][_0xe4d2('0x2a')]);}})[_0xe4d2('0x2c')](function(_0x318c40){logger['error'](_0xe4d2('0x24'),_0x4ddec4,_0x318c40);_0x3fa1ec(_0x318c40);});});}function respondWithStatusCode(_0x3c8866,_0x2721e9){_0x2721e9=_0x2721e9||0xcc;return function(_0x1bbea7){if(_0x1bbea7){return _0x3c8866['sendStatus'](_0x2721e9);}return _0x3c8866['status'](_0x2721e9)[_0xe4d2('0x2d')]();};}function respondWithResult(_0x4cf496,_0x2aead1){_0x2aead1=_0x2aead1||0xc8;return function(_0x3bddab){if(_0x3bddab){return _0x4cf496[_0xe4d2('0x2e')](_0x2aead1)[_0xe4d2('0x2f')](_0x3bddab);}};}function respondWithFilteredResult(_0x2935a5,_0x114e23){return function(_0x2b9d7f){if(_0x2b9d7f){var _0x3ce1f1=_0x2b9d7f[_0xe4d2('0x30')],_0x153f78=_0x114e23['offset'],_0x307347=_0x114e23[_0xe4d2('0x31')]+_0x114e23[_0xe4d2('0x32')],_0x52d759;if(_0x307347>=_0x3ce1f1){_0x307347=_0x3ce1f1;_0x52d759=0xc8;}else{_0x52d759=0xce;}_0x2935a5[_0xe4d2('0x2e')](_0x52d759);return _0x2935a5[_0xe4d2('0x33')](_0xe4d2('0x34'),_0x153f78+'-'+_0x307347+'/'+_0x3ce1f1)['json'](_0x2b9d7f);}return null;};}function patchUpdates(_0x1ef563){return function(_0xa79c26){try{jsonpatch[_0xe4d2('0x35')](_0xa79c26,_0x1ef563,!![]);}catch(_0x40a166){return BPromise[_0xe4d2('0x36')](_0x40a166);}return _0xa79c26[_0xe4d2('0x37')]();};}function saveUpdates(_0x17a91a,_0x3d4a18){return function(_0x30073e){if(_0x30073e){return _0x30073e[_0xe4d2('0x38')](_0x17a91a)[_0xe4d2('0x22')](function(_0x4a4182){return _0x4a4182;});}return null;};}function removeEntity(_0x2c4b86,_0x290220){return function(_0x311bd0){if(_0x311bd0){return _0x311bd0[_0xe4d2('0x39')]()[_0xe4d2('0x22')](function(){var _0x2ce9c1=_0x311bd0[_0xe4d2('0x3a')]({'plain':!![]});var _0x43d3dd=_0xe4d2('0x3b');return db['UserProfileResource'][_0xe4d2('0x39')]({'where':{'type':_0x43d3dd,'resourceId':_0x2ce9c1['id']}})[_0xe4d2('0x22')](function(){return _0x311bd0;});})[_0xe4d2('0x22')](function(){_0x2c4b86[_0xe4d2('0x2e')](0xcc)[_0xe4d2('0x2d')]();});}};}function handleEntityNotFound(_0x4db200,_0x551af9){return function(_0x3548b5){if(!_0x3548b5){_0x4db200[_0xe4d2('0x3c')](0x194);}return _0x3548b5;};}function handleError(_0x570e22,_0x168102){_0x168102=_0x168102||0x1f4;return function(_0x5d4838){logger[_0xe4d2('0x28')](_0x5d4838[_0xe4d2('0x3d')]);if(_0x5d4838['name']){delete _0x5d4838[_0xe4d2('0x3e')];}_0x570e22[_0xe4d2('0x2e')](_0x168102)[_0xe4d2('0x3f')](_0x5d4838);};}exports[_0xe4d2('0x40')]=function(_0x99a03b,_0x1dd1c4){var _0x36d21d={'include':[{'model':db[_0xe4d2('0x41')],'as':_0xe4d2('0x42')}]},_0x58cb3e={},_0x238921={'count':0x0,'rows':[]};var _0x20ff74=_[_0xe4d2('0x43')](db['ChatWebsite'][_0xe4d2('0x44')],function(_0x135e80){return{'name':_0x135e80[_0xe4d2('0x45')],'type':_0x135e80[_0xe4d2('0x46')][_0xe4d2('0x47')]};});_0x58cb3e[_0xe4d2('0x48')]=_[_0xe4d2('0x43')](_0x20ff74,_0xe4d2('0x3e'));_0x58cb3e[_0xe4d2('0x49')]=_[_0xe4d2('0x4a')](_0x99a03b[_0xe4d2('0x49')]);_0x58cb3e[_0xe4d2('0x4b')]=_[_0xe4d2('0x4c')](_0x58cb3e['model'],_0x58cb3e[_0xe4d2('0x49')]);_0x36d21d['attributes']=_[_0xe4d2('0x4c')](_0x58cb3e[_0xe4d2('0x48')],qs[_0xe4d2('0x4d')](_0x99a03b[_0xe4d2('0x49')][_0xe4d2('0x4d')]));_0x36d21d[_0xe4d2('0x4e')]=_0x36d21d['attributes'][_0xe4d2('0x4f')]?_0x36d21d['attributes']:_0x58cb3e[_0xe4d2('0x48')];if(!_0x99a03b[_0xe4d2('0x49')]['hasOwnProperty'](_0xe4d2('0x50'))){_0x36d21d[_0xe4d2('0x32')]=qs['limit'](_0x99a03b[_0xe4d2('0x49')][_0xe4d2('0x32')]);_0x36d21d[_0xe4d2('0x31')]=qs['offset'](_0x99a03b[_0xe4d2('0x49')][_0xe4d2('0x31')]);}_0x36d21d['order']=qs[_0xe4d2('0x51')](_0x99a03b[_0xe4d2('0x49')][_0xe4d2('0x51')]);_0x36d21d[_0xe4d2('0x52')]=qs['filters'](_['pick'](_0x99a03b[_0xe4d2('0x49')],_0x58cb3e['filters']),_0x20ff74);if(_0x99a03b[_0xe4d2('0x49')]['filter']){_0x36d21d[_0xe4d2('0x52')]=_['merge'](_0x36d21d[_0xe4d2('0x52')],{'$or':_[_0xe4d2('0x43')](_0x20ff74,function(_0x534430){if(_0x534430['type']!==_0xe4d2('0x53')){var _0x332af9={};_0x332af9[_0x534430['name']]={'$like':'%'+_0x99a03b[_0xe4d2('0x49')][_0xe4d2('0x54')]+'%'};return _0x332af9;}})});}_0x36d21d=_[_0xe4d2('0x55')]({},_0x36d21d,_0x99a03b[_0xe4d2('0x56')]);var _0x3dd4f3={'where':_0x36d21d[_0xe4d2('0x52')]};return db[_0xe4d2('0x57')]['count'](_0x3dd4f3)[_0xe4d2('0x22')](function(_0x129ae9){_0x238921[_0xe4d2('0x30')]=_0x129ae9;if(_0x99a03b[_0xe4d2('0x49')]['includeAll']){_0x36d21d[_0xe4d2('0x58')]=[{'all':!![]}];}return db['ChatWebsite'][_0xe4d2('0x59')](_0x36d21d);})[_0xe4d2('0x22')](function(_0x1794c5){_0x238921[_0xe4d2('0x5a')]=_0x1794c5;return _0x238921;})[_0xe4d2('0x22')](respondWithFilteredResult(_0x1dd1c4,_0x36d21d))[_0xe4d2('0x2c')](handleError(_0x1dd1c4,null));};exports[_0xe4d2('0x5b')]=function(_0x18ca19,_0x43eff8){var _0x5ef72e={'raw':![],'where':{'id':_0x18ca19[_0xe4d2('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0xe4d2('0x42')}]},_0x3e4fac={};_0x3e4fac[_0xe4d2('0x48')]=_['keys'](db[_0xe4d2('0x57')][_0xe4d2('0x44')]);_0x3e4fac['query']=_[_0xe4d2('0x4a')](_0x18ca19['query']);_0x3e4fac[_0xe4d2('0x4b')]=_[_0xe4d2('0x4c')](_0x3e4fac[_0xe4d2('0x48')],_0x3e4fac[_0xe4d2('0x49')]);_0x5ef72e['attributes']=_[_0xe4d2('0x4c')](_0x3e4fac[_0xe4d2('0x48')],qs[_0xe4d2('0x4d')](_0x18ca19[_0xe4d2('0x49')][_0xe4d2('0x4d')]));_0x5ef72e[_0xe4d2('0x4e')]=_0x5ef72e['attributes']['length']?_0x5ef72e[_0xe4d2('0x4e')]:_0x3e4fac[_0xe4d2('0x48')];if(_0x18ca19['query'][_0xe4d2('0x5d')]){_0x5ef72e[_0xe4d2('0x58')]=[{'all':!![]}];}_0x5ef72e=_[_0xe4d2('0x55')]({},_0x5ef72e,_0x18ca19['options']);return db[_0xe4d2('0x57')]['find'](_0x5ef72e)[_0xe4d2('0x22')](handleEntityNotFound(_0x43eff8,null))[_0xe4d2('0x22')](respondWithResult(_0x43eff8,null))['catch'](handleError(_0x43eff8,null));};exports[_0xe4d2('0x5e')]=function(_0x3af04a,_0x4f48a0){return db[_0xe4d2('0x57')][_0xe4d2('0x5e')](_0x3af04a[_0xe4d2('0x5f')],{})[_0xe4d2('0x22')](function(_0x307eee){var _0xc4a63a=_0x3af04a[_0xe4d2('0x60')][_0xe4d2('0x3a')]({'plain':!![]});if(!_0xc4a63a)throw new Error(_0xe4d2('0x61'));if(_0xc4a63a[_0xe4d2('0x62')]===_0xe4d2('0x60')){var _0x2548fa=_0x307eee[_0xe4d2('0x3a')]({'plain':!![]});var _0x5385c6=_0xe4d2('0x3b');return db['UserProfileSection']['find']({'where':{'name':_0x5385c6,'userProfileId':_0xc4a63a[_0xe4d2('0x63')]},'raw':!![]})['then'](function(_0x13b2aa){if(_0x13b2aa&&_0x13b2aa[_0xe4d2('0x64')]===0x0){return db[_0xe4d2('0x65')][_0xe4d2('0x5e')]({'name':_0x2548fa[_0xe4d2('0x3e')],'resourceId':_0x2548fa['id'],'type':_0x13b2aa[_0xe4d2('0x3e')],'sectionId':_0x13b2aa['id']},{})['then'](function(){return _0x307eee;});}else{return _0x307eee;}})[_0xe4d2('0x2c')](function(_0x5e5749){logger['error'](_0xe4d2('0x66'),_0x5e5749);throw _0x5e5749;});}return _0x307eee;})[_0xe4d2('0x22')](respondWithResult(_0x4f48a0,0xc9))[_0xe4d2('0x2c')](handleError(_0x4f48a0,null));};exports[_0xe4d2('0x38')]=function(_0x23fcce,_0x59034e){if(_0x23fcce[_0xe4d2('0x5f')]['id']){delete _0x23fcce[_0xe4d2('0x5f')]['id'];}return db[_0xe4d2('0x57')][_0xe4d2('0x67')]({'where':{'id':_0x23fcce[_0xe4d2('0x5c')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xe4d2('0x22')](handleEntityNotFound(_0x59034e,null))['then'](saveUpdates(_0x23fcce[_0xe4d2('0x5f')],null))[_0xe4d2('0x22')](respondWithResult(_0x59034e,null))[_0xe4d2('0x2c')](handleError(_0x59034e,null));};exports[_0xe4d2('0x39')]=function(_0x274079,_0x3c7f6c){return db[_0xe4d2('0x57')][_0xe4d2('0x67')]({'where':{'id':_0x274079[_0xe4d2('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3c7f6c,null))['then'](removeEntity(_0x3c7f6c,null))[_0xe4d2('0x2c')](handleError(_0x3c7f6c,null));};exports[_0xe4d2('0x68')]=function(_0x13e7ca,_0x1c7d96){return db[_0xe4d2('0x57')]['describe']()[_0xe4d2('0x22')](respondWithResult(_0x1c7d96,null))[_0xe4d2('0x2c')](handleError(_0x1c7d96,null));};exports[_0xe4d2('0x69')]=function(_0xe9f448,_0x2abbdb,_0x53cba5){if(_0xe9f448[_0xe4d2('0x5f')]['id']){delete _0xe9f448[_0xe4d2('0x5f')]['id'];}return db[_0xe4d2('0x57')]['find']({'where':{'id':_0xe9f448['params']['id']}})[_0xe4d2('0x22')](handleEntityNotFound(_0x2abbdb,null))[_0xe4d2('0x22')](function(_0x2c26f2){if(_0x2c26f2){_0xe9f448[_0xe4d2('0x5f')][_0xe4d2('0x6a')]=_0x2c26f2['id'];return db[_0xe4d2('0x6b')][_0xe4d2('0x5e')](_0xe9f448[_0xe4d2('0x5f')]);}})[_0xe4d2('0x22')](respondWithResult(_0x2abbdb,null))[_0xe4d2('0x2c')](handleError(_0x2abbdb,null));};exports['getDispositions']=function(_0x19f7ac,_0x424387,_0x37c174){var _0x4fd939={'raw':![],'where':{}};var _0x1a848b={};var _0x15d860={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x19f7ac[_0xe4d2('0x5c')]['id']}})[_0xe4d2('0x22')](handleEntityNotFound(_0x424387,null))[_0xe4d2('0x22')](function(_0x30d4ba){if(_0x30d4ba){_0x1a848b['model']=_[_0xe4d2('0x4a')](db[_0xe4d2('0x6b')]['rawAttributes']);_0x1a848b['query']=_[_0xe4d2('0x4a')](_0x19f7ac[_0xe4d2('0x49')]);_0x1a848b[_0xe4d2('0x4b')]=_[_0xe4d2('0x4c')](_0x1a848b[_0xe4d2('0x48')],_0x1a848b[_0xe4d2('0x49')]);_0x4fd939[_0xe4d2('0x4e')]=_[_0xe4d2('0x4c')](_0x1a848b[_0xe4d2('0x48')],qs[_0xe4d2('0x4d')](_0x19f7ac['query'][_0xe4d2('0x4d')]));_0x4fd939[_0xe4d2('0x4e')]=_0x4fd939[_0xe4d2('0x4e')][_0xe4d2('0x4f')]?_0x4fd939[_0xe4d2('0x4e')]:_0x1a848b[_0xe4d2('0x48')];if(!_0x19f7ac[_0xe4d2('0x49')][_0xe4d2('0x6c')](_0xe4d2('0x50'))){_0x4fd939[_0xe4d2('0x32')]=qs['limit'](_0x19f7ac[_0xe4d2('0x49')]['limit']);_0x4fd939[_0xe4d2('0x31')]=qs['offset'](_0x19f7ac['query'][_0xe4d2('0x31')]);}_0x4fd939[_0xe4d2('0x6d')]=qs[_0xe4d2('0x51')](_0x19f7ac[_0xe4d2('0x49')][_0xe4d2('0x51')]);_0x4fd939[_0xe4d2('0x52')]=qs[_0xe4d2('0x4b')](_[_0xe4d2('0x6e')](_0x19f7ac[_0xe4d2('0x49')],_0x1a848b[_0xe4d2('0x4b')]));_0x4fd939[_0xe4d2('0x52')][_0xe4d2('0x6a')]=_0x30d4ba['id'];if(_0x19f7ac[_0xe4d2('0x49')][_0xe4d2('0x54')]){_0x4fd939[_0xe4d2('0x52')]=_['merge'](_0x4fd939[_0xe4d2('0x52')],{'$or':_[_0xe4d2('0x43')](_0x4fd939[_0xe4d2('0x4e')],function(_0x26eac4){var _0x546e43={};_0x546e43[_0x26eac4]={'$like':'%'+_0x19f7ac['query'][_0xe4d2('0x54')]+'%'};return _0x546e43;})});}_0x4fd939=_[_0xe4d2('0x55')]({},_0x4fd939,_0x19f7ac[_0xe4d2('0x56')]);return db[_0xe4d2('0x6b')][_0xe4d2('0x30')]({'where':_0x4fd939[_0xe4d2('0x52')]})['then'](function(_0xd2b25){_0x15d860[_0xe4d2('0x30')]=_0xd2b25;if(_0x19f7ac[_0xe4d2('0x49')][_0xe4d2('0x5d')]){_0x4fd939[_0xe4d2('0x58')]=[{'all':!![]}];}return db[_0xe4d2('0x6b')][_0xe4d2('0x59')](_0x4fd939);})[_0xe4d2('0x22')](function(_0x2193e4){_0x15d860[_0xe4d2('0x5a')]=_0x2193e4;return _0x15d860;});}})[_0xe4d2('0x22')](respondWithFilteredResult(_0x424387,_0x4fd939))[_0xe4d2('0x2c')](handleError(_0x424387,null));};exports['removeDispositions']=function(_0x2d2d89,_0x2ed943,_0xb96234){return db[_0xe4d2('0x57')][_0xe4d2('0x67')]({'where':{'id':_0x2d2d89[_0xe4d2('0x5c')]['id']}})[_0xe4d2('0x22')](handleEntityNotFound(_0x2ed943,null))[_0xe4d2('0x22')](function(_0x1bf082){if(_0x1bf082){return _0x1bf082[_0xe4d2('0x6f')](_0x2d2d89[_0xe4d2('0x49')][_0xe4d2('0x70')]);}})['then'](respondWithStatusCode(_0x2ed943,null))[_0xe4d2('0x2c')](handleError(_0x2ed943,null));};exports[_0xe4d2('0x71')]=function(_0x53460d,_0x2ade23,_0x48f585){if(_0x53460d[_0xe4d2('0x5f')]['id']){delete _0x53460d['body']['id'];}return db['ChatWebsite'][_0xe4d2('0x67')]({'where':{'id':_0x53460d[_0xe4d2('0x5c')]['id']}})[_0xe4d2('0x22')](handleEntityNotFound(_0x2ade23,null))[_0xe4d2('0x22')](function(_0x2939a2){if(_0x2939a2){_0x53460d[_0xe4d2('0x5f')][_0xe4d2('0x6a')]=_0x2939a2['id'];return db[_0xe4d2('0x72')]['create'](_0x53460d['body']);}})[_0xe4d2('0x22')](respondWithResult(_0x2ade23,null))[_0xe4d2('0x2c')](handleError(_0x2ade23,null));};exports[_0xe4d2('0x73')]=function(_0x12cf4b,_0x41cf5a,_0x281840){var _0x1dcd93={'raw':![],'where':{}};var _0x1b939c={};var _0x1de6d5={'count':0x0,'rows':[]};return db[_0xe4d2('0x57')]['findOne']({'where':{'id':_0x12cf4b[_0xe4d2('0x5c')]['id']}})[_0xe4d2('0x22')](handleEntityNotFound(_0x41cf5a,null))[_0xe4d2('0x22')](function(_0x45cd90){if(_0x45cd90){_0x1b939c[_0xe4d2('0x48')]=_[_0xe4d2('0x4a')](db[_0xe4d2('0x72')]['rawAttributes']);_0x1b939c['query']=_[_0xe4d2('0x4a')](_0x12cf4b[_0xe4d2('0x49')]);_0x1b939c[_0xe4d2('0x4b')]=_[_0xe4d2('0x4c')](_0x1b939c['model'],_0x1b939c[_0xe4d2('0x49')]);_0x1dcd93[_0xe4d2('0x4e')]=_[_0xe4d2('0x4c')](_0x1b939c[_0xe4d2('0x48')],qs[_0xe4d2('0x4d')](_0x12cf4b[_0xe4d2('0x49')][_0xe4d2('0x4d')]));_0x1dcd93['attributes']=_0x1dcd93[_0xe4d2('0x4e')][_0xe4d2('0x4f')]?_0x1dcd93[_0xe4d2('0x4e')]:_0x1b939c[_0xe4d2('0x48')];if(!_0x12cf4b['query'][_0xe4d2('0x6c')](_0xe4d2('0x50'))){_0x1dcd93['limit']=qs[_0xe4d2('0x32')](_0x12cf4b['query']['limit']);_0x1dcd93[_0xe4d2('0x31')]=qs[_0xe4d2('0x31')](_0x12cf4b[_0xe4d2('0x49')]['offset']);}_0x1dcd93[_0xe4d2('0x6d')]=qs[_0xe4d2('0x51')](_0x12cf4b[_0xe4d2('0x49')]['sort']);_0x1dcd93[_0xe4d2('0x52')]=qs[_0xe4d2('0x4b')](_[_0xe4d2('0x6e')](_0x12cf4b[_0xe4d2('0x49')],_0x1b939c[_0xe4d2('0x4b')]));_0x1dcd93[_0xe4d2('0x52')][_0xe4d2('0x6a')]=_0x45cd90['id'];if(_0x12cf4b['query'][_0xe4d2('0x54')]){_0x1dcd93[_0xe4d2('0x52')]=_[_0xe4d2('0x55')](_0x1dcd93['where'],{'$or':_['map'](_0x1dcd93['attributes'],function(_0x11449f){var _0x22fd81={};_0x22fd81[_0x11449f]={'$like':'%'+_0x12cf4b['query'][_0xe4d2('0x54')]+'%'};return _0x22fd81;})});}_0x1dcd93=_[_0xe4d2('0x55')]({},_0x1dcd93,_0x12cf4b[_0xe4d2('0x56')]);return db[_0xe4d2('0x72')][_0xe4d2('0x30')]({'where':_0x1dcd93['where']})[_0xe4d2('0x22')](function(_0x227fdd){_0x1de6d5[_0xe4d2('0x30')]=_0x227fdd;if(_0x12cf4b[_0xe4d2('0x49')][_0xe4d2('0x5d')]){_0x1dcd93[_0xe4d2('0x58')]=[{'all':!![]}];}return db[_0xe4d2('0x72')][_0xe4d2('0x59')](_0x1dcd93);})[_0xe4d2('0x22')](function(_0x250029){_0x1de6d5[_0xe4d2('0x5a')]=_0x250029;return _0x1de6d5;});}})['then'](respondWithFilteredResult(_0x41cf5a,_0x1dcd93))[_0xe4d2('0x2c')](handleError(_0x41cf5a,null));};exports[_0xe4d2('0x74')]=function(_0x56f5e3,_0x525210,_0x2a3a32){return db['ChatWebsite'][_0xe4d2('0x67')]({'where':{'id':_0x56f5e3[_0xe4d2('0x5c')]['id']}})[_0xe4d2('0x22')](handleEntityNotFound(_0x525210,null))[_0xe4d2('0x22')](function(_0x3aff06){if(_0x3aff06){return _0x3aff06[_0xe4d2('0x74')](_0x56f5e3[_0xe4d2('0x49')][_0xe4d2('0x70')]);}})[_0xe4d2('0x22')](respondWithStatusCode(_0x525210,null))[_0xe4d2('0x2c')](handleError(_0x525210,null));};exports[_0xe4d2('0x75')]=function(_0x26a4b4,_0x53eaa1,_0x5c9259){_0x26a4b4[_0xe4d2('0x5f')][_0xe4d2('0x76')]=_0x26a4b4[_0xe4d2('0x77')][_0xe4d2('0x78')];return db[_0xe4d2('0x57')][_0xe4d2('0x67')]({'where':{'id':_0x26a4b4[_0xe4d2('0x5c')]['id']}})[_0xe4d2('0x22')](handleEntityNotFound(_0x53eaa1,null))[_0xe4d2('0x22')](saveUpdates(_0x26a4b4[_0xe4d2('0x5f')],null))[_0xe4d2('0x22')](respondWithResult(_0x53eaa1,null))[_0xe4d2('0x2c')](handleError(_0x53eaa1,null));};exports[_0xe4d2('0x79')]=function(_0x2911e3,_0x5d991f,_0x1da857){_0x2911e3['body'][_0xe4d2('0x7a')]=_0x2911e3['file'][_0xe4d2('0x78')];return db[_0xe4d2('0x57')][_0xe4d2('0x67')]({'where':{'id':_0x2911e3[_0xe4d2('0x5c')]['id']}})[_0xe4d2('0x22')](handleEntityNotFound(_0x5d991f,null))[_0xe4d2('0x22')](saveUpdates(_0x2911e3[_0xe4d2('0x5f')],null))[_0xe4d2('0x22')](respondWithResult(_0x5d991f,null))[_0xe4d2('0x2c')](handleError(_0x5d991f,null));};exports[_0xe4d2('0x7b')]=function(_0x461430,_0x564939,_0x5dece3){_0x461430[_0xe4d2('0x5f')][_0xe4d2('0x7c')]=_0x461430[_0xe4d2('0x77')]['filename'];return db[_0xe4d2('0x57')][_0xe4d2('0x67')]({'where':{'id':_0x461430[_0xe4d2('0x5c')]['id']}})[_0xe4d2('0x22')](handleEntityNotFound(_0x564939,null))[_0xe4d2('0x22')](saveUpdates(_0x461430[_0xe4d2('0x5f')],null))['then'](respondWithResult(_0x564939,null))[_0xe4d2('0x2c')](handleError(_0x564939,null));};exports[_0xe4d2('0x7d')]=function(_0x22ffcc,_0x57767b,_0x5667f8){_0x22ffcc['body'][_0xe4d2('0x7e')]=_0x22ffcc[_0xe4d2('0x77')][_0xe4d2('0x78')];return db['ChatWebsite']['find']({'where':{'id':_0x22ffcc[_0xe4d2('0x5c')]['id']}})['then'](handleEntityNotFound(_0x57767b,null))['then'](saveUpdates(_0x22ffcc['body'],null))[_0xe4d2('0x22')](respondWithResult(_0x57767b,null))[_0xe4d2('0x2c')](handleError(_0x57767b,null));};exports[_0xe4d2('0x7f')]=function(_0x3655f5,_0x16bc90,_0x5e141c){var _0x4aba2a=path[_0xe4d2('0x80')](config[_0xe4d2('0x81')],'server/files/images/logos/default_logo.svg');var _0x399084={'where':{'id':_0x3655f5[_0xe4d2('0x5c')]['id']},'attributes':['id',_0xe4d2('0x76')],'raw':!![]};var _0x1624fa=![];return require(_0xe4d2('0x82'))['getLicense']()[_0xe4d2('0x22')](function(_0x5b6983){if(_0x5b6983){_0x1624fa=_0x5b6983[_0xe4d2('0x83')];}})['then'](function(){return db[_0xe4d2('0x57')]['find'](_0x399084);})[_0xe4d2('0x22')](handleEntityNotFound(_0x16bc90,null))['then'](function(_0x27e691){if(_0x27e691){if(!_['isNil'](_0x27e691[_0xe4d2('0x76')])){if(fs[_0xe4d2('0x84')](path[_0xe4d2('0x80')](config[_0xe4d2('0x81')],_0xe4d2('0x85'),_0x27e691[_0xe4d2('0x76')]))&&_0x1624fa){_0x4aba2a=path[_0xe4d2('0x80')](config[_0xe4d2('0x81')],_0xe4d2('0x85'),_0x27e691['sitepic']);}}return _0x16bc90[_0xe4d2('0x86')](_0x4aba2a);}})[_0xe4d2('0x2c')](handleError(_0x16bc90,null));};exports[_0xe4d2('0x87')]=function(_0xd40974,_0x54ba97,_0x3074e8){var _0x5942a2=path[_0xe4d2('0x80')](config[_0xe4d2('0x81')],_0xe4d2('0x88'));var _0x43b777={'where':{'id':_0xd40974[_0xe4d2('0x5c')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xe4d2('0x57')]['find'](_0x43b777)[_0xe4d2('0x22')](handleEntityNotFound(_0x54ba97,null))[_0xe4d2('0x22')](function(_0x2b009d){if(_0x2b009d){if(!_['isNil'](_0x2b009d[_0xe4d2('0x7a')])){if(fs[_0xe4d2('0x84')](path[_0xe4d2('0x80')](config[_0xe4d2('0x81')],_0xe4d2('0x89'),_0x2b009d[_0xe4d2('0x7a')]))){_0x5942a2=path[_0xe4d2('0x80')](config[_0xe4d2('0x81')],'server/files/images/avatars/',_0x2b009d['agentAvatar']);}}return _0x54ba97[_0xe4d2('0x86')](_0x5942a2);}})[_0xe4d2('0x2c')](handleError(_0x54ba97,null));};exports[_0xe4d2('0x8a')]=function(_0x3d84af,_0x595f19,_0x7c9058){var _0x15b317=path[_0xe4d2('0x80')](config[_0xe4d2('0x81')],_0xe4d2('0x8b'));var _0x324ff2={'where':{'id':_0x3d84af[_0xe4d2('0x5c')]['id']},'attributes':['id',_0xe4d2('0x7c'),'showCustomerAvatar'],'raw':!![]};return db[_0xe4d2('0x57')]['find'](_0x324ff2)[_0xe4d2('0x22')](handleEntityNotFound(_0x595f19,null))[_0xe4d2('0x22')](function(_0xd87547){if(_0xd87547){if(!_[_0xe4d2('0x8c')](_0xd87547['customerAvatar'])){if(fs[_0xe4d2('0x84')](path[_0xe4d2('0x80')](config[_0xe4d2('0x81')],_0xe4d2('0x89'),_0xd87547[_0xe4d2('0x7c')]))&&_0xd87547[_0xe4d2('0x8d')]){_0x15b317=path[_0xe4d2('0x80')](config[_0xe4d2('0x81')],_0xe4d2('0x89'),_0xd87547[_0xe4d2('0x7c')]);}}return _0x595f19[_0xe4d2('0x86')](_0x15b317);}})[_0xe4d2('0x2c')](handleError(_0x595f19,null));};exports[_0xe4d2('0x8e')]=function(_0x41023a,_0x407354,_0x1d8492){var _0x6d88de=path['join'](config[_0xe4d2('0x81')],'server/files/images/avatars/system_avatar.png');var _0x40a27c={'where':{'id':_0x41023a['params']['id']},'attributes':['id',_0xe4d2('0x7e')],'raw':!![]};return db[_0xe4d2('0x57')][_0xe4d2('0x67')](_0x40a27c)[_0xe4d2('0x22')](handleEntityNotFound(_0x407354,null))[_0xe4d2('0x22')](function(_0x52aefd){if(_0x52aefd){if(!_[_0xe4d2('0x8c')](_0x52aefd[_0xe4d2('0x7e')])){if(fs[_0xe4d2('0x84')](path[_0xe4d2('0x80')](config[_0xe4d2('0x81')],'server/files/images/avatars/',_0x52aefd['systemAvatar']))){_0x6d88de=path['join'](config[_0xe4d2('0x81')],'server/files/images/avatars/',_0x52aefd[_0xe4d2('0x7e')]);}}return _0x407354[_0xe4d2('0x86')](_0x6d88de);}})[_0xe4d2('0x2c')](handleError(_0x407354,null));};exports['notify']=function(_0x1b0477,_0x4533dd,_0x1c2ce0){var _0x5c2d53=require('user-agent-parser');var _0x46c403=new _0x5c2d53();var _0x35e8a9=_0x46c403['setUA'](_0x1b0477[_0xe4d2('0x8f')]['user-agent'])['getResult']();var _0x3f8f34={'body':_0x1b0477[_0xe4d2('0x5f')],'channel':_0xe4d2('0x90')};var _0x33e185=[];var _0x13af8f=[];var _0x4d2809={};var _0x2996ce=![];return db['CmContact'][_0xe4d2('0x68')]()['then'](function(_0x1dccab){if(!_0x1dccab){throw new db['Sequelize'][(_0xe4d2('0x1f'))](_0xe4d2('0x91'));}_0x33e185=_[_0xe4d2('0x92')](_[_0xe4d2('0x4a')](_0x1dccab),[_0xe4d2('0x93'),'updatedAt']);_0x13af8f=_['difference'](_[_0xe4d2('0x4a')](_0x1dccab),[_0xe4d2('0x93'),_0xe4d2('0x94'),'CompanyId',_0xe4d2('0x95')]);if(_0x1b0477[_0xe4d2('0x5f')]['id']){delete _0x1b0477[_0xe4d2('0x5f')]['id'];}if(_['isNil'](_0x1b0477[_0xe4d2('0x5f')][_0xe4d2('0x96')])){throw new db[(_0xe4d2('0x1e'))]['ValidationError'](_0xe4d2('0x97'));}if(_['isNil'](_0x1b0477[_0xe4d2('0x5f')][_0xe4d2('0x5f')])||_0x1b0477['body'][_0xe4d2('0x5f')]===''){throw new db['Sequelize'][(_0xe4d2('0x1f'))](_0xe4d2('0x98'));}if(_['isNil'](_0x1b0477[_0xe4d2('0x5f')][_0xe4d2('0x99')])){throw new db[(_0xe4d2('0x1e'))][(_0xe4d2('0x1f'))](_0xe4d2('0x9a')+_0x13af8f);}if(!_['includes'](_0x13af8f,_0x1b0477['body'][_0xe4d2('0x99')])){throw new db[(_0xe4d2('0x1e'))][(_0xe4d2('0x1f'))](_0xe4d2('0x9b')+_0x13af8f);}_0x4d2809[_0x1b0477['body'][_0xe4d2('0x99')]]=_0x1b0477[_0xe4d2('0x5f')][_0xe4d2('0x96')];})[_0xe4d2('0x22')](function(){return db['ChatWebsite'][_0xe4d2('0x67')]({'where':{'id':_0x1b0477['params']['id']},'include':[{'model':db[_0xe4d2('0x9c')],'as':_0xe4d2('0x9d'),'include':[{'model':db[_0xe4d2('0x9e')],'as':_0xe4d2('0x9f'),'where':_0x4d2809,'limit':0x1,'order':[[_0xe4d2('0x94'),_0xe4d2('0xa0')]]}]},{'model':db[_0xe4d2('0xa1')],'as':_0xe4d2('0xa2')}]});})['then'](handleEntityNotFound(_0x4533dd,null))[_0xe4d2('0x22')](function(_0x6c8333){if(_0x6c8333&&_0x6c8333['List']){_0x3f8f34[_0xe4d2('0xa3')]=_0x6c8333;_0x3f8f34[_0xe4d2('0xa4')]=_0x6c8333[_0xe4d2('0xa2')];_0x3f8f34[_0xe4d2('0xa5')]=_0x6c8333[_0xe4d2('0x9d')];_0x3f8f34[_0xe4d2('0xa4')]=_[_0xe4d2('0xa6')](_0x3f8f34[_0xe4d2('0xa4')],[_0xe4d2('0xa7')],[_0xe4d2('0xa8')]);if(_0x3f8f34[_0xe4d2('0xa3')][_0xe4d2('0xa2')]){delete _0x3f8f34[_0xe4d2('0xa3')][_0xe4d2('0xa2')];}if(_0x3f8f34[_0xe4d2('0xa3')][_0xe4d2('0x9d')]&&_0x3f8f34[_0xe4d2('0xa3')]['List']['Contacts'][_0xe4d2('0x4f')]){return _0x3f8f34[_0xe4d2('0xa3')][_0xe4d2('0x9d')][_0xe4d2('0x9f')][0x0];}var _0x53d84b=_[_0xe4d2('0xa9')](_0x1b0477[_0xe4d2('0x5f')],{'firstName':_0x1b0477['body']['from'],'ListId':_0x6c8333[_0xe4d2('0x95')]});_0x53d84b[_0x1b0477[_0xe4d2('0x5f')][_0xe4d2('0x99')]]=_0x1b0477[_0xe4d2('0x5f')]['from'];return db[_0xe4d2('0x9e')][_0xe4d2('0x5e')](_0x53d84b,{'fields':_0x33e185,'raw':!![]});}})[_0xe4d2('0x22')](handleEntityNotFound(_0x4533dd,null))['then'](function(_0x3fa3cc){_0x3f8f34[_0xe4d2('0xaa')]=_0x3fa3cc;var _0x4590c4=_0x1b0477[_0xe4d2('0x5f')][_0xe4d2('0xab')];if(_0x1b0477[_0xe4d2('0x8f')][_0xe4d2('0xac')]){_0x4590c4=_0x1b0477[_0xe4d2('0x8f')][_0xe4d2('0xac')];}else if(_0x1b0477[_0xe4d2('0x8f')]['x-forwarded-for']){_0x4590c4=_[_0xe4d2('0xad')](_0x1b0477[_0xe4d2('0x8f')][_0xe4d2('0xae')][_0xe4d2('0xaf')](','));}if(_0x3fa3cc){var _0x45643a={'ContactId':_0x3fa3cc['id'],'ChatWebsiteId':_0x1b0477[_0xe4d2('0x5c')]['id'],'from':(_0x3fa3cc[_0xe4d2('0xb0')]||'')+'\x20'+(_0x3fa3cc['lastName']||''),'customerIp':_0x4590c4,'customerPort':_0x1b0477['headers'][_0xe4d2('0xb1')]?_0x1b0477['headers'][_0xe4d2('0xb1')]:null,'referer':_0x1b0477[_0xe4d2('0x5f')][_0xe4d2('0xb2')],'browserName':_0x35e8a9['browser'][_0xe4d2('0x3e')]&&_0x35e8a9[_0xe4d2('0xb3')][_0xe4d2('0xb4')]?util['format']('%s\x20%s',_0x35e8a9[_0xe4d2('0xb3')][_0xe4d2('0x3e')],_0x35e8a9[_0xe4d2('0xb3')][_0xe4d2('0xb4')]):_0xe4d2('0xb5'),'browserVersion':_0x35e8a9['browser'][_0xe4d2('0xb4')]||_0xe4d2('0xb5'),'osName':util['format']('%s\x20%s',_0x35e8a9['os'][_0xe4d2('0x3e')],_0x35e8a9['os'][_0xe4d2('0xb4')]),'osVersion':_0x35e8a9['os']['version'],'deviceModel':_0x35e8a9[_0xe4d2('0xb6')][_0xe4d2('0x48')]&&_0x35e8a9[_0xe4d2('0xb6')][_0xe4d2('0xb7')]?util[_0xe4d2('0xb8')](_0xe4d2('0xb9'),_0x35e8a9['device'][_0xe4d2('0x48')],_0x35e8a9[_0xe4d2('0xb6')][_0xe4d2('0xb7')],_0x35e8a9[_0xe4d2('0xb6')][_0xe4d2('0x46')]):null,'deviceVendor':_0x35e8a9[_0xe4d2('0xb6')][_0xe4d2('0xb7')],'deviceType':_0x35e8a9[_0xe4d2('0xb6')][_0xe4d2('0x46')],'formData':JSON[_0xe4d2('0xba')](_0x1b0477[_0xe4d2('0x5f')])};var _0x294618={'ChatWebsiteId':_0x1b0477['params']['id'],'closed':![]};if(_0x1b0477[_0xe4d2('0x5f')][_0xe4d2('0xbb')]){_0x294618[_0xe4d2('0xbb')]=_0x1b0477[_0xe4d2('0x5f')]['threadId'];return db[_0xe4d2('0xbc')][_0xe4d2('0x67')]({'where':_0x294618})[_0xe4d2('0x22')](function(_0x4a94ea){if(_0x4a94ea){return[_0x4a94ea,![]];}_0x45643a[_0xe4d2('0xbb')]=_0x1b0477['body']['threadId'];_0x45643a[_0xe4d2('0xbd')]=_0x1b0477[_0xe4d2('0x5f')]['externalUrl'];return db[_0xe4d2('0xbc')][_0xe4d2('0x5e')](_0x45643a)['then'](function(_0x48c2fb){return[_0x48c2fb,!![]];});});}_0x294618[_0xe4d2('0xbe')]=_0x3fa3cc['id'];if(_0x1b0477[_0xe4d2('0x5f')][_0xe4d2('0xbf')]&&_0x1b0477[_0xe4d2('0x5f')]['interaction']['id']){_0x294618['id']=_0x1b0477['body']['interaction']['id'];return db[_0xe4d2('0xbc')][_0xe4d2('0x67')]({'where':_0x294618})[_0xe4d2('0x22')](function(_0x10a8b9){if(_0x10a8b9){return[_0x10a8b9,![]];}return db['ChatInteraction']['create'](_0x45643a)[_0xe4d2('0x22')](function(_0x4406e1){return[_0x4406e1,!![]];});});}return db['ChatInteraction']['create'](_0x45643a)[_0xe4d2('0x22')](function(_0x253b02){return[_0x253b02,!![]];});}})[_0xe4d2('0xc0')](function(_0x2f482e,_0x13e081){if(_0x2f482e){_0x2996ce=_0x13e081;if(!_0x13e081){var _0x3bf97d={'from':(_0x3f8f34[_0xe4d2('0xaa')][_0xe4d2('0xb0')]||'')+'\x20'+(_0x3f8f34[_0xe4d2('0xaa')]['lastName']||'')};if(_0x1b0477[_0xe4d2('0x5f')]['threadId']&&_0x1b0477[_0xe4d2('0x5f')][_0xe4d2('0xc1')]&&_0x1b0477[_0xe4d2('0x5f')][_0xe4d2('0xbb')]!=_0x1b0477['body']['messageId']){_0x3bf97d[_0xe4d2('0xbb')]=_0x1b0477[_0xe4d2('0x5f')][_0xe4d2('0xc1')];}return _0x2f482e[_0xe4d2('0x38')](_0x3bf97d);}else{return _0x2f482e;}}})[_0xe4d2('0x22')](function(_0x5d0b48){_0x3f8f34[_0xe4d2('0xbf')]=_0x5d0b48[_0xe4d2('0x3a')]({'plain':!![]});_0x3f8f34[_0xe4d2('0xbf')]['created']=_0x2996ce;if(_0x3f8f34[_0xe4d2('0xbf')][_0xe4d2('0xc2')]){if(_0x3f8f34[_0xe4d2('0xa3')][_0xe4d2('0xc3')]){_0x3f8f34[_0xe4d2('0xa4')][_0xe4d2('0xc4')]({'id':0x0,'priority':_0x3f8f34['applications'][_0xe4d2('0x4f')]+0x1,'app':_0xe4d2('0xc5'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0xe4d2('0xc6')][_0xe4d2('0x5e')]({'body':_0x1b0477['body']['body'],'ChatWebsiteId':_0x1b0477[_0xe4d2('0x5c')]['id'],'ChatInteractionId':_0x5d0b48['id'],'direction':'in','ContactId':_0x3f8f34[_0xe4d2('0xaa')]['id'],'AttachmentId':_0x1b0477[_0xe4d2('0x5f')][_0xe4d2('0xc7')]});})[_0xe4d2('0x22')](function(_0x3eee1b){_0x3f8f34[_0xe4d2('0x2a')]=_0x3eee1b;if(_0x3f8f34[_0xe4d2('0xbf')][_0xe4d2('0xc8')]){return db[_0xe4d2('0xc9')][_0xe4d2('0x67')]({'attributes':['id',_0xe4d2('0x3e')],'where':{'id':_0x3f8f34[_0xe4d2('0xbf')][_0xe4d2('0xc8')]}})[_0xe4d2('0x22')](function(_0x59621d){if(_0x59621d){_0x3f8f34[_0xe4d2('0xa4')][_0xe4d2('0xca')]({'id':0x0,'priority':0x0,'app':_0xe4d2('0xcb'),'appdata':_0x59621d['name']+','+(_0x3f8f34[_0xe4d2('0xa3')]['waitForTheAssignedAgent']||0xa),'interval':_0xe4d2('0xcc')});_0x3f8f34[_0xe4d2('0xcd')]=!![];}return respondWithRpcPromise(_0xe4d2('0xce'),_0xe4d2('0xcf'),_0x3f8f34);});}return respondWithRpcPromise(_0xe4d2('0xce'),_0xe4d2('0xcf'),_0x3f8f34);})['then'](function(_0x22f932){respondWithRpcPromise('EventManager','EventManager',{'event':_0xe4d2('0xd0'),'message':_0x22f932},client9002);return _0x22f932;})[_0xe4d2('0x22')](respondWithResult(_0x4533dd,null))['catch'](handleError(_0x4533dd,null));};exports[_0xe4d2('0xd1')]=function(_0x1e5394,_0x28b533,_0x2f922c){var _0x197ad4,_0x3cb6f4,_0x481c09;var _0x2e22f5=[];var _0x2f5c7e=[];var _0x3b1bfb={};return db['CmContact']['describe']()[_0xe4d2('0x22')](function(_0x52333f){if(!_0x52333f){throw new db[(_0xe4d2('0x1e'))][(_0xe4d2('0x1f'))](_0xe4d2('0x91'));}_0x2f5c7e=_[_0xe4d2('0x92')](_['keys'](_0x52333f),[_0xe4d2('0x93'),_0xe4d2('0x94')]);_0x2e22f5=_[_0xe4d2('0x92')](_['keys'](_0x52333f),[_0xe4d2('0x93'),_0xe4d2('0x94'),_0xe4d2('0xd2'),_0xe4d2('0x95')]);if(_0x1e5394[_0xe4d2('0x5f')]['id']){delete _0x1e5394['body']['id'];}if(_[_0xe4d2('0x8c')](_0x1e5394[_0xe4d2('0x5f')][_0xe4d2('0x96')])){throw _0x28b533[_0xe4d2('0x2e')](0x1f4)[_0xe4d2('0x3f')](new db['Sequelize'][(_0xe4d2('0x1f'))]('from\x20is\x20mandatory'));}if(_[_0xe4d2('0x8c')](_0x1e5394[_0xe4d2('0x5f')][_0xe4d2('0x5f')])||_0x1e5394['body'][_0xe4d2('0x5f')]===''){throw _0x28b533['status'](0x1f4)[_0xe4d2('0x3f')](new db['Sequelize'][(_0xe4d2('0x1f'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xe4d2('0x8c')](_0x1e5394['body'][_0xe4d2('0xd3')])){throw _0x28b533[_0xe4d2('0x2e')](0x1f4)[_0xe4d2('0x3f')](new db[(_0xe4d2('0x1e'))][(_0xe4d2('0x1f'))](_0xe4d2('0xd4')+_0x2e22f5));}if(!_[_0xe4d2('0xd5')](_0x2e22f5,_0x1e5394[_0xe4d2('0x5f')][_0xe4d2('0xd3')])){throw _0x28b533[_0xe4d2('0x2e')](0x1f4)[_0xe4d2('0x3f')](new db['Sequelize'][(_0xe4d2('0x1f'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2e22f5));}_0x3b1bfb[_0x1e5394[_0xe4d2('0x5f')][_0xe4d2('0xd3')]]=_0x1e5394[_0xe4d2('0x5f')][_0xe4d2('0x96')];})['then'](function(){return db[_0xe4d2('0x57')][_0xe4d2('0x67')]({'where':{'id':_0x1e5394['params']['id']},'include':[{'model':db['CmList'],'as':_0xe4d2('0x9d')}]});})[_0xe4d2('0x22')](handleEntityNotFound(_0x28b533,null))[_0xe4d2('0x22')](function(_0x5a9bf8){if(_0x5a9bf8&&_0x5a9bf8[_0xe4d2('0x9d')]){_0x3cb6f4=_0x5a9bf8;var _0x156520=_['defaults'](_0x1e5394[_0xe4d2('0x5f')],{'firstName':_0x1e5394[_0xe4d2('0x5f')]['from'],'phone':_0x1e5394[_0xe4d2('0x5f')][_0xe4d2('0x96')],'ListId':_0x5a9bf8[_0xe4d2('0x95')]});_0x156520[_0x1e5394['body'][_0xe4d2('0xd3')]]=_0x1e5394[_0xe4d2('0x5f')][_0xe4d2('0x96')];return db[_0xe4d2('0x9e')]['findOrCreate']({'where':_0x3b1bfb,'defaults':_0x156520});}})[_0xe4d2('0xc0')](function(_0x20574a){if(_0x20574a){_0x481c09=_0x20574a;var _0x1f7b1c=fs[_0xe4d2('0xd6')](path['join'](config[_0xe4d2('0x81')],_0xe4d2('0xd7')),'utf8');var _0x63a054=ejs[_0xe4d2('0xd8')](_0x1f7b1c,{'body':_[_0xe4d2('0xd9')](_0x1e5394['body'][_0xe4d2('0x5f')]),'bodyTitle':_0x3cb6f4[_0xe4d2('0xda')]});return db['ChatOfflineMessage'][_0xe4d2('0x5e')]({'body':_0x63a054,'ContactId':_0x20574a['id'],'ChatWebsiteId':_0x3cb6f4['id']});}})[_0xe4d2('0x22')](function(_0x5c5b96){if(_0x5c5b96){_0x197ad4=_0x5c5b96;return db[_0xe4d2('0xdb')][_0xe4d2('0xdc')]({'where':{'service':!![]},'include':[{'model':db[_0xe4d2('0xdd')],'as':'Smtp','raw':!![]}]});}})[_0xe4d2('0x22')](function(_0x4eccd2){if(_0x4eccd2&&_0x4eccd2['Smtp']&&_0x3cb6f4[_0xe4d2('0xde')]){var _0x51c36e={'tls':{'rejectUnauthorized':![]}};if(_0x4eccd2[_0xe4d2('0xdf')][_0xe4d2('0xe0')]){_0x51c36e['service']=_0x4eccd2[_0xe4d2('0xdf')][_0xe4d2('0xe0')];}else{_0x51c36e[_0xe4d2('0xe1')]=_0x4eccd2['Smtp'][_0xe4d2('0xe1')];_0x51c36e[_0xe4d2('0xe2')]=_0x4eccd2[_0xe4d2('0xdf')][_0xe4d2('0xe2')];_0x51c36e[_0xe4d2('0xe3')]=_0x4eccd2[_0xe4d2('0xdf')][_0xe4d2('0xe3')];}if(_0x4eccd2[_0xe4d2('0xdf')][_0xe4d2('0xe4')]){_0x51c36e[_0xe4d2('0xe5')]={'user':_0x4eccd2[_0xe4d2('0xdf')][_0xe4d2('0x60')],'pass':_0x4eccd2[_0xe4d2('0xdf')]['pass']};}return respondWithRpcPromise(_0xe4d2('0xe6'),'sendMail',{'account':_0x51c36e,'message':{'from':util[_0xe4d2('0xb8')](_0xe4d2('0xe7'),_0x4eccd2['name'],_0x4eccd2[_0xe4d2('0xe8')]||_0x4eccd2['Smtp'][_0xe4d2('0x60')]),'to':_0x3cb6f4[_0xe4d2('0xde')],'subject':_0x3cb6f4[_0xe4d2('0xe9')],'text':_0x197ad4['body']}},client9003)[_0xe4d2('0x22')](function(){return _0x197ad4;})[_0xe4d2('0x2c')](function(_0x2aa3ce){console[_0xe4d2('0x28')](_0x2aa3ce);});}})[_0xe4d2('0x22')](function(){if(_0x197ad4){return _0x197ad4;}})[_0xe4d2('0x22')](respondWithResult(_0x28b533,null))['catch'](handleError(_0x28b533,null));};exports[_0xe4d2('0xea')]=function(_0x58cced,_0x521c12,_0x32cc97){return db[_0xe4d2('0xbc')][_0xe4d2('0x67')]({'where':{'id':_0x58cced['params']['id']}})[_0xe4d2('0x22')](handleEntityNotFound(_0x521c12,null))[_0xe4d2('0x22')](function(_0x2eca45){if(_0x2eca45){return _0x2eca45[_0xe4d2('0xea')](_0x58cced[_0xe4d2('0x5f')]['ids'],_['omit'](_0x58cced['body'],[_0xe4d2('0x70'),'id'])||{});}})[_0xe4d2('0x22')](respondWithResult(_0x521c12,null))[_0xe4d2('0x2c')](handleError(_0x521c12,null));};exports[_0xe4d2('0xeb')]=function(_0x7e3b61,_0x5a6c44,_0x1a4e2c){var _0x5338b4={'raw':![],'where':{}};var _0x2cae99={};var _0x2e3c71={'count':0x0,'rows':[]};return db[_0xe4d2('0x57')][_0xe4d2('0xdc')]({'where':{'id':_0x7e3b61['params']['id']}})['then'](handleEntityNotFound(_0x5a6c44,null))['then'](function(_0x585c58){if(_0x585c58){_0x2cae99['model']=_[_0xe4d2('0x4a')](db[_0xe4d2('0xbc')][_0xe4d2('0x44')]);_0x2cae99['query']=_[_0xe4d2('0x4a')](_0x7e3b61[_0xe4d2('0x49')]);_0x2cae99[_0xe4d2('0x4b')]=_[_0xe4d2('0x4c')](_0x2cae99[_0xe4d2('0x48')],_0x2cae99[_0xe4d2('0x49')]);_0x5338b4[_0xe4d2('0x4e')]=_[_0xe4d2('0x4c')](_0x2cae99['model'],qs[_0xe4d2('0x4d')](_0x7e3b61[_0xe4d2('0x49')][_0xe4d2('0x4d')]));_0x5338b4[_0xe4d2('0x4e')]=_0x5338b4[_0xe4d2('0x4e')][_0xe4d2('0x4f')]?_0x5338b4[_0xe4d2('0x4e')]:_0x2cae99[_0xe4d2('0x48')];if(!_0x7e3b61['query'][_0xe4d2('0x6c')](_0xe4d2('0x50'))){_0x5338b4[_0xe4d2('0x32')]=qs[_0xe4d2('0x32')](_0x7e3b61[_0xe4d2('0x49')][_0xe4d2('0x32')]);_0x5338b4[_0xe4d2('0x31')]=qs[_0xe4d2('0x31')](_0x7e3b61[_0xe4d2('0x49')][_0xe4d2('0x31')]);}_0x5338b4[_0xe4d2('0x6d')]=qs[_0xe4d2('0x51')](_0x7e3b61['query'][_0xe4d2('0x51')]);_0x5338b4[_0xe4d2('0x52')]=qs[_0xe4d2('0x4b')](_['pick'](_0x7e3b61['query'],_0x2cae99[_0xe4d2('0x4b')]));_0x5338b4[_0xe4d2('0x52')][_0xe4d2('0x6a')]=_0x585c58['id'];if(_0x7e3b61[_0xe4d2('0x49')]['filter']){_0x5338b4[_0xe4d2('0x52')]=_['merge'](_0x5338b4[_0xe4d2('0x52')],{'$or':_[_0xe4d2('0x43')](_0x5338b4['attributes'],function(_0x45ce15){var _0x1f12d9={};_0x1f12d9[_0x45ce15]={'$like':'%'+_0x7e3b61['query']['filter']+'%'};return _0x1f12d9;})});}_0x5338b4=_['merge']({},_0x5338b4,_0x7e3b61[_0xe4d2('0x56')]);return db[_0xe4d2('0xbc')][_0xe4d2('0x30')]({'where':_0x5338b4[_0xe4d2('0x52')]})['then'](function(_0x31a413){_0x2e3c71['count']=_0x31a413;if(_0x7e3b61[_0xe4d2('0x49')]['includeAll']){_0x5338b4['include']=[{'model':db[_0xe4d2('0x9e')],'as':_0xe4d2('0xec'),'required':![]},{'model':db[_0xe4d2('0xc9')],'as':_0xe4d2('0xed'),'attributes':[_0xe4d2('0x3e'),_0xe4d2('0xee'),_0xe4d2('0xef')],'required':![]},{'model':db['Tag'],'as':_0xe4d2('0xf0'),'attributes':['id','name','color'],'where':_0x7e3b61[_0xe4d2('0x49')]['tag']?{'id':_0x7e3b61[_0xe4d2('0x49')][_0xe4d2('0xf1')]}:undefined,'required':_0x7e3b61[_0xe4d2('0x49')]['tag']?!![]:![]}];}return db[_0xe4d2('0xbc')][_0xe4d2('0x59')](_0x5338b4);})['then'](function(_0x3ec164){_0x2e3c71[_0xe4d2('0x5a')]=_0x3ec164;return _0x2e3c71;});}})[_0xe4d2('0x22')](respondWithFilteredResult(_0x5a6c44,_0x5338b4))[_0xe4d2('0x2c')](handleError(_0x5a6c44,null));};function iftimePromise(_0x4716f5,_0x2f079b){return respondWithRpcPromise(_0xe4d2('0xf2'),_0xe4d2('0xf3'),{'command':_0x2f079b[_0xe4d2('0xf4')]?util[_0xe4d2('0xb8')](_0xe4d2('0xf5'),_0x4716f5[_0xe4d2('0xf6')],_0x2f079b[_0xe4d2('0xf4')]):util['format']('iftime\x20%s',_0x4716f5['interval'])},client9002)['then'](function(_0x471fc8){var _0x52aa67=_0x471fc8&&_0x471fc8['indexOf']('true')>=0x0?!![]:![];logger[_0xe4d2('0x23')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x2f079b['id'],_0x4716f5['id'],_0x4716f5['interval'],_0x52aa67?_0xe4d2('0xf7'):_0xe4d2('0xf8'),_0x2f079b[_0xe4d2('0xf4')]?_0x2f079b[_0xe4d2('0xf4')]:_0xe4d2('0xf9'));return _0x52aa67;})['catch'](function(_0x4c2d89){logger['error'](_0xe4d2('0xfa'),_0x2f079b['id'],_0x4716f5['id'],_0x4716f5[_0xe4d2('0xf6')],util[_0xe4d2('0xfb')](_0x4c2d89,{'showHidden':![],'depth':null}),_0x2f079b[_0xe4d2('0xf4')]?_0x2f079b[_0xe4d2('0xf4')]:_0xe4d2('0xf9'));return![];});}exports[_0xe4d2('0xf3')]=function(_0x42cf1b,_0x596531,_0x2259c6){var _0x16a98b=0x0;var _0x2238bf=0x0;var _0x1e523e=![];var _0x4ee14c;var _0x590302;return db[_0xe4d2('0x57')][_0xe4d2('0x67')]({'where':{'id':_0x42cf1b[_0xe4d2('0x5c')]['id']},'include':[{'model':db[_0xe4d2('0xfc')],'as':_0xe4d2('0xfc'),'include':[{'model':db[_0xe4d2('0xfc')],'as':_0xe4d2('0xfd'),'attributes':['id',_0xe4d2('0xf6')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x596531,null))[_0xe4d2('0x22')](function(_0x45e282){if(_0x45e282){_0x4ee14c=_0x45e282;return _0x45e282[_0xe4d2('0xfe')]({'raw':!![]});}})[_0xe4d2('0x22')](function(_0x1f7f3a){if(_0x4ee14c){if(_0x1f7f3a){_0x590302=_0x1f7f3a;}}return require(_0xe4d2('0x82'))['getLicense']();})[_0xe4d2('0x22')](function(_0x16e587){if(_0x16e587){_0x2238bf=_0x16e587[_0xe4d2('0xff')];_0x1e523e=_0x16e587[_0xe4d2('0x83')];}})['then'](function(){return db[_0xe4d2('0xbc')][_0xe4d2('0x30')]({'where':{'closed':![]}});})[_0xe4d2('0x22')](function(_0x35da09){_0x16a98b=_0x35da09;if(_0x2238bf&&_0x35da09>_0x2238bf){return db['License'][_0xe4d2('0xdc')]({'where':{'id':0x1}})[_0xe4d2('0x22')](function(_0x757dab){if(_0x757dab){_0x757dab[_0xe4d2('0x100')](_0xe4d2('0x101'));}});}})['then'](function(){if(_0x4ee14c['Interval']&&_0x4ee14c[_0xe4d2('0xfc')]['Intervals']){var _0xab4c21=[];for(var _0x175915=0x0;_0x175915<_0x4ee14c[_0xe4d2('0xfc')][_0xe4d2('0xfd')]['length'];_0x175915++){var _0x1be466=_0x4ee14c[_0xe4d2('0xfc')][_0xe4d2('0xfd')][_0x175915][_0xe4d2('0x3a')]({'plain':!![]});_0xab4c21[_0xe4d2('0xc4')](iftimePromise(_0x1be466,_0x4ee14c));}return BPromise[_0xe4d2('0x102')](_0xab4c21)[_0xe4d2('0x22')](function(_0x204706){return _[_0xe4d2('0x103')](_0x204706);});}else{return!![];}})[_0xe4d2('0x22')](function(_0x4201b9){var _0x4b7506=fs[_0xe4d2('0xd6')](path['join'](config['root'],_0xe4d2('0x104')),_0xe4d2('0x105'));var _0x1f2b21={'remote':_0x4ee14c[_0xe4d2('0x106')],'query':querystring[_0xe4d2('0xba')](_[_0xe4d2('0x55')](_0x4ee14c['get']({'plain':!![]}),{'customerIp':_0x42cf1b['headers'][_0xe4d2('0xae')]||_0x42cf1b[_0xe4d2('0x8f')][_0xe4d2('0x107')]||_0x42cf1b[_0xe4d2('0x108')]['remoteAddress']||_0x42cf1b['ip'],'referer':_0x42cf1b['headers'][_0xe4d2('0xb2')],'openedInteractions':_0x16a98b,'maxInteractions':_0x2238bf,'virtual':_0x1e523e['virtual'],'online':_0x4201b9,'custom':_0x1e523e}))[_0xe4d2('0x109')](/'/g,'\x5c\x27')};_0x596531[_0xe4d2('0x3f')](ejs[_0xe4d2('0xd8')](Mustache[_0xe4d2('0xd8')](_0x4b7506,_0x1f2b21),{'proactiveActions':_0x590302,'alignment':_0x4ee14c[_0xe4d2('0x10a')],'verticalAlignment':_0x4ee14c['verticalAlignment'],'div_color':_0x4ee14c[_0xe4d2('0x10b')],'text_color':_0x4ee14c['textColor']}));})['catch'](handleError(_0x596531,null));};exports[_0xe4d2('0x10c')]=function(_0x5dcdbf,_0x1dcda8,_0x15b86b){return db['ChatWebsite'][_0xe4d2('0xdc')]({'where':{'id':_0x5dcdbf[_0xe4d2('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1dcda8,null))['then'](function(_0x5e94d6){if(_0x5e94d6){return db[_0xe4d2('0x10d')][_0xe4d2('0x10e')](function(_0x30fac0){return db[_0xe4d2('0xa1')][_0xe4d2('0x39')]({'where':{'ChatWebsiteId':_0x5dcdbf[_0xe4d2('0x5c')]['id']},'transaction':_0x30fac0})[_0xe4d2('0x22')](function(_0x5af252){var _0x2540b4=_[_0xe4d2('0x43')](_0x5dcdbf[_0xe4d2('0x5f')],function(_0x515560){_0x515560['ChatWebsiteId']=_0x5dcdbf[_0xe4d2('0x5c')]['id'];return _0x515560;});return db[_0xe4d2('0xa1')][_0xe4d2('0x10f')](_0x2540b4,{'transaction':_0x30fac0});});})['then'](function(){return db[_0xe4d2('0xa1')][_0xe4d2('0x110')]({'where':{'ChatWebsiteId':_0x5dcdbf[_0xe4d2('0x5c')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x1dcda8,null))[_0xe4d2('0x2c')](handleError(_0x1dcda8,null));};exports[_0xe4d2('0x111')]=function(_0xf2cd98,_0x39056e,_0x28f070){var _0x3198b8={};var _0x7f72cc={};var _0x18b6ff;var _0x23728b;return db[_0xe4d2('0x57')][_0xe4d2('0xdc')]({'where':{'id':_0xf2cd98[_0xe4d2('0x5c')]['id']}})['then'](handleEntityNotFound(_0x39056e,null))[_0xe4d2('0x22')](function(_0x3f7fd9){if(_0x3f7fd9){_0x18b6ff=_0x3f7fd9;_0x7f72cc[_0xe4d2('0x48')]=_[_0xe4d2('0x4a')](db[_0xe4d2('0xa1')][_0xe4d2('0x44')]);_0x7f72cc[_0xe4d2('0x49')]=_[_0xe4d2('0x4a')](_0xf2cd98[_0xe4d2('0x49')]);_0x7f72cc[_0xe4d2('0x4b')]=_[_0xe4d2('0x4c')](_0x7f72cc[_0xe4d2('0x48')],_0x7f72cc['query']);_0x3198b8[_0xe4d2('0x4e')]=_[_0xe4d2('0x4c')](_0x7f72cc[_0xe4d2('0x48')],qs[_0xe4d2('0x4d')](_0xf2cd98['query'][_0xe4d2('0x4d')]));_0x3198b8[_0xe4d2('0x4e')]=_0x3198b8[_0xe4d2('0x4e')][_0xe4d2('0x4f')]?_0x3198b8[_0xe4d2('0x4e')]:_0x7f72cc['model'];_0x3198b8['order']=qs[_0xe4d2('0x51')](_0xf2cd98[_0xe4d2('0x49')][_0xe4d2('0x51')]);_0x3198b8['where']=qs[_0xe4d2('0x4b')](_[_0xe4d2('0x6e')](_0xf2cd98['query'],_0x7f72cc[_0xe4d2('0x4b')]));if(_0xf2cd98[_0xe4d2('0x49')][_0xe4d2('0x54')]){_0x3198b8['where']=_[_0xe4d2('0x55')](_0x3198b8[_0xe4d2('0x52')],{'$or':_[_0xe4d2('0x43')](_0x3198b8[_0xe4d2('0x4e')],function(_0x55d1a5){var _0x9b3edb={};_0x9b3edb[_0x55d1a5]={'$like':'%'+_0xf2cd98[_0xe4d2('0x49')][_0xe4d2('0x54')]+'%'};return _0x9b3edb;})});}_0x3198b8=_['merge']({},_0x3198b8,_0xf2cd98[_0xe4d2('0x56')]);return _0x18b6ff[_0xe4d2('0x111')](_0x3198b8);}})[_0xe4d2('0x22')](function(_0x1cc1a7){if(_0x1cc1a7){_0x23728b=_0x1cc1a7['length'];if(!_0xf2cd98[_0xe4d2('0x49')][_0xe4d2('0x6c')]('nolimit')){_0x3198b8[_0xe4d2('0x32')]=qs[_0xe4d2('0x32')](_0xf2cd98[_0xe4d2('0x49')]['limit']);_0x3198b8[_0xe4d2('0x31')]=qs[_0xe4d2('0x31')](_0xf2cd98[_0xe4d2('0x49')][_0xe4d2('0x31')]);}return _0x18b6ff['getApplications'](_0x3198b8);}})[_0xe4d2('0x22')](function(_0x3b8382){if(_0x3b8382){return _0x3b8382?{'count':_0x23728b,'rows':_0x3b8382}:null;}})['then'](respondWithResult(_0x39056e,null))['catch'](handleError(_0x39056e,null));};exports[_0xe4d2('0x112')]=function(_0x38544d,_0x19b5cf,_0x4150e5){return db[_0xe4d2('0x113')][_0xe4d2('0x67')]({'where':{'id':_0x38544d[_0xe4d2('0x5c')]['id']}})[_0xe4d2('0x22')](handleEntityNotFound(_0x19b5cf,null))[_0xe4d2('0x22')](function(_0x37f80d){if(_0x37f80d){return _0x37f80d['addProactiveActions'](_0x38544d[_0xe4d2('0x5f')][_0xe4d2('0x70')],_['omit'](_0x38544d['body'],[_0xe4d2('0x70'),'id'])||{});}})[_0xe4d2('0x22')](respondWithResult(_0x19b5cf,null))['catch'](handleError(_0x19b5cf,null));};exports[_0xe4d2('0xfe')]=function(_0x17250a,_0x563d9d,_0x199271){var _0x33d9d9={};var _0x5d2f9a={};var _0x42d34b;var _0x4252b2;return db[_0xe4d2('0x57')]['findOne']({'where':{'id':_0x17250a[_0xe4d2('0x5c')]['id']}})[_0xe4d2('0x22')](handleEntityNotFound(_0x563d9d,null))[_0xe4d2('0x22')](function(_0x36e192){if(_0x36e192){_0x42d34b=_0x36e192;_0x5d2f9a[_0xe4d2('0x48')]=_['keys'](db['ChatProactiveAction'][_0xe4d2('0x44')]);_0x5d2f9a[_0xe4d2('0x49')]=_[_0xe4d2('0x4a')](_0x17250a[_0xe4d2('0x49')]);_0x5d2f9a[_0xe4d2('0x4b')]=_['intersection'](_0x5d2f9a[_0xe4d2('0x48')],_0x5d2f9a['query']);_0x33d9d9['attributes']=_[_0xe4d2('0x4c')](_0x5d2f9a[_0xe4d2('0x48')],qs[_0xe4d2('0x4d')](_0x17250a[_0xe4d2('0x49')][_0xe4d2('0x4d')]));_0x33d9d9['attributes']=_0x33d9d9[_0xe4d2('0x4e')][_0xe4d2('0x4f')]?_0x33d9d9[_0xe4d2('0x4e')]:_0x5d2f9a[_0xe4d2('0x48')];_0x33d9d9['order']=qs[_0xe4d2('0x51')](_0x17250a[_0xe4d2('0x49')]['sort']);_0x33d9d9['where']=qs[_0xe4d2('0x4b')](_[_0xe4d2('0x6e')](_0x17250a[_0xe4d2('0x49')],_0x5d2f9a[_0xe4d2('0x4b')]));if(_0x17250a[_0xe4d2('0x49')][_0xe4d2('0x54')]){_0x33d9d9['where']=_[_0xe4d2('0x55')](_0x33d9d9[_0xe4d2('0x52')],{'$or':_['map'](_0x33d9d9[_0xe4d2('0x4e')],function(_0x4225f1){var _0x7a3c5={};_0x7a3c5[_0x4225f1]={'$like':'%'+_0x17250a['query']['filter']+'%'};return _0x7a3c5;})});}_0x33d9d9=_['merge']({},_0x33d9d9,_0x17250a[_0xe4d2('0x56')]);return _0x42d34b['getProactiveActions'](_0x33d9d9);}})[_0xe4d2('0x22')](function(_0xdd82f2){if(_0xdd82f2){_0x4252b2=_0xdd82f2[_0xe4d2('0x4f')];if(!_0x17250a[_0xe4d2('0x49')][_0xe4d2('0x6c')]('nolimit')){_0x33d9d9[_0xe4d2('0x32')]=qs[_0xe4d2('0x32')](_0x17250a['query'][_0xe4d2('0x32')]);_0x33d9d9['offset']=qs[_0xe4d2('0x31')](_0x17250a['query'][_0xe4d2('0x31')]);}return _0x42d34b[_0xe4d2('0xfe')](_0x33d9d9);}})['then'](function(_0x302488){if(_0x302488){return _0x302488?{'count':_0x4252b2,'rows':_0x302488}:null;}})['then'](respondWithResult(_0x563d9d,null))['catch'](handleError(_0x563d9d,null));};exports['getFields']=function(_0x2e59cc,_0x118d73,_0x220f8e){var _0x504bb4=_0x2e59cc[_0xe4d2('0x49')][_0xe4d2('0x114')]===_0xe4d2('0x115')?_0xe4d2('0x116'):_0xe4d2('0x117');return db['ChatWebsite'][_0xe4d2('0x67')]({'attributes':['id',_0x504bb4],'where':{'id':_0x2e59cc[_0xe4d2('0x5c')]['id']}})[_0xe4d2('0x22')](handleEntityNotFound(_0x118d73,null))[_0xe4d2('0x22')](function(_0x9c2ec1){if(_0x9c2ec1){var _0xab92f4=_0x9c2ec1[_0x504bb4];var _0x345da2=_0xab92f4&&_0xab92f4['items']?_0xab92f4[_0xe4d2('0x118')]:[];_0x118d73[_0xe4d2('0x3f')]({'fromKey':_[_0xe4d2('0x8c')](_0xab92f4[_0xe4d2('0x119')])?undefined:_0xab92f4[_0xe4d2('0x119')],'count':_0x345da2[_0xe4d2('0x4f')],'rows':_0x345da2});}})[_0xe4d2('0x2c')](handleError(_0x118d73,null));};exports[_0xe4d2('0x11a')]=function(_0x5547df,_0x5d0e1d,_0x179216){var _0x27f7a6={'raw':![],'where':{}};var _0x5dfeef={};var _0x29da6f={'count':0x0,'rows':[]};return db[_0xe4d2('0x57')]['findOne']({'where':{'id':_0x5547df[_0xe4d2('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5d0e1d,null))[_0xe4d2('0x22')](function(_0x2dfda6){if(_0x2dfda6){_0x5dfeef['model']=_[_0xe4d2('0x4a')](db[_0xe4d2('0x11b')]['rawAttributes']);_0x5dfeef[_0xe4d2('0x49')]=_[_0xe4d2('0x4a')](_0x5547df[_0xe4d2('0x49')]);_0x5dfeef[_0xe4d2('0x4b')]=_['intersection'](_0x5dfeef[_0xe4d2('0x48')],_0x5dfeef['query']);_0x27f7a6['attributes']=_[_0xe4d2('0x4c')](_0x5dfeef[_0xe4d2('0x48')],qs[_0xe4d2('0x4d')](_0x5547df[_0xe4d2('0x49')]['fields']));_0x27f7a6[_0xe4d2('0x4e')]=_0x27f7a6[_0xe4d2('0x4e')][_0xe4d2('0x4f')]?_0x27f7a6[_0xe4d2('0x4e')]:_0x5dfeef[_0xe4d2('0x48')];if(!_0x5547df[_0xe4d2('0x49')][_0xe4d2('0x6c')]('nolimit')){_0x27f7a6['limit']=qs[_0xe4d2('0x32')](_0x5547df[_0xe4d2('0x49')][_0xe4d2('0x32')]);_0x27f7a6[_0xe4d2('0x31')]=qs[_0xe4d2('0x31')](_0x5547df[_0xe4d2('0x49')][_0xe4d2('0x31')]);}_0x27f7a6[_0xe4d2('0x6d')]=qs[_0xe4d2('0x51')](_0x5547df['query'][_0xe4d2('0x51')]);_0x27f7a6[_0xe4d2('0x52')]=qs[_0xe4d2('0x4b')](_[_0xe4d2('0x6e')](_0x5547df['query'],_0x5dfeef['filters']));_0x27f7a6[_0xe4d2('0x52')]['ChatWebsiteId']=_0x2dfda6['id'];if(_0x5547df['query'][_0xe4d2('0x54')]){_0x27f7a6[_0xe4d2('0x52')]=_['merge'](_0x27f7a6['where'],{'$or':_[_0xe4d2('0x43')](_0x27f7a6['attributes'],function(_0x44bf9f){var _0x4f1079={};_0x4f1079[_0x44bf9f]={'$like':'%'+_0x5547df[_0xe4d2('0x49')][_0xe4d2('0x54')]+'%'};return _0x4f1079;})});}_0x27f7a6=_[_0xe4d2('0x55')]({},_0x27f7a6,_0x5547df[_0xe4d2('0x56')]);return db['ChatOfflineMessage']['count']({'where':_0x27f7a6[_0xe4d2('0x52')]})['then'](function(_0x3153b1){_0x29da6f[_0xe4d2('0x30')]=_0x3153b1;if(_0x5547df[_0xe4d2('0x49')][_0xe4d2('0x5d')]){_0x27f7a6['include']=[{'all':!![]}];}else{_0x27f7a6[_0xe4d2('0x58')]=[{'model':db[_0xe4d2('0x9e')],'as':_0xe4d2('0xec'),'required':![]}];}return db[_0xe4d2('0x11b')][_0xe4d2('0x59')](_0x27f7a6);})[_0xe4d2('0x22')](function(_0x33a05c){_0x29da6f[_0xe4d2('0x5a')]=_0x33a05c;return _0x29da6f;});}})[_0xe4d2('0x22')](respondWithFilteredResult(_0x5d0e1d,_0x27f7a6))[_0xe4d2('0x2c')](handleError(_0x5d0e1d,null));};exports[_0xe4d2('0x11c')]=function(_0x316ea9,_0x11d71,_0x2cf5a9){return db[_0xe4d2('0x57')]['find']({'where':{'id':_0x316ea9['params']['id']}})[_0xe4d2('0x22')](handleEntityNotFound(_0x11d71,null))['then'](function(_0x26fe63){if(_0x26fe63){return _0x26fe63[_0xe4d2('0x11c')](_0x316ea9[_0xe4d2('0x5f')][_0xe4d2('0x70')],_[_0xe4d2('0x11d')](_0x316ea9['body'],[_0xe4d2('0x70'),'id'])||{})[_0xe4d2('0xc0')](function(_0x55bbff){for(var _0x51dc44=0x0;_0x51dc44<_0x316ea9[_0xe4d2('0x5f')][_0xe4d2('0x70')][_0xe4d2('0x4f')];_0x51dc44+=0x1){socket[_0xe4d2('0x11e')](_0xe4d2('0x11f'),{'UserId':_0x316ea9[_0xe4d2('0x5f')][_0xe4d2('0x70')][_0x51dc44],'ChatWebsiteId':_0x316ea9[_0xe4d2('0x5c')]['id']});}return _0x55bbff;});}})['then'](respondWithResult(_0x11d71,null))[_0xe4d2('0x2c')](handleError(_0x11d71,null));};exports['removeAgents']=function(_0x5f0422,_0x4a7d4b,_0x20ae8b){return db[_0xe4d2('0x57')][_0xe4d2('0x67')]({'where':{'id':_0x5f0422[_0xe4d2('0x5c')]['id']}})[_0xe4d2('0x22')](handleEntityNotFound(_0x4a7d4b,null))[_0xe4d2('0x22')](function(_0x3b1f79){if(_0x3b1f79){return _0x3b1f79['removeAgents'](_0x5f0422['query'][_0xe4d2('0x70')])['then'](function(){if(_[_0xe4d2('0x120')](_0x5f0422['query'][_0xe4d2('0x70')])){for(var _0x4fe0ab=0x0;_0x4fe0ab<_0x5f0422[_0xe4d2('0x49')][_0xe4d2('0x70')]['length'];_0x4fe0ab+=0x1){socket[_0xe4d2('0x11e')](_0xe4d2('0x121'),{'UserId':Number(_0x5f0422['query']['ids'][_0x4fe0ab]),'ChatWebsiteId':Number(_0x5f0422[_0xe4d2('0x5c')]['id'])});}}else{socket['emit'](_0xe4d2('0x121'),{'UserId':Number(_0x5f0422[_0xe4d2('0x49')][_0xe4d2('0x70')]),'ChatWebsiteId':Number(_0x5f0422[_0xe4d2('0x5c')]['id'])});}});}})[_0xe4d2('0x22')](respondWithStatusCode(_0x4a7d4b,null))[_0xe4d2('0x2c')](handleError(_0x4a7d4b,null));};exports[_0xe4d2('0x122')]=function(_0x4e2817,_0x28cdbb,_0x35450c){var _0x22a397={};var _0x1062dc={};var _0x22751f;var _0x44631a;return db['ChatWebsite'][_0xe4d2('0xdc')]({'where':{'id':_0x4e2817[_0xe4d2('0x5c')]['id']}})[_0xe4d2('0x22')](handleEntityNotFound(_0x28cdbb,null))[_0xe4d2('0x22')](function(_0x210f63){if(_0x210f63){_0x22751f=_0x210f63;_0x1062dc[_0xe4d2('0x48')]=_['keys'](db[_0xe4d2('0xc9')][_0xe4d2('0x44')]);_0x1062dc[_0xe4d2('0x49')]=_['keys'](_0x4e2817[_0xe4d2('0x49')]);_0x1062dc[_0xe4d2('0x4b')]=_[_0xe4d2('0x4c')](_0x1062dc[_0xe4d2('0x48')],_0x1062dc[_0xe4d2('0x49')]);_0x22a397[_0xe4d2('0x4e')]=_['intersection'](_0x1062dc[_0xe4d2('0x48')],qs[_0xe4d2('0x4d')](_0x4e2817[_0xe4d2('0x49')][_0xe4d2('0x4d')]));_0x22a397[_0xe4d2('0x4e')]=_0x22a397[_0xe4d2('0x4e')][_0xe4d2('0x4f')]?_0x22a397[_0xe4d2('0x4e')]:_0x1062dc['model'];_0x22a397[_0xe4d2('0x6d')]=qs[_0xe4d2('0x51')](_0x4e2817['query']['sort']);_0x22a397[_0xe4d2('0x52')]=qs[_0xe4d2('0x4b')](_[_0xe4d2('0x6e')](_0x4e2817[_0xe4d2('0x49')],_0x1062dc[_0xe4d2('0x4b')]));if(_0x4e2817['query'][_0xe4d2('0x54')]){_0x22a397[_0xe4d2('0x52')]=_[_0xe4d2('0x55')](_0x22a397[_0xe4d2('0x52')],{'$or':_[_0xe4d2('0x43')](_0x22a397[_0xe4d2('0x4e')],function(_0x56983f){var _0x2ee8e8={};_0x2ee8e8[_0x56983f]={'$like':'%'+_0x4e2817['query']['filter']+'%'};return _0x2ee8e8;})});}_0x22a397=_[_0xe4d2('0x55')]({},_0x22a397,_0x4e2817['options']);return _0x22751f['getAgents'](_0x22a397);}})['then'](function(_0x525ac3){if(_0x525ac3){_0x44631a=_0x525ac3['length'];if(!_0x4e2817[_0xe4d2('0x49')]['hasOwnProperty']('nolimit')){_0x22a397['limit']=qs[_0xe4d2('0x32')](_0x4e2817[_0xe4d2('0x49')]['limit']);_0x22a397['offset']=qs[_0xe4d2('0x31')](_0x4e2817['query'][_0xe4d2('0x31')]);}return _0x22751f['getAgents'](_0x22a397);}})[_0xe4d2('0x22')](function(_0x496c4b){if(_0x496c4b){return _0x496c4b?{'count':_0x44631a,'rows':_0x496c4b}:null;}})[_0xe4d2('0x22')](respondWithResult(_0x28cdbb,null))[_0xe4d2('0x2c')](handleError(_0x28cdbb,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index dacfcff..4fc1605 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 _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 +var _0xc9f5=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatWebsite'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc9f5,0xc4));var _0x5c9f=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0xc9f5[_0x1ed116];return _0x574066;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x5c9f('0x0'))['db'][_0x5c9f('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5c9f('0x2'),'afterUpdate':_0x5c9f('0x3'),'afterDestroy':_0x5c9f('0x4')};function emitEvent(_0x5a1ee5){return function(_0x4a046a,_0x1af905,_0x57d666){ChatWebsiteEvents[_0x5c9f('0x5')](_0x5a1ee5+':'+_0x4a046a['id'],_0x4a046a);ChatWebsiteEvents['emit'](_0x5a1ee5,_0x4a046a);_0x57d666(null);};}for(var e in events){if(events[_0x5c9f('0x6')](e)){var event=events[e];ChatWebsite[_0x5c9f('0x7')](e,emitEvent(event));}}module[_0x5c9f('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index af72586..faf7829 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 _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 +var _0xf403=['path','rimraf','../../config/environment','define','ChatWebsite','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x493404,_0x5efd40){var _0x2868f3=function(_0x22b5cf){while(--_0x22b5cf){_0x493404['push'](_0x493404['shift']());}};_0x2868f3(++_0x5efd40);}(_0xf403,0x1d3));var _0x3f40=function(_0xe2c604,_0x46d4c3){_0xe2c604=_0xe2c604-0x0;var _0xe41261=_0xf403[_0xe2c604];return _0xe41261;};'use strict';var _=require(_0x3f40('0x0'));var util=require('util');var logger=require(_0x3f40('0x1'))(_0x3f40('0x2'));var moment=require(_0x3f40('0x3'));var BPromise=require(_0x3f40('0x4'));var rp=require(_0x3f40('0x5'));var fs=require('fs');var path=require(_0x3f40('0x6'));var rimraf=require(_0x3f40('0x7'));var config=require(_0x3f40('0x8'));var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x33f742,_0x22d5e6){return _0x33f742[_0x3f40('0x9')](_0x3f40('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 e7524ba..ad31d93 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 _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 +var _0x4991=['localhost','socket.io-emitter','./chatWebsite.socket','then','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','ChatWebsite,\x20%s,\x20%s','info','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x5e54ea,_0x27a035){var _0x5ebbfb=function(_0x1a4968){while(--_0x1a4968){_0x5e54ea['push'](_0x5e54ea['shift']());}};_0x5ebbfb(++_0x27a035);}(_0x4991,0xf7));var _0x1499=function(_0x40adb4,_0x47cd73){_0x40adb4=_0x40adb4-0x0;var _0x11cc22=_0x4991[_0x40adb4];return _0x11cc22;};'use strict';var _=require(_0x1499('0x0'));var util=require('util');var moment=require(_0x1499('0x1'));var BPromise=require('bluebird');var rs=require(_0x1499('0x2'));var fs=require('fs');var Redis=require(_0x1499('0x3'));var db=require(_0x1499('0x4'))['db'];var utils=require(_0x1499('0x5'));var logger=require(_0x1499('0x6'))(_0x1499('0x7'));var config=require(_0x1499('0x8'));var jayson=require(_0x1499('0x9'));var client=jayson['client'][_0x1499('0xa')]({'port':0x232a});config[_0x1499('0xb')]=_[_0x1499('0xc')](config[_0x1499('0xb')],{'host':_0x1499('0xd'),'port':0x18eb});var socket=require(_0x1499('0xe'))(new Redis(config[_0x1499('0xb')]));require(_0x1499('0xf'))['register'](socket);function respondWithRpcPromise(_0x16e8ad,_0x36a053,_0x575251){return new BPromise(function(_0x2a4816,_0x352180){return client['request'](_0x16e8ad,_0x575251)[_0x1499('0x10')](function(_0x2867b1){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x36a053,'request\x20sent');logger[_0x1499('0x11')](_0x1499('0x12'),_0x36a053,_0x1499('0x13'),JSON[_0x1499('0x14')](_0x2867b1));if(_0x2867b1[_0x1499('0x15')]){if(_0x2867b1['error']['code']===0x1f4){logger[_0x1499('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x36a053,_0x2867b1[_0x1499('0x15')][_0x1499('0x16')]);return _0x352180(_0x2867b1[_0x1499('0x15')][_0x1499('0x16')]);}logger['error'](_0x1499('0x17'),_0x36a053,_0x2867b1[_0x1499('0x15')]['message']);return _0x2a4816(_0x2867b1[_0x1499('0x15')][_0x1499('0x16')]);}else{logger[_0x1499('0x18')](_0x1499('0x17'),_0x36a053,_0x1499('0x13'));_0x2a4816(_0x2867b1[_0x1499('0x19')]['message']);}})['catch'](function(_0x5bcb5f){logger[_0x1499('0x15')](_0x1499('0x17'),_0x36a053,_0x5bcb5f);_0x352180(_0x5bcb5f);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index c327cb3..5a03af5 100644 --- a/server/api/chatWebsite/chatWebsite.socket.js +++ b/server/api/chatWebsite/chatWebsite.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_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 +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x5d5ad9,_0x9fe65c){var _0x461f64=function(_0x97c064){while(--_0x97c064){_0x5d5ad9['push'](_0x5d5ad9['shift']());}};_0x461f64(++_0x9fe65c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2063e6,_0x4f04e6){_0x2063e6=_0x2063e6-0x0;var _0x3e3f25=_0x5f2f[_0x2063e6];return _0x3e3f25;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index d2a5794..7446fd6 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 _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 +var _0x6c83=['/:id/system_avatar','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getOfflineMessages','post','create','addDisposition','/:id/canned_answers','addAnswer','join','format','now','originalname','single','file','addLogo','server/files/images/avatars/','/:id/avatar','addAvatar','diskStorage','root','addCustomerAvatar','%s-%s','addSystemAvatar','/:id/offline','/:id/interactions','addApplications','addProactiveActions','/:id/users','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getAvatar','/:id/customer_avatar','getCustomerAvatar'];(function(_0x2a79c0,_0x54030d){var _0x48ab04=function(_0x1f69a0){while(--_0x1f69a0){_0x2a79c0['push'](_0x2a79c0['shift']());}};_0x48ab04(++_0x54030d);}(_0x6c83,0x1f2));var _0x36c8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6c83[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x36c8('0x0'));var util=require('util');var path=require(_0x36c8('0x1'));var timeout=require(_0x36c8('0x2'));var express=require(_0x36c8('0x3'));var router=express[_0x36c8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x36c8('0x5'));var config=require(_0x36c8('0x6'));var controller=require(_0x36c8('0x7'));router[_0x36c8('0x8')]('/',auth['isAuthenticated'](),controller[_0x36c8('0x9')]);router[_0x36c8('0x8')](_0x36c8('0xa'),auth[_0x36c8('0xb')](),controller[_0x36c8('0xc')]);router['get'](_0x36c8('0xd'),auth['isAuthenticated'](),controller[_0x36c8('0xe')]);router[_0x36c8('0x8')](_0x36c8('0xf'),auth[_0x36c8('0xb')](),controller[_0x36c8('0x10')]);router[_0x36c8('0x8')]('/:id/canned_answers',auth[_0x36c8('0xb')](),controller[_0x36c8('0x11')]);router[_0x36c8('0x8')](_0x36c8('0x12'),controller['getLogo']);router[_0x36c8('0x8')]('/:id/avatar',controller[_0x36c8('0x13')]);router['get'](_0x36c8('0x14'),controller[_0x36c8('0x15')]);router['get'](_0x36c8('0x16'),controller['getSystemAvatar']);router['get']('/:id/interactions',auth[_0x36c8('0xb')](),controller[_0x36c8('0x17')]);router[_0x36c8('0x8')](_0x36c8('0x18'),controller['getSnippet']);router[_0x36c8('0x8')](_0x36c8('0x19'),auth[_0x36c8('0xb')](),controller[_0x36c8('0x1a')]);router[_0x36c8('0x8')](_0x36c8('0x1b'),auth[_0x36c8('0xb')](),controller[_0x36c8('0x1c')]);router[_0x36c8('0x8')](_0x36c8('0x1d'),controller['getFields']);router[_0x36c8('0x8')]('/:id/offline_messages',auth[_0x36c8('0xb')](),controller[_0x36c8('0x1e')]);router[_0x36c8('0x8')]('/:id/users',auth[_0x36c8('0xb')](),controller['getAgents']);router[_0x36c8('0x1f')]('/',auth[_0x36c8('0xb')](),controller[_0x36c8('0x20')]);router[_0x36c8('0x1f')](_0x36c8('0xf'),auth['isAuthenticated'](),controller[_0x36c8('0x21')]);router[_0x36c8('0x1f')](_0x36c8('0x22'),auth[_0x36c8('0xb')](),controller[_0x36c8('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3b5e77,_0x161e14,_0x3bd06e){_0x3bd06e(null,path[_0x36c8('0x24')](config['root'],'server/files/images/logos/'));},'filename':function(_0x18a670,_0x3c3399,_0x3cdf8e){_0x3cdf8e(null,util[_0x36c8('0x25')]('%s-%s',Date[_0x36c8('0x26')](),_0x3c3399[_0x36c8('0x27')]));}})});router[_0x36c8('0x1f')](_0x36c8('0x12'),upload[_0x36c8('0x28')](_0x36c8('0x29')),controller[_0x36c8('0x2a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xb893e9,_0x32dc6f,_0x17a66c){_0x17a66c(null,path[_0x36c8('0x24')](config['root'],_0x36c8('0x2b')));},'filename':function(_0x42d2d7,_0xd71a7d,_0x5eceb7){_0x5eceb7(null,util[_0x36c8('0x25')]('%s-%s',Date[_0x36c8('0x26')](),_0xd71a7d[_0x36c8('0x27')]));}})});router[_0x36c8('0x1f')](_0x36c8('0x2c'),upload[_0x36c8('0x28')]('file'),controller[_0x36c8('0x2d')]);var upload=multer({'storage':multer[_0x36c8('0x2e')]({'destination':function(_0x24f8f4,_0x5ce88a,_0x3cad04){_0x3cad04(null,path['join'](config[_0x36c8('0x2f')],_0x36c8('0x2b')));},'filename':function(_0x363418,_0x21901c,_0x3f882a){_0x3f882a(null,util[_0x36c8('0x25')]('%s-%s',Date[_0x36c8('0x26')](),_0x21901c[_0x36c8('0x27')]));}})});router[_0x36c8('0x1f')](_0x36c8('0x14'),upload[_0x36c8('0x28')](_0x36c8('0x29')),controller[_0x36c8('0x30')]);var upload=multer({'storage':multer[_0x36c8('0x2e')]({'destination':function(_0x165c90,_0x1fb51f,_0x5550c5){_0x5550c5(null,path[_0x36c8('0x24')](config[_0x36c8('0x2f')],_0x36c8('0x2b')));},'filename':function(_0x44ae97,_0x489750,_0xc3eb48){_0xc3eb48(null,util[_0x36c8('0x25')](_0x36c8('0x31'),Date[_0x36c8('0x26')](),_0x489750['originalname']));}})});router[_0x36c8('0x1f')](_0x36c8('0x16'),upload[_0x36c8('0x28')](_0x36c8('0x29')),controller[_0x36c8('0x32')]);router['post']('/:id/notify',controller['notify']);router['post'](_0x36c8('0x33'),controller['offline']);router[_0x36c8('0x1f')](_0x36c8('0x34'),auth['isAuthenticated'](),controller['addInteraction']);router['post'](_0x36c8('0x19'),auth[_0x36c8('0xb')](),controller[_0x36c8('0x35')]);router[_0x36c8('0x1f')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x36c8('0x36')]);router['post'](_0x36c8('0x37'),auth[_0x36c8('0xb')](),controller[_0x36c8('0x38')]);router[_0x36c8('0x39')](_0x36c8('0xd'),auth['isAuthenticated'](),controller[_0x36c8('0x3a')]);router[_0x36c8('0x3b')](_0x36c8('0xd'),auth['isAuthenticated'](),controller[_0x36c8('0x3c')]);router[_0x36c8('0x3b')](_0x36c8('0xf'),auth[_0x36c8('0xb')](),controller[_0x36c8('0x3d')]);router[_0x36c8('0x3b')]('/:id/canned_answers',auth[_0x36c8('0xb')](),controller[_0x36c8('0x3e')]);router[_0x36c8('0x3b')]('/:id/users',auth[_0x36c8('0xb')](),controller[_0x36c8('0x3f')]);module[_0x36c8('0x40')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index b642bdc..015938a 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 _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 +var _0x5d59=['Google','exports','STRING','ENUM','AmazonAWS'];(function(_0xcc2c66,_0x27cf7b){var _0x2197b2=function(_0xacbaeb){while(--_0xacbaeb){_0xcc2c66['push'](_0xcc2c66['shift']());}};_0x2197b2(++_0x27cf7b);}(_0x5d59,0x15f));var _0x95d5=function(_0x4c4d6d,_0x10ac62){_0x4c4d6d=_0x4c4d6d-0x0;var _0x4eacef=_0x5d59[_0x4c4d6d];return _0x4eacef;};'use strict';var Sequelize=require('sequelize');module[_0x95d5('0x0')]={'name':{'type':Sequelize[_0x95d5('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x95d5('0x2')](_0x95d5('0x3'),_0x95d5('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x95d5('0x1')]},'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 e54f5e8..35e8358 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 _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 +var _0x93d5=['index','map','CloudProvider','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','json','count','offset','limit','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send'];(function(_0x2c4f3f,_0x266947){var _0x3d0234=function(_0x31495c){while(--_0x31495c){_0x2c4f3f['push'](_0x2c4f3f['shift']());}};_0x3d0234(++_0x266947);}(_0x93d5,0x192));var _0x593d=function(_0x549baf,_0x8416bf){_0x549baf=_0x549baf-0x0;var _0x2ddc4e=_0x93d5[_0x549baf];return _0x2ddc4e;};'use strict';var pdf=require(_0x593d('0x0'));var emlformat=require(_0x593d('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x593d('0x2'));var rp=require(_0x593d('0x3'));var moment=require('moment');var BPromise=require(_0x593d('0x4'));var Mustache=require(_0x593d('0x5'));var util=require('util');var path=require(_0x593d('0x6'));var sox=require(_0x593d('0x7'));var csv=require(_0x593d('0x8'));var ejs=require(_0x593d('0x9'));var fs=require('fs');var _=require(_0x593d('0xa'));var squel=require(_0x593d('0xb'));var crypto=require(_0x593d('0xc'));var jsforce=require(_0x593d('0xd'));var deskjs=require(_0x593d('0xe'));var toCsv=require(_0x593d('0x8'));var querystring=require(_0x593d('0xf'));var Papa=require(_0x593d('0x10'));var Redis=require(_0x593d('0x11'));var authService=require(_0x593d('0x12'));var qs=require(_0x593d('0x13'));var as=require(_0x593d('0x14'));var hardwareService=require(_0x593d('0x15'));var logger=require(_0x593d('0x16'))(_0x593d('0x17'));var utils=require(_0x593d('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48e405,_0x1af943){_0x1af943=_0x1af943||0xcc;return function(_0x1c2120){if(_0x1c2120){return _0x48e405['sendStatus'](_0x1af943);}return _0x48e405[_0x593d('0x19')](_0x1af943)['end']();};}function respondWithResult(_0x4b41c1,_0x3b1c83){_0x3b1c83=_0x3b1c83||0xc8;return function(_0x311c21){if(_0x311c21){return _0x4b41c1[_0x593d('0x19')](_0x3b1c83)[_0x593d('0x1a')](_0x311c21);}};}function respondWithFilteredResult(_0x5be2eb,_0x593e4f){return function(_0x84f83c){if(_0x84f83c){var _0x4372f6=_0x84f83c[_0x593d('0x1b')],_0xdee582=_0x593e4f[_0x593d('0x1c')],_0x6b03f1=_0x593e4f[_0x593d('0x1c')]+_0x593e4f[_0x593d('0x1d')],_0x425fcc;if(_0x6b03f1>=_0x4372f6){_0x6b03f1=_0x4372f6;_0x425fcc=0xc8;}else{_0x425fcc=0xce;}_0x5be2eb[_0x593d('0x19')](_0x425fcc);return _0x5be2eb[_0x593d('0x1e')]('Content-Range',_0xdee582+'-'+_0x6b03f1+'/'+_0x4372f6)['json'](_0x84f83c);}return null;};}function patchUpdates(_0x3aa4bb){return function(_0x5e4ec0){try{jsonpatch[_0x593d('0x1f')](_0x5e4ec0,_0x3aa4bb,!![]);}catch(_0x26d17c){return BPromise['reject'](_0x26d17c);}return _0x5e4ec0[_0x593d('0x20')]();};}function saveUpdates(_0x21935a,_0x53dcb8){return function(_0x1e22a9){if(_0x1e22a9){return _0x1e22a9[_0x593d('0x21')](_0x21935a)[_0x593d('0x22')](function(_0x5c0d49){return _0x5c0d49;});}return null;};}function removeEntity(_0x41bcac,_0x1f290a){return function(_0x189319){if(_0x189319){return _0x189319[_0x593d('0x23')]()[_0x593d('0x22')](function(){_0x41bcac[_0x593d('0x19')](0xcc)[_0x593d('0x24')]();});}};}function handleEntityNotFound(_0x2d1891,_0x1dcae2){return function(_0x61013b){if(!_0x61013b){_0x2d1891[_0x593d('0x25')](0x194);}return _0x61013b;};}function handleError(_0x230db9,_0xbe2e0f){_0xbe2e0f=_0xbe2e0f||0x1f4;return function(_0x30300e){logger[_0x593d('0x26')](_0x30300e[_0x593d('0x27')]);if(_0x30300e[_0x593d('0x28')]){delete _0x30300e[_0x593d('0x28')];}_0x230db9['status'](_0xbe2e0f)[_0x593d('0x29')](_0x30300e);};}exports[_0x593d('0x2a')]=function(_0x15085d,_0x3f2fbf){var _0x44f856={},_0x315936={},_0x265a44={'count':0x0,'rows':[]};var _0x4227aa=_[_0x593d('0x2b')](db[_0x593d('0x2c')][_0x593d('0x2d')],function(_0x1d8597){return{'name':_0x1d8597['fieldName'],'type':_0x1d8597[_0x593d('0x2e')][_0x593d('0x2f')]};});_0x315936[_0x593d('0x30')]=_[_0x593d('0x2b')](_0x4227aa,_0x593d('0x28'));_0x315936[_0x593d('0x31')]=_['keys'](_0x15085d[_0x593d('0x31')]);_0x315936[_0x593d('0x32')]=_[_0x593d('0x33')](_0x315936[_0x593d('0x30')],_0x315936['query']);_0x44f856[_0x593d('0x34')]=_[_0x593d('0x33')](_0x315936[_0x593d('0x30')],qs['fields'](_0x15085d[_0x593d('0x31')][_0x593d('0x35')]));_0x44f856[_0x593d('0x34')]=_0x44f856[_0x593d('0x34')]['length']?_0x44f856[_0x593d('0x34')]:_0x315936[_0x593d('0x30')];if(!_0x15085d[_0x593d('0x31')][_0x593d('0x36')](_0x593d('0x37'))){_0x44f856[_0x593d('0x1d')]=qs['limit'](_0x15085d['query'][_0x593d('0x1d')]);_0x44f856[_0x593d('0x1c')]=qs[_0x593d('0x1c')](_0x15085d['query'][_0x593d('0x1c')]);}_0x44f856[_0x593d('0x38')]=qs[_0x593d('0x39')](_0x15085d[_0x593d('0x31')]['sort']);_0x44f856[_0x593d('0x3a')]=qs[_0x593d('0x32')](_[_0x593d('0x3b')](_0x15085d[_0x593d('0x31')],_0x315936[_0x593d('0x32')]),_0x4227aa);if(_0x15085d[_0x593d('0x31')][_0x593d('0x3c')]){_0x44f856['where']=_[_0x593d('0x3d')](_0x44f856[_0x593d('0x3a')],{'$or':_[_0x593d('0x2b')](_0x4227aa,function(_0x368177){if(_0x368177[_0x593d('0x2e')]!==_0x593d('0x3e')){var _0x1e5214={};_0x1e5214[_0x368177['name']]={'$like':'%'+_0x15085d['query'][_0x593d('0x3c')]+'%'};return _0x1e5214;}})});}_0x44f856=_[_0x593d('0x3d')]({},_0x44f856,_0x15085d[_0x593d('0x3f')]);var _0x28c73e={'where':_0x44f856[_0x593d('0x3a')]};return db[_0x593d('0x2c')]['count'](_0x28c73e)[_0x593d('0x22')](function(_0x4ac0f2){_0x265a44['count']=_0x4ac0f2;if(_0x15085d[_0x593d('0x31')][_0x593d('0x40')]){_0x44f856[_0x593d('0x41')]=[{'all':!![]}];}return db[_0x593d('0x2c')]['findAll'](_0x44f856);})[_0x593d('0x22')](function(_0x1d3620){_0x265a44[_0x593d('0x42')]=_0x1d3620;return _0x265a44;})[_0x593d('0x22')](respondWithFilteredResult(_0x3f2fbf,_0x44f856))[_0x593d('0x43')](handleError(_0x3f2fbf,null));};exports[_0x593d('0x44')]=function(_0x23562f,_0x9c7807){var _0xd42a87={'raw':!![],'where':{'id':_0x23562f[_0x593d('0x45')]['id']}},_0x70185b={};_0x70185b[_0x593d('0x30')]=_[_0x593d('0x46')](db[_0x593d('0x2c')][_0x593d('0x2d')]);_0x70185b[_0x593d('0x31')]=_[_0x593d('0x46')](_0x23562f[_0x593d('0x31')]);_0x70185b['filters']=_[_0x593d('0x33')](_0x70185b[_0x593d('0x30')],_0x70185b[_0x593d('0x31')]);_0xd42a87[_0x593d('0x34')]=_[_0x593d('0x33')](_0x70185b[_0x593d('0x30')],qs['fields'](_0x23562f[_0x593d('0x31')][_0x593d('0x35')]));_0xd42a87[_0x593d('0x34')]=_0xd42a87[_0x593d('0x34')]['length']?_0xd42a87['attributes']:_0x70185b['model'];if(_0x23562f['query'][_0x593d('0x40')]){_0xd42a87['include']=[{'all':!![]}];}_0xd42a87=_[_0x593d('0x3d')]({},_0xd42a87,_0x23562f[_0x593d('0x3f')]);return db[_0x593d('0x2c')][_0x593d('0x47')](_0xd42a87)[_0x593d('0x22')](handleEntityNotFound(_0x9c7807,null))[_0x593d('0x22')](respondWithResult(_0x9c7807,null))['catch'](handleError(_0x9c7807,null));};exports[_0x593d('0x48')]=function(_0x264900,_0x4d43a3){return db[_0x593d('0x2c')][_0x593d('0x48')](_0x264900[_0x593d('0x49')],{})['then'](respondWithResult(_0x4d43a3,0xc9))['catch'](handleError(_0x4d43a3,null));};exports[_0x593d('0x21')]=function(_0x1e678c,_0x40da56){if(_0x1e678c[_0x593d('0x49')]['id']){delete _0x1e678c[_0x593d('0x49')]['id'];}return db['CloudProvider']['find']({'where':{'id':_0x1e678c[_0x593d('0x45')]['id']}})['then'](handleEntityNotFound(_0x40da56,null))[_0x593d('0x22')](saveUpdates(_0x1e678c['body'],null))[_0x593d('0x22')](respondWithResult(_0x40da56,null))['catch'](handleError(_0x40da56,null));};exports[_0x593d('0x23')]=function(_0x15d587,_0x44dfe4){return db[_0x593d('0x2c')]['find']({'where':{'id':_0x15d587[_0x593d('0x45')]['id']}})[_0x593d('0x22')](handleEntityNotFound(_0x44dfe4,null))['then'](removeEntity(_0x44dfe4,null))[_0x593d('0x43')](handleError(_0x44dfe4,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index ce2a61c..759e466 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 _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 +var _0x987d=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers'];(function(_0x29551d,_0x5c8430){var _0x7e358e=function(_0x150337){while(--_0x150337){_0x29551d['push'](_0x29551d['shift']());}};_0x7e358e(++_0x5c8430);}(_0x987d,0x144));var _0xd987=function(_0x15d6e6,_0x36039e){_0x15d6e6=_0x15d6e6-0x0;var _0x4fb1a7=_0x987d[_0x15d6e6];return _0x4fb1a7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd987('0x0'))(_0xd987('0x1'));var moment=require(_0xd987('0x2'));var BPromise=require('bluebird');var rp=require(_0xd987('0x3'));var fs=require('fs');var path=require(_0xd987('0x4'));var rimraf=require(_0xd987('0x5'));var config=require(_0xd987('0x6'));var attributes=require(_0xd987('0x7'));module[_0xd987('0x8')]=function(_0x35497e,_0x52a3f9){return _0x35497e[_0xd987('0x9')](_0xd987('0xa'),attributes,{'tableName':_0xd987('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 2232c5c..8694cfb 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 _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 +var _0xff35=['request','info','CloudProvider,\x20%s,\x20%s','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1ace67,_0xf592f7){var _0x4dcaea=function(_0x206564){while(--_0x206564){_0x1ace67['push'](_0x1ace67['shift']());}};_0x4dcaea(++_0xf592f7);}(_0xff35,0xcb));var _0x5ff3=function(_0x351ce5,_0x150077){_0x351ce5=_0x351ce5-0x0;var _0x260035=_0xff35[_0x351ce5];return _0x260035;};'use strict';var _=require(_0x5ff3('0x0'));var util=require(_0x5ff3('0x1'));var moment=require(_0x5ff3('0x2'));var BPromise=require('bluebird');var rs=require(_0x5ff3('0x3'));var fs=require('fs');var Redis=require(_0x5ff3('0x4'));var db=require(_0x5ff3('0x5'))['db'];var utils=require(_0x5ff3('0x6'));var logger=require(_0x5ff3('0x7'))(_0x5ff3('0x8'));var config=require(_0x5ff3('0x9'));var jayson=require(_0x5ff3('0xa'));var client=jayson[_0x5ff3('0xb')][_0x5ff3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x432650,_0x4b3ad3,_0x230746){return new BPromise(function(_0x4cf2b0,_0x525cb8){return client[_0x5ff3('0xd')](_0x432650,_0x230746)['then'](function(_0x52c3b4){logger[_0x5ff3('0xe')](_0x5ff3('0xf'),_0x4b3ad3,'request\x20sent');logger['debug'](_0x5ff3('0x10'),_0x4b3ad3,_0x5ff3('0x11'),JSON[_0x5ff3('0x12')](_0x52c3b4));if(_0x52c3b4[_0x5ff3('0x13')]){if(_0x52c3b4[_0x5ff3('0x13')][_0x5ff3('0x14')]===0x1f4){logger[_0x5ff3('0x13')]('CloudProvider,\x20%s,\x20%s',_0x4b3ad3,_0x52c3b4[_0x5ff3('0x13')][_0x5ff3('0x15')]);return _0x525cb8(_0x52c3b4[_0x5ff3('0x13')]['message']);}logger[_0x5ff3('0x13')](_0x5ff3('0xf'),_0x4b3ad3,_0x52c3b4['error']['message']);return _0x4cf2b0(_0x52c3b4['error'][_0x5ff3('0x15')]);}else{logger[_0x5ff3('0xe')](_0x5ff3('0xf'),_0x4b3ad3,'request\x20sent');_0x4cf2b0(_0x52c3b4[_0x5ff3('0x16')]['message']);}})[_0x5ff3('0x17')](function(_0x2ccde0){logger[_0x5ff3('0x13')](_0x5ff3('0xf'),_0x4b3ad3,_0x2ccde0);_0x525cb8(_0x2ccde0);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 65e5b86..560380f 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 _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 +var _0x25e4=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','show','create','put'];(function(_0x10db36,_0x1d0aca){var _0x24357c=function(_0x192b20){while(--_0x192b20){_0x10db36['push'](_0x10db36['shift']());}};_0x24357c(++_0x1d0aca);}(_0x25e4,0x112));var _0x425e=function(_0x4cd71b,_0x4835a0){_0x4cd71b=_0x4cd71b-0x0;var _0x2245e4=_0x25e4[_0x4cd71b];return _0x2245e4;};'use strict';var multer=require(_0x425e('0x0'));var util=require('util');var path=require(_0x425e('0x1'));var timeout=require(_0x425e('0x2'));var express=require(_0x425e('0x3'));var router=express[_0x425e('0x4')]();var auth=require(_0x425e('0x5'));var interaction=require(_0x425e('0x6'));var config=require(_0x425e('0x7'));var controller=require('./cloudProvider.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x425e('0x8')]);router['get'](_0x425e('0x9'),auth[_0x425e('0xa')](),controller[_0x425e('0xb')]);router['post']('/',auth[_0x425e('0xa')](),controller[_0x425e('0xc')]);router[_0x425e('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x425e('0xe')]);router[_0x425e('0xf')]('/:id',auth[_0x425e('0xa')](),controller[_0x425e('0x10')]);module[_0x425e('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 43bdfd8..c90a5e1 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 _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 +var _0x220d=['STRING','exports'];(function(_0x349b00,_0x5b58c3){var _0x45744f=function(_0x3caf27){while(--_0x3caf27){_0x349b00['push'](_0x349b00['shift']());}};_0x45744f(++_0x5b58c3);}(_0x220d,0x18b));var _0xd220=function(_0x599b22,_0x34d0b4){_0x599b22=_0x599b22-0x0;var _0x3e0e1a=_0x220d[_0x599b22];return _0x3e0e1a;};'use strict';var Sequelize=require('sequelize');module[_0xd220('0x0')]={'name':{'type':Sequelize[_0xd220('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0xd220('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xd220('0x1')]},'fax':{'type':Sequelize[_0xd220('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xd220('0x1')]},'postalCode':{'type':Sequelize[_0xd220('0x1')]},'city':{'type':Sequelize[_0xd220('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xd220('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xd220('0x1')]},'sStreet':{'type':Sequelize[_0xd220('0x1')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xd220('0x1')]},'sCountry':{'type':Sequelize[_0xd220('0x1')]},'description':{'type':Sequelize[_0xd220('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index e048ed0..ba976a4 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 _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 +var _0xcdba=['fields','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','addContacts','CmContact','ids','omit','getContacts','findOne','order','map','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','describe','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','options','findAll','catch','show','params','rawAttributes'];(function(_0x54d52,_0x2473ba){var _0x968345=function(_0x3fcd06){while(--_0x3fcd06){_0x54d52['push'](_0x54d52['shift']());}};_0x968345(++_0x2473ba);}(_0xcdba,0x69));var _0xacdb=function(_0x48e750,_0x2125d4){_0x48e750=_0x48e750-0x0;var _0x17f085=_0xcdba[_0x48e750];return _0x17f085;};'use strict';var pdf=require(_0xacdb('0x0'));var emlformat=require(_0xacdb('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xacdb('0x2'));var jsonpatch=require(_0xacdb('0x3'));var rp=require(_0xacdb('0x4'));var moment=require(_0xacdb('0x5'));var BPromise=require(_0xacdb('0x6'));var Mustache=require('mustache');var util=require(_0xacdb('0x7'));var path=require(_0xacdb('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xacdb('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xacdb('0xa'));var crypto=require(_0xacdb('0xb'));var jsforce=require(_0xacdb('0xc'));var deskjs=require(_0xacdb('0xd'));var toCsv=require(_0xacdb('0xe'));var querystring=require(_0xacdb('0xf'));var Papa=require('papaparse');var Redis=require(_0xacdb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xacdb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xacdb('0x12'));var logger=require(_0xacdb('0x13'))(_0xacdb('0x14'));var utils=require(_0xacdb('0x15'));var config=require(_0xacdb('0x16'));var db=require(_0xacdb('0x17'))['db'];function respondWithStatusCode(_0x46b521,_0xfb7c5a){_0xfb7c5a=_0xfb7c5a||0xcc;return function(_0x5247b0){if(_0x5247b0){return _0x46b521[_0xacdb('0x18')](_0xfb7c5a);}return _0x46b521[_0xacdb('0x19')](_0xfb7c5a)[_0xacdb('0x1a')]();};}function respondWithResult(_0x3fad7b,_0x322618){_0x322618=_0x322618||0xc8;return function(_0x28cded){if(_0x28cded){return _0x3fad7b[_0xacdb('0x19')](_0x322618)[_0xacdb('0x1b')](_0x28cded);}};}function respondWithFilteredResult(_0x39c3cd,_0x114508){return function(_0x2ccf15){if(_0x2ccf15){var _0x3cc8df=_0x2ccf15[_0xacdb('0x1c')],_0x3397bc=_0x114508[_0xacdb('0x1d')],_0x1ff0a6=_0x114508[_0xacdb('0x1d')]+_0x114508[_0xacdb('0x1e')],_0x576ec4;if(_0x1ff0a6>=_0x3cc8df){_0x1ff0a6=_0x3cc8df;_0x576ec4=0xc8;}else{_0x576ec4=0xce;}_0x39c3cd['status'](_0x576ec4);return _0x39c3cd[_0xacdb('0x1f')]('Content-Range',_0x3397bc+'-'+_0x1ff0a6+'/'+_0x3cc8df)['json'](_0x2ccf15);}return null;};}function patchUpdates(_0x192afd){return function(_0x12f658){try{jsonpatch[_0xacdb('0x20')](_0x12f658,_0x192afd,!![]);}catch(_0x385fb){return BPromise['reject'](_0x385fb);}return _0x12f658[_0xacdb('0x21')]();};}function saveUpdates(_0x20b172,_0xf7b82d){return function(_0x2145a5){if(_0x2145a5){return _0x2145a5[_0xacdb('0x22')](_0x20b172)[_0xacdb('0x23')](function(_0x4a7364){return _0x4a7364;});}return null;};}function removeEntity(_0x5e9f30,_0x223d05){return function(_0x1d0584){if(_0x1d0584){return _0x1d0584[_0xacdb('0x24')]()[_0xacdb('0x23')](function(){var _0x354299=_0x1d0584[_0xacdb('0x25')]({'plain':!![]});var _0x89e45a=_0xacdb('0x26');return db[_0xacdb('0x27')][_0xacdb('0x24')]({'where':{'type':_0x89e45a,'resourceId':_0x354299['id']}})['then'](function(){return _0x1d0584;});})['then'](function(){_0x5e9f30[_0xacdb('0x19')](0xcc)[_0xacdb('0x1a')]();});}};}function handleEntityNotFound(_0x58a32a,_0x46a0d8){return function(_0x272ee1){if(!_0x272ee1){_0x58a32a[_0xacdb('0x18')](0x194);}return _0x272ee1;};}function handleError(_0x2901d7,_0xbbfc8e){_0xbbfc8e=_0xbbfc8e||0x1f4;return function(_0x2dba9d){logger[_0xacdb('0x28')](_0x2dba9d[_0xacdb('0x29')]);if(_0x2dba9d['name']){delete _0x2dba9d[_0xacdb('0x2a')];}_0x2901d7[_0xacdb('0x19')](_0xbbfc8e)[_0xacdb('0x2b')](_0x2dba9d);};}exports[_0xacdb('0x2c')]=function(_0x33cceb,_0x5bdf91){var _0x5d454c={},_0x39ad53={},_0x468cd7={'count':0x0,'rows':[]};return db[_0xacdb('0x2d')][_0xacdb('0x2e')]()[_0xacdb('0x23')](function(_0x1c9d31){_0x39ad53[_0xacdb('0x2f')]=_['keys'](_0x1c9d31);_0x39ad53[_0xacdb('0x30')]=_[_0xacdb('0x31')](_0x33cceb[_0xacdb('0x30')]);_0x39ad53[_0xacdb('0x32')]=_[_0xacdb('0x33')](_0x39ad53[_0xacdb('0x2f')],_0x39ad53['query']);_0x5d454c[_0xacdb('0x34')]=_[_0xacdb('0x33')](_0x39ad53[_0xacdb('0x2f')],qs['fields'](_0x33cceb['query']['fields']));_0x5d454c[_0xacdb('0x34')]=_0x5d454c[_0xacdb('0x34')][_0xacdb('0x35')]?_0x5d454c[_0xacdb('0x34')]:_0x39ad53[_0xacdb('0x2f')];if(!_0x33cceb[_0xacdb('0x30')][_0xacdb('0x36')](_0xacdb('0x37'))){_0x5d454c[_0xacdb('0x1e')]=qs[_0xacdb('0x1e')](_0x33cceb[_0xacdb('0x30')][_0xacdb('0x1e')]);_0x5d454c[_0xacdb('0x1d')]=qs['offset'](_0x33cceb[_0xacdb('0x30')][_0xacdb('0x1d')]);}_0x5d454c['order']=qs[_0xacdb('0x38')](_0x33cceb[_0xacdb('0x30')][_0xacdb('0x38')]);_0x5d454c['where']=qs[_0xacdb('0x32')](_[_0xacdb('0x39')](_0x33cceb[_0xacdb('0x30')],_0x39ad53[_0xacdb('0x32')]),_0x1c9d31);if(_0x33cceb[_0xacdb('0x30')][_0xacdb('0x3a')]){_0x5d454c['where']=_[_0xacdb('0x3b')](_0x5d454c[_0xacdb('0x3c')],{'$or':_['map'](_0x5d454c['attributes'],function(_0x3914a3){var _0x451d07={};_0x451d07[_0x3914a3]={'$like':'%'+_0x33cceb[_0xacdb('0x30')][_0xacdb('0x3a')]+'%'};return _0x451d07;})});}_0x5d454c=_[_0xacdb('0x3b')]({},_0x5d454c,_0x33cceb[_0xacdb('0x3d')]);var _0xd50646={'where':_0x5d454c[_0xacdb('0x3c')]};return db[_0xacdb('0x2d')][_0xacdb('0x1c')](_0xd50646)[_0xacdb('0x23')](function(_0x286b8f){_0x468cd7['count']=_0x286b8f;if(_0x33cceb['query']['includeAll']){_0x5d454c['include']=[{'all':!![]}];}return db[_0xacdb('0x2d')][_0xacdb('0x3e')](_0x5d454c);})[_0xacdb('0x23')](function(_0x154608){_0x468cd7['rows']=_0x154608;return _0x468cd7;})[_0xacdb('0x23')](respondWithFilteredResult(_0x5bdf91,_0x5d454c))[_0xacdb('0x3f')](handleError(_0x5bdf91,null));})[_0xacdb('0x3f')](handleError(_0x5bdf91,null));};exports[_0xacdb('0x40')]=function(_0x2cb9c5,_0x237241){var _0xbeae59={'raw':![],'where':{'id':_0x2cb9c5[_0xacdb('0x41')]['id']}},_0x7839bd={};_0x7839bd['model']=_[_0xacdb('0x31')](db[_0xacdb('0x2d')][_0xacdb('0x42')]);_0x7839bd['query']=_[_0xacdb('0x31')](_0x2cb9c5['query']);_0x7839bd[_0xacdb('0x32')]=_[_0xacdb('0x33')](_0x7839bd[_0xacdb('0x2f')],_0x7839bd[_0xacdb('0x30')]);_0xbeae59[_0xacdb('0x34')]=_['intersection'](_0x7839bd[_0xacdb('0x2f')],qs[_0xacdb('0x43')](_0x2cb9c5['query']['fields']));_0xbeae59[_0xacdb('0x34')]=_0xbeae59[_0xacdb('0x34')][_0xacdb('0x35')]?_0xbeae59[_0xacdb('0x34')]:_0x7839bd[_0xacdb('0x2f')];if(_0x2cb9c5[_0xacdb('0x30')]['includeAll']){_0xbeae59['include']=[{'all':!![]}];}_0xbeae59=_[_0xacdb('0x3b')]({},_0xbeae59,_0x2cb9c5[_0xacdb('0x3d')]);return db[_0xacdb('0x2d')][_0xacdb('0x44')](_0xbeae59)[_0xacdb('0x23')](handleEntityNotFound(_0x237241,null))[_0xacdb('0x23')](respondWithResult(_0x237241,null))[_0xacdb('0x3f')](handleError(_0x237241,null));};exports[_0xacdb('0x45')]=function(_0x3d3e44,_0x586225){return db[_0xacdb('0x2d')]['create'](_0x3d3e44[_0xacdb('0x46')],{})[_0xacdb('0x23')](function(_0x26a579){var _0x44ac81=_0x3d3e44[_0xacdb('0x47')][_0xacdb('0x25')]({'plain':!![]});if(!_0x44ac81)throw new Error(_0xacdb('0x48'));if(_0x44ac81[_0xacdb('0x49')]===_0xacdb('0x47')){var _0x110ef1=_0x26a579[_0xacdb('0x25')]({'plain':!![]});var _0x5add10=_0xacdb('0x26');return db[_0xacdb('0x4a')][_0xacdb('0x44')]({'where':{'name':_0x5add10,'userProfileId':_0x44ac81[_0xacdb('0x4b')]},'raw':!![]})['then'](function(_0x2b07cb){if(_0x2b07cb&&_0x2b07cb[_0xacdb('0x4c')]===0x0){return db[_0xacdb('0x27')][_0xacdb('0x45')]({'name':_0x110ef1[_0xacdb('0x2a')],'resourceId':_0x110ef1['id'],'type':_0x2b07cb[_0xacdb('0x2a')],'sectionId':_0x2b07cb['id']},{})[_0xacdb('0x23')](function(){return _0x26a579;});}else{return _0x26a579;}})['catch'](function(_0x365d9d){logger[_0xacdb('0x28')](_0xacdb('0x4d'),_0x365d9d);throw _0x365d9d;});}return _0x26a579;})[_0xacdb('0x23')](respondWithResult(_0x586225,0xc9))[_0xacdb('0x3f')](handleError(_0x586225,null));};exports[_0xacdb('0x22')]=function(_0x49f5e7,_0x3e2e7c){if(_0x49f5e7[_0xacdb('0x46')]['id']){delete _0x49f5e7[_0xacdb('0x46')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x49f5e7[_0xacdb('0x41')]['id']}})[_0xacdb('0x23')](handleEntityNotFound(_0x3e2e7c,null))[_0xacdb('0x23')](saveUpdates(_0x49f5e7[_0xacdb('0x46')],null))[_0xacdb('0x23')](respondWithResult(_0x3e2e7c,null))['catch'](handleError(_0x3e2e7c,null));};exports['destroy']=function(_0x5325a5,_0x15ee08){return db[_0xacdb('0x2d')][_0xacdb('0x44')]({'where':{'id':_0x5325a5[_0xacdb('0x41')]['id']}})[_0xacdb('0x23')](handleEntityNotFound(_0x15ee08,null))[_0xacdb('0x23')](removeEntity(_0x15ee08,null))['catch'](handleError(_0x15ee08,null));};exports[_0xacdb('0x2e')]=function(_0x2266b7,_0x1b886d){return db[_0xacdb('0x2d')]['describe']()[_0xacdb('0x23')](respondWithResult(_0x1b886d,null))['catch'](handleError(_0x1b886d,null));};exports[_0xacdb('0x4e')]=function(_0x903f64,_0x31157c,_0x4804a3){return db[_0xacdb('0x4f')][_0xacdb('0x44')]({'where':{'id':_0x903f64['params']['id']}})[_0xacdb('0x23')](handleEntityNotFound(_0x31157c,null))[_0xacdb('0x23')](function(_0xc8d0ac){if(_0xc8d0ac){return _0xc8d0ac[_0xacdb('0x4e')](_0x903f64[_0xacdb('0x46')][_0xacdb('0x50')],_[_0xacdb('0x51')](_0x903f64['body'],[_0xacdb('0x50'),'id'])||{});}})['then'](respondWithResult(_0x31157c,null))[_0xacdb('0x3f')](handleError(_0x31157c,null));};exports[_0xacdb('0x52')]=function(_0xd67d39,_0x165e53,_0x4ae1e4){var _0xab9341={};var _0x9442c={};var _0x5f24a2;var _0x5a48da;return db[_0xacdb('0x2d')][_0xacdb('0x53')]({'where':{'id':_0xd67d39[_0xacdb('0x41')]['id']}})[_0xacdb('0x23')](handleEntityNotFound(_0x165e53,null))[_0xacdb('0x23')](function(_0x26d07a){if(_0x26d07a){_0x5f24a2=_0x26d07a;_0x9442c[_0xacdb('0x2f')]=_['keys'](db[_0xacdb('0x4f')]['rawAttributes']);_0x9442c[_0xacdb('0x30')]=_[_0xacdb('0x31')](_0xd67d39['query']);_0x9442c[_0xacdb('0x32')]=_[_0xacdb('0x33')](_0x9442c[_0xacdb('0x2f')],_0x9442c[_0xacdb('0x30')]);_0xab9341[_0xacdb('0x34')]=_['intersection'](_0x9442c[_0xacdb('0x2f')],qs[_0xacdb('0x43')](_0xd67d39[_0xacdb('0x30')][_0xacdb('0x43')]));_0xab9341[_0xacdb('0x34')]=_0xab9341[_0xacdb('0x34')][_0xacdb('0x35')]?_0xab9341[_0xacdb('0x34')]:_0x9442c[_0xacdb('0x2f')];_0xab9341[_0xacdb('0x54')]=qs[_0xacdb('0x38')](_0xd67d39[_0xacdb('0x30')][_0xacdb('0x38')]);_0xab9341[_0xacdb('0x3c')]=qs[_0xacdb('0x32')](_[_0xacdb('0x39')](_0xd67d39[_0xacdb('0x30')],_0x9442c['filters']));if(_0xd67d39['query']['filter']){_0xab9341['where']=_[_0xacdb('0x3b')](_0xab9341[_0xacdb('0x3c')],{'$or':_[_0xacdb('0x55')](_0xab9341[_0xacdb('0x34')],function(_0x702e7f){var _0x62accd={};_0x62accd[_0x702e7f]={'$like':'%'+_0xd67d39[_0xacdb('0x30')][_0xacdb('0x3a')]+'%'};return _0x62accd;})});}_0xab9341=_[_0xacdb('0x3b')]({},_0xab9341,_0xd67d39[_0xacdb('0x3d')]);return _0x5f24a2['getContacts'](_0xab9341);}})[_0xacdb('0x23')](function(_0x46bbfb){if(_0x46bbfb){_0x5a48da=_0x46bbfb[_0xacdb('0x35')];if(!_0xd67d39['query']['hasOwnProperty'](_0xacdb('0x37'))){_0xab9341[_0xacdb('0x1e')]=qs['limit'](_0xd67d39[_0xacdb('0x30')][_0xacdb('0x1e')]);_0xab9341[_0xacdb('0x1d')]=qs['offset'](_0xd67d39['query'][_0xacdb('0x1d')]);}return _0x5f24a2[_0xacdb('0x52')](_0xab9341);}})[_0xacdb('0x23')](function(_0x350b4a){if(_0x350b4a){return _0x350b4a?{'count':_0x5a48da,'rows':_0x350b4a}:null;}})[_0xacdb('0x23')](respondWithResult(_0x165e53,null))[_0xacdb('0x3f')](handleError(_0x165e53,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 8bfc0f2..5bbc7a6 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 _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 +var _0xf2cf=['./cmCompany.attributes','CmCompany','cm_companies','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x12faa6,_0x29d735){var _0x15a89d=function(_0x302212){while(--_0x302212){_0x12faa6['push'](_0x12faa6['shift']());}};_0x15a89d(++_0x29d735);}(_0xf2cf,0xf5));var _0xff2c=function(_0x425802,_0x4f996f){_0x425802=_0x425802-0x0;var _0x12a4fa=_0xf2cf[_0x425802];return _0x12a4fa;};'use strict';var _=require('lodash');var util=require(_0xff2c('0x0'));var logger=require(_0xff2c('0x1'))(_0xff2c('0x2'));var moment=require('moment');var BPromise=require(_0xff2c('0x3'));var rp=require(_0xff2c('0x4'));var fs=require('fs');var path=require(_0xff2c('0x5'));var rimraf=require(_0xff2c('0x6'));var config=require(_0xff2c('0x7'));var attributes=require(_0xff2c('0x8'));module['exports']=function(_0x8f0f4,_0x68b356){return _0x8f0f4['define'](_0xff2c('0x9'),attributes,{'tableName':_0xff2c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index fc9bf69..cedb9cb 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 _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 +var _0x8ed8=['CmCompany,\x20%s,\x20%s','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5b5a2e,_0x421b5d){var _0x50f592=function(_0xe1e8b){while(--_0xe1e8b){_0x5b5a2e['push'](_0x5b5a2e['shift']());}};_0x50f592(++_0x421b5d);}(_0x8ed8,0x168));var _0x88ed=function(_0x4582f9,_0x2ba207){_0x4582f9=_0x4582f9-0x0;var _0x33b957=_0x8ed8[_0x4582f9];return _0x33b957;};'use strict';var _=require(_0x88ed('0x0'));var util=require(_0x88ed('0x1'));var moment=require(_0x88ed('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x88ed('0x3'));var db=require(_0x88ed('0x4'))['db'];var utils=require(_0x88ed('0x5'));var logger=require('../../config/logger')(_0x88ed('0x6'));var config=require('../../config/environment');var jayson=require(_0x88ed('0x7'));var client=jayson[_0x88ed('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27cbf2,_0xbd647f,_0x3e3a9d){return new BPromise(function(_0x582e60,_0x1be946){return client[_0x88ed('0x9')](_0x27cbf2,_0x3e3a9d)[_0x88ed('0xa')](function(_0x54bc8c){logger['info']('CmCompany,\x20%s,\x20%s',_0xbd647f,_0x88ed('0xb'));logger[_0x88ed('0xc')](_0x88ed('0xd'),_0xbd647f,'request\x20sent',JSON[_0x88ed('0xe')](_0x54bc8c));if(_0x54bc8c[_0x88ed('0xf')]){if(_0x54bc8c[_0x88ed('0xf')][_0x88ed('0x10')]===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0xbd647f,_0x54bc8c['error'][_0x88ed('0x11')]);return _0x1be946(_0x54bc8c[_0x88ed('0xf')][_0x88ed('0x11')]);}logger[_0x88ed('0xf')](_0x88ed('0x12'),_0xbd647f,_0x54bc8c['error'][_0x88ed('0x11')]);return _0x582e60(_0x54bc8c[_0x88ed('0xf')][_0x88ed('0x11')]);}else{logger['info'](_0x88ed('0x12'),_0xbd647f,_0x88ed('0xb'));_0x582e60(_0x54bc8c[_0x88ed('0x13')][_0x88ed('0x11')]);}})[_0x88ed('0x14')](function(_0x5eb5c4){logger['error'](_0x88ed('0x12'),_0xbd647f,_0x5eb5c4);_0x1be946(_0x5eb5c4);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index ac5e8be..ad97113 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 _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 +var _0x2a07=['delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getContacts','create','post','/:id/contacts','put','update'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x2a07,0x74));var _0x72a0=function(_0x4adad3,_0x202bba){_0x4adad3=_0x4adad3-0x0;var _0x52dae4=_0x2a07[_0x4adad3];return _0x52dae4;};'use strict';var multer=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var path=require(_0x72a0('0x2'));var timeout=require(_0x72a0('0x3'));var express=require(_0x72a0('0x4'));var router=express['Router']();var auth=require(_0x72a0('0x5'));var interaction=require(_0x72a0('0x6'));var config=require(_0x72a0('0x7'));var controller=require(_0x72a0('0x8'));router[_0x72a0('0x9')]('/',auth[_0x72a0('0xa')](),controller[_0x72a0('0xb')]);router[_0x72a0('0x9')](_0x72a0('0xc'),auth[_0x72a0('0xa')](),controller[_0x72a0('0xd')]);router[_0x72a0('0x9')](_0x72a0('0xe'),auth[_0x72a0('0xa')](),controller[_0x72a0('0xf')]);router[_0x72a0('0x9')]('/:id/contacts',auth[_0x72a0('0xa')](),controller[_0x72a0('0x10')]);router['post']('/',auth[_0x72a0('0xa')](),controller[_0x72a0('0x11')]);router[_0x72a0('0x12')](_0x72a0('0x13'),auth[_0x72a0('0xa')](),controller['addContacts']);router[_0x72a0('0x14')](_0x72a0('0xe'),auth[_0x72a0('0xa')](),controller[_0x72a0('0x15')]);router[_0x72a0('0x16')](_0x72a0('0xe'),auth[_0x72a0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 7d9c7f4..d133622 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 _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 +var _0x652c=['TEXT','INTEGER','UNSIGNED','DATE','lodash','sequelize','exports','STRING'];(function(_0x5192de,_0x4e91cd){var _0x4e287e=function(_0x3639bc){while(--_0x3639bc){_0x5192de['push'](_0x5192de['shift']());}};_0x4e287e(++_0x4e91cd);}(_0x652c,0x15c));var _0xc652=function(_0x37a350,_0x154790){_0x37a350=_0x37a350-0x0;var _0x15627a=_0x652c[_0x37a350];return _0x15627a;};'use strict';var _=require(_0xc652('0x0'));var Sequelize=require(_0xc652('0x1'));module[_0xc652('0x2')]={'firstName':{'type':Sequelize[_0xc652('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xc652('0x3')]},'street':{'type':Sequelize[_0xc652('0x3')]},'postalCode':{'type':Sequelize[_0xc652('0x3')]},'city':{'type':Sequelize[_0xc652('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0xc652('0x3')]},'description':{'type':Sequelize[_0xc652('0x4')]},'phone':{'type':Sequelize[_0xc652('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xc652('0x3')]},'url':{'type':Sequelize[_0xc652('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xc652('0x3')]},'twitter':{'type':Sequelize[_0xc652('0x3')]},'skype':{'type':Sequelize[_0xc652('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xc652('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xc652('0x3')]},'telegram':{'type':Sequelize[_0xc652('0x3')]},'UserId':{'type':Sequelize[_0xc652('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xc652('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xc652('0x7')],'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 1325370..2efe303 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 _0x712e=['User','and','dateOfBirth','datetime','castTo','buildExpression','start','filter','push','isEmpty','ListId','c.ListId\x20IN\x20?','concat','Contact','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','tag','isArray','replace','\x27\x27\x27\x27','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','SELECT','clone','t.id\x20IN\x20?','some','user','c.ListId\x20IS\x20NULL','sequelize','toString','merge','c.firstName','c.mobile','c.fax','c.email','c.ListId','c.deletedAt','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','CmContact','tags','startsWith','findAll','columnName','displayName','alias','custom','values','body','get','mergeWith','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','ReportAgentPreview','VoiceCallReport','ChatQueueReport','SmsQueueReport','bulkCreate','each','duplicates','$or','findOrCreate','show','params','$and','omit','format','cf_%d','cm_contacts','toParam','text','phone','getTags','findOne','options','nolimit','setTags','getHoppers','rawAttributes','ContactId','includeAll','include','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','filename','chmodSync','0777','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','file','parse','meta','import','agent','binding','child_process','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','describe','keys','length','cf_','CmCustomField','trimStart','all','type','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','pick','select','field','color','from','left_join','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','tools_tags','where','expr','search','sqlOperator','conditions','find','Tag','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union'];(function(_0x5b100f,_0x53ba43){var _0x596469=function(_0xf4a23e){while(--_0xf4a23e){_0x5b100f['push'](_0x5b100f['shift']());}};_0x596469(++_0x53ba43);}(_0x712e,0x186));var _0xe712=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x712e[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0xe712('0x0'));var emlformat=require(_0xe712('0x1'));var rimraf=require(_0xe712('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe712('0x3'));var rp=require(_0xe712('0x4'));var moment=require(_0xe712('0x5'));var BPromise=require(_0xe712('0x6'));var Mustache=require('mustache');var util=require(_0xe712('0x7'));var path=require(_0xe712('0x8'));var sox=require(_0xe712('0x9'));var csv=require(_0xe712('0xa'));var ejs=require(_0xe712('0xb'));var fs=require('fs');var _=require(_0xe712('0xc'));var squel=require(_0xe712('0xd'));var crypto=require('crypto');var jsforce=require(_0xe712('0xe'));var deskjs=require(_0xe712('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe712('0x10'));var Papa=require(_0xe712('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe712('0x12'));var as=require(_0xe712('0x13'));var hardwareService=require(_0xe712('0x14'));var logger=require(_0xe712('0x15'))(_0xe712('0x16'));var utils=require('../../config/utils');var config=require(_0xe712('0x17'));var db=require(_0xe712('0x18'))['db'];config[_0xe712('0x19')]=_[_0xe712('0x1a')](config[_0xe712('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xe712('0x1b'))(new Redis(config[_0xe712('0x19')]));require('./cmContact.socket')[_0xe712('0x1c')](socket);function respondWithStatusCode(_0x304e02,_0x1f58e4){_0x1f58e4=_0x1f58e4||0xcc;return function(_0x5265df){if(_0x5265df){return _0x304e02['sendStatus'](_0x1f58e4);}return _0x304e02[_0xe712('0x1d')](_0x1f58e4)[_0xe712('0x1e')]();};}function respondWithResult(_0x578ba8,_0x34829c){_0x34829c=_0x34829c||0xc8;return function(_0x19b6b4){if(_0x19b6b4){return _0x578ba8[_0xe712('0x1d')](_0x34829c)[_0xe712('0x1f')](_0x19b6b4);}};}function respondWithFilteredResult(_0x3c805,_0x3d49ed){return function(_0x3c736c){if(_0x3c736c){var _0x32e7c2=_0x3c736c[_0xe712('0x20')],_0x55c78a=_0x3d49ed[_0xe712('0x21')],_0x4bd7e3=_0x3d49ed[_0xe712('0x21')]+_0x3d49ed[_0xe712('0x22')],_0x4398b3;if(_0x4bd7e3>=_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=_0x5197a1){_0x5f1a71=_0x5197a1;_0x317c80=0xc8;}else{_0x317c80=0xce;}_0x33ce27[_0x4968('0x1e')](_0x317c80);return _0x33ce27[_0x4968('0x24')](_0x4968('0x25'),_0x547cf6+'-'+_0x5f1a71+'/'+_0x5197a1)[_0x4968('0x20')](_0x220b54);}return null;};}function patchUpdates(_0x432e5d){return function(_0x36b33d){try{jsonpatch[_0x4968('0x26')](_0x36b33d,_0x432e5d,!![]);}catch(_0x3d87a3){return BPromise[_0x4968('0x27')](_0x3d87a3);}return _0x36b33d[_0x4968('0x28')]();};}function saveUpdates(_0x55e268,_0x3c747e){return function(_0x43791c){if(_0x43791c){return _0x43791c['update'](_0x55e268)[_0x4968('0x29')](function(_0xcceccb){return _0xcceccb;});}return null;};}function removeEntity(_0x4ad9ef,_0x44685d){return function(_0x333fc7){if(_0x333fc7){return _0x333fc7[_0x4968('0x2a')]()[_0x4968('0x29')](function(){_0x4ad9ef[_0x4968('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5681d0,_0x580180){return function(_0x393275){if(!_0x393275){_0x5681d0[_0x4968('0x2b')](0x194);}return _0x393275;};}function handleError(_0x7b8f26,_0x174bd2){_0x174bd2=_0x174bd2||0x1f4;return function(_0xa4d28f){logger['error'](_0xa4d28f[_0x4968('0x2c')]);if(_0xa4d28f[_0x4968('0x2d')]){delete _0xa4d28f['name'];}_0x7b8f26['status'](_0x174bd2)[_0x4968('0x2e')](_0xa4d28f);};}exports['index']=function(_0x20b6cf,_0x265eff){var _0x2eb35b={},_0x5ca9e5={},_0x33aabd={'count':0x0,'rows':[]};return db['CmContact'][_0x4968('0x2f')]()[_0x4968('0x29')](function(_0x5b707a){var _0x14a11a=[];for(var _0x1dbcaf=0x0;_0x1dbcaf0x1){_0x36e5a2['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x47709d),null);}else{if(qs[_0x4968('0x6d')](_0x47709d)){_0x36e5a2['or'](_0x4968('0x6e'),_0x47709d+'%');_0x36e5a2['or']('c.phone\x20LIKE\x20?',_0x47709d+'%');_0x36e5a2['or']('c.mobile\x20LIKE\x20?',_0x47709d+'%');_0x36e5a2['or'](_0x4968('0x6f'),_0x47709d+'%');}else if(qs[_0x4968('0x70')](_0x47709d)){_0x36e5a2['or'](_0x4968('0x71'),_0x47709d+'%');}else{_0x36e5a2['or']('c.firstName\x20LIKE\x20?','%'+_0x47709d+'%');_0x36e5a2['or']('c.lastName\x20LIKE\x20?','%'+_0x47709d+'%');_0x36e5a2['or'](_0x4968('0x71'),'%'+_0x47709d+'%');}}}}_0x14fa2e[_0x4968('0x4e')](_0x36e5a2);_0x14fa2e['group'](_0x4968('0x72'));var _0x2078a7={'type':db[_0x4968('0x73')][_0x4968('0x74')][_0x4968('0x75')],'raw':!![]};var _0x53009f=_0x14fa2e['clone']()[_0x4968('0x45')](_0x4968('0x72'));if(_0x2eb35b[_0x4968('0x41')]){_0x2eb35b[_0x4968('0x41')][_0x4968('0x58')](function(_0x2c32f4){_0x14fa2e[_0x4968('0x41')]('c.'+_0x2c32f4[0x0],_0x2c32f4[0x1]===_0x4968('0x76')?![]:!![]);});}if(!_[_0x4968('0x65')](_0x1b898c)){_0x14fa2e[_0x4968('0x77')](_0x312714);_0x53009f[_0x4968('0x4e')](_0x4968('0x78'),_0x1b898c);}BPromise['resolve']()[_0x4968('0x29')](function(){if(_0x1079f6&&!_[_0x4968('0x79')](_0x1079f6[_0x4968('0x54')],[_0x4968('0x45'),_0x4968('0x7a')])){return _0x20b6cf[_0x4968('0x7b')]['getLists']({'attributes':['id'],'raw':!![]})[_0x4968('0x29')](function(_0x1db385){if(_[_0x4968('0x65')](_0x1db385)){_0x53009f[_0x4968('0x4e')]('c.ListId\x20IS\x20NULL');_0x14fa2e[_0x4968('0x4e')](_0x4968('0x7c'));}else{_0x53009f[_0x4968('0x4e')](_0x4968('0x7d'),_['map'](_0x1db385,'id'));_0x14fa2e['where'](_0x4968('0x7d'),_['map'](_0x1db385,'id'));}});}else{return;}})['then'](function(){db[_0x4968('0x7e')][_0x4968('0x3a')](_0x53009f['toString'](),_0x2078a7)[_0x4968('0x29')](function(_0xcf41b){_0x33aabd[_0x4968('0x21')]=_0xcf41b[_0x4968('0x36')];if(_0x33aabd['count']===0x0)return[];return db[_0x4968('0x7e')][_0x4968('0x3a')](_0x5b6d0f['toString'](),_0x2078a7);})[_0x4968('0x29')](function(_0x3b29c2){_0x428561=_[_0x4968('0x7f')](_0x3b29c2,'id');_0x2078a7=_['merge'](_0x2078a7,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x20b6cf['query'][_0x4968('0x3e')]){_0x2eb35b[_0x4968('0x3d')]['forEach'](function(_0x4d52aa){_0x14fa2e[_0x4968('0x45')]('c.'+_0x4d52aa);});}else{_0x14fa2e[_0x4968('0x45')](_0x4968('0x72'));_0x14fa2e['field']('c.firstName');_0x14fa2e[_0x4968('0x45')](_0x4968('0x80'));_0x14fa2e[_0x4968('0x45')](_0x4968('0x81'));_0x14fa2e[_0x4968('0x45')](_0x4968('0x82'));_0x14fa2e[_0x4968('0x45')](_0x4968('0x83'));_0x14fa2e[_0x4968('0x45')]('c.email');_0x14fa2e['field'](_0x4968('0x84'));_0x14fa2e[_0x4968('0x45')]('c.deletedAt');_0x14fa2e['field'](_0x4968('0x85'),_0x4968('0x86'));}if(_0x2eb35b['limit'])_0x14fa2e[_0x4968('0x23')](_0x2eb35b[_0x4968('0x23')]);if(_0x2eb35b[_0x4968('0x22')])_0x14fa2e['offset'](_0x2eb35b[_0x4968('0x22')]);return db[_0x4968('0x7e')][_0x4968('0x3a')](_0x14fa2e[_0x4968('0x87')](),_0x2078a7);})[_0x4968('0x29')](function(_0x275311){_0x275311['forEach'](function(_0x31c762){if(_0x31c762[_0x4968('0x86')]){_0x31c762[_0x4968('0x88')]=[];_0x31c762['TagIds'][_0x4968('0x56')](',')[_0x4968('0x58')](function(_0x2f4fd9){_0x31c762['Tags'][_0x4968('0x33')](_0x428561[_0x2f4fd9]);});}delete _0x31c762[_0x4968('0x86')];});_0x33aabd[_0x4968('0x89')]=_0x275311;return _0x33aabd;})[_0x4968('0x29')](respondWithFilteredResult(_0x265eff,_0x2eb35b));});})[_0x4968('0x8a')](handleError(_0x265eff,null));};exports[_0x4968('0x2a')]=function(_0x2a8b9d,_0xe4e2a2){return db[_0x4968('0x8b')][_0x4968('0x8c')]({'where':{'id':_0x2a8b9d[_0x4968('0x8d')]['id']}})['then'](handleEntityNotFound(_0xe4e2a2,null))[_0x4968('0x29')](removeEntity(_0xe4e2a2,null))[_0x4968('0x8a')](handleError(_0xe4e2a2,null));};exports[_0x4968('0x2f')]=function(_0xe25778,_0x1e0632){return db[_0x4968('0x8b')][_0x4968('0x2f')]()['then'](function(_0x19d78f){delete _0x19d78f['tags'];for(var _0x51b467=0x0;_0x51b467{}\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 +var _0x2d17=['single','upload','/upload/:id','import','update','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./cmContact.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','post','/merge','merge','create','/create_many','bulkCreate','setTags','diskStorage','join','root','server/files/tmp','originalname','extname','now','/csv','uploadCsv','replace','%s-%s%s','/upload'];(function(_0x93942f,_0xb48547){var _0x23fcd8=function(_0x4728be){while(--_0x4728be){_0x93942f['push'](_0x93942f['shift']());}};_0x23fcd8(++_0xb48547);}(_0x2d17,0x17e));var _0x72d1=function(_0x55ad19,_0x39a3a1){_0x55ad19=_0x55ad19-0x0;var _0x9947aa=_0x2d17[_0x55ad19];return _0x9947aa;};'use strict';var multer=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var path=require('path');var timeout=require(_0x72d1('0x2'));var express=require(_0x72d1('0x3'));var router=express['Router']();var auth=require(_0x72d1('0x4'));var interaction=require(_0x72d1('0x5'));var config=require('../../config/environment');var controller=require(_0x72d1('0x6'));router['get']('/',auth[_0x72d1('0x7')](),controller['index']);router[_0x72d1('0x8')](_0x72d1('0x9'),auth['isAuthenticated'](),controller[_0x72d1('0xa')]);router[_0x72d1('0x8')](_0x72d1('0xb'),auth['isAuthenticated'](),controller[_0x72d1('0xc')]);router[_0x72d1('0x8')](_0x72d1('0xd'),auth['isAuthenticated'](),controller[_0x72d1('0xe')]);router[_0x72d1('0x8')](_0x72d1('0xf'),auth[_0x72d1('0x7')](),controller[_0x72d1('0x10')]);router[_0x72d1('0x8')](_0x72d1('0x11'),auth[_0x72d1('0x7')](),controller[_0x72d1('0x12')]);router[_0x72d1('0x8')]('/:id/hopper_finals',auth[_0x72d1('0x7')](),controller[_0x72d1('0x13')]);router[_0x72d1('0x8')](_0x72d1('0x14'),auth[_0x72d1('0x7')](),controller[_0x72d1('0x15')]);router[_0x72d1('0x16')](_0x72d1('0x17'),auth[_0x72d1('0x7')](),controller[_0x72d1('0x18')]);router[_0x72d1('0x16')]('/',auth[_0x72d1('0x7')](),controller[_0x72d1('0x19')]);router['post'](_0x72d1('0x1a'),auth['isAuthenticated'](),controller[_0x72d1('0x1b')]);router[_0x72d1('0x16')]('/:id/tags',auth[_0x72d1('0x7')](),controller[_0x72d1('0x1c')]);var upload=multer({'storage':multer[_0x72d1('0x1d')]({'destination':function(_0x49caf4,_0x4925f6,_0x313d7b){_0x313d7b(null,path[_0x72d1('0x1e')](config[_0x72d1('0x1f')],_0x72d1('0x20')));},'filename':function(_0x8d6890,_0x2253fd,_0x1e2411){_0x2253fd['originalname']=_0x2253fd[_0x72d1('0x21')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1e2411(null,util['format']('%s-%s%s',path['basename'](_0x2253fd[_0x72d1('0x21')],path[_0x72d1('0x22')](_0x2253fd['originalname'])),Date[_0x72d1('0x23')](),path[_0x72d1('0x22')](_0x2253fd[_0x72d1('0x21')])));}})});router[_0x72d1('0x16')](_0x72d1('0x24'),upload['single']('file'),controller[_0x72d1('0x25')]);var upload=multer({'storage':multer[_0x72d1('0x1d')]({'destination':function(_0x2f661,_0x2f879f,_0xdf6a69){_0xdf6a69(null,path[_0x72d1('0x1e')](config[_0x72d1('0x1f')],'server/files/tmp'));},'filename':function(_0x57ec9e,_0x1ba258,_0x482cb8){_0x1ba258[_0x72d1('0x21')]=_0x1ba258[_0x72d1('0x21')][_0x72d1('0x26')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x482cb8(null,util['format'](_0x72d1('0x27'),path['basename'](_0x1ba258[_0x72d1('0x21')],path[_0x72d1('0x22')](_0x1ba258[_0x72d1('0x21')])),Date[_0x72d1('0x23')](),path['extname'](_0x1ba258[_0x72d1('0x21')])));}})});router['post'](_0x72d1('0x28'),upload[_0x72d1('0x29')]('file'),controller[_0x72d1('0x2a')]);router[_0x72d1('0x16')](_0x72d1('0x2b'),auth[_0x72d1('0x7')](),controller[_0x72d1('0x2c')]);router['put'](_0x72d1('0xb'),auth[_0x72d1('0x7')](),controller[_0x72d1('0x2d')]);router['delete'](_0x72d1('0xb'),auth[_0x72d1('0x7')](),controller['destroy']);module[_0x72d1('0x2e')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 8f28c10..1a68224 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 _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 +var _0xd802=['STRING','setDataValue','name','TEXT','long','type','select','parse','values','isArray','stringify','BOOLEAN','sequelize','exports','VIRTUAL','getDataValue','alias'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd802,0x10b));var _0x2d80=function(_0x9fb081,_0x48f480){_0x9fb081=_0x9fb081-0x0;var _0x43f8b0=_0xd802[_0x9fb081];return _0x43f8b0;};'use strict';var Sequelize=require(_0x2d80('0x0'));var _=require('lodash');module[_0x2d80('0x1')]={'name':{'type':Sequelize[_0x2d80('0x2')],'get':function(_0x4dbc96){return this[_0x2d80('0x3')](_0x2d80('0x4'));}},'alias':{'type':Sequelize[_0x2d80('0x5')],'allowNull':![],'set':function(_0x4370a9){this[_0x2d80('0x6')](_0x2d80('0x4'),_0x4370a9?_0x4370a9:this[_0x2d80('0x3')](_0x2d80('0x7')));}},'type':{'type':Sequelize[_0x2d80('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x2d80('0x8')](_0x2d80('0x9')),'get':function(){if(this[_0x2d80('0x3')](_0x2d80('0xa'))===_0x2d80('0xb')){return JSON[_0x2d80('0xc')](this[_0x2d80('0x3')](_0x2d80('0xd')));}else{return this[_0x2d80('0x3')](_0x2d80('0xd'));}},'set':function(_0x48b355){if(Array[_0x2d80('0xe')](_0x48b355)){this[_0x2d80('0x6')](_0x2d80('0xd'),JSON[_0x2d80('0xf')](_0x48b355));}else{this[_0x2d80('0x6')](_0x2d80('0xd'),_0x48b355);}}},'required':{'type':Sequelize[_0x2d80('0x10')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 6982907..f8954fa 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 _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 +var _0x6215=['mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','reject','save','update','then','stack','map','rawAttributes','type','name','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','CmCustomField','count','includeAll','include','findAll','rows','show','catch','body','find','params','sequelize','transaction','create','text','TEXT','number','Sequelize','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','format','cf_%d','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x6215,0x19e));var _0x5621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6215[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5621('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5621('0x1'));var jsonpatch=require(_0x5621('0x2'));var rp=require(_0x5621('0x3'));var moment=require(_0x5621('0x4'));var BPromise=require(_0x5621('0x5'));var Mustache=require(_0x5621('0x6'));var util=require('util');var path=require(_0x5621('0x7'));var sox=require(_0x5621('0x8'));var csv=require('to-csv');var ejs=require(_0x5621('0x9'));var fs=require('fs');var _=require(_0x5621('0xa'));var squel=require('squel');var crypto=require(_0x5621('0xb'));var jsforce=require(_0x5621('0xc'));var deskjs=require(_0x5621('0xd'));var toCsv=require(_0x5621('0xe'));var querystring=require(_0x5621('0xf'));var Papa=require(_0x5621('0x10'));var Redis=require('ioredis');var authService=require(_0x5621('0x11'));var qs=require(_0x5621('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5621('0x13'));var logger=require(_0x5621('0x14'))(_0x5621('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x5621('0x16'))['db'];function respondWithStatusCode(_0x1ad3c6,_0x560e84){_0x560e84=_0x560e84||0xcc;return function(_0xef6013){if(_0xef6013){return _0x1ad3c6[_0x5621('0x17')](_0x560e84);}return _0x1ad3c6['status'](_0x560e84)[_0x5621('0x18')]();};}function respondWithResult(_0x34e350,_0x34a1c1){_0x34a1c1=_0x34a1c1||0xc8;return function(_0x3bdd75){if(_0x3bdd75){return _0x34e350[_0x5621('0x19')](_0x34a1c1)[_0x5621('0x1a')](_0x3bdd75);}};}function respondWithFilteredResult(_0x360e2a,_0x545003){return function(_0x5b0ef0){if(_0x5b0ef0){var _0x37a308=_0x5b0ef0['count'],_0x2d73b3=_0x545003['offset'],_0x3747bd=_0x545003[_0x5621('0x1b')]+_0x545003[_0x5621('0x1c')],_0xbfa5e6;if(_0x3747bd>=_0x37a308){_0x3747bd=_0x37a308;_0xbfa5e6=0xc8;}else{_0xbfa5e6=0xce;}_0x360e2a[_0x5621('0x19')](_0xbfa5e6);return _0x360e2a[_0x5621('0x1d')](_0x5621('0x1e'),_0x2d73b3+'-'+_0x3747bd+'/'+_0x37a308)[_0x5621('0x1a')](_0x5b0ef0);}return null;};}function patchUpdates(_0x2922a5){return function(_0x5ad788){try{jsonpatch['apply'](_0x5ad788,_0x2922a5,!![]);}catch(_0x51a6cb){return BPromise[_0x5621('0x1f')](_0x51a6cb);}return _0x5ad788[_0x5621('0x20')]();};}function saveUpdates(_0x371a73,_0x2d4f5a){return function(_0x1843d2){if(_0x1843d2){return _0x1843d2[_0x5621('0x21')](_0x371a73)[_0x5621('0x22')](function(_0x64a41b){return _0x64a41b;});}return null;};}function removeEntity(_0x5ba75a,_0x219044){return function(_0x14b786){if(_0x14b786){return _0x14b786['destroy']()['then'](function(){_0x5ba75a[_0x5621('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12088b,_0x3446bd){return function(_0x19ea8d){if(!_0x19ea8d){_0x12088b[_0x5621('0x17')](0x194);}return _0x19ea8d;};}function handleError(_0x5a546a,_0x1444eb){_0x1444eb=_0x1444eb||0x1f4;return function(_0x1111ad){logger['error'](_0x1111ad[_0x5621('0x23')]);if(_0x1111ad['name']){delete _0x1111ad['name'];}_0x5a546a[_0x5621('0x19')](_0x1444eb)['send'](_0x1111ad);};}exports['index']=function(_0x591194,_0x1d0ce6){var _0x2694b7={},_0x22e97f={},_0x37be5d={'count':0x0,'rows':[]};var _0x588e43=_[_0x5621('0x24')](db['CmCustomField'][_0x5621('0x25')],function(_0x57294a){return{'name':_0x57294a['fieldName'],'type':_0x57294a[_0x5621('0x26')]['key']};});_0x22e97f['model']=_['differenceBy'](_[_0x5621('0x24')](_0x588e43,_0x5621('0x27')),['name']);_0x22e97f[_0x5621('0x28')]=_[_0x5621('0x29')](_0x591194[_0x5621('0x28')]);_0x22e97f['filters']=_['intersection'](_0x22e97f['model'],_0x22e97f[_0x5621('0x28')]);_0x2694b7[_0x5621('0x2a')]=_[_0x5621('0x2b')](_0x22e97f[_0x5621('0x2c')],qs['fields'](_0x591194[_0x5621('0x28')][_0x5621('0x2d')]));_0x2694b7[_0x5621('0x2a')]=_0x2694b7[_0x5621('0x2a')][_0x5621('0x2e')]?_0x2694b7['attributes']:_0x22e97f[_0x5621('0x2c')];if(!_0x591194[_0x5621('0x28')][_0x5621('0x2f')](_0x5621('0x30'))){_0x2694b7['limit']=qs[_0x5621('0x1c')](_0x591194[_0x5621('0x28')][_0x5621('0x1c')]);_0x2694b7[_0x5621('0x1b')]=qs['offset'](_0x591194[_0x5621('0x28')]['offset']);}_0x2694b7[_0x5621('0x31')]=qs[_0x5621('0x32')](_0x591194[_0x5621('0x28')][_0x5621('0x32')]);_0x2694b7[_0x5621('0x33')]=qs['filters'](_[_0x5621('0x34')](_0x591194[_0x5621('0x28')],_0x22e97f[_0x5621('0x35')]),_0x588e43);if(_0x591194[_0x5621('0x28')]['filter']){_0x2694b7['where']=_[_0x5621('0x36')](_0x2694b7[_0x5621('0x33')],{'$or':_[_0x5621('0x24')](_0x588e43,function(_0x2b907d){if(_0x2b907d[_0x5621('0x26')]!==_0x5621('0x37')){var _0x78e692={};_0x78e692[_0x2b907d['name']]={'$like':'%'+_0x591194[_0x5621('0x28')][_0x5621('0x38')]+'%'};return _0x78e692;}})});}_0x2694b7=_[_0x5621('0x36')]({},_0x2694b7,_0x591194[_0x5621('0x39')]);var _0x39f6de={'where':_0x2694b7[_0x5621('0x33')]};return db[_0x5621('0x3a')][_0x5621('0x3b')](_0x39f6de)[_0x5621('0x22')](function(_0x42d2fb){_0x37be5d[_0x5621('0x3b')]=_0x42d2fb;if(_0x591194[_0x5621('0x28')][_0x5621('0x3c')]){_0x2694b7[_0x5621('0x3d')]=[{'all':!![]}];}return db[_0x5621('0x3a')][_0x5621('0x3e')](_0x2694b7);})[_0x5621('0x22')](function(_0x53dcdd){_0x37be5d[_0x5621('0x3f')]=_0x53dcdd;return _0x37be5d;})[_0x5621('0x22')](respondWithFilteredResult(_0x1d0ce6,_0x2694b7))['catch'](handleError(_0x1d0ce6,null));};exports[_0x5621('0x40')]=function(_0x402f1e,_0x195768){var _0x439b5e={'raw':!![],'where':{'id':_0x402f1e['params']['id']}},_0x1d7d14={};_0x1d7d14[_0x5621('0x2c')]=_['keys'](db[_0x5621('0x3a')][_0x5621('0x25')]);_0x1d7d14[_0x5621('0x28')]=_[_0x5621('0x29')](_0x402f1e[_0x5621('0x28')]);_0x1d7d14[_0x5621('0x35')]=_[_0x5621('0x2b')](_0x1d7d14[_0x5621('0x2c')],_0x1d7d14['query']);_0x439b5e['attributes']=_[_0x5621('0x2b')](_0x1d7d14['model'],qs[_0x5621('0x2d')](_0x402f1e[_0x5621('0x28')][_0x5621('0x2d')]));_0x439b5e[_0x5621('0x2a')]=_0x439b5e['attributes'][_0x5621('0x2e')]?_0x439b5e['attributes']:_0x1d7d14[_0x5621('0x2c')];if(_0x402f1e[_0x5621('0x28')]['includeAll']){_0x439b5e[_0x5621('0x3d')]=[{'all':!![]}];}_0x439b5e=_['merge']({},_0x439b5e,_0x402f1e[_0x5621('0x39')]);return db[_0x5621('0x3a')]['find'](_0x439b5e)[_0x5621('0x22')](handleEntityNotFound(_0x195768,null))[_0x5621('0x22')](respondWithResult(_0x195768,null))[_0x5621('0x41')](handleError(_0x195768,null));};exports['update']=function(_0x4c289d,_0x4b05d6){if(_0x4c289d[_0x5621('0x42')]['id']){delete _0x4c289d['body']['id'];}return db['CmCustomField'][_0x5621('0x43')]({'where':{'id':_0x4c289d[_0x5621('0x44')]['id']}})[_0x5621('0x22')](handleEntityNotFound(_0x4b05d6,null))['then'](saveUpdates(_0x4c289d[_0x5621('0x42')],null))[_0x5621('0x22')](respondWithResult(_0x4b05d6,null))[_0x5621('0x41')](handleError(_0x4b05d6,null));};exports['destroy']=function(_0x28fa45,_0x35d68f){return db[_0x5621('0x3a')][_0x5621('0x43')]({'where':{'id':_0x28fa45['params']['id']}})[_0x5621('0x22')](handleEntityNotFound(_0x35d68f,null))[_0x5621('0x22')](removeEntity(_0x35d68f,null))[_0x5621('0x41')](handleError(_0x35d68f,null));};exports['create']=function(_0x2241ac,_0x4e8698){var _0x3db1a4;return db[_0x5621('0x45')][_0x5621('0x46')](function(_0xb04d1a){return db[_0x5621('0x3a')][_0x5621('0x47')](_0x2241ac[_0x5621('0x42')],{'transaction':_0xb04d1a})[_0x5621('0x22')](function(_0x42cdbe){_0x3db1a4=_0x42cdbe;var _0x56e6a3={'type':db['Sequelize']['TEXT'],'transaction':_0xb04d1a};switch(_0x2241ac[_0x5621('0x42')]['type']){case _0x5621('0x48'):_0x56e6a3[_0x5621('0x26')]=db['Sequelize'][_0x5621('0x49')];break;case _0x5621('0x4a'):_0x56e6a3['type']=db[_0x5621('0x4b')][_0x5621('0x4c')];break;case _0x5621('0x4d'):_0x56e6a3['type']=db[_0x5621('0x4b')][_0x5621('0x4e')];_0x56e6a3[_0x5621('0x4f')]=![];break;default:}return db[_0x5621('0x45')]['queryInterface'][_0x5621('0x50')](_0x5621('0x51'),util[_0x5621('0x52')](_0x5621('0x53'),_0x3db1a4['id']),_0x56e6a3);})['then'](function(){return _0x3db1a4;});})['then'](respondWithResult(_0x4e8698,0xc9))['catch'](handleError(_0x4e8698,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 54a6522..4b2af3c 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 _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 +var _0x4ea5=['./cmCustomField.attributes','CmCustomField','cm_custom_fields','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x5460be,_0x871df3){var _0x3b18c4=function(_0x5d88e8){while(--_0x5d88e8){_0x5460be['push'](_0x5460be['shift']());}};_0x3b18c4(++_0x871df3);}(_0x4ea5,0xcb));var _0x54ea=function(_0x38af48,_0x400460){_0x38af48=_0x38af48-0x0;var _0x445384=_0x4ea5[_0x38af48];return _0x445384;};'use strict';var _=require(_0x54ea('0x0'));var util=require('util');var logger=require(_0x54ea('0x1'))(_0x54ea('0x2'));var moment=require(_0x54ea('0x3'));var BPromise=require('bluebird');var rp=require(_0x54ea('0x4'));var fs=require('fs');var path=require(_0x54ea('0x5'));var rimraf=require('rimraf');var config=require(_0x54ea('0x6'));var attributes=require(_0x54ea('0x7'));module['exports']=function(_0x11941c,_0x396f28){return _0x11941c['define'](_0x54ea('0x8'),attributes,{'tableName':_0x54ea('0x9'),'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 c94169d..f734778 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 _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 +var _0xb821=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','ioredis'];(function(_0xa99357,_0x50ffad){var _0x111875=function(_0x4dce0c){while(--_0x4dce0c){_0xa99357['push'](_0xa99357['shift']());}};_0x111875(++_0x50ffad);}(_0xb821,0xa7));var _0x1b82=function(_0x23f741,_0x494b5f){_0x23f741=_0x23f741-0x0;var _0x2bda3d=_0xb821[_0x23f741];return _0x2bda3d;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b82('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b82('0x3'))(_0x1b82('0x4'));var config=require(_0x1b82('0x5'));var jayson=require(_0x1b82('0x6'));var client=jayson['client'][_0x1b82('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x192434,_0x202a5f,_0x3632dd){return new BPromise(function(_0x18f45f,_0x7b87e8){return client[_0x1b82('0x8')](_0x192434,_0x3632dd)[_0x1b82('0x9')](function(_0x141673){logger['info'](_0x1b82('0xa'),_0x202a5f,_0x1b82('0xb'));logger[_0x1b82('0xc')](_0x1b82('0xd'),_0x202a5f,_0x1b82('0xb'),JSON[_0x1b82('0xe')](_0x141673));if(_0x141673[_0x1b82('0xf')]){if(_0x141673[_0x1b82('0xf')]['code']===0x1f4){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);return _0x7b87e8(_0x141673['error'][_0x1b82('0x10')]);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x202a5f,_0x141673[_0x1b82('0xf')]['message']);return _0x18f45f(_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);}else{logger['info'](_0x1b82('0xa'),_0x202a5f,'request\x20sent');_0x18f45f(_0x141673['result'][_0x1b82('0x10')]);}})['catch'](function(_0x111247){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x111247);_0x7b87e8(_0x111247);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 518b880..06d01a5 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 _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 +var _0x7677=['update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','show','create','put','/:id'];(function(_0xebbd1e,_0xad74b4){var _0x25e2e5=function(_0x29ee2c){while(--_0x29ee2c){_0xebbd1e['push'](_0xebbd1e['shift']());}};_0x25e2e5(++_0xad74b4);}(_0x7677,0x18f));var _0x7767=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7677[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x7767('0x0'));var util=require('util');var path=require(_0x7767('0x1'));var timeout=require(_0x7767('0x2'));var express=require(_0x7767('0x3'));var router=express['Router']();var auth=require(_0x7767('0x4'));var interaction=require(_0x7767('0x5'));var config=require(_0x7767('0x6'));var controller=require(_0x7767('0x7'));router[_0x7767('0x8')]('/',auth[_0x7767('0x9')](),controller[_0x7767('0xa')]);router[_0x7767('0x8')]('/:id',auth[_0x7767('0x9')](),controller[_0x7767('0xb')]);router['post']('/',auth[_0x7767('0x9')](),controller[_0x7767('0xc')]);router[_0x7767('0xd')](_0x7767('0xe'),auth['isAuthenticated'](),controller[_0x7767('0xf')]);router[_0x7767('0x10')](_0x7767('0xe'),auth[_0x7767('0x9')](),controller['destroy']);module[_0x7767('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index af269e3..0171ec0 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 _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 +var _0x2bd8=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','exports','STRING','BOOLEAN','DATE','format'];(function(_0x381874,_0x3f2356){var _0x1ba1d5=function(_0x339a00){while(--_0x339a00){_0x381874['push'](_0x381874['shift']());}};_0x1ba1d5(++_0x3f2356);}(_0x2bd8,0x130));var _0x82bd=function(_0x52b2e2,_0x3e6a1f){_0x52b2e2=_0x52b2e2-0x0;var _0x40c96e=_0x2bd8[_0x52b2e2];return _0x40c96e;};'use strict';var moment=require(_0x82bd('0x0'));var Sequelize=require('sequelize');module[_0x82bd('0x1')]={'phone':{'type':Sequelize[_0x82bd('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x82bd('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x82bd('0x4')],'defaultValue':moment()[_0x82bd('0x5')](_0x82bd('0x6'))},'countbusyretry':{'type':Sequelize[_0x82bd('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x82bd('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x82bd('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x82bd('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x82bd('0x7')](0x2)[_0x82bd('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x82bd('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x82bd('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x82bd('0x7')],'unique':'contactListQueue'},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x82bd('0x9')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x82bd('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x82bd('0x7')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 51625dd..78c86d9 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 _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 +var _0xc9d5=['desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','sendStatus','status','json','offset','Content-Range','save','then','end','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','model','keys','intersection','query','filters','concat','$or','$gt','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$notLike','$iLike','$notILike','$like','$contained','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','fields','options','find','create','body','update','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmList','List','Queue','dialActive','isNumber','getOpenContacts','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','crypto','jsforce'];(function(_0x1d6e31,_0x1c5921){var _0x249c60=function(_0x5dd68d){while(--_0x5dd68d){_0x1d6e31['push'](_0x1d6e31['shift']());}};_0x249c60(++_0x1c5921);}(_0xc9d5,0x19f));var _0x5c9d=function(_0x5cd9b9,_0x40d591){_0x5cd9b9=_0x5cd9b9-0x0;var _0x5cc187=_0xc9d5[_0x5cd9b9];return _0x5cc187;};'use strict';var pdf=require(_0x5c9d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5c9d('0x1'));var zipdir=require(_0x5c9d('0x2'));var jsonpatch=require(_0x5c9d('0x3'));var rp=require(_0x5c9d('0x4'));var moment=require(_0x5c9d('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5c9d('0x6'));var path=require(_0x5c9d('0x7'));var sox=require(_0x5c9d('0x8'));var csv=require(_0x5c9d('0x9'));var ejs=require(_0x5c9d('0xa'));var fs=require('fs');var _=require(_0x5c9d('0xb'));var squel=require('squel');var crypto=require(_0x5c9d('0xc'));var jsforce=require(_0x5c9d('0xd'));var deskjs=require(_0x5c9d('0xe'));var toCsv=require(_0x5c9d('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5c9d('0xf'));var authService=require(_0x5c9d('0x10'));var qs=require(_0x5c9d('0x11'));var as=require(_0x5c9d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5c9d('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x5c9d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45668e,_0xccd7ce){_0xccd7ce=_0xccd7ce||0xcc;return function(_0x47a9a4){if(_0x47a9a4){return _0x45668e[_0x5c9d('0x15')](_0xccd7ce);}return _0x45668e[_0x5c9d('0x16')](_0xccd7ce)['end']();};}function respondWithResult(_0x3aad05,_0x2e97b1){_0x2e97b1=_0x2e97b1||0xc8;return function(_0x11838d){if(_0x11838d){return _0x3aad05[_0x5c9d('0x16')](_0x2e97b1)[_0x5c9d('0x17')](_0x11838d);}};}function respondWithFilteredResult(_0xbd1215,_0x21a0e2){return function(_0x49ecf0){if(_0x49ecf0){var _0xe2df3c=_0x49ecf0['count'],_0xbfd873=_0x21a0e2[_0x5c9d('0x18')],_0xb5a221=_0x21a0e2[_0x5c9d('0x18')]+_0x21a0e2['limit'],_0x5b22f1;if(_0xb5a221>=_0xe2df3c){_0xb5a221=_0xe2df3c;_0x5b22f1=0xc8;}else{_0x5b22f1=0xce;}_0xbd1215[_0x5c9d('0x16')](_0x5b22f1);return _0xbd1215['set'](_0x5c9d('0x19'),_0xbfd873+'-'+_0xb5a221+'/'+_0xe2df3c)['json'](_0x49ecf0);}return null;};}function patchUpdates(_0x5dbf73){return function(_0x403ae5){try{jsonpatch['apply'](_0x403ae5,_0x5dbf73,!![]);}catch(_0x8eef54){return BPromise['reject'](_0x8eef54);}return _0x403ae5[_0x5c9d('0x1a')]();};}function saveUpdates(_0x39e255,_0xbe8125){return function(_0x1936bb){if(_0x1936bb){return _0x1936bb['update'](_0x39e255)[_0x5c9d('0x1b')](function(_0x4d5b88){return _0x4d5b88;});}return null;};}function removeEntity(_0x27fb24,_0x227e8e){return function(_0x24e639){if(_0x24e639){return _0x24e639['destroy']()[_0x5c9d('0x1b')](function(){_0x27fb24[_0x5c9d('0x16')](0xcc)[_0x5c9d('0x1c')]();});}};}function handleEntityNotFound(_0x3c456d,_0x1d4891){return function(_0x3fdc7a){if(!_0x3fdc7a){_0x3c456d[_0x5c9d('0x15')](0x194);}return _0x3fdc7a;};}function handleError(_0x2d8ae9,_0x450884){_0x450884=_0x450884||0x1f4;return function(_0x39480b){logger[_0x5c9d('0x1d')](_0x39480b[_0x5c9d('0x1e')]);if(_0x39480b[_0x5c9d('0x1f')]){delete _0x39480b[_0x5c9d('0x1f')];}_0x2d8ae9['status'](_0x450884)[_0x5c9d('0x20')](_0x39480b);};}exports[_0x5c9d('0x21')]=function(_0x28ee6a,_0x2ba9e8){var _0x1f3e4a={},_0x527208={},_0x51dd37={'count':0x0,'rows':[]};var _0x3d210d=_[_0x5c9d('0x22')](db[_0x5c9d('0x23')][_0x5c9d('0x24')],function(_0x25dd2d){return{'name':_0x25dd2d[_0x5c9d('0x25')],'type':_0x25dd2d[_0x5c9d('0x26')][_0x5c9d('0x27')]};});_0x527208[_0x5c9d('0x28')]=_[_0x5c9d('0x22')](_0x3d210d,_0x5c9d('0x1f'));_0x527208['query']=_[_0x5c9d('0x29')](_0x28ee6a['query']);_0x527208['filters']=_[_0x5c9d('0x2a')](_0x527208[_0x5c9d('0x28')],_0x527208[_0x5c9d('0x2b')]);_0x527208[_0x5c9d('0x2c')]=_[_0x5c9d('0x2d')](_0x527208[_0x5c9d('0x2c')],['$and',_0x5c9d('0x2e'),_0x5c9d('0x2f'),_0x5c9d('0x30'),_0x5c9d('0x31'),_0x5c9d('0x32'),_0x5c9d('0x33'),_0x5c9d('0x34'),'$not',_0x5c9d('0x35'),_0x5c9d('0x36'),_0x5c9d('0x37'),'$notIn','$like',_0x5c9d('0x38'),_0x5c9d('0x39'),_0x5c9d('0x3a'),_0x5c9d('0x3b'),'$overlap','$contains',_0x5c9d('0x3c'),'$any']);_0x1f3e4a[_0x5c9d('0x3d')]=_[_0x5c9d('0x2a')](_0x527208[_0x5c9d('0x28')],qs['fields'](_0x28ee6a[_0x5c9d('0x2b')]['fields']));_0x1f3e4a[_0x5c9d('0x3d')]=_0x1f3e4a[_0x5c9d('0x3d')][_0x5c9d('0x3e')]?_0x1f3e4a[_0x5c9d('0x3d')]:_0x527208[_0x5c9d('0x28')];if(!_0x28ee6a['query'][_0x5c9d('0x3f')](_0x5c9d('0x40'))){_0x1f3e4a[_0x5c9d('0x41')]=qs[_0x5c9d('0x41')](_0x28ee6a[_0x5c9d('0x2b')][_0x5c9d('0x41')]);_0x1f3e4a['offset']=qs[_0x5c9d('0x18')](_0x28ee6a[_0x5c9d('0x2b')][_0x5c9d('0x18')]);}_0x1f3e4a[_0x5c9d('0x42')]=qs[_0x5c9d('0x43')](_0x28ee6a[_0x5c9d('0x2b')]['sort']);_0x1f3e4a[_0x5c9d('0x44')]=qs[_0x5c9d('0x2c')](_['pick'](_0x28ee6a['query'],_0x527208['filters']),_0x3d210d);if(_0x28ee6a[_0x5c9d('0x2b')][_0x5c9d('0x45')]){_0x1f3e4a['where']=_[_0x5c9d('0x46')](_0x1f3e4a[_0x5c9d('0x44')],{'$or':_[_0x5c9d('0x22')](_0x3d210d,function(_0x454172){if(_0x454172[_0x5c9d('0x26')]!==_0x5c9d('0x47')){var _0x3bd0a8={};_0x3bd0a8[_0x454172[_0x5c9d('0x1f')]]={'$like':'%'+_0x28ee6a[_0x5c9d('0x2b')][_0x5c9d('0x45')]+'%'};return _0x3bd0a8;}})});}_0x1f3e4a=_[_0x5c9d('0x46')]({},_0x1f3e4a,_0x28ee6a['options']);var _0x3cb457={'where':_0x1f3e4a[_0x5c9d('0x44')]};return db[_0x5c9d('0x23')]['count'](_0x3cb457)['then'](function(_0x37200c){_0x51dd37[_0x5c9d('0x48')]=_0x37200c;if(_0x28ee6a[_0x5c9d('0x2b')][_0x5c9d('0x49')]){_0x1f3e4a[_0x5c9d('0x4a')]=[{'all':!![]}];}return db[_0x5c9d('0x23')][_0x5c9d('0x4b')](_0x1f3e4a);})[_0x5c9d('0x1b')](function(_0x21d0ec){_0x51dd37[_0x5c9d('0x4c')]=_0x21d0ec;return _0x51dd37;})[_0x5c9d('0x1b')](respondWithFilteredResult(_0x2ba9e8,_0x1f3e4a))[_0x5c9d('0x4d')](handleError(_0x2ba9e8,null));};exports[_0x5c9d('0x4e')]=function(_0x2bac9e,_0x2fa749){var _0x26e13e={'raw':!![],'where':{'id':_0x2bac9e[_0x5c9d('0x4f')]['id']}},_0x272921={};_0x272921[_0x5c9d('0x28')]=_[_0x5c9d('0x29')](db[_0x5c9d('0x23')][_0x5c9d('0x24')]);_0x272921['query']=_['keys'](_0x2bac9e[_0x5c9d('0x2b')]);_0x272921[_0x5c9d('0x2c')]=_['intersection'](_0x272921[_0x5c9d('0x28')],_0x272921['query']);_0x26e13e[_0x5c9d('0x3d')]=_[_0x5c9d('0x2a')](_0x272921[_0x5c9d('0x28')],qs[_0x5c9d('0x50')](_0x2bac9e[_0x5c9d('0x2b')]['fields']));_0x26e13e[_0x5c9d('0x3d')]=_0x26e13e['attributes'][_0x5c9d('0x3e')]?_0x26e13e['attributes']:_0x272921[_0x5c9d('0x28')];if(_0x2bac9e['query'][_0x5c9d('0x49')]){_0x26e13e[_0x5c9d('0x4a')]=[{'all':!![]}];}_0x26e13e=_[_0x5c9d('0x46')]({},_0x26e13e,_0x2bac9e[_0x5c9d('0x51')]);return db[_0x5c9d('0x23')][_0x5c9d('0x52')](_0x26e13e)['then'](handleEntityNotFound(_0x2fa749,null))['then'](respondWithResult(_0x2fa749,null))[_0x5c9d('0x4d')](handleError(_0x2fa749,null));};exports['create']=function(_0x17f314,_0x20e25c){return db[_0x5c9d('0x23')][_0x5c9d('0x53')](_0x17f314[_0x5c9d('0x54')],{})[_0x5c9d('0x1b')](respondWithResult(_0x20e25c,0xc9))[_0x5c9d('0x4d')](handleError(_0x20e25c,null));};exports[_0x5c9d('0x55')]=function(_0x1b055f,_0x32aecc){if(_0x1b055f['body']['id']){delete _0x1b055f['body']['id'];}return db[_0x5c9d('0x23')]['find']({'where':{'id':_0x1b055f[_0x5c9d('0x4f')]['id']}})[_0x5c9d('0x1b')](handleEntityNotFound(_0x32aecc,null))[_0x5c9d('0x1b')](saveUpdates(_0x1b055f['body'],null))['then'](respondWithResult(_0x32aecc,null))['catch'](handleError(_0x32aecc,null));};exports[_0x5c9d('0x56')]=function(_0x1e458d,_0x996688){return db[_0x5c9d('0x23')]['describe']()[_0x5c9d('0x1b')](respondWithResult(_0x996688,null))['catch'](handleError(_0x996688,null));};exports['destroy']=function(_0xff6338,_0xc8d0c){var _0x6b2aee;return db[_0x5c9d('0x23')][_0x5c9d('0x52')]({'where':{'id':_0xff6338[_0x5c9d('0x4f')]['id']}})[_0x5c9d('0x1b')](handleEntityNotFound(_0xc8d0c,null))[_0x5c9d('0x1b')](function(_0x117f2d){if(_0x117f2d){return _0x117f2d[_0x5c9d('0x57')]()[_0x5c9d('0x1b')](function(_0x39e1c6){return _0x39e1c6;});}})[_0x5c9d('0x1b')](function(_0x9fbf4d){_0x6b2aee=_0x9fbf4d;if(_0x9fbf4d){if(_0x9fbf4d[_0x5c9d('0x58')]||_0x9fbf4d[_0x5c9d('0x59')]){return db[_0x9fbf4d[_0x5c9d('0x58')]?_0x5c9d('0x5a'):_0x5c9d('0x5b')][_0x5c9d('0x52')]({'where':{'id':_0x9fbf4d['VoiceQueueId']?_0x9fbf4d[_0x5c9d('0x58')]:_0x9fbf4d[_0x5c9d('0x59')]},'attributes':['id',_0x5c9d('0x1f')],'raw':!![]});}}})['then'](function(_0x558593){var _0x1004a1={};if(_0x558593){_[_0x5c9d('0x46')](_0x1004a1,_[_0x5c9d('0x5c')](_0x6b2aee[_0x5c9d('0x5d')],[_0x5c9d('0x5e'),_0x5c9d('0x5f'),'id']));_0x1004a1['state']=0x15;_0x1004a1[_0x5c9d('0x60')]=_0x5c9d('0x61');_0x1004a1[_0x5c9d('0x62')]=_0x558593[_0x5c9d('0x1f')];_0x1004a1[_0x5c9d('0x63')]=_0xff6338[_0x5c9d('0x64')]['name'];_0x1004a1[_0x5c9d('0x65')]=_0xff6338['user']['id'];_0x1004a1[_0x5c9d('0x61')]=!![];_0x1004a1[_0x5c9d('0x66')]=moment()[_0x5c9d('0x67')](_0x5c9d('0x68'));_0x1004a1['calleridnum']=_0x6b2aee[_0x5c9d('0x69')];_0x1004a1[_0x5c9d('0x6a')]=_0x6b2aee['VoiceQueueId']?_0x5c9d('0x6b'):_0x5c9d('0x6c');return db[_0x5c9d('0x6d')][_0x5c9d('0x52')]({'where':{'id':_0x1004a1[_0x5c9d('0x6e')]},'attributes':[_0x5c9d('0x6f'),_0x5c9d('0x70')]})[_0x5c9d('0x1b')](function(_0x260020){if(!_[_0x5c9d('0x71')](_0xc8d0c)&&!_[_0x5c9d('0x71')](_0x260020['firstName'])){_0x1004a1['calleridname']=_0x260020[_0x5c9d('0x6f')];if(!_['isNil'](_0x260020['lastName'])){_0x1004a1['calleridname']+='\x20'+_0x260020[_0x5c9d('0x70')];}}})['finally'](function(){return db['CmHopperFinal'][_0x5c9d('0x53')](_0x1004a1);});}})['then'](function(){return _0xc8d0c[_0x5c9d('0x16')](0xcc)[_0x5c9d('0x1c')]();})[_0x5c9d('0x4d')](handleError(_0xc8d0c,null));};exports[_0x5c9d('0x72')]=function(_0x105d70,_0x306e10,_0x3039a5){var _0x32b06a=[];return db['CmContact'][_0x5c9d('0x56')]()['then'](function(_0x6fec7f){_0x32b06a=_[_0x5c9d('0x29')](_0x6fec7f);return _0x105d70['user'][_0x5c9d('0x73')]({'where':{'type':_0x5c9d('0x74'),'dialActive':!![],'dialMethod':_0x5c9d('0x75')},'attributes':['id',_0x5c9d('0x76')],'raw':!![]});})[_0x5c9d('0x1b')](function(_0x106c56){if(_0x106c56&&_0x106c56[_0x5c9d('0x3e')]){return db[_0x5c9d('0x77')][_0x5c9d('0x78')](function(_0x498413){var _0x24131c={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5c9d('0x67')](_0x5c9d('0x68'))},'VoiceQueueId':{'$in':_[_0x5c9d('0x22')](_0x106c56,'id')},'$or':[{'UserId':null},{'UserId':_0x105d70[_0x5c9d('0x64')]['id']}]};var _0x4b8bbf=[];if(_0x105d70[_0x5c9d('0x54')][_0x5c9d('0x79')]&&_0x105d70[_0x5c9d('0x54')][_0x5c9d('0x79')]===_0x5c9d('0x7a')){if(!_[_0x5c9d('0x7b')](_0x105d70['body'][_0x5c9d('0x7c')])){_0x24131c['id']={'$in':_0x105d70[_0x5c9d('0x54')][_0x5c9d('0x7c')]};}_0x4b8bbf=[[_0x5c9d('0x7d'),'ASC'],['scheduledAt',_0x106c56[0x0][_0x5c9d('0x76')]===_0x5c9d('0x7e')?_0x5c9d('0x7f'):_0x5c9d('0x7e')],db['sequelize'][_0x5c9d('0x80')](_0x5c9d('0x81')),['id','DESC']];}else{if(!_[_0x5c9d('0x7b')](_0x105d70[_0x5c9d('0x54')]['hopperIds'])){_0x24131c['id']={'$notIn':_0x105d70['body']['hopperIds']};}_0x4b8bbf=[[_0x5c9d('0x7d'),'DESC'],[_0x5c9d('0x82'),_0x106c56[0x0]['dialOrderByScheduledAt']],db[_0x5c9d('0x77')][_0x5c9d('0x80')](_0x5c9d('0x83')),['id',_0x5c9d('0x7e')]];}return db[_0x5c9d('0x23')][_0x5c9d('0x84')]({'attributes':['id',_0x5c9d('0x85')],'where':_0x24131c,'order':_0x4b8bbf,'transaction':_0x498413,'lock':_0x498413[_0x5c9d('0x86')][_0x5c9d('0x87')],'include':[{'model':db[_0x5c9d('0x6d')],'as':_0x5c9d('0x88'),'attributes':_0x32b06a,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id','name']}]},{'model':db[_0x5c9d('0x89')],'as':_0x5c9d('0x8a'),'attributes':['id',_0x5c9d('0x1f')]},{'model':db[_0x5c9d('0x5a')],'as':_0x5c9d('0x8b'),'attributes':['id',_0x5c9d('0x1f'),_0x5c9d('0x8c')]}]})[_0x5c9d('0x1b')](function(_0x267fcf){if(_0x267fcf){return _0x267fcf['update']({'UserId':_0x105d70[_0x5c9d('0x64')]['id']},{'transaction':_0x498413});}});});}})[_0x5c9d('0x1b')](handleEntityNotFound(_0x306e10,null))['then'](respondWithResult(_0x306e10,null))[_0x5c9d('0x4d')](handleError(_0x306e10,null));};exports['getOpenContacts']=function(_0x538096,_0x249ef1,_0x83fd66){return _0x538096[_0x5c9d('0x64')][_0x5c9d('0x73')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x5c9d('0x75')},'attributes':['id'],'raw':!![]})[_0x5c9d('0x1b')](function(_0x3225a9){if(_0x3225a9&&_0x3225a9[_0x5c9d('0x3e')]){return db[_0x5c9d('0x23')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5c9d('0x67')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x3225a9,'id')},'$or':[{'UserId':null},{'UserId':_0x538096['user']['id']}]}});}return 0x0;})[_0x5c9d('0x1b')](function(_0x264ecd){if(!_[_0x5c9d('0x71')](_0x264ecd)&&_[_0x5c9d('0x8d')](_0x264ecd)){return _0x249ef1['status'](0xc8)[_0x5c9d('0x17')]({'contacts':_0x264ecd});}else{logger[_0x5c9d('0x1d')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x5c9d('0x8e'),0x194,'entity\x20not\x20found');_0x249ef1['sendStatus'](0x194);}})['catch'](handleError(_0x249ef1,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index c71981f..0e16703 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 _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 +var _0xe202=['define','CmHopper','scheduledat','phone','priority','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x1a0c59,_0x3b4dcc){var _0xed67c9=function(_0x247698){while(--_0x247698){_0x1a0c59['push'](_0x1a0c59['shift']());}};_0xed67c9(++_0x3b4dcc);}(_0xe202,0x147));var _0x2e20=function(_0x47c3c3,_0x5dc6a5){_0x47c3c3=_0x47c3c3-0x0;var _0x1ca8e4=_0xe202[_0x47c3c3];return _0x1ca8e4;};'use strict';var _=require(_0x2e20('0x0'));var util=require('util');var logger=require(_0x2e20('0x1'))('api');var moment=require(_0x2e20('0x2'));var BPromise=require(_0x2e20('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e20('0x4'));var rimraf=require(_0x2e20('0x5'));var config=require(_0x2e20('0x6'));var attributes=require(_0x2e20('0x7'));module[_0x2e20('0x8')]=function(_0xec053f,_0x155e5f){return _0xec053f[_0x2e20('0x9')](_0x2e20('0xa'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x2e20('0xb'),'fields':[_0x2e20('0xb')]},{'name':_0x2e20('0xc'),'fields':[_0x2e20('0xc')]},{'name':'priority','fields':[_0x2e20('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index cd1a738..26ca833 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 _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 +var _0xee8a=['stringify','error','code','CmHopper,\x20%s,\x20%s','message','result','catch','GetCmHopper','findAll','options','where','attributes','limit','include','map','model','ShowCmHopper','find','CreateCmHopper','CmHopper','body','raw','UpdateCmHopper','update','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','includes','push','UserId','all','CmHopperFinal','create','CountReScheduled','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','order','GetCmHopperPreview','lodash','moment','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x2104d2,_0xcc2a90){var _0xd3a9a7=function(_0x3837a1){while(--_0x3837a1){_0x2104d2['push'](_0x2104d2['shift']());}};_0xd3a9a7(++_0xcc2a90);}(_0xee8a,0x103));var _0xaee8=function(_0x4849f6,_0x104836){_0x4849f6=_0x4849f6-0x0;var _0x1a3dcd=_0xee8a[_0x4849f6];return _0x1a3dcd;};'use strict';var _=require(_0xaee8('0x0'));var util=require('util');var moment=require(_0xaee8('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaee8('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xaee8('0x3'))('rpc');var config=require(_0xaee8('0x4'));var jayson=require(_0xaee8('0x5'));var client=jayson[_0xaee8('0x6')][_0xaee8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x18bc5c,_0x1a5500,_0x2994c3){return new BPromise(function(_0x47c1f1,_0x12fe4c){return client[_0xaee8('0x8')](_0x18bc5c,_0x2994c3)[_0xaee8('0x9')](function(_0x50e859){logger[_0xaee8('0xa')]('CmHopper,\x20%s,\x20%s',_0x1a5500,_0xaee8('0xb'));logger[_0xaee8('0xc')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x1a5500,_0xaee8('0xb'),JSON[_0xaee8('0xd')](_0x50e859));if(_0x50e859[_0xaee8('0xe')]){if(_0x50e859[_0xaee8('0xe')][_0xaee8('0xf')]===0x1f4){logger[_0xaee8('0xe')](_0xaee8('0x10'),_0x1a5500,_0x50e859[_0xaee8('0xe')][_0xaee8('0x11')]);return _0x12fe4c(_0x50e859[_0xaee8('0xe')][_0xaee8('0x11')]);}logger[_0xaee8('0xe')](_0xaee8('0x10'),_0x1a5500,_0x50e859[_0xaee8('0xe')][_0xaee8('0x11')]);return _0x47c1f1(_0x50e859[_0xaee8('0xe')]['message']);}else{logger[_0xaee8('0xa')](_0xaee8('0x10'),_0x1a5500,_0xaee8('0xb'));_0x47c1f1(_0x50e859[_0xaee8('0x12')][_0xaee8('0x11')]);}})[_0xaee8('0x13')](function(_0x36cd07){logger['error'](_0xaee8('0x10'),_0x1a5500,_0x36cd07);_0x12fe4c(_0x36cd07);});});}exports[_0xaee8('0x14')]=function(_0xbeca26){var _0x2862d8=this;return new Promise(function(_0x187a39,_0x1e472f){return db['CmHopper'][_0xaee8('0x15')]({'raw':_0xbeca26[_0xaee8('0x16')]?_0xbeca26[_0xaee8('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xbeca26[_0xaee8('0x16')]?_0xbeca26[_0xaee8('0x16')][_0xaee8('0x17')]||null:null,'attributes':_0xbeca26[_0xaee8('0x16')]?_0xbeca26['options'][_0xaee8('0x18')]||null:null,'limit':_0xbeca26[_0xaee8('0x16')]?_0xbeca26[_0xaee8('0x16')][_0xaee8('0x19')]||null:null,'include':_0xbeca26[_0xaee8('0x16')]?_0xbeca26[_0xaee8('0x16')][_0xaee8('0x1a')]?_[_0xaee8('0x1b')](_0xbeca26[_0xaee8('0x16')][_0xaee8('0x1a')],function(_0x1029b5){return{'model':db[_0x1029b5[_0xaee8('0x1c')]],'as':_0x1029b5['as'],'attributes':_0x1029b5['attributes'],'include':_0x1029b5[_0xaee8('0x1a')]?_['map'](_0x1029b5[_0xaee8('0x1a')],function(_0x18fdac){return{'model':db[_0x18fdac[_0xaee8('0x1c')]],'as':_0x18fdac['as'],'attributes':_0x18fdac[_0xaee8('0x18')],'include':_0x18fdac['include']?_[_0xaee8('0x1b')](_0x18fdac[_0xaee8('0x1a')],function(_0x46ae64){return{'model':db[_0x46ae64[_0xaee8('0x1c')]],'as':_0x46ae64['as'],'attributes':_0x46ae64['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x260a33){logger[_0xaee8('0xa')]('GetCmHopper',_0xbeca26);logger['debug']('GetCmHopper',_0xbeca26,JSON[_0xaee8('0xd')](_0x260a33));_0x187a39(_0x260a33);})[_0xaee8('0x13')](function(_0x4f4e8d){logger[_0xaee8('0xe')](_0xaee8('0x14'),_0x4f4e8d[_0xaee8('0x11')],_0xbeca26);_0x1e472f(_0x2862d8[_0xaee8('0xe')](0x1f4,_0x4f4e8d[_0xaee8('0x11')]));});});};exports[_0xaee8('0x1d')]=function(_0x5d7397){var _0x1660b3=this;return new Promise(function(_0x59785d,_0x13e9c2){return db['CmHopper'][_0xaee8('0x1e')]({'raw':_0x5d7397[_0xaee8('0x16')]?_0x5d7397['options']['raw']===undefined?!![]:![]:!![],'where':_0x5d7397['options']?_0x5d7397['options']['where']||null:null,'attributes':_0x5d7397[_0xaee8('0x16')]?_0x5d7397['options'][_0xaee8('0x18')]||null:null,'include':_0x5d7397[_0xaee8('0x16')]?_0x5d7397['options'][_0xaee8('0x1a')]?_['map'](_0x5d7397[_0xaee8('0x16')]['include'],function(_0xa4e2d3){return{'model':db[_0xa4e2d3['model']],'as':_0xa4e2d3['as'],'attributes':_0xa4e2d3['attributes'],'include':_0xa4e2d3[_0xaee8('0x1a')]?_[_0xaee8('0x1b')](_0xa4e2d3[_0xaee8('0x1a')],function(_0x58c791){return{'model':db[_0x58c791['model']],'as':_0x58c791['as'],'attributes':_0x58c791['attributes'],'include':_0x58c791[_0xaee8('0x1a')]?_[_0xaee8('0x1b')](_0x58c791[_0xaee8('0x1a')],function(_0x320da2){return{'model':db[_0x320da2[_0xaee8('0x1c')]],'as':_0x320da2['as'],'attributes':_0x320da2[_0xaee8('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x924cf8){logger[_0xaee8('0xa')](_0xaee8('0x1d'),_0x5d7397);logger[_0xaee8('0xc')]('ShowCmHopper',_0x5d7397,JSON['stringify'](_0x924cf8));_0x59785d(_0x924cf8);})[_0xaee8('0x13')](function(_0x27925a){logger[_0xaee8('0xe')]('ShowCmHopper',_0x27925a[_0xaee8('0x11')],_0x5d7397);_0x13e9c2(_0x1660b3[_0xaee8('0xe')](0x1f4,_0x27925a[_0xaee8('0x11')]));});});};exports[_0xaee8('0x1f')]=function(_0x4f00eb){var _0x42e664=this;return new Promise(function(_0x53230a,_0x48a573){return db[_0xaee8('0x20')]['create'](_0x4f00eb[_0xaee8('0x21')],{'raw':_0x4f00eb[_0xaee8('0x16')]?_0x4f00eb['options'][_0xaee8('0x22')]===undefined?!![]:![]:!![]})[_0xaee8('0x9')](function(_0x234bcc){logger[_0xaee8('0xa')](_0xaee8('0x1f'),_0x4f00eb);logger['debug'](_0xaee8('0x1f'),_0x4f00eb,JSON[_0xaee8('0xd')](_0x234bcc));_0x53230a(_0x234bcc);})[_0xaee8('0x13')](function(_0x1bc55f){logger[_0xaee8('0xe')](_0xaee8('0x1f'),_0x1bc55f[_0xaee8('0x11')],_0x4f00eb);_0x48a573(_0x42e664[_0xaee8('0xe')](0x1f4,_0x1bc55f[_0xaee8('0x11')]));});});};exports[_0xaee8('0x23')]=function(_0x464d54){var _0x504ced=this;return new Promise(function(_0x4bf4a2,_0x36fd19){return db['CmHopper'][_0xaee8('0x24')](_0x464d54[_0xaee8('0x21')],{'raw':_0x464d54['options']?_0x464d54[_0xaee8('0x16')][_0xaee8('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x464d54[_0xaee8('0x16')]?_0x464d54[_0xaee8('0x16')]['where']||null:null,'attributes':_0x464d54[_0xaee8('0x16')]?_0x464d54['options'][_0xaee8('0x18')]||null:null,'limit':_0x464d54[_0xaee8('0x16')]?_0x464d54[_0xaee8('0x16')][_0xaee8('0x19')]||null:null})[_0xaee8('0x9')](function(_0x20f357){logger[_0xaee8('0xa')](_0xaee8('0x23'),_0x464d54);logger[_0xaee8('0xc')]('UpdateCmHopper',_0x464d54,JSON[_0xaee8('0xd')](_0x20f357));_0x4bf4a2(_0x20f357);})[_0xaee8('0x13')](function(_0x3c017d){logger[_0xaee8('0xe')](_0xaee8('0x23'),_0x3c017d[_0xaee8('0x11')],_0x464d54);_0x36fd19(_0x504ced[_0xaee8('0xe')](0x1f4,_0x3c017d[_0xaee8('0x11')]));});});};exports[_0xaee8('0x25')]=function(_0x3ab42c){var _0x53ae71=this;return new Promise(function(_0x549c75,_0x500dcb){return db[_0xaee8('0x20')][_0xaee8('0x26')]({'where':_0x3ab42c[_0xaee8('0x16')]?_0x3ab42c[_0xaee8('0x16')]['where']||null:null})['then'](function(_0x19df2a){logger[_0xaee8('0xa')](_0xaee8('0x25'),_0x3ab42c);logger[_0xaee8('0xc')](_0xaee8('0x25'),_0x3ab42c,JSON[_0xaee8('0xd')](_0x19df2a));_0x549c75(_0x19df2a);})['catch'](function(_0x1ca6d1){logger[_0xaee8('0xe')](_0xaee8('0x25'),_0x1ca6d1[_0xaee8('0x11')],_0x3ab42c);_0x500dcb(_0x53ae71['error'](0x1f4,_0x1ca6d1[_0xaee8('0x11')]));});});};exports[_0xaee8('0x27')]=function(_0x3be72e){var _0xbad69b=this;return new Promise(function(_0xb9b7d0,_0x1171d0){return db[_0xaee8('0x28')][_0xaee8('0x29')]()['then'](function(_0x4e593b){return db[_0xaee8('0x2a')][_0xaee8('0x2b')](function(_0x4fa158){return db[_0xaee8('0x20')][_0xaee8('0x15')]({'where':_0x3be72e[_0xaee8('0x16')]?_0x3be72e[_0xaee8('0x16')][_0xaee8('0x17')]||null:null,'attributes':_0x3be72e[_0xaee8('0x16')]?_0x3be72e[_0xaee8('0x16')]['attributes']||null:null,'limit':_0x3be72e[_0xaee8('0x16')]?_0x3be72e[_0xaee8('0x16')][_0xaee8('0x19')]||null:null,'order':_0x3be72e[_0xaee8('0x16')]?_0x3be72e['options']['order']||null:null,'transaction':_0x4fa158,'lock':_0x4fa158[_0xaee8('0x2c')][_0xaee8('0x2d')],'include':[{'model':db['CmContact'],'as':_0xaee8('0x2e'),'attributes':_[_0xaee8('0x2f')](_0x4e593b)},{'model':db[_0xaee8('0x30')],'as':_0xaee8('0x31'),'attributes':['id',_0xaee8('0x32'),_0xaee8('0x33')]}]})['then'](function(_0x2bfb20){var _0x4d3e2e=[];var _0x14995a=[];for(var _0x323ea5=0x0;_0x323ea5<_0x2bfb20[_0xaee8('0x34')];_0x323ea5+=0x1){if(!_0x14995a[_0xaee8('0x35')](_0x2bfb20[_0x323ea5]['UserId'])){_0x14995a[_0xaee8('0x36')](_0x2bfb20[_0x323ea5][_0xaee8('0x37')]);_0x4d3e2e[_0xaee8('0x36')](_0x2bfb20[_0x323ea5][_0xaee8('0x24')](_0x3be72e[_0xaee8('0x21')],{'transaction':_0x4fa158}));}}return BPromise[_0xaee8('0x38')](_0x4d3e2e);});})['then'](function(_0x4b2647){logger[_0xaee8('0xa')](_0xaee8('0x27'),_0x3be72e);logger[_0xaee8('0xc')](_0xaee8('0x27'),_0x3be72e,JSON[_0xaee8('0xd')](_0x4b2647));_0xb9b7d0(_0x4b2647);})[_0xaee8('0x13')](function(_0x1c1953){logger[_0xaee8('0xe')](_0xaee8('0x27'),_0x1c1953[_0xaee8('0x11')],_0x3be72e);_0x1171d0(_0xbad69b[_0xaee8('0xe')](0x1f4,_0x1c1953[_0xaee8('0x11')]));});});});};exports['MoveContactManagedDialer']=function(_0x4de8b3){var _0x4ccd61=this;return new Promise(function(_0xf8162,_0xb46638){return db[_0xaee8('0x2a')]['transaction'](function(_0x2a731c){return db[_0xaee8('0x39')][_0xaee8('0x3a')](_0x4de8b3[_0xaee8('0x21')],{'raw':_0x4de8b3[_0xaee8('0x16')]?_0x4de8b3[_0xaee8('0x16')][_0xaee8('0x22')]===undefined?!![]:![]:!![],'transaction':_0x2a731c})[_0xaee8('0x9')](function(){return db[_0xaee8('0x20')][_0xaee8('0x26')]({'where':_0x4de8b3[_0xaee8('0x16')]?_0x4de8b3[_0xaee8('0x16')]['where']||null:null,'transaction':_0x2a731c});});})[_0xaee8('0x9')](function(_0x89857c){logger[_0xaee8('0xa')]('MoveContactManagedDialer',_0x4de8b3);logger['debug']('MoveContactManagedDialer',_0x4de8b3,JSON[_0xaee8('0xd')](_0x89857c));_0xf8162(_0x89857c);})[_0xaee8('0x13')](function(_0x20c038){logger[_0xaee8('0xe')]('MoveContactManagedDialer',_0x20c038['message'],_0x4de8b3);_0xb46638(_0x4ccd61[_0xaee8('0xe')](0x1f4,_0x20c038['message']));});});};exports[_0xaee8('0x3b')]=function(_0x555d5e){var _0xc822e6=this;return new Promise(function(_0x3f6562,_0x360001){return db[_0xaee8('0x20')]['findAll']({'raw':_0x555d5e[_0xaee8('0x16')]?_0x555d5e[_0xaee8('0x16')][_0xaee8('0x22')]===undefined?!![]:![]:!![],'where':_0x555d5e[_0xaee8('0x16')]?_0x555d5e[_0xaee8('0x16')][_0xaee8('0x17')]||null:null,'attributes':[[db[_0xaee8('0x2a')]['fn']('COUNT',db[_0xaee8('0x2a')]['fn']('IF',db[_0xaee8('0x2a')]['literal']('`scheduledat`\x20>=\x20'+util[_0xaee8('0x3c')](_0xaee8('0x3d'),moment()[_0xaee8('0x3c')](_0xaee8('0x3e')))+_0xaee8('0x3f')))),_0xaee8('0x40')]]})[_0xaee8('0x9')](function(_0x5dc68b){logger[_0xaee8('0xa')](_0xaee8('0x3b'),_0x555d5e);logger[_0xaee8('0xc')]('CountReScheduled',_0x555d5e,JSON[_0xaee8('0xd')](_0x5dc68b));_0x3f6562(_0x5dc68b);})[_0xaee8('0x13')](function(_0x80881f){logger['error'](_0xaee8('0x3b'),_0x80881f[_0xaee8('0x11')],_0x555d5e);_0x360001(_0xc822e6['error'](0x1f4,_0x80881f[_0xaee8('0x11')]));});});};exports[_0xaee8('0x41')]=function(_0x2f33de){var _0x4a174e=this;return new Promise(function(_0x23e700,_0x1fd495){return db[_0xaee8('0x28')]['describe']()[_0xaee8('0x9')](function(_0x5c066b){return db[_0xaee8('0x2a')]['transaction'](function(_0x4c9ab0){return db['CmHopper']['findAll']({'where':_0x2f33de[_0xaee8('0x16')]?_0x2f33de[_0xaee8('0x16')]['where']||null:null,'attributes':_0x2f33de[_0xaee8('0x16')]?_0x2f33de[_0xaee8('0x16')]['attributes']||null:null,'limit':0x1,'order':_0x2f33de[_0xaee8('0x16')]?_0x2f33de[_0xaee8('0x16')][_0xaee8('0x42')]||null:null,'group':db[_0xaee8('0x20')][_0xaee8('0x37')],'transaction':_0x4c9ab0,'lock':_0x4c9ab0[_0xaee8('0x2c')][_0xaee8('0x2d')],'include':_0x2f33de[_0xaee8('0x16')]?_0x2f33de['options'][_0xaee8('0x1a')]?_[_0xaee8('0x1b')](_0x2f33de[_0xaee8('0x16')][_0xaee8('0x1a')],function(_0x32bfd5){return{'model':db[_0x32bfd5[_0xaee8('0x1c')]],'as':_0x32bfd5['as'],'attributes':_0x32bfd5[_0xaee8('0x18')],'include':_0x32bfd5[_0xaee8('0x1a')]?_['map'](_0x32bfd5[_0xaee8('0x1a')],function(_0x1b245c){return{'model':db[_0x1b245c['model']],'as':_0x1b245c['as'],'attributes':_0x1b245c[_0xaee8('0x18')],'include':_0x1b245c['include']?_[_0xaee8('0x1b')](_0x1b245c[_0xaee8('0x1a')],function(_0xc1200a){return{'model':db[_0xc1200a[_0xaee8('0x1c')]],'as':_0xc1200a['as'],'attributes':_0xc1200a[_0xaee8('0x18')]};}):[]};}):[]};}):[]:[]})[_0xaee8('0x9')](function(_0x3e5059){var _0x22af79=[];for(var _0xb03f4e=0x0;_0xb03f4e<_0x3e5059['length'];_0xb03f4e+=0x1){_0x22af79['push'](_0x3e5059[_0xb03f4e]['update'](_0x2f33de[_0xaee8('0x21')],{'transaction':_0x4c9ab0}));}return BPromise['all'](_0x22af79);});})['then'](function(_0x412ebc){logger[_0xaee8('0xa')](_0xaee8('0x41'),_0x2f33de);logger['debug'](_0xaee8('0x41'),_0x2f33de,JSON[_0xaee8('0xd')](_0x412ebc));_0x23e700(_0x412ebc);})[_0xaee8('0x13')](function(_0x36811a){logger['error'](_0xaee8('0x41'),_0x36811a[_0xaee8('0x11')],_0x2f33de);_0x1fd495(_0x4a174e[_0xaee8('0xe')](0x1f4,_0x36811a['message']));});});});};exports[_0xaee8('0x43')]=function(_0x292976){var _0x336222=this;return new Promise(function(_0x8d7e46,_0x547868){db[_0xaee8('0x28')][_0xaee8('0x29')]()[_0xaee8('0x9')](function(_0x37cd94){return db[_0xaee8('0x20')]['findAll']({'raw':_0x292976[_0xaee8('0x16')]?_0x292976[_0xaee8('0x16')][_0xaee8('0x22')]===undefined?!![]:![]:!![],'where':_0x292976['options']?_0x292976[_0xaee8('0x16')]['where']||null:null,'attributes':_0x292976[_0xaee8('0x16')]?_0x292976[_0xaee8('0x16')][_0xaee8('0x18')]||null:null,'limit':_0x292976['options']?_0x292976[_0xaee8('0x16')][_0xaee8('0x19')]||null:null,'include':_0x292976[_0xaee8('0x16')]?_0x292976[_0xaee8('0x16')][_0xaee8('0x1a')]?_[_0xaee8('0x1b')](_0x292976[_0xaee8('0x16')][_0xaee8('0x1a')],function(_0x422189){return{'model':db[_0x422189['model']],'as':_0x422189['as'],'attributes':_0x422189['as']===_0xaee8('0x2e')?_[_0xaee8('0x2f')](_0x37cd94):_0x422189[_0xaee8('0x18')],'include':_0x422189['include']?_[_0xaee8('0x1b')](_0x422189[_0xaee8('0x1a')],function(_0x3b4ef3){return{'model':db[_0x3b4ef3['model']],'as':_0x3b4ef3['as'],'attributes':_0x3b4ef3['attributes'],'include':_0x3b4ef3['include']?_[_0xaee8('0x1b')](_0x3b4ef3['include'],function(_0x11ec85){return{'model':db[_0x11ec85['model']],'as':_0x11ec85['as'],'attributes':_0x11ec85[_0xaee8('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56da10){logger[_0xaee8('0xa')](_0xaee8('0x14'),_0x292976);logger[_0xaee8('0xc')]('GetCmHopper',_0x292976,JSON['stringify'](_0x56da10));_0x8d7e46(_0x56da10);})[_0xaee8('0x13')](function(_0x78ceae){logger['error'](_0xaee8('0x14'),_0x78ceae[_0xaee8('0x11')],_0x292976);_0x547868(_0x336222[_0xaee8('0xe')](0x1f4,_0x78ceae[_0xaee8('0x11')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 0d81881..b1a9599 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 _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 +var _0x30c7=['multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','index','get','isAuthenticated','describe','getOpenContacts','/:id','show','post','create','getPreview','put','update','delete','destroy','exports'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x30c7,0x111));var _0x730c=function(_0x4154c7,_0x2ae804){_0x4154c7=_0x4154c7-0x0;var _0xad1a71=_0x30c7[_0x4154c7];return _0xad1a71;};'use strict';var multer=require(_0x730c('0x0'));var util=require('util');var path=require(_0x730c('0x1'));var timeout=require(_0x730c('0x2'));var express=require(_0x730c('0x3'));var router=express['Router']();var auth=require(_0x730c('0x4'));var interaction=require(_0x730c('0x5'));var config=require('../../config/environment');var controller=require('./cmHopper.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x730c('0x6')]);router[_0x730c('0x7')]('/describe',auth[_0x730c('0x8')](),controller[_0x730c('0x9')]);router[_0x730c('0x7')]('/opencontacts',auth[_0x730c('0x8')](),controller[_0x730c('0xa')]);router['get'](_0x730c('0xb'),auth[_0x730c('0x8')](),controller[_0x730c('0xc')]);router[_0x730c('0xd')]('/',auth[_0x730c('0x8')](),controller[_0x730c('0xe')]);router[_0x730c('0xd')]('/preview',auth[_0x730c('0x8')](),controller[_0x730c('0xf')]);router[_0x730c('0x10')](_0x730c('0xb'),auth['isAuthenticated'](),controller[_0x730c('0x11')]);router[_0x730c('0x12')](_0x730c('0xb'),auth[_0x730c('0x8')](),controller[_0x730c('0x13')]);module[_0x730c('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 370766c..ffeb0bf 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 _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 +var _0x22e5=['sequelize','exports','INTEGER','contactListQueue','moment'];(function(_0x38c3c8,_0x25a7c5){var _0x256252=function(_0x282b1d){while(--_0x282b1d){_0x38c3c8['push'](_0x38c3c8['shift']());}};_0x256252(++_0x25a7c5);}(_0x22e5,0x185));var _0x522e=function(_0x145e2c,_0x3128e9){_0x145e2c=_0x145e2c-0x0;var _0x3bbd82=_0x22e5[_0x145e2c];return _0x3bbd82;};'use strict';var moment=require(_0x522e('0x0'));var Sequelize=require(_0x522e('0x1'));module[_0x522e('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x522e('0x3')],'unique':_0x522e('0x4')},'ListId':{'type':Sequelize[_0x522e('0x3')],'unique':_0x522e('0x4')},'VoiceQueueId':{'type':Sequelize[_0x522e('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 4f57220..242f911 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(_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 +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(_0x4ed802,_0x5c66a2){var _0x390c99=function(_0x24683d){while(--_0x24683d){_0x4ed802['push'](_0x4ed802['shift']());}};_0x390c99(++_0x5c66a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 c65903f..dc3c49c 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 _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 +var _0x5f66=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','lodash','util','../../config/logger','api'];(function(_0x4528cf,_0x3b1892){var _0x4bca53=function(_0x47d77b){while(--_0x47d77b){_0x4528cf['push'](_0x4528cf['shift']());}};_0x4bca53(++_0x3b1892);}(_0x5f66,0xc0));var _0x65f6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5f66[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x65f6('0x0'));var util=require(_0x65f6('0x1'));var logger=require(_0x65f6('0x2'))(_0x65f6('0x3'));var moment=require(_0x65f6('0x4'));var BPromise=require(_0x65f6('0x5'));var rp=require(_0x65f6('0x6'));var fs=require('fs');var path=require(_0x65f6('0x7'));var rimraf=require(_0x65f6('0x8'));var config=require(_0x65f6('0x9'));var attributes=require(_0x65f6('0xa'));module[_0x65f6('0xb')]=function(_0x1347d0,_0x4c634c){return _0x1347d0[_0x65f6('0xc')](_0x65f6('0xd'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 5c76201..af74793 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 _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 +var _0xec70=['then','GetCmHopperBlack','stringify','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x163b12,_0x140f0b){var _0x44118f=function(_0x588744){while(--_0x588744){_0x163b12['push'](_0x163b12['shift']());}};_0x44118f(++_0x140f0b);}(_0xec70,0xf2));var _0x0ec7=function(_0x4812dd,_0x38e4db){_0x4812dd=_0x4812dd-0x0;var _0x5bade8=_0xec70[_0x4812dd];return _0x5bade8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0ec7('0x0'));var BPromise=require(_0x0ec7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ec7('0x2'));var db=require(_0x0ec7('0x3'))['db'];var utils=require(_0x0ec7('0x4'));var logger=require(_0x0ec7('0x5'))(_0x0ec7('0x6'));var config=require(_0x0ec7('0x7'));var jayson=require(_0x0ec7('0x8'));var client=jayson[_0x0ec7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d69ad,_0x54aa1b,_0xdf5c75){return new BPromise(function(_0x562531,_0x549b38){return client[_0x0ec7('0xa')](_0x2d69ad,_0xdf5c75)['then'](function(_0x1676c6){logger['info'](_0x0ec7('0xb'),_0x54aa1b,_0x0ec7('0xc'));logger[_0x0ec7('0xd')](_0x0ec7('0xe'),_0x54aa1b,_0x0ec7('0xc'),JSON['stringify'](_0x1676c6));if(_0x1676c6[_0x0ec7('0xf')]){if(_0x1676c6[_0x0ec7('0xf')][_0x0ec7('0x10')]===0x1f4){logger[_0x0ec7('0xf')](_0x0ec7('0xb'),_0x54aa1b,_0x1676c6[_0x0ec7('0xf')][_0x0ec7('0x11')]);return _0x549b38(_0x1676c6[_0x0ec7('0xf')][_0x0ec7('0x11')]);}logger['error'](_0x0ec7('0xb'),_0x54aa1b,_0x1676c6['error'][_0x0ec7('0x11')]);return _0x562531(_0x1676c6[_0x0ec7('0xf')][_0x0ec7('0x11')]);}else{logger[_0x0ec7('0x12')](_0x0ec7('0xb'),_0x54aa1b,'request\x20sent');_0x562531(_0x1676c6[_0x0ec7('0x13')]['message']);}})[_0x0ec7('0x14')](function(_0x44d0c4){logger[_0x0ec7('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x54aa1b,_0x44d0c4);_0x549b38(_0x44d0c4);});});}exports['GetCmHopperBlack']=function(_0x2df137){var _0x39930b=this;return new Promise(function(_0x176917,_0x4a9540){return db[_0x0ec7('0x15')][_0x0ec7('0x16')]({'raw':_0x2df137[_0x0ec7('0x17')]?_0x2df137['options'][_0x0ec7('0x18')]===undefined?!![]:![]:!![],'where':_0x2df137[_0x0ec7('0x17')]?_0x2df137[_0x0ec7('0x17')][_0x0ec7('0x19')]||null:null,'attributes':_0x2df137[_0x0ec7('0x17')]?_0x2df137[_0x0ec7('0x17')][_0x0ec7('0x1a')]||null:null,'limit':_0x2df137[_0x0ec7('0x17')]?_0x2df137[_0x0ec7('0x17')][_0x0ec7('0x1b')]||null:null,'include':_0x2df137[_0x0ec7('0x17')]?_0x2df137['options']['include']?_['map'](_0x2df137[_0x0ec7('0x17')]['include'],function(_0x4a5778){return{'model':db[_0x4a5778['model']],'as':_0x4a5778['as'],'attributes':_0x4a5778[_0x0ec7('0x1a')],'include':_0x4a5778[_0x0ec7('0x1c')]?_[_0x0ec7('0x1d')](_0x4a5778['include'],function(_0x2cf151){return{'model':db[_0x2cf151[_0x0ec7('0x1e')]],'as':_0x2cf151['as'],'attributes':_0x2cf151[_0x0ec7('0x1a')],'include':_0x2cf151[_0x0ec7('0x1c')]?_['map'](_0x2cf151[_0x0ec7('0x1c')],function(_0x18698b){return{'model':db[_0x18698b[_0x0ec7('0x1e')]],'as':_0x18698b['as'],'attributes':_0x18698b[_0x0ec7('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0ec7('0x1f')](function(_0x322ad7){logger['info'](_0x0ec7('0x20'),_0x2df137);logger[_0x0ec7('0xd')](_0x0ec7('0x20'),_0x2df137,JSON[_0x0ec7('0x21')](_0x322ad7));_0x176917(_0x322ad7);})[_0x0ec7('0x14')](function(_0x400bae){logger[_0x0ec7('0xf')]('GetCmHopperBlack',_0x400bae[_0x0ec7('0x11')],_0x2df137);_0x4a9540(_0x39930b[_0x0ec7('0xf')](0x1f4,_0x400bae[_0x0ec7('0x11')]));});});};exports[_0x0ec7('0x22')]=function(_0x4077a7){var _0x205244=this;return new Promise(function(_0x4ba97e,_0x2108a7){return db[_0x0ec7('0x15')][_0x0ec7('0x23')](_0x4077a7[_0x0ec7('0x24')],{'raw':_0x4077a7[_0x0ec7('0x17')]?_0x4077a7[_0x0ec7('0x17')][_0x0ec7('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4077a7[_0x0ec7('0x17')]?_0x4077a7['options'][_0x0ec7('0x19')]||null:null,'attributes':_0x4077a7[_0x0ec7('0x17')]?_0x4077a7[_0x0ec7('0x17')]['attributes']||null:null,'limit':_0x4077a7[_0x0ec7('0x17')]?_0x4077a7['options'][_0x0ec7('0x1b')]||null:null})['then'](function(_0x40a160){logger['info']('UpdateCmHopperBlack',_0x4077a7);logger[_0x0ec7('0xd')](_0x0ec7('0x22'),_0x4077a7,JSON['stringify'](_0x40a160));_0x4ba97e(_0x40a160);})[_0x0ec7('0x14')](function(_0x1505fd){logger['error'](_0x0ec7('0x22'),_0x1505fd[_0x0ec7('0x11')],_0x4077a7);_0x2108a7(_0x205244[_0x0ec7('0xf')](0x1f4,_0x1505fd[_0x0ec7('0x11')]));});});};exports[_0x0ec7('0x25')]=function(_0x286a5b){var _0x42583b=this;return new Promise(function(_0x14bd46,_0x401ccf){return db['CmHopperBlack'][_0x0ec7('0x26')]({'where':_0x286a5b[_0x0ec7('0x17')]?_0x286a5b[_0x0ec7('0x17')][_0x0ec7('0x19')]||null:null})[_0x0ec7('0x1f')](function(_0xd8efc5){logger[_0x0ec7('0x12')]('DestroyCmHopperBlack',_0x286a5b);logger[_0x0ec7('0xd')](_0x0ec7('0x25'),_0x286a5b,JSON[_0x0ec7('0x21')](_0xd8efc5));_0x14bd46(_0xd8efc5);})[_0x0ec7('0x14')](function(_0x116edf){logger['error'](_0x0ec7('0x25'),_0x116edf[_0x0ec7('0x11')],_0x286a5b);_0x401ccf(_0x42583b[_0x0ec7('0xf')](0x1f4,_0x116edf[_0x0ec7('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 061baf8..03e65d4 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 _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 +var _0xda55=['../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service'];(function(_0x34cad9,_0x3fa757){var _0x2f8aa4=function(_0x364bc8){while(--_0x364bc8){_0x34cad9['push'](_0x34cad9['shift']());}};_0x2f8aa4(++_0x3fa757);}(_0xda55,0x6d));var _0x5da5=function(_0x34049b,_0x2a5f1b){_0x34049b=_0x34049b-0x0;var _0x3a82e9=_0xda55[_0x34049b];return _0x3a82e9;};'use strict';var multer=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5da5('0x2'));var router=express[_0x5da5('0x3')]();var auth=require(_0x5da5('0x4'));var interaction=require(_0x5da5('0x5'));var config=require(_0x5da5('0x6'));var controller=require('./cmHopperBlack.controller');router[_0x5da5('0x7')]('/',auth['isAuthenticated'](),controller[_0x5da5('0x8')]);router['get'](_0x5da5('0x9'),auth[_0x5da5('0xa')](),controller[_0x5da5('0xb')]);router[_0x5da5('0x7')](_0x5da5('0xc'),auth[_0x5da5('0xa')](),controller[_0x5da5('0xd')]);router[_0x5da5('0xe')]('/:id',auth[_0x5da5('0xa')](),controller[_0x5da5('0xf')]);router[_0x5da5('0x10')](_0x5da5('0xc'),auth[_0x5da5('0xa')](),controller[_0x5da5('0x11')]);module[_0x5da5('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index b5897a8..6c8a6ea 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 _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 +var _0xc6af=['getDataValue','endtime','setDataValue','followuptime','diff','BOOLEAN','moment','INTEGER','DATE','STRING'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0xc6af,0x1d2));var _0xfc6a=function(_0xcdcb27,_0x25af6f){_0xcdcb27=_0xcdcb27-0x0;var _0x214445=_0xc6af[_0xcdcb27];return _0x214445;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xfc6a('0x0'));module['exports']={'state':{'type':Sequelize[_0xfc6a('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xfc6a('0x2')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xfc6a('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfc6a('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xfc6a('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xfc6a('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xfc6a('0x3')]},'originatecalleridname':{'type':Sequelize[_0xfc6a('0x3')]},'calleridnum':{'type':Sequelize[_0xfc6a('0x3')]},'calleridname':{'type':Sequelize[_0xfc6a('0x3')]},'starttime':{'type':Sequelize[_0xfc6a('0x2')]},'responsetime':{'type':Sequelize[_0xfc6a('0x2')]},'answertime':{'type':Sequelize[_0xfc6a('0x2')]},'droptime':{'type':Sequelize[_0xfc6a('0x2')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xfc6a('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xfc6a('0x3')]},'campaign':{'type':Sequelize[_0xfc6a('0x3')]},'campaigntype':{'type':Sequelize[_0xfc6a('0x3')]},'membername':{'type':Sequelize[_0xfc6a('0x3')]},'reason':{'type':Sequelize[_0xfc6a('0x3')]},'disposition':{'type':Sequelize[_0xfc6a('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x463c41){var _0x32ac52=this[_0xfc6a('0x4')](_0xfc6a('0x5'));if(_0x32ac52&&_0x463c41){this[_0xfc6a('0x6')](_0xfc6a('0x7'),moment(_0x463c41)[_0xfc6a('0x8')](moment(_0x32ac52),'seconds'));}return this[_0xfc6a('0x6')]('dispositionat',_0x463c41);}},'amd':{'type':Sequelize[_0xfc6a('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0xfc6a('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xfc6a('0x2')]},'callback':{'type':Sequelize[_0xfc6a('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xfc6a('0x2')]},'deleted':{'type':Sequelize[_0xfc6a('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xfc6a('0x2')]},'recallme':{'type':Sequelize[_0xfc6a('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xfc6a('0x2')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xfc6a('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xfc6a('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 9dbcacb..8eb9b53 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 _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 +var _0x8b52=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','describe','update','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','phone','from','cm_hopper','select','calleridnum','state\x20=\x204','Campaign','CampaignId','CampaignId\x20=\x20?','checkContactHopper','findOne','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','count','offset','limit','set','save','then','end','sendStatus','stack','name','send','map','CmHopperFinal','rawAttributes','fieldName','key','model','query'];(function(_0x4b1508,_0x3ec884){var _0x4e8f0b=function(_0x1a9c6f){while(--_0x1a9c6f){_0x4b1508['push'](_0x4b1508['shift']());}};_0x4e8f0b(++_0x3ec884);}(_0x8b52,0x151));var _0x28b5=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x8b52[_0x2d7f0e];return _0x110b07;};'use strict';var pdf=require(_0x28b5('0x0'));var emlformat=require(_0x28b5('0x1'));var rimraf=require(_0x28b5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x28b5('0x3'));var rp=require(_0x28b5('0x4'));var moment=require('moment');var BPromise=require(_0x28b5('0x5'));var Mustache=require(_0x28b5('0x6'));var util=require(_0x28b5('0x7'));var path=require(_0x28b5('0x8'));var sox=require(_0x28b5('0x9'));var csv=require(_0x28b5('0xa'));var ejs=require(_0x28b5('0xb'));var fs=require('fs');var _=require(_0x28b5('0xc'));var squel=require(_0x28b5('0xd'));var crypto=require('crypto');var jsforce=require(_0x28b5('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x28b5('0xf'));var Papa=require(_0x28b5('0x10'));var Redis=require('ioredis');var authService=require(_0x28b5('0x11'));var qs=require(_0x28b5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x28b5('0x13'));var logger=require(_0x28b5('0x14'))(_0x28b5('0x15'));var utils=require(_0x28b5('0x16'));var config=require('../../config/environment');var db=require(_0x28b5('0x17'))['db'];function respondWithStatusCode(_0x5ef09b,_0xc18108){_0xc18108=_0xc18108||0xcc;return function(_0x3bd9f3){if(_0x3bd9f3){return _0x5ef09b['sendStatus'](_0xc18108);}return _0x5ef09b[_0x28b5('0x18')](_0xc18108)['end']();};}function respondWithResult(_0x26d895,_0x4a684e){_0x4a684e=_0x4a684e||0xc8;return function(_0x58f350){if(_0x58f350){return _0x26d895[_0x28b5('0x18')](_0x4a684e)[_0x28b5('0x19')](_0x58f350);}};}function respondWithFilteredResult(_0x590ef6,_0x2c17c7){return function(_0x26213c){if(_0x26213c){var _0x1e4a10=_0x26213c[_0x28b5('0x1a')],_0x16c115=_0x2c17c7['offset'],_0x39ae7f=_0x2c17c7[_0x28b5('0x1b')]+_0x2c17c7[_0x28b5('0x1c')],_0x593561;if(_0x39ae7f>=_0x1e4a10){_0x39ae7f=_0x1e4a10;_0x593561=0xc8;}else{_0x593561=0xce;}_0x590ef6[_0x28b5('0x18')](_0x593561);return _0x590ef6[_0x28b5('0x1d')]('Content-Range',_0x16c115+'-'+_0x39ae7f+'/'+_0x1e4a10)[_0x28b5('0x19')](_0x26213c);}return null;};}function patchUpdates(_0x1396cf){return function(_0x3a8059){try{jsonpatch['apply'](_0x3a8059,_0x1396cf,!![]);}catch(_0x1ddaf2){return BPromise['reject'](_0x1ddaf2);}return _0x3a8059[_0x28b5('0x1e')]();};}function saveUpdates(_0x20e18c,_0x2c4cae){return function(_0x386494){if(_0x386494){return _0x386494['update'](_0x20e18c)[_0x28b5('0x1f')](function(_0x3658dc){return _0x3658dc;});}return null;};}function removeEntity(_0x16e3ec,_0x32c819){return function(_0x5c453a){if(_0x5c453a){return _0x5c453a['destroy']()['then'](function(){_0x16e3ec[_0x28b5('0x18')](0xcc)[_0x28b5('0x20')]();});}};}function handleEntityNotFound(_0x395feb,_0x740562){return function(_0x8fa4b9){if(!_0x8fa4b9){_0x395feb[_0x28b5('0x21')](0x194);}return _0x8fa4b9;};}function handleError(_0x488374,_0x4b1673){_0x4b1673=_0x4b1673||0x1f4;return function(_0x32f15d){logger['error'](_0x32f15d[_0x28b5('0x22')]);if(_0x32f15d[_0x28b5('0x23')]){delete _0x32f15d[_0x28b5('0x23')];}_0x488374[_0x28b5('0x18')](_0x4b1673)[_0x28b5('0x24')](_0x32f15d);};}exports['index']=function(_0x47e031,_0x30348a){var _0x41784a={},_0x12c721={},_0xb109dd={'count':0x0,'rows':[]};var _0x291811=_[_0x28b5('0x25')](db[_0x28b5('0x26')][_0x28b5('0x27')],function(_0x139524){return{'name':_0x139524[_0x28b5('0x28')],'type':_0x139524['type'][_0x28b5('0x29')]};});_0x12c721[_0x28b5('0x2a')]=_['map'](_0x291811,_0x28b5('0x23'));_0x12c721[_0x28b5('0x2b')]=_[_0x28b5('0x2c')](_0x47e031[_0x28b5('0x2b')]);_0x12c721[_0x28b5('0x2d')]=_[_0x28b5('0x2e')](_0x12c721[_0x28b5('0x2a')],_0x12c721['query']);_0x41784a[_0x28b5('0x2f')]=_['intersection'](_0x12c721[_0x28b5('0x2a')],qs[_0x28b5('0x30')](_0x47e031[_0x28b5('0x2b')][_0x28b5('0x30')]));_0x41784a[_0x28b5('0x2f')]=_0x41784a[_0x28b5('0x2f')][_0x28b5('0x31')]?_0x41784a[_0x28b5('0x2f')]:_0x12c721[_0x28b5('0x2a')];if(!_0x47e031[_0x28b5('0x2b')][_0x28b5('0x32')](_0x28b5('0x33'))){_0x41784a[_0x28b5('0x1c')]=qs[_0x28b5('0x1c')](_0x47e031[_0x28b5('0x2b')][_0x28b5('0x1c')]);_0x41784a['offset']=qs[_0x28b5('0x1b')](_0x47e031['query'][_0x28b5('0x1b')]);}_0x41784a[_0x28b5('0x34')]=qs[_0x28b5('0x35')](_0x47e031[_0x28b5('0x2b')]['sort']);_0x41784a[_0x28b5('0x36')]=qs[_0x28b5('0x2d')](_[_0x28b5('0x37')](_0x47e031['query'],_0x12c721['filters']),_0x291811);if(_0x47e031[_0x28b5('0x2b')][_0x28b5('0x38')]){_0x41784a[_0x28b5('0x36')]=_[_0x28b5('0x39')](_0x41784a['where'],{'$or':_[_0x28b5('0x25')](_0x291811,function(_0x388339){if(_0x388339[_0x28b5('0x3a')]!==_0x28b5('0x3b')){var _0x46421f={};_0x46421f[_0x388339[_0x28b5('0x23')]]={'$like':'%'+_0x47e031[_0x28b5('0x2b')][_0x28b5('0x38')]+'%'};return _0x46421f;}})});}_0x41784a=_['merge']({},_0x41784a,_0x47e031[_0x28b5('0x3c')]);var _0x360671={'where':_0x41784a['where']};return db[_0x28b5('0x26')]['count'](_0x360671)[_0x28b5('0x1f')](function(_0x2a20c9){_0xb109dd[_0x28b5('0x1a')]=_0x2a20c9;if(_0x47e031['query'][_0x28b5('0x3d')]){_0x41784a[_0x28b5('0x3e')]=[{'all':!![]}];}return db[_0x28b5('0x26')][_0x28b5('0x3f')](_0x41784a);})[_0x28b5('0x1f')](function(_0x11d429){_0xb109dd['rows']=_0x11d429;return _0xb109dd;})[_0x28b5('0x1f')](respondWithFilteredResult(_0x30348a,_0x41784a))[_0x28b5('0x40')](handleError(_0x30348a,null));};exports[_0x28b5('0x41')]=function(_0x3b068f,_0x3d3a7f){var _0x5c237f={'raw':!![],'where':{'id':_0x3b068f[_0x28b5('0x42')]['id']}},_0x108a49={};_0x108a49[_0x28b5('0x2a')]=_[_0x28b5('0x2c')](db[_0x28b5('0x26')]['rawAttributes']);_0x108a49[_0x28b5('0x2b')]=_[_0x28b5('0x2c')](_0x3b068f[_0x28b5('0x2b')]);_0x108a49[_0x28b5('0x2d')]=_[_0x28b5('0x2e')](_0x108a49[_0x28b5('0x2a')],_0x108a49['query']);_0x5c237f['attributes']=_[_0x28b5('0x2e')](_0x108a49[_0x28b5('0x2a')],qs[_0x28b5('0x30')](_0x3b068f[_0x28b5('0x2b')][_0x28b5('0x30')]));_0x5c237f['attributes']=_0x5c237f[_0x28b5('0x2f')]['length']?_0x5c237f[_0x28b5('0x2f')]:_0x108a49[_0x28b5('0x2a')];if(_0x3b068f[_0x28b5('0x2b')][_0x28b5('0x3d')]){_0x5c237f[_0x28b5('0x3e')]=[{'all':!![]}];}_0x5c237f=_[_0x28b5('0x39')]({},_0x5c237f,_0x3b068f[_0x28b5('0x3c')]);return db['CmHopperFinal'][_0x28b5('0x43')](_0x5c237f)[_0x28b5('0x1f')](handleEntityNotFound(_0x3d3a7f,null))[_0x28b5('0x1f')](respondWithResult(_0x3d3a7f,null))[_0x28b5('0x40')](handleError(_0x3d3a7f,null));};exports[_0x28b5('0x44')]=function(_0x5a24f1,_0x370aa6){return db[_0x28b5('0x26')][_0x28b5('0x44')]()['then'](respondWithResult(_0x370aa6,null))[_0x28b5('0x40')](handleError(_0x370aa6,null));};exports[_0x28b5('0x45')]=function(_0xe46b0a,_0x141f9a){if(_0xe46b0a['body'][_0x28b5('0x46')]){delete _0xe46b0a[_0x28b5('0x47')][_0x28b5('0x46')];}return db[_0x28b5('0x26')][_0x28b5('0x43')]({'where':{'uniqueid':_0xe46b0a[_0x28b5('0x42')]['id']}})[_0x28b5('0x1f')](handleEntityNotFound(_0x141f9a,null))[_0x28b5('0x1f')](saveUpdates(_0xe46b0a[_0x28b5('0x47')],null))[_0x28b5('0x1f')](respondWithResult(_0x141f9a,null))[_0x28b5('0x40')](handleError(_0x141f9a,null));};exports[_0x28b5('0x48')]=function(_0x97dfe5,_0x319a0f,_0x5ebe01){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x97dfe5[_0x28b5('0x42')]['id']},'attributes':[[db[_0x28b5('0x49')]['fn']('COUNT',db[_0x28b5('0x49')]['fn']('IF',db[_0x28b5('0x49')]['literal'](_0x28b5('0x4a')))),_0x28b5('0x4b')],[db[_0x28b5('0x49')]['fn'](_0x28b5('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x28b5('0x4d')](_0x28b5('0x4e')))),_0x28b5('0x4f')],[db[_0x28b5('0x49')]['fn'](_0x28b5('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x28b5('0x4d')](_0x28b5('0x50')))),'busyContacts'],[db[_0x28b5('0x49')]['fn'](_0x28b5('0x4c'),db[_0x28b5('0x49')]['fn']('IF',db[_0x28b5('0x49')]['literal'](_0x28b5('0x51')))),_0x28b5('0x52')],[db['sequelize']['fn'](_0x28b5('0x4c'),db[_0x28b5('0x49')]['fn']('IF',db[_0x28b5('0x49')][_0x28b5('0x4d')](_0x28b5('0x53')))),_0x28b5('0x54')],[db[_0x28b5('0x49')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x28b5('0x49')]['literal'](_0x28b5('0x55')))),_0x28b5('0x56')],[db[_0x28b5('0x49')]['fn'](_0x28b5('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x28b5('0x4d')](_0x28b5('0x57')))),'reCallContacts'],[db[_0x28b5('0x49')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x28b5('0x49')][_0x28b5('0x4d')](_0x28b5('0x58')))),_0x28b5('0x59')]]})['then'](handleEntityNotFound(_0x319a0f,null))[_0x28b5('0x1f')](respondWithResult(_0x319a0f,null))[_0x28b5('0x40')](handleError(_0x319a0f,null));};exports[_0x28b5('0x5a')]=function(_0x5e81aa,_0x3ca81c,_0x86aeb8){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x5e81aa['params']['id']},'attributes':[[db[_0x28b5('0x49')]['fn']('COUNT',db[_0x28b5('0x49')]['fn']('IF',db[_0x28b5('0x49')][_0x28b5('0x4d')](_0x28b5('0x4a')))),_0x28b5('0x4b')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x28b5('0x49')][_0x28b5('0x4d')](_0x28b5('0x4e')))),'noAnswerContacts'],[db[_0x28b5('0x49')]['fn'](_0x28b5('0x4c'),db[_0x28b5('0x49')]['fn']('IF',db['sequelize'][_0x28b5('0x4d')](_0x28b5('0x50')))),'busyContacts'],[db['sequelize']['fn'](_0x28b5('0x4c'),db[_0x28b5('0x49')]['fn']('IF',db[_0x28b5('0x49')]['literal'](_0x28b5('0x51')))),_0x28b5('0x52')],[db['sequelize']['fn']('COUNT',db[_0x28b5('0x49')]['fn']('IF',db[_0x28b5('0x49')][_0x28b5('0x4d')](_0x28b5('0x53')))),_0x28b5('0x54')],[db[_0x28b5('0x49')]['fn'](_0x28b5('0x4c'),db[_0x28b5('0x49')]['fn']('IF',db[_0x28b5('0x49')][_0x28b5('0x4d')](_0x28b5('0x55')))),_0x28b5('0x56')],[db[_0x28b5('0x49')]['fn'](_0x28b5('0x4c'),db[_0x28b5('0x49')]['fn']('IF',db[_0x28b5('0x49')][_0x28b5('0x4d')](_0x28b5('0x57')))),_0x28b5('0x5b')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x28b5('0x49')][_0x28b5('0x4d')](_0x28b5('0x58')))),_0x28b5('0x59')]]})[_0x28b5('0x1f')](handleEntityNotFound(_0x3ca81c,null))['then'](respondWithResult(_0x3ca81c,null))[_0x28b5('0x40')](handleError(_0x3ca81c,null));};exports[_0x28b5('0x5c')]=function(_0x26d9be,_0x42c12d,_0x5c70b5){return db[_0x28b5('0x5d')][_0x28b5('0x43')]({'where':{'id':_0x26d9be[_0x28b5('0x42')]['id']}})[_0x28b5('0x1f')](handleEntityNotFound(_0x42c12d,null))[_0x28b5('0x1f')](function(_0x50e97a){var _0x19cab5;if(_0x50e97a){_0x19cab5=squel[_0x28b5('0x5e')]()[_0x28b5('0x5f')]('cm_hopper')[_0x28b5('0x60')](['phone',_0x28b5('0x61'),_0x28b5('0x62'),_0x28b5('0x63'),_0x28b5('0x64'),_0x28b5('0x65'),_0x28b5('0x66')],squel['select']()[_0x28b5('0x67')](_0x28b5('0x68'),'phone')[_0x28b5('0x67')](_0x28b5('0x69'),_0x28b5('0x61'))[_0x28b5('0x67')](_0x28b5('0x6a'),_0x28b5('0x62'))[_0x28b5('0x67')](_0x28b5('0x6b'),'ListId')[_0x28b5('0x67')](_0x28b5('0x6c'),_0x28b5('0x64'))[_0x28b5('0x67')](_0x28b5('0x69'),_0x28b5('0x65'))[_0x28b5('0x67')]('NOW()','updatedAt')['from'](_0x28b5('0x6d'))[_0x28b5('0x36')](_0x28b5('0x6e'),_0x26d9be['params']['id'][_0x28b5('0x6f')]())[_0x28b5('0x36')](_0x28b5('0x70'),_0x26d9be['body'][_0x28b5('0x71')][_0x28b5('0x6f')]())['where'](_0x28b5('0x72'))[_0x28b5('0x36')](_0x28b5('0x73'),squel['select']()['field'](_0x28b5('0x74'))[_0x28b5('0x75')](_0x28b5('0x76'))[_0x28b5('0x36')](_0x28b5('0x6e'),_0x26d9be['params']['id'][_0x28b5('0x6f')]()))[_0x28b5('0x36')](_0x28b5('0x73'),squel[_0x28b5('0x77')]()[_0x28b5('0x67')](_0x28b5('0x78'))[_0x28b5('0x75')](_0x28b5('0x6d'))['where'](_0x28b5('0x6e'),_0x26d9be['params']['id'][_0x28b5('0x6f')]())[_0x28b5('0x36')](_0x28b5('0x79')))['group']('ContactId'))[_0x28b5('0x6f')]();return db['sequelize'][_0x28b5('0x2b')](_0x19cab5);}return[];})[_0x28b5('0x1f')](respondWithResult(_0x42c12d,null))[_0x28b5('0x40')](handleError(_0x42c12d,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1a5267,_0x15ed43,_0x7ba15){return db[_0x28b5('0x7a')]['find']({'where':{'id':_0x1a5267[_0x28b5('0x42')]['id']}})[_0x28b5('0x1f')](handleEntityNotFound(_0x15ed43,null))[_0x28b5('0x1f')](function(_0x5588b5){var _0x137e0d;if(_0x5588b5){_0x137e0d=squel[_0x28b5('0x5e')]()[_0x28b5('0x5f')](_0x28b5('0x76'))[_0x28b5('0x60')]([_0x28b5('0x74'),_0x28b5('0x61'),_0x28b5('0x62'),_0x28b5('0x63'),_0x28b5('0x7b'),_0x28b5('0x65'),_0x28b5('0x66')],squel[_0x28b5('0x77')]()[_0x28b5('0x67')]('ANY_VALUE(calleridnum)',_0x28b5('0x74'))['field'](_0x28b5('0x69'),_0x28b5('0x61'))['field']('ANY_VALUE(ContactId)','ContactId')[_0x28b5('0x67')](_0x28b5('0x6b'),_0x28b5('0x63'))[_0x28b5('0x67')]('ANY_VALUE(CampaignId)','CampaignId')[_0x28b5('0x67')](_0x28b5('0x69'),_0x28b5('0x65'))['field'](_0x28b5('0x69'),_0x28b5('0x66'))[_0x28b5('0x75')](_0x28b5('0x6d'))['where'](_0x28b5('0x7c'),_0x1a5267['params']['id']['toString']())[_0x28b5('0x36')](_0x28b5('0x70'),_0x1a5267[_0x28b5('0x47')]['state'][_0x28b5('0x6f')]())['where'](_0x28b5('0x72'))[_0x28b5('0x36')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x28b5('0x67')]('phone')[_0x28b5('0x75')](_0x28b5('0x76'))[_0x28b5('0x36')](_0x28b5('0x7c'),_0x1a5267[_0x28b5('0x42')]['id'][_0x28b5('0x6f')]()))[_0x28b5('0x36')](_0x28b5('0x73'),squel[_0x28b5('0x77')]()[_0x28b5('0x67')](_0x28b5('0x78'))[_0x28b5('0x75')](_0x28b5('0x6d'))[_0x28b5('0x36')](_0x28b5('0x7c'),_0x1a5267['params']['id']['toString']())[_0x28b5('0x36')](_0x28b5('0x79')))['group']('ContactId'))['toString']();return db[_0x28b5('0x49')][_0x28b5('0x2b')](_0x137e0d);}return[];})[_0x28b5('0x1f')](respondWithResult(_0x15ed43,null))[_0x28b5('0x40')](handleError(_0x15ed43,null));};exports[_0x28b5('0x7d')]=function(_0x2d5c84,_0x32c312,_0x4c65e5){return db['CmHopper'][_0x28b5('0x7e')]({'where':{'VoiceQueueId':_0x2d5c84[_0x28b5('0x47')][_0x28b5('0x64')],'CampaignId':_0x2d5c84['body'][_0x28b5('0x7b')],'ContactId':_0x2d5c84['body'][_0x28b5('0x62')]}})[_0x28b5('0x1f')](handleEntityNotFound(_0x32c312,null))[_0x28b5('0x1f')](function(_0x3c2613){if(_0x3c2613){return _0x3c2613;}return null;})[_0x28b5('0x1f')](respondWithResult(_0x32c312,null))['catch'](handleError(_0x32c312,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index b1999dd..05f71fb 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 _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 +var _0x1fd8=['define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports'];(function(_0x5a9846,_0xac81db){var _0x4c7b9d=function(_0x3eea6a){while(--_0x3eea6a){_0x5a9846['push'](_0x5a9846['shift']());}};_0x4c7b9d(++_0xac81db);}(_0x1fd8,0xa5));var _0x81fd=function(_0x3eff93,_0x17d9b2){_0x3eff93=_0x3eff93-0x0;var _0x28bd82=_0x1fd8[_0x3eff93];return _0x28bd82;};'use strict';var _=require(_0x81fd('0x0'));var util=require(_0x81fd('0x1'));var logger=require(_0x81fd('0x2'))('api');var moment=require(_0x81fd('0x3'));var BPromise=require(_0x81fd('0x4'));var rp=require(_0x81fd('0x5'));var fs=require('fs');var path=require(_0x81fd('0x6'));var rimraf=require(_0x81fd('0x7'));var config=require(_0x81fd('0x8'));var attributes=require(_0x81fd('0x9'));module[_0x81fd('0xa')]=function(_0x2803ac,_0x13dd4e){return _0x2803ac[_0x81fd('0xb')](_0x81fd('0xc'),attributes,{'tableName':_0x81fd('0xd'),'paranoid':![],'indexes':[{'name':_0x81fd('0xe'),'fields':['calleridnum']},{'name':_0x81fd('0xf'),'fields':[_0x81fd('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index a7acce0..a2e6938 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 _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 +var _0x2d8d=['info','request\x20sent','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','message','CmHopperFinal,\x20%s,\x20%s','result','catch','CmHopperFinal','create','options','raw','then','CreateCmHopperFinal','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x2bfb6e,_0xff43a6){var _0x2b4bba=function(_0x34c5d1){while(--_0x34c5d1){_0x2bfb6e['push'](_0x2bfb6e['shift']());}};_0x2b4bba(++_0xff43a6);}(_0x2d8d,0x154));var _0xd2d8=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0x2d8d[_0x30cd7e];return _0x462a02;};'use strict';var _=require(_0xd2d8('0x0'));var util=require(_0xd2d8('0x1'));var moment=require(_0xd2d8('0x2'));var BPromise=require(_0xd2d8('0x3'));var rs=require(_0xd2d8('0x4'));var fs=require('fs');var Redis=require(_0xd2d8('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd2d8('0x6'))(_0xd2d8('0x7'));var config=require('../../config/environment');var jayson=require(_0xd2d8('0x8'));var client=jayson[_0xd2d8('0x9')][_0xd2d8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x256863,_0x3c8971,_0x561afc){return new BPromise(function(_0x44d189,_0x4de791){return client['request'](_0x256863,_0x561afc)['then'](function(_0x3aa0e1){logger[_0xd2d8('0xb')]('CmHopperFinal,\x20%s,\x20%s',_0x3c8971,_0xd2d8('0xc'));logger['debug'](_0xd2d8('0xd'),_0x3c8971,_0xd2d8('0xc'),JSON[_0xd2d8('0xe')](_0x3aa0e1));if(_0x3aa0e1['error']){if(_0x3aa0e1['error']['code']===0x1f4){logger[_0xd2d8('0xf')]('CmHopperFinal,\x20%s,\x20%s',_0x3c8971,_0x3aa0e1[_0xd2d8('0xf')][_0xd2d8('0x10')]);return _0x4de791(_0x3aa0e1['error'][_0xd2d8('0x10')]);}logger[_0xd2d8('0xf')]('CmHopperFinal,\x20%s,\x20%s',_0x3c8971,_0x3aa0e1[_0xd2d8('0xf')]['message']);return _0x44d189(_0x3aa0e1['error'][_0xd2d8('0x10')]);}else{logger[_0xd2d8('0xb')](_0xd2d8('0x11'),_0x3c8971,_0xd2d8('0xc'));_0x44d189(_0x3aa0e1[_0xd2d8('0x12')][_0xd2d8('0x10')]);}})[_0xd2d8('0x13')](function(_0x145373){logger[_0xd2d8('0xf')](_0xd2d8('0x11'),_0x3c8971,_0x145373);_0x4de791(_0x145373);});});}exports['CreateCmHopperFinal']=function(_0x3e2181){var _0xff938e=this;return new Promise(function(_0x28f2e7,_0x2f8503){return db[_0xd2d8('0x14')][_0xd2d8('0x15')](_0x3e2181['body'],{'raw':_0x3e2181[_0xd2d8('0x16')]?_0x3e2181['options'][_0xd2d8('0x17')]===undefined?!![]:![]:!![]})[_0xd2d8('0x18')](function(_0x344a1c){logger['info'](_0xd2d8('0x19'),_0x3e2181);logger[_0xd2d8('0x1a')]('CreateCmHopperFinal',_0x3e2181,JSON[_0xd2d8('0xe')](_0x344a1c));_0x28f2e7(_0x344a1c);})[_0xd2d8('0x13')](function(_0x2dc047){logger['error'](_0xd2d8('0x19'),_0x2dc047[_0xd2d8('0x10')],_0x3e2181);_0x2f8503(_0xff938e[_0xd2d8('0xf')](0x1f4,_0x2dc047[_0xd2d8('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 338d50a..03ef32b 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 _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 +var _0xad02=['express','Router','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','path'];(function(_0x210d7f,_0x2abe4f){var _0x42d687=function(_0x46b2ae){while(--_0x46b2ae){_0x210d7f['push'](_0x210d7f['shift']());}};_0x42d687(++_0x2abe4f);}(_0xad02,0xef));var _0x2ad0=function(_0x2db667,_0x193cf5){_0x2db667=_0x2db667-0x0;var _0x83ff9=_0xad02[_0x2db667];return _0x83ff9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2ad0('0x0'));var timeout=require('connect-timeout');var express=require(_0x2ad0('0x1'));var router=express[_0x2ad0('0x2')]();var auth=require(_0x2ad0('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2ad0('0x4'));var controller=require(_0x2ad0('0x5'));router[_0x2ad0('0x6')]('/',auth[_0x2ad0('0x7')](),controller[_0x2ad0('0x8')]);router[_0x2ad0('0x6')](_0x2ad0('0x9'),auth[_0x2ad0('0x7')](),controller['describe']);router[_0x2ad0('0x6')](_0x2ad0('0xa'),auth[_0x2ad0('0x7')](),controller[_0x2ad0('0xb')]);router[_0x2ad0('0x6')](_0x2ad0('0xc'),auth[_0x2ad0('0x7')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x2ad0('0x6')](_0x2ad0('0xd'),auth[_0x2ad0('0x7')](),controller[_0x2ad0('0xe')]);router[_0x2ad0('0xf')]('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller[_0x2ad0('0x10')]);router['post']('/voice/campaign/moveContacts/:id',auth[_0x2ad0('0x7')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x2ad0('0xf')](_0x2ad0('0x11'),auth[_0x2ad0('0x7')](),controller[_0x2ad0('0x12')]);router['put'](_0x2ad0('0xa'),auth['isAuthenticated'](),controller[_0x2ad0('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index f3d0da6..49c2f99 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 _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 +var _0xa18c=['STRING','INTEGER','DATE','BOOLEAN','sequelize','exports'];(function(_0x417bde,_0x9f389e){var _0xd29a29=function(_0x1f54f0){while(--_0x1f54f0){_0x417bde['push'](_0x417bde['shift']());}};_0xd29a29(++_0x9f389e);}(_0xa18c,0x160));var _0xca18=function(_0x5dff13,_0x4391ad){_0x5dff13=_0x5dff13-0x0;var _0x50998d=_0xa18c[_0x5dff13];return _0x50998d;};'use strict';var Sequelize=require(_0xca18('0x0'));module[_0xca18('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xca18('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xca18('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xca18('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xca18('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xca18('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xca18('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xca18('0x2')]},'originatecalleridname':{'type':Sequelize[_0xca18('0x2')]},'calleridnum':{'type':Sequelize[_0xca18('0x2')]},'calleridname':{'type':Sequelize[_0xca18('0x2')]},'starttime':{'type':Sequelize[_0xca18('0x4')]},'responsetime':{'type':Sequelize[_0xca18('0x4')]},'answertime':{'type':Sequelize[_0xca18('0x4')]},'droptime':{'type':Sequelize[_0xca18('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xca18('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xca18('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xca18('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xca18('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xca18('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xca18('0x2')]},'membername':{'type':Sequelize[_0xca18('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xca18('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xca18('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xca18('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xca18('0x4')]},'recallme':{'type':Sequelize[_0xca18('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xca18('0x4')]},'edited':{'type':Sequelize[_0xca18('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xca18('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xca18('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xca18('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xca18('0x3')],'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 6ec70a7..b1e0b0d 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 _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 +var _0x2a7a=['reject','then','stack','name','send','index','map','CmHopperHistory','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','find','catch','create','body','describe','uniqueid','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','offset','limit','set','json','apply'];(function(_0x2605dc,_0x50cf7e){var _0x4568c9=function(_0x447f7c){while(--_0x447f7c){_0x2605dc['push'](_0x2605dc['shift']());}};_0x4568c9(++_0x50cf7e);}(_0x2a7a,0x6b));var _0xa2a7=function(_0x186850,_0x522266){_0x186850=_0x186850-0x0;var _0x50ef0e=_0x2a7a[_0x186850];return _0x50ef0e;};'use strict';var pdf=require(_0xa2a7('0x0'));var emlformat=require(_0xa2a7('0x1'));var rimraf=require(_0xa2a7('0x2'));var zipdir=require(_0xa2a7('0x3'));var jsonpatch=require(_0xa2a7('0x4'));var rp=require(_0xa2a7('0x5'));var moment=require(_0xa2a7('0x6'));var BPromise=require(_0xa2a7('0x7'));var Mustache=require('mustache');var util=require(_0xa2a7('0x8'));var path=require(_0xa2a7('0x9'));var sox=require('sox');var csv=require(_0xa2a7('0xa'));var ejs=require(_0xa2a7('0xb'));var fs=require('fs');var _=require(_0xa2a7('0xc'));var squel=require('squel');var crypto=require(_0xa2a7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa2a7('0xe'));var toCsv=require(_0xa2a7('0xa'));var querystring=require(_0xa2a7('0xf'));var Papa=require(_0xa2a7('0x10'));var Redis=require(_0xa2a7('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa2a7('0x12'));var hardwareService=require(_0xa2a7('0x13'));var logger=require(_0xa2a7('0x14'))(_0xa2a7('0x15'));var utils=require('../../config/utils');var config=require(_0xa2a7('0x16'));var db=require(_0xa2a7('0x17'))['db'];function respondWithStatusCode(_0x2da610,_0x21ce79){_0x21ce79=_0x21ce79||0xcc;return function(_0x5e3601){if(_0x5e3601){return _0x2da610['sendStatus'](_0x21ce79);}return _0x2da610[_0xa2a7('0x18')](_0x21ce79)[_0xa2a7('0x19')]();};}function respondWithResult(_0x32a74e,_0x11bbe4){_0x11bbe4=_0x11bbe4||0xc8;return function(_0x522c4f){if(_0x522c4f){return _0x32a74e[_0xa2a7('0x18')](_0x11bbe4)['json'](_0x522c4f);}};}function respondWithFilteredResult(_0x2ff3a7,_0x5acd31){return function(_0xf145dd){if(_0xf145dd){var _0x269ba4=_0xf145dd['count'],_0x3e9ddb=_0x5acd31['offset'],_0x8659ff=_0x5acd31[_0xa2a7('0x1a')]+_0x5acd31[_0xa2a7('0x1b')],_0x2a4aa3;if(_0x8659ff>=_0x269ba4){_0x8659ff=_0x269ba4;_0x2a4aa3=0xc8;}else{_0x2a4aa3=0xce;}_0x2ff3a7[_0xa2a7('0x18')](_0x2a4aa3);return _0x2ff3a7[_0xa2a7('0x1c')]('Content-Range',_0x3e9ddb+'-'+_0x8659ff+'/'+_0x269ba4)[_0xa2a7('0x1d')](_0xf145dd);}return null;};}function patchUpdates(_0x174dc5){return function(_0x37079a){try{jsonpatch[_0xa2a7('0x1e')](_0x37079a,_0x174dc5,!![]);}catch(_0x8bf5f5){return BPromise[_0xa2a7('0x1f')](_0x8bf5f5);}return _0x37079a['save']();};}function saveUpdates(_0xe91f1e,_0x30c37a){return function(_0x10c7b2){if(_0x10c7b2){return _0x10c7b2['update'](_0xe91f1e)[_0xa2a7('0x20')](function(_0x97da06){return _0x97da06;});}return null;};}function removeEntity(_0x248ce7,_0x17916d){return function(_0x3d5133){if(_0x3d5133){return _0x3d5133['destroy']()[_0xa2a7('0x20')](function(){_0x248ce7['status'](0xcc)[_0xa2a7('0x19')]();});}};}function handleEntityNotFound(_0x107ff8,_0x34ae56){return function(_0x2ea125){if(!_0x2ea125){_0x107ff8['sendStatus'](0x194);}return _0x2ea125;};}function handleError(_0x4a4de1,_0x22c05d){_0x22c05d=_0x22c05d||0x1f4;return function(_0x20be62){logger['error'](_0x20be62[_0xa2a7('0x21')]);if(_0x20be62[_0xa2a7('0x22')]){delete _0x20be62[_0xa2a7('0x22')];}_0x4a4de1[_0xa2a7('0x18')](_0x22c05d)[_0xa2a7('0x23')](_0x20be62);};}exports[_0xa2a7('0x24')]=function(_0x53b055,_0x13a1f0){var _0x448a83={},_0x1c10e6={},_0x294318={'count':0x0,'rows':[]};var _0x4585d2=_[_0xa2a7('0x25')](db[_0xa2a7('0x26')][_0xa2a7('0x27')],function(_0x2f57cd){return{'name':_0x2f57cd['fieldName'],'type':_0x2f57cd[_0xa2a7('0x28')][_0xa2a7('0x29')]};});_0x1c10e6['model']=_[_0xa2a7('0x25')](_0x4585d2,_0xa2a7('0x22'));_0x1c10e6[_0xa2a7('0x2a')]=_[_0xa2a7('0x2b')](_0x53b055[_0xa2a7('0x2a')]);_0x1c10e6[_0xa2a7('0x2c')]=_[_0xa2a7('0x2d')](_0x1c10e6[_0xa2a7('0x2e')],_0x1c10e6[_0xa2a7('0x2a')]);_0x448a83[_0xa2a7('0x2f')]=_[_0xa2a7('0x2d')](_0x1c10e6['model'],qs[_0xa2a7('0x30')](_0x53b055['query']['fields']));_0x448a83[_0xa2a7('0x2f')]=_0x448a83[_0xa2a7('0x2f')][_0xa2a7('0x31')]?_0x448a83[_0xa2a7('0x2f')]:_0x1c10e6[_0xa2a7('0x2e')];if(!_0x53b055[_0xa2a7('0x2a')][_0xa2a7('0x32')]('nolimit')){_0x448a83['limit']=qs[_0xa2a7('0x1b')](_0x53b055[_0xa2a7('0x2a')][_0xa2a7('0x1b')]);_0x448a83[_0xa2a7('0x1a')]=qs[_0xa2a7('0x1a')](_0x53b055[_0xa2a7('0x2a')][_0xa2a7('0x1a')]);}_0x448a83['order']=qs[_0xa2a7('0x33')](_0x53b055[_0xa2a7('0x2a')][_0xa2a7('0x33')]);_0x448a83[_0xa2a7('0x34')]=qs[_0xa2a7('0x2c')](_[_0xa2a7('0x35')](_0x53b055[_0xa2a7('0x2a')],_0x1c10e6[_0xa2a7('0x2c')]),_0x4585d2);if(_0x53b055[_0xa2a7('0x2a')][_0xa2a7('0x36')]){_0x448a83[_0xa2a7('0x34')]=_[_0xa2a7('0x37')](_0x448a83[_0xa2a7('0x34')],{'$or':_[_0xa2a7('0x25')](_0x4585d2,function(_0x16eb44){if(_0x16eb44['type']!==_0xa2a7('0x38')){var _0xf3ad7c={};_0xf3ad7c[_0x16eb44[_0xa2a7('0x22')]]={'$like':'%'+_0x53b055[_0xa2a7('0x2a')][_0xa2a7('0x36')]+'%'};return _0xf3ad7c;}})});}_0x448a83=_[_0xa2a7('0x37')]({},_0x448a83,_0x53b055[_0xa2a7('0x39')]);var _0x3d557b={'where':_0x448a83['where']};return db[_0xa2a7('0x26')][_0xa2a7('0x3a')](_0x3d557b)[_0xa2a7('0x20')](function(_0x3ea967){_0x294318[_0xa2a7('0x3a')]=_0x3ea967;if(_0x53b055[_0xa2a7('0x2a')][_0xa2a7('0x3b')]){_0x448a83[_0xa2a7('0x3c')]=[{'all':!![]}];}return db[_0xa2a7('0x26')][_0xa2a7('0x3d')](_0x448a83);})['then'](function(_0x5c8e37){_0x294318['rows']=_0x5c8e37;return _0x294318;})[_0xa2a7('0x20')](respondWithFilteredResult(_0x13a1f0,_0x448a83))['catch'](handleError(_0x13a1f0,null));};exports['show']=function(_0x337266,_0x58f762){var _0x3766c6={'raw':!![],'where':{'id':_0x337266['params']['id']}},_0x5c8dd9={};_0x5c8dd9[_0xa2a7('0x2e')]=_['keys'](db[_0xa2a7('0x26')][_0xa2a7('0x27')]);_0x5c8dd9[_0xa2a7('0x2a')]=_[_0xa2a7('0x2b')](_0x337266[_0xa2a7('0x2a')]);_0x5c8dd9[_0xa2a7('0x2c')]=_['intersection'](_0x5c8dd9[_0xa2a7('0x2e')],_0x5c8dd9['query']);_0x3766c6[_0xa2a7('0x2f')]=_['intersection'](_0x5c8dd9['model'],qs['fields'](_0x337266[_0xa2a7('0x2a')][_0xa2a7('0x30')]));_0x3766c6[_0xa2a7('0x2f')]=_0x3766c6[_0xa2a7('0x2f')][_0xa2a7('0x31')]?_0x3766c6[_0xa2a7('0x2f')]:_0x5c8dd9[_0xa2a7('0x2e')];if(_0x337266[_0xa2a7('0x2a')][_0xa2a7('0x3b')]){_0x3766c6[_0xa2a7('0x3c')]=[{'all':!![]}];}_0x3766c6=_[_0xa2a7('0x37')]({},_0x3766c6,_0x337266['options']);return db['CmHopperHistory'][_0xa2a7('0x3e')](_0x3766c6)['then'](handleEntityNotFound(_0x58f762,null))['then'](respondWithResult(_0x58f762,null))[_0xa2a7('0x3f')](handleError(_0x58f762,null));};exports[_0xa2a7('0x40')]=function(_0x210a91,_0x500672){return db['CmHopperHistory'][_0xa2a7('0x40')](_0x210a91[_0xa2a7('0x41')],{})[_0xa2a7('0x20')](respondWithResult(_0x500672,0xc9))[_0xa2a7('0x3f')](handleError(_0x500672,null));};exports[_0xa2a7('0x42')]=function(_0x9a67c6,_0x16524e){return db[_0xa2a7('0x26')]['describe']()['then'](respondWithResult(_0x16524e,null))[_0xa2a7('0x3f')](handleError(_0x16524e,null));};exports['update']=function(_0x782eea,_0x22749d){if(_0x782eea[_0xa2a7('0x41')][_0xa2a7('0x43')]){delete _0x782eea[_0xa2a7('0x41')][_0xa2a7('0x43')];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x782eea[_0xa2a7('0x44')]['id']}})['then'](handleEntityNotFound(_0x22749d,null))[_0xa2a7('0x20')](saveUpdates(_0x782eea['body'],null))[_0xa2a7('0x20')](respondWithResult(_0x22749d,null))['catch'](handleError(_0x22749d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index acd8b8d..b58a305 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 _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 +var _0xacc2=['CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','moment','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xacc2,0xb8));var _0x2acc=function(_0x4a1d79,_0x2fdf58){_0x4a1d79=_0x4a1d79-0x0;var _0x71b353=_0xacc2[_0x4a1d79];return _0x71b353;};'use strict';var _=require(_0x2acc('0x0'));var util=require(_0x2acc('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2acc('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2acc('0x3'));var rimraf=require(_0x2acc('0x4'));var config=require(_0x2acc('0x5'));var attributes=require(_0x2acc('0x6'));module[_0x2acc('0x7')]=function(_0x195d3f,_0x2f4d64){return _0x195d3f['define'](_0x2acc('0x8'),attributes,{'tableName':_0x2acc('0x9'),'paranoid':![],'indexes':[{'name':_0x2acc('0xa'),'fields':['endtime']},{'name':_0x2acc('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 0995a07..2685581 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 _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 +var _0x7916=['body','options','raw','sequelize','COUNT','col','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','AvgHandleTime','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','findAll','ivrAnswerCallsDay','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','create'];(function(_0x380016,_0x178dd6){var _0x5c7ac0=function(_0xa8ddca){while(--_0xa8ddca){_0x380016['push'](_0x380016['shift']());}};_0x5c7ac0(++_0x178dd6);}(_0x7916,0x128));var _0x6791=function(_0x3d23e4,_0x164466){_0x3d23e4=_0x3d23e4-0x0;var _0x1aedd6=_0x7916[_0x3d23e4];return _0x1aedd6;};'use strict';var _=require(_0x6791('0x0'));var util=require('util');var moment=require(_0x6791('0x1'));var BPromise=require(_0x6791('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6791('0x3'));var db=require(_0x6791('0x4'))['db'];var utils=require(_0x6791('0x5'));var logger=require(_0x6791('0x6'))('rpc');var config=require(_0x6791('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6791('0x8')][_0x6791('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ad8c0,_0x8b85ff,_0x5d2118){return new BPromise(function(_0x2b240c,_0x50c563){return client['request'](_0x5ad8c0,_0x5d2118)[_0x6791('0xa')](function(_0x198a64){logger['info'](_0x6791('0xb'),_0x8b85ff,_0x6791('0xc'));logger[_0x6791('0xd')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x8b85ff,_0x6791('0xc'),JSON[_0x6791('0xe')](_0x198a64));if(_0x198a64[_0x6791('0xf')]){if(_0x198a64[_0x6791('0xf')][_0x6791('0x10')]===0x1f4){logger[_0x6791('0xf')](_0x6791('0xb'),_0x8b85ff,_0x198a64[_0x6791('0xf')][_0x6791('0x11')]);return _0x50c563(_0x198a64[_0x6791('0xf')][_0x6791('0x11')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x8b85ff,_0x198a64[_0x6791('0xf')]['message']);return _0x2b240c(_0x198a64[_0x6791('0xf')]['message']);}else{logger[_0x6791('0x12')](_0x6791('0xb'),_0x8b85ff,'request\x20sent');_0x2b240c(_0x198a64[_0x6791('0x13')]['message']);}})[_0x6791('0x14')](function(_0x150d1f){logger['error'](_0x6791('0xb'),_0x8b85ff,_0x150d1f);_0x50c563(_0x150d1f);});});}exports[_0x6791('0x15')]=function(_0x5bec14){var _0x1872f5=this;return new Promise(function(_0x4d8a79,_0xe55dba){return db[_0x6791('0x16')][_0x6791('0x17')](_0x5bec14[_0x6791('0x18')],{'raw':_0x5bec14[_0x6791('0x19')]?_0x5bec14[_0x6791('0x19')][_0x6791('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x4a2922){logger[_0x6791('0x12')]('CreateCmHopperHistory',_0x5bec14);logger[_0x6791('0xd')](_0x6791('0x15'),_0x5bec14,JSON['stringify'](_0x4a2922));_0x4d8a79(_0x4a2922);})[_0x6791('0x14')](function(_0x309610){logger[_0x6791('0xf')](_0x6791('0x15'),_0x309610['message'],_0x5bec14);_0xe55dba(_0x1872f5[_0x6791('0xf')](0x1f4,_0x309610[_0x6791('0x11')]));});});};exports['AvgHandleTime']=function(_0x53bb44){var _0x4b23bc=this;return new Promise(function(_0x372dae,_0x502043){return db[_0x6791('0x16')]['findAll']({'raw':_0x53bb44['options']?_0x53bb44['options'][_0x6791('0x1a')]===undefined?!![]:![]:!![],'where':_0x53bb44[_0x6791('0x19')]?_0x53bb44[_0x6791('0x19')]['where']||null:null,'attributes':[[db[_0x6791('0x1b')]['fn'](_0x6791('0x1c'),db['sequelize'][_0x6791('0x1d')]('id')),'predictiveIntervalTotalCalls'],[db[_0x6791('0x1b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6791('0x1b')]['literal'](_0x6791('0x1e')))),_0x6791('0x1f')],[db['sequelize']['fn'](_0x6791('0x1c'),db[_0x6791('0x1b')]['fn']('IF',db[_0x6791('0x1b')][_0x6791('0x20')]('`state`\x20=\x2010,\x201,\x20null'))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x6791('0x1b')]['fn']('COUNT',db[_0x6791('0x1b')]['fn']('IF',db[_0x6791('0x1b')][_0x6791('0x20')](_0x6791('0x21')))),_0x6791('0x22')],[db[_0x6791('0x1b')]['fn'](_0x6791('0x23'),db[_0x6791('0x1b')]['fn']('IF',db[_0x6791('0x1b')][_0x6791('0x20')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x6791('0x24')],[db[_0x6791('0x1b')]['fn'](_0x6791('0x23'),db[_0x6791('0x1b')]['fn']('IF',db[_0x6791('0x1b')][_0x6791('0x20')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})['then'](function(_0x1de770){logger[_0x6791('0x12')](_0x6791('0x25'),_0x53bb44);logger['debug']('AvgHandleTime',_0x53bb44,JSON[_0x6791('0xe')](_0x1de770));_0x372dae(_0x1de770);})[_0x6791('0x14')](function(_0x31a525){logger[_0x6791('0xf')]('AvgHandleTime',_0x31a525[_0x6791('0x11')],_0x53bb44);_0x502043(_0x4b23bc[_0x6791('0xf')](0x1f4,_0x31a525[_0x6791('0x11')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x31217d){var _0x567e36=this;return new Promise(function(_0x4ee010,_0x256c02){return db[_0x6791('0x16')]['findAll']({'raw':_0x31217d[_0x6791('0x19')]?_0x31217d[_0x6791('0x19')][_0x6791('0x1a')]===undefined?!![]:![]:!![],'where':_0x31217d[_0x6791('0x19')]?_0x31217d[_0x6791('0x19')]['where']||null:null,'attributes':[[_0x6791('0x26'),_0x6791('0x27')],[db[_0x6791('0x1b')]['fn']('COUNT',db[_0x6791('0x1b')]['fn']('IF',db[_0x6791('0x1b')][_0x6791('0x20')]('`state`\x20=\x200,\x201,\x20null'))),_0x6791('0x28')],[db[_0x6791('0x1b')]['fn'](_0x6791('0x1c'),db[_0x6791('0x1b')]['fn']('IF',db['sequelize'][_0x6791('0x20')](_0x6791('0x29')))),_0x6791('0x2a')],[db[_0x6791('0x1b')]['fn'](_0x6791('0x1c'),db[_0x6791('0x1b')]['fn']('IF',db[_0x6791('0x1b')][_0x6791('0x20')](_0x6791('0x1e')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0x6791('0x1c'),db[_0x6791('0x1b')]['fn']('IF',db['sequelize'][_0x6791('0x20')](_0x6791('0x2b')))),_0x6791('0x2c')],[db[_0x6791('0x1b')]['fn'](_0x6791('0x1c'),db[_0x6791('0x1b')]['fn']('IF',db[_0x6791('0x1b')]['literal'](_0x6791('0x2d')))),'outboundCongestionCallsDay'],[db[_0x6791('0x1b')]['fn'](_0x6791('0x1c'),db[_0x6791('0x1b')]['fn']('IF',db[_0x6791('0x1b')]['literal'](_0x6791('0x2e')))),_0x6791('0x2f')],[db[_0x6791('0x1b')]['fn'](_0x6791('0x1c'),db[_0x6791('0x1b')]['fn']('IF',db[_0x6791('0x1b')][_0x6791('0x20')](_0x6791('0x30')))),'outboundDropCallsDayCallersExit'],[db[_0x6791('0x1b')]['fn'](_0x6791('0x1c'),db[_0x6791('0x1b')]['fn']('IF',db[_0x6791('0x1b')]['literal'](_0x6791('0x31')))),_0x6791('0x32')],[db['sequelize']['fn'](_0x6791('0x1c'),db['sequelize']['fn']('IF',db[_0x6791('0x1b')][_0x6791('0x20')](_0x6791('0x33')))),_0x6791('0x34')],[db[_0x6791('0x1b')]['fn'](_0x6791('0x1c'),db[_0x6791('0x1b')]['fn']('IF',db[_0x6791('0x1b')][_0x6791('0x20')]('`state`\x20=\x2014,\x201,\x20null'))),_0x6791('0x35')],[db['sequelize']['fn'](_0x6791('0x1c'),db[_0x6791('0x1b')]['fn']('IF',db[_0x6791('0x1b')][_0x6791('0x20')](_0x6791('0x36')))),'outboundRejectCallsDay'],[db[_0x6791('0x1b')]['fn'](_0x6791('0x1c'),db[_0x6791('0x1b')]['fn']('IF',db[_0x6791('0x1b')][_0x6791('0x20')]('`state`\x20=\x2016,\x201,\x20null'))),_0x6791('0x37')],[db[_0x6791('0x1b')]['fn']('COUNT',db[_0x6791('0x1b')]['fn']('IF',db['sequelize'][_0x6791('0x20')](_0x6791('0x38')))),_0x6791('0x39')],[db[_0x6791('0x1b')]['fn']('COUNT',db[_0x6791('0x1b')]['fn']('IF',db[_0x6791('0x1b')]['literal'](_0x6791('0x3a')))),_0x6791('0x3b')]],'group':[_0x6791('0x26')]})['then'](function(_0x355e97){logger[_0x6791('0x12')]('GetVoiceQueueHopperHistory',_0x31217d);logger[_0x6791('0xd')](_0x6791('0x3c'),_0x31217d,JSON['stringify'](_0x355e97));_0x4ee010(_0x355e97);})[_0x6791('0x14')](function(_0x216498){logger[_0x6791('0xf')](_0x6791('0x3c'),_0x216498['message'],_0x31217d);_0x256c02(_0x567e36[_0x6791('0xf')](0x1f4,_0x216498[_0x6791('0x11')]));});});};exports[_0x6791('0x3d')]=function(_0x5b534b){var _0x5a7a88=this;return new Promise(function(_0x1d6bec,_0x6b8acd){return db[_0x6791('0x16')][_0x6791('0x3e')]({'raw':_0x5b534b[_0x6791('0x19')]?_0x5b534b['options']['raw']===undefined?!![]:![]:!![],'where':_0x5b534b[_0x6791('0x19')]?_0x5b534b['options']['where']||null:null,'attributes':[[_0x6791('0x26'),_0x6791('0x27')],[db[_0x6791('0x1b')]['fn'](_0x6791('0x1c'),db[_0x6791('0x1b')][_0x6791('0x1d')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0x6791('0x1c'),db[_0x6791('0x1b')]['fn']('IF',db['sequelize'][_0x6791('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0x6791('0x3f')]],'group':[_0x6791('0x26')]})['then'](function(_0x1ebfb6){logger[_0x6791('0x12')](_0x6791('0x3d'),_0x5b534b);logger['debug'](_0x6791('0x3d'),_0x5b534b,JSON[_0x6791('0xe')](_0x1ebfb6));_0x1d6bec(_0x1ebfb6);})[_0x6791('0x14')](function(_0x383853){logger[_0x6791('0xf')]('GetCampaignHopperHistory',_0x383853['message'],_0x5b534b);_0x6b8acd(_0x5a7a88[_0x6791('0xf')](0x1f4,_0x383853[_0x6791('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 4c2a66c..6617cfc 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 _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 +var _0x64e4=['/describe','describe','get','/:id','show','post','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated'];(function(_0x361484,_0xd0f420){var _0x4b1eb3=function(_0x390bc4){while(--_0x390bc4){_0x361484['push'](_0x361484['shift']());}};_0x4b1eb3(++_0xd0f420);}(_0x64e4,0x135));var _0x464e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x64e4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x464e('0x0'));var util=require(_0x464e('0x1'));var path=require(_0x464e('0x2'));var timeout=require(_0x464e('0x3'));var express=require(_0x464e('0x4'));var router=express[_0x464e('0x5')]();var auth=require(_0x464e('0x6'));var interaction=require(_0x464e('0x7'));var config=require(_0x464e('0x8'));var controller=require(_0x464e('0x9'));router['get']('/',auth[_0x464e('0xa')](),controller['index']);router['get'](_0x464e('0xb'),auth['isAuthenticated'](),controller[_0x464e('0xc')]);router[_0x464e('0xd')](_0x464e('0xe'),auth[_0x464e('0xa')](),controller[_0x464e('0xf')]);router[_0x464e('0x10')]('/',auth[_0x464e('0xa')](),controller['create']);router[_0x464e('0x11')](_0x464e('0xe'),auth[_0x464e('0xa')](),controller[_0x464e('0x12')]);module[_0x464e('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 4a0dded..78bdcbc 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 _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 +var _0xeeb6=['STRING','name','exports'];(function(_0x162e41,_0x37a68f){var _0x18b742=function(_0x5b232a){while(--_0x5b232a){_0x162e41['push'](_0x162e41['shift']());}};_0x18b742(++_0x37a68f);}(_0xeeb6,0xfe));var _0x6eeb=function(_0x520f9b,_0x1d53e6){_0x520f9b=_0x520f9b-0x0;var _0x3b32ab=_0xeeb6[_0x520f9b];return _0x3b32ab;};'use strict';var Sequelize=require('sequelize');module[_0x6eeb('0x0')]={'name':{'type':Sequelize[_0x6eeb('0x1')],'unique':_0x6eeb('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6eeb('0x1')]},'dialPrefix':{'type':Sequelize[_0x6eeb('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index c6ef704..49f0940 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 _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 +var _0xd267=['number','switch','BOOLEAN','defaultValue','cm_contacts','findAndCountAll','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','html-pdf','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/logger','../../config/utils','../../config/environment','redis','localhost','./cmList.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','UserProfileResource','error','stack','name','send','index','CmList','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Lists','userProfileId','autoAssociation','body','describe','addDisposition','Disposition','getDispositions','findOne','order','ListId','rows','removeDispositions','ids','addContacts','CmContact','tags','join','isArray','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContacts','getContactsCsv','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','download','addCustomField','transaction','addCustomFields','Sequelize','TEXT','text'];(function(_0x49cfb0,_0x430675){var _0x56954e=function(_0x401391){while(--_0x401391){_0x49cfb0['push'](_0x49cfb0['shift']());}};_0x56954e(++_0x430675);}(_0xd267,0x1bd));var _0x7d26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd267[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x7d26('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7d26('0x1'));var jsonpatch=require(_0x7d26('0x2'));var rp=require(_0x7d26('0x3'));var moment=require(_0x7d26('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7d26('0x5'));var util=require(_0x7d26('0x6'));var path=require(_0x7d26('0x7'));var sox=require(_0x7d26('0x8'));var csv=require(_0x7d26('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7d26('0xa'));var squel=require(_0x7d26('0xb'));var crypto=require(_0x7d26('0xc'));var jsforce=require(_0x7d26('0xd'));var deskjs=require(_0x7d26('0xe'));var toCsv=require(_0x7d26('0x9'));var querystring=require(_0x7d26('0xf'));var Papa=require('papaparse');var Redis=require(_0x7d26('0x10'));var authService=require(_0x7d26('0x11'));var qs=require(_0x7d26('0x12'));var as=require(_0x7d26('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d26('0x14'))('api');var utils=require(_0x7d26('0x15'));var config=require(_0x7d26('0x16'));var db=require('../../mysqldb')['db'];config[_0x7d26('0x17')]=_['defaults'](config[_0x7d26('0x17')],{'host':_0x7d26('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7d26('0x17')]));require(_0x7d26('0x19'))[_0x7d26('0x1a')](socket);function respondWithStatusCode(_0x5d8d63,_0x64453){_0x64453=_0x64453||0xcc;return function(_0x728590){if(_0x728590){return _0x5d8d63[_0x7d26('0x1b')](_0x64453);}return _0x5d8d63[_0x7d26('0x1c')](_0x64453)[_0x7d26('0x1d')]();};}function respondWithResult(_0x44e923,_0x51319a){_0x51319a=_0x51319a||0xc8;return function(_0x12ef09){if(_0x12ef09){return _0x44e923[_0x7d26('0x1c')](_0x51319a)[_0x7d26('0x1e')](_0x12ef09);}};}function respondWithFilteredResult(_0x359ad6,_0x25b7f8){return function(_0x38b71b){if(_0x38b71b){var _0x2c395a=_0x38b71b[_0x7d26('0x1f')],_0x46f3cf=_0x25b7f8[_0x7d26('0x20')],_0x4b5bf2=_0x25b7f8['offset']+_0x25b7f8[_0x7d26('0x21')],_0x559c3c;if(_0x4b5bf2>=_0x2c395a){_0x4b5bf2=_0x2c395a;_0x559c3c=0xc8;}else{_0x559c3c=0xce;}_0x359ad6[_0x7d26('0x1c')](_0x559c3c);return _0x359ad6[_0x7d26('0x22')](_0x7d26('0x23'),_0x46f3cf+'-'+_0x4b5bf2+'/'+_0x2c395a)['json'](_0x38b71b);}return null;};}function patchUpdates(_0x3217d8){return function(_0x110ccf){try{jsonpatch[_0x7d26('0x24')](_0x110ccf,_0x3217d8,!![]);}catch(_0x879a1c){return BPromise[_0x7d26('0x25')](_0x879a1c);}return _0x110ccf['save']();};}function saveUpdates(_0x45a0d9,_0x19eab4){return function(_0x122502){if(_0x122502){return _0x122502[_0x7d26('0x26')](_0x45a0d9)['then'](function(_0x215108){return _0x215108;});}return null;};}function removeEntity(_0x102e06,_0x248496){return function(_0x2f7ec9){if(_0x2f7ec9){return _0x2f7ec9[_0x7d26('0x27')]()[_0x7d26('0x28')](function(){var _0x241e6a=_0x2f7ec9['get']({'plain':!![]});var _0x3459='Lists';return db[_0x7d26('0x29')][_0x7d26('0x27')]({'where':{'type':_0x3459,'resourceId':_0x241e6a['id']}})[_0x7d26('0x28')](function(){return _0x2f7ec9;});})[_0x7d26('0x28')](function(){_0x102e06[_0x7d26('0x1c')](0xcc)[_0x7d26('0x1d')]();});}};}function handleEntityNotFound(_0x3dbfdb,_0x5d56cf){return function(_0x266652){if(!_0x266652){_0x3dbfdb[_0x7d26('0x1b')](0x194);}return _0x266652;};}function handleError(_0x5c0ac7,_0xbe859){_0xbe859=_0xbe859||0x1f4;return function(_0x5475ec){logger[_0x7d26('0x2a')](_0x5475ec[_0x7d26('0x2b')]);if(_0x5475ec[_0x7d26('0x2c')]){delete _0x5475ec[_0x7d26('0x2c')];}_0x5c0ac7[_0x7d26('0x1c')](_0xbe859)[_0x7d26('0x2d')](_0x5475ec);};}exports[_0x7d26('0x2e')]=function(_0x35a72c,_0x2f3d82){var _0x23b39b={},_0x875755={},_0x159bb3={'count':0x0,'rows':[]};var _0x13c642=_['map'](db[_0x7d26('0x2f')][_0x7d26('0x30')],function(_0x3ef5f7){return{'name':_0x3ef5f7['fieldName'],'type':_0x3ef5f7[_0x7d26('0x31')][_0x7d26('0x32')]};});_0x875755[_0x7d26('0x33')]=_[_0x7d26('0x34')](_0x13c642,_0x7d26('0x2c'));_0x875755[_0x7d26('0x35')]=_[_0x7d26('0x36')](_0x35a72c[_0x7d26('0x35')]);_0x875755[_0x7d26('0x37')]=_[_0x7d26('0x38')](_0x875755[_0x7d26('0x33')],_0x875755[_0x7d26('0x35')]);_0x23b39b['attributes']=_[_0x7d26('0x38')](_0x875755[_0x7d26('0x33')],qs[_0x7d26('0x39')](_0x35a72c[_0x7d26('0x35')]['fields']));_0x23b39b['attributes']=_0x23b39b['attributes'][_0x7d26('0x3a')]?_0x23b39b[_0x7d26('0x3b')]:_0x875755['model'];if(!_0x35a72c[_0x7d26('0x35')][_0x7d26('0x3c')](_0x7d26('0x3d'))){_0x23b39b['limit']=qs['limit'](_0x35a72c[_0x7d26('0x35')]['limit']);_0x23b39b[_0x7d26('0x20')]=qs['offset'](_0x35a72c['query'][_0x7d26('0x20')]);}_0x23b39b['order']=qs[_0x7d26('0x3e')](_0x35a72c[_0x7d26('0x35')]['sort']);_0x23b39b['where']=qs[_0x7d26('0x37')](_[_0x7d26('0x3f')](_0x35a72c[_0x7d26('0x35')],_0x875755[_0x7d26('0x37')]),_0x13c642);if(_0x35a72c['query'][_0x7d26('0x40')]){_0x23b39b['where']=_[_0x7d26('0x41')](_0x23b39b[_0x7d26('0x42')],{'$or':_['map'](_0x13c642,function(_0x37f823){if(_0x37f823[_0x7d26('0x31')]!==_0x7d26('0x43')){var _0x59b9ff={};_0x59b9ff[_0x37f823[_0x7d26('0x2c')]]={'$like':'%'+_0x35a72c[_0x7d26('0x35')][_0x7d26('0x40')]+'%'};return _0x59b9ff;}})});}_0x23b39b=_[_0x7d26('0x41')]({},_0x23b39b,_0x35a72c[_0x7d26('0x44')]);var _0x3e8624={'where':_0x23b39b[_0x7d26('0x42')]};return db['CmList'][_0x7d26('0x1f')](_0x3e8624)[_0x7d26('0x28')](function(_0x1fab48){_0x159bb3[_0x7d26('0x1f')]=_0x1fab48;if(_0x35a72c['query'][_0x7d26('0x45')]){_0x23b39b[_0x7d26('0x46')]=[{'all':!![]}];}return db[_0x7d26('0x2f')][_0x7d26('0x47')](_0x23b39b);})[_0x7d26('0x28')](function(_0x12cbc){_0x159bb3['rows']=_0x12cbc;return _0x159bb3;})[_0x7d26('0x28')](respondWithFilteredResult(_0x2f3d82,_0x23b39b))[_0x7d26('0x48')](handleError(_0x2f3d82,null));};exports[_0x7d26('0x49')]=function(_0x5583ae,_0x215dd6){var _0x4c890a={'raw':![],'where':{'id':_0x5583ae[_0x7d26('0x4a')]['id']}},_0x5066e7={};_0x5066e7['model']=_[_0x7d26('0x36')](db[_0x7d26('0x2f')][_0x7d26('0x30')]);_0x5066e7[_0x7d26('0x35')]=_[_0x7d26('0x36')](_0x5583ae[_0x7d26('0x35')]);_0x5066e7[_0x7d26('0x37')]=_[_0x7d26('0x38')](_0x5066e7[_0x7d26('0x33')],_0x5066e7[_0x7d26('0x35')]);_0x4c890a['attributes']=_[_0x7d26('0x38')](_0x5066e7[_0x7d26('0x33')],qs[_0x7d26('0x39')](_0x5583ae[_0x7d26('0x35')]['fields']));_0x4c890a[_0x7d26('0x3b')]=_0x4c890a[_0x7d26('0x3b')]['length']?_0x4c890a[_0x7d26('0x3b')]:_0x5066e7[_0x7d26('0x33')];if(_0x5583ae[_0x7d26('0x35')][_0x7d26('0x45')]){_0x4c890a[_0x7d26('0x46')]=[{'all':!![]}];}_0x4c890a=_['merge']({},_0x4c890a,_0x5583ae['options']);return db[_0x7d26('0x2f')][_0x7d26('0x4b')](_0x4c890a)[_0x7d26('0x28')](handleEntityNotFound(_0x215dd6,null))[_0x7d26('0x28')](respondWithResult(_0x215dd6,null))[_0x7d26('0x48')](handleError(_0x215dd6,null));};exports[_0x7d26('0x4c')]=function(_0x24f098,_0x13d367){return db['CmList'][_0x7d26('0x4c')](_0x24f098['body'],{})[_0x7d26('0x28')](function(_0x41b53e){var _0x3908ba=_0x24f098[_0x7d26('0x4d')][_0x7d26('0x4e')]({'plain':!![]});if(!_0x3908ba)throw new Error(_0x7d26('0x4f'));if(_0x3908ba['role']===_0x7d26('0x4d')){var _0xc48ac9=_0x41b53e[_0x7d26('0x4e')]({'plain':!![]});var _0x406251=_0x7d26('0x50');return db['UserProfileSection'][_0x7d26('0x4b')]({'where':{'name':_0x406251,'userProfileId':_0x3908ba[_0x7d26('0x51')]},'raw':!![]})[_0x7d26('0x28')](function(_0x140763){if(_0x140763&&_0x140763[_0x7d26('0x52')]===0x0){return db[_0x7d26('0x29')]['create']({'name':_0xc48ac9[_0x7d26('0x2c')],'resourceId':_0xc48ac9['id'],'type':_0x140763['name'],'sectionId':_0x140763['id']},{})[_0x7d26('0x28')](function(){return _0x41b53e;});}else{return _0x41b53e;}})[_0x7d26('0x48')](function(_0x352ad6){logger[_0x7d26('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x352ad6);throw _0x352ad6;});}return _0x41b53e;})[_0x7d26('0x28')](respondWithResult(_0x13d367,0xc9))[_0x7d26('0x48')](handleError(_0x13d367,null));};exports[_0x7d26('0x26')]=function(_0x2e9c8a,_0x11c43e){if(_0x2e9c8a[_0x7d26('0x53')]['id']){delete _0x2e9c8a[_0x7d26('0x53')]['id'];}return db[_0x7d26('0x2f')][_0x7d26('0x4b')]({'where':{'id':_0x2e9c8a['params']['id']}})[_0x7d26('0x28')](handleEntityNotFound(_0x11c43e,null))[_0x7d26('0x28')](saveUpdates(_0x2e9c8a[_0x7d26('0x53')],null))['then'](respondWithResult(_0x11c43e,null))[_0x7d26('0x48')](handleError(_0x11c43e,null));};exports[_0x7d26('0x27')]=function(_0x37ea0a,_0x668675){return db[_0x7d26('0x2f')][_0x7d26('0x4b')]({'where':{'id':_0x37ea0a[_0x7d26('0x4a')]['id']}})['then'](handleEntityNotFound(_0x668675,null))['then'](removeEntity(_0x668675,null))['catch'](handleError(_0x668675,null));};exports[_0x7d26('0x54')]=function(_0x1b6230,_0x39fe58){return db[_0x7d26('0x2f')][_0x7d26('0x54')]()[_0x7d26('0x28')](respondWithResult(_0x39fe58,null))['catch'](handleError(_0x39fe58,null));};exports[_0x7d26('0x55')]=function(_0x38433c,_0xaced3c,_0x54fd2b){if(_0x38433c['body']['id']){delete _0x38433c[_0x7d26('0x53')]['id'];}return db[_0x7d26('0x2f')][_0x7d26('0x4b')]({'where':{'id':_0x38433c[_0x7d26('0x4a')]['id']}})[_0x7d26('0x28')](handleEntityNotFound(_0xaced3c,null))['then'](function(_0x5dd8da){if(_0x5dd8da){_0x38433c[_0x7d26('0x53')]['ListId']=_0x5dd8da['id'];return db[_0x7d26('0x56')][_0x7d26('0x4c')](_0x38433c[_0x7d26('0x53')]);}})['then'](respondWithResult(_0xaced3c,null))[_0x7d26('0x48')](handleError(_0xaced3c,null));};exports[_0x7d26('0x57')]=function(_0x424d43,_0x43fae6,_0x4b9b97){var _0x2c889b={'raw':![],'where':{}};var _0x3bf852={};var _0x4aef67={'count':0x0,'rows':[]};return db['CmList'][_0x7d26('0x58')]({'where':{'id':_0x424d43[_0x7d26('0x4a')]['id']}})[_0x7d26('0x28')](handleEntityNotFound(_0x43fae6,null))[_0x7d26('0x28')](function(_0x57af97){if(_0x57af97){_0x3bf852[_0x7d26('0x33')]=_[_0x7d26('0x36')](db[_0x7d26('0x56')][_0x7d26('0x30')]);_0x3bf852[_0x7d26('0x35')]=_['keys'](_0x424d43[_0x7d26('0x35')]);_0x3bf852['filters']=_[_0x7d26('0x38')](_0x3bf852[_0x7d26('0x33')],_0x3bf852['query']);_0x2c889b[_0x7d26('0x3b')]=_['intersection'](_0x3bf852[_0x7d26('0x33')],qs[_0x7d26('0x39')](_0x424d43[_0x7d26('0x35')][_0x7d26('0x39')]));_0x2c889b[_0x7d26('0x3b')]=_0x2c889b['attributes']['length']?_0x2c889b[_0x7d26('0x3b')]:_0x3bf852['model'];if(!_0x424d43[_0x7d26('0x35')]['hasOwnProperty'](_0x7d26('0x3d'))){_0x2c889b['limit']=qs[_0x7d26('0x21')](_0x424d43['query'][_0x7d26('0x21')]);_0x2c889b[_0x7d26('0x20')]=qs['offset'](_0x424d43[_0x7d26('0x35')][_0x7d26('0x20')]);}_0x2c889b[_0x7d26('0x59')]=qs[_0x7d26('0x3e')](_0x424d43[_0x7d26('0x35')]['sort']);_0x2c889b[_0x7d26('0x42')]=qs[_0x7d26('0x37')](_['pick'](_0x424d43[_0x7d26('0x35')],_0x3bf852[_0x7d26('0x37')]));_0x2c889b['where'][_0x7d26('0x5a')]=_0x57af97['id'];if(_0x424d43[_0x7d26('0x35')]['filter']){_0x2c889b[_0x7d26('0x42')]=_[_0x7d26('0x41')](_0x2c889b[_0x7d26('0x42')],{'$or':_[_0x7d26('0x34')](_0x2c889b['attributes'],function(_0xd5fa03){var _0x1ca61f={};_0x1ca61f[_0xd5fa03]={'$like':'%'+_0x424d43[_0x7d26('0x35')][_0x7d26('0x40')]+'%'};return _0x1ca61f;})});}_0x2c889b=_['merge']({},_0x2c889b,_0x424d43[_0x7d26('0x44')]);return db['Disposition'][_0x7d26('0x1f')]({'where':_0x2c889b['where']})[_0x7d26('0x28')](function(_0x52a092){_0x4aef67[_0x7d26('0x1f')]=_0x52a092;if(_0x424d43[_0x7d26('0x35')][_0x7d26('0x45')]){_0x2c889b[_0x7d26('0x46')]=[{'all':!![]}];}return db[_0x7d26('0x56')][_0x7d26('0x47')](_0x2c889b);})[_0x7d26('0x28')](function(_0x3fb157){_0x4aef67[_0x7d26('0x5b')]=_0x3fb157;return _0x4aef67;});}})[_0x7d26('0x28')](respondWithFilteredResult(_0x43fae6,_0x2c889b))['catch'](handleError(_0x43fae6,null));};exports[_0x7d26('0x5c')]=function(_0x9d602c,_0x2a83ff,_0xcc8572){return db[_0x7d26('0x2f')]['find']({'where':{'id':_0x9d602c[_0x7d26('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2a83ff,null))[_0x7d26('0x28')](function(_0x26ccb7){if(_0x26ccb7){return _0x26ccb7[_0x7d26('0x5c')](_0x9d602c[_0x7d26('0x35')][_0x7d26('0x5d')]);}})[_0x7d26('0x28')](respondWithStatusCode(_0x2a83ff,null))[_0x7d26('0x48')](handleError(_0x2a83ff,null));};exports[_0x7d26('0x5e')]=function(_0x262f6b,_0x59678d,_0x412f61){return db[_0x7d26('0x2f')][_0x7d26('0x4b')]({'where':{'id':_0x262f6b[_0x7d26('0x4a')]['id']}})[_0x7d26('0x28')](handleEntityNotFound(_0x59678d,null))[_0x7d26('0x28')](function(_0x39ecb7){if(_0x39ecb7){var _0x28a7a0=[];var _0x41310e={'success':[],'errors':[]};return db[_0x7d26('0x5f')]['describe']()[_0x7d26('0x28')](function(_0x2b98b1){if(_0x262f6b[_0x7d26('0x53')][_0x7d26('0x60')]&&_['isArray'](_0x262f6b[_0x7d26('0x53')][_0x7d26('0x60')])){if(_0x262f6b[_0x7d26('0x53')][_0x7d26('0x60')]['length']){_0x262f6b['body'][_0x7d26('0x60')]=_0x262f6b[_0x7d26('0x53')]['tags'][_0x7d26('0x61')](';')+';';}else{_0x262f6b[_0x7d26('0x53')]['tags']=null;}}else{_0x262f6b['body'][_0x7d26('0x60')]=null;}if(_0x262f6b[_0x7d26('0x53')]&&_[_0x7d26('0x62')](_0x262f6b[_0x7d26('0x53')])){for(var _0x5ee3bd=0x0;_0x5ee3bd<_0x262f6b[_0x7d26('0x53')][_0x7d26('0x3a')];_0x5ee3bd+=0x1){_0x262f6b[_0x7d26('0x53')][_0x5ee3bd]['ListId']=_0x262f6b[_0x7d26('0x4a')]['id'];_0x28a7a0[_0x7d26('0x63')](_0x262f6b[_0x7d26('0x53')][_0x5ee3bd]);}return BPromise[_0x7d26('0x64')](_0x28a7a0,function(_0xdd085d){return db[_0x7d26('0x5f')][_0x7d26('0x4c')](_[_0x7d26('0x65')](_0xdd085d,[_0x7d26('0x5d'),'id'])||{},{'fields':_['keys'](_0x2b98b1),'raw':!![]})[_0x7d26('0x28')](function(_0x445dd1){_0x41310e[_0x7d26('0x66')][_0x7d26('0x63')](_0x445dd1[_0x7d26('0x67')]);})['catch'](function(_0x4bd771){_0x41310e[_0x7d26('0x68')][_0x7d26('0x63')]({'data':_0xdd085d,'error':_0x4bd771[_0x7d26('0x69')]});});})[_0x7d26('0x28')](function(_0x404c3b){return _0x41310e;})[_0x7d26('0x48')](function(_0x525ef2){return _0x525ef2;});}else{_0x59678d[_0x7d26('0x1c')](0x190)[_0x7d26('0x1e')]({'message':_0x7d26('0x6a')});}});}})[_0x7d26('0x28')](respondWithResult(_0x59678d,null))[_0x7d26('0x48')](handleError(_0x59678d,null));};exports['getContacts']=function(_0x1e3fb,_0x4775d8,_0xfb1ea0){var _0x33dfd2;return db[_0x7d26('0x2f')]['find']({'where':{'id':_0x1e3fb[_0x7d26('0x4a')]['id']},'include':[{'model':db[_0x7d26('0x6b')],'as':_0x7d26('0x6c')}]})[_0x7d26('0x28')](handleEntityNotFound(_0x4775d8,null))[_0x7d26('0x28')](function(_0x437bdb){if(_0x437bdb){_0x33dfd2=_0x437bdb;return db[_0x7d26('0x5f')]['rawAttributes'];}})['then'](function(_0x2553ca){if(_0x2553ca){var _0x48702f={};var _0x45a8a8={};_0x45a8a8[_0x7d26('0x33')]=_[_0x7d26('0x6d')](_['keys'](_0x2553ca),_[_0x7d26('0x34')](_0x33dfd2[_0x7d26('0x6c')],function(_0x41ba9e){return util[_0x7d26('0x6e')](_0x7d26('0x6f'),_0x41ba9e['id']);}));_0x45a8a8[_0x7d26('0x35')]=_[_0x7d26('0x36')](_0x1e3fb[_0x7d26('0x35')]);_0x45a8a8[_0x7d26('0x37')]=_[_0x7d26('0x38')](_0x45a8a8[_0x7d26('0x33')],_0x45a8a8['query']);_0x48702f['attributes']=_['intersection'](_0x45a8a8[_0x7d26('0x33')],qs[_0x7d26('0x39')](_0x1e3fb[_0x7d26('0x35')][_0x7d26('0x39')]));_0x48702f[_0x7d26('0x3b')]=_0x48702f[_0x7d26('0x3b')][_0x7d26('0x3a')]?_0x48702f[_0x7d26('0x3b')]:_0x45a8a8['model'];if(!_0x1e3fb['query']['hasOwnProperty'](_0x7d26('0x3d'))){_0x48702f[_0x7d26('0x21')]=qs[_0x7d26('0x21')](_0x1e3fb[_0x7d26('0x35')][_0x7d26('0x21')]);_0x48702f[_0x7d26('0x20')]=qs[_0x7d26('0x20')](_0x1e3fb[_0x7d26('0x35')]['offset']);}_0x48702f[_0x7d26('0x59')]=qs[_0x7d26('0x3e')](_0x1e3fb[_0x7d26('0x35')][_0x7d26('0x3e')]);_0x48702f['where']=qs[_0x7d26('0x37')](_[_0x7d26('0x3f')](_0x1e3fb[_0x7d26('0x35')],_0x45a8a8['filters']));_0x48702f[_0x7d26('0x70')]=!![];if(_0x1e3fb['query'][_0x7d26('0x40')]){_0x48702f['where']=_[_0x7d26('0x41')](_0x48702f[_0x7d26('0x42')],{'$or':_[_0x7d26('0x34')](_0x48702f[_0x7d26('0x3b')],function(_0x3481ff){var _0x46581f={};_0x46581f[_0x3481ff]={'$like':'%'+_0x1e3fb[_0x7d26('0x35')]['filter']+'%'};return _0x46581f;})});}_0x48702f=_[_0x7d26('0x41')]({},_0x48702f,_0x1e3fb[_0x7d26('0x44')]);return _0x33dfd2[_0x7d26('0x71')](_0x48702f);}})[_0x7d26('0x28')](respondWithResult(_0x4775d8,null))['catch'](handleError(_0x4775d8,null));};exports[_0x7d26('0x72')]=function(_0x57dafe,_0x1cbf04,_0x36b4f3){var _0x4a72a2;return db[_0x7d26('0x2f')][_0x7d26('0x4b')]({'where':{'id':_0x57dafe[_0x7d26('0x4a')]['id']},'include':[{'model':db[_0x7d26('0x6b')],'as':_0x7d26('0x6c')}]})[_0x7d26('0x28')](handleEntityNotFound(_0x1cbf04,null))[_0x7d26('0x28')](function(_0x211039){if(_0x211039){_0x4a72a2=_0x211039;return db[_0x7d26('0x5f')]['rawAttributes'];}})[_0x7d26('0x28')](function(_0x187c54){if(_0x187c54){var _0x23780c={};var _0x4ab950={};_0x4ab950[_0x7d26('0x33')]=_[_0x7d26('0x6d')](_['keys'](_0x187c54),_[_0x7d26('0x34')](_0x4a72a2['CustomFields'],function(_0x5a4c73){return util[_0x7d26('0x6e')](_0x7d26('0x6f'),_0x5a4c73['id']);}));_0x4ab950[_0x7d26('0x35')]=_[_0x7d26('0x36')](_0x57dafe['query']);_0x4ab950[_0x7d26('0x37')]=_[_0x7d26('0x38')](_0x4ab950[_0x7d26('0x33')],_0x4ab950[_0x7d26('0x35')]);_0x23780c[_0x7d26('0x3b')]=_[_0x7d26('0x38')](_0x4ab950['model'],qs[_0x7d26('0x39')](_0x57dafe[_0x7d26('0x35')][_0x7d26('0x39')]));_0x23780c['attributes']=_0x23780c[_0x7d26('0x3b')][_0x7d26('0x3a')]?_0x23780c['attributes']:_0x4ab950[_0x7d26('0x33')];if(!_0x57dafe[_0x7d26('0x35')][_0x7d26('0x3c')](_0x7d26('0x3d'))){_0x23780c[_0x7d26('0x21')]=qs[_0x7d26('0x21')](_0x57dafe['query'][_0x7d26('0x21')]);_0x23780c[_0x7d26('0x20')]=qs[_0x7d26('0x20')](_0x57dafe['query'][_0x7d26('0x20')]);}_0x23780c[_0x7d26('0x59')]=qs[_0x7d26('0x3e')](_0x57dafe[_0x7d26('0x35')]['sort']);_0x23780c['where']=qs[_0x7d26('0x37')](_[_0x7d26('0x3f')](_0x57dafe[_0x7d26('0x35')],_0x4ab950['filters']));_0x23780c[_0x7d26('0x70')]=!![];if(_0x57dafe[_0x7d26('0x35')][_0x7d26('0x40')]){_0x23780c[_0x7d26('0x42')]=_[_0x7d26('0x41')](_0x23780c[_0x7d26('0x42')],{'$or':_['map'](_0x23780c[_0x7d26('0x3b')],function(_0x276289){var _0x8a44f0={};_0x8a44f0[_0x276289]={'$like':'%'+_0x57dafe['query'][_0x7d26('0x40')]+'%'};return _0x8a44f0;})});}_0x23780c=_[_0x7d26('0x41')]({},_0x23780c,_0x57dafe['options']);return _0x4a72a2[_0x7d26('0x71')](_0x23780c);}})[_0x7d26('0x28')](function(_0x50954f){if(!_[_0x7d26('0x73')](_0x50954f)){var _0x56539b=toCsv(_0x50954f);var _0xb6abf2=Date[_0x7d26('0x74')]();fs[_0x7d26('0x75')](util[_0x7d26('0x6e')](_0x7d26('0x76'),_0x4a72a2['id'],_0xb6abf2),_0x56539b);_0x1cbf04[_0x7d26('0x77')](_0x7d26('0x78'),_0x7d26('0x79')+util['format'](_0x7d26('0x7a'),_0x4a72a2['id'],_0xb6abf2));_0x1cbf04[_0x7d26('0x77')]('Content-type',_0x7d26('0x7b'));return _0x1cbf04[_0x7d26('0x7c')](util[_0x7d26('0x6e')]('/tmp/list_%d_%s.csv',_0x4a72a2['id'],_0xb6abf2));}else{return _0x1cbf04[_0x7d26('0x1b')](0xcc);}})['catch'](handleError(_0x1cbf04,null));};exports[_0x7d26('0x7d')]=function(_0x28d710,_0x410319,_0x59ed90){var _0x291f21;delete _0x28d710[_0x7d26('0x53')]['id'];return db[_0x7d26('0x2f')][_0x7d26('0x58')]({'where':{'id':_0x28d710['params']['id']}})[_0x7d26('0x28')](handleEntityNotFound(_0x410319,null))['then'](function(_0xc5fbb0){if(_0xc5fbb0){return db['sequelize'][_0x7d26('0x7e')](function(_0x4f580e){return db[_0x7d26('0x6b')]['create'](_0x28d710[_0x7d26('0x53')],{'transaction':_0x4f580e})[_0x7d26('0x28')](function(_0x1a26e5){_0x291f21=_0x1a26e5;return _0xc5fbb0[_0x7d26('0x7f')](_0x1a26e5,{'transaction':_0x4f580e});})[_0x7d26('0x28')](function(){var _0x4bb4db={'type':db[_0x7d26('0x80')][_0x7d26('0x81')],'transaction':_0x4f580e};switch(_0x28d710['body'][_0x7d26('0x31')]){case _0x7d26('0x82'):_0x4bb4db[_0x7d26('0x31')]=db[_0x7d26('0x80')]['TEXT'];break;case _0x7d26('0x83'):_0x4bb4db[_0x7d26('0x31')]=db[_0x7d26('0x80')]['INTEGER'];break;case _0x7d26('0x84'):_0x4bb4db[_0x7d26('0x31')]=db[_0x7d26('0x80')][_0x7d26('0x85')];_0x4bb4db[_0x7d26('0x86')]=![];break;default:}return db['sequelize']['queryInterface']['addColumn'](_0x7d26('0x87'),util[_0x7d26('0x6e')]('cf_%s',_0x291f21['id']),_0x4bb4db);})[_0x7d26('0x28')](function(){return _0x291f21;});});}})[_0x7d26('0x28')](respondWithResult(_0x410319,null))[_0x7d26('0x48')](handleError(_0x410319,null));};exports['getCustomFields']=function(_0x5bae60,_0x334b26,_0x3fd865){var _0x1e2580={};var _0x8f2c16={};var _0x4703c5;var _0x2d2c5a;return db[_0x7d26('0x2f')]['findOne']({'where':{'id':_0x5bae60[_0x7d26('0x4a')]['id']}})['then'](handleEntityNotFound(_0x334b26,null))[_0x7d26('0x28')](function(_0x57e51a){if(_0x57e51a){_0x4703c5=_0x57e51a;_0x8f2c16[_0x7d26('0x33')]=_[_0x7d26('0x36')](db[_0x7d26('0x6b')][_0x7d26('0x30')]);_0x8f2c16[_0x7d26('0x35')]=_[_0x7d26('0x36')](_0x5bae60['query']);_0x8f2c16[_0x7d26('0x37')]=_['intersection'](_0x8f2c16[_0x7d26('0x33')],_0x8f2c16[_0x7d26('0x35')]);_0x1e2580[_0x7d26('0x3b')]=_[_0x7d26('0x38')](_0x8f2c16[_0x7d26('0x33')],qs[_0x7d26('0x39')](_0x5bae60['query'][_0x7d26('0x39')]));_0x1e2580[_0x7d26('0x3b')]=_0x1e2580['attributes']['length']?_0x1e2580['attributes']:_0x8f2c16['model'];_0x1e2580[_0x7d26('0x59')]=qs['sort'](_0x5bae60['query'][_0x7d26('0x3e')]);_0x1e2580['where']=qs[_0x7d26('0x37')](_[_0x7d26('0x3f')](_0x5bae60[_0x7d26('0x35')],_0x8f2c16[_0x7d26('0x37')]));_0x1e2580[_0x7d26('0x42')]=_[_0x7d26('0x41')](_0x1e2580['where'],{'$or':[{'ListId':_0x57e51a['id']},{'ListId':null}]});if(_0x5bae60[_0x7d26('0x35')][_0x7d26('0x40')]){_0x1e2580[_0x7d26('0x42')]=_[_0x7d26('0x41')](_0x1e2580[_0x7d26('0x42')],{'$or':_[_0x7d26('0x34')](_0x1e2580['attributes'],function(_0x46b19c){var _0x5a43a2={};_0x5a43a2[_0x46b19c]={'$like':'%'+_0x5bae60[_0x7d26('0x35')]['filter']+'%'};return _0x5a43a2;})});}_0x1e2580=_[_0x7d26('0x41')]({},_0x1e2580,_0x5bae60[_0x7d26('0x44')]);return db[_0x7d26('0x6b')][_0x7d26('0x88')](_0x1e2580);}})[_0x7d26('0x28')](respondWithResult(_0x334b26,null))[_0x7d26('0x48')](handleError(_0x334b26,null));};exports[_0x7d26('0x89')]=function(_0x24ddea,_0x2955b5,_0x429da0){return db[_0x7d26('0x2f')][_0x7d26('0x4b')]({'where':{'id':_0x24ddea[_0x7d26('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2955b5,null))['then'](function(_0xa1d6e8){if(_0xa1d6e8){return _0xa1d6e8[_0x7d26('0x89')](_0x24ddea[_0x7d26('0x53')][_0x7d26('0x5d')],_[_0x7d26('0x65')](_0x24ddea[_0x7d26('0x53')],[_0x7d26('0x5d'),'id'])||{})['spread'](function(_0x2e67a1){for(var _0x27e68b=0x0;_0x27e68b<_0x24ddea[_0x7d26('0x53')][_0x7d26('0x5d')][_0x7d26('0x3a')];_0x27e68b+=0x1){socket[_0x7d26('0x8a')](_0x7d26('0x8b'),{'UserId':_0x24ddea[_0x7d26('0x53')][_0x7d26('0x5d')][_0x27e68b],'CmListId':_0x24ddea[_0x7d26('0x4a')]['id']});}return _0x2e67a1;});}})[_0x7d26('0x28')](respondWithResult(_0x2955b5,null))[_0x7d26('0x48')](handleError(_0x2955b5,null));};exports[_0x7d26('0x8c')]=function(_0x618abf,_0x390cae,_0x465f7c){return db[_0x7d26('0x2f')][_0x7d26('0x4b')]({'where':{'id':_0x618abf[_0x7d26('0x4a')]['id']}})[_0x7d26('0x28')](handleEntityNotFound(_0x390cae,null))[_0x7d26('0x28')](function(_0x3ec621){if(_0x3ec621){return _0x3ec621[_0x7d26('0x8c')](_0x618abf['query'][_0x7d26('0x5d')])[_0x7d26('0x28')](function(){if(_[_0x7d26('0x62')](_0x618abf['query'][_0x7d26('0x5d')])){for(var _0x79797e=0x0;_0x79797e<_0x618abf[_0x7d26('0x35')][_0x7d26('0x5d')][_0x7d26('0x3a')];_0x79797e+=0x1){socket[_0x7d26('0x8a')](_0x7d26('0x8d'),{'UserId':Number(_0x618abf[_0x7d26('0x35')][_0x7d26('0x5d')][_0x79797e]),'CmListId':Number(_0x618abf[_0x7d26('0x4a')]['id'])});}}else{socket[_0x7d26('0x8a')](_0x7d26('0x8d'),{'UserId':Number(_0x618abf[_0x7d26('0x35')][_0x7d26('0x5d')]),'CmListId':Number(_0x618abf[_0x7d26('0x4a')]['id'])});}});}})[_0x7d26('0x28')](respondWithStatusCode(_0x390cae,null))[_0x7d26('0x48')](handleError(_0x390cae,null));};exports[_0x7d26('0x8e')]=function(_0x4601fa,_0x1875c3,_0x1387ff){var _0x483bf5={};var _0x414009={};var _0x2d0970;var _0x155467;return db[_0x7d26('0x2f')][_0x7d26('0x58')]({'where':{'id':_0x4601fa[_0x7d26('0x4a')]['id']}})[_0x7d26('0x28')](handleEntityNotFound(_0x1875c3,null))[_0x7d26('0x28')](function(_0x4fa8a9){if(_0x4fa8a9){_0x2d0970=_0x4fa8a9;_0x414009[_0x7d26('0x33')]=_[_0x7d26('0x36')](db[_0x7d26('0x8f')][_0x7d26('0x30')]);_0x414009[_0x7d26('0x35')]=_[_0x7d26('0x36')](_0x4601fa[_0x7d26('0x35')]);_0x414009[_0x7d26('0x37')]=_[_0x7d26('0x38')](_0x414009[_0x7d26('0x33')],_0x414009[_0x7d26('0x35')]);_0x483bf5['attributes']=_['intersection'](_0x414009[_0x7d26('0x33')],qs[_0x7d26('0x39')](_0x4601fa[_0x7d26('0x35')][_0x7d26('0x39')]));_0x483bf5['attributes']=_0x483bf5['attributes']['length']?_0x483bf5[_0x7d26('0x3b')]:_0x414009[_0x7d26('0x33')];_0x483bf5[_0x7d26('0x59')]=qs[_0x7d26('0x3e')](_0x4601fa[_0x7d26('0x35')]['sort']);_0x483bf5[_0x7d26('0x42')]=qs[_0x7d26('0x37')](_[_0x7d26('0x3f')](_0x4601fa[_0x7d26('0x35')],_0x414009['filters']));if(_0x4601fa[_0x7d26('0x35')][_0x7d26('0x40')]){_0x483bf5['where']=_['merge'](_0x483bf5[_0x7d26('0x42')],{'$or':_[_0x7d26('0x34')](_0x483bf5[_0x7d26('0x3b')],function(_0x3e05d0){var _0x12fede={};_0x12fede[_0x3e05d0]={'$like':'%'+_0x4601fa[_0x7d26('0x35')]['filter']+'%'};return _0x12fede;})});}_0x483bf5=_[_0x7d26('0x41')]({},_0x483bf5,_0x4601fa[_0x7d26('0x44')]);return _0x2d0970[_0x7d26('0x8e')](_0x483bf5);}})[_0x7d26('0x28')](function(_0xe5050b){if(_0xe5050b){_0x155467=_0xe5050b[_0x7d26('0x3a')];if(!_0x4601fa[_0x7d26('0x35')][_0x7d26('0x3c')](_0x7d26('0x3d'))){_0x483bf5[_0x7d26('0x21')]=qs[_0x7d26('0x21')](_0x4601fa[_0x7d26('0x35')][_0x7d26('0x21')]);_0x483bf5['offset']=qs[_0x7d26('0x20')](_0x4601fa[_0x7d26('0x35')][_0x7d26('0x20')]);}return _0x2d0970[_0x7d26('0x8e')](_0x483bf5);}})[_0x7d26('0x28')](function(_0x11848d){if(_0x11848d){return _0x11848d?{'count':_0x155467,'rows':_0x11848d}:null;}})[_0x7d26('0x28')](respondWithResult(_0x1875c3,null))[_0x7d26('0x48')](handleError(_0x1875c3,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index aa0c707..bb4dc93 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 _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 +var _0x3ecb=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x572997,_0x323709){var _0x1de5ae=function(_0x4ef06d){while(--_0x4ef06d){_0x572997['push'](_0x572997['shift']());}};_0x1de5ae(++_0x323709);}(_0x3ecb,0xa5));var _0xb3ec=function(_0x150397,_0x258581){_0x150397=_0x150397-0x0;var _0x5cadab=_0x3ecb[_0x150397];return _0x5cadab;};'use strict';var EventEmitter=require(_0xb3ec('0x0'));var CmList=require(_0xb3ec('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0xb3ec('0x2')](0x0);var events={'afterCreate':_0xb3ec('0x3'),'afterUpdate':_0xb3ec('0x4'),'afterDestroy':'remove'};function emitEvent(_0xfa75c){return function(_0x95e3c0,_0x34b8b0,_0x1bbf05){CmListEvents[_0xb3ec('0x5')](_0xfa75c+':'+_0x95e3c0['id'],_0x95e3c0);CmListEvents[_0xb3ec('0x5')](_0xfa75c,_0x95e3c0);_0x1bbf05(null);};}for(var e in events){if(events[_0xb3ec('0x6')](e)){var event=events[e];CmList[_0xb3ec('0x7')](e,emitEvent(event));}}module[_0xb3ec('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 40378de..e4a4607 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 _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 +var _0x7b37=['request-promise','path','rimraf','../../config/environment','./cmList.attributes','cm_lists','lodash','api','bluebird'];(function(_0x13ac10,_0x46e79e){var _0x28eda2=function(_0x169ef0){while(--_0x169ef0){_0x13ac10['push'](_0x13ac10['shift']());}};_0x28eda2(++_0x46e79e);}(_0x7b37,0x1da));var _0x77b3=function(_0x2ca0cf,_0x2f56c3){_0x2ca0cf=_0x2ca0cf-0x0;var _0x12e852=_0x7b37[_0x2ca0cf];return _0x12e852;};'use strict';var _=require(_0x77b3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x77b3('0x1'));var moment=require('moment');var BPromise=require(_0x77b3('0x2'));var rp=require(_0x77b3('0x3'));var fs=require('fs');var path=require(_0x77b3('0x4'));var rimraf=require(_0x77b3('0x5'));var config=require(_0x77b3('0x6'));var attributes=require(_0x77b3('0x7'));module['exports']=function(_0x567aed,_0x4d3b09){return _0x567aed['define']('CmList',attributes,{'tableName':_0x77b3('0x8'),'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 ed43405..549fcb8 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 _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 +var _0x847f=['defaults','socket.io-emitter','./cmList.socket','register','then','info','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x566d4d,_0x457261){var _0x12a84a=function(_0x17bc0a){while(--_0x17bc0a){_0x566d4d['push'](_0x566d4d['shift']());}};_0x12a84a(++_0x457261);}(_0x847f,0xc4));var _0xf847=function(_0x377fb1,_0x5ee538){_0x377fb1=_0x377fb1-0x0;var _0x3248e9=_0x847f[_0x377fb1];return _0x3248e9;};'use strict';var _=require('lodash');var util=require(_0xf847('0x0'));var moment=require(_0xf847('0x1'));var BPromise=require(_0xf847('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf847('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf847('0x4'));var logger=require(_0xf847('0x5'))(_0xf847('0x6'));var config=require(_0xf847('0x7'));var jayson=require(_0xf847('0x8'));var client=jayson[_0xf847('0x9')][_0xf847('0xa')]({'port':0x232a});config[_0xf847('0xb')]=_[_0xf847('0xc')](config[_0xf847('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xf847('0xd'))(new Redis(config[_0xf847('0xb')]));require(_0xf847('0xe'))[_0xf847('0xf')](socket);function respondWithRpcPromise(_0x2f7733,_0x1eebe6,_0x526f25){return new BPromise(function(_0x120b39,_0x5c2279){return client['request'](_0x2f7733,_0x526f25)[_0xf847('0x10')](function(_0x17c9f2){logger[_0xf847('0x11')](_0xf847('0x12'),_0x1eebe6,_0xf847('0x13'));logger['debug'](_0xf847('0x14'),_0x1eebe6,_0xf847('0x13'),JSON['stringify'](_0x17c9f2));if(_0x17c9f2['error']){if(_0x17c9f2[_0xf847('0x15')][_0xf847('0x16')]===0x1f4){logger[_0xf847('0x15')](_0xf847('0x12'),_0x1eebe6,_0x17c9f2['error'][_0xf847('0x17')]);return _0x5c2279(_0x17c9f2[_0xf847('0x15')][_0xf847('0x17')]);}logger['error']('CmList,\x20%s,\x20%s',_0x1eebe6,_0x17c9f2[_0xf847('0x15')]['message']);return _0x120b39(_0x17c9f2[_0xf847('0x15')][_0xf847('0x17')]);}else{logger['info']('CmList,\x20%s,\x20%s',_0x1eebe6,_0xf847('0x13'));_0x120b39(_0x17c9f2[_0xf847('0x18')]['message']);}})[_0xf847('0x19')](function(_0x407ebb){logger[_0xf847('0x15')](_0xf847('0x12'),_0x1eebe6,_0x407ebb);_0x5c2279(_0x407ebb);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 31ce993..0d485eb 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 _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 +var _0xbdb9=['update','register','length','cmList:','./cmList.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbdb9,0xac));var _0x9bdb=function(_0x3f8568,_0x11efa9){_0x3f8568=_0x3f8568-0x0;var _0x5249c0=_0xbdb9[_0x3f8568];return _0x5249c0;};'use strict';var CmListEvents=require(_0x9bdb('0x0'));var events=[_0x9bdb('0x1'),_0x9bdb('0x2'),_0x9bdb('0x3')];function createListener(_0x23595d,_0x4fe743){return function(_0x24a6af){_0x4fe743['emit'](_0x23595d,_0x24a6af);};}function removeListener(_0x5dbce0,_0x5870f6){return function(){CmListEvents['removeListener'](_0x5dbce0,_0x5870f6);};}exports[_0x9bdb('0x4')]=function(_0x4f9fbe){for(var _0x225a66=0x0,_0x4e9c54=events[_0x9bdb('0x5')];_0x225a66<_0x4e9c54;_0x225a66++){var _0x27cdd8=events[_0x225a66];var _0x27c6b8=createListener(_0x9bdb('0x6')+_0x27cdd8,_0x4f9fbe);CmListEvents['on'](_0x27cdd8,_0x27c6b8);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index bb0c7cb..f048009 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 _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 +var _0x7fe0=['removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','index','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','getAgents','create','post','addDisposition','addContacts','/:id/fields','addCustomField','addAgents','put','/:id','update','delete','destroy'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x7fe0,0x1e3));var _0x07fe=function(_0x45c1df,_0x2d14bc){_0x45c1df=_0x45c1df-0x0;var _0x1bb9db=_0x7fe0[_0x45c1df];return _0x1bb9db;};'use strict';var multer=require(_0x07fe('0x0'));var util=require(_0x07fe('0x1'));var path=require(_0x07fe('0x2'));var timeout=require(_0x07fe('0x3'));var express=require(_0x07fe('0x4'));var router=express[_0x07fe('0x5')]();var auth=require(_0x07fe('0x6'));var interaction=require(_0x07fe('0x7'));var config=require('../../config/environment');var controller=require(_0x07fe('0x8'));router[_0x07fe('0x9')]('/',auth['isAuthenticated'](),controller[_0x07fe('0xa')]);router[_0x07fe('0x9')](_0x07fe('0xb'),auth[_0x07fe('0xc')](),controller[_0x07fe('0xd')]);router[_0x07fe('0x9')]('/:id',auth[_0x07fe('0xc')](),controller[_0x07fe('0xe')]);router['get'](_0x07fe('0xf'),auth[_0x07fe('0xc')](),controller[_0x07fe('0x10')]);router[_0x07fe('0x9')](_0x07fe('0x11'),auth['isAuthenticated'](),controller['getContacts']);router[_0x07fe('0x9')](_0x07fe('0x12'),auth['isAuthenticated'](),controller[_0x07fe('0x13')]);router['get']('/:id/fields',auth[_0x07fe('0xc')](),controller[_0x07fe('0x14')]);router[_0x07fe('0x9')](_0x07fe('0x15'),auth[_0x07fe('0xc')](),controller[_0x07fe('0x16')]);router['post']('/',auth[_0x07fe('0xc')](),controller[_0x07fe('0x17')]);router[_0x07fe('0x18')](_0x07fe('0xf'),auth[_0x07fe('0xc')](),controller[_0x07fe('0x19')]);router[_0x07fe('0x18')](_0x07fe('0x11'),auth['isAuthenticated'](),controller[_0x07fe('0x1a')]);router[_0x07fe('0x18')](_0x07fe('0x1b'),auth['isAuthenticated'](),controller[_0x07fe('0x1c')]);router[_0x07fe('0x18')](_0x07fe('0x15'),auth[_0x07fe('0xc')](),controller[_0x07fe('0x1d')]);router[_0x07fe('0x1e')](_0x07fe('0x1f'),auth[_0x07fe('0xc')](),controller[_0x07fe('0x20')]);router[_0x07fe('0x21')]('/:id',auth['isAuthenticated'](),controller[_0x07fe('0x22')]);router[_0x07fe('0x21')](_0x07fe('0xf'),auth[_0x07fe('0xc')](),controller['removeDispositions']);router[_0x07fe('0x21')](_0x07fe('0x15'),auth[_0x07fe('0xc')](),controller[_0x07fe('0x23')]);module[_0x07fe('0x24')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index c6cb089..eaeea1e 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 _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 +var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x1ef6e3,_0x2a2df5){var _0x21cf56=function(_0x19b02f){while(--_0x19b02f){_0x1ef6e3['push'](_0x1ef6e3['shift']());}};_0x21cf56(++_0x2a2df5);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 1b14699..25be5dc 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 _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 +var _0x81cb=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','body','Condition','catch','params','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x81cb,0xaa));var _0xb81c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x81cb[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xb81c('0x0'));var emlformat=require(_0xb81c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb81c('0x2'));var jsonpatch=require(_0xb81c('0x3'));var rp=require('request-promise');var moment=require(_0xb81c('0x4'));var BPromise=require(_0xb81c('0x5'));var Mustache=require(_0xb81c('0x6'));var util=require(_0xb81c('0x7'));var path=require('path');var sox=require(_0xb81c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb81c('0x9'));var squel=require(_0xb81c('0xa'));var crypto=require(_0xb81c('0xb'));var jsforce=require(_0xb81c('0xc'));var deskjs=require(_0xb81c('0xd'));var toCsv=require(_0xb81c('0xe'));var querystring=require(_0xb81c('0xf'));var Papa=require(_0xb81c('0x10'));var Redis=require(_0xb81c('0x11'));var authService=require(_0xb81c('0x12'));var qs=require(_0xb81c('0x13'));var as=require(_0xb81c('0x14'));var hardwareService=require(_0xb81c('0x15'));var logger=require(_0xb81c('0x16'))('api');var utils=require(_0xb81c('0x17'));var config=require(_0xb81c('0x18'));var db=require(_0xb81c('0x19'))['db'];function respondWithStatusCode(_0x60aa8e,_0x2e8242){_0x2e8242=_0x2e8242||0xcc;return function(_0x4b1d98){if(_0x4b1d98){return _0x60aa8e[_0xb81c('0x1a')](_0x2e8242);}return _0x60aa8e['status'](_0x2e8242)[_0xb81c('0x1b')]();};}function respondWithResult(_0x29b1db,_0x572945){_0x572945=_0x572945||0xc8;return function(_0x1bb255){if(_0x1bb255){return _0x29b1db[_0xb81c('0x1c')](_0x572945)['json'](_0x1bb255);}};}function respondWithFilteredResult(_0x21f5c8,_0x3942dc){return function(_0x3462bd){if(_0x3462bd){var _0x56eb92=_0x3462bd[_0xb81c('0x1d')],_0x393e11=_0x3942dc[_0xb81c('0x1e')],_0x112ad5=_0x3942dc[_0xb81c('0x1e')]+_0x3942dc['limit'],_0x4d95cd;if(_0x112ad5>=_0x56eb92){_0x112ad5=_0x56eb92;_0x4d95cd=0xc8;}else{_0x4d95cd=0xce;}_0x21f5c8[_0xb81c('0x1c')](_0x4d95cd);return _0x21f5c8[_0xb81c('0x1f')](_0xb81c('0x20'),_0x393e11+'-'+_0x112ad5+'/'+_0x56eb92)['json'](_0x3462bd);}return null;};}function patchUpdates(_0x174009){return function(_0x3e8376){try{jsonpatch[_0xb81c('0x21')](_0x3e8376,_0x174009,!![]);}catch(_0x1d970c){return BPromise[_0xb81c('0x22')](_0x1d970c);}return _0x3e8376[_0xb81c('0x23')]();};}function saveUpdates(_0x445222,_0x4f09d7){return function(_0xc2ba68){if(_0xc2ba68){return _0xc2ba68[_0xb81c('0x24')](_0x445222)[_0xb81c('0x25')](function(_0x2cb18e){return _0x2cb18e;});}return null;};}function removeEntity(_0x4dab47,_0x11a5d3){return function(_0x597547){if(_0x597547){return _0x597547[_0xb81c('0x26')]()[_0xb81c('0x25')](function(){_0x4dab47[_0xb81c('0x1c')](0xcc)[_0xb81c('0x1b')]();});}};}function handleEntityNotFound(_0x554cc0,_0x5de2ac){return function(_0x12798b){if(!_0x12798b){_0x554cc0[_0xb81c('0x1a')](0x194);}return _0x12798b;};}function handleError(_0x101e04,_0x43b90f){_0x43b90f=_0x43b90f||0x1f4;return function(_0x375b9b){logger[_0xb81c('0x27')](_0x375b9b[_0xb81c('0x28')]);if(_0x375b9b[_0xb81c('0x29')]){delete _0x375b9b[_0xb81c('0x29')];}_0x101e04[_0xb81c('0x1c')](_0x43b90f)[_0xb81c('0x2a')](_0x375b9b);};}exports[_0xb81c('0x24')]=function(_0x7c57ba,_0x20b7ea){if(_0x7c57ba[_0xb81c('0x2b')]['id']){delete _0x7c57ba[_0xb81c('0x2b')]['id'];}return db[_0xb81c('0x2c')]['find']({'where':{'id':_0x7c57ba['params']['id']}})[_0xb81c('0x25')](handleEntityNotFound(_0x20b7ea,null))[_0xb81c('0x25')](saveUpdates(_0x7c57ba['body'],null))[_0xb81c('0x25')](respondWithResult(_0x20b7ea,null))[_0xb81c('0x2d')](handleError(_0x20b7ea,null));};exports['destroy']=function(_0x3c8384,_0x484ce9){return db[_0xb81c('0x2c')]['find']({'where':{'id':_0x3c8384[_0xb81c('0x2e')]['id']}})[_0xb81c('0x25')](handleEntityNotFound(_0x484ce9,null))[_0xb81c('0x25')](removeEntity(_0x484ce9,null))['catch'](handleError(_0x484ce9,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index f531e81..0d94511 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 _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 +var _0x2c2e=['../../config/environment','./condition.attributes','exports','define','Condition','lodash','util','moment','bluebird','request-promise','rimraf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2c2e,0x89));var _0xe2c2=function(_0x19e2aa,_0x5bd441){_0x19e2aa=_0x19e2aa-0x0;var _0x1b5df5=_0x2c2e[_0x19e2aa];return _0x1b5df5;};'use strict';var _=require(_0xe2c2('0x0'));var util=require(_0xe2c2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe2c2('0x2'));var BPromise=require(_0xe2c2('0x3'));var rp=require(_0xe2c2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe2c2('0x5'));var config=require(_0xe2c2('0x6'));var attributes=require(_0xe2c2('0x7'));module[_0xe2c2('0x8')]=function(_0x1c9a02,_0x140450){return _0x1c9a02[_0xe2c2('0x9')](_0xe2c2('0xa'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 1869434..9f9aa26 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 _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 +var _0x8d1c=['request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','http','info'];(function(_0x3904fa,_0x21d5f4){var _0x426439=function(_0x543f41){while(--_0x543f41){_0x3904fa['push'](_0x3904fa['shift']());}};_0x426439(++_0x21d5f4);}(_0x8d1c,0x1ae));var _0xc8d1=function(_0x1cfb37,_0x19d0d6){_0x1cfb37=_0x1cfb37-0x0;var _0x1f9a1f=_0x8d1c[_0x1cfb37];return _0x1f9a1f;};'use strict';var _=require(_0xc8d1('0x0'));var util=require(_0xc8d1('0x1'));var moment=require(_0xc8d1('0x2'));var BPromise=require(_0xc8d1('0x3'));var rs=require(_0xc8d1('0x4'));var fs=require('fs');var Redis=require(_0xc8d1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8d1('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc8d1('0x7'));var client=jayson[_0xc8d1('0x8')][_0xc8d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d5221,_0x28ac27,_0x534c12){return new BPromise(function(_0x5b7f9d,_0x479dc5){return client['request'](_0x2d5221,_0x534c12)['then'](function(_0x9710a6){logger[_0xc8d1('0xa')]('Condition,\x20%s,\x20%s',_0x28ac27,_0xc8d1('0xb'));logger[_0xc8d1('0xc')](_0xc8d1('0xd'),_0x28ac27,_0xc8d1('0xb'),JSON[_0xc8d1('0xe')](_0x9710a6));if(_0x9710a6[_0xc8d1('0xf')]){if(_0x9710a6[_0xc8d1('0xf')][_0xc8d1('0x10')]===0x1f4){logger[_0xc8d1('0xf')](_0xc8d1('0x11'),_0x28ac27,_0x9710a6['error']['message']);return _0x479dc5(_0x9710a6[_0xc8d1('0xf')][_0xc8d1('0x12')]);}logger[_0xc8d1('0xf')](_0xc8d1('0x11'),_0x28ac27,_0x9710a6[_0xc8d1('0xf')]['message']);return _0x5b7f9d(_0x9710a6['error']['message']);}else{logger[_0xc8d1('0xa')](_0xc8d1('0x11'),_0x28ac27,_0xc8d1('0xb'));_0x5b7f9d(_0x9710a6[_0xc8d1('0x13')][_0xc8d1('0x12')]);}})[_0xc8d1('0x14')](function(_0x204868){logger[_0xc8d1('0xf')](_0xc8d1('0x11'),_0x28ac27,_0x204868);_0x479dc5(_0x204868);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 83e10f3..d4ce150 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 _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 +var _0x4a95=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./condition.controller','/:id','isAuthenticated','update'];(function(_0x4d9618,_0x2a4178){var _0x100f02=function(_0x144799){while(--_0x144799){_0x4d9618['push'](_0x4d9618['shift']());}};_0x100f02(++_0x2a4178);}(_0x4a95,0xab));var _0x54a9=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4a95[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x54a9('0x0'));var util=require(_0x54a9('0x1'));var path=require(_0x54a9('0x2'));var timeout=require(_0x54a9('0x3'));var express=require('express');var router=express[_0x54a9('0x4')]();var auth=require(_0x54a9('0x5'));var interaction=require(_0x54a9('0x6'));var config=require('../../config/environment');var controller=require(_0x54a9('0x7'));router['put'](_0x54a9('0x8'),auth[_0x54a9('0x9')](),controller[_0x54a9('0xa')]);router['delete'](_0x54a9('0x8'),auth[_0x54a9('0x9')](),controller[_0x54a9('0xb')]);module[_0x54a9('0xc')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index c1cccad..1940bed 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 _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 +var _0x548b=['STRING','name','sequelize'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x548b,0x14f));var _0xb548=function(_0x46abd1,_0x3ca47d){_0x46abd1=_0x46abd1-0x0;var _0x28f4f5=_0x548b[_0x46abd1];return _0x28f4f5;};'use strict';var Sequelize=require(_0xb548('0x0'));module['exports']={'name':{'type':Sequelize[_0xb548('0x1')],'allowNull':![],'unique':_0xb548('0x2')},'description':{'type':Sequelize[_0xb548('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index c73f472..894434e 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 _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 +var _0x73b5=['zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','end','status','json','count','offset','set','Content-Range','apply','save','then','destroy','CustomDashboards','UserProfileResource','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','params','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','get','omit','createdAt','updatedAt','update','attrUrl','attrs','value','https://','attrPath','clock','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','pick','html-pdf'];(function(_0x4375fb,_0x22650a){var _0x445a97=function(_0x37e046){while(--_0x37e046){_0x4375fb['push'](_0x4375fb['shift']());}};_0x445a97(++_0x22650a);}(_0x73b5,0x164));var _0x573b=function(_0x3e1896,_0x531fab){_0x3e1896=_0x3e1896-0x0;var _0x3a5074=_0x73b5[_0x3e1896];return _0x3a5074;};'use strict';var pdf=require(_0x573b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x573b('0x1'));var jsonpatch=require(_0x573b('0x2'));var rp=require(_0x573b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x573b('0x4'));var util=require(_0x573b('0x5'));var path=require(_0x573b('0x6'));var sox=require(_0x573b('0x7'));var csv=require(_0x573b('0x8'));var ejs=require(_0x573b('0x9'));var fs=require('fs');var _=require(_0x573b('0xa'));var squel=require(_0x573b('0xb'));var crypto=require('crypto');var jsforce=require(_0x573b('0xc'));var deskjs=require(_0x573b('0xd'));var toCsv=require(_0x573b('0x8'));var querystring=require(_0x573b('0xe'));var Papa=require(_0x573b('0xf'));var Redis=require('ioredis');var authService=require(_0x573b('0x10'));var qs=require(_0x573b('0x11'));var as=require(_0x573b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x573b('0x13'))(_0x573b('0x14'));var utils=require(_0x573b('0x15'));var config=require('../../config/environment');var db=require(_0x573b('0x16'))['db'];config[_0x573b('0x17')]=_['defaults'](config[_0x573b('0x17')],{'host':_0x573b('0x18'),'port':0x18eb});var socket=require(_0x573b('0x19'))(new Redis(config[_0x573b('0x17')]));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x460f09,_0x5ce93e){_0x5ce93e=_0x5ce93e||0xcc;return function(_0x386cbb){if(_0x386cbb){return _0x460f09[_0x573b('0x1a')](_0x5ce93e);}return _0x460f09['status'](_0x5ce93e)[_0x573b('0x1b')]();};}function respondWithResult(_0x50b35b,_0xec676b){_0xec676b=_0xec676b||0xc8;return function(_0x38303f){if(_0x38303f){return _0x50b35b[_0x573b('0x1c')](_0xec676b)[_0x573b('0x1d')](_0x38303f);}};}function respondWithFilteredResult(_0x153606,_0x4fda22){return function(_0x16ac4e){if(_0x16ac4e){var _0x2598a3=_0x16ac4e[_0x573b('0x1e')],_0x537433=_0x4fda22['offset'],_0x24597e=_0x4fda22[_0x573b('0x1f')]+_0x4fda22['limit'],_0xdfa6ea;if(_0x24597e>=_0x2598a3){_0x24597e=_0x2598a3;_0xdfa6ea=0xc8;}else{_0xdfa6ea=0xce;}_0x153606[_0x573b('0x1c')](_0xdfa6ea);return _0x153606[_0x573b('0x20')](_0x573b('0x21'),_0x537433+'-'+_0x24597e+'/'+_0x2598a3)[_0x573b('0x1d')](_0x16ac4e);}return null;};}function patchUpdates(_0x2c01ad){return function(_0x427c23){try{jsonpatch[_0x573b('0x22')](_0x427c23,_0x2c01ad,!![]);}catch(_0x103d63){return BPromise['reject'](_0x103d63);}return _0x427c23[_0x573b('0x23')]();};}function saveUpdates(_0x578bd8,_0x2302ab){return function(_0x14d154){if(_0x14d154){return _0x14d154['update'](_0x578bd8)[_0x573b('0x24')](function(_0x447f22){return _0x447f22;});}return null;};}function removeEntity(_0x5369b2,_0x3cb930){return function(_0x1a77aa){if(_0x1a77aa){return _0x1a77aa[_0x573b('0x25')]()[_0x573b('0x24')](function(){var _0x5ad7fc=_0x1a77aa['get']({'plain':!![]});var _0x4d7f8b=_0x573b('0x26');return db[_0x573b('0x27')][_0x573b('0x25')]({'where':{'type':_0x4d7f8b,'resourceId':_0x5ad7fc['id']}})[_0x573b('0x24')](function(){return _0x1a77aa;});})[_0x573b('0x24')](function(){_0x5369b2[_0x573b('0x1c')](0xcc)[_0x573b('0x1b')]();});}};}function handleEntityNotFound(_0x1463b7,_0x4e3027){return function(_0x1f0ea7){if(!_0x1f0ea7){_0x1463b7[_0x573b('0x1a')](0x194);}return _0x1f0ea7;};}function handleError(_0x1a3cf6,_0x35d70e){_0x35d70e=_0x35d70e||0x1f4;return function(_0x44975b){logger[_0x573b('0x28')](_0x44975b[_0x573b('0x29')]);if(_0x44975b['name']){delete _0x44975b[_0x573b('0x2a')];}_0x1a3cf6[_0x573b('0x1c')](_0x35d70e)[_0x573b('0x2b')](_0x44975b);};}exports[_0x573b('0x2c')]=function(_0x37aacb,_0x277874){var _0x10e1e7={},_0x416e06={},_0x82f16d={'count':0x0,'rows':[]};var _0x39a321=_[_0x573b('0x2d')](db[_0x573b('0x2e')][_0x573b('0x2f')],function(_0x1d64ae){return{'name':_0x1d64ae[_0x573b('0x30')],'type':_0x1d64ae[_0x573b('0x31')][_0x573b('0x32')]};});_0x416e06[_0x573b('0x33')]=_['map'](_0x39a321,_0x573b('0x2a'));_0x416e06[_0x573b('0x34')]=_[_0x573b('0x35')](_0x37aacb[_0x573b('0x34')]);_0x416e06[_0x573b('0x36')]=_[_0x573b('0x37')](_0x416e06[_0x573b('0x33')],_0x416e06['query']);_0x10e1e7[_0x573b('0x38')]=_['intersection'](_0x416e06[_0x573b('0x33')],qs['fields'](_0x37aacb[_0x573b('0x34')][_0x573b('0x39')]));_0x10e1e7[_0x573b('0x38')]=_0x10e1e7['attributes']['length']?_0x10e1e7['attributes']:_0x416e06[_0x573b('0x33')];if(!_0x37aacb['query'][_0x573b('0x3a')](_0x573b('0x3b'))){_0x10e1e7['limit']=qs[_0x573b('0x3c')](_0x37aacb[_0x573b('0x34')]['limit']);_0x10e1e7[_0x573b('0x1f')]=qs[_0x573b('0x1f')](_0x37aacb[_0x573b('0x34')][_0x573b('0x1f')]);}_0x10e1e7[_0x573b('0x3d')]=qs['sort'](_0x37aacb[_0x573b('0x34')][_0x573b('0x3e')]);_0x10e1e7['where']=qs[_0x573b('0x36')](_['pick'](_0x37aacb[_0x573b('0x34')],_0x416e06[_0x573b('0x36')]),_0x39a321);if(_0x37aacb[_0x573b('0x34')][_0x573b('0x3f')]){_0x10e1e7[_0x573b('0x40')]=_[_0x573b('0x41')](_0x10e1e7[_0x573b('0x40')],{'$or':_[_0x573b('0x2d')](_0x39a321,function(_0x42e761){if(_0x42e761['type']!=='VIRTUAL'){var _0x474cb0={};_0x474cb0[_0x42e761[_0x573b('0x2a')]]={'$like':'%'+_0x37aacb[_0x573b('0x34')][_0x573b('0x3f')]+'%'};return _0x474cb0;}})});}_0x10e1e7=_['merge']({},_0x10e1e7,_0x37aacb[_0x573b('0x42')]);var _0x3e327d={'where':_0x10e1e7['where']};return db[_0x573b('0x2e')][_0x573b('0x1e')](_0x3e327d)[_0x573b('0x24')](function(_0x2a234a){_0x82f16d[_0x573b('0x1e')]=_0x2a234a;if(_0x37aacb[_0x573b('0x34')][_0x573b('0x43')]){_0x10e1e7[_0x573b('0x44')]=[{'all':!![]}];}return db[_0x573b('0x2e')][_0x573b('0x45')](_0x10e1e7);})[_0x573b('0x24')](function(_0x1d2e6c){_0x82f16d[_0x573b('0x46')]=_0x1d2e6c;return _0x82f16d;})[_0x573b('0x24')](respondWithFilteredResult(_0x277874,_0x10e1e7))['catch'](handleError(_0x277874,null));};exports['show']=function(_0x55346d,_0x6e21fa){var _0x59b947={'raw':![],'where':{'id':_0x55346d[_0x573b('0x47')]['id']}},_0x11aa0e={};_0x11aa0e[_0x573b('0x33')]=_[_0x573b('0x35')](db[_0x573b('0x2e')][_0x573b('0x2f')]);_0x11aa0e[_0x573b('0x34')]=_[_0x573b('0x35')](_0x55346d[_0x573b('0x34')]);_0x11aa0e[_0x573b('0x36')]=_[_0x573b('0x37')](_0x11aa0e[_0x573b('0x33')],_0x11aa0e[_0x573b('0x34')]);_0x59b947[_0x573b('0x38')]=_[_0x573b('0x37')](_0x11aa0e[_0x573b('0x33')],qs[_0x573b('0x39')](_0x55346d[_0x573b('0x34')][_0x573b('0x39')]));_0x59b947[_0x573b('0x38')]=_0x59b947[_0x573b('0x38')][_0x573b('0x48')]?_0x59b947[_0x573b('0x38')]:_0x11aa0e[_0x573b('0x33')];if(_0x55346d['query'][_0x573b('0x43')]){_0x59b947[_0x573b('0x44')]=[{'all':!![]}];}_0x59b947=_[_0x573b('0x41')]({},_0x59b947,_0x55346d[_0x573b('0x42')]);return db['Dashboard'][_0x573b('0x49')](_0x59b947)[_0x573b('0x24')](handleEntityNotFound(_0x6e21fa,null))[_0x573b('0x24')](respondWithResult(_0x6e21fa,null))[_0x573b('0x4a')](handleError(_0x6e21fa,null));};exports[_0x573b('0x4b')]=function(_0x529d76,_0x5bcdfa){return db[_0x573b('0x2e')]['create'](_0x529d76[_0x573b('0x4c')],{})[_0x573b('0x24')](function(_0x101a2f){var _0x1dc14a=_0x529d76[_0x573b('0x4d')]['get']({'plain':!![]});if(!_0x1dc14a)throw new Error(_0x573b('0x4e'));if(_0x1dc14a[_0x573b('0x4f')]===_0x573b('0x4d')){var _0x3e0df7=_0x101a2f['get']({'plain':!![]});var _0xf6f810='CustomDashboards';return db[_0x573b('0x50')][_0x573b('0x49')]({'where':{'name':_0xf6f810,'userProfileId':_0x1dc14a[_0x573b('0x51')]},'raw':!![]})[_0x573b('0x24')](function(_0x2eef0c){if(_0x2eef0c&&_0x2eef0c['autoAssociation']===0x0){return db[_0x573b('0x27')][_0x573b('0x4b')]({'name':_0x3e0df7[_0x573b('0x2a')],'resourceId':_0x3e0df7['id'],'type':_0x2eef0c[_0x573b('0x2a')],'sectionId':_0x2eef0c['id']},{})[_0x573b('0x24')](function(){return _0x101a2f;});}else{return _0x101a2f;}})['catch'](function(_0xdd537e){logger['error'](_0x573b('0x52'),_0xdd537e);throw _0xdd537e;});}return _0x101a2f;})[_0x573b('0x24')](respondWithResult(_0x5bcdfa,0xc9))[_0x573b('0x4a')](handleError(_0x5bcdfa,null));};exports['clone']=function(_0x510ba4,_0x2ade86){var _0x3f957f={'where':{'id':_0x510ba4[_0x573b('0x47')]['id']}},_0x38efe0={};_0x38efe0[_0x573b('0x33')]=_['keys'](db[_0x573b('0x2e')]['rawAttributes']);_0x3f957f['attributes']=_['intersection'](_0x38efe0[_0x573b('0x33')],qs[_0x573b('0x39')](_0x510ba4['query'][_0x573b('0x39')]));_0x3f957f['attributes']=_0x3f957f[_0x573b('0x38')]['length']?_0x3f957f['attributes']:_0x38efe0[_0x573b('0x33')];if(_0x510ba4[_0x573b('0x34')]['includeAll']){_0x3f957f[_0x573b('0x44')]=[{'all':!![]}];}_0x3f957f=_[_0x573b('0x41')]({},_0x3f957f,_0x510ba4[_0x573b('0x42')]);return db[_0x573b('0x2e')][_0x573b('0x49')](_0x3f957f)[_0x573b('0x24')](handleEntityNotFound(_0x2ade86,null))['then'](function(_0x4b4af7){if(_0x4b4af7){var _0xea15b4=_0x4b4af7[_0x573b('0x53')]({'plain':!![]});_0xea15b4=qs[_0x573b('0x54')](_0xea15b4,['id',_0x573b('0x55'),_0x573b('0x56')]);_0x510ba4[_0x573b('0x4c')]=_['omit'](_0x510ba4[_0x573b('0x4c')],['id',_0x573b('0x55'),_0x573b('0x56')]);return db[_0x573b('0x2e')][_0x573b('0x4b')](_[_0x573b('0x41')](_0xea15b4,_0x510ba4[_0x573b('0x4c')]),{'include':_0x510ba4[_0x573b('0x34')]['includeAll']?[{'all':!![]}]:undefined})[_0x573b('0x24')](function(_0x41737d){var _0x3d44c9=_0x510ba4[_0x573b('0x4d')][_0x573b('0x53')]({'plain':!![]});if(!_0x3d44c9)throw new Error(_0x573b('0x4e'));if(_0x3d44c9['role']===_0x573b('0x4d')){var _0x1560bb=_0x41737d[_0x573b('0x53')]({'plain':!![]});var _0x21560f=_0x573b('0x26');return db[_0x573b('0x50')][_0x573b('0x49')]({'where':{'name':_0x21560f,'userProfileId':_0x3d44c9[_0x573b('0x51')]},'raw':!![]})[_0x573b('0x24')](function(_0x14b7db){if(_0x14b7db&&_0x14b7db['autoAssociation']===0x0){return db[_0x573b('0x27')][_0x573b('0x4b')]({'name':_0x1560bb[_0x573b('0x2a')],'resourceId':_0x1560bb['id'],'type':_0x14b7db[_0x573b('0x2a')],'sectionId':_0x14b7db['id']},{})[_0x573b('0x24')](function(){return _0x41737d;});}else{return _0x41737d;}})[_0x573b('0x4a')](function(_0x360f42){logger[_0x573b('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x360f42);throw _0x360f42;});}return _0x41737d;});}})[_0x573b('0x24')](respondWithResult(_0x2ade86,0xc9))[_0x573b('0x4a')](handleError(_0x2ade86,null));};exports[_0x573b('0x57')]=function(_0x39d01e,_0x200c6c){if(_0x39d01e[_0x573b('0x4c')]['id']){delete _0x39d01e[_0x573b('0x4c')]['id'];}return db[_0x573b('0x2e')]['find']({'where':{'id':_0x39d01e['params']['id']}})[_0x573b('0x24')](handleEntityNotFound(_0x200c6c,null))[_0x573b('0x24')](saveUpdates(_0x39d01e[_0x573b('0x4c')],null))[_0x573b('0x24')](respondWithResult(_0x200c6c,null))[_0x573b('0x4a')](handleError(_0x200c6c,null));};exports[_0x573b('0x25')]=function(_0x36ff76,_0x2a8ffe){return db[_0x573b('0x2e')][_0x573b('0x49')]({'where':{'id':_0x36ff76[_0x573b('0x47')]['id']}})[_0x573b('0x24')](handleEntityNotFound(_0x2a8ffe,null))[_0x573b('0x24')](removeEntity(_0x2a8ffe,null))[_0x573b('0x4a')](handleError(_0x2a8ffe,null));};function widgetAttributes(_0x5cda83){try{switch(_0x5cda83['type']){case'iframe':return[{'name':_0x573b('0x58'),'value':_0x5cda83[_0x573b('0x58')]||(_0x5cda83[_0x573b('0x59')]&&_0x5cda83[_0x573b('0x59')][0x0]?_0x5cda83[_0x573b('0x59')][0x0][_0x573b('0x5a')]:undefined)||_0x573b('0x5b')}];case'custom':return[{'name':_0x573b('0x5c'),'value':_0x5cda83[_0x573b('0x5c')]||(_0x5cda83[_0x573b('0x59')]&&_0x5cda83['attrs'][0x0]?_0x5cda83['attrs'][0x0]['value']:undefined)||''}];case _0x573b('0x5d'):return[{'name':'attrHourFormat','value':_0x5cda83['attrHourFormat']||(_0x5cda83[_0x573b('0x59')]&&_0x5cda83[_0x573b('0x59')][0x0]?_0x5cda83[_0x573b('0x59')][0x0][_0x573b('0x5a')]:undefined)||_0x573b('0x5e')},{'name':_0x573b('0x5f'),'value':_0x5cda83['attrTimezone']||(_0x5cda83['attrs']&&_0x5cda83[_0x573b('0x59')][0x1]?_0x5cda83[_0x573b('0x59')][0x1][_0x573b('0x5a')]:undefined)||_0x573b('0x60')},{'name':_0x573b('0x61'),'value':_0x5cda83[_0x573b('0x61')]||(_0x5cda83[_0x573b('0x59')]&&_0x5cda83[_0x573b('0x59')][0x2]?_0x5cda83[_0x573b('0x59')][0x2][_0x573b('0x5a')]:undefined)||0xc}];case _0x573b('0x62'):return[{'name':_0x573b('0x63'),'value':_0x5cda83[_0x573b('0x63')]||(_0x5cda83[_0x573b('0x59')]&&_0x5cda83[_0x573b('0x59')][0x0]?_0x5cda83[_0x573b('0x59')][0x0][_0x573b('0x5a')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x5cda83[_0x573b('0x64')]||(_0x5cda83[_0x573b('0x59')]&&_0x5cda83[_0x573b('0x59')][0x1]?_0x5cda83[_0x573b('0x59')][0x1]['value']:undefined)||[]},{'name':_0x573b('0x61'),'value':_0x5cda83[_0x573b('0x61')]||(_0x5cda83[_0x573b('0x59')]&&_0x5cda83[_0x573b('0x59')][0x2]?_0x5cda83['attrs'][0x2]['value']:undefined)||0x14}];case _0x573b('0x65'):case _0x573b('0x66'):return[{'name':_0x573b('0x67'),'value':_0x5cda83[_0x573b('0x67')]||(_0x5cda83[_0x573b('0x59')]&&_0x5cda83[_0x573b('0x59')][0x0]?_0x5cda83[_0x573b('0x59')][0x0][_0x573b('0x5a')]:undefined)||_0x573b('0x68')},{'name':_0x573b('0x69'),'value':_0x5cda83[_0x573b('0x69')]||(_0x5cda83[_0x573b('0x59')]&&_0x5cda83[_0x573b('0x59')][0x1]?_0x5cda83[_0x573b('0x59')][0x1][_0x573b('0x5a')]:undefined)||null},{'name':_0x573b('0x6a'),'value':_0x5cda83[_0x573b('0x6a')]||(_0x5cda83[_0x573b('0x59')]&&_0x5cda83[_0x573b('0x59')][0x2]?_0x5cda83['attrs'][0x2][_0x573b('0x5a')]:undefined)||null},{'name':_0x573b('0x64'),'value':_0x5cda83[_0x573b('0x64')]||(_0x5cda83['attrs']&&_0x5cda83[_0x573b('0x59')][0x3]?_0x5cda83['attrs'][0x3][_0x573b('0x5a')]:undefined)||[]}];case _0x573b('0x6b'):return[{'name':'attrReport','type':_0x5cda83[_0x573b('0x6c')]||(_0x5cda83['attrs']&&_0x5cda83[_0x573b('0x59')][0x0]?_0x5cda83[_0x573b('0x59')][0x0]['type']:undefined)||null,'value':_0x5cda83[_0x573b('0x6d')]||(_0x5cda83['attrs']&&_0x5cda83[_0x573b('0x59')][0x0]?_0x5cda83[_0x573b('0x59')][0x0][_0x573b('0x5a')]:undefined)||null},{'name':_0x573b('0x6e'),'value':_0x5cda83[_0x573b('0x6e')]||(_0x5cda83[_0x573b('0x59')]&&_0x5cda83[_0x573b('0x59')][0x1]?_0x5cda83['attrs'][0x1][_0x573b('0x5a')]:undefined)||0x0}];default:return[];}}catch(_0x15da3b){logger[_0x573b('0x28')](_0x573b('0x6f'),JSON[_0x573b('0x70')](_0x15da3b));return[];}}exports[_0x573b('0x71')]=function(_0x4793e7,_0x109571,_0x2ee25d){if(_0x4793e7[_0x573b('0x4c')]['id']){delete _0x4793e7['body']['id'];}return db[_0x573b('0x2e')][_0x573b('0x49')]({'where':{'id':_0x4793e7[_0x573b('0x47')]['id']}})[_0x573b('0x24')](handleEntityNotFound(_0x109571,null))[_0x573b('0x24')](function(_0x3c1123){if(_0x3c1123){_0x4793e7[_0x573b('0x4c')][_0x573b('0x72')]=_0x3c1123['id'];_0x4793e7[_0x573b('0x4c')][_0x573b('0x59')]=widgetAttributes(_0x4793e7[_0x573b('0x4c')]);return db[_0x573b('0x73')][_0x573b('0x4b')](_0x4793e7[_0x573b('0x4c')]);}})[_0x573b('0x24')](respondWithResult(_0x109571,null))[_0x573b('0x4a')](handleError(_0x109571,null));};exports[_0x573b('0x74')]=function(_0x549f75,_0x3741ee,_0x2f552e){var _0x40a11a={};var _0x5a4df1={};var _0x1b68a0;var _0x5e55f9;return db[_0x573b('0x2e')][_0x573b('0x75')]({'where':{'id':_0x549f75[_0x573b('0x47')]['id']}})['then'](handleEntityNotFound(_0x3741ee,null))[_0x573b('0x24')](function(_0x49b603){if(_0x49b603){_0x1b68a0=_0x49b603;_0x5a4df1['model']=_[_0x573b('0x35')](db['DashboardItem'][_0x573b('0x2f')]);_0x5a4df1[_0x573b('0x34')]=_[_0x573b('0x35')](_0x549f75[_0x573b('0x34')]);_0x5a4df1[_0x573b('0x36')]=_[_0x573b('0x37')](_0x5a4df1[_0x573b('0x33')],_0x5a4df1[_0x573b('0x34')]);_0x40a11a[_0x573b('0x38')]=_[_0x573b('0x37')](_0x5a4df1[_0x573b('0x33')],qs[_0x573b('0x39')](_0x549f75[_0x573b('0x34')][_0x573b('0x39')]));_0x40a11a[_0x573b('0x38')]=_0x40a11a[_0x573b('0x38')][_0x573b('0x48')]?_0x40a11a[_0x573b('0x38')]:_0x5a4df1['model'];_0x40a11a[_0x573b('0x3d')]=qs[_0x573b('0x3e')](_0x549f75['query'][_0x573b('0x3e')]);_0x40a11a[_0x573b('0x40')]=qs[_0x573b('0x36')](_[_0x573b('0x76')](_0x549f75['query'],_0x5a4df1[_0x573b('0x36')]));if(_0x549f75['query'][_0x573b('0x3f')]){_0x40a11a['where']=_[_0x573b('0x41')](_0x40a11a['where'],{'$or':_[_0x573b('0x2d')](_0x40a11a[_0x573b('0x38')],function(_0x120e85){var _0x45c498={};_0x45c498[_0x120e85]={'$like':'%'+_0x549f75[_0x573b('0x34')][_0x573b('0x3f')]+'%'};return _0x45c498;})});}_0x40a11a=_['merge']({},_0x40a11a,_0x549f75['options']);return _0x1b68a0[_0x573b('0x74')](_0x40a11a);}})[_0x573b('0x24')](function(_0xf42fe5){if(_0xf42fe5){_0x5e55f9=_0xf42fe5[_0x573b('0x48')];if(!_0x549f75[_0x573b('0x34')][_0x573b('0x3a')](_0x573b('0x3b'))){_0x40a11a[_0x573b('0x3c')]=qs[_0x573b('0x3c')](_0x549f75[_0x573b('0x34')][_0x573b('0x3c')]);_0x40a11a['offset']=qs[_0x573b('0x1f')](_0x549f75[_0x573b('0x34')][_0x573b('0x1f')]);}return _0x1b68a0[_0x573b('0x74')](_0x40a11a);}})[_0x573b('0x24')](function(_0x298195){if(_0x298195){return _0x298195?{'count':_0x5e55f9,'rows':_0x298195}:null;}})[_0x573b('0x24')](respondWithResult(_0x3741ee,null))['catch'](handleError(_0x3741ee,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index b1d19fa..0800c18 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 _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 +var _0x406f=['exports','events','../../mysqldb','setMaxListeners','remove','emit','hook'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x406f,0x78));var _0xf406=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x406f[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require(_0xf406('0x0'));var Dashboard=require(_0xf406('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xf406('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf406('0x3')};function emitEvent(_0x396903){return function(_0x15f78f,_0x1661ae,_0x1af7b5){DashboardEvents[_0xf406('0x4')](_0x396903+':'+_0x15f78f['id'],_0x15f78f);DashboardEvents[_0xf406('0x4')](_0x396903,_0x15f78f);_0x1af7b5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xf406('0x5')](e,emitEvent(event));}}module[_0xf406('0x6')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index bc027bb..5ecb590 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 _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 +var _0xc3dc=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','Dashboard','dashboards','lodash','util'];(function(_0x3a77ce,_0x486ee8){var _0xe885c7=function(_0x5a8ae0){while(--_0x5a8ae0){_0x3a77ce['push'](_0x3a77ce['shift']());}};_0xe885c7(++_0x486ee8);}(_0xc3dc,0x186));var _0xcc3d=function(_0x1a9b87,_0x4b9987){_0x1a9b87=_0x1a9b87-0x0;var _0x3e5a50=_0xc3dc[_0x1a9b87];return _0x3e5a50;};'use strict';var _=require(_0xcc3d('0x0'));var util=require(_0xcc3d('0x1'));var logger=require(_0xcc3d('0x2'))(_0xcc3d('0x3'));var moment=require(_0xcc3d('0x4'));var BPromise=require(_0xcc3d('0x5'));var rp=require(_0xcc3d('0x6'));var fs=require('fs');var path=require(_0xcc3d('0x7'));var rimraf=require(_0xcc3d('0x8'));var config=require(_0xcc3d('0x9'));var attributes=require(_0xcc3d('0xa'));module[_0xcc3d('0xb')]=function(_0x253156,_0x4cd3a7){return _0x253156['define'](_0xcc3d('0xc'),attributes,{'tableName':_0xcc3d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index f92d482..44ab8e0 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 _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 +var _0x6981=['Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboard.socket','register','then'];(function(_0x2a0183,_0x3fc93c){var _0x158c3a=function(_0x57a903){while(--_0x57a903){_0x2a0183['push'](_0x2a0183['shift']());}};_0x158c3a(++_0x3fc93c);}(_0x6981,0x14d));var _0x1698=function(_0x2dca4e,_0x44f614){_0x2dca4e=_0x2dca4e-0x0;var _0x32fb16=_0x6981[_0x2dca4e];return _0x32fb16;};'use strict';var _=require(_0x1698('0x0'));var util=require(_0x1698('0x1'));var moment=require(_0x1698('0x2'));var BPromise=require(_0x1698('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1698('0x4'));var db=require(_0x1698('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1698('0x6'))(_0x1698('0x7'));var config=require(_0x1698('0x8'));var jayson=require(_0x1698('0x9'));var client=jayson[_0x1698('0xa')][_0x1698('0xb')]({'port':0x232a});config[_0x1698('0xc')]=_['defaults'](config[_0x1698('0xc')],{'host':_0x1698('0xd'),'port':0x18eb});var socket=require(_0x1698('0xe'))(new Redis(config[_0x1698('0xc')]));require(_0x1698('0xf'))[_0x1698('0x10')](socket);function respondWithRpcPromise(_0x33ff3b,_0x237884,_0x926653){return new BPromise(function(_0x2ca130,_0x28e9e8){return client['request'](_0x33ff3b,_0x926653)[_0x1698('0x11')](function(_0x292d9a){logger['info'](_0x1698('0x12'),_0x237884,_0x1698('0x13'));logger[_0x1698('0x14')](_0x1698('0x15'),_0x237884,'request\x20sent',JSON[_0x1698('0x16')](_0x292d9a));if(_0x292d9a[_0x1698('0x17')]){if(_0x292d9a[_0x1698('0x17')][_0x1698('0x18')]===0x1f4){logger[_0x1698('0x17')](_0x1698('0x12'),_0x237884,_0x292d9a[_0x1698('0x17')][_0x1698('0x19')]);return _0x28e9e8(_0x292d9a['error'][_0x1698('0x19')]);}logger[_0x1698('0x17')](_0x1698('0x12'),_0x237884,_0x292d9a[_0x1698('0x17')][_0x1698('0x19')]);return _0x2ca130(_0x292d9a['error'][_0x1698('0x19')]);}else{logger[_0x1698('0x1a')]('Dashboard,\x20%s,\x20%s',_0x237884,_0x1698('0x13'));_0x2ca130(_0x292d9a['result']['message']);}})['catch'](function(_0x575c64){logger[_0x1698('0x17')](_0x1698('0x12'),_0x237884,_0x575c64);_0x28e9e8(_0x575c64);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index c7d0a66..eba142a 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 _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 +var _0x7483=['remove','emit','length','dashboard:','save'];(function(_0x56e37e,_0x5c595d){var _0x56b462=function(_0x1495d6){while(--_0x1495d6){_0x56e37e['push'](_0x56e37e['shift']());}};_0x56b462(++_0x5c595d);}(_0x7483,0x1d0));var _0x3748=function(_0x1795bc,_0x7d89f6){_0x1795bc=_0x1795bc-0x0;var _0x9c9519=_0x7483[_0x1795bc];return _0x9c9519;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x3748('0x0'),_0x3748('0x1'),'update'];function createListener(_0x2c5a79,_0x1966a6){return function(_0x5c6507){_0x1966a6[_0x3748('0x2')](_0x2c5a79,_0x5c6507);};}function removeListener(_0x43b104,_0x2e0857){return function(){DashboardEvents['removeListener'](_0x43b104,_0x2e0857);};}exports['register']=function(_0x4c7712){for(var _0x3f5b69=0x0,_0x5717b5=events[_0x3748('0x3')];_0x3f5b69<_0x5717b5;_0x3f5b69++){var _0x442038=events[_0x3f5b69];var _0x1b2efa=createListener(_0x3748('0x4')+_0x442038,_0x4c7712);DashboardEvents['on'](_0x442038,_0x1b2efa);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 1c34a19..cccd2d5 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 _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 +var _0xa9e0=['/:id','/:id/items','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated'];(function(_0x379172,_0x16ae4e){var _0x49ee77=function(_0x45dbc7){while(--_0x45dbc7){_0x379172['push'](_0x379172['shift']());}};_0x49ee77(++_0x16ae4e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getItems']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xb')](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['clone']);router['post']('/:id/items',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);module[_0x0a9e('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index d10bf6d..2d28fad 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 _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 +var _0x1bc3=['getDataValue','attrs','setDataValue','stringify','INTEGER','#2196f3','squel','lodash','exports','STRING','TEXT','parse'];(function(_0x44ca6e,_0x5e2c91){var _0x2edab2=function(_0x3afa91){while(--_0x3afa91){_0x44ca6e['push'](_0x44ca6e['shift']());}};_0x2edab2(++_0x5e2c91);}(_0x1bc3,0x7e));var _0x31bc=function(_0x4c26ea,_0x37e307){_0x4c26ea=_0x4c26ea-0x0;var _0x3b3a39=_0x1bc3[_0x4c26ea];return _0x3b3a39;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x31bc('0x0'));var _=require(_0x31bc('0x1'));module[_0x31bc('0x2')]={'title':{'type':Sequelize[_0x31bc('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x31bc('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x31bc('0x4')]('long'),'get':function(){try{return JSON[_0x31bc('0x5')](this[_0x31bc('0x6')](_0x31bc('0x7')));}catch(_0x39b0e0){return[];}},'set':function(_0x53d84c){try{this[_0x31bc('0x8')]('attrs',JSON[_0x31bc('0x9')](_0x53d84c));}catch(_0x42acf5){this[_0x31bc('0x8')](_0x31bc('0x7'),JSON[_0x31bc('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x31bc('0xa')]},'col':{'type':Sequelize[_0x31bc('0xa')]},'background':{'type':Sequelize[_0x31bc('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x31bc('0x3')],'allowNull':![],'defaultValue':_0x31bc('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x31bc('0x3')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 2d99614..0ca60df 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 _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 +var _0x31a2=['localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','show','params','model','keys','DashboardItem','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','merge','options','catch','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis'];(function(_0x86f0fb,_0xdc2f14){var _0x3e71c6=function(_0x4efcf3){while(--_0x4efcf3){_0x86f0fb['push'](_0x86f0fb['shift']());}};_0x3e71c6(++_0xdc2f14);}(_0x31a2,0x96));var _0x231a=function(_0x482cbd,_0x3862f3){_0x482cbd=_0x482cbd-0x0;var _0x27d8b0=_0x31a2[_0x482cbd];return _0x27d8b0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x231a('0x0'));var rimraf=require(_0x231a('0x1'));var zipdir=require(_0x231a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x231a('0x3'));var moment=require(_0x231a('0x4'));var BPromise=require(_0x231a('0x5'));var Mustache=require(_0x231a('0x6'));var util=require(_0x231a('0x7'));var path=require(_0x231a('0x8'));var sox=require(_0x231a('0x9'));var csv=require(_0x231a('0xa'));var ejs=require(_0x231a('0xb'));var fs=require('fs');var _=require(_0x231a('0xc'));var squel=require(_0x231a('0xd'));var crypto=require(_0x231a('0xe'));var jsforce=require(_0x231a('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x231a('0x10'));var Papa=require(_0x231a('0x11'));var Redis=require(_0x231a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x231a('0x13'));var as=require(_0x231a('0x14'));var hardwareService=require(_0x231a('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x231a('0x16'));var config=require(_0x231a('0x17'));var db=require(_0x231a('0x18'))['db'];config[_0x231a('0x19')]=_['defaults'](config[_0x231a('0x19')],{'host':_0x231a('0x1a'),'port':0x18eb});var socket=require(_0x231a('0x1b'))(new Redis(config[_0x231a('0x19')]));require(_0x231a('0x1c'))[_0x231a('0x1d')](socket);function respondWithStatusCode(_0x43f152,_0x2d7cd1){_0x2d7cd1=_0x2d7cd1||0xcc;return function(_0x1abead){if(_0x1abead){return _0x43f152[_0x231a('0x1e')](_0x2d7cd1);}return _0x43f152['status'](_0x2d7cd1)[_0x231a('0x1f')]();};}function respondWithResult(_0x3a9f6f,_0xe35fb2){_0xe35fb2=_0xe35fb2||0xc8;return function(_0x5d4013){if(_0x5d4013){return _0x3a9f6f[_0x231a('0x20')](_0xe35fb2)[_0x231a('0x21')](_0x5d4013);}};}function respondWithFilteredResult(_0x33ebf6,_0x269b79){return function(_0x2ff571){if(_0x2ff571){var _0x555480=_0x2ff571[_0x231a('0x22')],_0x413706=_0x269b79[_0x231a('0x23')],_0x2d54d6=_0x269b79[_0x231a('0x23')]+_0x269b79[_0x231a('0x24')],_0x34ebb3;if(_0x2d54d6>=_0x555480){_0x2d54d6=_0x555480;_0x34ebb3=0xc8;}else{_0x34ebb3=0xce;}_0x33ebf6['status'](_0x34ebb3);return _0x33ebf6[_0x231a('0x25')](_0x231a('0x26'),_0x413706+'-'+_0x2d54d6+'/'+_0x555480)['json'](_0x2ff571);}return null;};}function patchUpdates(_0x26d6cc){return function(_0x3b209c){try{jsonpatch['apply'](_0x3b209c,_0x26d6cc,!![]);}catch(_0x3bbb61){return BPromise[_0x231a('0x27')](_0x3bbb61);}return _0x3b209c[_0x231a('0x28')]();};}function saveUpdates(_0x3a776b,_0x589298){return function(_0x4d9548){if(_0x4d9548){return _0x4d9548['update'](_0x3a776b)[_0x231a('0x29')](function(_0x30782d){return _0x30782d;});}return null;};}function removeEntity(_0x40bf4c,_0x5a4247){return function(_0x182043){if(_0x182043){return _0x182043[_0x231a('0x2a')]()['then'](function(){_0x40bf4c['status'](0xcc)[_0x231a('0x1f')]();});}};}function handleEntityNotFound(_0x305380,_0x15f9df){return function(_0x48c9aa){if(!_0x48c9aa){_0x305380[_0x231a('0x1e')](0x194);}return _0x48c9aa;};}function handleError(_0x336783,_0x5ea1ae){_0x5ea1ae=_0x5ea1ae||0x1f4;return function(_0xf9da82){logger[_0x231a('0x2b')](_0xf9da82[_0x231a('0x2c')]);if(_0xf9da82[_0x231a('0x2d')]){delete _0xf9da82['name'];}_0x336783[_0x231a('0x20')](_0x5ea1ae)['send'](_0xf9da82);};}exports[_0x231a('0x2e')]=function(_0x4b719b,_0x417096){var _0x32c655={'raw':![],'where':{'id':_0x4b719b[_0x231a('0x2f')]['id']}},_0x11c850={};_0x11c850[_0x231a('0x30')]=_[_0x231a('0x31')](db[_0x231a('0x32')][_0x231a('0x33')]);_0x11c850[_0x231a('0x34')]=_[_0x231a('0x31')](_0x4b719b[_0x231a('0x34')]);_0x11c850['filters']=_[_0x231a('0x35')](_0x11c850[_0x231a('0x30')],_0x11c850[_0x231a('0x34')]);_0x32c655[_0x231a('0x36')]=_[_0x231a('0x35')](_0x11c850[_0x231a('0x30')],qs[_0x231a('0x37')](_0x4b719b['query'][_0x231a('0x37')]));_0x32c655[_0x231a('0x36')]=_0x32c655['attributes'][_0x231a('0x38')]?_0x32c655[_0x231a('0x36')]:_0x11c850[_0x231a('0x30')];if(_0x4b719b[_0x231a('0x34')][_0x231a('0x39')]){_0x32c655[_0x231a('0x3a')]=[{'all':!![]}];}_0x32c655=_[_0x231a('0x3b')]({},_0x32c655,_0x4b719b[_0x231a('0x3c')]);return db['DashboardItem']['find'](_0x32c655)['then'](handleEntityNotFound(_0x417096,null))[_0x231a('0x29')](respondWithResult(_0x417096,null))['catch'](handleError(_0x417096,null));};exports['destroy']=function(_0x2a7356,_0x1f8756){return db[_0x231a('0x32')]['find']({'where':{'id':_0x2a7356[_0x231a('0x2f')]['id']}})[_0x231a('0x29')](handleEntityNotFound(_0x1f8756,null))[_0x231a('0x29')](removeEntity(_0x1f8756,null))[_0x231a('0x3d')](handleError(_0x1f8756,null));};function widgetAttributes(_0x56fc7d){try{switch(_0x56fc7d['type']){case'iframe':return[{'name':_0x231a('0x3e'),'value':_0x56fc7d[_0x231a('0x3e')]||(_0x56fc7d[_0x231a('0x3f')]&&_0x56fc7d[_0x231a('0x3f')][0x0]?_0x56fc7d[_0x231a('0x3f')][0x0][_0x231a('0x40')]:undefined)||'https://'}];case _0x231a('0x41'):return[{'name':_0x231a('0x42'),'value':_0x56fc7d['attrPath']||(_0x56fc7d[_0x231a('0x3f')]&&_0x56fc7d[_0x231a('0x3f')][0x0]?_0x56fc7d[_0x231a('0x3f')][0x0]['value']:undefined)||''}];case _0x231a('0x43'):return[{'name':_0x231a('0x44'),'value':_0x56fc7d[_0x231a('0x44')]||(_0x56fc7d['attrs']&&_0x56fc7d['attrs'][0x0]?_0x56fc7d[_0x231a('0x3f')][0x0][_0x231a('0x40')]:undefined)||_0x231a('0x45')},{'name':_0x231a('0x46'),'value':_0x56fc7d[_0x231a('0x46')]||(_0x56fc7d['attrs']&&_0x56fc7d[_0x231a('0x3f')][0x1]?_0x56fc7d[_0x231a('0x3f')][0x1][_0x231a('0x40')]:undefined)||_0x231a('0x47')},{'name':_0x231a('0x48'),'value':_0x56fc7d[_0x231a('0x48')]||(_0x56fc7d[_0x231a('0x3f')]&&_0x56fc7d[_0x231a('0x3f')][0x2]?_0x56fc7d['attrs'][0x2]['value']:undefined)||0xc}];case _0x231a('0x49'):return[{'name':'attrMetric','value':_0x56fc7d[_0x231a('0x4a')]||(_0x56fc7d[_0x231a('0x3f')]&&_0x56fc7d[_0x231a('0x3f')][0x0]?_0x56fc7d[_0x231a('0x3f')][0x0][_0x231a('0x40')]:undefined)||'total'},{'name':_0x231a('0x4b'),'value':_0x56fc7d['attrVoiceQueues']||(_0x56fc7d['attrs']&&_0x56fc7d['attrs'][0x1]?_0x56fc7d[_0x231a('0x3f')][0x1][_0x231a('0x40')]:undefined)||[]},{'name':_0x231a('0x48'),'value':_0x56fc7d[_0x231a('0x48')]||(_0x56fc7d[_0x231a('0x3f')]&&_0x56fc7d[_0x231a('0x3f')][0x2]?_0x56fc7d[_0x231a('0x3f')][0x2][_0x231a('0x40')]:undefined)||0x14}];case'multibar-chart':case _0x231a('0x4c'):return[{'name':'attrSerie1','value':_0x56fc7d[_0x231a('0x4d')]||(_0x56fc7d[_0x231a('0x3f')]&&_0x56fc7d[_0x231a('0x3f')][0x0]?_0x56fc7d['attrs'][0x0][_0x231a('0x40')]:undefined)||'total'},{'name':_0x231a('0x4e'),'value':_0x56fc7d['attrSerie2']||(_0x56fc7d['attrs']&&_0x56fc7d[_0x231a('0x3f')][0x1]?_0x56fc7d[_0x231a('0x3f')][0x1][_0x231a('0x40')]:undefined)||null},{'name':_0x231a('0x4f'),'value':_0x56fc7d[_0x231a('0x4f')]||(_0x56fc7d['attrs']&&_0x56fc7d[_0x231a('0x3f')][0x2]?_0x56fc7d['attrs'][0x2][_0x231a('0x40')]:undefined)||null},{'name':_0x231a('0x4b'),'value':_0x56fc7d[_0x231a('0x4b')]||(_0x56fc7d['attrs']&&_0x56fc7d[_0x231a('0x3f')][0x3]?_0x56fc7d[_0x231a('0x3f')][0x3][_0x231a('0x40')]:undefined)||[]}];case'web-report':return[{'name':_0x231a('0x50'),'type':_0x56fc7d[_0x231a('0x51')]||(_0x56fc7d[_0x231a('0x3f')]&&_0x56fc7d[_0x231a('0x3f')][0x0]?_0x56fc7d['attrs'][0x0]['type']:undefined)||null,'value':_0x56fc7d['attrReport']||(_0x56fc7d[_0x231a('0x3f')]&&_0x56fc7d['attrs'][0x0]?_0x56fc7d['attrs'][0x0][_0x231a('0x40')]:undefined)||null},{'name':_0x231a('0x52'),'value':_0x56fc7d['attrRefresh']||(_0x56fc7d[_0x231a('0x3f')]&&_0x56fc7d[_0x231a('0x3f')][0x1]?_0x56fc7d[_0x231a('0x3f')][0x1][_0x231a('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x252e88){logger[_0x231a('0x2b')](_0x231a('0x53'),JSON[_0x231a('0x54')](_0x252e88));return[];}}exports['create']=function(_0x106078,_0x4981bd){if(_0x106078[_0x231a('0x55')]){_0x106078[_0x231a('0x55')]['attrs']=widgetAttributes(_0x106078[_0x231a('0x55')]);}return db[_0x231a('0x32')][_0x231a('0x56')](_0x106078['body'],{})[_0x231a('0x29')](respondWithResult(_0x4981bd,0xc9))['catch'](handleError(_0x4981bd,null));};exports['update']=function(_0x487032,_0x383e0c){if(_0x487032['body']['id']){delete _0x487032[_0x231a('0x55')]['id'];}_0x487032[_0x231a('0x55')][_0x231a('0x3f')]=widgetAttributes(_0x487032['body']);return db[_0x231a('0x32')][_0x231a('0x57')]({'where':{'id':_0x487032[_0x231a('0x2f')]['id']}})['then'](handleEntityNotFound(_0x383e0c,null))[_0x231a('0x29')](saveUpdates(_0x487032[_0x231a('0x55')],null))['then'](respondWithResult(_0x383e0c,null))['catch'](handleError(_0x383e0c,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index fd49d7f..e7201c9 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 _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 +var _0x09f1=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0xcf82b2,_0x49ab9a){var _0x4275e9=function(_0x5b768f){while(--_0x5b768f){_0xcf82b2['push'](_0xcf82b2['shift']());}};_0x4275e9(++_0x49ab9a);}(_0x09f1,0xbf));var _0x109f=function(_0x29c579,_0x572b71){_0x29c579=_0x29c579-0x0;var _0x65a95a=_0x09f1[_0x29c579];return _0x65a95a;};'use strict';var EventEmitter=require(_0x109f('0x0'));var DashboardItem=require(_0x109f('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x109f('0x2')](0x0);var events={'afterCreate':_0x109f('0x3'),'afterUpdate':_0x109f('0x4'),'afterDestroy':_0x109f('0x5')};function emitEvent(_0x1acd97){return function(_0xba0ea1,_0x11ac9d,_0x3c5370){DashboardItemEvents[_0x109f('0x6')](_0x1acd97+':'+_0xba0ea1['id'],_0xba0ea1);DashboardItemEvents[_0x109f('0x6')](_0x1acd97,_0xba0ea1);_0x3c5370(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x109f('0x7')](e,emitEvent(event));}}module[_0x109f('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index d55121c..705e698 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 _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 +var _0xcff9=['rimraf','../../config/environment','DashboardItem','dashboard_items','util','../../config/logger','moment','bluebird','path'];(function(_0x23bea4,_0x38a38){var _0xb54789=function(_0x2a5608){while(--_0x2a5608){_0x23bea4['push'](_0x23bea4['shift']());}};_0xb54789(++_0x38a38);}(_0xcff9,0x8b));var _0x9cff=function(_0x5847f2,_0x5c06dd){_0x5847f2=_0x5847f2-0x0;var _0x18ec0d=_0xcff9[_0x5847f2];return _0x18ec0d;};'use strict';var _=require('lodash');var util=require(_0x9cff('0x0'));var logger=require(_0x9cff('0x1'))('api');var moment=require(_0x9cff('0x2'));var BPromise=require(_0x9cff('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9cff('0x4'));var rimraf=require(_0x9cff('0x5'));var config=require(_0x9cff('0x6'));var attributes=require('./dashboardItem.attributes');module['exports']=function(_0x17b65e,_0x48614e){return _0x17b65e['define'](_0x9cff('0x7'),attributes,{'tableName':_0x9cff('0x8'),'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 5b1722e..e8604bb 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 _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 +var _0xdada=['request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s'];(function(_0x22a81b,_0x51edff){var _0x4540aa=function(_0x10b676){while(--_0x10b676){_0x22a81b['push'](_0x22a81b['shift']());}};_0x4540aa(++_0x51edff);}(_0xdada,0x7e));var _0xadad=function(_0x257e7e,_0x59e43f){_0x257e7e=_0x257e7e-0x0;var _0x116184=_0xdada[_0x257e7e];return _0x116184;};'use strict';var _=require(_0xadad('0x0'));var util=require(_0xadad('0x1'));var moment=require(_0xadad('0x2'));var BPromise=require(_0xadad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xadad('0x4'));var db=require(_0xadad('0x5'))['db'];var utils=require(_0xadad('0x6'));var logger=require(_0xadad('0x7'))('rpc');var config=require(_0xadad('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xadad('0x9')]['http']({'port':0x232a});config[_0xadad('0xa')]=_['defaults'](config[_0xadad('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xadad('0xb'))(new Redis(config[_0xadad('0xa')]));require(_0xadad('0xc'))[_0xadad('0xd')](socket);function respondWithRpcPromise(_0x185850,_0x55ebfa,_0x484a12){return new BPromise(function(_0x1fb798,_0x19d94e){return client[_0xadad('0xe')](_0x185850,_0x484a12)[_0xadad('0xf')](function(_0xafa1ec){logger[_0xadad('0x10')](_0xadad('0x11'),_0x55ebfa,_0xadad('0x12'));logger['debug'](_0xadad('0x13'),_0x55ebfa,_0xadad('0x12'),JSON['stringify'](_0xafa1ec));if(_0xafa1ec[_0xadad('0x14')]){if(_0xafa1ec['error'][_0xadad('0x15')]===0x1f4){logger['error'](_0xadad('0x11'),_0x55ebfa,_0xafa1ec[_0xadad('0x14')][_0xadad('0x16')]);return _0x19d94e(_0xafa1ec[_0xadad('0x14')][_0xadad('0x16')]);}logger[_0xadad('0x14')](_0xadad('0x11'),_0x55ebfa,_0xafa1ec[_0xadad('0x14')][_0xadad('0x16')]);return _0x1fb798(_0xafa1ec[_0xadad('0x14')][_0xadad('0x16')]);}else{logger[_0xadad('0x10')](_0xadad('0x11'),_0x55ebfa,_0xadad('0x12'));_0x1fb798(_0xafa1ec[_0xadad('0x17')][_0xadad('0x16')]);}})['catch'](function(_0x30d0a9){logger[_0xadad('0x14')](_0xadad('0x11'),_0x55ebfa,_0x30d0a9);_0x19d94e(_0x30d0a9);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 9a0761e..b8f438e 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 _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 +var _0x81d7=['dashboardItem:','./dashboardItem.events','save','remove','update','emit','register','length'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x81d7,0x1e1));var _0x781d=function(_0x19152e,_0x1e349f){_0x19152e=_0x19152e-0x0;var _0x13cba3=_0x81d7[_0x19152e];return _0x13cba3;};'use strict';var DashboardItemEvents=require(_0x781d('0x0'));var events=[_0x781d('0x1'),_0x781d('0x2'),_0x781d('0x3')];function createListener(_0x1183ae,_0x94e824){return function(_0x7476a7){_0x94e824[_0x781d('0x4')](_0x1183ae,_0x7476a7);};}function removeListener(_0x4299c8,_0x25e19f){return function(){DashboardItemEvents['removeListener'](_0x4299c8,_0x25e19f);};}exports[_0x781d('0x5')]=function(_0x546288){for(var _0x25fe98=0x0,_0xf7b932=events[_0x781d('0x6')];_0x25fe98<_0xf7b932;_0x25fe98++){var _0x4c99f0=events[_0x25fe98];var _0x4b1ca1=createListener(_0x781d('0x7')+_0x4c99f0,_0x546288);DashboardItemEvents['on'](_0x4c99f0,_0x4b1ca1);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 9a8d80d..61de997 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 _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 +var _0xdbf5=['../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','update','delete','exports','util','express','Router','../../components/auth/service'];(function(_0x3a254f,_0x5d4955){var _0xaf1686=function(_0x16cfdb){while(--_0x16cfdb){_0x3a254f['push'](_0x3a254f['shift']());}};_0xaf1686(++_0x5d4955);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x54b44a,_0x70b8b5){_0x54b44a=_0x54b44a-0x0;var _0x4d8bb4=_0xdbf5[_0x54b44a];return _0x4d8bb4;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var auth=require(_0x5dbf('0x3'));var interaction=require(_0x5dbf('0x4'));var config=require(_0x5dbf('0x5'));var controller=require(_0x5dbf('0x6'));router[_0x5dbf('0x7')](_0x5dbf('0x8'),auth[_0x5dbf('0x9')](),controller[_0x5dbf('0xa')]);router[_0x5dbf('0xb')]('/',auth[_0x5dbf('0x9')](),controller[_0x5dbf('0xc')]);router['put'](_0x5dbf('0x8'),auth['isAuthenticated'](),controller[_0x5dbf('0xd')]);router[_0x5dbf('0xe')](_0x5dbf('0x8'),auth[_0x5dbf('0x9')](),controller['destroy']);module[_0x5dbf('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index dadda17..be0ffce 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 _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 +'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index eb46d93..4a6db3b 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 _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 +var _0x41f8=['keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../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','Content-Range','json','reject','save','update','get','UserProfileResource','destroy','then','name','Disposition','rawAttributes','model','map'];(function(_0x4be27a,_0x208578){var _0x10de26=function(_0x551f30){while(--_0x551f30){_0x4be27a['push'](_0x4be27a['shift']());}};_0x10de26(++_0x208578);}(_0x41f8,0x116));var _0x841f=function(_0x4e07d2,_0x3c2365){_0x4e07d2=_0x4e07d2-0x0;var _0x5d2ffa=_0x41f8[_0x4e07d2];return _0x5d2ffa;};'use strict';var pdf=require(_0x841f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x841f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x841f('0x2'));var rp=require(_0x841f('0x3'));var moment=require(_0x841f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x841f('0x5'));var util=require(_0x841f('0x6'));var path=require(_0x841f('0x7'));var sox=require(_0x841f('0x8'));var csv=require(_0x841f('0x9'));var ejs=require(_0x841f('0xa'));var fs=require('fs');var _=require(_0x841f('0xb'));var squel=require(_0x841f('0xc'));var crypto=require(_0x841f('0xd'));var jsforce=require(_0x841f('0xe'));var deskjs=require(_0x841f('0xf'));var toCsv=require(_0x841f('0x9'));var querystring=require(_0x841f('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x841f('0x11'));var qs=require(_0x841f('0x12'));var as=require(_0x841f('0x13'));var hardwareService=require(_0x841f('0x14'));var logger=require(_0x841f('0x15'))(_0x841f('0x16'));var utils=require('../../config/utils');var config=require(_0x841f('0x17'));var db=require(_0x841f('0x18'))['db'];function respondWithStatusCode(_0x35e38d,_0x38f585){_0x38f585=_0x38f585||0xcc;return function(_0x2f5ee1){if(_0x2f5ee1){return _0x35e38d[_0x841f('0x19')](_0x38f585);}return _0x35e38d[_0x841f('0x1a')](_0x38f585)[_0x841f('0x1b')]();};}function respondWithResult(_0x4870da,_0x487623){_0x487623=_0x487623||0xc8;return function(_0x15d2be){if(_0x15d2be){return _0x4870da['status'](_0x487623)['json'](_0x15d2be);}};}function respondWithFilteredResult(_0x1b00e3,_0x26e160){return function(_0x59775f){if(_0x59775f){var _0x53d9d7=_0x59775f[_0x841f('0x1c')],_0x1c9015=_0x26e160[_0x841f('0x1d')],_0x2edadd=_0x26e160[_0x841f('0x1d')]+_0x26e160[_0x841f('0x1e')],_0x5a201b;if(_0x2edadd>=_0x53d9d7){_0x2edadd=_0x53d9d7;_0x5a201b=0xc8;}else{_0x5a201b=0xce;}_0x1b00e3[_0x841f('0x1a')](_0x5a201b);return _0x1b00e3[_0x841f('0x1f')](_0x841f('0x20'),_0x1c9015+'-'+_0x2edadd+'/'+_0x53d9d7)[_0x841f('0x21')](_0x59775f);}return null;};}function patchUpdates(_0x3f6edb){return function(_0x3728e3){try{jsonpatch['apply'](_0x3728e3,_0x3f6edb,!![]);}catch(_0x45200e){return BPromise[_0x841f('0x22')](_0x45200e);}return _0x3728e3[_0x841f('0x23')]();};}function saveUpdates(_0x447b7d,_0x79aa57){return function(_0x3a3545){if(_0x3a3545){return _0x3a3545[_0x841f('0x24')](_0x447b7d)['then'](function(_0x4903d4){return _0x4903d4;});}return null;};}function removeEntity(_0x407724,_0x539544){return function(_0xace08e){if(_0xace08e){return _0xace08e['destroy']()['then'](function(){var _0x40469d=_0xace08e[_0x841f('0x25')]({'plain':!![]});var _0x19371f='Dispositions';return db[_0x841f('0x26')][_0x841f('0x27')]({'where':{'type':_0x19371f,'resourceId':_0x40469d['id']}})[_0x841f('0x28')](function(){return _0xace08e;});})['then'](function(){_0x407724[_0x841f('0x1a')](0xcc)[_0x841f('0x1b')]();});}};}function handleEntityNotFound(_0x1dbb59,_0xc2a7d7){return function(_0x543641){if(!_0x543641){_0x1dbb59[_0x841f('0x19')](0x194);}return _0x543641;};}function handleError(_0x4a11a7,_0x3790bf){_0x3790bf=_0x3790bf||0x1f4;return function(_0x2fb77d){logger['error'](_0x2fb77d['stack']);if(_0x2fb77d[_0x841f('0x29')]){delete _0x2fb77d[_0x841f('0x29')];}_0x4a11a7[_0x841f('0x1a')](_0x3790bf)['send'](_0x2fb77d);};}exports['index']=function(_0xed2e23,_0x44f127){var _0x4de839={},_0x58d004={},_0x2b73a9={'count':0x0,'rows':[]};var _0x3e63b2=_['map'](db[_0x841f('0x2a')][_0x841f('0x2b')],function(_0x3c7a2f){return{'name':_0x3c7a2f['fieldName'],'type':_0x3c7a2f['type']['key']};});_0x58d004[_0x841f('0x2c')]=_[_0x841f('0x2d')](_0x3e63b2,_0x841f('0x29'));_0x58d004['query']=_[_0x841f('0x2e')](_0xed2e23['query']);_0x58d004[_0x841f('0x2f')]=_[_0x841f('0x30')](_0x58d004[_0x841f('0x2c')],_0x58d004[_0x841f('0x31')]);_0x4de839[_0x841f('0x32')]=_[_0x841f('0x30')](_0x58d004[_0x841f('0x2c')],qs['fields'](_0xed2e23[_0x841f('0x31')][_0x841f('0x33')]));_0x4de839[_0x841f('0x32')]=_0x4de839[_0x841f('0x32')][_0x841f('0x34')]?_0x4de839[_0x841f('0x32')]:_0x58d004[_0x841f('0x2c')];if(!_0xed2e23[_0x841f('0x31')][_0x841f('0x35')]('nolimit')){_0x4de839[_0x841f('0x1e')]=qs['limit'](_0xed2e23[_0x841f('0x31')]['limit']);_0x4de839[_0x841f('0x1d')]=qs['offset'](_0xed2e23[_0x841f('0x31')][_0x841f('0x1d')]);}_0x4de839[_0x841f('0x36')]=qs[_0x841f('0x37')](_0xed2e23[_0x841f('0x31')]['sort']);_0x4de839[_0x841f('0x38')]=qs[_0x841f('0x2f')](_[_0x841f('0x39')](_0xed2e23['query'],_0x58d004[_0x841f('0x2f')]),_0x3e63b2);if(_0xed2e23['query']['filter']){_0x4de839[_0x841f('0x38')]=_['merge'](_0x4de839[_0x841f('0x38')],{'$or':_[_0x841f('0x2d')](_0x3e63b2,function(_0x344195){if(_0x344195['type']!==_0x841f('0x3a')){var _0x356a4d={};_0x356a4d[_0x344195[_0x841f('0x29')]]={'$like':'%'+_0xed2e23[_0x841f('0x31')][_0x841f('0x3b')]+'%'};return _0x356a4d;}})});}_0x4de839=_['merge']({},_0x4de839,_0xed2e23['options']);var _0x451eb6={'where':_0x4de839[_0x841f('0x38')]};return db['Disposition'][_0x841f('0x1c')](_0x451eb6)[_0x841f('0x28')](function(_0x4ddb7a){_0x2b73a9[_0x841f('0x1c')]=_0x4ddb7a;if(_0xed2e23['query'][_0x841f('0x3c')]){_0x4de839[_0x841f('0x3d')]=[{'all':!![]}];}return db[_0x841f('0x2a')][_0x841f('0x3e')](_0x4de839);})[_0x841f('0x28')](function(_0x58fce4){_0x2b73a9[_0x841f('0x3f')]=_0x58fce4;return _0x2b73a9;})[_0x841f('0x28')](respondWithFilteredResult(_0x44f127,_0x4de839))[_0x841f('0x40')](handleError(_0x44f127,null));};exports[_0x841f('0x41')]=function(_0x22a741,_0x3ed196){var _0x1d4f16={'raw':!![],'where':{'id':_0x22a741[_0x841f('0x42')]['id']}},_0x3d1d8d={};_0x3d1d8d[_0x841f('0x2c')]=_[_0x841f('0x2e')](db[_0x841f('0x2a')][_0x841f('0x2b')]);_0x3d1d8d[_0x841f('0x31')]=_[_0x841f('0x2e')](_0x22a741['query']);_0x3d1d8d[_0x841f('0x2f')]=_['intersection'](_0x3d1d8d[_0x841f('0x2c')],_0x3d1d8d[_0x841f('0x31')]);_0x1d4f16[_0x841f('0x32')]=_[_0x841f('0x30')](_0x3d1d8d[_0x841f('0x2c')],qs['fields'](_0x22a741[_0x841f('0x31')][_0x841f('0x33')]));_0x1d4f16['attributes']=_0x1d4f16[_0x841f('0x32')]['length']?_0x1d4f16['attributes']:_0x3d1d8d[_0x841f('0x2c')];if(_0x22a741[_0x841f('0x31')][_0x841f('0x3c')]){_0x1d4f16[_0x841f('0x3d')]=[{'all':!![]}];}_0x1d4f16=_[_0x841f('0x43')]({},_0x1d4f16,_0x22a741[_0x841f('0x44')]);return db[_0x841f('0x2a')][_0x841f('0x45')](_0x1d4f16)[_0x841f('0x28')](handleEntityNotFound(_0x3ed196,null))[_0x841f('0x28')](respondWithResult(_0x3ed196,null))[_0x841f('0x40')](handleError(_0x3ed196,null));};exports['create']=function(_0x1240ec,_0x57a63e){return db[_0x841f('0x2a')][_0x841f('0x46')](_0x1240ec[_0x841f('0x47')],{})['then'](function(_0x43626d){var _0x43401f=_0x1240ec[_0x841f('0x48')][_0x841f('0x25')]({'plain':!![]});if(!_0x43401f)throw new Error(_0x841f('0x49'));if(_0x43401f[_0x841f('0x4a')]===_0x841f('0x48')){var _0x56fb3d=_0x43626d[_0x841f('0x25')]({'plain':!![]});var _0x2745b4=_0x841f('0x4b');return db[_0x841f('0x4c')]['find']({'where':{'name':_0x2745b4,'userProfileId':_0x43401f[_0x841f('0x4d')]},'raw':!![]})[_0x841f('0x28')](function(_0x3ef9cc){if(_0x3ef9cc&&_0x3ef9cc[_0x841f('0x4e')]===0x0){return db[_0x841f('0x26')][_0x841f('0x46')]({'name':_0x56fb3d[_0x841f('0x29')],'resourceId':_0x56fb3d['id'],'type':_0x3ef9cc[_0x841f('0x29')],'sectionId':_0x3ef9cc['id']},{})[_0x841f('0x28')](function(){return _0x43626d;});}else{return _0x43626d;}})[_0x841f('0x40')](function(_0x298a20){logger[_0x841f('0x4f')](_0x841f('0x50'),_0x298a20);throw _0x298a20;});}return _0x43626d;})[_0x841f('0x28')](respondWithResult(_0x57a63e,0xc9))['catch'](handleError(_0x57a63e,null));};exports[_0x841f('0x24')]=function(_0xca192e,_0x28d3d9){if(_0xca192e[_0x841f('0x47')]['id']){delete _0xca192e[_0x841f('0x47')]['id'];}return db[_0x841f('0x2a')][_0x841f('0x45')]({'where':{'id':_0xca192e[_0x841f('0x42')]['id']}})['then'](handleEntityNotFound(_0x28d3d9,null))[_0x841f('0x28')](saveUpdates(_0xca192e[_0x841f('0x47')],null))[_0x841f('0x28')](respondWithResult(_0x28d3d9,null))[_0x841f('0x40')](handleError(_0x28d3d9,null));};exports[_0x841f('0x27')]=function(_0x4928f3,_0x5f0d8f){return db[_0x841f('0x2a')][_0x841f('0x45')]({'where':{'id':_0x4928f3[_0x841f('0x42')]['id']}})['then'](handleEntityNotFound(_0x5f0d8f,null))[_0x841f('0x28')](removeEntity(_0x5f0d8f,null))['catch'](handleError(_0x5f0d8f,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index ac2b7df..d425553 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 _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 +var _0xc92f=['name','ListId','name_chat','ChatWebsiteId','name_mail','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','define','tools_dispositions'];(function(_0x52a9d3,_0x32c240){var _0x343278=function(_0x1a1e94){while(--_0x1a1e94){_0x52a9d3['push'](_0x52a9d3['shift']());}};_0x343278(++_0x32c240);}(_0xc92f,0xf3));var _0xfc92=function(_0x4c0293,_0x5b20fe){_0x4c0293=_0x4c0293-0x0;var _0x26ee1c=_0xc92f[_0x4c0293];return _0x26ee1c;};'use strict';var _=require(_0xfc92('0x0'));var util=require(_0xfc92('0x1'));var logger=require('../../config/logger')(_0xfc92('0x2'));var moment=require(_0xfc92('0x3'));var BPromise=require(_0xfc92('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfc92('0x5'));var rimraf=require(_0xfc92('0x6'));var config=require(_0xfc92('0x7'));var attributes=require('./disposition.attributes');module['exports']=function(_0x930bab,_0x47abee){return _0x930bab[_0xfc92('0x8')]('Disposition',attributes,{'tableName':_0xfc92('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xfc92('0xa'),_0xfc92('0xb')]},{'unique':!![],'name':_0xfc92('0xc'),'fields':['name',_0xfc92('0xd')]},{'unique':!![],'name':_0xfc92('0xe'),'fields':[_0xfc92('0xa'),'MailAccountId']},{'unique':!![],'name':_0xfc92('0xf'),'fields':[_0xfc92('0xa'),_0xfc92('0x10')]},{'unique':!![],'name':_0xfc92('0x11'),'fields':[_0xfc92('0xa'),_0xfc92('0x12')]},{'unique':!![],'name':_0xfc92('0x13'),'fields':[_0xfc92('0xa'),_0xfc92('0x14')]},{'unique':!![],'name':_0xfc92('0x15'),'fields':[_0xfc92('0xa'),_0xfc92('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index d3bb0e8..699f21c 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 _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 +var _0xf3f6=['stringify','error','code','message','Disposition,\x20%s,\x20%s','result','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent'];(function(_0x204894,_0x50f992){var _0x5a7c0=function(_0x1079c4){while(--_0x1079c4){_0x204894['push'](_0x204894['shift']());}};_0x5a7c0(++_0x50f992);}(_0xf3f6,0x132));var _0x6f3f=function(_0x980b9b,_0x2e2dad){_0x980b9b=_0x980b9b-0x0;var _0x20bb63=_0xf3f6[_0x980b9b];return _0x20bb63;};'use strict';var _=require(_0x6f3f('0x0'));var util=require(_0x6f3f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6f3f('0x2'));var fs=require('fs');var Redis=require(_0x6f3f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f3f('0x4'));var logger=require(_0x6f3f('0x5'))(_0x6f3f('0x6'));var config=require(_0x6f3f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6f3f('0x8')][_0x6f3f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46c439,_0x45cbb3,_0x3dde2d){return new BPromise(function(_0x5609b6,_0x5c10c2){return client[_0x6f3f('0xa')](_0x46c439,_0x3dde2d)[_0x6f3f('0xb')](function(_0x3c70b4){logger[_0x6f3f('0xc')]('Disposition,\x20%s,\x20%s',_0x45cbb3,'request\x20sent');logger['debug']('Disposition,\x20%s,\x20%s,\x20%s',_0x45cbb3,_0x6f3f('0xd'),JSON[_0x6f3f('0xe')](_0x3c70b4));if(_0x3c70b4[_0x6f3f('0xf')]){if(_0x3c70b4[_0x6f3f('0xf')][_0x6f3f('0x10')]===0x1f4){logger['error']('Disposition,\x20%s,\x20%s',_0x45cbb3,_0x3c70b4['error']['message']);return _0x5c10c2(_0x3c70b4[_0x6f3f('0xf')][_0x6f3f('0x11')]);}logger[_0x6f3f('0xf')](_0x6f3f('0x12'),_0x45cbb3,_0x3c70b4[_0x6f3f('0xf')][_0x6f3f('0x11')]);return _0x5609b6(_0x3c70b4[_0x6f3f('0xf')][_0x6f3f('0x11')]);}else{logger[_0x6f3f('0xc')](_0x6f3f('0x12'),_0x45cbb3,'request\x20sent');_0x5609b6(_0x3c70b4[_0x6f3f('0x13')][_0x6f3f('0x11')]);}})['catch'](function(_0x4b94e7){logger[_0x6f3f('0xf')](_0x6f3f('0x12'),_0x45cbb3,_0x4b94e7);_0x5c10c2(_0x4b94e7);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 76e146b..335bc5a 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 _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 +var _0xb2f3=['show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id'];(function(_0x1b2071,_0x3b3149){var _0x1598aa=function(_0x5460bd){while(--_0x5460bd){_0x1b2071['push'](_0x1b2071['shift']());}};_0x1598aa(++_0x3b3149);}(_0xb2f3,0xfd));var _0x3b2f=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xb2f3[_0x2112d4];return _0x434972;};'use strict';var multer=require(_0x3b2f('0x0'));var util=require(_0x3b2f('0x1'));var path=require(_0x3b2f('0x2'));var timeout=require(_0x3b2f('0x3'));var express=require(_0x3b2f('0x4'));var router=express[_0x3b2f('0x5')]();var auth=require(_0x3b2f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3b2f('0x7'));var controller=require(_0x3b2f('0x8'));router[_0x3b2f('0x9')]('/',auth[_0x3b2f('0xa')](),controller[_0x3b2f('0xb')]);router[_0x3b2f('0x9')](_0x3b2f('0xc'),auth['isAuthenticated'](),controller[_0x3b2f('0xd')]);router['post']('/',auth[_0x3b2f('0xa')](),controller[_0x3b2f('0xe')]);router[_0x3b2f('0xf')](_0x3b2f('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x3b2f('0x10')](_0x3b2f('0xc'),auth[_0x3b2f('0xa')](),controller[_0x3b2f('0x11')]);module[_0x3b2f('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 3c1c514..8d2f97b 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 _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 +var _0xe48c=['STRING','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','ENUM','yes'];(function(_0x4bb353,_0x23d4de){var _0x46a8bb=function(_0x5af20b){while(--_0x5af20b){_0x4bb353['push'](_0x4bb353['shift']());}};_0x46a8bb(++_0x23d4de);}(_0xe48c,0x147));var _0xce48=function(_0x3f2c9b,_0x277794){_0x3f2c9b=_0x3f2c9b-0x0;var _0x542039=_0xe48c[_0x3f2c9b];return _0x542039;};'use strict';var Sequelize=require(_0xce48('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0xce48('0x1')](_0xce48('0x2'),'no'),'defaultValue':_0xce48('0x2')},'headerinfo':{'type':Sequelize[_0xce48('0x3')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':_0xce48('0x4')},'minrate':{'type':Sequelize[_0xce48('0x1')](_0xce48('0x5'),_0xce48('0x6'),_0xce48('0x7'),_0xce48('0x8'),_0xce48('0x9'),_0xce48('0xa')),'defaultValue':_0xce48('0x6')},'maxrate':{'type':Sequelize[_0xce48('0x1')](_0xce48('0x5'),_0xce48('0x6'),'7200',_0xce48('0x8'),_0xce48('0x9'),_0xce48('0xa')),'defaultValue':_0xce48('0xa')},'modem':{'type':Sequelize[_0xce48('0x3')],'defaultValue':_0xce48('0xb')},'gateway':{'type':Sequelize[_0xce48('0x3')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xce48('0x3')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xce48('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xce48('0x1')](_0xce48('0xd'),'IAX','DADHI',_0xce48('0xe')),'defaultValue':_0xce48('0xd')},'key':{'type':Sequelize[_0xce48('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xce48('0xf')],'defaultValue':function(){return _0xce48('0x10');}},'notificationSound':{'type':Sequelize[_0xce48('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xce48('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xce48('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xce48('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xce48('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xce48('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xce48('0xc')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xce48('0x11')],'defaultValue':![],'comment':_0xce48('0x12'),'set':function(_0x251a67){if(!_0x251a67)this[_0xce48('0x13')](_0xce48('0x14'),null);this[_0xce48('0x13')](_0xce48('0x15'),_0x251a67);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 55a871b..623f546 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 _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 +var _0xb125=['dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./faxAccount.socket','register','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','info','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','FaxAccounts','UserProfileResource','stack','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','FaxAccount','findAll','show','create','body','user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','FaxAccountId','Disposition','getDispositions','nolimit','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addInteraction','FaxInteraction','omit','CmContact','Contact','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','priority','getApplications','context','from-voip-provider','exten','localstationid','app','Fax\x20Extension','push','Answer','CDR(type)=inbound-fax','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','getMessages','$gte','split','format','FaxMessage','CmList','List','Contacts','DESC','attachments','join','root','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','out','filename','Messages','Contact\x20not\x20found','ContactId'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xb125,0xcd));var _0x5b12=function(_0x3cadff,_0xf88fa1){_0x3cadff=_0x3cadff-0x0;var _0x6c9fbe=_0xb125[_0x3cadff];return _0x6c9fbe;};'use strict';var pdf=require(_0x5b12('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5b12('0x1'));var zipdir=require(_0x5b12('0x2'));var jsonpatch=require(_0x5b12('0x3'));var rp=require('request-promise');var moment=require(_0x5b12('0x4'));var BPromise=require(_0x5b12('0x5'));var Mustache=require(_0x5b12('0x6'));var util=require('util');var path=require(_0x5b12('0x7'));var sox=require(_0x5b12('0x8'));var csv=require(_0x5b12('0x9'));var ejs=require(_0x5b12('0xa'));var fs=require('fs');var _=require(_0x5b12('0xb'));var squel=require(_0x5b12('0xc'));var crypto=require(_0x5b12('0xd'));var jsforce=require(_0x5b12('0xe'));var deskjs=require(_0x5b12('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5b12('0x10'));var Redis=require(_0x5b12('0x11'));var authService=require(_0x5b12('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5b12('0x13'));var logger=require(_0x5b12('0x14'))(_0x5b12('0x15'));var utils=require(_0x5b12('0x16'));var config=require('../../config/environment');var db=require(_0x5b12('0x17'))['db'];config[_0x5b12('0x18')]=_[_0x5b12('0x19')](config[_0x5b12('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x5b12('0x1a'))(new Redis(config[_0x5b12('0x18')]));require(_0x5b12('0x1b'))[_0x5b12('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5b12('0x1d')][_0x5b12('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x5b12('0x1e')]({'port':0x232a});function checkPasswordPattern(_0xd6986c,_0x551c8f,_0x32275f){if(_0x32275f){var _0x244cd6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x244cd6[_0x5b12('0x1f')](_0x551c8f)){return _0xd6986c;}else{throw new db['Sequelize']['ValidationError'](_0x5b12('0x20'));}}else{return _0xd6986c;}}function respondWithRpcPromise(_0x1936a8,_0x47d6c7,_0x3dbe9c,_0x36bbfd){return new BPromise(function(_0x3b64a9,_0x4b37fa){var _0x29951b=_0x36bbfd||client;return _0x29951b[_0x5b12('0x21')](_0x1936a8,_0x3dbe9c)['then'](function(_0x236142){logger[_0x5b12('0x22')]('FaxAccount,\x20%s,\x20%s',_0x47d6c7,_0x5b12('0x23'));logger['debug'](_0x5b12('0x24'),_0x47d6c7,_0x5b12('0x23'),JSON[_0x5b12('0x25')](_0x236142));if(_0x236142[_0x5b12('0x26')]){if(_0x236142[_0x5b12('0x26')][_0x5b12('0x27')]===0x1f4){logger['error'](_0x5b12('0x28'),_0x47d6c7,_0x236142[_0x5b12('0x26')][_0x5b12('0x29')]);return _0x4b37fa(_0x236142[_0x5b12('0x26')][_0x5b12('0x29')]);}logger[_0x5b12('0x26')]('FaxAccount,\x20%s,\x20%s',_0x47d6c7,_0x236142['error']['message']);return _0x3b64a9(_0x236142[_0x5b12('0x26')][_0x5b12('0x29')]);}else{logger[_0x5b12('0x22')]('FaxAccount,\x20%s,\x20%s',_0x47d6c7,_0x5b12('0x23'));_0x3b64a9(_0x236142[_0x5b12('0x2a')][_0x5b12('0x29')]);}})[_0x5b12('0x2b')](function(_0x858e6a){logger[_0x5b12('0x26')]('FaxAccount,\x20%s,\x20%s',_0x47d6c7,_0x858e6a);_0x4b37fa(_0x858e6a);});});}function respondWithStatusCode(_0xf1ba51,_0x2ab451){_0x2ab451=_0x2ab451||0xcc;return function(_0xefad8e){if(_0xefad8e){return _0xf1ba51[_0x5b12('0x2c')](_0x2ab451);}return _0xf1ba51[_0x5b12('0x2d')](_0x2ab451)[_0x5b12('0x2e')]();};}function respondWithResult(_0x2291e2,_0x1616fa){_0x1616fa=_0x1616fa||0xc8;return function(_0x440838){if(_0x440838){return _0x2291e2[_0x5b12('0x2d')](_0x1616fa)[_0x5b12('0x2f')](_0x440838);}};}function respondWithFilteredResult(_0x1a2902,_0x5c174e){return function(_0x1d6927){if(_0x1d6927){var _0x14f8f2=_0x1d6927[_0x5b12('0x30')],_0x1c59da=_0x5c174e['offset'],_0x3e04b0=_0x5c174e[_0x5b12('0x31')]+_0x5c174e[_0x5b12('0x32')],_0x5d8fba;if(_0x3e04b0>=_0x14f8f2){_0x3e04b0=_0x14f8f2;_0x5d8fba=0xc8;}else{_0x5d8fba=0xce;}_0x1a2902['status'](_0x5d8fba);return _0x1a2902[_0x5b12('0x33')](_0x5b12('0x34'),_0x1c59da+'-'+_0x3e04b0+'/'+_0x14f8f2)[_0x5b12('0x2f')](_0x1d6927);}return null;};}function patchUpdates(_0x2207e2){return function(_0x37650d){try{jsonpatch[_0x5b12('0x35')](_0x37650d,_0x2207e2,!![]);}catch(_0x684e23){return BPromise['reject'](_0x684e23);}return _0x37650d[_0x5b12('0x36')]();};}function saveUpdates(_0x17a647,_0x33833d){return function(_0x47adfb){if(_0x47adfb){return _0x47adfb[_0x5b12('0x37')](_0x17a647)[_0x5b12('0x38')](function(_0x370f35){return _0x370f35;});}return null;};}function removeEntity(_0xe5dc06,_0xbe0a57){return function(_0x239f9f){if(_0x239f9f){return _0x239f9f[_0x5b12('0x39')]()['then'](function(){var _0x13d7b4=_0x239f9f[_0x5b12('0x3a')]({'plain':!![]});var _0x395af6=_0x5b12('0x3b');return db[_0x5b12('0x3c')][_0x5b12('0x39')]({'where':{'type':_0x395af6,'resourceId':_0x13d7b4['id']}})['then'](function(){return _0x239f9f;});})[_0x5b12('0x38')](function(){_0xe5dc06[_0x5b12('0x2d')](0xcc)[_0x5b12('0x2e')]();});}};}function handleEntityNotFound(_0x56cab7,_0x1a105d){return function(_0x1a51e3){if(!_0x1a51e3){_0x56cab7['sendStatus'](0x194);}return _0x1a51e3;};}function handleError(_0x246915,_0x1f8c35){_0x1f8c35=_0x1f8c35||0x1f4;return function(_0x2088c4){logger[_0x5b12('0x26')](_0x2088c4[_0x5b12('0x3d')]);if(_0x2088c4['name']){delete _0x2088c4['name'];}_0x246915['status'](_0x1f8c35)[_0x5b12('0x3e')](_0x2088c4);};}exports[_0x5b12('0x3f')]=function(_0x3412d8,_0x233bd5){var _0x1a708e={'include':[{'model':db[_0x5b12('0x40')],'as':_0x5b12('0x41')}]},_0x50d5a5={},_0x1e712d={'count':0x0,'rows':[]};var _0x38f9d5=_[_0x5b12('0x42')](db['FaxAccount'][_0x5b12('0x43')],function(_0x3939bf){return{'name':_0x3939bf[_0x5b12('0x44')],'type':_0x3939bf['type']['key']};});_0x50d5a5[_0x5b12('0x45')]=_[_0x5b12('0x42')](_0x38f9d5,_0x5b12('0x46'));_0x50d5a5['query']=_[_0x5b12('0x47')](_0x3412d8[_0x5b12('0x48')]);_0x50d5a5[_0x5b12('0x49')]=_[_0x5b12('0x4a')](_0x50d5a5[_0x5b12('0x45')],_0x50d5a5['query']);_0x1a708e[_0x5b12('0x4b')]=_['intersection'](_0x50d5a5[_0x5b12('0x45')],qs[_0x5b12('0x4c')](_0x3412d8[_0x5b12('0x48')][_0x5b12('0x4c')]));_0x1a708e[_0x5b12('0x4b')]=_0x1a708e[_0x5b12('0x4b')][_0x5b12('0x4d')]?_0x1a708e[_0x5b12('0x4b')]:_0x50d5a5[_0x5b12('0x45')];if(!_0x3412d8[_0x5b12('0x48')][_0x5b12('0x4e')]('nolimit')){_0x1a708e['limit']=qs[_0x5b12('0x32')](_0x3412d8[_0x5b12('0x48')]['limit']);_0x1a708e[_0x5b12('0x31')]=qs[_0x5b12('0x31')](_0x3412d8['query'][_0x5b12('0x31')]);}_0x1a708e[_0x5b12('0x4f')]=qs[_0x5b12('0x50')](_0x3412d8[_0x5b12('0x48')]['sort']);_0x1a708e['where']=qs['filters'](_[_0x5b12('0x51')](_0x3412d8['query'],_0x50d5a5['filters']),_0x38f9d5);if(_0x3412d8[_0x5b12('0x48')][_0x5b12('0x52')]){_0x1a708e[_0x5b12('0x53')]=_[_0x5b12('0x54')](_0x1a708e[_0x5b12('0x53')],{'$or':_[_0x5b12('0x42')](_0x38f9d5,function(_0x2de37e){if(_0x2de37e[_0x5b12('0x55')]!==_0x5b12('0x56')){var _0x16fd94={};_0x16fd94[_0x2de37e[_0x5b12('0x46')]]={'$like':'%'+_0x3412d8[_0x5b12('0x48')][_0x5b12('0x52')]+'%'};return _0x16fd94;}})});}_0x1a708e=_[_0x5b12('0x54')]({},_0x1a708e,_0x3412d8[_0x5b12('0x57')]);var _0x28f92c={'where':_0x1a708e['where']};return db['FaxAccount'][_0x5b12('0x30')](_0x28f92c)['then'](function(_0x1ac963){_0x1e712d[_0x5b12('0x30')]=_0x1ac963;if(_0x3412d8[_0x5b12('0x48')][_0x5b12('0x58')]){_0x1a708e[_0x5b12('0x59')]=[{'all':!![]}];}return db[_0x5b12('0x5a')][_0x5b12('0x5b')](_0x1a708e);})['then'](function(_0x2e7a41){_0x1e712d['rows']=_0x2e7a41;return _0x1e712d;})[_0x5b12('0x38')](respondWithFilteredResult(_0x233bd5,_0x1a708e))[_0x5b12('0x2b')](handleError(_0x233bd5,null));};exports[_0x5b12('0x5c')]=function(_0x4ca65b,_0x138cbd){var _0x1af521={'raw':![],'where':{'id':_0x4ca65b['params']['id']},'include':[{'model':db[_0x5b12('0x40')],'as':'mandatoryDispositionPause'}]},_0x24523e={};_0x24523e[_0x5b12('0x45')]=_[_0x5b12('0x47')](db[_0x5b12('0x5a')]['rawAttributes']);_0x24523e[_0x5b12('0x48')]=_['keys'](_0x4ca65b[_0x5b12('0x48')]);_0x24523e[_0x5b12('0x49')]=_[_0x5b12('0x4a')](_0x24523e[_0x5b12('0x45')],_0x24523e[_0x5b12('0x48')]);_0x1af521[_0x5b12('0x4b')]=_[_0x5b12('0x4a')](_0x24523e[_0x5b12('0x45')],qs[_0x5b12('0x4c')](_0x4ca65b[_0x5b12('0x48')][_0x5b12('0x4c')]));_0x1af521[_0x5b12('0x4b')]=_0x1af521[_0x5b12('0x4b')][_0x5b12('0x4d')]?_0x1af521[_0x5b12('0x4b')]:_0x24523e['model'];if(_0x4ca65b[_0x5b12('0x48')][_0x5b12('0x58')]){_0x1af521['include']=[{'all':!![]}];}_0x1af521=_['merge']({},_0x1af521,_0x4ca65b[_0x5b12('0x57')]);return db[_0x5b12('0x5a')]['find'](_0x1af521)['then'](handleEntityNotFound(_0x138cbd,null))[_0x5b12('0x38')](respondWithResult(_0x138cbd,null))[_0x5b12('0x2b')](handleError(_0x138cbd,null));};exports[_0x5b12('0x5d')]=function(_0x5f4336,_0x177404){return db['FaxAccount'][_0x5b12('0x5d')](_0x5f4336[_0x5b12('0x5e')],{})['then'](function(_0x5c6712){var _0x361254=_0x5f4336[_0x5b12('0x5f')][_0x5b12('0x3a')]({'plain':!![]});if(!_0x361254)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x361254[_0x5b12('0x60')]===_0x5b12('0x5f')){var _0x2dd4c6=_0x5c6712[_0x5b12('0x3a')]({'plain':!![]});var _0x520cb6=_0x5b12('0x3b');return db[_0x5b12('0x61')][_0x5b12('0x62')]({'where':{'name':_0x520cb6,'userProfileId':_0x361254['userProfileId']},'raw':!![]})[_0x5b12('0x38')](function(_0x539b53){if(_0x539b53&&_0x539b53[_0x5b12('0x63')]===0x0){return db[_0x5b12('0x3c')]['create']({'name':_0x2dd4c6['name'],'resourceId':_0x2dd4c6['id'],'type':_0x539b53[_0x5b12('0x46')],'sectionId':_0x539b53['id']},{})[_0x5b12('0x38')](function(){return _0x5c6712;});}else{return _0x5c6712;}})['catch'](function(_0x5536b5){logger[_0x5b12('0x26')](_0x5b12('0x64'),_0x5536b5);throw _0x5536b5;});}return _0x5c6712;})[_0x5b12('0x38')](respondWithResult(_0x177404,0xc9))[_0x5b12('0x2b')](handleError(_0x177404,null));};exports[_0x5b12('0x37')]=function(_0x450866,_0x4b13cd){if(_0x450866[_0x5b12('0x5e')]['id']){delete _0x450866['body']['id'];}return db[_0x5b12('0x5a')]['find']({'where':{'id':_0x450866[_0x5b12('0x65')]['id']},'include':[{'model':db['Pause'],'as':_0x5b12('0x41')}]})[_0x5b12('0x38')](handleEntityNotFound(_0x4b13cd,null))[_0x5b12('0x38')](saveUpdates(_0x450866['body'],null))['then'](respondWithResult(_0x4b13cd,null))[_0x5b12('0x2b')](handleError(_0x4b13cd,null));};exports[_0x5b12('0x39')]=function(_0x1c66c1,_0x3c592e){return db['FaxAccount'][_0x5b12('0x62')]({'where':{'id':_0x1c66c1[_0x5b12('0x65')]['id']}})[_0x5b12('0x38')](handleEntityNotFound(_0x3c592e,null))[_0x5b12('0x38')](removeEntity(_0x3c592e,null))[_0x5b12('0x2b')](handleError(_0x3c592e,null));};exports['describe']=function(_0x119da3,_0x5576eb){return db[_0x5b12('0x5a')][_0x5b12('0x66')]()[_0x5b12('0x38')](respondWithResult(_0x5576eb,null))[_0x5b12('0x2b')](handleError(_0x5576eb,null));};exports['addDisposition']=function(_0x1ca6f9,_0x1e3de8,_0x31315e){if(_0x1ca6f9['body']['id']){delete _0x1ca6f9[_0x5b12('0x5e')]['id'];}return db[_0x5b12('0x5a')][_0x5b12('0x62')]({'where':{'id':_0x1ca6f9[_0x5b12('0x65')]['id']}})[_0x5b12('0x38')](handleEntityNotFound(_0x1e3de8,null))[_0x5b12('0x38')](function(_0x599692){if(_0x599692){_0x1ca6f9[_0x5b12('0x5e')][_0x5b12('0x67')]=_0x599692['id'];return db[_0x5b12('0x68')][_0x5b12('0x5d')](_0x1ca6f9[_0x5b12('0x5e')]);}})[_0x5b12('0x38')](respondWithResult(_0x1e3de8,null))[_0x5b12('0x2b')](handleError(_0x1e3de8,null));};exports[_0x5b12('0x69')]=function(_0x9c73cf,_0x3b994b,_0x12a4ff){var _0x1cae17={'raw':![],'where':{}};var _0x432e10={};var _0x3fbf12={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x9c73cf[_0x5b12('0x65')]['id']}})[_0x5b12('0x38')](handleEntityNotFound(_0x3b994b,null))[_0x5b12('0x38')](function(_0x273892){if(_0x273892){_0x432e10[_0x5b12('0x45')]=_[_0x5b12('0x47')](db[_0x5b12('0x68')]['rawAttributes']);_0x432e10[_0x5b12('0x48')]=_[_0x5b12('0x47')](_0x9c73cf[_0x5b12('0x48')]);_0x432e10['filters']=_[_0x5b12('0x4a')](_0x432e10[_0x5b12('0x45')],_0x432e10[_0x5b12('0x48')]);_0x1cae17[_0x5b12('0x4b')]=_[_0x5b12('0x4a')](_0x432e10[_0x5b12('0x45')],qs[_0x5b12('0x4c')](_0x9c73cf['query'][_0x5b12('0x4c')]));_0x1cae17[_0x5b12('0x4b')]=_0x1cae17['attributes']['length']?_0x1cae17['attributes']:_0x432e10[_0x5b12('0x45')];if(!_0x9c73cf[_0x5b12('0x48')][_0x5b12('0x4e')](_0x5b12('0x6a'))){_0x1cae17['limit']=qs['limit'](_0x9c73cf[_0x5b12('0x48')][_0x5b12('0x32')]);_0x1cae17[_0x5b12('0x31')]=qs[_0x5b12('0x31')](_0x9c73cf[_0x5b12('0x48')][_0x5b12('0x31')]);}_0x1cae17['order']=qs[_0x5b12('0x50')](_0x9c73cf[_0x5b12('0x48')][_0x5b12('0x50')]);_0x1cae17[_0x5b12('0x53')]=qs[_0x5b12('0x49')](_['pick'](_0x9c73cf[_0x5b12('0x48')],_0x432e10[_0x5b12('0x49')]));_0x1cae17[_0x5b12('0x53')][_0x5b12('0x67')]=_0x273892['id'];if(_0x9c73cf['query']['filter']){_0x1cae17['where']=_[_0x5b12('0x54')](_0x1cae17[_0x5b12('0x53')],{'$or':_[_0x5b12('0x42')](_0x1cae17[_0x5b12('0x4b')],function(_0x543846){var _0x543db1={};_0x543db1[_0x543846]={'$like':'%'+_0x9c73cf['query']['filter']+'%'};return _0x543db1;})});}_0x1cae17=_['merge']({},_0x1cae17,_0x9c73cf[_0x5b12('0x57')]);return db[_0x5b12('0x68')]['count']({'where':_0x1cae17['where']})[_0x5b12('0x38')](function(_0x3aa0be){_0x3fbf12[_0x5b12('0x30')]=_0x3aa0be;if(_0x9c73cf[_0x5b12('0x48')][_0x5b12('0x58')]){_0x1cae17[_0x5b12('0x59')]=[{'all':!![]}];}return db[_0x5b12('0x68')][_0x5b12('0x5b')](_0x1cae17);})[_0x5b12('0x38')](function(_0x45423f){_0x3fbf12[_0x5b12('0x6b')]=_0x45423f;return _0x3fbf12;});}})[_0x5b12('0x38')](respondWithFilteredResult(_0x3b994b,_0x1cae17))[_0x5b12('0x2b')](handleError(_0x3b994b,null));};exports[_0x5b12('0x6c')]=function(_0x1f67f8,_0x4d6c87,_0x1ec4c2){return db['FaxAccount'][_0x5b12('0x62')]({'where':{'id':_0x1f67f8['params']['id']}})[_0x5b12('0x38')](handleEntityNotFound(_0x4d6c87,null))[_0x5b12('0x38')](function(_0x409ee3){if(_0x409ee3){return _0x409ee3['removeDispositions'](_0x1f67f8['query'][_0x5b12('0x6d')]);}})[_0x5b12('0x38')](respondWithStatusCode(_0x4d6c87,null))[_0x5b12('0x2b')](handleError(_0x4d6c87,null));};exports[_0x5b12('0x6e')]=function(_0x51459f,_0x1e2e2f,_0x58b732){if(_0x51459f['body']['id']){delete _0x51459f[_0x5b12('0x5e')]['id'];}return db[_0x5b12('0x5a')][_0x5b12('0x62')]({'where':{'id':_0x51459f['params']['id']}})[_0x5b12('0x38')](handleEntityNotFound(_0x1e2e2f,null))[_0x5b12('0x38')](function(_0x308e43){if(_0x308e43){_0x51459f[_0x5b12('0x5e')]['FaxAccountId']=_0x308e43['id'];return db[_0x5b12('0x6f')][_0x5b12('0x5d')](_0x51459f[_0x5b12('0x5e')]);}})[_0x5b12('0x38')](respondWithResult(_0x1e2e2f,null))[_0x5b12('0x2b')](handleError(_0x1e2e2f,null));};exports[_0x5b12('0x70')]=function(_0xa7e442,_0x9acfca,_0x791b58){var _0x222cc5={'raw':![],'where':{}};var _0x1a2bab={};var _0x1cd0f4={'count':0x0,'rows':[]};return db[_0x5b12('0x5a')][_0x5b12('0x71')]({'where':{'id':_0xa7e442[_0x5b12('0x65')]['id']}})[_0x5b12('0x38')](handleEntityNotFound(_0x9acfca,null))[_0x5b12('0x38')](function(_0xd6c1a0){if(_0xd6c1a0){_0x1a2bab[_0x5b12('0x45')]=_[_0x5b12('0x47')](db[_0x5b12('0x6f')]['rawAttributes']);_0x1a2bab['query']=_[_0x5b12('0x47')](_0xa7e442[_0x5b12('0x48')]);_0x1a2bab[_0x5b12('0x49')]=_[_0x5b12('0x4a')](_0x1a2bab[_0x5b12('0x45')],_0x1a2bab[_0x5b12('0x48')]);_0x222cc5['attributes']=_[_0x5b12('0x4a')](_0x1a2bab[_0x5b12('0x45')],qs[_0x5b12('0x4c')](_0xa7e442[_0x5b12('0x48')][_0x5b12('0x4c')]));_0x222cc5[_0x5b12('0x4b')]=_0x222cc5[_0x5b12('0x4b')]['length']?_0x222cc5[_0x5b12('0x4b')]:_0x1a2bab['model'];if(!_0xa7e442[_0x5b12('0x48')][_0x5b12('0x4e')](_0x5b12('0x6a'))){_0x222cc5['limit']=qs[_0x5b12('0x32')](_0xa7e442[_0x5b12('0x48')]['limit']);_0x222cc5['offset']=qs[_0x5b12('0x31')](_0xa7e442['query'][_0x5b12('0x31')]);}_0x222cc5[_0x5b12('0x4f')]=qs['sort'](_0xa7e442[_0x5b12('0x48')][_0x5b12('0x50')]);_0x222cc5['where']=qs['filters'](_[_0x5b12('0x51')](_0xa7e442['query'],_0x1a2bab[_0x5b12('0x49')]));_0x222cc5[_0x5b12('0x53')][_0x5b12('0x67')]=_0xd6c1a0['id'];if(_0xa7e442[_0x5b12('0x48')]['filter']){_0x222cc5[_0x5b12('0x53')]=_[_0x5b12('0x54')](_0x222cc5['where'],{'$or':_['map'](_0x222cc5['attributes'],function(_0x553ea8){var _0x4ad4ef={};_0x4ad4ef[_0x553ea8]={'$like':'%'+_0xa7e442['query'][_0x5b12('0x52')]+'%'};return _0x4ad4ef;})});}_0x222cc5=_[_0x5b12('0x54')]({},_0x222cc5,_0xa7e442['options']);return db[_0x5b12('0x6f')][_0x5b12('0x30')]({'where':_0x222cc5[_0x5b12('0x53')]})[_0x5b12('0x38')](function(_0x18f73b){_0x1cd0f4[_0x5b12('0x30')]=_0x18f73b;if(_0xa7e442[_0x5b12('0x48')][_0x5b12('0x58')]){_0x222cc5[_0x5b12('0x59')]=[{'all':!![]}];}return db[_0x5b12('0x6f')][_0x5b12('0x5b')](_0x222cc5);})[_0x5b12('0x38')](function(_0x58cf88){_0x1cd0f4[_0x5b12('0x6b')]=_0x58cf88;return _0x1cd0f4;});}})[_0x5b12('0x38')](respondWithFilteredResult(_0x9acfca,_0x222cc5))[_0x5b12('0x2b')](handleError(_0x9acfca,null));};exports[_0x5b12('0x72')]=function(_0x85944a,_0x2ee94d,_0x2572ea){return db[_0x5b12('0x5a')][_0x5b12('0x62')]({'where':{'id':_0x85944a['params']['id']}})[_0x5b12('0x38')](handleEntityNotFound(_0x2ee94d,null))[_0x5b12('0x38')](function(_0x1e1fb4){if(_0x1e1fb4){return _0x1e1fb4[_0x5b12('0x72')](_0x85944a[_0x5b12('0x48')][_0x5b12('0x6d')]);}})[_0x5b12('0x38')](respondWithStatusCode(_0x2ee94d,null))[_0x5b12('0x2b')](handleError(_0x2ee94d,null));};exports[_0x5b12('0x73')]=function(_0x2d6484,_0xeb4c3a,_0x4429f2){return db[_0x5b12('0x74')][_0x5b12('0x62')]({'where':{'id':_0x2d6484[_0x5b12('0x65')]['id']}})['then'](handleEntityNotFound(_0xeb4c3a,null))['then'](function(_0x29d3e8){if(_0x29d3e8){return _0x29d3e8[_0x5b12('0x73')](_0x2d6484[_0x5b12('0x5e')][_0x5b12('0x6d')],_[_0x5b12('0x75')](_0x2d6484['body'],[_0x5b12('0x6d'),'id'])||{});}})[_0x5b12('0x38')](respondWithResult(_0xeb4c3a,null))[_0x5b12('0x2b')](handleError(_0xeb4c3a,null));};exports['getInteractions']=function(_0x3f105c,_0x4d9c0b,_0xaa43b4){var _0x2fa8eb={'raw':![],'where':{}};var _0x42a16f={};var _0x464167={'count':0x0,'rows':[]};return db['FaxAccount'][_0x5b12('0x71')]({'where':{'id':_0x3f105c[_0x5b12('0x65')]['id']}})[_0x5b12('0x38')](handleEntityNotFound(_0x4d9c0b,null))[_0x5b12('0x38')](function(_0x49eaa5){if(_0x49eaa5){_0x42a16f[_0x5b12('0x45')]=_[_0x5b12('0x47')](db[_0x5b12('0x74')][_0x5b12('0x43')]);_0x42a16f[_0x5b12('0x48')]=_[_0x5b12('0x47')](_0x3f105c[_0x5b12('0x48')]);_0x42a16f[_0x5b12('0x49')]=_[_0x5b12('0x4a')](_0x42a16f[_0x5b12('0x45')],_0x42a16f['query']);_0x2fa8eb[_0x5b12('0x4b')]=_[_0x5b12('0x4a')](_0x42a16f[_0x5b12('0x45')],qs[_0x5b12('0x4c')](_0x3f105c[_0x5b12('0x48')]['fields']));_0x2fa8eb['attributes']=_0x2fa8eb[_0x5b12('0x4b')][_0x5b12('0x4d')]?_0x2fa8eb[_0x5b12('0x4b')]:_0x42a16f[_0x5b12('0x45')];if(!_0x3f105c[_0x5b12('0x48')][_0x5b12('0x4e')](_0x5b12('0x6a'))){_0x2fa8eb[_0x5b12('0x32')]=qs[_0x5b12('0x32')](_0x3f105c[_0x5b12('0x48')][_0x5b12('0x32')]);_0x2fa8eb[_0x5b12('0x31')]=qs[_0x5b12('0x31')](_0x3f105c[_0x5b12('0x48')][_0x5b12('0x31')]);}_0x2fa8eb[_0x5b12('0x4f')]=qs[_0x5b12('0x50')](_0x3f105c[_0x5b12('0x48')][_0x5b12('0x50')]);_0x2fa8eb[_0x5b12('0x53')]=qs[_0x5b12('0x49')](_[_0x5b12('0x51')](_0x3f105c[_0x5b12('0x48')],_0x42a16f[_0x5b12('0x49')]));_0x2fa8eb['where'][_0x5b12('0x67')]=_0x49eaa5['id'];if(_0x3f105c['query']['filter']){_0x2fa8eb[_0x5b12('0x53')]=_[_0x5b12('0x54')](_0x2fa8eb[_0x5b12('0x53')],{'$or':_[_0x5b12('0x42')](_0x2fa8eb[_0x5b12('0x4b')],function(_0x21c0c6){var _0x3dd446={};_0x3dd446[_0x21c0c6]={'$like':'%'+_0x3f105c[_0x5b12('0x48')][_0x5b12('0x52')]+'%'};return _0x3dd446;})});}_0x2fa8eb=_[_0x5b12('0x54')]({},_0x2fa8eb,_0x3f105c[_0x5b12('0x57')]);return db[_0x5b12('0x74')][_0x5b12('0x30')]({'where':_0x2fa8eb[_0x5b12('0x53')]})[_0x5b12('0x38')](function(_0x16b9ff){_0x464167['count']=_0x16b9ff;if(_0x3f105c['query'][_0x5b12('0x58')]){_0x2fa8eb['include']=[{'model':db[_0x5b12('0x76')],'as':_0x5b12('0x77'),'required':![]},{'model':db['User'],'as':_0x5b12('0x78'),'attributes':['name','fullname',_0x5b12('0x79')],'required':![]},{'model':db[_0x5b12('0x7a')],'as':_0x5b12('0x7b'),'attributes':['id','name',_0x5b12('0x7c')],'where':_0x3f105c[_0x5b12('0x48')][_0x5b12('0x7d')]?{'id':_0x3f105c[_0x5b12('0x48')][_0x5b12('0x7d')]}:undefined,'required':_0x3f105c[_0x5b12('0x48')][_0x5b12('0x7d')]?!![]:![]}];}return db[_0x5b12('0x74')][_0x5b12('0x5b')](_0x2fa8eb);})[_0x5b12('0x38')](function(_0x516010){_0x464167[_0x5b12('0x6b')]=_0x516010;return _0x464167;});}})[_0x5b12('0x38')](respondWithFilteredResult(_0x4d9c0b,_0x2fa8eb))[_0x5b12('0x2b')](handleError(_0x4d9c0b,null));};exports[_0x5b12('0x7e')]=function(_0x3f59e7,_0x1126ba,_0x454b3d){return db['FaxAccount'][_0x5b12('0x71')]({'where':{'id':_0x3f59e7['params']['id']}})[_0x5b12('0x38')](handleEntityNotFound(_0x1126ba,null))[_0x5b12('0x38')](function(_0x2bd72f){if(_0x2bd72f){return db[_0x5b12('0x7f')][_0x5b12('0x80')](function(_0x1e9cce){return db[_0x5b12('0x81')][_0x5b12('0x39')]({'where':{'FaxAccountId':_0x3f59e7[_0x5b12('0x65')]['id']},'transaction':_0x1e9cce})[_0x5b12('0x38')](function(_0x19b37c){var _0x2c87f4=_[_0x5b12('0x42')](_0x3f59e7['body'],function(_0x25c955){_0x25c955[_0x5b12('0x67')]=_0x3f59e7[_0x5b12('0x65')]['id'];return _0x25c955;});return db[_0x5b12('0x81')][_0x5b12('0x82')](_0x2c87f4,{'transaction':_0x1e9cce});});})[_0x5b12('0x38')](function(){return db[_0x5b12('0x81')]['findAndCountAll']({'where':{'FaxAccountId':_0x3f59e7[_0x5b12('0x65')]['id']},'order':_0x5b12('0x83')});});}})[_0x5b12('0x38')](respondWithResult(_0x1126ba,null))[_0x5b12('0x2b')](handleError(_0x1126ba,null));};exports['getApplications']=function(_0x3b88e0,_0xe3368,_0x54573e){var _0x2699b3={};var _0x428543={};var _0x11fce9;var _0x289961;return db['FaxAccount'][_0x5b12('0x71')]({'where':{'id':_0x3b88e0['params']['id']}})[_0x5b12('0x38')](handleEntityNotFound(_0xe3368,null))['then'](function(_0x1b5f66){if(_0x1b5f66){_0x11fce9=_0x1b5f66;_0x428543[_0x5b12('0x45')]=_[_0x5b12('0x47')](db['FaxApplication'][_0x5b12('0x43')]);_0x428543[_0x5b12('0x48')]=_[_0x5b12('0x47')](_0x3b88e0[_0x5b12('0x48')]);_0x428543[_0x5b12('0x49')]=_[_0x5b12('0x4a')](_0x428543['model'],_0x428543[_0x5b12('0x48')]);_0x2699b3[_0x5b12('0x4b')]=_['intersection'](_0x428543[_0x5b12('0x45')],qs['fields'](_0x3b88e0['query'][_0x5b12('0x4c')]));_0x2699b3[_0x5b12('0x4b')]=_0x2699b3[_0x5b12('0x4b')][_0x5b12('0x4d')]?_0x2699b3[_0x5b12('0x4b')]:_0x428543['model'];_0x2699b3['order']=qs[_0x5b12('0x50')](_0x3b88e0['query'][_0x5b12('0x50')]);_0x2699b3['where']=qs[_0x5b12('0x49')](_[_0x5b12('0x51')](_0x3b88e0[_0x5b12('0x48')],_0x428543[_0x5b12('0x49')]));if(_0x3b88e0[_0x5b12('0x48')][_0x5b12('0x52')]){_0x2699b3[_0x5b12('0x53')]=_[_0x5b12('0x54')](_0x2699b3['where'],{'$or':_[_0x5b12('0x42')](_0x2699b3[_0x5b12('0x4b')],function(_0x35e505){var _0x55a774={};_0x55a774[_0x35e505]={'$like':'%'+_0x3b88e0[_0x5b12('0x48')][_0x5b12('0x52')]+'%'};return _0x55a774;})});}_0x2699b3=_[_0x5b12('0x54')]({},_0x2699b3,_0x3b88e0[_0x5b12('0x57')]);return _0x11fce9[_0x5b12('0x84')](_0x2699b3);}})['then'](function(_0x8606ff){if(_0x8606ff){_0x289961=_0x8606ff[_0x5b12('0x4d')];if(!_0x3b88e0[_0x5b12('0x48')][_0x5b12('0x4e')]('nolimit')){_0x2699b3[_0x5b12('0x32')]=qs[_0x5b12('0x32')](_0x3b88e0[_0x5b12('0x48')][_0x5b12('0x32')]);_0x2699b3[_0x5b12('0x31')]=qs[_0x5b12('0x31')](_0x3b88e0[_0x5b12('0x48')][_0x5b12('0x31')]);}return _0x11fce9['getApplications'](_0x2699b3);}})['then'](function(_0x1d3c88){if(_0x1d3c88){return _0x1d3c88?{'count':_0x289961,'rows':_0x1d3c88}:null;}})['then'](respondWithResult(_0xe3368,null))[_0x5b12('0x2b')](handleError(_0xe3368,null));};function Extension(_0x499dae,_0x9dc26f,_0x49ae2b,_0x46162b){this[_0x5b12('0x85')]=_0x5b12('0x86');this[_0x5b12('0x87')]=_0x499dae[_0x5b12('0x88')];this[_0x5b12('0x89')]=_0x46162b;this[_0x5b12('0x55')]='system';this['description']=_0x5b12('0x8a');this[_0x5b12('0x67')]=_0x499dae['id'];this[_0x5b12('0x83')]=_0x9dc26f;this['appdata']=_0x49ae2b;}function createExtensionsReciveFax(_0x13fc6d){var _0x21862b=0x1;var _0xd16ee7=[];_0xd16ee7[_0x5b12('0x8b')](new Extension(_0x13fc6d,_0x21862b,'',_0x5b12('0x8c')));_0x21862b+=0x1;_0xd16ee7[_0x5b12('0x8b')](new Extension(_0x13fc6d,_0x21862b,_0x5b12('0x8d'),'Set'));_0x21862b+=0x1;for(var _0x8b2f0d in _0x13fc6d){if(_0x13fc6d[_0x5b12('0x4e')](_0x8b2f0d)&&(_0x8b2f0d===_0x5b12('0x8e')||_0x8b2f0d==='localstationid'||_0x8b2f0d===_0x5b12('0x8f')||_0x8b2f0d===_0x5b12('0x90')||_0x8b2f0d===_0x5b12('0x91')||_0x8b2f0d===_0x5b12('0x92')||_0x8b2f0d===_0x5b12('0x93')||_0x8b2f0d===_0x5b12('0x94')||_0x8b2f0d===_0x5b12('0x95'))){_0xd16ee7['push'](new Extension(_0x13fc6d,_0x21862b,_0x5b12('0x96')+_0x8b2f0d+')='+_0x13fc6d[_0x8b2f0d],'Set'));_0x21862b+=0x1;}}_0xd16ee7[_0x5b12('0x8b')](new Extension(_0x13fc6d,_0x21862b,'6',_0x5b12('0x97')));_0x21862b+=0x1;_0xd16ee7['push'](new Extension(_0x13fc6d,_0x21862b,'/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',_0x5b12('0x98')));_0x21862b=0x0;return _0xd16ee7;}exports[_0x5b12('0x99')]=function(_0x49bb19,_0xbc60ff,_0x1fe719){var _0x1d5fe5;return db['sequelize']['transaction'](function(_0x5bd35a){return db['FaxAccount']['create'](_0x49bb19[_0x5b12('0x5e')],{'transaction':_0x5bd35a})['then'](function(_0x1cefdb){_0x1d5fe5=_0x1cefdb['get']({'plain':!![]});return db[_0x5b12('0x9a')][_0x5b12('0x82')](createExtensionsReciveFax(_0x1d5fe5),{'transaction':_0x5bd35a});});})['then'](function(){return _0x1d5fe5;})[_0x5b12('0x38')](respondWithResult(_0xbc60ff,null))[_0x5b12('0x2b')](handleError(_0xbc60ff,null));};exports[_0x5b12('0x9b')]=function(_0x523467,_0x3cf4cf,_0x2d4542){var _0x389485;return db[_0x5b12('0x7f')]['transaction'](function(_0x4ed067){return db[_0x5b12('0x5a')][_0x5b12('0x37')](_0x523467[_0x5b12('0x5e')],{'where':{'id':_0x523467[_0x5b12('0x5e')]['id']},'transaction':_0x4ed067})[_0x5b12('0x38')](function(_0x330db8){return db[_0x5b12('0x9a')][_0x5b12('0x39')]({'where':{'FaxAccountId':_0x523467[_0x5b12('0x5e')]['id']},'transaction':_0x4ed067})['then'](function(_0xacbf25){return db[_0x5b12('0x9a')][_0x5b12('0x82')](createExtensionsReciveFax(_[_0x5b12('0x75')](_0x523467[_0x5b12('0x5e')],[_0x5b12('0x9c'),'key',_0x5b12('0x9d'),_0x5b12('0x9e'),_0x5b12('0x9f'),_0x5b12('0xa0')])),{'transaction':_0x4ed067});});});})[_0x5b12('0x38')](function(){return db[_0x5b12('0x5a')]['findById'](_0x523467[_0x5b12('0x5e')]['id']);})[_0x5b12('0x38')](respondWithResult(_0x3cf4cf,null))[_0x5b12('0x2b')](handleError(_0x3cf4cf,null));};exports[_0x5b12('0xa1')]=function(_0x54a22c,_0x838bae,_0x1380b5){var _0x1dc2a4={'raw':!![],'where':{}};var _0x5ec116={};var _0x50e371={'count':0x0,'rows':[]};return db[_0x5b12('0x5a')][_0x5b12('0x71')]({'where':{'id':_0x54a22c[_0x5b12('0x65')]['id']}})['then'](handleEntityNotFound(_0x838bae,null))[_0x5b12('0x38')](function(_0x59a282){if(_0x59a282){_0x5ec116[_0x5b12('0x45')]=_['keys'](db['FaxMessage'][_0x5b12('0x43')]);_0x5ec116[_0x5b12('0x48')]=_[_0x5b12('0x47')](_0x54a22c['query']);_0x5ec116['filters']=_['intersection'](_0x5ec116[_0x5b12('0x45')],_0x5ec116['query']);_0x1dc2a4[_0x5b12('0x4b')]=_['intersection'](_0x5ec116[_0x5b12('0x45')],qs['fields'](_0x54a22c['query'][_0x5b12('0x4c')]));_0x1dc2a4[_0x5b12('0x4b')]=_0x1dc2a4[_0x5b12('0x4b')][_0x5b12('0x4d')]?_0x1dc2a4['attributes']:_0x5ec116['model'];if(!_0x54a22c[_0x5b12('0x48')][_0x5b12('0x4e')](_0x5b12('0x6a'))){_0x1dc2a4[_0x5b12('0x32')]=qs[_0x5b12('0x32')](_0x54a22c['query'][_0x5b12('0x32')]);_0x1dc2a4[_0x5b12('0x31')]=qs[_0x5b12('0x31')](_0x54a22c[_0x5b12('0x48')][_0x5b12('0x31')]);}_0x1dc2a4[_0x5b12('0x4f')]=qs[_0x5b12('0x50')](_0x54a22c[_0x5b12('0x48')][_0x5b12('0x50')]);_0x1dc2a4[_0x5b12('0x53')]=qs[_0x5b12('0x49')](_[_0x5b12('0x51')](_0x54a22c['query'],_0x5ec116[_0x5b12('0x49')]));_0x1dc2a4[_0x5b12('0x53')][_0x5b12('0x67')]=_0x59a282['id'];if(_0x54a22c[_0x5b12('0x48')][_0x5b12('0x52')]){_0x1dc2a4[_0x5b12('0x53')]=_[_0x5b12('0x54')](_0x1dc2a4[_0x5b12('0x53')],{'$or':_[_0x5b12('0x42')](_0x1dc2a4[_0x5b12('0x4b')],function(_0x546d60){var _0x2b606b={};_0x2b606b[_0x546d60]={'$like':'%'+_0x54a22c[_0x5b12('0x48')]['filter']+'%'};return _0x2b606b;})});}if(_0x54a22c['query']['$gte']){var _0x517c1e=_0x54a22c[_0x5b12('0x48')][_0x5b12('0xa2')][_0x5b12('0xa3')](',');var _0x24c9b2={};_0x24c9b2[_0x517c1e[0x0]]={'$gte':moment(_0x517c1e[0x1])[_0x5b12('0xa4')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1dc2a4['where']=_[_0x5b12('0x54')](_0x1dc2a4[_0x5b12('0x53')],_0x24c9b2);}_0x1dc2a4=_[_0x5b12('0x54')]({},_0x1dc2a4,_0x54a22c['options']);return db[_0x5b12('0xa5')][_0x5b12('0x30')]({'where':_0x1dc2a4[_0x5b12('0x53')]})[_0x5b12('0x38')](function(_0x189f62){_0x50e371[_0x5b12('0x30')]=_0x189f62;if(_0x54a22c[_0x5b12('0x48')][_0x5b12('0x58')]){_0x1dc2a4[_0x5b12('0x59')]=[{'all':!![]}];}return db[_0x5b12('0xa5')]['findAll'](_0x1dc2a4);})[_0x5b12('0x38')](function(_0x5b572b){_0x50e371[_0x5b12('0x6b')]=_0x5b572b;return _0x50e371;});}})[_0x5b12('0x38')](respondWithFilteredResult(_0x838bae,_0x1dc2a4))[_0x5b12('0x2b')](handleError(_0x838bae,null));};exports[_0x5b12('0x3e')]=function(_0x44ad77,_0x456d91,_0x149d6c){var _0x3e117c,_0x20cb9e={},_0xd9f92d;if(_0x44ad77['body']['to']){_0xd9f92d=_0x44ad77[_0x5b12('0x5e')]['to'][0x0];}return db[_0x5b12('0x5a')][_0x5b12('0x62')]({'where':{'id':_0x44ad77['params']['id']},'include':[{'model':db[_0x5b12('0xa6')],'as':_0x5b12('0xa7'),'include':[{'model':db[_0x5b12('0x76')],'as':_0x5b12('0xa8'),'where':{'fax':_0xd9f92d},'limit':0x1,'order':[[_0x5b12('0x9e'),_0x5b12('0xa9')]]}]}]})['then'](handleEntityNotFound(_0x456d91,null))[_0x5b12('0x38')](function(_0x2ba646){_0x3e117c=_0x2ba646;if(_0x44ad77['body'][_0x5b12('0xaa')]&&_0x44ad77[_0x5b12('0x5e')]['attachments'][_0x5b12('0x4d')]){for(var _0x53fa5a=0x0;_0x53fa5a<_0x44ad77[_0x5b12('0x5e')][_0x5b12('0xaa')]['length'];_0x53fa5a+=0x1){_0x44ad77[_0x5b12('0x5e')][_0x5b12('0xaa')][_0x53fa5a]={'filename':_0x44ad77[_0x5b12('0x5e')][_0x5b12('0xaa')][_0x53fa5a]['name'],'id':_0x44ad77[_0x5b12('0x5e')][_0x5b12('0xaa')][_0x53fa5a]['id'],'path':path[_0x5b12('0xab')](config[_0x5b12('0xac')],'server/files/attachments',_0x44ad77[_0x5b12('0x5e')]['attachments'][_0x53fa5a][_0x5b12('0xad')])};}}return respondWithRpcPromise(_0x5b12('0xae'),_0x5b12('0xae'),{'FaxAccountId':_[_0x5b12('0xaf')](_0x44ad77[_0x5b12('0x65')]['id'])?undefined:_0x44ad77[_0x5b12('0x65')]['id'],'path':_['isNil'](_0x44ad77['body'][_0x5b12('0xaa')][0x0][_0x5b12('0x7')])?undefined:_0x44ad77[_0x5b12('0x5e')][_0x5b12('0xaa')][0x0]['path'],'fax':_[_0x5b12('0xaf')](_0x44ad77[_0x5b12('0x5e')]['to'][0x0])?undefined:_0x44ad77[_0x5b12('0x5e')]['to'][0x0]},client9002);})[_0x5b12('0x38')](function(){if(_0x3e117c){if(_['isNil'](_0x44ad77[_0x5b12('0x5e')][_0x5b12('0xb0')])){_0x44ad77[_0x5b12('0x5e')][_0x5b12('0xb0')]=util[_0x5b12('0xa4')](_0x5b12('0xb1'),_0x3e117c[_0x5b12('0x46')],_0x3e117c[_0x5b12('0xb2')]);}if(_0x3e117c[_0x5b12('0xa7')]){if(_0x3e117c[_0x5b12('0xa7')]['Contacts'][_0x5b12('0x4d')]){return _0x3e117c['List'][_0x5b12('0xa8')][0x0];}else{return db['CmContact']['create'](_[_0x5b12('0x19')](_0x44ad77['body'],{'firstName':_0x44ad77[_0x5b12('0x5e')]['to'][0x0],'phone':_0x44ad77['body']['to'][0x0],'fax':_0x44ad77[_0x5b12('0x5e')]['to'][0x0],'ListId':_0x3e117c[_0x5b12('0xa0')]}));}}else{throw new Error(_0x5b12('0xb3'));}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x4cf4ab){if(_0x4cf4ab){return db[_0x5b12('0x74')][_0x5b12('0x62')]({'where':{'ContactId':_0x4cf4ab['id'],'closed':![],'FaxAccountId':_0x3e117c['id']}})['then'](function(_0x53dae2){if(_0x53dae2){return[_0x53dae2,![]];}return db[_0x5b12('0x74')][_0x5b12('0x5d')]({'UserId':_0x44ad77[_0x5b12('0x5f')]['id'],'ContactId':_0x4cf4ab['id'],'FaxAccountId':_0x3e117c['id'],'fax':_0x44ad77[_0x5b12('0x5e')]['to'][0x0],'firstMsgDirection':_0x5b12('0xb4'),'Messages':[_[_0x5b12('0x54')](_0x44ad77[_0x5b12('0x5e')],{'read':![],'body':_0x44ad77[_0x5b12('0x5e')][_0x5b12('0xaa')][0x0][_0x5b12('0xb5')],'FaxAccountId':_0x3e117c['id'],'UserId':_0x44ad77[_0x5b12('0x5f')]['id'],'ContactId':_0x4cf4ab['id'],'AttachmentId':_0x44ad77['body'][_0x5b12('0xaa')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x5b12('0xb6')}]})['then'](function(_0x6dc165){return[_0x6dc165,!![]];});});}else{throw new Error(_0x5b12('0xb7'));}})['spread'](function(_0x4964ae,_0x399e3a){if(_0x399e3a){return _0x4964ae;}return db[_0x5b12('0xa5')][_0x5b12('0x5d')]({'direction':'out','read':![],'body':_0x44ad77[_0x5b12('0x5e')][_0x5b12('0xaa')][0x0][_0x5b12('0xb5')],'FaxAccountId':_0x3e117c['id'],'FaxInteractionId':_0x4964ae['id'],'UserId':_0x44ad77[_0x5b12('0x5f')]['id'],'ContactId':_0x4964ae[_0x5b12('0xb8')],'AttachmentId':_0x44ad77['body'][_0x5b12('0xaa')][0x0]['id']})[_0x5b12('0x38')](function(_0x490e6d){_0x4964ae[_0x5b12('0xb9')][_0x5b12('0xb6')]=[];_0x4964ae[_0x5b12('0xb9')][_0x5b12('0xb6')][_0x5b12('0x8b')](_0x490e6d[_0x5b12('0xb9')]);return _0x4964ae;});})[_0x5b12('0x38')](function(_0x4a2993){respondWithRpcPromise(_0x5b12('0xba'),_0x5b12('0xba'),{'FaxAccountId':_['isNil'](_0x44ad77[_0x5b12('0x65')]['id'])?undefined:_0x44ad77[_0x5b12('0x65')]['id'],'path':_[_0x5b12('0xaf')](_0x44ad77[_0x5b12('0x5e')]['attachments'][0x0][_0x5b12('0x7')])?undefined:_0x44ad77[_0x5b12('0x5e')][_0x5b12('0xaa')][0x0][_0x5b12('0x7')],'fax':_[_0x5b12('0xaf')](_0x44ad77[_0x5b12('0x5e')]['to'][0x0])?undefined:_0x44ad77[_0x5b12('0x5e')]['to'][0x0],'AttachmentId':_0x44ad77[_0x5b12('0x5e')][_0x5b12('0xaa')][0x0]['id']},client9002)[_0x5b12('0x38')](function(_0x4083ef){logger[_0x5b12('0x22')](_0x5b12('0xbb'),_0x4083ef);})['catch'](function(_0x5d46c2){logger[_0x5b12('0x22')]('SendFaxRpc,\x20%s',_0x5d46c2);});return _0x4a2993;})[_0x5b12('0x38')](respondWithResult(_0x456d91,null))[_0x5b12('0x2b')](handleError(_0x456d91,null));};exports[_0x5b12('0xbc')]=function(_0x19e7f1,_0x51524b,_0x3f06be){return db['FaxAccount'][_0x5b12('0x62')]({'where':{'id':_0x19e7f1[_0x5b12('0x65')]['id']}})[_0x5b12('0x38')](handleEntityNotFound(_0x51524b,null))[_0x5b12('0x38')](function(_0x104a45){if(_0x104a45){return _0x104a45[_0x5b12('0xbc')](_0x19e7f1[_0x5b12('0x5e')][_0x5b12('0x6d')],_[_0x5b12('0x75')](_0x19e7f1['body'],[_0x5b12('0x6d'),'id'])||{})[_0x5b12('0xbd')](function(_0x5cd6d2){for(var _0x18d4a3=0x0;_0x18d4a3<_0x19e7f1['body'][_0x5b12('0x6d')][_0x5b12('0x4d')];_0x18d4a3+=0x1){socket[_0x5b12('0xbe')](_0x5b12('0xbf'),{'UserId':_0x19e7f1['body'][_0x5b12('0x6d')][_0x18d4a3],'FaxAccountId':_0x19e7f1[_0x5b12('0x65')]['id']});}return _0x5cd6d2;});}})[_0x5b12('0x38')](respondWithResult(_0x51524b,null))[_0x5b12('0x2b')](handleError(_0x51524b,null));};exports[_0x5b12('0xc0')]=function(_0x33bfc5,_0x470e86,_0x557bb3){return db[_0x5b12('0x5a')]['find']({'where':{'id':_0x33bfc5[_0x5b12('0x65')]['id']}})[_0x5b12('0x38')](handleEntityNotFound(_0x470e86,null))[_0x5b12('0x38')](function(_0x251e55){if(_0x251e55){return _0x251e55[_0x5b12('0xc0')](_0x33bfc5['query'][_0x5b12('0x6d')])[_0x5b12('0x38')](function(){if(_['isArray'](_0x33bfc5[_0x5b12('0x48')][_0x5b12('0x6d')])){for(var _0x20b9d4=0x0;_0x20b9d4<_0x33bfc5[_0x5b12('0x48')][_0x5b12('0x6d')][_0x5b12('0x4d')];_0x20b9d4+=0x1){socket['emit'](_0x5b12('0xc1'),{'UserId':Number(_0x33bfc5[_0x5b12('0x48')][_0x5b12('0x6d')][_0x20b9d4]),'FaxAccountId':Number(_0x33bfc5['params']['id'])});}}else{socket[_0x5b12('0xbe')]('userFaxAccount:remove',{'UserId':Number(_0x33bfc5[_0x5b12('0x48')][_0x5b12('0x6d')]),'FaxAccountId':Number(_0x33bfc5[_0x5b12('0x65')]['id'])});}});}})['then'](respondWithStatusCode(_0x470e86,null))['catch'](handleError(_0x470e86,null));};exports[_0x5b12('0xc2')]=function(_0x230fcd,_0x209d2f,_0x2bdd97){var _0x178c43={};var _0x3d11aa={};var _0x1469a4;var _0x3b8b61;return db[_0x5b12('0x5a')][_0x5b12('0x71')]({'where':{'id':_0x230fcd[_0x5b12('0x65')]['id']}})[_0x5b12('0x38')](handleEntityNotFound(_0x209d2f,null))['then'](function(_0x20548a){if(_0x20548a){_0x1469a4=_0x20548a;_0x3d11aa['model']=_[_0x5b12('0x47')](db['User']['rawAttributes']);_0x3d11aa[_0x5b12('0x48')]=_[_0x5b12('0x47')](_0x230fcd['query']);_0x3d11aa[_0x5b12('0x49')]=_['intersection'](_0x3d11aa[_0x5b12('0x45')],_0x3d11aa['query']);_0x178c43[_0x5b12('0x4b')]=_[_0x5b12('0x4a')](_0x3d11aa[_0x5b12('0x45')],qs[_0x5b12('0x4c')](_0x230fcd[_0x5b12('0x48')][_0x5b12('0x4c')]));_0x178c43[_0x5b12('0x4b')]=_0x178c43[_0x5b12('0x4b')][_0x5b12('0x4d')]?_0x178c43[_0x5b12('0x4b')]:_0x3d11aa[_0x5b12('0x45')];_0x178c43[_0x5b12('0x4f')]=qs['sort'](_0x230fcd[_0x5b12('0x48')]['sort']);_0x178c43[_0x5b12('0x53')]=qs[_0x5b12('0x49')](_[_0x5b12('0x51')](_0x230fcd[_0x5b12('0x48')],_0x3d11aa['filters']));if(_0x230fcd[_0x5b12('0x48')][_0x5b12('0x52')]){_0x178c43[_0x5b12('0x53')]=_['merge'](_0x178c43['where'],{'$or':_[_0x5b12('0x42')](_0x178c43[_0x5b12('0x4b')],function(_0x31b51d){var _0x13a69f={};_0x13a69f[_0x31b51d]={'$like':'%'+_0x230fcd[_0x5b12('0x48')][_0x5b12('0x52')]+'%'};return _0x13a69f;})});}_0x178c43=_['merge']({},_0x178c43,_0x230fcd[_0x5b12('0x57')]);return _0x1469a4['getAgents'](_0x178c43);}})[_0x5b12('0x38')](function(_0x297c63){if(_0x297c63){_0x3b8b61=_0x297c63[_0x5b12('0x4d')];if(!_0x230fcd[_0x5b12('0x48')][_0x5b12('0x4e')](_0x5b12('0x6a'))){_0x178c43[_0x5b12('0x32')]=qs['limit'](_0x230fcd[_0x5b12('0x48')][_0x5b12('0x32')]);_0x178c43[_0x5b12('0x31')]=qs[_0x5b12('0x31')](_0x230fcd[_0x5b12('0x48')][_0x5b12('0x31')]);}return _0x1469a4[_0x5b12('0xc2')](_0x178c43);}})[_0x5b12('0x38')](function(_0x47a9fd){if(_0x47a9fd){return _0x47a9fd?{'count':_0x3b8b61,'rows':_0x47a9fd}:null;}})[_0x5b12('0x38')](respondWithResult(_0x209d2f,null))[_0x5b12('0x2b')](handleError(_0x209d2f,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 80bc27d..14e964b 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 _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 +var _0x3be2=['emit','exports','FaxAccount','setMaxListeners','update'];(function(_0x41c8f8,_0x23be4d){var _0xbc785a=function(_0x5e4b66){while(--_0x5e4b66){_0x41c8f8['push'](_0x41c8f8['shift']());}};_0xbc785a(++_0x23be4d);}(_0x3be2,0x17e));var _0x23be=function(_0x13d3d4,_0x493ea5){_0x13d3d4=_0x13d3d4-0x0;var _0x48c26c=_0x3be2[_0x13d3d4];return _0x48c26c;};'use strict';var EventEmitter=require('events');var FaxAccount=require('../../mysqldb')['db'][_0x23be('0x0')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x23be('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x23be('0x2'),'afterDestroy':'remove'};function emitEvent(_0x1d9a4f){return function(_0x65895e,_0x348d91,_0xf6222a){FaxAccountEvents[_0x23be('0x3')](_0x1d9a4f+':'+_0x65895e['id'],_0x65895e);FaxAccountEvents[_0x23be('0x3')](_0x1d9a4f,_0x65895e);_0xf6222a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x23be('0x4')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index e0ab490..8574ddb 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 _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 +var _0x4aa5=['fax_accounts','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./faxAccount.attributes','exports','FaxAccount'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4aa5,0x18d));var _0x54aa=function(_0x5b42af,_0x40c27b){_0x5b42af=_0x5b42af-0x0;var _0x35839e=_0x4aa5[_0x5b42af];return _0x35839e;};'use strict';var _=require(_0x54aa('0x0'));var util=require(_0x54aa('0x1'));var logger=require(_0x54aa('0x2'))(_0x54aa('0x3'));var moment=require('moment');var BPromise=require(_0x54aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x54aa('0x5'));var rimraf=require(_0x54aa('0x6'));var config=require(_0x54aa('0x7'));var attributes=require(_0x54aa('0x8'));module[_0x54aa('0x9')]=function(_0x303595,_0xdfbbf6){return _0x303595['define'](_0x54aa('0xa'),attributes,{'tableName':_0x54aa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index d318a4a..74d2544 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 _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 +var _0xd041=['map','model','stringify','body','fax','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','keys','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','CmContact','FaxApplication','Applications','List','applications','list','priority','asc','Contacts','length','create','FaxInteraction','spread','get','autoclose','push','close','unmanaged','created','interaction','FaxMessage','ContactId','UserId','name','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetFaxAccount','FaxAccount','options','raw','attributes','include'];(function(_0x10c0ff,_0x4aa275){var _0x330bf1=function(_0xff322a){while(--_0xff322a){_0x10c0ff['push'](_0x10c0ff['shift']());}};_0x330bf1(++_0x4aa275);}(_0xd041,0x1e9));var _0x1d04=function(_0x369f28,_0x2c949d){_0x369f28=_0x369f28-0x0;var _0x584c8c=_0xd041[_0x369f28];return _0x584c8c;};'use strict';var _=require(_0x1d04('0x0'));var util=require(_0x1d04('0x1'));var moment=require(_0x1d04('0x2'));var BPromise=require('bluebird');var rs=require(_0x1d04('0x3'));var fs=require('fs');var Redis=require(_0x1d04('0x4'));var db=require(_0x1d04('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1d04('0x6'))(_0x1d04('0x7'));var config=require('../../config/environment');var jayson=require(_0x1d04('0x8'));var client=jayson[_0x1d04('0x9')][_0x1d04('0xa')]({'port':0x232c});config[_0x1d04('0xb')]=_[_0x1d04('0xc')](config[_0x1d04('0xb')],{'host':_0x1d04('0xd'),'port':0x18eb});var socket=require(_0x1d04('0xe'))(new Redis(config[_0x1d04('0xb')]));require(_0x1d04('0xf'))['register'](socket);function respondWithRpcPromise(_0x38ce69,_0x27514d,_0x4ea671){return new BPromise(function(_0x1b5b63,_0x1a5de6){return client[_0x1d04('0x10')](_0x38ce69,_0x4ea671)[_0x1d04('0x11')](function(_0x3605e8){logger[_0x1d04('0x12')](_0x1d04('0x13'),_0x27514d,_0x1d04('0x14'));logger[_0x1d04('0x15')](_0x1d04('0x16'),_0x27514d,'request\x20sent',JSON['stringify'](_0x3605e8));if(_0x3605e8[_0x1d04('0x17')]){if(_0x3605e8[_0x1d04('0x17')][_0x1d04('0x18')]===0x1f4){logger[_0x1d04('0x17')](_0x1d04('0x13'),_0x27514d,_0x3605e8[_0x1d04('0x17')]['message']);return _0x1a5de6(_0x3605e8['error'][_0x1d04('0x19')]);}logger[_0x1d04('0x17')](_0x1d04('0x13'),_0x27514d,_0x3605e8[_0x1d04('0x17')][_0x1d04('0x19')]);return _0x1b5b63(_0x3605e8[_0x1d04('0x17')][_0x1d04('0x19')]);}else{logger[_0x1d04('0x12')]('FaxAccount,\x20%s,\x20%s',_0x27514d,_0x1d04('0x14'));_0x1b5b63(_0x3605e8['result'][_0x1d04('0x19')]);}})[_0x1d04('0x1a')](function(_0x2175ea){logger[_0x1d04('0x17')](_0x1d04('0x13'),_0x27514d,_0x2175ea);_0x1a5de6(_0x2175ea);});});}exports[_0x1d04('0x1b')]=function(_0x3aa801){var _0x1b2e3c=this;return new Promise(function(_0x1563dc,_0x539f0){return db[_0x1d04('0x1c')]['findAll']({'raw':_0x3aa801[_0x1d04('0x1d')]?_0x3aa801[_0x1d04('0x1d')][_0x1d04('0x1e')]===undefined?!![]:![]:!![],'where':_0x3aa801[_0x1d04('0x1d')]?_0x3aa801[_0x1d04('0x1d')]['where']||null:null,'attributes':_0x3aa801[_0x1d04('0x1d')]?_0x3aa801[_0x1d04('0x1d')][_0x1d04('0x1f')]||null:null,'limit':_0x3aa801[_0x1d04('0x1d')]?_0x3aa801[_0x1d04('0x1d')]['limit']||null:null,'include':_0x3aa801[_0x1d04('0x1d')]?_0x3aa801[_0x1d04('0x1d')][_0x1d04('0x20')]?_[_0x1d04('0x21')](_0x3aa801[_0x1d04('0x1d')][_0x1d04('0x20')],function(_0x6bf38e){return{'model':db[_0x6bf38e[_0x1d04('0x22')]],'as':_0x6bf38e['as'],'attributes':_0x6bf38e[_0x1d04('0x1f')],'include':_0x6bf38e[_0x1d04('0x20')]?_[_0x1d04('0x21')](_0x6bf38e[_0x1d04('0x20')],function(_0x557fbd){return{'model':db[_0x557fbd[_0x1d04('0x22')]],'as':_0x557fbd['as'],'attributes':_0x557fbd[_0x1d04('0x1f')],'include':_0x557fbd[_0x1d04('0x20')]?_[_0x1d04('0x21')](_0x557fbd[_0x1d04('0x20')],function(_0x48e382){return{'model':db[_0x48e382['model']],'as':_0x48e382['as'],'attributes':_0x48e382[_0x1d04('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1d04('0x11')](function(_0x229eec){logger[_0x1d04('0x12')](_0x1d04('0x1b'),_0x3aa801);logger[_0x1d04('0x15')]('GetFaxAccount',_0x3aa801,JSON[_0x1d04('0x23')](_0x229eec));_0x1563dc(_0x229eec);})[_0x1d04('0x1a')](function(_0x5cc8b0){logger[_0x1d04('0x17')]('GetFaxAccount',_0x5cc8b0['message'],_0x3aa801);_0x539f0(_0x1b2e3c[_0x1d04('0x17')](0x1f4,_0x5cc8b0[_0x1d04('0x19')]));});});};exports['NotifyFaxAccount']=function(_0x38b122,_0x509b04,_0x20cdc4){var _0xe62439=this;return new Promise(function(_0x2219ca,_0x491e29){var _0x16cce0={'body':_0x38b122[_0x1d04('0x24')],'channel':_0x1d04('0x25')};var _0x4d1110=[];var _0x59965a=[];var _0x342c1c={};return db['CmContact'][_0x1d04('0x26')]()[_0x1d04('0x11')](function(_0x22ec84){if(!_0x22ec84){throw new db[(_0x1d04('0x27'))][(_0x1d04('0x28'))](_0x1d04('0x29'));}_0x4d1110=_[_0x1d04('0x2a')](_['keys'](_0x22ec84),[_0x1d04('0x2b'),_0x1d04('0x2c')]);_0x59965a=_[_0x1d04('0x2a')](_[_0x1d04('0x2d')](_0x22ec84),[_0x1d04('0x2b'),_0x1d04('0x2c'),_0x1d04('0x2e'),_0x1d04('0x2f')]);if(_0x38b122[_0x1d04('0x24')]['id']){delete _0x38b122[_0x1d04('0x24')]['id'];}if(_[_0x1d04('0x30')](_0x38b122[_0x1d04('0x24')][_0x1d04('0x31')])){throw new db[(_0x1d04('0x27'))][(_0x1d04('0x28'))](_0x1d04('0x32'));}if(_['isNil'](_0x38b122[_0x1d04('0x24')][_0x1d04('0x24')])||_0x38b122[_0x1d04('0x24')][_0x1d04('0x24')]===''){throw new db[(_0x1d04('0x27'))][(_0x1d04('0x28'))](_0x1d04('0x33'));}if(_[_0x1d04('0x30')](_0x38b122['body'][_0x1d04('0x34')])){throw new db[(_0x1d04('0x27'))][(_0x1d04('0x28'))](_0x1d04('0x35')+_0x59965a);}if(!_['includes'](_0x59965a,_0x38b122[_0x1d04('0x24')][_0x1d04('0x34')])){throw new db[(_0x1d04('0x27'))]['ValidationError'](_0x1d04('0x36')+_0x59965a);}_0x342c1c[_0x38b122[_0x1d04('0x24')][_0x1d04('0x34')]]=_0x38b122[_0x1d04('0x24')][_0x1d04('0x31')];})[_0x1d04('0x11')](function(){return db[_0x1d04('0x1c')][_0x1d04('0x37')]({'where':{'id':_0x38b122[_0x1d04('0x38')]['id']},'include':[{'model':db[_0x1d04('0x39')],'as':'List','include':[{'model':db[_0x1d04('0x3a')],'as':'Contacts','where':_0x342c1c,'limit':0x1,'order':[[_0x1d04('0x2c'),'DESC']]}]},{'model':db[_0x1d04('0x3b')],'as':_0x1d04('0x3c')}]});})['then'](function(_0x2779ee){if(_0x2779ee&&_0x2779ee[_0x1d04('0x3d')]){var _0x299e9e=_0x2779ee['get']({'plain':!![]});_0x16cce0[_0x1d04('0x38')]=_0x299e9e;_0x16cce0[_0x1d04('0x3e')]=_0x299e9e[_0x1d04('0x3c')];_0x16cce0[_0x1d04('0x3f')]=_0x299e9e[_0x1d04('0x3d')];_0x16cce0[_0x1d04('0x3e')]=_['orderBy'](_0x16cce0[_0x1d04('0x3e')],[_0x1d04('0x40')],[_0x1d04('0x41')]);if(_0x16cce0['account'][_0x1d04('0x3c')]){delete _0x16cce0['account'][_0x1d04('0x3c')];}if(_0x16cce0['account'][_0x1d04('0x3d')]&&_0x16cce0[_0x1d04('0x38')][_0x1d04('0x3d')][_0x1d04('0x42')][_0x1d04('0x43')]){return _0x16cce0[_0x1d04('0x38')]['List'][_0x1d04('0x42')][0x0];}var _0x9e7bf=_[_0x1d04('0xc')](_0x38b122[_0x1d04('0x24')],{'firstName':_0x38b122[_0x1d04('0x24')][_0x1d04('0x31')],'ListId':_0x299e9e[_0x1d04('0x2f')]});_0x9e7bf[_0x38b122[_0x1d04('0x24')][_0x1d04('0x34')]]=_0x38b122['body']['from'];return db[_0x1d04('0x3a')][_0x1d04('0x44')](_0x9e7bf,{'fields':_0x4d1110,'raw':!![]});}})[_0x1d04('0x11')](function(_0x52a900){_0x16cce0['contact']=_0x52a900;if(_0x52a900){var _0x2fc707={'ContactId':_0x52a900['id'],'FaxAccountId':_0x38b122[_0x1d04('0x38')]['id'],'fax':_0x52a900[_0x1d04('0x25')]};return db[_0x1d04('0x45')][_0x1d04('0x37')]({'where':{'ContactId':_0x52a900['id'],'closed':![],'FaxAccountId':_0x38b122[_0x1d04('0x38')]['id']}})[_0x1d04('0x11')](function(_0x292c07){if(_0x292c07){return[_0x292c07,![]];}return db[_0x1d04('0x45')]['create'](_0x2fc707)[_0x1d04('0x11')](function(_0x286e27){return[_0x286e27,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x1d04('0x46')](function(_0x3bdf87,_0x71568b){var _0x1918cf=_0x3bdf87[_0x1d04('0x47')]({'plain':!![]});if(_0x71568b){if(_0x16cce0[_0x1d04('0x38')][_0x1d04('0x48')]){_0x16cce0[_0x1d04('0x3e')][_0x1d04('0x49')]({'id':0x0,'priority':_0x16cce0[_0x1d04('0x3e')][_0x1d04('0x43')]+0x1,'app':_0x1d04('0x4a'),'appdata':_0x1d04('0x4b'),'interval':'*,*,*,*'});}_0x1918cf['created']=!![];}else{_0x1918cf[_0x1d04('0x4c')]=![];}_0x16cce0[_0x1d04('0x4d')]=_0x1918cf;return db[_0x1d04('0x4e')]['create']({'body':_0x38b122['body']['body'],'FaxAccountId':_0x38b122[_0x1d04('0x38')]['id'],'FaxInteractionId':_0x3bdf87['id'],'direction':'in','ContactId':_0x3bdf87[_0x1d04('0x4f')],'AttachmentId':_0x38b122[_0x1d04('0x24')]['AttachmentId']});})[_0x1d04('0x11')](function(_0x2a945d){_0x16cce0[_0x1d04('0x19')]=_0x2a945d;if(_0x16cce0[_0x1d04('0x4d')][_0x1d04('0x50')]){return db['User']['find']({'attributes':['id',_0x1d04('0x51')],'where':{'id':_0x16cce0[_0x1d04('0x4d')][_0x1d04('0x50')]}})['then'](function(_0x5d6b0f){if(_0x5d6b0f){_0x16cce0[_0x1d04('0x3e')]['unshift']({'id':0x0,'priority':0x0,'app':_0x1d04('0x52'),'appdata':_0x5d6b0f[_0x1d04('0x51')]+','+(_0x16cce0[_0x1d04('0x38')][_0x1d04('0x53')]||0xa),'interval':_0x1d04('0x54')});}return respondWithRpcPromise(_0x1d04('0x55'),_0x1d04('0x56'),_0x16cce0);});}return respondWithRpcPromise(_0x1d04('0x55'),'startRouting',_0x16cce0);})['then'](function(_0x459079){_0x2219ca(_0x459079);})['catch'](function(_0x5cc283){_0x491e29(_0xe62439[_0x1d04('0x17')](0x1f4,_0x5cc283['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 16fbbf3..62b392c 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 _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 +var _0x6455=['emit','removeListener','register','length','./faxAccount.events','remove','update'];(function(_0x4b1c44,_0x207008){var _0x24121d=function(_0x4c45e0){while(--_0x4c45e0){_0x4b1c44['push'](_0x4b1c44['shift']());}};_0x24121d(++_0x207008);}(_0x6455,0x97));var _0x5645=function(_0x36b1fb,_0x270bae){_0x36b1fb=_0x36b1fb-0x0;var _0x3571ed=_0x6455[_0x36b1fb];return _0x3571ed;};'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 diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index db7a1e9..377af15 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 _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 +var _0x66d8=['/:id/dispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show'];(function(_0x56f883,_0x146daf){var _0x563550=function(_0x3d3aee){while(--_0x3d3aee){_0x56f883['push'](_0x56f883['shift']());}};_0x563550(++_0x146daf);}(_0x66d8,0x143));var _0x866d=function(_0x2b608e,_0x2b9d76){_0x2b608e=_0x2b608e-0x0;var _0x2aca67=_0x66d8[_0x2b608e];return _0x2aca67;};'use strict';var multer=require(_0x866d('0x0'));var util=require(_0x866d('0x1'));var path=require(_0x866d('0x2'));var timeout=require(_0x866d('0x3'));var express=require(_0x866d('0x4'));var router=express['Router']();var auth=require(_0x866d('0x5'));var interaction=require(_0x866d('0x6'));var config=require(_0x866d('0x7'));var controller=require('./faxAccount.controller');router[_0x866d('0x8')]('/',auth[_0x866d('0x9')](),controller['index']);router['get'](_0x866d('0xa'),auth[_0x866d('0x9')](),controller['describe']);router['get'](_0x866d('0xb'),auth[_0x866d('0x9')](),controller[_0x866d('0xc')]);router[_0x866d('0x8')](_0x866d('0xd'),auth[_0x866d('0x9')](),controller['getDispositions']);router['get'](_0x866d('0xe'),auth[_0x866d('0x9')](),controller['getAnswers']);router['get'](_0x866d('0xf'),auth['isAuthenticated'](),controller[_0x866d('0x10')]);router[_0x866d('0x8')](_0x866d('0x11'),auth[_0x866d('0x9')](),controller['getApplications']);router[_0x866d('0x8')](_0x866d('0x12'),auth[_0x866d('0x9')](),controller[_0x866d('0x13')]);router[_0x866d('0x8')](_0x866d('0x14'),auth[_0x866d('0x9')](),controller[_0x866d('0x15')]);router[_0x866d('0x16')]('/',auth['isAuthenticated'](),controller[_0x866d('0x17')]);router['post']('/:id/dispositions',auth[_0x866d('0x9')](),controller[_0x866d('0x18')]);router[_0x866d('0x16')](_0x866d('0xe'),auth['isAuthenticated'](),controller['addAnswer']);router['post'](_0x866d('0xf'),auth['isAuthenticated'](),controller[_0x866d('0x19')]);router[_0x866d('0x16')](_0x866d('0x11'),auth[_0x866d('0x9')](),controller[_0x866d('0x1a')]);router[_0x866d('0x16')](_0x866d('0x1b'),auth[_0x866d('0x9')](),controller[_0x866d('0x1c')]);router[_0x866d('0x16')](_0x866d('0x1d'),auth[_0x866d('0x9')](),controller[_0x866d('0x1e')]);router[_0x866d('0x16')](_0x866d('0x1f'),auth[_0x866d('0x9')](),controller[_0x866d('0x20')]);router['post'](_0x866d('0x14'),auth[_0x866d('0x9')](),controller[_0x866d('0x21')]);router[_0x866d('0x22')](_0x866d('0xb'),auth['isAuthenticated'](),controller[_0x866d('0x23')]);router[_0x866d('0x24')](_0x866d('0xb'),auth['isAuthenticated'](),controller[_0x866d('0x25')]);router[_0x866d('0x24')](_0x866d('0xd'),auth[_0x866d('0x9')](),controller[_0x866d('0x26')]);router[_0x866d('0x24')](_0x866d('0xe'),auth[_0x866d('0x9')](),controller[_0x866d('0x27')]);router[_0x866d('0x24')]('/:id/users',auth[_0x866d('0x9')](),controller[_0x866d('0x28')]);module[_0x866d('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index fbbee89..6db307b 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 _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 +var _0x82d8=['INTEGER','TEXT','STRING','sequelize'];(function(_0x5c07b7,_0x589b4c){var _0xb25d55=function(_0x5f1c3b){while(--_0x5f1c3b){_0x5c07b7['push'](_0x5c07b7['shift']());}};_0xb25d55(++_0x589b4c);}(_0x82d8,0xff));var _0x882d=function(_0x2fdeaf,_0x426b20){_0x2fdeaf=_0x2fdeaf-0x0;var _0x3e8954=_0x82d8[_0x2fdeaf];return _0x3e8954;};'use strict';var Sequelize=require(_0x882d('0x0'));module['exports']={'priority':{'type':Sequelize[_0x882d('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x882d('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x882d('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 0838cc6..e584340 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 _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 +var _0x1cb9=['api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','apply','save','then','destroy','error','stack','index','map','FaxApplication','rawAttributes','type','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','rows','catch','show','params','includeAll','options','find','create','body','update','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x10638a,_0x484345){var _0x1471ed=function(_0x4a79ee){while(--_0x4a79ee){_0x10638a['push'](_0x10638a['shift']());}};_0x1471ed(++_0x484345);}(_0x1cb9,0x14e));var _0x91cb=function(_0x44e9e8,_0x2cd96d){_0x44e9e8=_0x44e9e8-0x0;var _0x46af1a=_0x1cb9[_0x44e9e8];return _0x46af1a;};'use strict';var pdf=require(_0x91cb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x91cb('0x1'));var zipdir=require(_0x91cb('0x2'));var jsonpatch=require(_0x91cb('0x3'));var rp=require(_0x91cb('0x4'));var moment=require('moment');var BPromise=require(_0x91cb('0x5'));var Mustache=require(_0x91cb('0x6'));var util=require('util');var path=require(_0x91cb('0x7'));var sox=require(_0x91cb('0x8'));var csv=require(_0x91cb('0x9'));var ejs=require(_0x91cb('0xa'));var fs=require('fs');var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x9'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c1f56,_0x366f09){_0x366f09=_0x366f09||0xcc;return function(_0x4ba2f2){if(_0x4ba2f2){return _0x3c1f56[_0x91cb('0x18')](_0x366f09);}return _0x3c1f56[_0x91cb('0x19')](_0x366f09)[_0x91cb('0x1a')]();};}function respondWithResult(_0x2c7d40,_0x4a7d45){_0x4a7d45=_0x4a7d45||0xc8;return function(_0x4cc6ef){if(_0x4cc6ef){return _0x2c7d40[_0x91cb('0x19')](_0x4a7d45)[_0x91cb('0x1b')](_0x4cc6ef);}};}function respondWithFilteredResult(_0x585470,_0x528f73){return function(_0x576369){if(_0x576369){var _0xc3629e=_0x576369[_0x91cb('0x1c')],_0x347980=_0x528f73['offset'],_0x5ea796=_0x528f73[_0x91cb('0x1d')]+_0x528f73[_0x91cb('0x1e')],_0x238f11;if(_0x5ea796>=_0xc3629e){_0x5ea796=_0xc3629e;_0x238f11=0xc8;}else{_0x238f11=0xce;}_0x585470[_0x91cb('0x19')](_0x238f11);return _0x585470[_0x91cb('0x1f')]('Content-Range',_0x347980+'-'+_0x5ea796+'/'+_0xc3629e)[_0x91cb('0x1b')](_0x576369);}return null;};}function patchUpdates(_0x7dcf60){return function(_0x4ca8e8){try{jsonpatch[_0x91cb('0x20')](_0x4ca8e8,_0x7dcf60,!![]);}catch(_0x4c9fb2){return BPromise['reject'](_0x4c9fb2);}return _0x4ca8e8[_0x91cb('0x21')]();};}function saveUpdates(_0x160ded,_0x56e409){return function(_0x51a1d5){if(_0x51a1d5){return _0x51a1d5['update'](_0x160ded)[_0x91cb('0x22')](function(_0x18827b){return _0x18827b;});}return null;};}function removeEntity(_0x20aff5,_0x1dbee2){return function(_0x5c6a15){if(_0x5c6a15){return _0x5c6a15[_0x91cb('0x23')]()[_0x91cb('0x22')](function(){_0x20aff5[_0x91cb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26f18f,_0x1a7a54){return function(_0x2447e7){if(!_0x2447e7){_0x26f18f[_0x91cb('0x18')](0x194);}return _0x2447e7;};}function handleError(_0x3ca500,_0x7ad361){_0x7ad361=_0x7ad361||0x1f4;return function(_0x414e60){logger[_0x91cb('0x24')](_0x414e60[_0x91cb('0x25')]);if(_0x414e60['name']){delete _0x414e60['name'];}_0x3ca500[_0x91cb('0x19')](_0x7ad361)['send'](_0x414e60);};}exports[_0x91cb('0x26')]=function(_0x34d372,_0x318031){var _0x5595c5={},_0x9b26a6={},_0x4f5a7b={'count':0x0,'rows':[]};var _0x4572f6=_[_0x91cb('0x27')](db[_0x91cb('0x28')][_0x91cb('0x29')],function(_0x468908){return{'name':_0x468908['fieldName'],'type':_0x468908[_0x91cb('0x2a')]['key']};});_0x9b26a6[_0x91cb('0x2b')]=_[_0x91cb('0x27')](_0x4572f6,_0x91cb('0x2c'));_0x9b26a6['query']=_[_0x91cb('0x2d')](_0x34d372[_0x91cb('0x2e')]);_0x9b26a6[_0x91cb('0x2f')]=_[_0x91cb('0x30')](_0x9b26a6[_0x91cb('0x2b')],_0x9b26a6[_0x91cb('0x2e')]);_0x5595c5[_0x91cb('0x31')]=_[_0x91cb('0x30')](_0x9b26a6[_0x91cb('0x2b')],qs['fields'](_0x34d372[_0x91cb('0x2e')][_0x91cb('0x32')]));_0x5595c5[_0x91cb('0x31')]=_0x5595c5[_0x91cb('0x31')][_0x91cb('0x33')]?_0x5595c5['attributes']:_0x9b26a6[_0x91cb('0x2b')];if(!_0x34d372[_0x91cb('0x2e')][_0x91cb('0x34')](_0x91cb('0x35'))){_0x5595c5[_0x91cb('0x1e')]=qs['limit'](_0x34d372[_0x91cb('0x2e')]['limit']);_0x5595c5['offset']=qs['offset'](_0x34d372[_0x91cb('0x2e')]['offset']);}_0x5595c5[_0x91cb('0x36')]=qs['sort'](_0x34d372['query'][_0x91cb('0x37')]);_0x5595c5[_0x91cb('0x38')]=qs[_0x91cb('0x2f')](_[_0x91cb('0x39')](_0x34d372[_0x91cb('0x2e')],_0x9b26a6['filters']),_0x4572f6);if(_0x34d372[_0x91cb('0x2e')][_0x91cb('0x3a')]){_0x5595c5[_0x91cb('0x38')]=_[_0x91cb('0x3b')](_0x5595c5['where'],{'$or':_['map'](_0x4572f6,function(_0x1eed21){if(_0x1eed21[_0x91cb('0x2a')]!=='VIRTUAL'){var _0x39bd64={};_0x39bd64[_0x1eed21[_0x91cb('0x2c')]]={'$like':'%'+_0x34d372['query'][_0x91cb('0x3a')]+'%'};return _0x39bd64;}})});}_0x5595c5=_[_0x91cb('0x3b')]({},_0x5595c5,_0x34d372['options']);var _0x43d4fe={'where':_0x5595c5['where']};return db[_0x91cb('0x28')][_0x91cb('0x1c')](_0x43d4fe)[_0x91cb('0x22')](function(_0x279ad5){_0x4f5a7b[_0x91cb('0x1c')]=_0x279ad5;if(_0x34d372[_0x91cb('0x2e')]['includeAll']){_0x5595c5[_0x91cb('0x3c')]=[{'all':!![]}];}return db[_0x91cb('0x28')]['findAll'](_0x5595c5);})[_0x91cb('0x22')](function(_0x4ecbd7){_0x4f5a7b[_0x91cb('0x3d')]=_0x4ecbd7;return _0x4f5a7b;})[_0x91cb('0x22')](respondWithFilteredResult(_0x318031,_0x5595c5))[_0x91cb('0x3e')](handleError(_0x318031,null));};exports[_0x91cb('0x3f')]=function(_0x5e98c4,_0x435fff){var _0x5af0e6={'raw':!![],'where':{'id':_0x5e98c4[_0x91cb('0x40')]['id']}},_0x2cf27e={};_0x2cf27e[_0x91cb('0x2b')]=_[_0x91cb('0x2d')](db[_0x91cb('0x28')][_0x91cb('0x29')]);_0x2cf27e[_0x91cb('0x2e')]=_[_0x91cb('0x2d')](_0x5e98c4['query']);_0x2cf27e[_0x91cb('0x2f')]=_['intersection'](_0x2cf27e[_0x91cb('0x2b')],_0x2cf27e['query']);_0x5af0e6[_0x91cb('0x31')]=_['intersection'](_0x2cf27e[_0x91cb('0x2b')],qs[_0x91cb('0x32')](_0x5e98c4[_0x91cb('0x2e')][_0x91cb('0x32')]));_0x5af0e6['attributes']=_0x5af0e6[_0x91cb('0x31')][_0x91cb('0x33')]?_0x5af0e6['attributes']:_0x2cf27e[_0x91cb('0x2b')];if(_0x5e98c4[_0x91cb('0x2e')][_0x91cb('0x41')]){_0x5af0e6[_0x91cb('0x3c')]=[{'all':!![]}];}_0x5af0e6=_[_0x91cb('0x3b')]({},_0x5af0e6,_0x5e98c4[_0x91cb('0x42')]);return db[_0x91cb('0x28')][_0x91cb('0x43')](_0x5af0e6)[_0x91cb('0x22')](handleEntityNotFound(_0x435fff,null))['then'](respondWithResult(_0x435fff,null))[_0x91cb('0x3e')](handleError(_0x435fff,null));};exports[_0x91cb('0x44')]=function(_0x2b7323,_0x470996){return db[_0x91cb('0x28')][_0x91cb('0x44')](_0x2b7323[_0x91cb('0x45')],{})[_0x91cb('0x22')](respondWithResult(_0x470996,0xc9))['catch'](handleError(_0x470996,null));};exports[_0x91cb('0x46')]=function(_0x46caf1,_0x2b8b7f){if(_0x46caf1[_0x91cb('0x45')]['id']){delete _0x46caf1['body']['id'];}return db[_0x91cb('0x28')][_0x91cb('0x43')]({'where':{'id':_0x46caf1['params']['id']}})[_0x91cb('0x22')](handleEntityNotFound(_0x2b8b7f,null))['then'](saveUpdates(_0x46caf1[_0x91cb('0x45')],null))['then'](respondWithResult(_0x2b8b7f,null))['catch'](handleError(_0x2b8b7f,null));};exports['destroy']=function(_0x98245b,_0xff3d11){return db[_0x91cb('0x28')][_0x91cb('0x43')]({'where':{'id':_0x98245b[_0x91cb('0x40')]['id']}})['then'](handleEntityNotFound(_0xff3d11,null))['then'](removeEntity(_0xff3d11,null))[_0x91cb('0x3e')](handleError(_0xff3d11,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index d33cc46..729de9d 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 _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 +var _0xa35c=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0xa193ea,_0x490360){var _0x403c5c=function(_0x2eac9e){while(--_0x2eac9e){_0xa193ea['push'](_0xa193ea['shift']());}};_0x403c5c(++_0x490360);}(_0xa35c,0xce));var _0xca35=function(_0x38487d,_0x3011cd){_0x38487d=_0x38487d-0x0;var _0x5838d4=_0xa35c[_0x38487d];return _0x5838d4;};'use strict';var _=require(_0xca35('0x0'));var util=require(_0xca35('0x1'));var logger=require(_0xca35('0x2'))(_0xca35('0x3'));var moment=require(_0xca35('0x4'));var BPromise=require(_0xca35('0x5'));var rp=require(_0xca35('0x6'));var fs=require('fs');var path=require(_0xca35('0x7'));var rimraf=require(_0xca35('0x8'));var config=require(_0xca35('0x9'));var attributes=require(_0xca35('0xa'));module[_0xca35('0xb')]=function(_0x2a1e73,_0x2c302d){return _0x2a1e73[_0xca35('0xc')]('FaxApplication',attributes,{'tableName':_0xca35('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xca35('0xe'),'collate':_0xca35('0xf')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 82165e3..f3efc6c 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 _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 +var _0x92d3=['request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','limit','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x2af009,_0x5432ee){var _0x46d15f=function(_0x26569f){while(--_0x26569f){_0x2af009['push'](_0x2af009['shift']());}};_0x46d15f(++_0x5432ee);}(_0x92d3,0x1e5));var _0x392d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x92d3[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x392d('0x0'));var util=require(_0x392d('0x1'));var moment=require(_0x392d('0x2'));var BPromise=require(_0x392d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x392d('0x4'));var db=require(_0x392d('0x5'))['db'];var utils=require(_0x392d('0x6'));var logger=require(_0x392d('0x7'))(_0x392d('0x8'));var config=require('../../config/environment');var jayson=require(_0x392d('0x9'));var client=jayson['client'][_0x392d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19c149,_0x41e7c9,_0x51b228){return new BPromise(function(_0x233d3d,_0x16ca0d){return client[_0x392d('0xb')](_0x19c149,_0x51b228)[_0x392d('0xc')](function(_0x14747f){logger[_0x392d('0xd')](_0x392d('0xe'),_0x41e7c9,_0x392d('0xf'));logger[_0x392d('0x10')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x41e7c9,_0x392d('0xf'),JSON['stringify'](_0x14747f));if(_0x14747f[_0x392d('0x11')]){if(_0x14747f[_0x392d('0x11')][_0x392d('0x12')]===0x1f4){logger[_0x392d('0x11')](_0x392d('0xe'),_0x41e7c9,_0x14747f[_0x392d('0x11')][_0x392d('0x13')]);return _0x16ca0d(_0x14747f[_0x392d('0x11')][_0x392d('0x13')]);}logger[_0x392d('0x11')](_0x392d('0xe'),_0x41e7c9,_0x14747f[_0x392d('0x11')][_0x392d('0x13')]);return _0x233d3d(_0x14747f[_0x392d('0x11')]['message']);}else{logger[_0x392d('0xd')](_0x392d('0xe'),_0x41e7c9,_0x392d('0xf'));_0x233d3d(_0x14747f[_0x392d('0x14')][_0x392d('0x13')]);}})[_0x392d('0x15')](function(_0x193a9a){logger['error'](_0x392d('0xe'),_0x41e7c9,_0x193a9a);_0x16ca0d(_0x193a9a);});});}exports[_0x392d('0x16')]=function(_0x1ede17){var _0xaace1b=this;return new Promise(function(_0x5ef550,_0x5a2d02){return db[_0x392d('0x17')][_0x392d('0x18')](_0x1ede17[_0x392d('0x19')],{'raw':_0x1ede17[_0x392d('0x1a')]?_0x1ede17['options'][_0x392d('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ede17[_0x392d('0x1a')]?_0x1ede17[_0x392d('0x1a')][_0x392d('0x1c')]||null:null,'attributes':_0x1ede17[_0x392d('0x1a')]?_0x1ede17[_0x392d('0x1a')]['attributes']||null:null,'limit':_0x1ede17[_0x392d('0x1a')]?_0x1ede17[_0x392d('0x1a')][_0x392d('0x1d')]||null:null})[_0x392d('0xc')](function(_0x5f56f0){logger['info'](_0x392d('0x16'),_0x1ede17);logger[_0x392d('0x10')](_0x392d('0x16'),_0x1ede17,JSON[_0x392d('0x1e')](_0x5f56f0));_0x5ef550(_0x5f56f0);})[_0x392d('0x15')](function(_0x42b80e){logger[_0x392d('0x11')](_0x392d('0x16'),_0x42b80e[_0x392d('0x13')],_0x1ede17);_0x5a2d02(_0xaace1b[_0x392d('0x11')](0x1f4,_0x42b80e[_0x392d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index e1e19ab..acdb19c 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 _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 +var _0xc4aa=['connect-timeout','express','Router','./faxApplication.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','multer','util','path'];(function(_0x2330fd,_0x56e9c7){var _0x5c1eba=function(_0x517719){while(--_0x517719){_0x2330fd['push'](_0x2330fd['shift']());}};_0x5c1eba(++_0x56e9c7);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xc4aa[_0x1b2ff7];return _0x31656a;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xac4a('0x6'));router[_0xac4a('0x7')]('/',auth[_0xac4a('0x8')](),controller[_0xac4a('0x9')]);router[_0xac4a('0x7')](_0xac4a('0xa'),auth[_0xac4a('0x8')](),controller[_0xac4a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xac4a('0xc')]);router[_0xac4a('0xd')](_0xac4a('0xa'),auth['isAuthenticated'](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')](_0xac4a('0xa'),auth['isAuthenticated'](),controller[_0xac4a('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index d7f4ba3..cf6f56d 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 _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 +var _0x4051=['STRING','DATE','ENUM','out','sequelize','exports'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x4051,0x13c));var _0x1405=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x4051[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x1405('0x0'));module[_0x1405('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x1405('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x1405('0x3')]},'fax':{'type':Sequelize[_0x1405('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x1405('0x4')]('in',_0x1405('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1405('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x1405('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 305b478..7df5ea3 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 _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 +var _0xfff0=['ContactId','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','some','isEmpty','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','DESC','resolve','journey','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','FaxInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','rows','catch','show','params','include','merge','describe','FaxMessage','addMessage','ids','omit','getMessages','pick','$gte','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','addTags','setTags','Tag','emit','download','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','createReadStream','pipe','createWriteStream','log','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxInteraction.socket','register','sendStatus','json','count','offset','status','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','Users','map','TagIds','split','forEach','Tags','push','index','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?'];(function(_0x55eabe,_0x44d1ab){var _0x5df9f7=function(_0x42ffaf){while(--_0x42ffaf){_0x55eabe['push'](_0x55eabe['shift']());}};_0x5df9f7(++_0x44d1ab);}(_0xfff0,0x139));var _0x0fff=function(_0x16f589,_0x1513d6){_0x16f589=_0x16f589-0x0;var _0x3a261e=_0xfff0[_0x16f589];return _0x3a261e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0fff('0x0'));var rimraf=require(_0x0fff('0x1'));var zipdir=require(_0x0fff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0fff('0x3'));var moment=require(_0x0fff('0x4'));var BPromise=require(_0x0fff('0x5'));var Mustache=require('mustache');var util=require(_0x0fff('0x6'));var path=require(_0x0fff('0x7'));var sox=require('sox');var csv=require(_0x0fff('0x8'));var ejs=require(_0x0fff('0x9'));var fs=require('fs');var _=require(_0x0fff('0xa'));var squel=require('squel');var crypto=require(_0x0fff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0fff('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0fff('0xd'));var Papa=require(_0x0fff('0xe'));var Redis=require('ioredis');var authService=require(_0x0fff('0xf'));var qs=require(_0x0fff('0x10'));var as=require(_0x0fff('0x11'));var hardwareService=require(_0x0fff('0x12'));var logger=require(_0x0fff('0x13'))(_0x0fff('0x14'));var utils=require(_0x0fff('0x15'));var config=require(_0x0fff('0x16'));var db=require(_0x0fff('0x17'))['db'];config[_0x0fff('0x18')]=_[_0x0fff('0x19')](config['redis'],{'host':_0x0fff('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0fff('0x18')]));require(_0x0fff('0x1b'))[_0x0fff('0x1c')](socket);function respondWithStatusCode(_0x2c0322,_0x55e5fa){_0x55e5fa=_0x55e5fa||0xcc;return function(_0x53bde9){if(_0x53bde9){return _0x2c0322[_0x0fff('0x1d')](_0x55e5fa);}return _0x2c0322['status'](_0x55e5fa)['end']();};}function respondWithResult(_0x51ceea,_0x1fb430){_0x1fb430=_0x1fb430||0xc8;return function(_0x41e2e7){if(_0x41e2e7){return _0x51ceea['status'](_0x1fb430)[_0x0fff('0x1e')](_0x41e2e7);}};}function respondWithFilteredResult(_0x6c24d2,_0x540a67){return function(_0x528071){if(_0x528071){var _0x48f36d=_0x528071[_0x0fff('0x1f')],_0x2337f=_0x540a67[_0x0fff('0x20')],_0x606792=_0x540a67[_0x0fff('0x20')]+_0x540a67['limit'],_0x46a02d;if(_0x606792>=_0x48f36d){_0x606792=_0x48f36d;_0x46a02d=0xc8;}else{_0x46a02d=0xce;}_0x6c24d2[_0x0fff('0x21')](_0x46a02d);return _0x6c24d2[_0x0fff('0x22')](_0x0fff('0x23'),_0x2337f+'-'+_0x606792+'/'+_0x48f36d)['json'](_0x528071);}return null;};}function patchUpdates(_0x5e27df){return function(_0x40831d){try{jsonpatch[_0x0fff('0x24')](_0x40831d,_0x5e27df,!![]);}catch(_0x1f97c5){return BPromise[_0x0fff('0x25')](_0x1f97c5);}return _0x40831d['save']();};}function saveUpdates(_0x155132,_0x2f8665){return function(_0x29d703){if(_0x29d703){return _0x29d703[_0x0fff('0x26')](_0x155132)[_0x0fff('0x27')](function(_0x17fba6){return _0x17fba6;});}return null;};}function removeEntity(_0x580b8e,_0x6a116c){return function(_0x29f702){if(_0x29f702){return _0x29f702[_0x0fff('0x28')]()[_0x0fff('0x27')](function(){_0x580b8e[_0x0fff('0x21')](0xcc)[_0x0fff('0x29')]();});}};}function handleEntityNotFound(_0x482e1e,_0x2c9725){return function(_0x87b3a6){if(!_0x87b3a6){_0x482e1e[_0x0fff('0x1d')](0x194);}return _0x87b3a6;};}function handleError(_0x440f56,_0x36d268){_0x36d268=_0x36d268||0x1f4;return function(_0x12d699){logger[_0x0fff('0x2a')](_0x12d699[_0x0fff('0x2b')]);if(_0x12d699[_0x0fff('0x2c')]){delete _0x12d699[_0x0fff('0x2c')];}_0x440f56[_0x0fff('0x21')](_0x36d268)[_0x0fff('0x2d')](_0x12d699);};}function getInteractionUsers(_0x495734,_0x7046a3){return new BPromise(function(_0x2d1800,_0x17ab6f){try{if(_0x7046a3[_0x495734['id']]){_0x495734[_0x0fff('0x2e')]=_[_0x0fff('0x2f')](_0x7046a3[_0x495734['id']],function(_0x125844){return{'id':_0x125844['id'],'fullname':_0x125844['fullname']};});}}catch(_0x31f9a4){_0x17ab6f(_0x31f9a4);}_0x2d1800(_0x495734);});}function getInteractionTags(_0xa16c29,_0x351102){return new BPromise(function(_0x48f1d1,_0x1016fa){try{if(_0xa16c29[_0x0fff('0x30')]){_0xa16c29['Tags']=[];_0xa16c29[_0x0fff('0x30')][_0x0fff('0x31')](',')[_0x0fff('0x32')](function(_0x15ae24){_0xa16c29[_0x0fff('0x33')][_0x0fff('0x34')](_0x351102[_0x15ae24]);});}delete _0xa16c29[_0x0fff('0x30')];}catch(_0x213958){_0x1016fa(_0x213958);}_0x48f1d1(_0xa16c29);});}function updateFaxInteraction(_0x3ac875,_0x3aaa62,_0x58469b){return new BPromise(function(_0x157863,_0x1c19f5){return getInteractionUsers(_0x3ac875,_0x58469b)[_0x0fff('0x27')](function(_0x1bbb9e){return getInteractionTags(_0x1bbb9e,_0x3aaa62);})[_0x0fff('0x27')](function(_0x5967dc){_0x157863(_0x5967dc);})['catch'](function(_0x316057){_0x1c19f5(_0x316057);});});}exports[_0x0fff('0x35')]=function(_0x648285,_0x30a131){var _0x5c1797={},_0x2458fb={},_0x2f5616={'count':0x0,'rows':[]};var _0x13347d=_[_0x0fff('0x2f')](db['FaxInteraction'][_0x0fff('0x36')],function(_0xfadd4f){return{'name':_0xfadd4f[_0x0fff('0x37')],'type':_0xfadd4f[_0x0fff('0x38')][_0x0fff('0x39')]};});_0x2458fb[_0x0fff('0x3a')]=_[_0x0fff('0x2f')](_0x13347d,_0x0fff('0x2c'));_0x2458fb[_0x0fff('0x3b')]=_[_0x0fff('0x3c')](_0x648285[_0x0fff('0x3b')]);_0x2458fb[_0x0fff('0x3d')]=_['intersection'](_0x2458fb[_0x0fff('0x3a')],_0x2458fb[_0x0fff('0x3b')]);_0x5c1797[_0x0fff('0x3e')]=_[_0x0fff('0x3f')](_0x2458fb[_0x0fff('0x3a')],qs[_0x0fff('0x40')](_0x648285['query'][_0x0fff('0x40')]));_0x5c1797[_0x0fff('0x3e')]=_0x5c1797[_0x0fff('0x3e')][_0x0fff('0x41')]?_0x5c1797[_0x0fff('0x3e')]:_0x2458fb[_0x0fff('0x3a')];if(!_0x648285[_0x0fff('0x3b')][_0x0fff('0x42')](_0x0fff('0x43'))){_0x5c1797['limit']=qs[_0x0fff('0x44')](_0x648285['query'][_0x0fff('0x44')]);_0x5c1797[_0x0fff('0x20')]=qs[_0x0fff('0x20')](_0x648285['query']['offset']);}_0x5c1797[_0x0fff('0x45')]=qs[_0x0fff('0x46')](_0x648285[_0x0fff('0x3b')]['sort']);_0x5c1797['where']=qs[_0x0fff('0x3d')](_['pick'](_0x648285[_0x0fff('0x3b')],_0x2458fb[_0x0fff('0x3d')]),_0x13347d);var _0x8352c1=[];var _0x309d75=squel[_0x0fff('0x47')]()[_0x0fff('0x48')]('id')['field'](_0x0fff('0x2c'))[_0x0fff('0x48')](_0x0fff('0x49'))[_0x0fff('0x4a')](_0x0fff('0x4b'));var _0xebc17b=squel[_0x0fff('0x47')]()['field'](_0x0fff('0x4c'))[_0x0fff('0x48')](_0x0fff('0x4d'))['field'](_0x0fff('0x4e'))[_0x0fff('0x4a')](_0x0fff('0x4f'),'ui')[_0x0fff('0x50')](_0x0fff('0x51'),'u',_0x0fff('0x52'));var _0x2f73cf=squel[_0x0fff('0x47')]()[_0x0fff('0x4a')](_0x0fff('0x53'),'i')[_0x0fff('0x50')]('cm_contacts','c',_0x0fff('0x54'))[_0x0fff('0x50')]('users','o',_0x0fff('0x55'))[_0x0fff('0x50')](_0x0fff('0x56'),'a','a.id\x20=\x20i.FaxAccountId')['left_join'](_0x0fff('0x57'),'me','me.FaxInteractionId\x20=\x20i.id')['left_join'](_0x0fff('0x58'),'it',_0x0fff('0x59'))[_0x0fff('0x50')](_0x0fff('0x4b'),'t',_0x0fff('0x5a'));var _0x1a7677=squel['expr']();var _0x350144=[];var _0x3ee3e3=squel[_0x0fff('0x5b')]();var _0x32568a;if(_0x648285[_0x0fff('0x3b')][_0x0fff('0x5c')]){_0x32568a=as['parseSearch'](_0x648285[_0x0fff('0x3b')][_0x0fff('0x5c')]);var _0x47f8db=_0x32568a[_0x0fff('0x5d')];for(var _0x4bae35=0x0;_0x4bae35<_0x32568a['conditions']['length'];_0x4bae35++){var _0x218e1c=_0x32568a[_0x0fff('0x5e')][_0x4bae35];var _0x15f725='i';var _0x194ed8=_[_0x0fff('0x5f')](_0x13347d,['name',_0x218e1c[_0x0fff('0x48')]]);if(!_0x194ed8){switch(_0x218e1c[_0x0fff('0x48')]){case _0x0fff('0x60'):if(_0x218e1c[_0x0fff('0x61')]==0x1){_0x2f73cf[_0x0fff('0x62')]('`'+_0x218e1c['field']+_0x0fff('0x63'));}else{_0x2f73cf[_0x0fff('0x62')]('`'+_0x218e1c[_0x0fff('0x48')]+_0x0fff('0x64'));}break;case _0x0fff('0x65'):if(_0x218e1c[_0x0fff('0x66')]===_0x0fff('0x67')){if(_0x218e1c[_0x0fff('0x61')][_0x0fff('0x31')]('\x20')[_0x0fff('0x41')]>0x1){_0x1a7677[_0x47f8db](_0x0fff('0x68'),qs[_0x0fff('0x69')](_0x218e1c[_0x0fff('0x61')]),null);}else{var _0x2608be='%'+_0x218e1c[_0x0fff('0x61')]+'%';_0x1a7677[_0x47f8db](_0x0fff('0x6a'),_0x2608be,_0x2608be,_0x2608be);}}else{_0x194ed8=_[_0x0fff('0x5f')](_0x13347d,[_0x0fff('0x2c'),_0x0fff('0x6b')]);_0x218e1c[_0x0fff('0x48')]=_0x0fff('0x6b');_0x56d5c5=as['buildExpression'](_0x15f725,_0x194ed8[_0x0fff('0x38')],_0x218e1c);_0x1a7677[_0x47f8db](_0x56d5c5[_0x0fff('0x6c')],_0x56d5c5[_0x0fff('0x61')][_0x0fff('0x6d')],_0x56d5c5['value'][_0x0fff('0x29')]);}break;case'Tag':var _0x3d6e54=_0x218e1c[_0x0fff('0x61')][_0x0fff('0x31')](',')[_0x0fff('0x2f')](function(_0x4bf865){return Number(_0x4bf865);});_0x3d6e54[_0x0fff('0x32')](function(_0x169855){_0x3ee3e3['or'](_0x0fff('0x6e'),'%,'+_0x169855+',%');});_0x350144=_[_0x0fff('0x6f')](_0x350144,_0x3d6e54);break;case'User':if(_0x218e1c['operator']===_0x0fff('0x67')){_0x1a7677[_0x47f8db](_0x0fff('0x70'),'%'+_0x218e1c[_0x0fff('0x61')]+'%',null);}else{_0x194ed8=_[_0x0fff('0x5f')](_0x13347d,[_0x0fff('0x2c'),_0x0fff('0x71')]);_0x218e1c['field']='UserId';_0x56d5c5=as[_0x0fff('0x72')](_0x15f725,_0x194ed8[_0x0fff('0x38')],_0x218e1c);_0x1a7677[_0x47f8db](_0x56d5c5[_0x0fff('0x6c')],_0x56d5c5[_0x0fff('0x61')][_0x0fff('0x6d')],_0x56d5c5[_0x0fff('0x61')][_0x0fff('0x29')]);}break;case _0x0fff('0x73'):_0x56d5c5=as['buildExpression']('me',null,_0x218e1c);_0x1a7677[_0x47f8db](_0x56d5c5[_0x0fff('0x6c')],_0x56d5c5['value'][_0x0fff('0x6d')],_0x56d5c5[_0x0fff('0x61')][_0x0fff('0x29')]);break;}}else{var _0x56d5c5=as['buildExpression'](_0x15f725,_0x194ed8[_0x0fff('0x38')],_0x218e1c);_0x1a7677[_0x47f8db](_0x56d5c5['text'],_0x56d5c5[_0x0fff('0x61')][_0x0fff('0x6d')],_0x56d5c5[_0x0fff('0x61')][_0x0fff('0x29')]);}}}else{var _0x4e3a31=_(_0x648285[_0x0fff('0x3b')])[_0x0fff('0x3c')]()['map'](function(_0x38e5d7){return _[_0x0fff('0x74')](_0x13347d,[_0x0fff('0x2c'),_0x38e5d7])?_0x38e5d7:undefined;})['compact']()[_0x0fff('0x61')]();if(!_[_0x0fff('0x75')](_0x4e3a31)){_0x4e3a31[_0x0fff('0x32')](function(_0x383d78){if(_0x383d78===_0x0fff('0x76')){_0x2f73cf[_0x0fff('0x77')](_0x0fff('0x78'),[][_0x0fff('0x79')](_0x648285[_0x0fff('0x3b')][_0x383d78]));}else if(_0x383d78===_0x0fff('0x7a')){var _0x1a5988=JSON[_0x0fff('0x7b')](_0x648285['query'][_0x383d78])['$gte'];var _0x247819=JSON['parse'](_0x648285['query'][_0x383d78])[_0x0fff('0x7c')];_0x2f73cf[_0x0fff('0x77')](_0x0fff('0x7d'),_0x1a5988,_0x247819);}else{if(_0x648285['query'][_0x383d78]==='null'){_0x2f73cf[_0x0fff('0x77')]('i.'+_0x383d78+_0x0fff('0x7e'));}else{_0x2f73cf[_0x0fff('0x77')]('i.'+_0x383d78+_0x0fff('0x7f'),_0x648285['query'][_0x383d78]);}}});}if(_0x648285[_0x0fff('0x3b')][_0x0fff('0x80')]){if(_0x648285[_0x0fff('0x3b')][_0x0fff('0x80')]==0x1){_0x2f73cf['having'](_0x0fff('0x81'));}else{_0x2f73cf[_0x0fff('0x62')]('`unreadMessages`\x20>\x200');}}if(_0x648285['query'][_0x0fff('0x82')]){_0x350144=_[_0x0fff('0x83')](_0x648285[_0x0fff('0x3b')][_0x0fff('0x82')])?_0x648285[_0x0fff('0x3b')]['tag']:new Array(_0x648285[_0x0fff('0x3b')][_0x0fff('0x82')]);_0x350144[_0x0fff('0x32')](function(_0x2d77bd){_0x3ee3e3['or'](_0x0fff('0x6e'),'%,'+_0x2d77bd+',%');});}if(_0x648285['query']['filter']){var _0x3713a9=_0x648285['query'][_0x0fff('0x84')][_0x0fff('0x85')]('\x5c','\x5c\x5c')[_0x0fff('0x85')]('\x27\x27',_0x0fff('0x86'));if(qs[_0x0fff('0x87')](_0x3713a9)){_0x1a7677['or']('i.id\x20LIKE\x20?',_0x3713a9+'%')['or'](_0x0fff('0x88'),_0x3713a9+'%');}_0x1a7677['or'](_0x0fff('0x89'),_0x3713a9+'%');}}_0x2f73cf[_0x0fff('0x77')](_0x1a7677);_0x2f73cf[_0x0fff('0x8a')](_0x0fff('0x8b'));var _0x15ab8e={'type':db[_0x0fff('0x8c')][_0x0fff('0x8d')][_0x0fff('0x8e')],'raw':!![]};var _0xfac929=_0x2f73cf[_0x0fff('0x8f')]();_0xfac929['field'](_0x0fff('0x8b'));_0xfac929[_0x0fff('0x48')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0fff('0x60'));if(_0x5c1797['order']){_0x5c1797[_0x0fff('0x45')][_0x0fff('0x32')](function(_0x1f2314){_0x2f73cf[_0x0fff('0x45')]('i.'+_0x1f2314[0x0],_0x1f2314[0x1]===_0x0fff('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x350144)){_0x2f73cf[_0x0fff('0x62')](_0x3ee3e3);_0xfac929[_0x0fff('0x77')]('t.id\x20IN\x20?',_0x350144);}BPromise[_0x0fff('0x91')]()[_0x0fff('0x27')](function(){if(!_0x32568a){if(_0x648285[_0x0fff('0x3b')]['FaxAccountId']||_0x648285[_0x0fff('0x3b')][_0x0fff('0x92')])return;_0xfac929['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x2f73cf[_0x0fff('0x77')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}return _0x648285['user'][_0x0fff('0x93')]({'attributes':['id'],'raw':!![]})[_0x0fff('0x27')](function(_0x258df6){if(_['isEmpty'](_0x258df6)){_0xfac929['where'](_0x0fff('0x94'));_0x2f73cf['where'](_0x0fff('0x94'));}else{_0xfac929[_0x0fff('0x77')](_0x0fff('0x78'),_[_0x0fff('0x2f')](_0x258df6,'id'));_0x2f73cf[_0x0fff('0x77')](_0x0fff('0x78'),_[_0x0fff('0x2f')](_0x258df6,'id'));}});})['then'](function(){db[_0x0fff('0x95')][_0x0fff('0x3b')](_0xfac929[_0x0fff('0x96')](),_0x15ab8e)[_0x0fff('0x27')](function(_0x340048){_0x2f5616[_0x0fff('0x1f')]=_0x340048['length'];if(_0x2f5616[_0x0fff('0x1f')]===0x0)return[];return db['sequelize'][_0x0fff('0x3b')](_0x309d75[_0x0fff('0x96')](),_0x15ab8e)[_0x0fff('0x27')](function(_0x4542c2){_0x8352c1=_['keyBy'](_0x4542c2,'id');_0x15ab8e=_['merge'](_0x15ab8e,{'model':db[_0x0fff('0x97')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x648285['query'][_0x0fff('0x40')]){_0x5c1797[_0x0fff('0x3e')]['forEach'](function(_0x5b04f2){_0x2f73cf[_0x0fff('0x48')]('i.'+_0x5b04f2);});}else{_0x2f73cf[_0x0fff('0x48')](_0x0fff('0x98'),_0x0fff('0x60'));_0x2f73cf['field'](_0x0fff('0x99'),'Account.key');_0x2f73cf[_0x0fff('0x48')](_0x0fff('0x9a'),_0x0fff('0x9b'));_0x2f73cf['field']('i.*');_0x2f73cf['field'](_0x0fff('0x9c'),'Contact.firstName');_0x2f73cf[_0x0fff('0x48')](_0x0fff('0x9d'),_0x0fff('0x9e'));_0x2f73cf[_0x0fff('0x48')](_0x0fff('0x9f'),_0x0fff('0xa0'));_0x2f73cf[_0x0fff('0x48')](_0x0fff('0xa1'),_0x0fff('0xa2'));_0x2f73cf[_0x0fff('0x48')](_0x0fff('0xa3'),'Contact.mobile');_0x2f73cf[_0x0fff('0x48')](_0x0fff('0xa4'),_0x0fff('0xa5'));_0x2f73cf[_0x0fff('0x48')](_0x0fff('0xa6'),'Owner.fullname');_0x2f73cf[_0x0fff('0x48')](_0x0fff('0xa7'),'Owner.internal');_0x2f73cf[_0x0fff('0x48')](_0x0fff('0xa8'),_0x0fff('0x30'));}if(_0x5c1797[_0x0fff('0x44')])_0x2f73cf[_0x0fff('0x44')](_0x5c1797[_0x0fff('0x44')]);if(_0x5c1797[_0x0fff('0x20')])_0x2f73cf[_0x0fff('0x20')](_0x5c1797[_0x0fff('0x20')]);return db[_0x0fff('0x95')]['query'](_0x2f73cf[_0x0fff('0x96')](),_0x15ab8e);})[_0x0fff('0x27')](function(_0x2404b2){_0xebc17b[_0x0fff('0x77')](_0x0fff('0xa9'),_[_0x0fff('0x2f')](_0x2404b2,'id'));return db[_0x0fff('0x95')]['query'](_0xebc17b[_0x0fff('0x96')](),_0x15ab8e)['then'](function(_0x11eeb6){var _0x3e3166=_[_0x0fff('0xaa')](_0x11eeb6,_0x0fff('0xab'));var _0x29ed33=[];_0x2404b2['forEach'](function(_0x359653){_0x29ed33['push'](updateFaxInteraction(_0x359653,_0x8352c1,_0x3e3166));});return BPromise['all'](_0x29ed33);});});})[_0x0fff('0x27')](function(_0x173b44){_0x2f5616[_0x0fff('0xac')]=_0x173b44;return _0x2f5616;})[_0x0fff('0x27')](respondWithFilteredResult(_0x30a131,_0x5c1797));})[_0x0fff('0xad')](handleError(_0x30a131,null));};exports[_0x0fff('0xae')]=function(_0x5bc4e1,_0x50f95c){var _0x5b637e={'raw':![],'where':{'id':_0x5bc4e1[_0x0fff('0xaf')]['id']}},_0x1bd02a={};_0x1bd02a[_0x0fff('0x3a')]=_[_0x0fff('0x3c')](db[_0x0fff('0x97')][_0x0fff('0x36')]);_0x1bd02a[_0x0fff('0x3b')]=_[_0x0fff('0x3c')](_0x5bc4e1[_0x0fff('0x3b')]);_0x1bd02a[_0x0fff('0x3d')]=_[_0x0fff('0x3f')](_0x1bd02a[_0x0fff('0x3a')],_0x1bd02a[_0x0fff('0x3b')]);_0x5b637e[_0x0fff('0x3e')]=_[_0x0fff('0x3f')](_0x1bd02a[_0x0fff('0x3a')],qs[_0x0fff('0x40')](_0x5bc4e1['query'][_0x0fff('0x40')]));_0x5b637e[_0x0fff('0x3e')]=_0x5b637e[_0x0fff('0x3e')][_0x0fff('0x41')]?_0x5b637e[_0x0fff('0x3e')]:_0x1bd02a[_0x0fff('0x3a')];if(_0x5bc4e1[_0x0fff('0x3b')]['includeAll']){_0x5b637e[_0x0fff('0xb0')]=[{'all':!![]}];}_0x5b637e=_[_0x0fff('0xb1')]({},_0x5b637e,_0x5bc4e1['options']);return db[_0x0fff('0x97')]['find'](_0x5b637e)[_0x0fff('0x27')](handleEntityNotFound(_0x50f95c,null))[_0x0fff('0x27')](respondWithResult(_0x50f95c,null))['catch'](handleError(_0x50f95c,null));};exports['create']=function(_0x5613e5,_0x22da86){return db['FaxInteraction']['create'](_0x5613e5['body'],{})['then'](respondWithResult(_0x22da86,0xc9))[_0x0fff('0xad')](handleError(_0x22da86,null));};exports['update']=function(_0x1ec5e6,_0x502215){if(_0x1ec5e6[_0x0fff('0x73')]['id']){delete _0x1ec5e6['body']['id'];}return db[_0x0fff('0x97')][_0x0fff('0x5f')]({'where':{'id':_0x1ec5e6['params']['id']}})['then'](handleEntityNotFound(_0x502215,null))[_0x0fff('0x27')](saveUpdates(_0x1ec5e6[_0x0fff('0x73')],null))[_0x0fff('0x27')](respondWithResult(_0x502215,null))[_0x0fff('0xad')](handleError(_0x502215,null));};exports[_0x0fff('0x28')]=function(_0x259628,_0x2aa43a){return db['FaxInteraction'][_0x0fff('0x5f')]({'where':{'id':_0x259628[_0x0fff('0xaf')]['id']}})[_0x0fff('0x27')](handleEntityNotFound(_0x2aa43a,null))[_0x0fff('0x27')](removeEntity(_0x2aa43a,null))['catch'](handleError(_0x2aa43a,null));};exports[_0x0fff('0xb2')]=function(_0x1d1264,_0x5bf8ad){return db['FaxInteraction']['describe']()[_0x0fff('0x27')](respondWithResult(_0x5bf8ad,null))[_0x0fff('0xad')](handleError(_0x5bf8ad,null));};exports['addMessage']=function(_0x3712af,_0x30a508,_0x4ab665){return db[_0x0fff('0xb3')][_0x0fff('0x5f')]({'where':{'id':_0x3712af[_0x0fff('0xaf')]['id']}})['then'](handleEntityNotFound(_0x30a508,null))['then'](function(_0x2eeee9){if(_0x2eeee9){return _0x2eeee9[_0x0fff('0xb4')](_0x3712af['body'][_0x0fff('0xb5')],_[_0x0fff('0xb6')](_0x3712af[_0x0fff('0x73')],[_0x0fff('0xb5'),'id'])||{});}})[_0x0fff('0x27')](respondWithResult(_0x30a508,null))[_0x0fff('0xad')](handleError(_0x30a508,null));};exports[_0x0fff('0xb7')]=function(_0x1b500a,_0x327b5,_0x320c2d){var _0x10aa61={'raw':![],'where':{}};var _0xc99224={};var _0x59127e={'count':0x0,'rows':[]};return db[_0x0fff('0x97')]['findOne']({'where':{'id':_0x1b500a[_0x0fff('0xaf')]['id']}})['then'](handleEntityNotFound(_0x327b5,null))[_0x0fff('0x27')](function(_0x5336){if(_0x5336){_0xc99224[_0x0fff('0x3a')]=_[_0x0fff('0x3c')](db[_0x0fff('0xb3')][_0x0fff('0x36')]);_0xc99224['query']=_[_0x0fff('0x3c')](_0x1b500a[_0x0fff('0x3b')]);_0xc99224['filters']=_[_0x0fff('0x3f')](_0xc99224['model'],_0xc99224['query']);_0x10aa61[_0x0fff('0x3e')]=_[_0x0fff('0x3f')](_0xc99224[_0x0fff('0x3a')],qs[_0x0fff('0x40')](_0x1b500a[_0x0fff('0x3b')][_0x0fff('0x40')]));_0x10aa61['attributes']=_0x10aa61[_0x0fff('0x3e')][_0x0fff('0x41')]?_0x10aa61[_0x0fff('0x3e')]:_0xc99224[_0x0fff('0x3a')];if(!_0x1b500a[_0x0fff('0x3b')]['hasOwnProperty'](_0x0fff('0x43'))){_0x10aa61[_0x0fff('0x44')]=qs[_0x0fff('0x44')](_0x1b500a[_0x0fff('0x3b')][_0x0fff('0x44')]);_0x10aa61[_0x0fff('0x20')]=qs[_0x0fff('0x20')](_0x1b500a['query']['offset']);}_0x10aa61[_0x0fff('0x45')]=qs['sort'](_0x1b500a[_0x0fff('0x3b')]['sort']);_0x10aa61['where']=qs['filters'](_[_0x0fff('0xb8')](_0x1b500a[_0x0fff('0x3b')],_0xc99224[_0x0fff('0x3d')]));_0x10aa61[_0x0fff('0x77')][_0x0fff('0xab')]=_0x5336['id'];if(_0x1b500a['query'][_0x0fff('0x84')]){_0x10aa61[_0x0fff('0x77')]=_[_0x0fff('0xb1')](_0x10aa61[_0x0fff('0x77')],{'$or':_[_0x0fff('0x2f')](_0x10aa61[_0x0fff('0x3e')],function(_0x40c1a8){var _0x115445={};_0x115445[_0x40c1a8]={'$like':'%'+_0x1b500a['query']['filter']+'%'};return _0x115445;})});}if(_0x1b500a[_0x0fff('0x3b')][_0x0fff('0xb9')]){var _0x2c599f=_0x1b500a['query'][_0x0fff('0xb9')][_0x0fff('0x31')](',');var _0x141d89={};_0x141d89[_0x2c599f[0x0]]={'$gte':moment(_0x2c599f[0x1])['format'](_0x0fff('0xba'))};_0x10aa61[_0x0fff('0x77')]=_[_0x0fff('0xb1')](_0x10aa61[_0x0fff('0x77')],_0x141d89);}_0x10aa61=_[_0x0fff('0xb1')]({},_0x10aa61,_0x1b500a[_0x0fff('0xbb')]);return db[_0x0fff('0xb3')]['count']({'where':_0x10aa61['where']})['then'](function(_0x247b3a){_0x59127e[_0x0fff('0x1f')]=_0x247b3a;if(_0x1b500a[_0x0fff('0x3b')][_0x0fff('0xbc')]){_0x10aa61[_0x0fff('0xb0')]=[{'all':!![]}];}return db[_0x0fff('0xb3')]['findAll'](_0x10aa61);})[_0x0fff('0x27')](function(_0x2f98b6){_0x59127e[_0x0fff('0xac')]=_0x2f98b6;return _0x59127e;});}})['then'](respondWithFilteredResult(_0x327b5,_0x10aa61))['catch'](handleError(_0x327b5,null));};exports[_0x0fff('0xbd')]=function(_0x51f70b,_0x8bcb8b,_0x15ed92){return db['FaxInteraction'][_0x0fff('0x5f')]({'where':{'id':_0x51f70b[_0x0fff('0xaf')]['id']}})['then'](handleEntityNotFound(_0x8bcb8b,null))[_0x0fff('0x27')](function(_0x2497b7){if(_0x2497b7){return _0x2497b7[_0x0fff('0xbe')](_0x51f70b[_0x0fff('0x73')][_0x0fff('0xb5')],_[_0x0fff('0xb6')](_0x51f70b['body'],[_0x0fff('0xb5'),'id'])||{})['spread'](function(){return db[_0x0fff('0xbf')]['findAll']({'attributes':['id',_0x0fff('0x2c'),'color'],'where':{'id':_0x51f70b[_0x0fff('0x73')][_0x0fff('0xb5')]}});})[_0x0fff('0x27')](function(_0x55f902){socket[_0x0fff('0xc0')]('faxInteractionTags:save',{'id':Number(_0x51f70b[_0x0fff('0xaf')]['id']),'tags':_0x55f902||[]});return{'id':Number(_0x51f70b[_0x0fff('0xaf')]['id']),'tags':_0x55f902||[]};});}})[_0x0fff('0x27')](respondWithResult(_0x8bcb8b,null))['catch'](handleError(_0x8bcb8b,null));};exports['removeTags']=function(_0x4b1b2f,_0x30a237,_0x57ed16){return db['FaxInteraction'][_0x0fff('0x5f')]({'where':{'id':_0x4b1b2f[_0x0fff('0xaf')]['id']}})[_0x0fff('0x27')](handleEntityNotFound(_0x30a237,null))[_0x0fff('0x27')](function(_0x314c84){if(_0x314c84){return _0x314c84['removeTags'](_0x4b1b2f[_0x0fff('0x3b')]['ids']);}})[_0x0fff('0x27')](respondWithStatusCode(_0x30a237,null))[_0x0fff('0xad')](handleError(_0x30a237,null));};exports[_0x0fff('0xc1')]=function(_0x188b79,_0x5cbaf8){var _0x2fa9e0=moment()['unix']()[_0x0fff('0x96')]();var _0x464cef=path[_0x0fff('0xc2')](config[_0x0fff('0xc3')],_0x0fff('0xc4'),'files','tmp');var _0x8b874d=path[_0x0fff('0xc2')](config[_0x0fff('0xc3')],'server',_0x0fff('0xc5'),_0x0fff('0xc6'));var _0x153c8a=path['join'](_0x464cef,_0x2fa9e0);var _0x3a8267=util['format'](_0x0fff('0xc7'),_0x188b79[_0x0fff('0xaf')]['id'],_0x2fa9e0);var _0x3df9df=path[_0x0fff('0xc2')](_0x464cef,_0x3a8267);var _0x1fc042=[];_0x1fc042[_0x0fff('0x34')]({'model':db[_0x0fff('0xc8')],'as':_0x0fff('0xc8'),'raw':!![]});var _0x3691f1=[{'model':db[_0x0fff('0xb3')],'as':'Messages','attributes':['id',_0x0fff('0x73'),_0x0fff('0x7a')],'include':_0x1fc042}];return db[_0x0fff('0x97')][_0x0fff('0x5f')]({'where':{'id':_0x188b79[_0x0fff('0xaf')]['id']},'include':_0x3691f1})[_0x0fff('0x27')](handleEntityNotFound(_0x5cbaf8,null))['then'](function(_0x58fde1){if(_0x58fde1&&_0x58fde1[_0x0fff('0xc9')]){var _0x4f5914=_0x58fde1[_0x0fff('0xca')]({'plain':!![]});fs[_0x0fff('0xcb')](_0x153c8a);for(var _0x545191=0x0;_0x545191<_0x4f5914[_0x0fff('0xc9')]['length'];_0x545191++){var _0x1b0ff4=_0x4f5914['Messages'][_0x545191]['Attachment'];if(_0x1b0ff4){var _0x5a7c28=path['join'](_0x8b874d,_0x1b0ff4['basename']);if(fs['existsSync'](_0x5a7c28)){fs[_0x0fff('0xcc')](_0x5a7c28)[_0x0fff('0xcd')](fs[_0x0fff('0xce')](path[_0x0fff('0xc2')](_0x153c8a,_0x1b0ff4['basename'])));}}}return BPromise[_0x0fff('0x91')]()['then'](function(){return new BPromise(function(_0x1f94b2,_0x5e6692){zipdir(_0x153c8a,{'saveTo':_0x3df9df},function(_0x752a12,_0x5bed22){if(_0x752a12)return _0x5e6692(_0x752a12);return _0x1f94b2(_0x5bed22);});})['then'](function(){return new BPromise(function(_0x5a6583,_0x29b6ab){rimraf(_0x153c8a,function(_0x2f8cf0){if(_0x2f8cf0)_0x29b6ab(_0x2f8cf0);return _0x5a6583();});});})[_0x0fff('0x27')](function(){return _0x5cbaf8[_0x0fff('0xc1')](_0x3df9df,_0x3a8267,function(_0x3033eb){if(_0x3033eb){console[_0x0fff('0xcf')](_0x0fff('0xd0'),_0x3033eb);}else{fs[_0x0fff('0xd1')](_0x3df9df);}});});});}else{return _0x5cbaf8[_0x0fff('0x1d')](0xc8);}})[_0x0fff('0xad')](handleError(_0x5cbaf8,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 87150d7..cfe7358 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 _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 +var _0x1261=['exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty'];(function(_0x443dda,_0x166898){var _0x29d49b=function(_0x2a027){while(--_0x2a027){_0x443dda['push'](_0x443dda['shift']());}};_0x29d49b(++_0x166898);}(_0x1261,0x144));var _0x1126=function(_0x5b27da,_0x4a6532){_0x5b27da=_0x5b27da-0x0;var _0x3254f4=_0x1261[_0x5b27da];return _0x3254f4;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x1126('0x0'))['db'][_0x1126('0x1')];var FaxMessage=require(_0x1126('0x0'))['db'][_0x1126('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1126('0x3')](0x0);var events={'afterCreate':_0x1126('0x4'),'afterUpdate':_0x1126('0x5'),'afterDestroy':_0x1126('0x6')};function emitEvent(_0x21a480){return function(_0x75a851,_0x5a2189,_0x5c68c8){_0x75a851[_0x1126('0x7')]({'attributes':['id'],'raw':!![]})[_0x1126('0x8')](function(_0x4f239c){_0x75a851[_0x1126('0x9')](_0x1126('0xa'),_0x4f239c[_0x1126('0xb')](function(_0x3abb0b){return{'id':_0x3abb0b['id']};}));return FaxMessage[_0x1126('0xc')]({'where':{'FaxInteractionId':_0x75a851['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3f09ac){_0x75a851[_0x1126('0x9')](_0x1126('0xd'),_0x3f09ac['length']);FaxInteractionEvents[_0x1126('0xe')](_0x21a480+':'+_0x75a851['id'],_0x75a851);FaxInteractionEvents['emit'](_0x21a480,_0x75a851);_0x5c68c8(null);})['catch'](_0x5c68c8(null));};}for(var e in events){if(events[_0x1126('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x1126('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 90fe17b..65a6c6c 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 _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 +var _0x2709=['changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','path','rimraf','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions'];(function(_0x3af0f2,_0x5bc727){var _0x557a6a=function(_0x153961){while(--_0x153961){_0x3af0f2['push'](_0x3af0f2['shift']());}};_0x557a6a(++_0x5bc727);}(_0x2709,0x112));var _0x9270=function(_0x151f32,_0x2c1420){_0x151f32=_0x151f32-0x0;var _0xd05b16=_0x2709[_0x151f32];return _0xd05b16;};'use strict';var _=require(_0x9270('0x0'));var util=require('util');var logger=require(_0x9270('0x1'))(_0x9270('0x2'));var moment=require(_0x9270('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9270('0x4'));var rimraf=require(_0x9270('0x5'));var config=require('../../config/environment');var attributes=require(_0x9270('0x6'));module[_0x9270('0x7')]=function(_0x25ae31,_0x57ea60){return _0x25ae31[_0x9270('0x8')](_0x9270('0x9'),attributes,{'tableName':_0x9270('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x39a062,_0x2a6f16,_0x22e6c7){if(_0x39a062[_0x9270('0xb')](_0x9270('0xc'))){_0x39a062[_0x9270('0xd')]=moment()['format'](_0x9270('0xe'));}_0x22e6c7(null,_0x39a062);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index d6531b8..2505dbb 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 _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 +var _0xf7d2=['stringify','error','message','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','where','attributes','limit','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x599c44,_0x2fb16e){var _0x1d6cf6=function(_0x43f375){while(--_0x43f375){_0x599c44['push'](_0x599c44['shift']());}};_0x1d6cf6(++_0x2fb16e);}(_0xf7d2,0x172));var _0x2f7d=function(_0x279de7,_0x5ac30d){_0x279de7=_0x279de7-0x0;var _0xcc8d9b=_0xf7d2[_0x279de7];return _0xcc8d9b;};'use strict';var _=require('lodash');var util=require(_0x2f7d('0x0'));var moment=require(_0x2f7d('0x1'));var BPromise=require(_0x2f7d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f7d('0x3'));var db=require(_0x2f7d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2f7d('0x5'))('rpc');var config=require(_0x2f7d('0x6'));var jayson=require(_0x2f7d('0x7'));var client=jayson[_0x2f7d('0x8')][_0x2f7d('0x9')]({'port':0x232a});config['redis']=_[_0x2f7d('0xa')](config[_0x2f7d('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x2f7d('0xc'))(new Redis(config[_0x2f7d('0xb')]));require('./faxInteraction.socket')[_0x2f7d('0xd')](socket);function respondWithRpcPromise(_0x469ee6,_0x4a2d79,_0x111760){return new BPromise(function(_0x1acab9,_0x191669){return client[_0x2f7d('0xe')](_0x469ee6,_0x111760)[_0x2f7d('0xf')](function(_0x522b2f){logger[_0x2f7d('0x10')](_0x2f7d('0x11'),_0x4a2d79,_0x2f7d('0x12'));logger[_0x2f7d('0x13')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x4a2d79,_0x2f7d('0x12'),JSON[_0x2f7d('0x14')](_0x522b2f));if(_0x522b2f['error']){if(_0x522b2f[_0x2f7d('0x15')]['code']===0x1f4){logger[_0x2f7d('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x4a2d79,_0x522b2f[_0x2f7d('0x15')]['message']);return _0x191669(_0x522b2f[_0x2f7d('0x15')][_0x2f7d('0x16')]);}logger['error'](_0x2f7d('0x11'),_0x4a2d79,_0x522b2f[_0x2f7d('0x15')][_0x2f7d('0x16')]);return _0x1acab9(_0x522b2f[_0x2f7d('0x15')][_0x2f7d('0x16')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x4a2d79,_0x2f7d('0x12'));_0x1acab9(_0x522b2f['result']['message']);}})[_0x2f7d('0x17')](function(_0x14ba4c){logger[_0x2f7d('0x15')](_0x2f7d('0x11'),_0x4a2d79,_0x14ba4c);_0x191669(_0x14ba4c);});});}exports[_0x2f7d('0x18')]=function(_0x40d939){var _0x241e79=this;return new Promise(function(_0x341066,_0x5283ac){return db[_0x2f7d('0x19')]['update'](_0x40d939[_0x2f7d('0x1a')],{'raw':_0x40d939[_0x2f7d('0x1b')]?_0x40d939[_0x2f7d('0x1b')][_0x2f7d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40d939[_0x2f7d('0x1b')]?_0x40d939['options'][_0x2f7d('0x1d')]||null:null,'attributes':_0x40d939[_0x2f7d('0x1b')]?_0x40d939['options'][_0x2f7d('0x1e')]||null:null,'limit':_0x40d939[_0x2f7d('0x1b')]?_0x40d939[_0x2f7d('0x1b')][_0x2f7d('0x1f')]||null:null})[_0x2f7d('0xf')](function(_0x16eeaf){logger[_0x2f7d('0x10')](_0x2f7d('0x18'),_0x40d939);logger[_0x2f7d('0x13')](_0x2f7d('0x18'),_0x40d939,JSON[_0x2f7d('0x14')](_0x16eeaf));_0x341066(_0x16eeaf);})[_0x2f7d('0x17')](function(_0x5c53e9){logger[_0x2f7d('0x15')](_0x2f7d('0x18'),_0x5c53e9[_0x2f7d('0x16')],_0x40d939);_0x5283ac(_0x241e79['error'](0x1f4,_0x5c53e9[_0x2f7d('0x16')]));});});};exports[_0x2f7d('0x20')]=function(_0x5ca268){return new Promise(function(_0x50fdaf,_0x2d626a){return db['FaxInteraction'][_0x2f7d('0x21')]({'where':_0x5ca268[_0x2f7d('0x1b')]?_0x5ca268[_0x2f7d('0x1b')]['where']||null:null})[_0x2f7d('0xf')](function(_0x2f388c){if(_0x2f388c){return _0x2f388c[_0x2f7d('0x22')](_0x5ca268[_0x2f7d('0x1a')][_0x2f7d('0x23')],_[_0x2f7d('0x24')](_0x5ca268['body'],[_0x2f7d('0x23'),'id'])||{});}})[_0x2f7d('0x25')](function(_0x221277){logger[_0x2f7d('0x10')](_0x2f7d('0x26'),_0x5ca268);logger[_0x2f7d('0x13')]('AddTags',_0x5ca268,JSON[_0x2f7d('0x14')](_0x221277));_0x50fdaf(_0x221277);})[_0x2f7d('0x17')](function(_0x4a8193){logger[_0x2f7d('0x15')](_0x2f7d('0x26'),_0x4a8193[_0x2f7d('0x16')],_0x5ca268);_0x2d626a(_this['error'](0x1f4,_0x4a8193[_0x2f7d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 1bfe564..1982232 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 _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 +var _0x3c18=['./faxInteraction.events','save','remove','update','removeListener','register','faxInteraction:'];(function(_0x47f23d,_0x13d2ed){var _0x1340a4=function(_0x12b177){while(--_0x12b177){_0x47f23d['push'](_0x47f23d['shift']());}};_0x1340a4(++_0x13d2ed);}(_0x3c18,0x1c7));var _0x83c1=function(_0x332e31,_0x379ec9){_0x332e31=_0x332e31-0x0;var _0x3d9408=_0x3c18[_0x332e31];return _0x3d9408;};'use strict';var FaxInteractionEvents=require(_0x83c1('0x0'));var events=[_0x83c1('0x1'),_0x83c1('0x2'),_0x83c1('0x3')];function createListener(_0xb5a9e9,_0x3afe82){return function(_0x2586c4){_0x3afe82['emit'](_0xb5a9e9,_0x2586c4);};}function removeListener(_0x409b5b,_0x47186c){return function(){FaxInteractionEvents[_0x83c1('0x4')](_0x409b5b,_0x47186c);};}exports[_0x83c1('0x5')]=function(_0x196ff5){for(var _0xf1228d=0x0,_0x469627=events['length'];_0xf1228d<_0x469627;_0xf1228d++){var _0x11a7d9=events[_0xf1228d];var _0x172c83=createListener(_0x83c1('0x6')+_0x11a7d9,_0x196ff5);FaxInteractionEvents['on'](_0x11a7d9,_0x172c83);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index c721d44..c01ff73 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 _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 +var _0x3361=['post','addMessage','/:id/tags','faxinteraction:addtags','addTags','tracked','fax','faxinteraction:update','update','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxInteraction.controller','isAuthenticated','index','get','/describe','/:id','show','getMessages','/:id/download','download'];(function(_0x295a92,_0x7d70dc){var _0x3f5dac=function(_0x47b9e8){while(--_0x47b9e8){_0x295a92['push'](_0x295a92['shift']());}};_0x3f5dac(++_0x7d70dc);}(_0x3361,0x124));var _0x1336=function(_0x168ee5,_0x2c04e1){_0x168ee5=_0x168ee5-0x0;var _0x3a4b43=_0x3361[_0x168ee5];return _0x3a4b43;};'use strict';var multer=require(_0x1336('0x0'));var util=require(_0x1336('0x1'));var path=require(_0x1336('0x2'));var timeout=require(_0x1336('0x3'));var express=require(_0x1336('0x4'));var router=express[_0x1336('0x5')]();var auth=require(_0x1336('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1336('0x7'));var controller=require(_0x1336('0x8'));router['get']('/',auth[_0x1336('0x9')](),controller[_0x1336('0xa')]);router[_0x1336('0xb')](_0x1336('0xc'),auth[_0x1336('0x9')](),controller['describe']);router['get'](_0x1336('0xd'),auth['isAuthenticated'](),controller[_0x1336('0xe')]);router[_0x1336('0xb')]('/:id/messages',auth[_0x1336('0x9')](),controller[_0x1336('0xf')]);router[_0x1336('0xb')](_0x1336('0x10'),auth[_0x1336('0x9')](),controller[_0x1336('0x11')]);router[_0x1336('0x12')]('/',auth[_0x1336('0x9')](),controller['create']);router[_0x1336('0x12')]('/:id/messages',auth[_0x1336('0x9')](),controller[_0x1336('0x13')]);router['post'](_0x1336('0x14'),auth[_0x1336('0x9')](),interaction['tracked']('fax',_0x1336('0x15')),controller[_0x1336('0x16')]);router['put'](_0x1336('0xd'),auth[_0x1336('0x9')](),interaction[_0x1336('0x17')](_0x1336('0x18'),_0x1336('0x19')),controller[_0x1336('0x1a')]);router[_0x1336('0x1b')](_0x1336('0xd'),auth[_0x1336('0x9')](),interaction[_0x1336('0x17')](_0x1336('0x18'),'faxinteraction:destroy'),controller[_0x1336('0x1c')]);router['delete'](_0x1336('0x14'),auth[_0x1336('0x9')](),controller[_0x1336('0x1d')]);module[_0x1336('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 727976e..c04c45d 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 _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 +var _0xf406=['BOOLEAN','ENUM','out','DATE','exports','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf406,0x15a));var _0x6f40=function(_0x50972d,_0x1376a9){_0x50972d=_0x50972d-0x0;var _0x334bb8=_0xf406[_0x50972d];return _0x334bb8;};'use strict';var Sequelize=require('sequelize');module[_0x6f40('0x0')]={'body':{'type':Sequelize[_0x6f40('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x6f40('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6f40('0x3')]('in',_0x6f40('0x4')),'defaultValue':_0x6f40('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x6f40('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x6f40('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 98247a2..1abc0b0 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 _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 +var _0x36b9=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','ValidationError','then','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','sendStatus','status','end','count','offset','set','Content-Range','json','apply','save','update','stack','name','send','map','FaxMessage','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','find','catch','body','params','destroy','describe','../../config/logger','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','FaxInteraction','FaxInteractionId','isNil','read1stAt','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','stringify','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','EventManager','fax-interactions','reject','agent','role','RejectMessage','rejectMessage','rejectmessage','create','findOne','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','root','server','files','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','to-csv','ejs','squel','crypto','jsforce','desk.js'];(function(_0x35c287,_0x32da43){var _0x91b030=function(_0x1e2e36){while(--_0x1e2e36){_0x35c287['push'](_0x35c287['shift']());}};_0x91b030(++_0x32da43);}(_0x36b9,0x17c));var _0x936b=function(_0x862db4,_0x50b080){_0x862db4=_0x862db4-0x0;var _0x3ff95d=_0x36b9[_0x862db4];return _0x3ff95d;};'use strict';var pdf=require(_0x936b('0x0'));var emlformat=require(_0x936b('0x1'));var rimraf=require(_0x936b('0x2'));var zipdir=require(_0x936b('0x3'));var jsonpatch=require(_0x936b('0x4'));var rp=require('request-promise');var moment=require(_0x936b('0x5'));var BPromise=require(_0x936b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x936b('0x7'));var ejs=require(_0x936b('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x936b('0x9'));var crypto=require(_0x936b('0xa'));var jsforce=require(_0x936b('0xb'));var deskjs=require(_0x936b('0xc'));var toCsv=require(_0x936b('0x7'));var querystring=require('querystring');var Papa=require(_0x936b('0xd'));var Redis=require(_0x936b('0xe'));var authService=require(_0x936b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x936b('0x10'));var hardwareService=require(_0x936b('0x11'));var logger=require('../../config/logger')(_0x936b('0x12'));var utils=require(_0x936b('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x936b('0x14')]=_['defaults'](config[_0x936b('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x936b('0x15'))(new Redis(config[_0x936b('0x14')]));require(_0x936b('0x16'))['register'](socket);var jayson=require(_0x936b('0x17'));var client=jayson[_0x936b('0x18')][_0x936b('0x19')]({'port':0x232c});var client9002=jayson[_0x936b('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x11e5ad,_0x2c9bdf,_0x2f0254){if(_0x2f0254){var _0x2f5169=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2f5169['test'](_0x2c9bdf)){return _0x11e5ad;}else{throw new db['Sequelize'][(_0x936b('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 _0x11e5ad;}}function respondWithRpcPromise(_0x19dd95,_0x4f915,_0x4fd4d3,_0xfdb779){return new BPromise(function(_0x3acea0,_0x442c1a){var _0x2a69c7=_0xfdb779||client;return _0x2a69c7['request'](_0x19dd95,_0x4fd4d3)[_0x936b('0x1b')](function(_0x481b8d){logger['info'](_0x936b('0x1c'),_0x4f915,'request\x20sent');logger[_0x936b('0x1d')](_0x936b('0x1e'),_0x4f915,_0x936b('0x1f'),JSON['stringify'](_0x481b8d));if(_0x481b8d[_0x936b('0x20')]){if(_0x481b8d[_0x936b('0x20')][_0x936b('0x21')]===0x1f4){logger[_0x936b('0x20')](_0x936b('0x1c'),_0x4f915,_0x481b8d['error'][_0x936b('0x22')]);return _0x442c1a(_0x481b8d[_0x936b('0x20')][_0x936b('0x22')]);}logger[_0x936b('0x20')]('FaxMessage,\x20%s,\x20%s',_0x4f915,_0x481b8d[_0x936b('0x20')][_0x936b('0x22')]);return _0x3acea0(_0x481b8d[_0x936b('0x20')][_0x936b('0x22')]);}else{logger[_0x936b('0x23')](_0x936b('0x1c'),_0x4f915,'request\x20sent');_0x3acea0(_0x481b8d[_0x936b('0x24')][_0x936b('0x22')]);}})['catch'](function(_0x54521a){logger['error']('FaxMessage,\x20%s,\x20%s',_0x4f915,_0x54521a);_0x442c1a(_0x54521a);});});}function respondWithStatusCode(_0x827b8,_0x2fa19e){_0x2fa19e=_0x2fa19e||0xcc;return function(_0x1ab8a0){if(_0x1ab8a0){return _0x827b8[_0x936b('0x25')](_0x2fa19e);}return _0x827b8[_0x936b('0x26')](_0x2fa19e)[_0x936b('0x27')]();};}function respondWithResult(_0x2485e4,_0x72f4b4){_0x72f4b4=_0x72f4b4||0xc8;return function(_0x5b8e0e){if(_0x5b8e0e){return _0x2485e4[_0x936b('0x26')](_0x72f4b4)['json'](_0x5b8e0e);}};}function respondWithFilteredResult(_0x15856c,_0x3b953f){return function(_0x5a5e3c){if(_0x5a5e3c){var _0x23419a=_0x5a5e3c[_0x936b('0x28')],_0x2eaf80=_0x3b953f[_0x936b('0x29')],_0x36942f=_0x3b953f[_0x936b('0x29')]+_0x3b953f['limit'],_0x5efe62;if(_0x36942f>=_0x23419a){_0x36942f=_0x23419a;_0x5efe62=0xc8;}else{_0x5efe62=0xce;}_0x15856c[_0x936b('0x26')](_0x5efe62);return _0x15856c[_0x936b('0x2a')](_0x936b('0x2b'),_0x2eaf80+'-'+_0x36942f+'/'+_0x23419a)[_0x936b('0x2c')](_0x5a5e3c);}return null;};}function patchUpdates(_0x5d996d){return function(_0x14bf23){try{jsonpatch[_0x936b('0x2d')](_0x14bf23,_0x5d996d,!![]);}catch(_0x3f0006){return BPromise['reject'](_0x3f0006);}return _0x14bf23[_0x936b('0x2e')]();};}function saveUpdates(_0x31daf5,_0x2f641b){return function(_0x51fd04){if(_0x51fd04){return _0x51fd04[_0x936b('0x2f')](_0x31daf5)['then'](function(_0x42ecb7){return _0x42ecb7;});}return null;};}function removeEntity(_0x277d81,_0x5a0ea0){return function(_0x3353dd){if(_0x3353dd){return _0x3353dd['destroy']()[_0x936b('0x1b')](function(){_0x277d81[_0x936b('0x26')](0xcc)[_0x936b('0x27')]();});}};}function handleEntityNotFound(_0x143528,_0x21784c){return function(_0x2cd2a5){if(!_0x2cd2a5){_0x143528[_0x936b('0x25')](0x194);}return _0x2cd2a5;};}function handleError(_0x49cdc6,_0x16d123){_0x16d123=_0x16d123||0x1f4;return function(_0x1143e1){logger[_0x936b('0x20')](_0x1143e1[_0x936b('0x30')]);if(_0x1143e1[_0x936b('0x31')]){delete _0x1143e1['name'];}_0x49cdc6[_0x936b('0x26')](_0x16d123)[_0x936b('0x32')](_0x1143e1);};}exports['index']=function(_0x10a607,_0x2c17c5){var _0x410e9e={},_0x344292={},_0x57d40b={'count':0x0,'rows':[]};var _0x14981c=_[_0x936b('0x33')](db[_0x936b('0x34')][_0x936b('0x35')],function(_0x3b8e5e){return{'name':_0x3b8e5e['fieldName'],'type':_0x3b8e5e[_0x936b('0x36')][_0x936b('0x37')]};});_0x344292[_0x936b('0x38')]=_[_0x936b('0x33')](_0x14981c,_0x936b('0x31'));_0x344292[_0x936b('0x39')]=_[_0x936b('0x3a')](_0x10a607['query']);_0x344292['filters']=_[_0x936b('0x3b')](_0x344292['model'],_0x344292[_0x936b('0x39')]);_0x410e9e[_0x936b('0x3c')]=_[_0x936b('0x3b')](_0x344292[_0x936b('0x38')],qs[_0x936b('0x3d')](_0x10a607[_0x936b('0x39')][_0x936b('0x3d')]));_0x410e9e[_0x936b('0x3c')]=_0x410e9e[_0x936b('0x3c')][_0x936b('0x3e')]?_0x410e9e[_0x936b('0x3c')]:_0x344292[_0x936b('0x38')];if(!_0x10a607[_0x936b('0x39')][_0x936b('0x3f')](_0x936b('0x40'))){_0x410e9e[_0x936b('0x41')]=qs[_0x936b('0x41')](_0x10a607[_0x936b('0x39')]['limit']);_0x410e9e[_0x936b('0x29')]=qs[_0x936b('0x29')](_0x10a607[_0x936b('0x39')][_0x936b('0x29')]);}_0x410e9e[_0x936b('0x42')]=qs[_0x936b('0x43')](_0x10a607[_0x936b('0x39')]['sort']);_0x410e9e[_0x936b('0x44')]=qs[_0x936b('0x45')](_[_0x936b('0x46')](_0x10a607[_0x936b('0x39')],_0x344292[_0x936b('0x45')]),_0x14981c);if(_0x10a607['query']['filter']){_0x410e9e[_0x936b('0x44')]=_[_0x936b('0x47')](_0x410e9e['where'],{'$or':_['map'](_0x14981c,function(_0x12e0aa){if(_0x12e0aa[_0x936b('0x36')]!==_0x936b('0x48')){var _0x2600d0={};_0x2600d0[_0x12e0aa['name']]={'$like':'%'+_0x10a607[_0x936b('0x39')][_0x936b('0x49')]+'%'};return _0x2600d0;}})});}_0x410e9e=_[_0x936b('0x47')]({},_0x410e9e,_0x10a607[_0x936b('0x4a')]);var _0x1951e6={'where':_0x410e9e[_0x936b('0x44')]};return db[_0x936b('0x34')][_0x936b('0x28')](_0x1951e6)[_0x936b('0x1b')](function(_0x1e390e){_0x57d40b[_0x936b('0x28')]=_0x1e390e;if(_0x10a607[_0x936b('0x39')][_0x936b('0x4b')]){_0x410e9e[_0x936b('0x4c')]=[{'all':!![]}];}return db[_0x936b('0x34')][_0x936b('0x4d')](_0x410e9e);})[_0x936b('0x1b')](function(_0x1dab2e){_0x57d40b[_0x936b('0x4e')]=_0x1dab2e;return _0x57d40b;})[_0x936b('0x1b')](respondWithFilteredResult(_0x2c17c5,_0x410e9e))['catch'](handleError(_0x2c17c5,null));};exports['show']=function(_0x3e7772,_0x15c323){var _0x14b2d6={'raw':!![],'where':{'id':_0x3e7772['params']['id']}},_0x276bd5={};_0x276bd5[_0x936b('0x38')]=_['keys'](db['FaxMessage'][_0x936b('0x35')]);_0x276bd5[_0x936b('0x39')]=_['keys'](_0x3e7772[_0x936b('0x39')]);_0x276bd5[_0x936b('0x45')]=_[_0x936b('0x3b')](_0x276bd5[_0x936b('0x38')],_0x276bd5['query']);_0x14b2d6[_0x936b('0x3c')]=_['intersection'](_0x276bd5[_0x936b('0x38')],qs[_0x936b('0x3d')](_0x3e7772[_0x936b('0x39')][_0x936b('0x3d')]));_0x14b2d6[_0x936b('0x3c')]=_0x14b2d6[_0x936b('0x3c')][_0x936b('0x3e')]?_0x14b2d6[_0x936b('0x3c')]:_0x276bd5[_0x936b('0x38')];if(_0x3e7772['query'][_0x936b('0x4b')]){_0x14b2d6[_0x936b('0x4c')]=[{'all':!![]}];}_0x14b2d6=_[_0x936b('0x47')]({},_0x14b2d6,_0x3e7772[_0x936b('0x4a')]);return db[_0x936b('0x34')][_0x936b('0x4f')](_0x14b2d6)[_0x936b('0x1b')](handleEntityNotFound(_0x15c323,null))[_0x936b('0x1b')](respondWithResult(_0x15c323,null))[_0x936b('0x50')](handleError(_0x15c323,null));};exports[_0x936b('0x2f')]=function(_0x218f0e,_0x249369){if(_0x218f0e[_0x936b('0x51')]['id']){delete _0x218f0e[_0x936b('0x51')]['id'];}return db[_0x936b('0x34')][_0x936b('0x4f')]({'where':{'id':_0x218f0e[_0x936b('0x52')]['id']}})[_0x936b('0x1b')](handleEntityNotFound(_0x249369,null))[_0x936b('0x1b')](saveUpdates(_0x218f0e[_0x936b('0x51')],null))[_0x936b('0x1b')](respondWithResult(_0x249369,null))['catch'](handleError(_0x249369,null));};exports[_0x936b('0x53')]=function(_0x52adff,_0x4f7eca){return db[_0x936b('0x34')][_0x936b('0x4f')]({'where':{'id':_0x52adff[_0x936b('0x52')]['id']}})[_0x936b('0x1b')](handleEntityNotFound(_0x4f7eca,null))[_0x936b('0x1b')](removeEntity(_0x4f7eca,null))[_0x936b('0x50')](handleError(_0x4f7eca,null));};exports[_0x936b('0x54')]=function(_0x35497c,_0xde4029){return db['FaxMessage'][_0x936b('0x54')]()[_0x936b('0x1b')](respondWithResult(_0xde4029,null))['catch'](handleError(_0xde4029,null));};var interaction_log=require(_0x936b('0x55'))('fax-interactions');exports[_0x936b('0x56')]=function(_0x491b06,_0x195670,_0x4b04e2){var _0x4fa1f4={'channel':_0x936b('0x57')};if(_0x491b06[_0x936b('0x51')]['id']){delete _0x491b06[_0x936b('0x51')]['id'];}_0x491b06['body'][_0x936b('0x58')]=!![];_0x491b06[_0x936b('0x51')]['readAt']=moment()[_0x936b('0x59')](_0x936b('0x5a'));_0x491b06[_0x936b('0x51')]['UserId']=_0x491b06[_0x936b('0x51')][_0x936b('0x5b')]||_0x491b06[_0x936b('0x5c')]['id'];return db[_0x936b('0x34')][_0x936b('0x4f')]({'where':{'id':_0x491b06[_0x936b('0x52')]['id'],'UserId':null},'include':[{'model':db[_0x936b('0x5d')],'as':_0x936b('0x5e')}]})['then'](handleEntityNotFound(_0x195670,null))['then'](saveUpdates(_0x491b06[_0x936b('0x51')],null))[_0x936b('0x1b')](function(_0x1a153d){if(_0x1a153d){_0x4fa1f4['message']=_0x1a153d['get']({'plain':!![]});return db[_0x936b('0x5f')][_0x936b('0x4f')]({'where':{'id':_0x1a153d[_0x936b('0x60')]}});}return null;})[_0x936b('0x1b')](handleEntityNotFound(_0x195670,null))[_0x936b('0x1b')](function(_0x46b99b){if(_0x46b99b){return _0x46b99b[_0x936b('0x2f')]({'UserId':_0x491b06[_0x936b('0x51')][_0x936b('0x5b')],'read1stAt':_[_0x936b('0x61')](_0x46b99b[_0x936b('0x62')])?moment()[_0x936b('0x59')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x936b('0x1b')](function(_0x42507a){if(_0x42507a){_0x4fa1f4['interaction']=_0x42507a[_0x936b('0x63')]({'plain':!![]});interaction_log[_0x936b('0x23')](_0x936b('0x64'),_0x491b06[_0x936b('0x5c')]['id'],_0x491b06[_0x936b('0x5c')][_0x936b('0x31')],_0x491b06[_0x936b('0x5c')]['role'],_0x4fa1f4[_0x936b('0x65')]['id'],_0x491b06['body']?JSON[_0x936b('0x66')](_0x491b06['body']):_0x936b('0x67'));return respondWithRpcPromise(_0x936b('0x68'),_0x936b('0x69'),_0x4fa1f4);}return null;})[_0x936b('0x1b')](function(_0x1273e6){if(_0x1273e6){if(_0x491b06[_0x936b('0x51')][_0x936b('0x6a')]){_0x4fa1f4['message'][_0x936b('0x6b')]=util[_0x936b('0x59')](_0x936b('0x6c'),_0x491b06[_0x936b('0x5c')][_0x936b('0x31')]);_0x4fa1f4['message'][_0x936b('0x6d')]=_0x4fa1f4['channel'];_0x4fa1f4[_0x936b('0x22')]['event']=_0x936b('0x56');return respondWithRpcPromise(_0x936b('0x6e'),_0x936b('0x6e'),{'event':'acceptmessage','message':_0x4fa1f4[_0x936b('0x22')]},client9002)['then'](function(){return _0x4fa1f4;});}return _0x4fa1f4;}return null;})[_0x936b('0x1b')](respondWithResult(_0x195670,null))['catch'](handleError(_0x195670,null));};var interaction_log=require(_0x936b('0x55'))(_0x936b('0x6f'));exports[_0x936b('0x70')]=function(_0x2d3692,_0x2513e3,_0x1fb2b0){var _0xccb105={'agent':{},'channel':_0x936b('0x57')};if(_0x2d3692[_0x936b('0x51')]['id']){delete _0x2d3692['body']['id'];}_0x2d3692['body'][_0x936b('0x5b')]=_0x2d3692[_0x936b('0x51')]['UserId']||_0x2d3692[_0x936b('0x5c')]['id'];_0xccb105[_0x936b('0x71')]['id']=_0x2d3692['body'][_0x936b('0x5b')];return db[_0x936b('0x34')][_0x936b('0x4f')]({'where':{'id':_0x2d3692['params']['id'],'UserId':null}})[_0x936b('0x1b')](handleEntityNotFound(_0x2513e3,null))[_0x936b('0x1b')](function(_0x5813b5){if(_0x5813b5){_0xccb105[_0x936b('0x22')]=_0x5813b5['get']({'plain':!![]});return db[_0x936b('0x5f')][_0x936b('0x4f')]({'where':{'id':_0x5813b5[_0x936b('0x60')]}});}return null;})[_0x936b('0x1b')](handleEntityNotFound(_0x2513e3,null))[_0x936b('0x1b')](function(_0x4807ac){if(_0x4807ac){_0xccb105[_0x936b('0x65')]=_0x4807ac[_0x936b('0x63')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2d3692[_0x936b('0x5c')]['id'],_0x2d3692[_0x936b('0x5c')][_0x936b('0x31')],_0x2d3692[_0x936b('0x5c')][_0x936b('0x72')],_0xccb105['interaction']['id'],_0x2d3692[_0x936b('0x51')]?JSON[_0x936b('0x66')](_0x2d3692[_0x936b('0x51')]):_0x936b('0x67'));return respondWithRpcPromise(_0x936b('0x73'),_0x936b('0x74'),_0xccb105);}return null;})[_0x936b('0x1b')](function(_0x120562){if(_0x120562){_0x120562[_0x936b('0x22')]['interface']=util[_0x936b('0x59')](_0x936b('0x6c'),_0x2d3692[_0x936b('0x5c')][_0x936b('0x31')]);_0x120562[_0x936b('0x22')][_0x936b('0x6d')]=_0xccb105[_0x936b('0x6d')];_0x120562[_0x936b('0x22')]['event']=_0x936b('0x70');respondWithRpcPromise(_0x936b('0x6e'),_0x936b('0x6e'),{'event':_0x936b('0x75'),'message':_0x120562['message']},client9002);return _0xccb105;}return null;})[_0x936b('0x1b')](respondWithResult(_0x2513e3,null))[_0x936b('0x50')](handleError(_0x2513e3,null));};exports[_0x936b('0x76')]=function(_0xc2d7bc,_0x16f8e2){var _0x205bc2;return db[_0x936b('0x34')][_0x936b('0x76')](_0xc2d7bc['body'],{})['then'](function(_0x16e234){_0x205bc2=_0x16e234;return db[_0x936b('0x5d')][_0x936b('0x77')]({'where':{'id':_0x205bc2['ContactId']}});})[_0x936b('0x1b')](function(_0x1e1de5){if(_[_0x936b('0x61')](_0x1e1de5)){return;}else{_0x205bc2[_0x936b('0x57')]=_0x1e1de5['fax'];return db[_0x936b('0x78')][_0x936b('0x77')]({'where':{'id':_0x205bc2['AttachmentId']}});}})['then'](function(_0x331fd5){return respondWithRpcPromise(_0x936b('0x79'),_0x936b('0x79'),{'FaxAccountId':_[_0x936b('0x61')](_0xc2d7bc[_0x936b('0x51')])?undefined:_0xc2d7bc[_0x936b('0x51')][_0x936b('0x7a')],'path':_[_0x936b('0x61')](_0x331fd5)?undefined:util['format'](_0x936b('0x7b'),_0x331fd5[_0x936b('0x7c')]),'fax':_['isNil'](_0x205bc2[_0x936b('0x57')])?undefined:_0x205bc2[_0x936b('0x57')],'AttachmentId':_0x205bc2[_0x936b('0x7d')]},client9002);})[_0x936b('0x1b')](respondWithResult(_0x16f8e2,0xc9))[_0x936b('0x50')](handleError(_0x16f8e2,null));};exports[_0x936b('0x7e')]=function(_0xbe129b,_0x5cd703){var _0x443fdd=path[_0x936b('0x7f')](config[_0x936b('0x80')],_0x936b('0x81'),_0x936b('0x82'),'attachments');return db[_0x936b('0x34')][_0x936b('0x4f')]({'where':{'id':_0xbe129b[_0x936b('0x52')]['id']},'include':[{'model':db[_0x936b('0x78')],'as':'Attachment'}]})[_0x936b('0x1b')](handleEntityNotFound(_0x5cd703,null))['then'](function(_0x128dde){if(_0x128dde){return _0x5cd703[_0x936b('0x7e')](path[_0x936b('0x7f')](_0x443fdd,_0x128dde[_0x936b('0x78')][_0x936b('0x7c')]));}})[_0x936b('0x50')](handleError(_0x5cd703,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index e9128c7..7486383 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 _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 +var _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','FaxMessage','setMaxListeners','update','remove'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x34e8,0x12c));var _0x834e=function(_0x457243,_0x403379){_0x457243=_0x457243-0x0;var _0x4e33b4=_0x34e8[_0x457243];return _0x4e33b4;};'use strict';var EventEmitter=require(_0x834e('0x0'));var FaxMessage=require(_0x834e('0x1'))['db'][_0x834e('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x834e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x834e('0x4'),'afterDestroy':_0x834e('0x5')};function emitEvent(_0x472111){return function(_0x31bf20,_0x289ef2,_0x19a3e0){FaxMessageEvents[_0x834e('0x6')](_0x472111+':'+_0x31bf20['id'],_0x31bf20);FaxMessageEvents['emit'](_0x472111,_0x31bf20);_0x19a3e0(null);};}for(var e in events){if(events[_0x834e('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x834e('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 08ecead..f805672 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 _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 +var _0x2f95=['secret','isNil','FaxInteraction','findOne','FaxInteractionId','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','body','FULLTEXT','models','direction','toLowerCase'];(function(_0x278d8d,_0x458be8){var _0x8a6be7=function(_0xbefe2b){while(--_0xbefe2b){_0x278d8d['push'](_0x278d8d['shift']());}};_0x8a6be7(++_0x458be8);}(_0x2f95,0x1a0));var _0x52f9=function(_0x509592,_0x51310c){_0x509592=_0x509592-0x0;var _0x222336=_0x2f95[_0x509592];return _0x222336;};'use strict';var _=require(_0x52f9('0x0'));var util=require(_0x52f9('0x1'));var logger=require(_0x52f9('0x2'))(_0x52f9('0x3'));var moment=require('moment');var BPromise=require(_0x52f9('0x4'));var rp=require(_0x52f9('0x5'));var fs=require('fs');var path=require(_0x52f9('0x6'));var rimraf=require(_0x52f9('0x7'));var config=require(_0x52f9('0x8'));var attributes=require(_0x52f9('0x9'));module[_0x52f9('0xa')]=function(_0x170d8b,_0x4136b1){return _0x170d8b[_0x52f9('0xb')](_0x52f9('0xc'),attributes,{'tableName':_0x52f9('0xd'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x52f9('0xe')],'type':_0x52f9('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4ce2a8,_0x1be2f8,_0x3e5999){var _0x36cb3d=_0x170d8b[_0x52f9('0x10')];var _0xe82294=_0x4ce2a8['get']({'plain':!![]});if(_0xe82294[_0x52f9('0x11')][_0x52f9('0x12')]()==='in'||_0xe82294[_0x52f9('0x11')][_0x52f9('0x12')]()==='out'&&!_0xe82294[_0x52f9('0x13')]&&!_[_0x52f9('0x14')](_0xe82294['UserId'])){_0x36cb3d[_0x52f9('0x15')][_0x52f9('0x16')]({'where':{'id':_0xe82294[_0x52f9('0x17')]}})['then'](function(_0x38bde2){if(_0x38bde2){_0x38bde2[_0x52f9('0x18')]({'lastMsgAt':_0xe82294['createdAt'],'lastMsgDirection':_0xe82294[_0x52f9('0x11')][_0x52f9('0x12')]()});}})[_0x52f9('0x19')](function(_0x45710c){console[_0x52f9('0x1a')](_0x45710c);});}_0x3e5999();}},'charset':_0x52f9('0x1b'),'collate':_0x52f9('0x1c')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 11b3ead..ee772a1 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 _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 +var _0x390a=['localhost','./faxMessage.socket','register','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateFaxMessage','create','body','options','raw','catch','FaxMessage','update','where','attributes','limit','then','UpdateFaxMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x390a,0xbe));var _0xa390=function(_0xd2b56f,_0x161dcc){_0xd2b56f=_0xd2b56f-0x0;var _0x51daec=_0x390a[_0xd2b56f];return _0x51daec;};'use strict';var _=require(_0xa390('0x0'));var util=require(_0xa390('0x1'));var moment=require(_0xa390('0x2'));var BPromise=require(_0xa390('0x3'));var rs=require(_0xa390('0x4'));var fs=require('fs');var Redis=require(_0xa390('0x5'));var db=require(_0xa390('0x6'))['db'];var utils=require(_0xa390('0x7'));var logger=require(_0xa390('0x8'))(_0xa390('0x9'));var config=require(_0xa390('0xa'));var jayson=require(_0xa390('0xb'));var client=jayson[_0xa390('0xc')]['http']({'port':0x232a});config[_0xa390('0xd')]=_[_0xa390('0xe')](config['redis'],{'host':_0xa390('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa390('0x10'))[_0xa390('0x11')](socket);function respondWithRpcPromise(_0xf5b97f,_0x8a741a,_0x475ecc){return new BPromise(function(_0x4e94e6,_0x38dfdb){return client[_0xa390('0x12')](_0xf5b97f,_0x475ecc)['then'](function(_0x3a9a18){logger[_0xa390('0x13')](_0xa390('0x14'),_0x8a741a,_0xa390('0x15'));logger[_0xa390('0x16')](_0xa390('0x17'),_0x8a741a,'request\x20sent',JSON[_0xa390('0x18')](_0x3a9a18));if(_0x3a9a18[_0xa390('0x19')]){if(_0x3a9a18[_0xa390('0x19')]['code']===0x1f4){logger['error'](_0xa390('0x14'),_0x8a741a,_0x3a9a18['error'][_0xa390('0x1a')]);return _0x38dfdb(_0x3a9a18[_0xa390('0x19')][_0xa390('0x1a')]);}logger[_0xa390('0x19')](_0xa390('0x14'),_0x8a741a,_0x3a9a18['error']['message']);return _0x4e94e6(_0x3a9a18['error'][_0xa390('0x1a')]);}else{logger[_0xa390('0x13')]('FaxMessage,\x20%s,\x20%s',_0x8a741a,_0xa390('0x15'));_0x4e94e6(_0x3a9a18[_0xa390('0x1b')][_0xa390('0x1a')]);}})['catch'](function(_0x192f3d){logger[_0xa390('0x19')](_0xa390('0x14'),_0x8a741a,_0x192f3d);_0x38dfdb(_0x192f3d);});});}exports[_0xa390('0x1c')]=function(_0x22298c){var _0x112e46=this;return new Promise(function(_0x4b8fe1,_0xba6a8){return db['FaxMessage'][_0xa390('0x1d')](_0x22298c[_0xa390('0x1e')],{'raw':_0x22298c['options']?_0x22298c[_0xa390('0x1f')][_0xa390('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x361b2f){logger[_0xa390('0x13')](_0xa390('0x1c'),_0x22298c);logger['debug'](_0xa390('0x1c'),_0x22298c,JSON[_0xa390('0x18')](_0x361b2f));_0x4b8fe1(_0x361b2f);})[_0xa390('0x21')](function(_0x10e815){logger[_0xa390('0x19')](_0xa390('0x1c'),_0x10e815[_0xa390('0x1a')],_0x22298c);_0xba6a8(_0x112e46[_0xa390('0x19')](0x1f4,_0x10e815['message']));});});};exports['UpdateFaxMessage']=function(_0x2f01be){var _0x54b25f=this;return new Promise(function(_0x5af8ef,_0x19f161){return db[_0xa390('0x22')][_0xa390('0x23')](_0x2f01be[_0xa390('0x1e')],{'raw':_0x2f01be[_0xa390('0x1f')]?_0x2f01be[_0xa390('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f01be[_0xa390('0x1f')]?_0x2f01be[_0xa390('0x1f')][_0xa390('0x24')]||null:null,'attributes':_0x2f01be[_0xa390('0x1f')]?_0x2f01be[_0xa390('0x1f')][_0xa390('0x25')]||null:null,'limit':_0x2f01be[_0xa390('0x1f')]?_0x2f01be['options'][_0xa390('0x26')]||null:null})[_0xa390('0x27')](function(_0x41874e){logger['info'](_0xa390('0x28'),_0x2f01be);logger[_0xa390('0x16')]('UpdateFaxMessage',_0x2f01be,JSON[_0xa390('0x18')](_0x41874e));_0x5af8ef(_0x41874e);})[_0xa390('0x21')](function(_0xcc1dd1){logger[_0xa390('0x19')](_0xa390('0x28'),_0xcc1dd1[_0xa390('0x1a')],_0x2f01be);_0x19f161(_0x54b25f[_0xa390('0x19')](0x1f4,_0xcc1dd1[_0xa390('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index f9d0270..b7b4e71 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 _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 +var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x59ee41,_0xaf7db8){var _0x3ecd3e=function(_0x2f9291){while(--_0x2f9291){_0x59ee41['push'](_0x59ee41['shift']());}};_0x3ecd3e(++_0xaf7db8);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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 diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 82a1dbd..cd0c08f 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 _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 +var _0xb1d5=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','delete','destroy','exports','multer'];(function(_0x3c8b28,_0xee9491){var _0x2febc8=function(_0x236b18){while(--_0x236b18){_0x3c8b28['push'](_0x3c8b28['shift']());}};_0x2febc8(++_0xee9491);}(_0xb1d5,0x187));var _0x5b1d=function(_0x5bcb11,_0x5b5d84){_0x5bcb11=_0x5bcb11-0x0;var _0x3daa19=_0xb1d5[_0x5bcb11];return _0x3daa19;};'use strict';var multer=require(_0x5b1d('0x0'));var util=require(_0x5b1d('0x1'));var path=require(_0x5b1d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5b1d('0x3')]();var auth=require(_0x5b1d('0x4'));var interaction=require(_0x5b1d('0x5'));var config=require(_0x5b1d('0x6'));var controller=require(_0x5b1d('0x7'));router['get']('/',auth[_0x5b1d('0x8')](),controller[_0x5b1d('0x9')]);router[_0x5b1d('0xa')](_0x5b1d('0xb'),auth['isAuthenticated'](),controller[_0x5b1d('0xc')]);router[_0x5b1d('0xa')](_0x5b1d('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x5b1d('0xa')](_0x5b1d('0xe'),auth['isAuthenticated'](),controller[_0x5b1d('0xf')]);router[_0x5b1d('0x10')]('/',auth['isAuthenticated'](),interaction[_0x5b1d('0x11')](_0x5b1d('0x12'),_0x5b1d('0x13')),controller[_0x5b1d('0x14')]);router[_0x5b1d('0x15')](_0x5b1d('0xd'),auth[_0x5b1d('0x8')](),controller[_0x5b1d('0x16')]);router[_0x5b1d('0x15')](_0x5b1d('0x17'),auth[_0x5b1d('0x8')](),controller[_0x5b1d('0x18')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller['reject']);router[_0x5b1d('0x19')](_0x5b1d('0xd'),auth['isAuthenticated'](),controller[_0x5b1d('0x1a')]);module[_0x5b1d('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index d8ec4ef..2df8507 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 _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 +var _0x7a28=['rrmemory','beepall','roundrobin','exports','name','INTEGER','ENUM'];(function(_0x1065a0,_0x5777bc){var _0x45322b=function(_0x2ed02a){while(--_0x2ed02a){_0x1065a0['push'](_0x1065a0['shift']());}};_0x45322b(++_0x5777bc);}(_0x7a28,0x176));var _0x87a2=function(_0x4acdeb,_0x4c175f){_0x4acdeb=_0x4acdeb-0x0;var _0x28cde4=_0x7a28[_0x4acdeb];return _0x28cde4;};'use strict';var Sequelize=require('sequelize');module[_0x87a2('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x87a2('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x87a2('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x87a2('0x3')](_0x87a2('0x4'),_0x87a2('0x5'),_0x87a2('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x87a2('0x2')],'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 6c210e4..1927e71 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 _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 +var _0x3843=['findAll','catch','show','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','update','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','findAndCountAll','agent','faxPause','createdAt','rows','SIP','updatedAt','getTeams','addTeams','ids','Team','User','Agents','voicePause','sequelize','transaction','each','findOrCreate','forEach','emit','select','field','tq.TeamId','from','team_has_fax_queues','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','TeamId','includes','all','union','value','removeTeams','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','userFaxQueue:save','getAgents','html-pdf','eml-format','rimraf','request-promise','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','index','map','FaxQueue','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','includeAll'];(function(_0x16916f,_0x1655ee){var _0x536d2a=function(_0x8cdc62){while(--_0x8cdc62){_0x16916f['push'](_0x16916f['shift']());}};_0x536d2a(++_0x1655ee);}(_0x3843,0x144));var _0x3384=function(_0x5704d4,_0x566c58){_0x5704d4=_0x5704d4-0x0;var _0x495bd4=_0x3843[_0x5704d4];return _0x495bd4;};'use strict';var pdf=require(_0x3384('0x0'));var emlformat=require(_0x3384('0x1'));var rimraf=require(_0x3384('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3384('0x3'));var moment=require('moment');var BPromise=require(_0x3384('0x4'));var Mustache=require('mustache');var util=require(_0x3384('0x5'));var path=require('path');var sox=require(_0x3384('0x6'));var csv=require('to-csv');var ejs=require(_0x3384('0x7'));var fs=require('fs');var _=require(_0x3384('0x8'));var squel=require(_0x3384('0x9'));var crypto=require(_0x3384('0xa'));var jsforce=require(_0x3384('0xb'));var deskjs=require(_0x3384('0xc'));var toCsv=require(_0x3384('0xd'));var querystring=require(_0x3384('0xe'));var Papa=require(_0x3384('0xf'));var Redis=require(_0x3384('0x10'));var authService=require(_0x3384('0x11'));var qs=require(_0x3384('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3384('0x13'))(_0x3384('0x14'));var utils=require('../../config/utils');var config=require(_0x3384('0x15'));var db=require(_0x3384('0x16'))['db'];config[_0x3384('0x17')]=_[_0x3384('0x18')](config[_0x3384('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x3384('0x19'))(new Redis(config[_0x3384('0x17')]));require('./faxQueue.socket')[_0x3384('0x1a')](socket);function respondWithStatusCode(_0x56ed14,_0x5e30b6){_0x5e30b6=_0x5e30b6||0xcc;return function(_0x22fec9){if(_0x22fec9){return _0x56ed14[_0x3384('0x1b')](_0x5e30b6);}return _0x56ed14[_0x3384('0x1c')](_0x5e30b6)[_0x3384('0x1d')]();};}function respondWithResult(_0x27efdb,_0x5d6c62){_0x5d6c62=_0x5d6c62||0xc8;return function(_0x2fec76){if(_0x2fec76){return _0x27efdb['status'](_0x5d6c62)[_0x3384('0x1e')](_0x2fec76);}};}function respondWithFilteredResult(_0x262099,_0x12d35b){return function(_0x5089ab){if(_0x5089ab){var _0x53f2da=_0x5089ab['count'],_0x549767=_0x12d35b[_0x3384('0x1f')],_0x4da375=_0x12d35b[_0x3384('0x1f')]+_0x12d35b[_0x3384('0x20')],_0x16aa4b;if(_0x4da375>=_0x53f2da){_0x4da375=_0x53f2da;_0x16aa4b=0xc8;}else{_0x16aa4b=0xce;}_0x262099[_0x3384('0x1c')](_0x16aa4b);return _0x262099[_0x3384('0x21')](_0x3384('0x22'),_0x549767+'-'+_0x4da375+'/'+_0x53f2da)[_0x3384('0x1e')](_0x5089ab);}return null;};}function patchUpdates(_0x265f0b){return function(_0x1d9556){try{jsonpatch['apply'](_0x1d9556,_0x265f0b,!![]);}catch(_0x31b746){return BPromise[_0x3384('0x23')](_0x31b746);}return _0x1d9556[_0x3384('0x24')]();};}function saveUpdates(_0x394bc2,_0x163f55){return function(_0x5eecdb){if(_0x5eecdb){return _0x5eecdb['update'](_0x394bc2)[_0x3384('0x25')](function(_0x575e68){return _0x575e68;});}return null;};}function removeEntity(_0x514f64,_0x2e1c53){return function(_0x21fa1){if(_0x21fa1){return _0x21fa1[_0x3384('0x26')]()[_0x3384('0x25')](function(){var _0x425819=_0x21fa1[_0x3384('0x27')]({'plain':!![]});var _0x6b2f17=_0x3384('0x28');return db[_0x3384('0x29')]['destroy']({'where':{'type':_0x6b2f17,'resourceId':_0x425819['id']}})['then'](function(){return _0x21fa1;});})[_0x3384('0x25')](function(){_0x514f64[_0x3384('0x1c')](0xcc)[_0x3384('0x1d')]();});}};}function handleEntityNotFound(_0xf6b085,_0x474f23){return function(_0x261f13){if(!_0x261f13){_0xf6b085[_0x3384('0x1b')](0x194);}return _0x261f13;};}function handleError(_0x3b25bf,_0x20a11b){_0x20a11b=_0x20a11b||0x1f4;return function(_0x5d5ed4){logger[_0x3384('0x2a')](_0x5d5ed4[_0x3384('0x2b')]);if(_0x5d5ed4[_0x3384('0x2c')]){delete _0x5d5ed4[_0x3384('0x2c')];}_0x3b25bf[_0x3384('0x1c')](_0x20a11b)['send'](_0x5d5ed4);};}exports[_0x3384('0x2d')]=function(_0x5f0841,_0x36e183){var _0x31957a={},_0x30e264={},_0x521887={'count':0x0,'rows':[]};var _0x51b110=_[_0x3384('0x2e')](db[_0x3384('0x2f')][_0x3384('0x30')],function(_0x7ed1c9){return{'name':_0x7ed1c9[_0x3384('0x31')],'type':_0x7ed1c9[_0x3384('0x32')][_0x3384('0x33')]};});_0x30e264['model']=_[_0x3384('0x2e')](_0x51b110,_0x3384('0x2c'));_0x30e264[_0x3384('0x34')]=_[_0x3384('0x35')](_0x5f0841[_0x3384('0x34')]);_0x30e264['filters']=_[_0x3384('0x36')](_0x30e264[_0x3384('0x37')],_0x30e264['query']);_0x31957a['attributes']=_[_0x3384('0x36')](_0x30e264[_0x3384('0x37')],qs[_0x3384('0x38')](_0x5f0841['query'][_0x3384('0x38')]));_0x31957a['attributes']=_0x31957a[_0x3384('0x39')][_0x3384('0x3a')]?_0x31957a[_0x3384('0x39')]:_0x30e264[_0x3384('0x37')];if(!_0x5f0841[_0x3384('0x34')][_0x3384('0x3b')](_0x3384('0x3c'))){_0x31957a['limit']=qs[_0x3384('0x20')](_0x5f0841[_0x3384('0x34')][_0x3384('0x20')]);_0x31957a['offset']=qs[_0x3384('0x1f')](_0x5f0841[_0x3384('0x34')]['offset']);}_0x31957a[_0x3384('0x3d')]=qs[_0x3384('0x3e')](_0x5f0841[_0x3384('0x34')][_0x3384('0x3e')]);_0x31957a[_0x3384('0x3f')]=qs[_0x3384('0x40')](_[_0x3384('0x41')](_0x5f0841[_0x3384('0x34')],_0x30e264[_0x3384('0x40')]),_0x51b110);if(_0x5f0841['query']['filter']){_0x31957a[_0x3384('0x3f')]=_[_0x3384('0x42')](_0x31957a[_0x3384('0x3f')],{'$or':_['map'](_0x51b110,function(_0x1e4a23){if(_0x1e4a23[_0x3384('0x32')]!==_0x3384('0x43')){var _0x5a020f={};_0x5a020f[_0x1e4a23[_0x3384('0x2c')]]={'$like':'%'+_0x5f0841[_0x3384('0x34')][_0x3384('0x44')]+'%'};return _0x5a020f;}})});}_0x31957a=_[_0x3384('0x42')]({},_0x31957a,_0x5f0841[_0x3384('0x45')]);var _0x46e107={'where':_0x31957a[_0x3384('0x3f')]};return db[_0x3384('0x2f')][_0x3384('0x46')](_0x46e107)[_0x3384('0x25')](function(_0x1bebab){_0x521887['count']=_0x1bebab;if(_0x5f0841[_0x3384('0x34')][_0x3384('0x47')]){_0x31957a['include']=[{'all':!![]}];}return db['FaxQueue'][_0x3384('0x48')](_0x31957a);})[_0x3384('0x25')](function(_0x49978){_0x521887['rows']=_0x49978;return _0x521887;})[_0x3384('0x25')](respondWithFilteredResult(_0x36e183,_0x31957a))[_0x3384('0x49')](handleError(_0x36e183,null));};exports[_0x3384('0x4a')]=function(_0x29aa78,_0x3c2c45){var _0x331c20={'raw':!![],'where':{'id':_0x29aa78[_0x3384('0x4b')]['id']}},_0x54e7d5={};_0x54e7d5[_0x3384('0x37')]=_[_0x3384('0x35')](db[_0x3384('0x2f')][_0x3384('0x30')]);_0x54e7d5[_0x3384('0x34')]=_['keys'](_0x29aa78[_0x3384('0x34')]);_0x54e7d5[_0x3384('0x40')]=_[_0x3384('0x36')](_0x54e7d5[_0x3384('0x37')],_0x54e7d5[_0x3384('0x34')]);_0x331c20[_0x3384('0x39')]=_['intersection'](_0x54e7d5[_0x3384('0x37')],qs[_0x3384('0x38')](_0x29aa78[_0x3384('0x34')][_0x3384('0x38')]));_0x331c20[_0x3384('0x39')]=_0x331c20[_0x3384('0x39')][_0x3384('0x3a')]?_0x331c20[_0x3384('0x39')]:_0x54e7d5['model'];if(_0x29aa78[_0x3384('0x34')][_0x3384('0x47')]){_0x331c20['include']=[{'all':!![]}];}_0x331c20=_['merge']({},_0x331c20,_0x29aa78[_0x3384('0x45')]);return db['FaxQueue'][_0x3384('0x4c')](_0x331c20)['then'](handleEntityNotFound(_0x3c2c45,null))[_0x3384('0x25')](respondWithResult(_0x3c2c45,null))[_0x3384('0x49')](handleError(_0x3c2c45,null));};exports['create']=function(_0x5f514b,_0xbd5be7){return db[_0x3384('0x2f')][_0x3384('0x4d')](_0x5f514b[_0x3384('0x4e')],{})[_0x3384('0x25')](function(_0x41461d){var _0x3764fb=_0x5f514b[_0x3384('0x4f')][_0x3384('0x27')]({'plain':!![]});if(!_0x3764fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3764fb[_0x3384('0x50')]===_0x3384('0x4f')){var _0x1a1c22=_0x41461d[_0x3384('0x27')]({'plain':!![]});var _0x245e6d=_0x3384('0x28');return db[_0x3384('0x51')][_0x3384('0x4c')]({'where':{'name':_0x245e6d,'userProfileId':_0x3764fb[_0x3384('0x52')]},'raw':!![]})['then'](function(_0x464d44){if(_0x464d44&&_0x464d44[_0x3384('0x53')]===0x0){return db[_0x3384('0x29')][_0x3384('0x4d')]({'name':_0x1a1c22['name'],'resourceId':_0x1a1c22['id'],'type':_0x464d44[_0x3384('0x2c')],'sectionId':_0x464d44['id']},{})[_0x3384('0x25')](function(){return _0x41461d;});}else{return _0x41461d;}})[_0x3384('0x49')](function(_0x56633e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56633e);throw _0x56633e;});}return _0x41461d;})[_0x3384('0x25')](respondWithResult(_0xbd5be7,0xc9))[_0x3384('0x49')](handleError(_0xbd5be7,null));};exports[_0x3384('0x54')]=function(_0x100a68,_0x63feb4){if(_0x100a68[_0x3384('0x4e')]['id']){delete _0x100a68[_0x3384('0x4e')]['id'];}return db[_0x3384('0x2f')][_0x3384('0x4c')]({'where':{'id':_0x100a68[_0x3384('0x4b')]['id']}})[_0x3384('0x25')](handleEntityNotFound(_0x63feb4,null))[_0x3384('0x25')](saveUpdates(_0x100a68[_0x3384('0x4e')],null))['then'](respondWithResult(_0x63feb4,null))[_0x3384('0x49')](handleError(_0x63feb4,null));};exports[_0x3384('0x26')]=function(_0x3733c5,_0x44f68f){return db['FaxQueue'][_0x3384('0x4c')]({'where':{'id':_0x3733c5[_0x3384('0x4b')]['id']}})[_0x3384('0x25')](handleEntityNotFound(_0x44f68f,null))[_0x3384('0x25')](removeEntity(_0x44f68f,null))[_0x3384('0x49')](handleError(_0x44f68f,null));};exports[_0x3384('0x55')]=function(_0x14771a,_0x37d952){return db['FaxQueue'][_0x3384('0x55')]()[_0x3384('0x25')](respondWithResult(_0x37d952,null))[_0x3384('0x49')](handleError(_0x37d952,null));};exports[_0x3384('0x56')]=function(_0x412098,_0x3a37fd,_0x449f37){var _0x2a3962={'raw':!![],'where':{}},_0x26afd3={},_0x375053;return db[_0x3384('0x2f')][_0x3384('0x57')]({'where':{'id':_0x412098[_0x3384('0x4b')]['id']}})[_0x3384('0x25')](handleEntityNotFound(_0x3a37fd,null))['then'](function(_0x20f9d5){if(_0x20f9d5){_0x375053=_0x20f9d5[_0x3384('0x27')]({'plain':!![]});_0x26afd3[_0x3384('0x37')]=_[_0x3384('0x35')](db[_0x3384('0x58')][_0x3384('0x30')]);_0x26afd3[_0x3384('0x34')]=_[_0x3384('0x35')](_0x412098[_0x3384('0x34')]);_0x26afd3[_0x3384('0x40')]=_['intersection'](_0x26afd3[_0x3384('0x37')],_0x26afd3['query']);_0x2a3962[_0x3384('0x39')]=_[_0x3384('0x36')](_0x26afd3[_0x3384('0x37')],qs[_0x3384('0x38')](_0x412098['query']['fields']));_0x2a3962[_0x3384('0x39')]=_0x2a3962[_0x3384('0x39')][_0x3384('0x3a')]?_0x2a3962[_0x3384('0x39')]:_0x26afd3[_0x3384('0x37')];if(!_0x412098[_0x3384('0x34')]['hasOwnProperty'](_0x3384('0x3c'))){_0x2a3962[_0x3384('0x20')]=qs['limit'](_0x412098[_0x3384('0x34')]['limit']);_0x2a3962[_0x3384('0x1f')]=qs[_0x3384('0x1f')](_0x412098[_0x3384('0x34')][_0x3384('0x1f')]);}_0x2a3962[_0x3384('0x3d')]=qs[_0x3384('0x3e')](_0x412098[_0x3384('0x34')]['sort']);_0x2a3962[_0x3384('0x3f')]=qs[_0x3384('0x40')](_['pick'](_0x412098[_0x3384('0x34')],_0x26afd3['filters']));_0x2a3962[_0x3384('0x3f')][_0x3384('0x59')]=_0x20f9d5['id'];if(_0x412098[_0x3384('0x34')][_0x3384('0x44')]){_0x2a3962[_0x3384('0x3f')]=_[_0x3384('0x42')](_0x2a3962[_0x3384('0x3f')],{'$or':_[_0x3384('0x2e')](_0x2a3962[_0x3384('0x39')],function(_0x115bf1){var _0x533640={};_0x533640[_0x115bf1]={'$like':'%'+_0x412098['query'][_0x3384('0x44')]+'%'};return _0x533640;})});}_0x2a3962=_[_0x3384('0x42')]({},_0x2a3962,_0x412098[_0x3384('0x45')]);return db[_0x3384('0x58')][_0x3384('0x48')](_0x2a3962);}})['then'](function(_0x1e6b61){if(_0x1e6b61){return db['User'][_0x3384('0x5a')]({'where':{'id':_[_0x3384('0x2e')](_0x1e6b61,'UserId'),'role':_0x3384('0x5b')},'attributes':['id',_0x3384('0x2c'),_0x3384('0x5c'),'updatedAt',_0x3384('0x5d')]});}})[_0x3384('0x25')](function(_0x2acbc4){if(_0x2acbc4){return{'count':_0x2acbc4[_0x3384('0x46')],'rows':_[_0x3384('0x2e')](_0x2acbc4[_0x3384('0x5e')],function(_0x40a2bd){return{'membername':_0x40a2bd[_0x3384('0x2c')],'UserId':_0x40a2bd['id'],'queue_name':_0x375053[_0x3384('0x2c')],'FaxQueueId':_0x375053['id'],'interface':util['format']('%s/%s',_0x3384('0x5f'),_0x40a2bd[_0x3384('0x2c')]),'penalty':0x0,'paused':_0x40a2bd[_0x3384('0x5c')],'createdAt':_0x40a2bd[_0x3384('0x5d')],'updatedAt':_0x40a2bd[_0x3384('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3a37fd,_0x2a3962))[_0x3384('0x49')](handleError(_0x3a37fd,null));};exports[_0x3384('0x61')]=function(_0x2c1c55,_0x30fdf8,_0x539193){var _0x1bcc6f={};var _0x5d326e={};var _0x2635b7;var _0x38b31e;return db[_0x3384('0x2f')]['findOne']({'where':{'id':_0x2c1c55[_0x3384('0x4b')]['id']}})[_0x3384('0x25')](handleEntityNotFound(_0x30fdf8,null))['then'](function(_0x4158e8){if(_0x4158e8){_0x2635b7=_0x4158e8;_0x5d326e[_0x3384('0x37')]=_['keys'](db['Team']['rawAttributes']);_0x5d326e[_0x3384('0x34')]=_[_0x3384('0x35')](_0x2c1c55[_0x3384('0x34')]);_0x5d326e[_0x3384('0x40')]=_['intersection'](_0x5d326e[_0x3384('0x37')],_0x5d326e[_0x3384('0x34')]);_0x1bcc6f[_0x3384('0x39')]=_[_0x3384('0x36')](_0x5d326e[_0x3384('0x37')],qs[_0x3384('0x38')](_0x2c1c55[_0x3384('0x34')]['fields']));_0x1bcc6f['attributes']=_0x1bcc6f[_0x3384('0x39')][_0x3384('0x3a')]?_0x1bcc6f[_0x3384('0x39')]:_0x5d326e[_0x3384('0x37')];_0x1bcc6f[_0x3384('0x3d')]=qs[_0x3384('0x3e')](_0x2c1c55[_0x3384('0x34')][_0x3384('0x3e')]);_0x1bcc6f[_0x3384('0x3f')]=qs[_0x3384('0x40')](_[_0x3384('0x41')](_0x2c1c55[_0x3384('0x34')],_0x5d326e[_0x3384('0x40')]));if(_0x2c1c55[_0x3384('0x34')][_0x3384('0x44')]){_0x1bcc6f['where']=_[_0x3384('0x42')](_0x1bcc6f[_0x3384('0x3f')],{'$or':_[_0x3384('0x2e')](_0x1bcc6f[_0x3384('0x39')],function(_0x32750f){var _0x5d0464={};_0x5d0464[_0x32750f]={'$like':'%'+_0x2c1c55[_0x3384('0x34')][_0x3384('0x44')]+'%'};return _0x5d0464;})});}_0x1bcc6f=_['merge']({},_0x1bcc6f,_0x2c1c55[_0x3384('0x45')]);return _0x2635b7['getTeams'](_0x1bcc6f);}})[_0x3384('0x25')](function(_0x295f4d){if(_0x295f4d){_0x38b31e=_0x295f4d[_0x3384('0x3a')];if(!_0x2c1c55['query'][_0x3384('0x3b')]('nolimit')){_0x1bcc6f['limit']=qs[_0x3384('0x20')](_0x2c1c55[_0x3384('0x34')][_0x3384('0x20')]);_0x1bcc6f[_0x3384('0x1f')]=qs[_0x3384('0x1f')](_0x2c1c55['query'][_0x3384('0x1f')]);}return _0x2635b7['getTeams'](_0x1bcc6f);}})[_0x3384('0x25')](function(_0x25d31f){if(_0x25d31f){return _0x25d31f?{'count':_0x38b31e,'rows':_0x25d31f}:null;}})[_0x3384('0x25')](respondWithResult(_0x30fdf8,null))[_0x3384('0x49')](handleError(_0x30fdf8,null));};exports[_0x3384('0x62')]=function(_0x998e13,_0xe77451,_0x2480ee){var _0x2ffddc=_0x998e13[_0x3384('0x4e')][_0x3384('0x63')];return db[_0x3384('0x64')][_0x3384('0x48')]({'where':{'id':_0x2ffddc},'attributes':['id'],'include':[{'model':db[_0x3384('0x65')],'as':_0x3384('0x66'),'attributes':['id','name','online',_0x3384('0x67'),'interface'],'raw':!![]}]})['then'](function(_0x57f2e0){if(_0x57f2e0){var _0x3efa09=_['flatMap'](_0x57f2e0,function(_0x279db9){var _0x103629=_0x279db9[_0x3384('0x27')]({'plain':!![]});return _0x103629[_0x3384('0x66')];});return db[_0x3384('0x2f')][_0x3384('0x4c')]({'where':{'id':_0x998e13[_0x3384('0x4b')]['id']}})[_0x3384('0x25')](function(_0x276a5c){return db[_0x3384('0x68')][_0x3384('0x69')](function(_0x1563f6){return _0x276a5c[_0x3384('0x62')](_0x2ffddc,{'transaction':_0x1563f6})[_0x3384('0x25')](function(){return BPromise[_0x3384('0x6a')](_0x3efa09,function(_0x5c98e1){return db[_0x3384('0x58')][_0x3384('0x6b')]({'where':{'UserId':_0x5c98e1['id'],'FaxQueueId':_0x998e13[_0x3384('0x4b')]['id']},'transaction':_0x1563f6});});})[_0x3384('0x25')](function(){_0x3efa09[_0x3384('0x6c')](function(_0x479009){socket[_0x3384('0x6d')]('userFaxQueue:save',{'UserId':_0x479009['id'],'FaxQueueId':_0x276a5c['id']});});});});});}})[_0x3384('0x25')](respondWithStatusCode(_0xe77451,null))[_0x3384('0x49')](handleError(_0xe77451,null));};exports['removeTeams']=function(_0xfca560,_0x37e582,_0x1191da){return db[_0x3384('0x64')][_0x3384('0x48')]({'where':{'id':_0xfca560['query'][_0x3384('0x63')]},'attributes':['id'],'include':[{'model':db[_0x3384('0x65')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x37e582,null))['then'](function(_0x1f0a3b){var _0x3b4348=_[_0x3384('0x2e')](_0x1f0a3b,'id');var _0x3e785a=[];var _0x57ed6e=[];var _0x23bea6=squel[_0x3384('0x6e')]();_0x23bea6[_0x3384('0x6f')](_0x3384('0x70'))[_0x3384('0x71')](_0x3384('0x72'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x3384('0x3f')](_0x3384('0x73'),_0xfca560[_0x3384('0x4b')]['id']);for(var _0xb35448=0x0;_0xb35448<_0x1f0a3b[_0x3384('0x3a')];_0xb35448+=0x1){let _0x69b4c7=_0x1f0a3b[_0xb35448];for(var _0x189a66=0x0;_0x189a66<_0x69b4c7[_0x3384('0x66')][_0x3384('0x3a')];_0x189a66+=0x1){let _0x306bb3=_0x69b4c7['Agents'][_0x189a66];var _0x5c7874=_0x23bea6[_0x3384('0x74')]();_0x5c7874[_0x3384('0x3f')](_0x3384('0x75'),_0x306bb3['id']);_0x57ed6e['push'](db[_0x3384('0x68')][_0x3384('0x34')](_0x5c7874[_0x3384('0x76')](),{'type':db[_0x3384('0x68')]['QueryTypes']['SELECT']})[_0x3384('0x25')](function(_0x302c75){if(_0x302c75[_0x3384('0x3a')]===0x1){return _0x306bb3['id'];}else{var _0x5916fe=_['every'](_[_0x3384('0x2e')](_0x302c75,_0x3384('0x77')),function(_0x12cbdd){return _[_0x3384('0x78')](_0x3b4348,_0x12cbdd);});if(_0x5916fe){return _0x306bb3['id'];}}}));}}return BPromise[_0x3384('0x79')](_0x57ed6e)[_0x3384('0x25')](function(_0x45eb16){_0x3e785a=_(_0x3e785a)[_0x3384('0x7a')](_0x45eb16)['compact']()[_0x3384('0x7b')]();return db['FaxQueue']['find']({'where':{'id':_0xfca560[_0x3384('0x4b')]['id']}})['then'](function(_0x5298d4){return db[_0x3384('0x68')][_0x3384('0x69')](function(_0x219b9e){return _0x5298d4[_0x3384('0x7c')](_0xfca560[_0x3384('0x34')][_0x3384('0x63')],{'transaction':_0x219b9e})[_0x3384('0x25')](function(){if(!_[_0x3384('0x7d')](_0x3e785a)){return _0x5298d4[_0x3384('0x7e')](_0x3e785a,{'transaction':_0x219b9e});}})['then'](function(){_0x3e785a[_0x3384('0x6c')](function(_0xfa056f){socket[_0x3384('0x6d')](_0x3384('0x7f'),{'UserId':_0xfa056f,'FaxQueueId':_0x5298d4['id']});});});});});});})['then'](respondWithStatusCode(_0x37e582,null))['catch'](handleError(_0x37e582,null));};exports[_0x3384('0x80')]=function(_0x1bc903,_0x3be20f,_0x41feb2){return db[_0x3384('0x2f')][_0x3384('0x4c')]({'where':{'id':_0x1bc903[_0x3384('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3be20f,null))[_0x3384('0x25')](function(_0x136bfc){if(_0x136bfc){return _0x136bfc[_0x3384('0x80')](_0x1bc903[_0x3384('0x4e')][_0x3384('0x63')],_[_0x3384('0x81')](_0x1bc903[_0x3384('0x4e')],[_0x3384('0x63'),'id'])||{})['spread'](function(_0x392618){for(var _0x272151=0x0;_0x272151<_0x1bc903[_0x3384('0x4e')][_0x3384('0x63')][_0x3384('0x3a')];_0x272151+=0x1){socket[_0x3384('0x6d')](_0x3384('0x82'),{'UserId':_0x1bc903[_0x3384('0x4e')][_0x3384('0x63')][_0x272151],'FaxQueueId':_0x1bc903[_0x3384('0x4b')]['id']});}return _0x392618;});}})[_0x3384('0x25')](respondWithResult(_0x3be20f,null))[_0x3384('0x49')](handleError(_0x3be20f,null));};exports[_0x3384('0x7e')]=function(_0x2804b8,_0x30b46b,_0x375296){return db[_0x3384('0x2f')][_0x3384('0x4c')]({'where':{'id':_0x2804b8[_0x3384('0x4b')]['id']}})['then'](handleEntityNotFound(_0x30b46b,null))[_0x3384('0x25')](function(_0x2e0c6d){if(_0x2e0c6d){return _0x2e0c6d[_0x3384('0x7e')](_0x2804b8[_0x3384('0x34')][_0x3384('0x63')])[_0x3384('0x25')](function(){if(_['isArray'](_0x2804b8[_0x3384('0x34')][_0x3384('0x63')])){for(var _0x525bfb=0x0;_0x525bfb<_0x2804b8['query'][_0x3384('0x63')][_0x3384('0x3a')];_0x525bfb+=0x1){socket[_0x3384('0x6d')](_0x3384('0x7f'),{'UserId':Number(_0x2804b8['query']['ids'][_0x525bfb]),'FaxQueueId':Number(_0x2804b8[_0x3384('0x4b')]['id'])});}}else{socket[_0x3384('0x6d')]('userFaxQueue:remove',{'UserId':Number(_0x2804b8[_0x3384('0x34')][_0x3384('0x63')]),'FaxQueueId':Number(_0x2804b8[_0x3384('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x30b46b,null))['catch'](handleError(_0x30b46b,null));};exports[_0x3384('0x83')]=function(_0x3b22f4,_0xf283c8,_0x25ac2a){var _0x3ab516={};var _0x294165={};var _0x1ba392;var _0x5af073;return db['FaxQueue']['findOne']({'where':{'id':_0x3b22f4[_0x3384('0x4b')]['id']}})[_0x3384('0x25')](handleEntityNotFound(_0xf283c8,null))['then'](function(_0xb55297){if(_0xb55297){_0x1ba392=_0xb55297;_0x294165[_0x3384('0x37')]=_[_0x3384('0x35')](db[_0x3384('0x65')]['rawAttributes']);_0x294165[_0x3384('0x34')]=_[_0x3384('0x35')](_0x3b22f4[_0x3384('0x34')]);_0x294165[_0x3384('0x40')]=_[_0x3384('0x36')](_0x294165[_0x3384('0x37')],_0x294165['query']);_0x3ab516[_0x3384('0x39')]=_[_0x3384('0x36')](_0x294165[_0x3384('0x37')],qs[_0x3384('0x38')](_0x3b22f4[_0x3384('0x34')][_0x3384('0x38')]));_0x3ab516[_0x3384('0x39')]=_0x3ab516[_0x3384('0x39')][_0x3384('0x3a')]?_0x3ab516[_0x3384('0x39')]:_0x294165[_0x3384('0x37')];_0x3ab516[_0x3384('0x3d')]=qs[_0x3384('0x3e')](_0x3b22f4[_0x3384('0x34')][_0x3384('0x3e')]);_0x3ab516['where']=qs[_0x3384('0x40')](_[_0x3384('0x41')](_0x3b22f4[_0x3384('0x34')],_0x294165[_0x3384('0x40')]));if(_0x3b22f4[_0x3384('0x34')]['filter']){_0x3ab516[_0x3384('0x3f')]=_['merge'](_0x3ab516[_0x3384('0x3f')],{'$or':_[_0x3384('0x2e')](_0x3ab516['attributes'],function(_0x14c56b){var _0x1063ed={};_0x1063ed[_0x14c56b]={'$like':'%'+_0x3b22f4[_0x3384('0x34')][_0x3384('0x44')]+'%'};return _0x1063ed;})});}_0x3ab516=_[_0x3384('0x42')]({},_0x3ab516,_0x3b22f4[_0x3384('0x45')]);return _0x1ba392[_0x3384('0x83')](_0x3ab516);}})[_0x3384('0x25')](function(_0x57b7bd){if(_0x57b7bd){_0x5af073=_0x57b7bd['length'];if(!_0x3b22f4[_0x3384('0x34')]['hasOwnProperty'](_0x3384('0x3c'))){_0x3ab516[_0x3384('0x20')]=qs[_0x3384('0x20')](_0x3b22f4[_0x3384('0x34')][_0x3384('0x20')]);_0x3ab516[_0x3384('0x1f')]=qs[_0x3384('0x1f')](_0x3b22f4['query'][_0x3384('0x1f')]);}return _0x1ba392[_0x3384('0x83')](_0x3ab516);}})[_0x3384('0x25')](function(_0x18f8eb){if(_0x18f8eb){return _0x18f8eb?{'count':_0x5af073,'rows':_0x18f8eb}:null;}})[_0x3384('0x25')](respondWithResult(_0xf283c8,null))[_0x3384('0x49')](handleError(_0xf283c8,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 9654a67..66cef54 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 _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 +var _0xdc27=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners'];(function(_0x34747e,_0x5962eb){var _0x24db6e=function(_0xc7a6da){while(--_0xc7a6da){_0x34747e['push'](_0x34747e['shift']());}};_0x24db6e(++_0x5962eb);}(_0xdc27,0x1ec));var _0x7dc2=function(_0x48c4ef,_0x319d44){_0x48c4ef=_0x48c4ef-0x0;var _0x435715=_0xdc27[_0x48c4ef];return _0x435715;};'use strict';var EventEmitter=require(_0x7dc2('0x0'));var FaxQueue=require(_0x7dc2('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x7dc2('0x2')](0x0);var events={'afterCreate':_0x7dc2('0x3'),'afterUpdate':_0x7dc2('0x4'),'afterDestroy':_0x7dc2('0x5')};function emitEvent(_0x4ec460){return function(_0x52bd67,_0x11f1b6,_0x16f2f1){FaxQueueEvents[_0x7dc2('0x6')](_0x4ec460+':'+_0x52bd67['id'],_0x52bd67);FaxQueueEvents['emit'](_0x4ec460,_0x52bd67);_0x16f2f1(null);};}for(var e in events){if(events[_0x7dc2('0x7')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x7dc2('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index a9bb09b..2e8dc6c 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 _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 +var _0xa4dd=['define','FaxQueue','fax_queues','lodash','util','api','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','exports'];(function(_0xc84c1d,_0x4f3d46){var _0x41afd7=function(_0x5d22ba){while(--_0x5d22ba){_0xc84c1d['push'](_0xc84c1d['shift']());}};_0x41afd7(++_0x4f3d46);}(_0xa4dd,0x9f));var _0xda4d=function(_0x41930d,_0x478ed3){_0x41930d=_0x41930d-0x0;var _0x455ade=_0xa4dd[_0x41930d];return _0x455ade;};'use strict';var _=require(_0xda4d('0x0'));var util=require(_0xda4d('0x1'));var logger=require('../../config/logger')(_0xda4d('0x2'));var moment=require('moment');var BPromise=require(_0xda4d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xda4d('0x4'));var rimraf=require(_0xda4d('0x5'));var config=require(_0xda4d('0x6'));var attributes=require(_0xda4d('0x7'));module[_0xda4d('0x8')]=function(_0x518f2c,_0x383dda){return _0x518f2c[_0xda4d('0x9')](_0xda4d('0xa'),attributes,{'tableName':_0xda4d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index adacde5..8f28f7f 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 _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 +var _0xd152=['catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','limit','map','include','model','ShowFaxQueue','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x56f7e2,_0x145392){var _0x36240b=function(_0x216ff7){while(--_0x216ff7){_0x56f7e2['push'](_0x56f7e2['shift']());}};_0x36240b(++_0x145392);}(_0xd152,0x124));var _0x2d15=function(_0x34c22c,_0xf4377a){_0x34c22c=_0x34c22c-0x0;var _0x10731f=_0xd152[_0x34c22c];return _0x10731f;};'use strict';var _=require(_0x2d15('0x0'));var util=require(_0x2d15('0x1'));var moment=require(_0x2d15('0x2'));var BPromise=require(_0x2d15('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d15('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d15('0x5'));var logger=require(_0x2d15('0x6'))(_0x2d15('0x7'));var config=require('../../config/environment');var jayson=require(_0x2d15('0x8'));var client=jayson[_0x2d15('0x9')][_0x2d15('0xa')]({'port':0x232a});config[_0x2d15('0xb')]=_[_0x2d15('0xc')](config['redis'],{'host':_0x2d15('0xd'),'port':0x18eb});var socket=require(_0x2d15('0xe'))(new Redis(config[_0x2d15('0xb')]));require('./faxQueue.socket')[_0x2d15('0xf')](socket);function respondWithRpcPromise(_0x22921a,_0x356919,_0x1f480b){return new BPromise(function(_0x244be5,_0x1a2c36){return client[_0x2d15('0x10')](_0x22921a,_0x1f480b)[_0x2d15('0x11')](function(_0x41dd6c){logger[_0x2d15('0x12')](_0x2d15('0x13'),_0x356919,_0x2d15('0x14'));logger[_0x2d15('0x15')](_0x2d15('0x16'),_0x356919,_0x2d15('0x14'),JSON[_0x2d15('0x17')](_0x41dd6c));if(_0x41dd6c[_0x2d15('0x18')]){if(_0x41dd6c[_0x2d15('0x18')][_0x2d15('0x19')]===0x1f4){logger[_0x2d15('0x18')](_0x2d15('0x13'),_0x356919,_0x41dd6c[_0x2d15('0x18')][_0x2d15('0x1a')]);return _0x1a2c36(_0x41dd6c[_0x2d15('0x18')][_0x2d15('0x1a')]);}logger[_0x2d15('0x18')](_0x2d15('0x13'),_0x356919,_0x41dd6c['error']['message']);return _0x244be5(_0x41dd6c[_0x2d15('0x18')][_0x2d15('0x1a')]);}else{logger['info']('FaxQueue,\x20%s,\x20%s',_0x356919,_0x2d15('0x14'));_0x244be5(_0x41dd6c[_0x2d15('0x1b')][_0x2d15('0x1a')]);}})[_0x2d15('0x1c')](function(_0x233ad9){logger[_0x2d15('0x18')](_0x2d15('0x13'),_0x356919,_0x233ad9);_0x1a2c36(_0x233ad9);});});}exports[_0x2d15('0x1d')]=function(_0x2a5a65){var _0xf631c8=this;return new Promise(function(_0xe5c297,_0x42c242){return db[_0x2d15('0x1e')]['findAll']({'raw':_0x2a5a65[_0x2d15('0x1f')]?_0x2a5a65[_0x2d15('0x1f')][_0x2d15('0x20')]===undefined?!![]:![]:!![],'where':_0x2a5a65[_0x2d15('0x1f')]?_0x2a5a65[_0x2d15('0x1f')][_0x2d15('0x21')]||null:null,'attributes':_0x2a5a65[_0x2d15('0x1f')]?_0x2a5a65['options'][_0x2d15('0x22')]||null:null,'limit':_0x2a5a65[_0x2d15('0x1f')]?_0x2a5a65[_0x2d15('0x1f')][_0x2d15('0x23')]||null:null,'include':_0x2a5a65[_0x2d15('0x1f')]?_0x2a5a65[_0x2d15('0x1f')]['include']?_[_0x2d15('0x24')](_0x2a5a65[_0x2d15('0x1f')]['include'],function(_0x36c64a){return{'model':db[_0x36c64a['model']],'as':_0x36c64a['as'],'attributes':_0x36c64a['attributes'],'include':_0x36c64a[_0x2d15('0x25')]?_['map'](_0x36c64a['include'],function(_0x495df4){return{'model':db[_0x495df4[_0x2d15('0x26')]],'as':_0x495df4['as'],'attributes':_0x495df4['attributes'],'include':_0x495df4[_0x2d15('0x25')]?_['map'](_0x495df4['include'],function(_0x481004){return{'model':db[_0x481004[_0x2d15('0x26')]],'as':_0x481004['as'],'attributes':_0x481004[_0x2d15('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b4c26){logger[_0x2d15('0x12')](_0x2d15('0x1d'),_0x2a5a65);logger[_0x2d15('0x15')](_0x2d15('0x1d'),_0x2a5a65,JSON[_0x2d15('0x17')](_0x1b4c26));_0xe5c297(_0x1b4c26);})[_0x2d15('0x1c')](function(_0x4f3658){logger[_0x2d15('0x18')](_0x2d15('0x1d'),_0x4f3658['message'],_0x2a5a65);_0x42c242(_0xf631c8['error'](0x1f4,_0x4f3658['message']));});});};exports[_0x2d15('0x27')]=function(_0x158c95){var _0x50cc8a=this;return new Promise(function(_0x104ae7,_0x25114d){return db[_0x2d15('0x1e')]['find']({'raw':_0x158c95['options']?_0x158c95[_0x2d15('0x1f')][_0x2d15('0x20')]===undefined?!![]:![]:!![],'where':_0x158c95['options']?_0x158c95[_0x2d15('0x1f')][_0x2d15('0x21')]||null:null,'attributes':_0x158c95[_0x2d15('0x1f')]?_0x158c95[_0x2d15('0x1f')][_0x2d15('0x22')]||null:null,'include':_0x158c95[_0x2d15('0x1f')]?_0x158c95[_0x2d15('0x1f')][_0x2d15('0x25')]?_[_0x2d15('0x24')](_0x158c95[_0x2d15('0x1f')]['include'],function(_0x4c4fb4){return{'model':db[_0x4c4fb4['model']],'as':_0x4c4fb4['as'],'attributes':_0x4c4fb4[_0x2d15('0x22')],'include':_0x4c4fb4[_0x2d15('0x25')]?_['map'](_0x4c4fb4[_0x2d15('0x25')],function(_0x485f42){return{'model':db[_0x485f42[_0x2d15('0x26')]],'as':_0x485f42['as'],'attributes':_0x485f42[_0x2d15('0x22')],'include':_0x485f42['include']?_[_0x2d15('0x24')](_0x485f42[_0x2d15('0x25')],function(_0x17842d){return{'model':db[_0x17842d[_0x2d15('0x26')]],'as':_0x17842d['as'],'attributes':_0x17842d[_0x2d15('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x293e1b){logger[_0x2d15('0x12')]('ShowFaxQueue',_0x158c95);logger[_0x2d15('0x15')]('ShowFaxQueue',_0x158c95,JSON[_0x2d15('0x17')](_0x293e1b));_0x104ae7(_0x293e1b);})['catch'](function(_0x428f3c){logger['error']('ShowFaxQueue',_0x428f3c['message'],_0x158c95);_0x25114d(_0x50cc8a[_0x2d15('0x18')](0x1f4,_0x428f3c[_0x2d15('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 4e5ed2c..a1f50b8 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 _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 +var _0x37af=['update','length','faxQueue:','./faxQueue.events','save','remove'];(function(_0x584267,_0x3dbe07){var _0x224516=function(_0x2e5f28){while(--_0x2e5f28){_0x584267['push'](_0x584267['shift']());}};_0x224516(++_0x3dbe07);}(_0x37af,0x1e9));var _0xf37a=function(_0x3de4d4,_0x5b21e2){_0x3de4d4=_0x3de4d4-0x0;var _0x304dac=_0x37af[_0x3de4d4];return _0x304dac;};'use strict';var FaxQueueEvents=require(_0xf37a('0x0'));var events=[_0xf37a('0x1'),_0xf37a('0x2'),_0xf37a('0x3')];function createListener(_0x994dae,_0x11820e){return function(_0x564a5c){_0x11820e['emit'](_0x994dae,_0x564a5c);};}function removeListener(_0x241e84,_0x3c88b1){return function(){FaxQueueEvents['removeListener'](_0x241e84,_0x3c88b1);};}exports['register']=function(_0x17b9bc){for(var _0x5e646f=0x0,_0x5a6ce1=events[_0xf37a('0x4')];_0x5e646f<_0x5a6ce1;_0x5e646f++){var _0x3bc605=events[_0x5e646f];var _0x7eb0f8=createListener(_0xf37a('0x5')+_0x3bc605,_0x17b9bc);FaxQueueEvents['on'](_0x3bc605,_0x7eb0f8);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 011d590..94391e8 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 _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 +var _0xd8b0=['util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','index','get','/describe','describe','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','/:id','update','delete','destroy','removeTeams','exports','multer'];(function(_0x411428,_0x986e54){var _0x50f873=function(_0x48da50){while(--_0x48da50){_0x411428['push'](_0x411428['shift']());}};_0x50f873(++_0x986e54);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x8')](_0x0d8b('0xf'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['get'](_0x0d8b('0x11'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x13')]('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x13')](_0x0d8b('0xf'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);router[_0x0d8b('0x13')](_0x0d8b('0x11'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x16')]);router['put'](_0x0d8b('0x17'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x18')]);router[_0x0d8b('0x19')](_0x0d8b('0x17'),auth['isAuthenticated'](),controller[_0x0d8b('0x1a')]);router[_0x0d8b('0x19')](_0x0d8b('0xf'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x1b')]);router[_0x0d8b('0x19')](_0x0d8b('0x11'),auth[_0x0d8b('0xb')](),controller['removeAgents']);module[_0x0d8b('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 47a0444..5b93596 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 _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 +var _0x0779=['DATE','moment','sequelize','STRING'];(function(_0x4defd6,_0x37bbd3){var _0x4c9276=function(_0x1d7a3d){while(--_0x1d7a3d){_0x4defd6['push'](_0x4defd6['shift']());}};_0x4c9276(++_0x37bbd3);}(_0x0779,0x14d));var _0x9077=function(_0x4579df,_0x2954ec){_0x4579df=_0x4579df-0x0;var _0x26b889=_0x0779[_0x4579df];return _0x26b889;};'use strict';var moment=require(_0x9077('0x0'));var Sequelize=require(_0x9077('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x9077('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9077('0x2')]},'joinAt':{'type':Sequelize[_0x9077('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x9077('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x9077('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 0343e3f..af1b92d 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 _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 +var _0xc59d=['FaxQueueReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','then','rows','catch','show','params','include','find','create','body','describe','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xc59d,0xb6));var _0xdc59=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc59d[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0xdc59('0x0'));var emlformat=require(_0xdc59('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xdc59('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdc59('0x3'));var BPromise=require(_0xdc59('0x4'));var Mustache=require(_0xdc59('0x5'));var util=require(_0xdc59('0x6'));var path=require(_0xdc59('0x7'));var sox=require(_0xdc59('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xdc59('0x9'));var squel=require(_0xdc59('0xa'));var crypto=require('crypto');var jsforce=require(_0xdc59('0xb'));var deskjs=require(_0xdc59('0xc'));var toCsv=require(_0xdc59('0xd'));var querystring=require(_0xdc59('0xe'));var Papa=require(_0xdc59('0xf'));var Redis=require(_0xdc59('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xdc59('0x11'));var as=require(_0xdc59('0x12'));var hardwareService=require(_0xdc59('0x13'));var logger=require(_0xdc59('0x14'))(_0xdc59('0x15'));var utils=require(_0xdc59('0x16'));var config=require(_0xdc59('0x17'));var db=require(_0xdc59('0x18'))['db'];function respondWithStatusCode(_0x536f1b,_0x18f4db){_0x18f4db=_0x18f4db||0xcc;return function(_0x42262c){if(_0x42262c){return _0x536f1b[_0xdc59('0x19')](_0x18f4db);}return _0x536f1b[_0xdc59('0x1a')](_0x18f4db)[_0xdc59('0x1b')]();};}function respondWithResult(_0x4ae1a9,_0x3b1428){_0x3b1428=_0x3b1428||0xc8;return function(_0x1a6257){if(_0x1a6257){return _0x4ae1a9[_0xdc59('0x1a')](_0x3b1428)['json'](_0x1a6257);}};}function respondWithFilteredResult(_0x48cd9c,_0x522a0e){return function(_0x2a4686){if(_0x2a4686){var _0xc42ef4=_0x2a4686[_0xdc59('0x1c')],_0x435e1c=_0x522a0e[_0xdc59('0x1d')],_0x2c99a7=_0x522a0e[_0xdc59('0x1d')]+_0x522a0e[_0xdc59('0x1e')],_0xfdd82c;if(_0x2c99a7>=_0xc42ef4){_0x2c99a7=_0xc42ef4;_0xfdd82c=0xc8;}else{_0xfdd82c=0xce;}_0x48cd9c[_0xdc59('0x1a')](_0xfdd82c);return _0x48cd9c['set'](_0xdc59('0x1f'),_0x435e1c+'-'+_0x2c99a7+'/'+_0xc42ef4)['json'](_0x2a4686);}return null;};}function patchUpdates(_0x776336){return function(_0x4a809b){try{jsonpatch[_0xdc59('0x20')](_0x4a809b,_0x776336,!![]);}catch(_0x171dd7){return BPromise[_0xdc59('0x21')](_0x171dd7);}return _0x4a809b[_0xdc59('0x22')]();};}function saveUpdates(_0xf92b33,_0x3c19d9){return function(_0x542a74){if(_0x542a74){return _0x542a74[_0xdc59('0x23')](_0xf92b33)['then'](function(_0x24b6f2){return _0x24b6f2;});}return null;};}function removeEntity(_0x3e42bd,_0x33a82a){return function(_0x59e71a){if(_0x59e71a){return _0x59e71a[_0xdc59('0x24')]()['then'](function(){_0x3e42bd[_0xdc59('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16b5fa,_0x2e77c6){return function(_0x42b7fa){if(!_0x42b7fa){_0x16b5fa[_0xdc59('0x19')](0x194);}return _0x42b7fa;};}function handleError(_0x1f979b,_0x26cd64){_0x26cd64=_0x26cd64||0x1f4;return function(_0x5aaa7c){logger[_0xdc59('0x25')](_0x5aaa7c[_0xdc59('0x26')]);if(_0x5aaa7c[_0xdc59('0x27')]){delete _0x5aaa7c[_0xdc59('0x27')];}_0x1f979b['status'](_0x26cd64)[_0xdc59('0x28')](_0x5aaa7c);};}exports[_0xdc59('0x29')]=function(_0x47fba8,_0x456f13){var _0x3b86fb={},_0x1ea72f={},_0x450b02={'count':0x0,'rows':[]};var _0x2bbc7e=_[_0xdc59('0x2a')](db[_0xdc59('0x2b')][_0xdc59('0x2c')],function(_0x1f6eb2){return{'name':_0x1f6eb2[_0xdc59('0x2d')],'type':_0x1f6eb2[_0xdc59('0x2e')][_0xdc59('0x2f')]};});_0x1ea72f[_0xdc59('0x30')]=_[_0xdc59('0x2a')](_0x2bbc7e,_0xdc59('0x27'));_0x1ea72f['query']=_[_0xdc59('0x31')](_0x47fba8[_0xdc59('0x32')]);_0x1ea72f['filters']=_[_0xdc59('0x33')](_0x1ea72f[_0xdc59('0x30')],_0x1ea72f[_0xdc59('0x32')]);_0x3b86fb[_0xdc59('0x34')]=_[_0xdc59('0x33')](_0x1ea72f[_0xdc59('0x30')],qs[_0xdc59('0x35')](_0x47fba8['query'][_0xdc59('0x35')]));_0x3b86fb[_0xdc59('0x34')]=_0x3b86fb[_0xdc59('0x34')][_0xdc59('0x36')]?_0x3b86fb[_0xdc59('0x34')]:_0x1ea72f[_0xdc59('0x30')];if(!_0x47fba8[_0xdc59('0x32')]['hasOwnProperty']('nolimit')){_0x3b86fb[_0xdc59('0x1e')]=qs[_0xdc59('0x1e')](_0x47fba8[_0xdc59('0x32')]['limit']);_0x3b86fb[_0xdc59('0x1d')]=qs[_0xdc59('0x1d')](_0x47fba8[_0xdc59('0x32')]['offset']);}_0x3b86fb[_0xdc59('0x37')]=qs[_0xdc59('0x38')](_0x47fba8[_0xdc59('0x32')][_0xdc59('0x38')]);_0x3b86fb[_0xdc59('0x39')]=qs[_0xdc59('0x3a')](_[_0xdc59('0x3b')](_0x47fba8[_0xdc59('0x32')],_0x1ea72f[_0xdc59('0x3a')]),_0x2bbc7e);if(_0x47fba8[_0xdc59('0x32')][_0xdc59('0x3c')]){_0x3b86fb[_0xdc59('0x39')]=_[_0xdc59('0x3d')](_0x3b86fb[_0xdc59('0x39')],{'$or':_['map'](_0x2bbc7e,function(_0x95fbcf){if(_0x95fbcf['type']!==_0xdc59('0x3e')){var _0x402471={};_0x402471[_0x95fbcf['name']]={'$like':'%'+_0x47fba8[_0xdc59('0x32')][_0xdc59('0x3c')]+'%'};return _0x402471;}})});}_0x3b86fb=_[_0xdc59('0x3d')]({},_0x3b86fb,_0x47fba8[_0xdc59('0x3f')]);var _0xbaa587={'where':_0x3b86fb[_0xdc59('0x39')]};return db[_0xdc59('0x2b')]['count'](_0xbaa587)['then'](function(_0x44fbda){_0x450b02['count']=_0x44fbda;if(_0x47fba8[_0xdc59('0x32')]['includeAll']){_0x3b86fb['include']=[{'all':!![]}];}return db[_0xdc59('0x2b')][_0xdc59('0x40')](_0x3b86fb);})[_0xdc59('0x41')](function(_0x5c3e2b){_0x450b02[_0xdc59('0x42')]=_0x5c3e2b;return _0x450b02;})['then'](respondWithFilteredResult(_0x456f13,_0x3b86fb))[_0xdc59('0x43')](handleError(_0x456f13,null));};exports[_0xdc59('0x44')]=function(_0x23c569,_0x2dac5f){var _0x4842d7={'raw':!![],'where':{'id':_0x23c569[_0xdc59('0x45')]['id']}},_0x1176b4={};_0x1176b4[_0xdc59('0x30')]=_['keys'](db[_0xdc59('0x2b')][_0xdc59('0x2c')]);_0x1176b4[_0xdc59('0x32')]=_[_0xdc59('0x31')](_0x23c569[_0xdc59('0x32')]);_0x1176b4[_0xdc59('0x3a')]=_['intersection'](_0x1176b4['model'],_0x1176b4['query']);_0x4842d7[_0xdc59('0x34')]=_['intersection'](_0x1176b4[_0xdc59('0x30')],qs[_0xdc59('0x35')](_0x23c569[_0xdc59('0x32')][_0xdc59('0x35')]));_0x4842d7[_0xdc59('0x34')]=_0x4842d7['attributes'][_0xdc59('0x36')]?_0x4842d7[_0xdc59('0x34')]:_0x1176b4['model'];if(_0x23c569[_0xdc59('0x32')]['includeAll']){_0x4842d7[_0xdc59('0x46')]=[{'all':!![]}];}_0x4842d7=_[_0xdc59('0x3d')]({},_0x4842d7,_0x23c569[_0xdc59('0x3f')]);return db[_0xdc59('0x2b')][_0xdc59('0x47')](_0x4842d7)[_0xdc59('0x41')](handleEntityNotFound(_0x2dac5f,null))['then'](respondWithResult(_0x2dac5f,null))[_0xdc59('0x43')](handleError(_0x2dac5f,null));};exports[_0xdc59('0x48')]=function(_0x13da83,_0x1a7852){return db[_0xdc59('0x2b')]['create'](_0x13da83[_0xdc59('0x49')],{})[_0xdc59('0x41')](respondWithResult(_0x1a7852,0xc9))[_0xdc59('0x43')](handleError(_0x1a7852,null));};exports[_0xdc59('0x23')]=function(_0x5c9def,_0x579661){if(_0x5c9def['body']['id']){delete _0x5c9def[_0xdc59('0x49')]['id'];}return db[_0xdc59('0x2b')][_0xdc59('0x47')]({'where':{'id':_0x5c9def[_0xdc59('0x45')]['id']}})['then'](handleEntityNotFound(_0x579661,null))[_0xdc59('0x41')](saveUpdates(_0x5c9def[_0xdc59('0x49')],null))['then'](respondWithResult(_0x579661,null))[_0xdc59('0x43')](handleError(_0x579661,null));};exports[_0xdc59('0x24')]=function(_0x2beb17,_0x27d44a){return db[_0xdc59('0x2b')]['find']({'where':{'id':_0x2beb17[_0xdc59('0x45')]['id']}})[_0xdc59('0x41')](handleEntityNotFound(_0x27d44a,null))[_0xdc59('0x41')](removeEntity(_0x27d44a,null))['catch'](handleError(_0x27d44a,null));};exports[_0xdc59('0x4a')]=function(_0x371236,_0x3987ca){return db[_0xdc59('0x2b')][_0xdc59('0x4a')]()[_0xdc59('0x41')](respondWithResult(_0x3987ca,null))[_0xdc59('0x43')](handleError(_0x3987ca,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 70e0d1f..508f073 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 _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 +var _0x2534=['./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','util','path','rimraf'];(function(_0x199c9b,_0xd6e4c3){var _0x2f4c42=function(_0x458822){while(--_0x458822){_0x199c9b['push'](_0x199c9b['shift']());}};_0x2f4c42(++_0xd6e4c3);}(_0x2534,0x84));var _0x4253=function(_0x233ff9,_0x5f1db1){_0x233ff9=_0x233ff9-0x0;var _0x290ffa=_0x2534[_0x233ff9];return _0x290ffa;};'use strict';var _=require('lodash');var util=require(_0x4253('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4253('0x1'));var rimraf=require(_0x4253('0x2'));var config=require('../../config/environment');var attributes=require(_0x4253('0x3'));module[_0x4253('0x4')]=function(_0x2204d0,_0x5f47ad){return _0x2204d0[_0x4253('0x5')](_0x4253('0x6'),attributes,{'tableName':_0x4253('0x7'),'paranoid':![],'indexes':[{'name':_0x4253('0x8'),'fields':[_0x4253('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 1a51e82..402d754 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 _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 +var _0xd93d=['../../config/logger','jayson/promise','client','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','raw','UpdateFaxQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x2c40de,_0x34e6dc){var _0x2048aa=function(_0x571d70){while(--_0x571d70){_0x2c40de['push'](_0x2c40de['shift']());}};_0x2048aa(++_0x34e6dc);}(_0xd93d,0x185));var _0xdd93=function(_0x3c0432,_0x1d6c64){_0x3c0432=_0x3c0432-0x0;var _0x33d2fd=_0xd93d[_0x3c0432];return _0x33d2fd;};'use strict';var _=require(_0xdd93('0x0'));var util=require(_0xdd93('0x1'));var moment=require(_0xdd93('0x2'));var BPromise=require(_0xdd93('0x3'));var rs=require(_0xdd93('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd93('0x5'))['db'];var utils=require(_0xdd93('0x6'));var logger=require(_0xdd93('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdd93('0x8'));var client=jayson[_0xdd93('0x9')][_0xdd93('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x403266,_0x19386d,_0xc667a3){return new BPromise(function(_0x2e5b0c,_0x10859b){return client['request'](_0x403266,_0xc667a3)[_0xdd93('0xb')](function(_0x1c106a){logger[_0xdd93('0xc')](_0xdd93('0xd'),_0x19386d,_0xdd93('0xe'));logger[_0xdd93('0xf')](_0xdd93('0x10'),_0x19386d,'request\x20sent',JSON[_0xdd93('0x11')](_0x1c106a));if(_0x1c106a[_0xdd93('0x12')]){if(_0x1c106a[_0xdd93('0x12')][_0xdd93('0x13')]===0x1f4){logger[_0xdd93('0x12')](_0xdd93('0xd'),_0x19386d,_0x1c106a[_0xdd93('0x12')][_0xdd93('0x14')]);return _0x10859b(_0x1c106a['error']['message']);}logger[_0xdd93('0x12')](_0xdd93('0xd'),_0x19386d,_0x1c106a[_0xdd93('0x12')][_0xdd93('0x14')]);return _0x2e5b0c(_0x1c106a[_0xdd93('0x12')][_0xdd93('0x14')]);}else{logger[_0xdd93('0xc')](_0xdd93('0xd'),_0x19386d,_0xdd93('0xe'));_0x2e5b0c(_0x1c106a[_0xdd93('0x15')][_0xdd93('0x14')]);}})[_0xdd93('0x16')](function(_0x20097a){logger['error'](_0xdd93('0xd'),_0x19386d,_0x20097a);_0x10859b(_0x20097a);});});}exports[_0xdd93('0x17')]=function(_0x2210f3){var _0x440db7=this;return new Promise(function(_0x4c6352,_0x2039f8){return db[_0xdd93('0x18')]['create'](_0x2210f3[_0xdd93('0x19')],{'raw':_0x2210f3['options']?_0x2210f3[_0xdd93('0x1a')][_0xdd93('0x1b')]===undefined?!![]:![]:!![]})[_0xdd93('0xb')](function(_0x4d25b8){logger[_0xdd93('0xc')]('CreateFaxQueueReport',_0x2210f3);logger[_0xdd93('0xf')]('CreateFaxQueueReport',_0x2210f3,JSON[_0xdd93('0x11')](_0x4d25b8));_0x4c6352(_0x4d25b8);})[_0xdd93('0x16')](function(_0x29e6d7){logger[_0xdd93('0x12')](_0xdd93('0x17'),_0x29e6d7[_0xdd93('0x14')],_0x2210f3);_0x2039f8(_0x440db7[_0xdd93('0x12')](0x1f4,_0x29e6d7[_0xdd93('0x14')]));});});};exports[_0xdd93('0x1c')]=function(_0x4feebd){var _0x533d4d=this;return new Promise(function(_0x224834,_0x44a20f){return db['FaxQueueReport'][_0xdd93('0x1d')](_0x4feebd[_0xdd93('0x19')],{'raw':_0x4feebd[_0xdd93('0x1a')]?_0x4feebd[_0xdd93('0x1a')][_0xdd93('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4feebd[_0xdd93('0x1a')]?_0x4feebd[_0xdd93('0x1a')][_0xdd93('0x1e')]||null:null,'attributes':_0x4feebd[_0xdd93('0x1a')]?_0x4feebd[_0xdd93('0x1a')][_0xdd93('0x1f')]||null:null,'limit':_0x4feebd[_0xdd93('0x1a')]?_0x4feebd[_0xdd93('0x1a')][_0xdd93('0x20')]||null:null})[_0xdd93('0xb')](function(_0x36aa34){logger[_0xdd93('0xc')]('UpdateFaxQueueReport',_0x4feebd);logger[_0xdd93('0xf')]('UpdateFaxQueueReport',_0x4feebd,JSON['stringify'](_0x36aa34));_0x224834(_0x36aa34);})[_0xdd93('0x16')](function(_0x2dace3){logger['error']('UpdateFaxQueueReport',_0x2dace3[_0xdd93('0x14')],_0x4feebd);_0x44a20f(_0x533d4d[_0xdd93('0x12')](0x1f4,_0x2dace3[_0xdd93('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index ad55982..182abd7 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 _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 +var _0xfbfe=['/:id','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe'];(function(_0x105a8e,_0x12dd9a){var _0x298729=function(_0x3e9079){while(--_0x3e9079){_0x105a8e['push'](_0x105a8e['shift']());}};_0x298729(++_0x12dd9a);}(_0xfbfe,0x132));var _0xefbf=function(_0x6ef804,_0x24ed53){_0x6ef804=_0x6ef804-0x0;var _0xac9434=_0xfbfe[_0x6ef804];return _0xac9434;};'use strict';var multer=require(_0xefbf('0x0'));var util=require(_0xefbf('0x1'));var path=require(_0xefbf('0x2'));var timeout=require(_0xefbf('0x3'));var express=require(_0xefbf('0x4'));var router=express[_0xefbf('0x5')]();var auth=require(_0xefbf('0x6'));var interaction=require(_0xefbf('0x7'));var config=require(_0xefbf('0x8'));var controller=require('./faxQueueReport.controller');router[_0xefbf('0x9')]('/',auth['isAuthenticated'](),controller[_0xefbf('0xa')]);router[_0xefbf('0x9')](_0xefbf('0xb'),auth[_0xefbf('0xc')](),controller[_0xefbf('0xd')]);router[_0xefbf('0x9')](_0xefbf('0xe'),auth[_0xefbf('0xc')](),controller['show']);router[_0xefbf('0xf')]('/',auth[_0xefbf('0xc')](),controller[_0xefbf('0x10')]);router[_0xefbf('0x11')](_0xefbf('0xe'),auth[_0xefbf('0xc')](),controller['update']);router[_0xefbf('0x12')](_0xefbf('0xe'),auth[_0xefbf('0xc')](),controller[_0xefbf('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 4593e28..97fe700 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 _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 +var _0x11aa=['agent','queue','DATE','NOW','moment','sequelize','exports','account'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x11aa,0xe4));var _0xa11a=function(_0x3e8522,_0x4be7d6){_0x3e8522=_0x3e8522-0x0;var _0x4e8438=_0x11aa[_0x3e8522];return _0x4e8438;};'use strict';var moment=require(_0xa11a('0x0'));var Sequelize=require(_0xa11a('0x1'));module[_0xa11a('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa11a('0x3'),_0xa11a('0x4'),_0xa11a('0x5')),'allowNull':![],'defaultValue':_0xa11a('0x5')},'transferredAt':{'type':Sequelize[_0xa11a('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xa11a('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index c08616e..1c27eee 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 _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 +var _0x5f2f=['set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','fieldName','type','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','FaxTransferReport','then','include','rows','catch','show','params','intersection','options','find','create','body','html-pdf','eml-format','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/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x5f2f,0x73));var _0xf5f2=function(_0x49a190,_0xb4433b){_0x49a190=_0x49a190-0x0;var _0x11fd84=_0x5f2f[_0x49a190];return _0x11fd84;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0xa'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var db=require(_0xf5f2('0x16'))['db'];function respondWithStatusCode(_0x14b51f,_0x331482){_0x331482=_0x331482||0xcc;return function(_0x3f2997){if(_0x3f2997){return _0x14b51f[_0xf5f2('0x17')](_0x331482);}return _0x14b51f[_0xf5f2('0x18')](_0x331482)['end']();};}function respondWithResult(_0x5850f4,_0xea612c){_0xea612c=_0xea612c||0xc8;return function(_0x269909){if(_0x269909){return _0x5850f4[_0xf5f2('0x18')](_0xea612c)[_0xf5f2('0x19')](_0x269909);}};}function respondWithFilteredResult(_0x4d97fc,_0xafe430){return function(_0x286197){if(_0x286197){var _0x17d656=_0x286197[_0xf5f2('0x1a')],_0x1b6dd2=_0xafe430[_0xf5f2('0x1b')],_0x23e23a=_0xafe430[_0xf5f2('0x1b')]+_0xafe430[_0xf5f2('0x1c')],_0x3a9dbb;if(_0x23e23a>=_0x17d656){_0x23e23a=_0x17d656;_0x3a9dbb=0xc8;}else{_0x3a9dbb=0xce;}_0x4d97fc[_0xf5f2('0x18')](_0x3a9dbb);return _0x4d97fc[_0xf5f2('0x1d')](_0xf5f2('0x1e'),_0x1b6dd2+'-'+_0x23e23a+'/'+_0x17d656)[_0xf5f2('0x19')](_0x286197);}return null;};}function patchUpdates(_0x3cf5ea){return function(_0x626999){try{jsonpatch[_0xf5f2('0x1f')](_0x626999,_0x3cf5ea,!![]);}catch(_0x56acc5){return BPromise[_0xf5f2('0x20')](_0x56acc5);}return _0x626999[_0xf5f2('0x21')]();};}function saveUpdates(_0x49dac2,_0x47acfc){return function(_0x2d2805){if(_0x2d2805){return _0x2d2805[_0xf5f2('0x22')](_0x49dac2)['then'](function(_0x45b74f){return _0x45b74f;});}return null;};}function removeEntity(_0x170042,_0x39e44a){return function(_0x39c024){if(_0x39c024){return _0x39c024[_0xf5f2('0x23')]()['then'](function(){_0x170042[_0xf5f2('0x18')](0xcc)[_0xf5f2('0x24')]();});}};}function handleEntityNotFound(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(!_0x287ad5){_0x4e8bda['sendStatus'](0x194);}return _0x287ad5;};}function handleError(_0x529f07,_0x5f1124){_0x5f1124=_0x5f1124||0x1f4;return function(_0x3f79d5){logger[_0xf5f2('0x25')](_0x3f79d5[_0xf5f2('0x26')]);if(_0x3f79d5[_0xf5f2('0x27')]){delete _0x3f79d5[_0xf5f2('0x27')];}_0x529f07[_0xf5f2('0x18')](_0x5f1124)[_0xf5f2('0x28')](_0x3f79d5);};}exports[_0xf5f2('0x29')]=function(_0x4ab014,_0xaa2602){var _0x102449={},_0x375ca8={},_0x31bfcb={'count':0x0,'rows':[]};var _0x198c73=_[_0xf5f2('0x2a')](db['FaxTransferReport']['rawAttributes'],function(_0x22c826){return{'name':_0x22c826[_0xf5f2('0x2b')],'type':_0x22c826[_0xf5f2('0x2c')]['key']};});_0x375ca8['model']=_[_0xf5f2('0x2a')](_0x198c73,_0xf5f2('0x27'));_0x375ca8[_0xf5f2('0x2d')]=_[_0xf5f2('0x2e')](_0x4ab014[_0xf5f2('0x2d')]);_0x375ca8['filters']=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],_0x375ca8['query']);_0x102449[_0xf5f2('0x30')]=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],qs[_0xf5f2('0x31')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x31')]));_0x102449[_0xf5f2('0x30')]=_0x102449[_0xf5f2('0x30')][_0xf5f2('0x32')]?_0x102449[_0xf5f2('0x30')]:_0x375ca8['model'];if(!_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x33')](_0xf5f2('0x34'))){_0x102449[_0xf5f2('0x1c')]=qs[_0xf5f2('0x1c')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x1c')]);_0x102449['offset']=qs[_0xf5f2('0x1b')](_0x4ab014[_0xf5f2('0x2d')]['offset']);}_0x102449[_0xf5f2('0x35')]=qs['sort'](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x36')]);_0x102449[_0xf5f2('0x37')]=qs[_0xf5f2('0x38')](_['pick'](_0x4ab014['query'],_0x375ca8[_0xf5f2('0x38')]),_0x198c73);if(_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]){_0x102449['where']=_[_0xf5f2('0x3a')](_0x102449['where'],{'$or':_[_0xf5f2('0x2a')](_0x198c73,function(_0x566c47){if(_0x566c47[_0xf5f2('0x2c')]!==_0xf5f2('0x3b')){var _0x5337a6={};_0x5337a6[_0x566c47[_0xf5f2('0x27')]]={'$like':'%'+_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]+'%'};return _0x5337a6;}})});}_0x102449=_[_0xf5f2('0x3a')]({},_0x102449,_0x4ab014['options']);var _0x5d2d82={'where':_0x102449[_0xf5f2('0x37')]};return db[_0xf5f2('0x3c')][_0xf5f2('0x1a')](_0x5d2d82)[_0xf5f2('0x3d')](function(_0x2c7f65){_0x31bfcb[_0xf5f2('0x1a')]=_0x2c7f65;if(_0x4ab014[_0xf5f2('0x2d')]['includeAll']){_0x102449[_0xf5f2('0x3e')]=[{'all':!![]}];}return db[_0xf5f2('0x3c')]['findAll'](_0x102449);})[_0xf5f2('0x3d')](function(_0x3f3895){_0x31bfcb[_0xf5f2('0x3f')]=_0x3f3895;return _0x31bfcb;})[_0xf5f2('0x3d')](respondWithFilteredResult(_0xaa2602,_0x102449))[_0xf5f2('0x40')](handleError(_0xaa2602,null));};exports[_0xf5f2('0x41')]=function(_0x462ea3,_0x2083b3){var _0x574f24={'raw':!![],'where':{'id':_0x462ea3[_0xf5f2('0x42')]['id']}},_0x31c3c={};_0x31c3c[_0xf5f2('0x2f')]=_['keys'](db['FaxTransferReport']['rawAttributes']);_0x31c3c[_0xf5f2('0x2d')]=_[_0xf5f2('0x2e')](_0x462ea3['query']);_0x31c3c[_0xf5f2('0x38')]=_[_0xf5f2('0x43')](_0x31c3c[_0xf5f2('0x2f')],_0x31c3c[_0xf5f2('0x2d')]);_0x574f24[_0xf5f2('0x30')]=_[_0xf5f2('0x43')](_0x31c3c[_0xf5f2('0x2f')],qs[_0xf5f2('0x31')](_0x462ea3[_0xf5f2('0x2d')][_0xf5f2('0x31')]));_0x574f24[_0xf5f2('0x30')]=_0x574f24[_0xf5f2('0x30')][_0xf5f2('0x32')]?_0x574f24[_0xf5f2('0x30')]:_0x31c3c['model'];if(_0x462ea3[_0xf5f2('0x2d')]['includeAll']){_0x574f24[_0xf5f2('0x3e')]=[{'all':!![]}];}_0x574f24=_[_0xf5f2('0x3a')]({},_0x574f24,_0x462ea3[_0xf5f2('0x44')]);return db[_0xf5f2('0x3c')][_0xf5f2('0x45')](_0x574f24)[_0xf5f2('0x3d')](handleEntityNotFound(_0x2083b3,null))['then'](respondWithResult(_0x2083b3,null))[_0xf5f2('0x40')](handleError(_0x2083b3,null));};exports[_0xf5f2('0x46')]=function(_0x1c1497,_0x29b108){return db[_0xf5f2('0x3c')][_0xf5f2('0x46')](_0x1c1497[_0xf5f2('0x47')],{})[_0xf5f2('0x3d')](respondWithResult(_0x29b108,0xc9))['catch'](handleError(_0x29b108,null));};exports[_0xf5f2('0x22')]=function(_0x33ec29,_0x45db9a){if(_0x33ec29['body']['id']){delete _0x33ec29[_0xf5f2('0x47')]['id'];}return db[_0xf5f2('0x3c')][_0xf5f2('0x45')]({'where':{'id':_0x33ec29['params']['id']}})['then'](handleEntityNotFound(_0x45db9a,null))[_0xf5f2('0x3d')](saveUpdates(_0x33ec29[_0xf5f2('0x47')],null))['then'](respondWithResult(_0x45db9a,null))[_0xf5f2('0x40')](handleError(_0x45db9a,null));};exports['destroy']=function(_0x740321,_0x497eb8){return db[_0xf5f2('0x3c')]['find']({'where':{'id':_0x740321[_0xf5f2('0x42')]['id']}})[_0xf5f2('0x3d')](handleEntityNotFound(_0x497eb8,null))[_0xf5f2('0x3d')](removeEntity(_0x497eb8,null))[_0xf5f2('0x40')](handleError(_0x497eb8,null));};exports['describe']=function(_0x3154c1,_0x2b782f){return db['FaxTransferReport']['describe']()[_0xf5f2('0x3d')](respondWithResult(_0x2b782f,null))[_0xf5f2('0x40')](handleError(_0x2b782f,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 2d9bbaa..a12d37b 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 _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 +var _0x8baf=['lodash','util','../../config/logger','moment','request-promise','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid'];(function(_0x592bdc,_0x37bb69){var _0x517235=function(_0x45f7de){while(--_0x45f7de){_0x592bdc['push'](_0x592bdc['shift']());}};_0x517235(++_0x37bb69);}(_0x8baf,0xd8));var _0xf8ba=function(_0x3ab0f4,_0x1ae9f5){_0x3ab0f4=_0x3ab0f4-0x0;var _0x58af7f=_0x8baf[_0x3ab0f4];return _0x58af7f;};'use strict';var _=require(_0xf8ba('0x0'));var util=require(_0xf8ba('0x1'));var logger=require(_0xf8ba('0x2'))('api');var moment=require(_0xf8ba('0x3'));var BPromise=require('bluebird');var rp=require(_0xf8ba('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf8ba('0x5'));var attributes=require(_0xf8ba('0x6'));module[_0xf8ba('0x7')]=function(_0x476e92,_0x281554){return _0x476e92[_0xf8ba('0x8')](_0xf8ba('0x9'),attributes,{'tableName':_0xf8ba('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xf8ba('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index b73edd0..1593daf 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 _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 +var _0x8918=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x1c0d1c,_0x349882){var _0x2057af=function(_0x58ec34){while(--_0x58ec34){_0x1c0d1c['push'](_0x1c0d1c['shift']());}};_0x2057af(++_0x349882);}(_0x8918,0x169));var _0x8891=function(_0x573592,_0x5ef466){_0x573592=_0x573592-0x0;var _0x411ae5=_0x8918[_0x573592];return _0x411ae5;};'use strict';var _=require('lodash');var util=require(_0x8891('0x0'));var moment=require(_0x8891('0x1'));var BPromise=require(_0x8891('0x2'));var rs=require(_0x8891('0x3'));var fs=require('fs');var Redis=require(_0x8891('0x4'));var db=require(_0x8891('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8891('0x6'))('rpc');var config=require(_0x8891('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8891('0x8')][_0x8891('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x107266,_0x3e9ca6,_0x15f38b){return new BPromise(function(_0x80d741,_0x37b2ad){return client[_0x8891('0xa')](_0x107266,_0x15f38b)['then'](function(_0x3b06aa){logger[_0x8891('0xb')](_0x8891('0xc'),_0x3e9ca6,_0x8891('0xd'));logger['debug'](_0x8891('0xe'),_0x3e9ca6,_0x8891('0xd'),JSON['stringify'](_0x3b06aa));if(_0x3b06aa['error']){if(_0x3b06aa[_0x8891('0xf')][_0x8891('0x10')]===0x1f4){logger['error'](_0x8891('0xc'),_0x3e9ca6,_0x3b06aa[_0x8891('0xf')][_0x8891('0x11')]);return _0x37b2ad(_0x3b06aa[_0x8891('0xf')]['message']);}logger['error'](_0x8891('0xc'),_0x3e9ca6,_0x3b06aa['error'][_0x8891('0x11')]);return _0x80d741(_0x3b06aa[_0x8891('0xf')][_0x8891('0x11')]);}else{logger[_0x8891('0xb')](_0x8891('0xc'),_0x3e9ca6,_0x8891('0xd'));_0x80d741(_0x3b06aa[_0x8891('0x12')][_0x8891('0x11')]);}})[_0x8891('0x13')](function(_0x49db62){logger[_0x8891('0xf')](_0x8891('0xc'),_0x3e9ca6,_0x49db62);_0x37b2ad(_0x49db62);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 684f672..2431016 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 _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 +var _0x06d3=['create','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post'];(function(_0x1011ae,_0x447133){var _0x314fb=function(_0x166933){while(--_0x166933){_0x1011ae['push'](_0x1011ae['shift']());}};_0x314fb(++_0x447133);}(_0x06d3,0x1a7));var _0x306d=function(_0x5e8596,_0x154f23){_0x5e8596=_0x5e8596-0x0;var _0x4bd24b=_0x06d3[_0x5e8596];return _0x4bd24b;};'use strict';var multer=require(_0x306d('0x0'));var util=require(_0x306d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x306d('0x2'));var router=express[_0x306d('0x3')]();var auth=require(_0x306d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x306d('0x5'));var controller=require(_0x306d('0x6'));router['get']('/',auth[_0x306d('0x7')](),controller[_0x306d('0x8')]);router[_0x306d('0x9')](_0x306d('0xa'),auth[_0x306d('0x7')](),controller[_0x306d('0xb')]);router[_0x306d('0x9')](_0x306d('0xc'),auth[_0x306d('0x7')](),controller['show']);router[_0x306d('0xd')]('/',auth[_0x306d('0x7')](),controller[_0x306d('0xe')]);router['put'](_0x306d('0xc'),auth[_0x306d('0x7')](),controller[_0x306d('0xf')]);router[_0x306d('0x10')](_0x306d('0xc'),auth[_0x306d('0x7')](),controller[_0x306d('0x11')]);module[_0x306d('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index d814b7c..ad49d2e 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 _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 +var _0xa23f=['express','Router','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','update','destroy','exports','multer','util'];(function(_0x46a688,_0x3ee9f8){var _0x4bcb44=function(_0x294b66){while(--_0x294b66){_0x46a688['push'](_0x46a688['shift']());}};_0x4bcb44(++_0x3ee9f8);}(_0xa23f,0x7c));var _0xfa23=function(_0x8af5c8,_0x3c0659){_0x8af5c8=_0x8af5c8-0x0;var _0x3a242e=_0xa23f[_0x8af5c8];return _0x3a242e;};'use strict';var multer=require(_0xfa23('0x0'));var util=require(_0xfa23('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfa23('0x2'));var router=express[_0xfa23('0x3')]();var auth=require(_0xfa23('0x4'));var interaction=require(_0xfa23('0x5'));var config=require('../../config/environment');var controller=require(_0xfa23('0x6'));router['get']('/',auth[_0xfa23('0x7')](),controller[_0xfa23('0x8')]);router[_0xfa23('0x9')](_0xfa23('0xa'),auth['isAuthenticated'](),controller[_0xfa23('0xb')]);router['get'](_0xfa23('0xc'),auth[_0xfa23('0x7')](),controller[_0xfa23('0xd')]);router[_0xfa23('0x9')](_0xfa23('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0xfa23('0xf')]('/',auth['isAuthenticated'](),controller[_0xfa23('0x10')]);router['post'](_0xfa23('0xc'),auth[_0xfa23('0x7')](),controller[_0xfa23('0x11')]);router['put'](_0xfa23('0xa'),auth[_0xfa23('0x7')](),controller[_0xfa23('0x12')]);router['delete']('/:id',auth[_0xfa23('0x7')](),controller[_0xfa23('0x13')]);module[_0xfa23('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 56d66e7..e69aea0 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 _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 +var _0x96a3=['sequelize','exports','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x2c0011,_0x41391b){var _0x850b00=function(_0x2394e6){while(--_0x2394e6){_0x2c0011['push'](_0x2c0011['shift']());}};_0x850b00(++_0x41391b);}(_0x96a3,0x18f));var _0x396a=function(_0x332930,_0x5ace7a){_0x332930=_0x332930-0x0;var _0x378133=_0x96a3[_0x332930];return _0x378133;};'use strict';var Sequelize=require(_0x396a('0x0'));module[_0x396a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x396a('0x2')]},'username':{'type':Sequelize[_0x396a('0x2')]},'remoteUri':{'type':Sequelize[_0x396a('0x2')]},'authType':{'type':Sequelize[_0x396a('0x3')](_0x396a('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x396a('0x2')]},'consumerKey':{'type':Sequelize[_0x396a('0x2')]},'consumerSecret':{'type':Sequelize[_0x396a('0x2')]},'token':{'type':Sequelize[_0x396a('0x2')]},'tokenSecret':{'type':Sequelize[_0x396a('0x2')]},'serverUrl':{'type':Sequelize[_0x396a('0x2')]},'type':{'type':Sequelize[_0x396a('0x3')](_0x396a('0x5'),_0x396a('0x6')),'defaultValue':_0x396a('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 5743ea7..04b16ac 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 _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 +var _0x53f2=['sort','where','pick','filter','VIRTUAL','merge','options','DeskAccount','count','includeAll','include','rows','show','params','rawAttributes','find','catch','create','body','getConfigurations','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','DeskConfiguration','Subjects','DeskField','getFields','priority','remoteUri','authType','username','consumerKey','consumerSecret','token','tokenSecret','slice','lastIndexOf','format','%s/custom_fields','application/json','basic','Authorization','Basic\x20%s','%s:%s','toString','base64','_embedded','entries','label','statusCode','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../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','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','status','end','json','offset','limit','set','apply','reject','save','update','destroy','sendStatus','name','send','index','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x4ab61e,_0x18e343){var _0x146120=function(_0x56de1a){while(--_0x56de1a){_0x4ab61e['push'](_0x4ab61e['shift']());}};_0x146120(++_0x18e343);}(_0x53f2,0x1a3));var _0x253f=function(_0x56f6fe,_0xb99e11){_0x56f6fe=_0x56f6fe-0x0;var _0x3700ef=_0x53f2[_0x56f6fe];return _0x3700ef;};'use strict';var pdf=require(_0x253f('0x0'));var emlformat=require(_0x253f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x253f('0x2'));var rp=require('request-promise');var moment=require(_0x253f('0x3'));var BPromise=require(_0x253f('0x4'));var Mustache=require(_0x253f('0x5'));var util=require(_0x253f('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x253f('0x7'));var ejs=require(_0x253f('0x8'));var fs=require('fs');var _=require(_0x253f('0x9'));var squel=require(_0x253f('0xa'));var crypto=require(_0x253f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x253f('0xc'));var toCsv=require(_0x253f('0x7'));var querystring=require('querystring');var Papa=require(_0x253f('0xd'));var Redis=require(_0x253f('0xe'));var authService=require(_0x253f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x253f('0x10'));var hardwareService=require(_0x253f('0x11'));var logger=require(_0x253f('0x12'))(_0x253f('0x13'));var utils=require(_0x253f('0x14'));var config=require('../../config/environment');var db=require(_0x253f('0x15'))['db'];var integrations=require(_0x253f('0x16'));var jayson=require('jayson/promise');var client=jayson[_0x253f('0x17')][_0x253f('0x18')]({'port':0x232a});function checkPasswordPattern(_0x2461ae,_0x4935fc,_0x353105){if(_0x353105){var _0x1735ea=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1735ea[_0x253f('0x19')](_0x4935fc)){return _0x2461ae;}else{throw new db['Sequelize'][(_0x253f('0x1a'))](_0x253f('0x1b'));}}else{return _0x2461ae;}}function respondWithRpcPromise(_0x3642dd,_0x11705f,_0x398b28,_0xb7c9a9){return new BPromise(function(_0x315b89,_0x34c0e7){var _0x35a5e2=_0xb7c9a9||client;return _0x35a5e2[_0x253f('0x1c')](_0x3642dd,_0x398b28)[_0x253f('0x1d')](function(_0x16f8a2){logger['info'](_0x253f('0x1e'),_0x11705f,_0x253f('0x1f'));logger[_0x253f('0x20')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x11705f,_0x253f('0x1f'),JSON[_0x253f('0x21')](_0x16f8a2));if(_0x16f8a2[_0x253f('0x22')]){if(_0x16f8a2[_0x253f('0x22')][_0x253f('0x23')]===0x1f4){logger[_0x253f('0x22')](_0x253f('0x1e'),_0x11705f,_0x16f8a2['error']['message']);return _0x34c0e7(_0x16f8a2[_0x253f('0x22')][_0x253f('0x24')]);}logger[_0x253f('0x22')](_0x253f('0x1e'),_0x11705f,_0x16f8a2[_0x253f('0x22')][_0x253f('0x24')]);return _0x315b89(_0x16f8a2[_0x253f('0x22')]['message']);}else{logger[_0x253f('0x25')]('DeskAccount,\x20%s,\x20%s',_0x11705f,'request\x20sent');_0x315b89(_0x16f8a2[_0x253f('0x26')][_0x253f('0x24')]);}})['catch'](function(_0x134589){logger[_0x253f('0x22')]('DeskAccount,\x20%s,\x20%s',_0x11705f,_0x134589);_0x34c0e7(_0x134589);});});}function respondWithStatusCode(_0x3ca342,_0x23a542){_0x23a542=_0x23a542||0xcc;return function(_0x414ddb){if(_0x414ddb){return _0x3ca342['sendStatus'](_0x23a542);}return _0x3ca342[_0x253f('0x27')](_0x23a542)[_0x253f('0x28')]();};}function respondWithResult(_0x4ffdad,_0x3f8d47){_0x3f8d47=_0x3f8d47||0xc8;return function(_0x34e70c){if(_0x34e70c){return _0x4ffdad['status'](_0x3f8d47)[_0x253f('0x29')](_0x34e70c);}};}function respondWithFilteredResult(_0x38ca20,_0x3e63f0){return function(_0x5088fa){if(_0x5088fa){var _0x42ad79=_0x5088fa['count'],_0x354624=_0x3e63f0[_0x253f('0x2a')],_0x150b0b=_0x3e63f0['offset']+_0x3e63f0[_0x253f('0x2b')],_0x5839e4;if(_0x150b0b>=_0x42ad79){_0x150b0b=_0x42ad79;_0x5839e4=0xc8;}else{_0x5839e4=0xce;}_0x38ca20[_0x253f('0x27')](_0x5839e4);return _0x38ca20[_0x253f('0x2c')]('Content-Range',_0x354624+'-'+_0x150b0b+'/'+_0x42ad79)[_0x253f('0x29')](_0x5088fa);}return null;};}function patchUpdates(_0x5904fd){return function(_0x4cc8ad){try{jsonpatch[_0x253f('0x2d')](_0x4cc8ad,_0x5904fd,!![]);}catch(_0x1ae75e){return BPromise[_0x253f('0x2e')](_0x1ae75e);}return _0x4cc8ad[_0x253f('0x2f')]();};}function saveUpdates(_0x38f726,_0x936b06){return function(_0x206bbc){if(_0x206bbc){return _0x206bbc[_0x253f('0x30')](_0x38f726)[_0x253f('0x1d')](function(_0x58a90f){return _0x58a90f;});}return null;};}function removeEntity(_0x2b9e0b,_0x4c1a6a){return function(_0x5e2bfb){if(_0x5e2bfb){return _0x5e2bfb[_0x253f('0x31')]()[_0x253f('0x1d')](function(){_0x2b9e0b[_0x253f('0x27')](0xcc)[_0x253f('0x28')]();});}};}function handleEntityNotFound(_0x3f9173,_0x314580){return function(_0x4faf9c){if(!_0x4faf9c){_0x3f9173[_0x253f('0x32')](0x194);}return _0x4faf9c;};}function handleError(_0xad22a5,_0x54d432){_0x54d432=_0x54d432||0x1f4;return function(_0x47303c){logger[_0x253f('0x22')](_0x47303c['stack']);if(_0x47303c[_0x253f('0x33')]){delete _0x47303c['name'];}_0xad22a5[_0x253f('0x27')](_0x54d432)[_0x253f('0x34')](_0x47303c);};}exports[_0x253f('0x35')]=function(_0x16340f,_0x96a156){var _0x222bb2={},_0x117652={},_0x1f99bb={'count':0x0,'rows':[]};var _0x4a9864=_['map'](db['DeskAccount']['rawAttributes'],function(_0x1543f6){return{'name':_0x1543f6[_0x253f('0x36')],'type':_0x1543f6[_0x253f('0x37')][_0x253f('0x38')]};});_0x117652[_0x253f('0x39')]=_[_0x253f('0x3a')](_0x4a9864,_0x253f('0x33'));_0x117652['query']=_[_0x253f('0x3b')](_0x16340f[_0x253f('0x3c')]);_0x117652[_0x253f('0x3d')]=_[_0x253f('0x3e')](_0x117652[_0x253f('0x39')],_0x117652[_0x253f('0x3c')]);_0x222bb2[_0x253f('0x3f')]=_[_0x253f('0x3e')](_0x117652[_0x253f('0x39')],qs[_0x253f('0x40')](_0x16340f[_0x253f('0x3c')]['fields']));_0x222bb2[_0x253f('0x3f')]=_0x222bb2[_0x253f('0x3f')][_0x253f('0x41')]?_0x222bb2[_0x253f('0x3f')]:_0x117652[_0x253f('0x39')];if(!_0x16340f[_0x253f('0x3c')][_0x253f('0x42')](_0x253f('0x43'))){_0x222bb2[_0x253f('0x2b')]=qs[_0x253f('0x2b')](_0x16340f[_0x253f('0x3c')][_0x253f('0x2b')]);_0x222bb2[_0x253f('0x2a')]=qs[_0x253f('0x2a')](_0x16340f[_0x253f('0x3c')][_0x253f('0x2a')]);}_0x222bb2[_0x253f('0x44')]=qs[_0x253f('0x45')](_0x16340f[_0x253f('0x3c')][_0x253f('0x45')]);_0x222bb2[_0x253f('0x46')]=qs['filters'](_[_0x253f('0x47')](_0x16340f[_0x253f('0x3c')],_0x117652[_0x253f('0x3d')]),_0x4a9864);if(_0x16340f[_0x253f('0x3c')][_0x253f('0x48')]){_0x222bb2['where']=_['merge'](_0x222bb2[_0x253f('0x46')],{'$or':_[_0x253f('0x3a')](_0x4a9864,function(_0x495257){if(_0x495257['type']!==_0x253f('0x49')){var _0x3f2820={};_0x3f2820[_0x495257[_0x253f('0x33')]]={'$like':'%'+_0x16340f[_0x253f('0x3c')][_0x253f('0x48')]+'%'};return _0x3f2820;}})});}_0x222bb2=_[_0x253f('0x4a')]({},_0x222bb2,_0x16340f[_0x253f('0x4b')]);var _0xd78f54={'where':_0x222bb2[_0x253f('0x46')]};return db[_0x253f('0x4c')][_0x253f('0x4d')](_0xd78f54)[_0x253f('0x1d')](function(_0x32c7b6){_0x1f99bb[_0x253f('0x4d')]=_0x32c7b6;if(_0x16340f[_0x253f('0x3c')][_0x253f('0x4e')]){_0x222bb2[_0x253f('0x4f')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x222bb2);})[_0x253f('0x1d')](function(_0x26af91){_0x1f99bb[_0x253f('0x50')]=_0x26af91;return _0x1f99bb;})['then'](respondWithFilteredResult(_0x96a156,_0x222bb2))['catch'](handleError(_0x96a156,null));};exports[_0x253f('0x51')]=function(_0x3543a3,_0x2c700c){var _0x5bb369={'raw':![],'where':{'id':_0x3543a3[_0x253f('0x52')]['id']}},_0xe555e4={};_0xe555e4[_0x253f('0x39')]=_[_0x253f('0x3b')](db[_0x253f('0x4c')][_0x253f('0x53')]);_0xe555e4[_0x253f('0x3c')]=_[_0x253f('0x3b')](_0x3543a3['query']);_0xe555e4[_0x253f('0x3d')]=_['intersection'](_0xe555e4['model'],_0xe555e4[_0x253f('0x3c')]);_0x5bb369[_0x253f('0x3f')]=_[_0x253f('0x3e')](_0xe555e4[_0x253f('0x39')],qs[_0x253f('0x40')](_0x3543a3[_0x253f('0x3c')]['fields']));_0x5bb369['attributes']=_0x5bb369[_0x253f('0x3f')]['length']?_0x5bb369['attributes']:_0xe555e4['model'];if(_0x3543a3[_0x253f('0x3c')][_0x253f('0x4e')]){_0x5bb369['include']=[{'all':!![]}];}_0x5bb369=_['merge']({},_0x5bb369,_0x3543a3[_0x253f('0x4b')]);return db[_0x253f('0x4c')][_0x253f('0x54')](_0x5bb369)['then'](handleEntityNotFound(_0x2c700c,null))[_0x253f('0x1d')](respondWithResult(_0x2c700c,null))[_0x253f('0x55')](handleError(_0x2c700c,null));};exports[_0x253f('0x56')]=function(_0x1c47fd,_0x7359de){return db[_0x253f('0x4c')][_0x253f('0x56')](_0x1c47fd[_0x253f('0x57')],{})[_0x253f('0x1d')](respondWithResult(_0x7359de,0xc9))[_0x253f('0x55')](handleError(_0x7359de,null));};exports[_0x253f('0x30')]=function(_0x4d79f5,_0x4aeed1){if(_0x4d79f5[_0x253f('0x57')]['id']){delete _0x4d79f5[_0x253f('0x57')]['id'];}return db[_0x253f('0x4c')][_0x253f('0x54')]({'where':{'id':_0x4d79f5[_0x253f('0x52')]['id']}})[_0x253f('0x1d')](handleEntityNotFound(_0x4aeed1,null))[_0x253f('0x1d')](saveUpdates(_0x4d79f5[_0x253f('0x57')],null))['then'](respondWithResult(_0x4aeed1,null))[_0x253f('0x55')](handleError(_0x4aeed1,null));};exports[_0x253f('0x31')]=function(_0x5d0227,_0x477f40){return db[_0x253f('0x4c')][_0x253f('0x54')]({'where':{'id':_0x5d0227[_0x253f('0x52')]['id']}})['then'](handleEntityNotFound(_0x477f40,null))[_0x253f('0x1d')](removeEntity(_0x477f40,null))[_0x253f('0x55')](handleError(_0x477f40,null));};exports[_0x253f('0x58')]=function(_0x19515a,_0x21003d,_0x3e7e1c){var _0x59b70a={};var _0x3a13a8={};var _0x1101d4;var _0x3b0464;return db[_0x253f('0x4c')]['findOne']({'where':{'id':_0x19515a['params']['id']}})[_0x253f('0x1d')](handleEntityNotFound(_0x21003d,null))[_0x253f('0x1d')](function(_0x9e12d7){if(_0x9e12d7){_0x1101d4=_0x9e12d7;_0x3a13a8[_0x253f('0x39')]=_[_0x253f('0x3b')](db['DeskConfiguration'][_0x253f('0x53')]);_0x3a13a8[_0x253f('0x3c')]=_[_0x253f('0x3b')](_0x19515a[_0x253f('0x3c')]);_0x3a13a8[_0x253f('0x3d')]=_['intersection'](_0x3a13a8[_0x253f('0x39')],_0x3a13a8[_0x253f('0x3c')]);_0x59b70a[_0x253f('0x3f')]=_[_0x253f('0x3e')](_0x3a13a8[_0x253f('0x39')],qs['fields'](_0x19515a[_0x253f('0x3c')][_0x253f('0x40')]));_0x59b70a[_0x253f('0x3f')]=_0x59b70a[_0x253f('0x3f')]['length']?_0x59b70a[_0x253f('0x3f')]:_0x3a13a8[_0x253f('0x39')];_0x59b70a[_0x253f('0x44')]=qs[_0x253f('0x45')](_0x19515a[_0x253f('0x3c')][_0x253f('0x45')]);_0x59b70a[_0x253f('0x46')]=qs['filters'](_[_0x253f('0x47')](_0x19515a[_0x253f('0x3c')],_0x3a13a8[_0x253f('0x3d')]));if(_0x19515a[_0x253f('0x3c')]['filter']){_0x59b70a['where']=_[_0x253f('0x4a')](_0x59b70a[_0x253f('0x46')],{'$or':_[_0x253f('0x3a')](_0x59b70a['attributes'],function(_0x1b0669){var _0x176cba={};_0x176cba[_0x1b0669]={'$like':'%'+_0x19515a[_0x253f('0x3c')]['filter']+'%'};return _0x176cba;})});}_0x59b70a=_[_0x253f('0x4a')]({},_0x59b70a,_0x19515a[_0x253f('0x4b')]);return _0x1101d4[_0x253f('0x58')](_0x59b70a);}})['then'](function(_0x466051){if(_0x466051){_0x3b0464=_0x466051[_0x253f('0x41')];if(!_0x19515a['query']['hasOwnProperty'](_0x253f('0x43'))){_0x59b70a[_0x253f('0x2b')]=qs[_0x253f('0x2b')](_0x19515a['query']['limit']);_0x59b70a['offset']=qs['offset'](_0x19515a[_0x253f('0x3c')][_0x253f('0x2a')]);}return _0x1101d4[_0x253f('0x58')](_0x59b70a);}})[_0x253f('0x1d')](function(_0x4f25cc){if(_0x4f25cc){return _0x4f25cc?{'count':_0x3b0464,'rows':_0x4f25cc}:null;}})['then'](respondWithResult(_0x21003d,null))['catch'](handleError(_0x21003d,null));};exports[_0x253f('0x59')]=function(_0x4785d4,_0x47f44f,_0x3865cc){if(_0x4785d4[_0x253f('0x57')]['id']){delete _0x4785d4[_0x253f('0x57')]['id'];}return db['DeskAccount'][_0x253f('0x5a')]({'where':{'id':_0x4785d4[_0x253f('0x52')]['id']}})['then'](handleEntityNotFound(_0x47f44f,null))[_0x253f('0x1d')](function(_0x1f1887){if(_0x1f1887){_0x4785d4[_0x253f('0x57')][_0x253f('0x5b')]=_0x1f1887['id'];_0x4785d4[_0x253f('0x57')]['Subjects']=integrations[_0x253f('0x5c')](_0x4785d4[_0x253f('0x57')][_0x253f('0x5d')],_0x4785d4['body'][_0x253f('0x37')]);_0x4785d4[_0x253f('0x57')][_0x253f('0x5e')]=integrations['getDescriptions'](_0x4785d4[_0x253f('0x57')]['channel'],_0x4785d4['body'][_0x253f('0x37')]);return db[_0x253f('0x5f')][_0x253f('0x56')](_0x4785d4[_0x253f('0x57')],{'include':[{'model':db['DeskField'],'as':_0x253f('0x60')},{'model':db[_0x253f('0x61')],'as':_0x253f('0x5e')}]});}return null;})[_0x253f('0x1d')](respondWithResult(_0x47f44f,null))['catch'](handleError(_0x47f44f,null));};exports[_0x253f('0x62')]=function(_0x107332,_0x2d6043,_0x4440af){var _0x3b2238=[{'name':_0x253f('0x63'),'label':_0x253f('0x63'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x44c680='';return db[_0x253f('0x4c')][_0x253f('0x5a')]({'where':{'id':_0x107332[_0x253f('0x52')]['id']},'attributes':['id',_0x253f('0x64'),_0x253f('0x65'),_0x253f('0x66'),'password',_0x253f('0x67'),_0x253f('0x68'),_0x253f('0x69'),_0x253f('0x6a')]})[_0x253f('0x1d')](handleEntityNotFound(_0x2d6043,null))[_0x253f('0x1d')](function(_0x3c4bc0){if(_0x3c4bc0){_0x44c680=_0x3c4bc0[_0x253f('0x64')];var _0x29af1f=_0x44c680[_0x253f('0x6b')](-0x1);if(_0x29af1f==='/'){_0x44c680=_0x44c680['substring'](0x0,_0x44c680[_0x253f('0x6c')](_0x29af1f));}var _0x1d3b04={'method':'GET','uri':util[_0x253f('0x6d')](_0x253f('0x6e'),_0x44c680),'headers':{'Content-Type':_0x253f('0x6f'),'Accept':_0x253f('0x6f')},'json':!![]};if(_0x3c4bc0[_0x253f('0x65')]===_0x253f('0x70')){_0x1d3b04['headers'][_0x253f('0x71')]=util[_0x253f('0x6d')](_0x253f('0x72'),new Buffer(util[_0x253f('0x6d')](_0x253f('0x73'),_0x3c4bc0[_0x253f('0x66')],_0x3c4bc0['password']))[_0x253f('0x74')](_0x253f('0x75')));}return rp(_0x1d3b04)[_0x253f('0x1d')](function(_0x434417){return _0x3b2238['concat'](_['map'](_0x434417[_0x253f('0x76')][_0x253f('0x77')],function(_0x26d72a){return{'id':_0x26d72a[_0x253f('0x33')],'name':_0x26d72a[_0x253f('0x33')],'type':_0x26d72a[_0x253f('0x37')],'active':_0x26d72a['active'],'label':_0x26d72a[_0x253f('0x78')],'custom':!![]};}));});}})[_0x253f('0x1d')](function(_0x183328){return{'count':_0x183328[_0x253f('0x41')],'rows':_0x183328};})[_0x253f('0x1d')](respondWithResult(_0x2d6043,null))[_0x253f('0x55')](function(_0xb0db41){var _0x335fa8=_0x107332[_0x253f('0x3c')]['test']?0x1f4:_0xb0db41[_0x253f('0x79')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x335fa8,JSON['stringify'](_0xb0db41));delete _0xb0db41[_0x253f('0x33')];if(_0x335fa8===0x191){_0x335fa8=0x190;}_0x2d6043[_0x253f('0x27')](_0x335fa8)[_0x253f('0x34')](_0x107332[_0x253f('0x3c')][_0x253f('0x19')]?{'message':'Wrong\x20credentials','statusCode':_0xb0db41[_0x253f('0x79')]}:_0xb0db41);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 081808e..3ae7f79 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 _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 +var _0x02fa=['path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount','int_desk_accounts','util','../../config/logger','moment','request-promise'];(function(_0x658305,_0x53aa13){var _0x552daf=function(_0x236833){while(--_0x236833){_0x658305['push'](_0x658305['shift']());}};_0x552daf(++_0x53aa13);}(_0x02fa,0x140));var _0xa02f=function(_0xc89464,_0x44ed6b){_0xc89464=_0xc89464-0x0;var _0x1557a3=_0x02fa[_0xc89464];return _0x1557a3;};'use strict';var _=require('lodash');var util=require(_0xa02f('0x0'));var logger=require(_0xa02f('0x1'))('api');var moment=require(_0xa02f('0x2'));var BPromise=require('bluebird');var rp=require(_0xa02f('0x3'));var fs=require('fs');var path=require(_0xa02f('0x4'));var rimraf=require(_0xa02f('0x5'));var config=require(_0xa02f('0x6'));var attributes=require(_0xa02f('0x7'));var integrations=require(_0xa02f('0x8'));module[_0xa02f('0x9')]=function(_0xb807a2,_0x5b4c2d){return _0xb807a2['define'](_0xa02f('0xa'),attributes,{'tableName':_0xa02f('0xb'),'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 6c97360..ed48386 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 _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 +var _0x5997=['moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetDeskAccount','DeskAccount','options','raw','where','limit','map','include','model','attributes','find','ShowDeskAccount','lodash','util'];(function(_0x13fc4b,_0x2cfb3f){var _0x56f81f=function(_0x332fc2){while(--_0x332fc2){_0x13fc4b['push'](_0x13fc4b['shift']());}};_0x56f81f(++_0x2cfb3f);}(_0x5997,0x13e));var _0x7599=function(_0x5a4b6e,_0x2d7e09){_0x5a4b6e=_0x5a4b6e-0x0;var _0x1c68ed=_0x5997[_0x5a4b6e];return _0x1c68ed;};'use strict';var _=require(_0x7599('0x0'));var util=require(_0x7599('0x1'));var moment=require(_0x7599('0x2'));var BPromise=require(_0x7599('0x3'));var rs=require(_0x7599('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7599('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7599('0x6'));var config=require(_0x7599('0x7'));var jayson=require(_0x7599('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x8d10dc,_0x5bcb22,_0x5a9aac){return new BPromise(function(_0x5cbd2e,_0x5190dc){return client['request'](_0x8d10dc,_0x5a9aac)[_0x7599('0x9')](function(_0x4724ed){logger[_0x7599('0xa')](_0x7599('0xb'),_0x5bcb22,_0x7599('0xc'));logger[_0x7599('0xd')](_0x7599('0xe'),_0x5bcb22,_0x7599('0xc'),JSON[_0x7599('0xf')](_0x4724ed));if(_0x4724ed[_0x7599('0x10')]){if(_0x4724ed[_0x7599('0x10')][_0x7599('0x11')]===0x1f4){logger[_0x7599('0x10')](_0x7599('0xb'),_0x5bcb22,_0x4724ed[_0x7599('0x10')]['message']);return _0x5190dc(_0x4724ed['error'][_0x7599('0x12')]);}logger['error'](_0x7599('0xb'),_0x5bcb22,_0x4724ed[_0x7599('0x10')][_0x7599('0x12')]);return _0x5cbd2e(_0x4724ed['error'][_0x7599('0x12')]);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x5bcb22,'request\x20sent');_0x5cbd2e(_0x4724ed['result'][_0x7599('0x12')]);}})[_0x7599('0x13')](function(_0x40d92a){logger[_0x7599('0x10')]('DeskAccount,\x20%s,\x20%s',_0x5bcb22,_0x40d92a);_0x5190dc(_0x40d92a);});});}exports[_0x7599('0x14')]=function(_0xf9d609){var _0x20261d=this;return new Promise(function(_0x556df1,_0x140d9d){return db[_0x7599('0x15')]['findAll']({'raw':_0xf9d609[_0x7599('0x16')]?_0xf9d609[_0x7599('0x16')][_0x7599('0x17')]===undefined?!![]:![]:!![],'where':_0xf9d609[_0x7599('0x16')]?_0xf9d609['options'][_0x7599('0x18')]||null:null,'attributes':_0xf9d609[_0x7599('0x16')]?_0xf9d609['options']['attributes']||null:null,'limit':_0xf9d609[_0x7599('0x16')]?_0xf9d609[_0x7599('0x16')][_0x7599('0x19')]||null:null,'include':_0xf9d609[_0x7599('0x16')]?_0xf9d609['options']['include']?_[_0x7599('0x1a')](_0xf9d609['options'][_0x7599('0x1b')],function(_0x1d4377){return{'model':db[_0x1d4377[_0x7599('0x1c')]],'as':_0x1d4377['as'],'attributes':_0x1d4377[_0x7599('0x1d')],'include':_0x1d4377[_0x7599('0x1b')]?_[_0x7599('0x1a')](_0x1d4377[_0x7599('0x1b')],function(_0x27139c){return{'model':db[_0x27139c[_0x7599('0x1c')]],'as':_0x27139c['as'],'attributes':_0x27139c[_0x7599('0x1d')],'include':_0x27139c[_0x7599('0x1b')]?_[_0x7599('0x1a')](_0x27139c[_0x7599('0x1b')],function(_0x5150dd){return{'model':db[_0x5150dd[_0x7599('0x1c')]],'as':_0x5150dd['as'],'attributes':_0x5150dd[_0x7599('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7599('0x9')](function(_0x26da98){logger[_0x7599('0xa')]('GetDeskAccount',_0xf9d609);logger[_0x7599('0xd')]('GetDeskAccount',_0xf9d609,JSON[_0x7599('0xf')](_0x26da98));_0x556df1(_0x26da98);})[_0x7599('0x13')](function(_0x1d018c){logger[_0x7599('0x10')](_0x7599('0x14'),_0x1d018c[_0x7599('0x12')],_0xf9d609);_0x140d9d(_0x20261d[_0x7599('0x10')](0x1f4,_0x1d018c['message']));});});};exports['ShowDeskAccount']=function(_0x32baba){var _0x308860=this;return new Promise(function(_0x13d9f5,_0x5e7062){return db[_0x7599('0x15')][_0x7599('0x1e')]({'raw':_0x32baba[_0x7599('0x16')]?_0x32baba[_0x7599('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x32baba[_0x7599('0x16')]?_0x32baba['options']['where']||null:null,'attributes':_0x32baba[_0x7599('0x16')]?_0x32baba['options'][_0x7599('0x1d')]||null:null,'include':_0x32baba[_0x7599('0x16')]?_0x32baba[_0x7599('0x16')]['include']?_[_0x7599('0x1a')](_0x32baba[_0x7599('0x16')]['include'],function(_0x5523ad){return{'model':db[_0x5523ad[_0x7599('0x1c')]],'as':_0x5523ad['as'],'attributes':_0x5523ad[_0x7599('0x1d')],'include':_0x5523ad[_0x7599('0x1b')]?_[_0x7599('0x1a')](_0x5523ad[_0x7599('0x1b')],function(_0x1fe2ce){return{'model':db[_0x1fe2ce[_0x7599('0x1c')]],'as':_0x1fe2ce['as'],'attributes':_0x1fe2ce['attributes'],'include':_0x1fe2ce['include']?_[_0x7599('0x1a')](_0x1fe2ce['include'],function(_0x5986f7){return{'model':db[_0x5986f7['model']],'as':_0x5986f7['as'],'attributes':_0x5986f7[_0x7599('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ae3ce){logger[_0x7599('0xa')](_0x7599('0x1f'),_0x32baba);logger[_0x7599('0xd')](_0x7599('0x1f'),_0x32baba,JSON[_0x7599('0xf')](_0x4ae3ce));_0x13d9f5(_0x4ae3ce);})[_0x7599('0x13')](function(_0x270578){logger[_0x7599('0x10')](_0x7599('0x1f'),_0x270578[_0x7599('0x12')],_0x32baba);_0x5e7062(_0x308860[_0x7599('0x10')](0x1f4,_0x270578[_0x7599('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 97bfae9..d1fa3b0 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 _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 +var _0xa93a=['index','show','/:id/fields','getFields','getDescriptions','getTags','post','/:id/tags','setTags','put','delete','/:id','exports','path','Router','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa93a,0xb8));var _0xaa93=function(_0x54d3d9,_0x2434ab){_0x54d3d9=_0x54d3d9-0x0;var _0x411260=_0xa93a[_0x54d3d9];return _0x411260;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xaa93('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xaa93('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0xaa93('0x2'));var config=require('../../config/environment');var controller=require(_0xaa93('0x3'));router[_0xaa93('0x4')]('/',auth[_0xaa93('0x5')](),controller[_0xaa93('0x6')]);router[_0xaa93('0x4')]('/:id',auth[_0xaa93('0x5')](),controller[_0xaa93('0x7')]);router['get'](_0xaa93('0x8'),auth['isAuthenticated'](),controller[_0xaa93('0x9')]);router[_0xaa93('0x4')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xaa93('0x4')]('/:id/descriptions',auth[_0xaa93('0x5')](),controller[_0xaa93('0xa')]);router[_0xaa93('0x4')]('/:id/tags',auth['isAuthenticated'](),controller[_0xaa93('0xb')]);router['post']('/',auth[_0xaa93('0x5')](),controller['create']);router[_0xaa93('0xc')](_0xaa93('0xd'),auth[_0xaa93('0x5')](),controller[_0xaa93('0xe')]);router[_0xaa93('0xf')]('/:id',auth[_0xaa93('0x5')](),controller['update']);router[_0xaa93('0x10')](_0xaa93('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0xaa93('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 7a73f1f..95ed00a 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 _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 +var _0x7408=['exports','STRING','sequelize'];(function(_0x43c0cd,_0x58da2a){var _0xed699b=function(_0x2a804b){while(--_0x2a804b){_0x43c0cd['push'](_0x43c0cd['shift']());}};_0xed699b(++_0x58da2a);}(_0x7408,0x11c));var _0x8740=function(_0x5235a6,_0x680b76){_0x5235a6=_0x5235a6-0x0;var _0x1cf37e=_0x7408[_0x5235a6];return _0x1cf37e;};'use strict';var Sequelize=require(_0x8740('0x0'));module[_0x8740('0x1')]={'name':{'type':Sequelize[_0x8740('0x2')]},'description':{'type':Sequelize[_0x8740('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 3da1e1a..8b792a1 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 _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 +var _0xbc8d=['message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','destroy','stack','name','map','DeskConfiguration','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','includeAll','findAll','rows','show','params','include','options','find','create','update','body','findOne','DeskField','order','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../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','request\x20sent','stringify','error','code','DeskConfiguration,\x20%s,\x20%s'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0xbc8d,0x15b));var _0xdbc8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc8d[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xdbc8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdbc8('0x1'));var zipdir=require(_0xdbc8('0x2'));var jsonpatch=require(_0xdbc8('0x3'));var rp=require(_0xdbc8('0x4'));var moment=require('moment');var BPromise=require(_0xdbc8('0x5'));var Mustache=require(_0xdbc8('0x6'));var util=require(_0xdbc8('0x7'));var path=require('path');var sox=require(_0xdbc8('0x8'));var csv=require(_0xdbc8('0x9'));var ejs=require(_0xdbc8('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdbc8('0xb'));var crypto=require('crypto');var jsforce=require(_0xdbc8('0xc'));var deskjs=require(_0xdbc8('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdbc8('0xe'));var Papa=require(_0xdbc8('0xf'));var Redis=require(_0xdbc8('0x10'));var authService=require(_0xdbc8('0x11'));var qs=require(_0xdbc8('0x12'));var as=require(_0xdbc8('0x13'));var hardwareService=require(_0xdbc8('0x14'));var logger=require(_0xdbc8('0x15'))(_0xdbc8('0x16'));var utils=require(_0xdbc8('0x17'));var config=require(_0xdbc8('0x18'));var db=require(_0xdbc8('0x19'))['db'];var jayson=require(_0xdbc8('0x1a'));var client=jayson[_0xdbc8('0x1b')][_0xdbc8('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x4a6595,_0x2ceaa6,_0x562914){if(_0x562914){var _0x42acc5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x42acc5[_0xdbc8('0x1d')](_0x2ceaa6)){return _0x4a6595;}else{throw new db[(_0xdbc8('0x1e'))][(_0xdbc8('0x1f'))](_0xdbc8('0x20'));}}else{return _0x4a6595;}}function respondWithRpcPromise(_0x21a2be,_0x1d5d7e,_0x32c678,_0x2f15c8){return new BPromise(function(_0x34ccb8,_0x24fd2a){var _0x3daa35=_0x2f15c8||client;return _0x3daa35[_0xdbc8('0x21')](_0x21a2be,_0x32c678)[_0xdbc8('0x22')](function(_0x4cdb17){logger[_0xdbc8('0x23')]('DeskConfiguration,\x20%s,\x20%s',_0x1d5d7e,'request\x20sent');logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1d5d7e,_0xdbc8('0x24'),JSON[_0xdbc8('0x25')](_0x4cdb17));if(_0x4cdb17[_0xdbc8('0x26')]){if(_0x4cdb17[_0xdbc8('0x26')][_0xdbc8('0x27')]===0x1f4){logger[_0xdbc8('0x26')](_0xdbc8('0x28'),_0x1d5d7e,_0x4cdb17[_0xdbc8('0x26')][_0xdbc8('0x29')]);return _0x24fd2a(_0x4cdb17[_0xdbc8('0x26')][_0xdbc8('0x29')]);}logger[_0xdbc8('0x26')](_0xdbc8('0x28'),_0x1d5d7e,_0x4cdb17[_0xdbc8('0x26')][_0xdbc8('0x29')]);return _0x34ccb8(_0x4cdb17[_0xdbc8('0x26')][_0xdbc8('0x29')]);}else{logger[_0xdbc8('0x23')](_0xdbc8('0x28'),_0x1d5d7e,'request\x20sent');_0x34ccb8(_0x4cdb17[_0xdbc8('0x2a')][_0xdbc8('0x29')]);}})[_0xdbc8('0x2b')](function(_0x1cd9c7){logger[_0xdbc8('0x26')](_0xdbc8('0x28'),_0x1d5d7e,_0x1cd9c7);_0x24fd2a(_0x1cd9c7);});});}function respondWithStatusCode(_0xb7c29c,_0xbc557a){_0xbc557a=_0xbc557a||0xcc;return function(_0x144d1c){if(_0x144d1c){return _0xb7c29c[_0xdbc8('0x2c')](_0xbc557a);}return _0xb7c29c[_0xdbc8('0x2d')](_0xbc557a)[_0xdbc8('0x2e')]();};}function respondWithResult(_0x26064a,_0x556d28){_0x556d28=_0x556d28||0xc8;return function(_0x23964f){if(_0x23964f){return _0x26064a[_0xdbc8('0x2d')](_0x556d28)[_0xdbc8('0x2f')](_0x23964f);}};}function respondWithFilteredResult(_0xf431c8,_0x36a8d9){return function(_0x536108){if(_0x536108){var _0x27ef0e=_0x536108[_0xdbc8('0x30')],_0x4f3bb8=_0x36a8d9['offset'],_0x137c8e=_0x36a8d9[_0xdbc8('0x31')]+_0x36a8d9[_0xdbc8('0x32')],_0x372454;if(_0x137c8e>=_0x27ef0e){_0x137c8e=_0x27ef0e;_0x372454=0xc8;}else{_0x372454=0xce;}_0xf431c8[_0xdbc8('0x2d')](_0x372454);return _0xf431c8['set'](_0xdbc8('0x33'),_0x4f3bb8+'-'+_0x137c8e+'/'+_0x27ef0e)[_0xdbc8('0x2f')](_0x536108);}return null;};}function patchUpdates(_0x2f465a){return function(_0x442e01){try{jsonpatch[_0xdbc8('0x34')](_0x442e01,_0x2f465a,!![]);}catch(_0x54d91e){return BPromise['reject'](_0x54d91e);}return _0x442e01[_0xdbc8('0x35')]();};}function saveUpdates(_0x54d5d1,_0x341af3){return function(_0x4c4eb7){if(_0x4c4eb7){return _0x4c4eb7['update'](_0x54d5d1)[_0xdbc8('0x22')](function(_0x4b605d){return _0x4b605d;});}return null;};}function removeEntity(_0x3780f8,_0x117d42){return function(_0x36f49c){if(_0x36f49c){return _0x36f49c[_0xdbc8('0x36')]()[_0xdbc8('0x22')](function(){_0x3780f8[_0xdbc8('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1edf94,_0xdf5ad4){return function(_0x52c00b){if(!_0x52c00b){_0x1edf94[_0xdbc8('0x2c')](0x194);}return _0x52c00b;};}function handleError(_0x2768a6,_0x9ade8f){_0x9ade8f=_0x9ade8f||0x1f4;return function(_0x5d0e58){logger[_0xdbc8('0x26')](_0x5d0e58[_0xdbc8('0x37')]);if(_0x5d0e58[_0xdbc8('0x38')]){delete _0x5d0e58[_0xdbc8('0x38')];}_0x2768a6[_0xdbc8('0x2d')](_0x9ade8f)['send'](_0x5d0e58);};}exports['index']=function(_0x39d913,_0x2a557e){var _0x6eb2b7={},_0x3c8647={},_0x46c391={'count':0x0,'rows':[]};var _0x545614=_[_0xdbc8('0x39')](db[_0xdbc8('0x3a')][_0xdbc8('0x3b')],function(_0x2f6b41){return{'name':_0x2f6b41['fieldName'],'type':_0x2f6b41[_0xdbc8('0x3c')]['key']};});_0x3c8647['model']=_['map'](_0x545614,'name');_0x3c8647[_0xdbc8('0x3d')]=_[_0xdbc8('0x3e')](_0x39d913['query']);_0x3c8647[_0xdbc8('0x3f')]=_[_0xdbc8('0x40')](_0x3c8647[_0xdbc8('0x41')],_0x3c8647['query']);_0x6eb2b7[_0xdbc8('0x42')]=_[_0xdbc8('0x40')](_0x3c8647[_0xdbc8('0x41')],qs[_0xdbc8('0x43')](_0x39d913[_0xdbc8('0x3d')][_0xdbc8('0x43')]));_0x6eb2b7[_0xdbc8('0x42')]=_0x6eb2b7[_0xdbc8('0x42')][_0xdbc8('0x44')]?_0x6eb2b7[_0xdbc8('0x42')]:_0x3c8647[_0xdbc8('0x41')];if(!_0x39d913['query'][_0xdbc8('0x45')](_0xdbc8('0x46'))){_0x6eb2b7['limit']=qs['limit'](_0x39d913[_0xdbc8('0x3d')][_0xdbc8('0x32')]);_0x6eb2b7[_0xdbc8('0x31')]=qs[_0xdbc8('0x31')](_0x39d913[_0xdbc8('0x3d')]['offset']);}_0x6eb2b7['order']=qs[_0xdbc8('0x47')](_0x39d913[_0xdbc8('0x3d')][_0xdbc8('0x47')]);_0x6eb2b7['where']=qs[_0xdbc8('0x3f')](_['pick'](_0x39d913[_0xdbc8('0x3d')],_0x3c8647[_0xdbc8('0x3f')]),_0x545614);if(_0x39d913[_0xdbc8('0x3d')][_0xdbc8('0x48')]){_0x6eb2b7[_0xdbc8('0x49')]=_[_0xdbc8('0x4a')](_0x6eb2b7['where'],{'$or':_['map'](_0x545614,function(_0x26b43b){if(_0x26b43b[_0xdbc8('0x3c')]!==_0xdbc8('0x4b')){var _0x39a6af={};_0x39a6af[_0x26b43b[_0xdbc8('0x38')]]={'$like':'%'+_0x39d913[_0xdbc8('0x3d')]['filter']+'%'};return _0x39a6af;}})});}_0x6eb2b7=_[_0xdbc8('0x4a')]({},_0x6eb2b7,_0x39d913['options']);var _0x308a8f={'where':_0x6eb2b7[_0xdbc8('0x49')]};return db['DeskConfiguration'][_0xdbc8('0x30')](_0x308a8f)[_0xdbc8('0x22')](function(_0x1b342a){_0x46c391['count']=_0x1b342a;if(_0x39d913[_0xdbc8('0x3d')][_0xdbc8('0x4c')]){_0x6eb2b7['include']=[{'all':!![]}];}return db[_0xdbc8('0x3a')][_0xdbc8('0x4d')](_0x6eb2b7);})[_0xdbc8('0x22')](function(_0x358887){_0x46c391[_0xdbc8('0x4e')]=_0x358887;return _0x46c391;})[_0xdbc8('0x22')](respondWithFilteredResult(_0x2a557e,_0x6eb2b7))[_0xdbc8('0x2b')](handleError(_0x2a557e,null));};exports[_0xdbc8('0x4f')]=function(_0x101cf9,_0x21fba7){var _0x426efc={'raw':![],'where':{'id':_0x101cf9[_0xdbc8('0x50')]['id']}},_0x237ef6={};_0x237ef6['model']=_['keys'](db[_0xdbc8('0x3a')]['rawAttributes']);_0x237ef6['query']=_['keys'](_0x101cf9['query']);_0x237ef6[_0xdbc8('0x3f')]=_[_0xdbc8('0x40')](_0x237ef6[_0xdbc8('0x41')],_0x237ef6['query']);_0x426efc[_0xdbc8('0x42')]=_['intersection'](_0x237ef6[_0xdbc8('0x41')],qs[_0xdbc8('0x43')](_0x101cf9[_0xdbc8('0x3d')][_0xdbc8('0x43')]));_0x426efc[_0xdbc8('0x42')]=_0x426efc[_0xdbc8('0x42')][_0xdbc8('0x44')]?_0x426efc[_0xdbc8('0x42')]:_0x237ef6[_0xdbc8('0x41')];if(_0x101cf9[_0xdbc8('0x3d')][_0xdbc8('0x4c')]){_0x426efc[_0xdbc8('0x51')]=[{'all':!![]}];}_0x426efc=_['merge']({},_0x426efc,_0x101cf9[_0xdbc8('0x52')]);return db[_0xdbc8('0x3a')][_0xdbc8('0x53')](_0x426efc)['then'](handleEntityNotFound(_0x21fba7,null))['then'](respondWithResult(_0x21fba7,null))['catch'](handleError(_0x21fba7,null));};exports[_0xdbc8('0x54')]=function(_0x20d196,_0x5dbd09){return db[_0xdbc8('0x3a')][_0xdbc8('0x54')](_0x20d196['body'],{})[_0xdbc8('0x22')](respondWithResult(_0x5dbd09,0xc9))['catch'](handleError(_0x5dbd09,null));};exports[_0xdbc8('0x55')]=function(_0x3aefc5,_0x102064){if(_0x3aefc5[_0xdbc8('0x56')]['id']){delete _0x3aefc5[_0xdbc8('0x56')]['id'];}return db[_0xdbc8('0x3a')][_0xdbc8('0x53')]({'where':{'id':_0x3aefc5[_0xdbc8('0x50')]['id']}})[_0xdbc8('0x22')](handleEntityNotFound(_0x102064,null))[_0xdbc8('0x22')](saveUpdates(_0x3aefc5[_0xdbc8('0x56')],null))['then'](respondWithResult(_0x102064,null))[_0xdbc8('0x2b')](handleError(_0x102064,null));};exports['destroy']=function(_0x4b35a7,_0x5a163f){return db[_0xdbc8('0x3a')][_0xdbc8('0x53')]({'where':{'id':_0x4b35a7[_0xdbc8('0x50')]['id']}})[_0xdbc8('0x22')](handleEntityNotFound(_0x5a163f,null))[_0xdbc8('0x22')](removeEntity(_0x5a163f,null))['catch'](handleError(_0x5a163f,null));};exports['getFields']=function(_0x3d0475,_0x176b69,_0x493f81){var _0x5168e3={};var _0x42d800={};var _0x386aac;var _0x42c3b2;return db[_0xdbc8('0x3a')][_0xdbc8('0x57')]({'where':{'id':_0x3d0475[_0xdbc8('0x50')]['id']}})[_0xdbc8('0x22')](handleEntityNotFound(_0x176b69,null))[_0xdbc8('0x22')](function(_0x3a0a4d){if(_0x3a0a4d){_0x386aac=_0x3a0a4d;_0x42d800[_0xdbc8('0x41')]=_[_0xdbc8('0x3e')](db[_0xdbc8('0x58')]['rawAttributes']);_0x42d800['query']=_[_0xdbc8('0x3e')](_0x3d0475[_0xdbc8('0x3d')]);_0x42d800[_0xdbc8('0x3f')]=_[_0xdbc8('0x40')](_0x42d800[_0xdbc8('0x41')],_0x42d800[_0xdbc8('0x3d')]);_0x5168e3[_0xdbc8('0x42')]=_[_0xdbc8('0x40')](_0x42d800[_0xdbc8('0x41')],qs['fields'](_0x3d0475['query'][_0xdbc8('0x43')]));_0x5168e3[_0xdbc8('0x42')]=_0x5168e3[_0xdbc8('0x42')]['length']?_0x5168e3['attributes']:_0x42d800['model'];_0x5168e3[_0xdbc8('0x59')]=qs[_0xdbc8('0x47')](_0x3d0475['query'][_0xdbc8('0x47')]);_0x5168e3[_0xdbc8('0x49')]=qs[_0xdbc8('0x3f')](_[_0xdbc8('0x5a')](_0x3d0475[_0xdbc8('0x3d')],_0x42d800[_0xdbc8('0x3f')]));if(_0x3d0475[_0xdbc8('0x3d')][_0xdbc8('0x48')]){_0x5168e3[_0xdbc8('0x49')]=_[_0xdbc8('0x4a')](_0x5168e3[_0xdbc8('0x49')],{'$or':_[_0xdbc8('0x39')](_0x5168e3[_0xdbc8('0x42')],function(_0x247f3c){var _0x32f8d3={};_0x32f8d3[_0x247f3c]={'$like':'%'+_0x3d0475[_0xdbc8('0x3d')][_0xdbc8('0x48')]+'%'};return _0x32f8d3;})});}_0x5168e3=_['merge']({},_0x5168e3,_0x3d0475[_0xdbc8('0x52')]);return _0x386aac['getFields'](_0x5168e3);}})[_0xdbc8('0x22')](function(_0x4333b5){if(_0x4333b5){_0x42c3b2=_0x4333b5[_0xdbc8('0x44')];if(!_0x3d0475[_0xdbc8('0x3d')][_0xdbc8('0x45')](_0xdbc8('0x46'))){_0x5168e3[_0xdbc8('0x32')]=qs[_0xdbc8('0x32')](_0x3d0475[_0xdbc8('0x3d')][_0xdbc8('0x32')]);_0x5168e3[_0xdbc8('0x31')]=qs[_0xdbc8('0x31')](_0x3d0475[_0xdbc8('0x3d')]['offset']);}return _0x386aac['getFields'](_0x5168e3);}})[_0xdbc8('0x22')](function(_0x191468){if(_0x191468){return _0x191468?{'count':_0x42c3b2,'rows':_0x191468}:null;}})[_0xdbc8('0x22')](respondWithResult(_0x176b69,null))[_0xdbc8('0x2b')](handleError(_0x176b69,null));};exports['getSubjects']=function(_0x428d7c,_0x51f142,_0x24cd4b){var _0x3b8248={};var _0x36080d={};var _0x113501;var _0x4a1b16;return db['DeskConfiguration'][_0xdbc8('0x57')]({'where':{'id':_0x428d7c['params']['id']}})[_0xdbc8('0x22')](handleEntityNotFound(_0x51f142,null))[_0xdbc8('0x22')](function(_0x2451b5){if(_0x2451b5){_0x113501=_0x2451b5;_0x36080d['model']=_[_0xdbc8('0x3e')](db[_0xdbc8('0x58')][_0xdbc8('0x3b')]);_0x36080d[_0xdbc8('0x3d')]=_[_0xdbc8('0x3e')](_0x428d7c['query']);_0x36080d[_0xdbc8('0x3f')]=_[_0xdbc8('0x40')](_0x36080d[_0xdbc8('0x41')],_0x36080d[_0xdbc8('0x3d')]);_0x3b8248[_0xdbc8('0x42')]=_[_0xdbc8('0x40')](_0x36080d[_0xdbc8('0x41')],qs[_0xdbc8('0x43')](_0x428d7c['query']['fields']));_0x3b8248[_0xdbc8('0x42')]=_0x3b8248['attributes']['length']?_0x3b8248['attributes']:_0x36080d[_0xdbc8('0x41')];_0x3b8248[_0xdbc8('0x59')]=qs[_0xdbc8('0x47')](_0x428d7c['query'][_0xdbc8('0x47')]);_0x3b8248[_0xdbc8('0x49')]=qs[_0xdbc8('0x3f')](_['pick'](_0x428d7c[_0xdbc8('0x3d')],_0x36080d['filters']));if(_0x428d7c['query']['filter']){_0x3b8248[_0xdbc8('0x49')]=_['merge'](_0x3b8248[_0xdbc8('0x49')],{'$or':_[_0xdbc8('0x39')](_0x3b8248[_0xdbc8('0x42')],function(_0x554a03){var _0x34ddf6={};_0x34ddf6[_0x554a03]={'$like':'%'+_0x428d7c['query']['filter']+'%'};return _0x34ddf6;})});}_0x3b8248=_['merge']({},_0x3b8248,_0x428d7c['options']);return _0x113501['getSubjects'](_0x3b8248);}})[_0xdbc8('0x22')](function(_0x505ff7){if(_0x505ff7){_0x4a1b16=_0x505ff7['length'];if(!_0x428d7c[_0xdbc8('0x3d')]['hasOwnProperty']('nolimit')){_0x3b8248['limit']=qs['limit'](_0x428d7c[_0xdbc8('0x3d')][_0xdbc8('0x32')]);_0x3b8248[_0xdbc8('0x31')]=qs[_0xdbc8('0x31')](_0x428d7c[_0xdbc8('0x3d')][_0xdbc8('0x31')]);}return _0x113501[_0xdbc8('0x5b')](_0x3b8248);}})[_0xdbc8('0x22')](function(_0x127728){if(_0x127728){return _0x127728?{'count':_0x4a1b16,'rows':_0x127728}:null;}})[_0xdbc8('0x22')](respondWithResult(_0x51f142,null))[_0xdbc8('0x2b')](handleError(_0x51f142,null));};exports[_0xdbc8('0x5c')]=function(_0x5f1b93,_0x159368,_0xff6b89){var _0x50578d={};var _0x3f3adb={};var _0x1d84e3;var _0x3134d2;return db[_0xdbc8('0x3a')][_0xdbc8('0x57')]({'where':{'id':_0x5f1b93[_0xdbc8('0x50')]['id']}})[_0xdbc8('0x22')](handleEntityNotFound(_0x159368,null))[_0xdbc8('0x22')](function(_0x166251){if(_0x166251){_0x1d84e3=_0x166251;_0x3f3adb[_0xdbc8('0x41')]=_[_0xdbc8('0x3e')](db[_0xdbc8('0x58')][_0xdbc8('0x3b')]);_0x3f3adb[_0xdbc8('0x3d')]=_[_0xdbc8('0x3e')](_0x5f1b93[_0xdbc8('0x3d')]);_0x3f3adb['filters']=_[_0xdbc8('0x40')](_0x3f3adb['model'],_0x3f3adb['query']);_0x50578d[_0xdbc8('0x42')]=_[_0xdbc8('0x40')](_0x3f3adb['model'],qs[_0xdbc8('0x43')](_0x5f1b93['query'][_0xdbc8('0x43')]));_0x50578d[_0xdbc8('0x42')]=_0x50578d[_0xdbc8('0x42')]['length']?_0x50578d[_0xdbc8('0x42')]:_0x3f3adb[_0xdbc8('0x41')];_0x50578d[_0xdbc8('0x59')]=qs[_0xdbc8('0x47')](_0x5f1b93[_0xdbc8('0x3d')][_0xdbc8('0x47')]);_0x50578d[_0xdbc8('0x49')]=qs['filters'](_['pick'](_0x5f1b93[_0xdbc8('0x3d')],_0x3f3adb[_0xdbc8('0x3f')]));if(_0x5f1b93[_0xdbc8('0x3d')][_0xdbc8('0x48')]){_0x50578d[_0xdbc8('0x49')]=_[_0xdbc8('0x4a')](_0x50578d['where'],{'$or':_[_0xdbc8('0x39')](_0x50578d[_0xdbc8('0x42')],function(_0x521e87){var _0x5c17ef={};_0x5c17ef[_0x521e87]={'$like':'%'+_0x5f1b93[_0xdbc8('0x3d')]['filter']+'%'};return _0x5c17ef;})});}_0x50578d=_['merge']({},_0x50578d,_0x5f1b93['options']);return _0x1d84e3[_0xdbc8('0x5c')](_0x50578d);}})['then'](function(_0x3598a7){if(_0x3598a7){_0x3134d2=_0x3598a7[_0xdbc8('0x44')];if(!_0x5f1b93[_0xdbc8('0x3d')][_0xdbc8('0x45')](_0xdbc8('0x46'))){_0x50578d['limit']=qs[_0xdbc8('0x32')](_0x5f1b93['query'][_0xdbc8('0x32')]);_0x50578d[_0xdbc8('0x31')]=qs[_0xdbc8('0x31')](_0x5f1b93['query'][_0xdbc8('0x31')]);}return _0x1d84e3[_0xdbc8('0x5c')](_0x50578d);}})[_0xdbc8('0x22')](function(_0x2a5da2){if(_0x2a5da2){return _0x2a5da2?{'count':_0x3134d2,'rows':_0x2a5da2}:null;}})[_0xdbc8('0x22')](respondWithResult(_0x159368,null))[_0xdbc8('0x2b')](handleError(_0x159368,null));};exports[_0xdbc8('0x5d')]=function(_0x473ae1,_0x4583db,_0x2fba87){var _0x33f2ee={};var _0x4d3cef={};var _0x41a758;var _0x1b705f;return db['DeskConfiguration'][_0xdbc8('0x57')]({'where':{'id':_0x473ae1['params']['id']}})[_0xdbc8('0x22')](handleEntityNotFound(_0x4583db,null))[_0xdbc8('0x22')](function(_0x5ee983){if(_0x5ee983){_0x41a758=_0x5ee983;_0x4d3cef[_0xdbc8('0x41')]=_['keys'](db[_0xdbc8('0x5e')]['rawAttributes']);_0x4d3cef['query']=_['keys'](_0x473ae1[_0xdbc8('0x3d')]);_0x4d3cef[_0xdbc8('0x3f')]=_[_0xdbc8('0x40')](_0x4d3cef[_0xdbc8('0x41')],_0x4d3cef['query']);_0x33f2ee[_0xdbc8('0x42')]=_['intersection'](_0x4d3cef[_0xdbc8('0x41')],qs['fields'](_0x473ae1[_0xdbc8('0x3d')]['fields']));_0x33f2ee[_0xdbc8('0x42')]=_0x33f2ee['attributes']['length']?_0x33f2ee[_0xdbc8('0x42')]:_0x4d3cef[_0xdbc8('0x41')];_0x33f2ee[_0xdbc8('0x59')]=qs[_0xdbc8('0x47')](_0x473ae1[_0xdbc8('0x3d')][_0xdbc8('0x47')]);_0x33f2ee[_0xdbc8('0x49')]=qs[_0xdbc8('0x3f')](_[_0xdbc8('0x5a')](_0x473ae1['query'],_0x4d3cef['filters']));if(_0x473ae1[_0xdbc8('0x3d')][_0xdbc8('0x48')]){_0x33f2ee[_0xdbc8('0x49')]=_[_0xdbc8('0x4a')](_0x33f2ee['where'],{'$or':_[_0xdbc8('0x39')](_0x33f2ee[_0xdbc8('0x42')],function(_0x44de95){var _0x1d7cf6={};_0x1d7cf6[_0x44de95]={'$like':'%'+_0x473ae1[_0xdbc8('0x3d')][_0xdbc8('0x48')]+'%'};return _0x1d7cf6;})});}_0x33f2ee=_[_0xdbc8('0x4a')]({},_0x33f2ee,_0x473ae1[_0xdbc8('0x52')]);return _0x41a758[_0xdbc8('0x5d')](_0x33f2ee);}})[_0xdbc8('0x22')](function(_0x149c42){if(_0x149c42){_0x1b705f=_0x149c42[_0xdbc8('0x44')];if(!_0x473ae1[_0xdbc8('0x3d')][_0xdbc8('0x45')](_0xdbc8('0x46'))){_0x33f2ee[_0xdbc8('0x32')]=qs[_0xdbc8('0x32')](_0x473ae1[_0xdbc8('0x3d')][_0xdbc8('0x32')]);_0x33f2ee[_0xdbc8('0x31')]=qs[_0xdbc8('0x31')](_0x473ae1[_0xdbc8('0x3d')][_0xdbc8('0x31')]);}return _0x41a758[_0xdbc8('0x5d')](_0x33f2ee);}})['then'](function(_0x5711c6){if(_0x5711c6){return _0x5711c6?{'count':_0x1b705f,'rows':_0x5711c6}:null;}})['then'](respondWithResult(_0x4583db,null))[_0xdbc8('0x2b')](handleError(_0x4583db,null));};exports[_0xdbc8('0x5f')]=function(_0x330bb7,_0x8fe5dd,_0x3667d7){if(_0x330bb7[_0xdbc8('0x56')]['id']){delete _0x330bb7['body']['id'];}return db[_0xdbc8('0x3a')][_0xdbc8('0x57')]({'where':{'id':_0x330bb7[_0xdbc8('0x50')]['id']}})[_0xdbc8('0x22')](handleEntityNotFound(_0x8fe5dd,null))['then'](function(_0x23057d){if(_0x23057d){return _0x23057d[_0xdbc8('0x5f')](_0x330bb7[_0xdbc8('0x56')][_0xdbc8('0x60')]||[]);}return null;})['then'](respondWithResult(_0x8fe5dd,null))[_0xdbc8('0x2b')](handleError(_0x8fe5dd,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 64e5624..83d22dc 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 _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 +var _0x0055=['define','DeskConfiguration','int_desk_configurations','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports'];(function(_0x2a1517,_0x4a91c1){var _0x406f24=function(_0x3ff0c2){while(--_0x3ff0c2){_0x2a1517['push'](_0x2a1517['shift']());}};_0x406f24(++_0x4a91c1);}(_0x0055,0x1bd));var _0x5005=function(_0x4ef5cd,_0x51d0ea){_0x4ef5cd=_0x4ef5cd-0x0;var _0x30a49e=_0x0055[_0x4ef5cd];return _0x30a49e;};'use strict';var _=require(_0x5005('0x0'));var util=require('util');var logger=require(_0x5005('0x1'))(_0x5005('0x2'));var moment=require('moment');var BPromise=require(_0x5005('0x3'));var rp=require(_0x5005('0x4'));var fs=require('fs');var path=require(_0x5005('0x5'));var rimraf=require(_0x5005('0x6'));var config=require(_0x5005('0x7'));var attributes=require(_0x5005('0x8'));module[_0x5005('0x9')]=function(_0x23fa94,_0x361de5){return _0x23fa94[_0x5005('0xa')](_0x5005('0xb'),attributes,{'tableName':_0x5005('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 4b68acf..490ebdd 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 _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 +var _0x8369=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x8369,0x10b));var _0x9836=function(_0x24c22c,_0xf14040){_0x24c22c=_0x24c22c-0x0;var _0x2d645b=_0x8369[_0x24c22c];return _0x2d645b;};'use strict';var _=require(_0x9836('0x0'));var util=require(_0x9836('0x1'));var moment=require(_0x9836('0x2'));var BPromise=require(_0x9836('0x3'));var rs=require(_0x9836('0x4'));var fs=require('fs');var Redis=require(_0x9836('0x5'));var db=require(_0x9836('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9836('0x7'))('rpc');var config=require(_0x9836('0x8'));var jayson=require(_0x9836('0x9'));var client=jayson['client'][_0x9836('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e4979,_0x52ae78,_0x37214e){return new BPromise(function(_0x3007ed,_0x16db95){return client[_0x9836('0xb')](_0x2e4979,_0x37214e)['then'](function(_0x30bc66){logger[_0x9836('0xc')](_0x9836('0xd'),_0x52ae78,_0x9836('0xe'));logger['debug'](_0x9836('0xf'),_0x52ae78,_0x9836('0xe'),JSON[_0x9836('0x10')](_0x30bc66));if(_0x30bc66[_0x9836('0x11')]){if(_0x30bc66[_0x9836('0x11')]['code']===0x1f4){logger[_0x9836('0x11')](_0x9836('0xd'),_0x52ae78,_0x30bc66[_0x9836('0x11')][_0x9836('0x12')]);return _0x16db95(_0x30bc66[_0x9836('0x11')][_0x9836('0x12')]);}logger[_0x9836('0x11')](_0x9836('0xd'),_0x52ae78,_0x30bc66['error'][_0x9836('0x12')]);return _0x3007ed(_0x30bc66[_0x9836('0x11')][_0x9836('0x12')]);}else{logger['info'](_0x9836('0xd'),_0x52ae78,'request\x20sent');_0x3007ed(_0x30bc66[_0x9836('0x13')]['message']);}})[_0x9836('0x14')](function(_0x22f9b5){logger[_0x9836('0x11')](_0x9836('0xd'),_0x52ae78,_0x22f9b5);_0x16db95(_0x22f9b5);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 5a5b273..63f74c3 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 _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 +var _0xc41d=['util','path','connect-timeout','express','Router','../../components/interaction/service','./intDeskField.controller','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','multer'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0xc41d,0x142));var _0xdc41=function(_0x5486cd,_0x20ada3){_0x5486cd=_0x5486cd-0x0;var _0x239dc8=_0xc41d[_0x5486cd];return _0x239dc8;};'use strict';var multer=require(_0xdc41('0x0'));var util=require(_0xdc41('0x1'));var path=require(_0xdc41('0x2'));var timeout=require(_0xdc41('0x3'));var express=require(_0xdc41('0x4'));var router=express[_0xdc41('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xdc41('0x6'));var config=require('../../config/environment');var controller=require(_0xdc41('0x7'));router[_0xdc41('0x8')]('/',auth['isAuthenticated'](),controller[_0xdc41('0x9')]);router['get'](_0xdc41('0xa'),auth[_0xdc41('0xb')](),controller['show']);router[_0xdc41('0xc')]('/',auth[_0xdc41('0xb')](),controller['create']);router[_0xdc41('0xd')](_0xdc41('0xa'),auth[_0xdc41('0xb')](),controller[_0xdc41('0xe')]);router[_0xdc41('0xf')](_0xdc41('0xa'),auth[_0xdc41('0xb')](),controller[_0xdc41('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 bebe0b4..3c6e6fa 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 _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 +var _0x0bb2=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x27856f,_0x5ab561){var _0x2dd87e=function(_0x147184){while(--_0x147184){_0x27856f['push'](_0x27856f['shift']());}};_0x2dd87e(++_0x5ab561);}(_0x0bb2,0xe2));var _0x20bb=function(_0x5d77f1,_0x31a467){_0x5d77f1=_0x5d77f1-0x0;var _0x3ba56f=_0x0bb2[_0x5d77f1];return _0x3ba56f;};'use strict';var Sequelize=require(_0x20bb('0x0'));module[_0x20bb('0x1')]={'type':{'type':Sequelize[_0x20bb('0x2')](_0x20bb('0x3'),_0x20bb('0x4'),_0x20bb('0x5'),_0x20bb('0x6')),'defaultValue':_0x20bb('0x3')},'content':{'type':Sequelize[_0x20bb('0x7')]},'key':{'type':Sequelize[_0x20bb('0x7')]},'keyType':{'type':Sequelize[_0x20bb('0x2')](_0x20bb('0x3'),_0x20bb('0x4'),_0x20bb('0x5'))},'keyContent':{'type':Sequelize[_0x20bb('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x20bb('0x7')]},'customField':{'type':Sequelize[_0x20bb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x20bb('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index ad687fc..6979cf8 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 _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 +var _0xaf9e=['find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','DeskField','rawAttributes','type','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','include','findAll','catch','show','params'];(function(_0x28f4ff,_0x5b575b){var _0x28a341=function(_0x1ccef8){while(--_0x1ccef8){_0x28f4ff['push'](_0x28f4ff['shift']());}};_0x28a341(++_0x5b575b);}(_0xaf9e,0x97));var _0xeaf9=function(_0x53f5dd,_0x3e2c6f){_0x53f5dd=_0x53f5dd-0x0;var _0x3a531e=_0xaf9e[_0x53f5dd];return _0x3a531e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xeaf9('0x0'));var rimraf=require(_0xeaf9('0x1'));var zipdir=require(_0xeaf9('0x2'));var jsonpatch=require(_0xeaf9('0x3'));var rp=require(_0xeaf9('0x4'));var moment=require(_0xeaf9('0x5'));var BPromise=require(_0xeaf9('0x6'));var Mustache=require('mustache');var util=require(_0xeaf9('0x7'));var path=require('path');var sox=require(_0xeaf9('0x8'));var csv=require(_0xeaf9('0x9'));var ejs=require(_0xeaf9('0xa'));var fs=require('fs');var _=require(_0xeaf9('0xb'));var squel=require(_0xeaf9('0xc'));var crypto=require(_0xeaf9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xeaf9('0xe'));var toCsv=require(_0xeaf9('0x9'));var querystring=require(_0xeaf9('0xf'));var Papa=require(_0xeaf9('0x10'));var Redis=require(_0xeaf9('0x11'));var authService=require(_0xeaf9('0x12'));var qs=require(_0xeaf9('0x13'));var as=require(_0xeaf9('0x14'));var hardwareService=require(_0xeaf9('0x15'));var logger=require(_0xeaf9('0x16'))(_0xeaf9('0x17'));var utils=require(_0xeaf9('0x18'));var config=require('../../config/environment');var db=require(_0xeaf9('0x19'))['db'];function respondWithStatusCode(_0x52ce7c,_0x1d998c){_0x1d998c=_0x1d998c||0xcc;return function(_0x93c31c){if(_0x93c31c){return _0x52ce7c[_0xeaf9('0x1a')](_0x1d998c);}return _0x52ce7c[_0xeaf9('0x1b')](_0x1d998c)[_0xeaf9('0x1c')]();};}function respondWithResult(_0x24e231,_0x1e396f){_0x1e396f=_0x1e396f||0xc8;return function(_0x3b5866){if(_0x3b5866){return _0x24e231[_0xeaf9('0x1b')](_0x1e396f)[_0xeaf9('0x1d')](_0x3b5866);}};}function respondWithFilteredResult(_0x292e35,_0x57dfb4){return function(_0x169932){if(_0x169932){var _0x58e35c=_0x169932['count'],_0x23c421=_0x57dfb4[_0xeaf9('0x1e')],_0x5d5b4b=_0x57dfb4[_0xeaf9('0x1e')]+_0x57dfb4[_0xeaf9('0x1f')],_0x3e631e;if(_0x5d5b4b>=_0x58e35c){_0x5d5b4b=_0x58e35c;_0x3e631e=0xc8;}else{_0x3e631e=0xce;}_0x292e35['status'](_0x3e631e);return _0x292e35[_0xeaf9('0x20')](_0xeaf9('0x21'),_0x23c421+'-'+_0x5d5b4b+'/'+_0x58e35c)[_0xeaf9('0x1d')](_0x169932);}return null;};}function patchUpdates(_0x2d0092){return function(_0x396127){try{jsonpatch['apply'](_0x396127,_0x2d0092,!![]);}catch(_0x18ace6){return BPromise[_0xeaf9('0x22')](_0x18ace6);}return _0x396127[_0xeaf9('0x23')]();};}function saveUpdates(_0x3022e8,_0x45a035){return function(_0x28a1f){if(_0x28a1f){return _0x28a1f['update'](_0x3022e8)[_0xeaf9('0x24')](function(_0x3e0fb7){return _0x3e0fb7;});}return null;};}function removeEntity(_0x2d5629,_0x35904b){return function(_0xff4abf){if(_0xff4abf){return _0xff4abf[_0xeaf9('0x25')]()['then'](function(){_0x2d5629[_0xeaf9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x368d42,_0x3bd68b){return function(_0x428c92){if(!_0x428c92){_0x368d42[_0xeaf9('0x1a')](0x194);}return _0x428c92;};}function handleError(_0x4d1666,_0x4b73ac){_0x4b73ac=_0x4b73ac||0x1f4;return function(_0x481c18){logger[_0xeaf9('0x26')](_0x481c18[_0xeaf9('0x27')]);if(_0x481c18[_0xeaf9('0x28')]){delete _0x481c18[_0xeaf9('0x28')];}_0x4d1666[_0xeaf9('0x1b')](_0x4b73ac)[_0xeaf9('0x29')](_0x481c18);};}exports[_0xeaf9('0x2a')]=function(_0x449089,_0xbc4eea){var _0x3dc8e0={},_0x42788e={},_0x11e6b8={'count':0x0,'rows':[]};var _0x564627=_[_0xeaf9('0x2b')](db[_0xeaf9('0x2c')][_0xeaf9('0x2d')],function(_0x216b14){return{'name':_0x216b14['fieldName'],'type':_0x216b14[_0xeaf9('0x2e')][_0xeaf9('0x2f')]};});_0x42788e['model']=_['map'](_0x564627,_0xeaf9('0x28'));_0x42788e[_0xeaf9('0x30')]=_[_0xeaf9('0x31')](_0x449089['query']);_0x42788e[_0xeaf9('0x32')]=_['intersection'](_0x42788e[_0xeaf9('0x33')],_0x42788e[_0xeaf9('0x30')]);_0x3dc8e0['attributes']=_[_0xeaf9('0x34')](_0x42788e[_0xeaf9('0x33')],qs[_0xeaf9('0x35')](_0x449089[_0xeaf9('0x30')][_0xeaf9('0x35')]));_0x3dc8e0[_0xeaf9('0x36')]=_0x3dc8e0[_0xeaf9('0x36')][_0xeaf9('0x37')]?_0x3dc8e0[_0xeaf9('0x36')]:_0x42788e[_0xeaf9('0x33')];if(!_0x449089[_0xeaf9('0x30')][_0xeaf9('0x38')](_0xeaf9('0x39'))){_0x3dc8e0[_0xeaf9('0x1f')]=qs[_0xeaf9('0x1f')](_0x449089[_0xeaf9('0x30')][_0xeaf9('0x1f')]);_0x3dc8e0[_0xeaf9('0x1e')]=qs[_0xeaf9('0x1e')](_0x449089[_0xeaf9('0x30')][_0xeaf9('0x1e')]);}_0x3dc8e0[_0xeaf9('0x3a')]=qs[_0xeaf9('0x3b')](_0x449089[_0xeaf9('0x30')][_0xeaf9('0x3b')]);_0x3dc8e0[_0xeaf9('0x3c')]=qs['filters'](_['pick'](_0x449089[_0xeaf9('0x30')],_0x42788e[_0xeaf9('0x32')]),_0x564627);if(_0x449089[_0xeaf9('0x30')][_0xeaf9('0x3d')]){_0x3dc8e0[_0xeaf9('0x3c')]=_[_0xeaf9('0x3e')](_0x3dc8e0['where'],{'$or':_['map'](_0x564627,function(_0x3a37f5){if(_0x3a37f5[_0xeaf9('0x2e')]!=='VIRTUAL'){var _0x155120={};_0x155120[_0x3a37f5['name']]={'$like':'%'+_0x449089['query']['filter']+'%'};return _0x155120;}})});}_0x3dc8e0=_[_0xeaf9('0x3e')]({},_0x3dc8e0,_0x449089[_0xeaf9('0x3f')]);var _0x590b67={'where':_0x3dc8e0['where']};return db[_0xeaf9('0x2c')][_0xeaf9('0x40')](_0x590b67)[_0xeaf9('0x24')](function(_0x5b0719){_0x11e6b8[_0xeaf9('0x40')]=_0x5b0719;if(_0x449089['query'][_0xeaf9('0x41')]){_0x3dc8e0[_0xeaf9('0x42')]=[{'all':!![]}];}return db[_0xeaf9('0x2c')][_0xeaf9('0x43')](_0x3dc8e0);})[_0xeaf9('0x24')](function(_0x224379){_0x11e6b8['rows']=_0x224379;return _0x11e6b8;})['then'](respondWithFilteredResult(_0xbc4eea,_0x3dc8e0))[_0xeaf9('0x44')](handleError(_0xbc4eea,null));};exports[_0xeaf9('0x45')]=function(_0xa413ef,_0x549254){var _0x1a9e03={'raw':!![],'where':{'id':_0xa413ef[_0xeaf9('0x46')]['id']}},_0x2686c1={};_0x2686c1['model']=_[_0xeaf9('0x31')](db[_0xeaf9('0x2c')][_0xeaf9('0x2d')]);_0x2686c1['query']=_[_0xeaf9('0x31')](_0xa413ef['query']);_0x2686c1[_0xeaf9('0x32')]=_['intersection'](_0x2686c1[_0xeaf9('0x33')],_0x2686c1[_0xeaf9('0x30')]);_0x1a9e03[_0xeaf9('0x36')]=_[_0xeaf9('0x34')](_0x2686c1[_0xeaf9('0x33')],qs['fields'](_0xa413ef[_0xeaf9('0x30')][_0xeaf9('0x35')]));_0x1a9e03['attributes']=_0x1a9e03[_0xeaf9('0x36')][_0xeaf9('0x37')]?_0x1a9e03[_0xeaf9('0x36')]:_0x2686c1[_0xeaf9('0x33')];if(_0xa413ef[_0xeaf9('0x30')][_0xeaf9('0x41')]){_0x1a9e03['include']=[{'all':!![]}];}_0x1a9e03=_['merge']({},_0x1a9e03,_0xa413ef['options']);return db['DeskField'][_0xeaf9('0x47')](_0x1a9e03)[_0xeaf9('0x24')](handleEntityNotFound(_0x549254,null))[_0xeaf9('0x24')](respondWithResult(_0x549254,null))[_0xeaf9('0x44')](handleError(_0x549254,null));};exports['create']=function(_0x445223,_0x51ac0d){return db[_0xeaf9('0x2c')][_0xeaf9('0x48')](_0x445223['body'],{})[_0xeaf9('0x24')](respondWithResult(_0x51ac0d,0xc9))[_0xeaf9('0x44')](handleError(_0x51ac0d,null));};exports['update']=function(_0x50b31e,_0x2e194b){if(_0x50b31e[_0xeaf9('0x49')]['id']){delete _0x50b31e[_0xeaf9('0x49')]['id'];}return db[_0xeaf9('0x2c')][_0xeaf9('0x47')]({'where':{'id':_0x50b31e['params']['id']}})[_0xeaf9('0x24')](handleEntityNotFound(_0x2e194b,null))[_0xeaf9('0x24')](saveUpdates(_0x50b31e[_0xeaf9('0x49')],null))[_0xeaf9('0x24')](respondWithResult(_0x2e194b,null))['catch'](handleError(_0x2e194b,null));};exports[_0xeaf9('0x25')]=function(_0x458dda,_0x234d2f){return db[_0xeaf9('0x2c')][_0xeaf9('0x47')]({'where':{'id':_0x458dda[_0xeaf9('0x46')]['id']}})['then'](handleEntityNotFound(_0x234d2f,null))[_0xeaf9('0x24')](removeEntity(_0x234d2f,null))[_0xeaf9('0x44')](handleError(_0x234d2f,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index ad101bf..890fefd 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 _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 +var _0x60d3=['DeskField','desk_unique_index','idField','FieldId','util','../../config/logger','moment','request-promise','path','rimraf','./intDeskField.attributes','exports','define'];(function(_0x561ffc,_0x20d0b3){var _0x2aff8b=function(_0xbe16b2){while(--_0xbe16b2){_0x561ffc['push'](_0x561ffc['shift']());}};_0x2aff8b(++_0x20d0b3);}(_0x60d3,0xd4));var _0x360d=function(_0x1b70e3,_0x3a15b1){_0x1b70e3=_0x1b70e3-0x0;var _0x1452ab=_0x60d3[_0x1b70e3];return _0x1452ab;};'use strict';var _=require('lodash');var util=require(_0x360d('0x0'));var logger=require(_0x360d('0x1'))('api');var moment=require(_0x360d('0x2'));var BPromise=require('bluebird');var rp=require(_0x360d('0x3'));var fs=require('fs');var path=require(_0x360d('0x4'));var rimraf=require(_0x360d('0x5'));var config=require('../../config/environment');var attributes=require(_0x360d('0x6'));module[_0x360d('0x7')]=function(_0x5bb72a,_0x4da21a){return _0x5bb72a[_0x360d('0x8')](_0x360d('0x9'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x360d('0xa'),'fields':[_0x360d('0xb'),_0x360d('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 0dc5d35..ae29a5d 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 _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 +var _0x6192=['../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','randomstring','ioredis'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x6192,0x13f));var _0x2619=function(_0x42319d,_0x33ecbe){_0x42319d=_0x42319d-0x0;var _0x5cc83d=_0x6192[_0x42319d];return _0x5cc83d;};'use strict';var _=require('lodash');var util=require(_0x2619('0x0'));var moment=require('moment');var BPromise=require(_0x2619('0x1'));var rs=require(_0x2619('0x2'));var fs=require('fs');var Redis=require(_0x2619('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2619('0x4'))(_0x2619('0x5'));var config=require(_0x2619('0x6'));var jayson=require(_0x2619('0x7'));var client=jayson['client'][_0x2619('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d9697,_0x11fdc7,_0x253c4b){return new BPromise(function(_0x382c8e,_0x53ccc0){return client['request'](_0x4d9697,_0x253c4b)[_0x2619('0x9')](function(_0x2a4f75){logger[_0x2619('0xa')](_0x2619('0xb'),_0x11fdc7,_0x2619('0xc'));logger['debug'](_0x2619('0xd'),_0x11fdc7,'request\x20sent',JSON[_0x2619('0xe')](_0x2a4f75));if(_0x2a4f75[_0x2619('0xf')]){if(_0x2a4f75[_0x2619('0xf')][_0x2619('0x10')]===0x1f4){logger[_0x2619('0xf')](_0x2619('0xb'),_0x11fdc7,_0x2a4f75[_0x2619('0xf')]['message']);return _0x53ccc0(_0x2a4f75['error']['message']);}logger[_0x2619('0xf')]('DeskField,\x20%s,\x20%s',_0x11fdc7,_0x2a4f75['error'][_0x2619('0x11')]);return _0x382c8e(_0x2a4f75[_0x2619('0xf')]['message']);}else{logger[_0x2619('0xa')](_0x2619('0xb'),_0x11fdc7,_0x2619('0xc'));_0x382c8e(_0x2a4f75['result'][_0x2619('0x11')]);}})[_0x2619('0x12')](function(_0x2090fd){logger[_0x2619('0xf')]('DeskField,\x20%s,\x20%s',_0x11fdc7,_0x2090fd);_0x53ccc0(_0x2090fd);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 71f4d9b..e934243 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 _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 +var _0x2092=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x2092,0x1f1));var _0x2209=function(_0x3a3eaf,_0x10b24c){_0x3a3eaf=_0x3a3eaf-0x0;var _0x187fbf=_0x2092[_0x3a3eaf];return _0x187fbf;};'use strict';var multer=require('multer');var util=require(_0x2209('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2209('0x1'));var router=express[_0x2209('0x2')]();var auth=require(_0x2209('0x3'));var interaction=require(_0x2209('0x4'));var config=require(_0x2209('0x5'));var controller=require(_0x2209('0x6'));router[_0x2209('0x7')]('/',auth[_0x2209('0x8')](),controller[_0x2209('0x9')]);router['get'](_0x2209('0xa'),auth['isAuthenticated'](),controller[_0x2209('0xb')]);router[_0x2209('0x7')](_0x2209('0xc'),auth[_0x2209('0x8')](),controller[_0x2209('0xd')]);router[_0x2209('0x7')](_0x2209('0xe'),auth[_0x2209('0x8')](),controller['getFields']);router[_0x2209('0xf')]('/',auth[_0x2209('0x8')](),controller[_0x2209('0x10')]);router[_0x2209('0xf')](_0x2209('0xc'),auth[_0x2209('0x8')](),controller[_0x2209('0x11')]);router[_0x2209('0x12')](_0x2209('0xa'),auth[_0x2209('0x8')](),controller[_0x2209('0x13')]);router[_0x2209('0x14')](_0x2209('0xa'),auth['isAuthenticated'](),controller[_0x2209('0x15')]);module[_0x2209('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index db3ec93..9e9e8e7 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 _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 +var _0x4524=['exports','STRING','sequelize'];(function(_0x17ed95,_0x23bbaf){var _0x267b68=function(_0x28ea16){while(--_0x28ea16){_0x17ed95['push'](_0x17ed95['shift']());}};_0x267b68(++_0x23bbaf);}(_0x4524,0x1a0));var _0x4452=function(_0xb33004,_0x48cab3){_0xb33004=_0xb33004-0x0;var _0x34469b=_0x4524[_0xb33004];return _0x34469b;};'use strict';var Sequelize=require(_0x4452('0x0'));module[_0x4452('0x1')]={'name':{'type':Sequelize[_0x4452('0x2')]},'username':{'type':Sequelize[_0x4452('0x2')]},'password':{'type':Sequelize[_0x4452('0x2')]},'remoteUri':{'type':Sequelize[_0x4452('0x2')]},'tenantId':{'type':Sequelize[_0x4452('0x2')]},'clientId':{'type':Sequelize[_0x4452('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x4452('0x2')]},'description':{'type':Sequelize[_0x4452('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index c6863c7..0f96fa4 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(_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 +var _0x4141=['getConfigurations','findOne','Dynamics365Configuration','pick','nolimit','addConfiguration','Subjects','channel','type','getDescriptions','Descriptions','getFields','incident','Incident','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','productidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','timezoneruleversionnumber','traversedpath','versionnumber','username','password','remoteUri','clientId','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','Wrong\x20credentials','UserLocalizedLabel','Label',')/Attributes(','OptionSet','TrueOption','true','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','debug','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','request\x20sent','result','catch','status','end','json','count','offset','limit','Content-Range','save','update','destroy','sendStatus','stack','name','send','index','map','rawAttributes','key','model','query','filters','attributes','intersection','fields','length','order','sort','where','filter','merge','Dynamics365Account','includeAll','include','findAll','show','params','keys','options','create','body','find'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x4141,0x7e));var _0x1414=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x4141[_0x19950b];return _0x3c6b41;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1414('0x0'));var rimraf=require(_0x1414('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1414('0x2'));var rp=require(_0x1414('0x3'));var moment=require(_0x1414('0x4'));var BPromise=require(_0x1414('0x5'));var Mustache=require(_0x1414('0x6'));var util=require('util');var path=require(_0x1414('0x7'));var sox=require(_0x1414('0x8'));var csv=require('to-csv');var ejs=require(_0x1414('0x9'));var fs=require('fs');var _=require(_0x1414('0xa'));var squel=require(_0x1414('0xb'));var crypto=require(_0x1414('0xc'));var jsforce=require(_0x1414('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1414('0xe'));var querystring=require(_0x1414('0xf'));var Papa=require(_0x1414('0x10'));var Redis=require(_0x1414('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1414('0x12'));var hardwareService=require(_0x1414('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x1414('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0x1414('0x15'));var jayson=require(_0x1414('0x16'));var client=jayson[_0x1414('0x17')][_0x1414('0x18')]({'port':0x232a});function checkPasswordPattern(_0x2ad24b,_0x24ee44,_0x5025c0){if(_0x5025c0){var _0x234bd9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x234bd9[_0x1414('0x19')](_0x24ee44)){return _0x2ad24b;}else{throw new db[(_0x1414('0x1a'))][(_0x1414('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 _0x2ad24b;}}function respondWithRpcPromise(_0x1a1b46,_0x1f1ace,_0x1826b5,_0x247436){return new BPromise(function(_0x3ae086,_0x125d7a){var _0x16ce20=_0x247436||client;return _0x16ce20[_0x1414('0x1c')](_0x1a1b46,_0x1826b5)[_0x1414('0x1d')](function(_0x47797f){logger[_0x1414('0x1e')]('Dynamics365Account,\x20%s,\x20%s',_0x1f1ace,'request\x20sent');logger[_0x1414('0x1f')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x1f1ace,'request\x20sent',JSON[_0x1414('0x20')](_0x47797f));if(_0x47797f[_0x1414('0x21')]){if(_0x47797f[_0x1414('0x21')][_0x1414('0x22')]===0x1f4){logger['error'](_0x1414('0x23'),_0x1f1ace,_0x47797f[_0x1414('0x21')][_0x1414('0x24')]);return _0x125d7a(_0x47797f['error'][_0x1414('0x24')]);}logger[_0x1414('0x21')](_0x1414('0x23'),_0x1f1ace,_0x47797f[_0x1414('0x21')][_0x1414('0x24')]);return _0x3ae086(_0x47797f[_0x1414('0x21')][_0x1414('0x24')]);}else{logger[_0x1414('0x1e')](_0x1414('0x23'),_0x1f1ace,_0x1414('0x25'));_0x3ae086(_0x47797f[_0x1414('0x26')]['message']);}})[_0x1414('0x27')](function(_0x4c7152){logger[_0x1414('0x21')](_0x1414('0x23'),_0x1f1ace,_0x4c7152);_0x125d7a(_0x4c7152);});});}function respondWithStatusCode(_0x240a4a,_0x1a9a43){_0x1a9a43=_0x1a9a43||0xcc;return function(_0x19097b){if(_0x19097b){return _0x240a4a['sendStatus'](_0x1a9a43);}return _0x240a4a[_0x1414('0x28')](_0x1a9a43)[_0x1414('0x29')]();};}function respondWithResult(_0xf6d19e,_0x30fa13){_0x30fa13=_0x30fa13||0xc8;return function(_0x5caad4){if(_0x5caad4){return _0xf6d19e[_0x1414('0x28')](_0x30fa13)[_0x1414('0x2a')](_0x5caad4);}};}function respondWithFilteredResult(_0x2038bb,_0x1f997d){return function(_0x15e5a9){if(_0x15e5a9){var _0xabebbe=_0x15e5a9[_0x1414('0x2b')],_0x1ffaba=_0x1f997d[_0x1414('0x2c')],_0x27ac38=_0x1f997d[_0x1414('0x2c')]+_0x1f997d[_0x1414('0x2d')],_0x3ae98d;if(_0x27ac38>=_0xabebbe){_0x27ac38=_0xabebbe;_0x3ae98d=0xc8;}else{_0x3ae98d=0xce;}_0x2038bb[_0x1414('0x28')](_0x3ae98d);return _0x2038bb['set'](_0x1414('0x2e'),_0x1ffaba+'-'+_0x27ac38+'/'+_0xabebbe)[_0x1414('0x2a')](_0x15e5a9);}return null;};}function patchUpdates(_0x46e96f){return function(_0x66c7a5){try{jsonpatch['apply'](_0x66c7a5,_0x46e96f,!![]);}catch(_0x446e59){return BPromise['reject'](_0x446e59);}return _0x66c7a5[_0x1414('0x2f')]();};}function saveUpdates(_0x484895,_0x54d950){return function(_0x22016e){if(_0x22016e){return _0x22016e[_0x1414('0x30')](_0x484895)[_0x1414('0x1d')](function(_0x5f2962){return _0x5f2962;});}return null;};}function removeEntity(_0x3db0b1,_0x316e57){return function(_0x544ea2){if(_0x544ea2){return _0x544ea2[_0x1414('0x31')]()[_0x1414('0x1d')](function(){_0x3db0b1[_0x1414('0x28')](0xcc)[_0x1414('0x29')]();});}};}function handleEntityNotFound(_0x77b538,_0x1ddf58){return function(_0x186a5b){if(!_0x186a5b){_0x77b538[_0x1414('0x32')](0x194);}return _0x186a5b;};}function handleError(_0x2cb1a9,_0x1a4c1b){_0x1a4c1b=_0x1a4c1b||0x1f4;return function(_0x497a16){logger['error'](_0x497a16[_0x1414('0x33')]);if(_0x497a16[_0x1414('0x34')]){delete _0x497a16[_0x1414('0x34')];}_0x2cb1a9[_0x1414('0x28')](_0x1a4c1b)[_0x1414('0x35')](_0x497a16);};}exports[_0x1414('0x36')]=function(_0x324e2e,_0x4ec5dc){var _0x7a8119={},_0x2be805={},_0x3b7168={'count':0x0,'rows':[]};var _0x10e6e6=_[_0x1414('0x37')](db['Dynamics365Account'][_0x1414('0x38')],function(_0x5d33d7){return{'name':_0x5d33d7['fieldName'],'type':_0x5d33d7['type'][_0x1414('0x39')]};});_0x2be805[_0x1414('0x3a')]=_[_0x1414('0x37')](_0x10e6e6,_0x1414('0x34'));_0x2be805[_0x1414('0x3b')]=_['keys'](_0x324e2e[_0x1414('0x3b')]);_0x2be805[_0x1414('0x3c')]=_['intersection'](_0x2be805[_0x1414('0x3a')],_0x2be805[_0x1414('0x3b')]);_0x7a8119[_0x1414('0x3d')]=_[_0x1414('0x3e')](_0x2be805[_0x1414('0x3a')],qs['fields'](_0x324e2e[_0x1414('0x3b')][_0x1414('0x3f')]));_0x7a8119[_0x1414('0x3d')]=_0x7a8119[_0x1414('0x3d')][_0x1414('0x40')]?_0x7a8119[_0x1414('0x3d')]:_0x2be805['model'];if(!_0x324e2e[_0x1414('0x3b')]['hasOwnProperty']('nolimit')){_0x7a8119[_0x1414('0x2d')]=qs[_0x1414('0x2d')](_0x324e2e[_0x1414('0x3b')][_0x1414('0x2d')]);_0x7a8119[_0x1414('0x2c')]=qs[_0x1414('0x2c')](_0x324e2e[_0x1414('0x3b')][_0x1414('0x2c')]);}_0x7a8119[_0x1414('0x41')]=qs[_0x1414('0x42')](_0x324e2e[_0x1414('0x3b')][_0x1414('0x42')]);_0x7a8119[_0x1414('0x43')]=qs[_0x1414('0x3c')](_['pick'](_0x324e2e[_0x1414('0x3b')],_0x2be805[_0x1414('0x3c')]),_0x10e6e6);if(_0x324e2e[_0x1414('0x3b')][_0x1414('0x44')]){_0x7a8119[_0x1414('0x43')]=_[_0x1414('0x45')](_0x7a8119[_0x1414('0x43')],{'$or':_[_0x1414('0x37')](_0x10e6e6,function(_0x12d88e){if(_0x12d88e['type']!=='VIRTUAL'){var _0x4613dc={};_0x4613dc[_0x12d88e[_0x1414('0x34')]]={'$like':'%'+_0x324e2e[_0x1414('0x3b')][_0x1414('0x44')]+'%'};return _0x4613dc;}})});}_0x7a8119=_['merge']({},_0x7a8119,_0x324e2e['options']);var _0x24f615={'where':_0x7a8119[_0x1414('0x43')]};return db[_0x1414('0x46')][_0x1414('0x2b')](_0x24f615)[_0x1414('0x1d')](function(_0x2da220){_0x3b7168[_0x1414('0x2b')]=_0x2da220;if(_0x324e2e[_0x1414('0x3b')][_0x1414('0x47')]){_0x7a8119[_0x1414('0x48')]=[{'all':!![]}];}return db[_0x1414('0x46')][_0x1414('0x49')](_0x7a8119);})['then'](function(_0x449faf){_0x3b7168['rows']=_0x449faf;return _0x3b7168;})[_0x1414('0x1d')](respondWithFilteredResult(_0x4ec5dc,_0x7a8119))['catch'](handleError(_0x4ec5dc,null));};exports[_0x1414('0x4a')]=function(_0x4a2f79,_0x15466e){var _0x3c1be3={'raw':![],'where':{'id':_0x4a2f79[_0x1414('0x4b')]['id']}},_0x3fe4c5={};_0x3fe4c5['model']=_[_0x1414('0x4c')](db[_0x1414('0x46')][_0x1414('0x38')]);_0x3fe4c5[_0x1414('0x3b')]=_[_0x1414('0x4c')](_0x4a2f79[_0x1414('0x3b')]);_0x3fe4c5[_0x1414('0x3c')]=_['intersection'](_0x3fe4c5[_0x1414('0x3a')],_0x3fe4c5[_0x1414('0x3b')]);_0x3c1be3['attributes']=_[_0x1414('0x3e')](_0x3fe4c5[_0x1414('0x3a')],qs[_0x1414('0x3f')](_0x4a2f79[_0x1414('0x3b')][_0x1414('0x3f')]));_0x3c1be3[_0x1414('0x3d')]=_0x3c1be3[_0x1414('0x3d')][_0x1414('0x40')]?_0x3c1be3[_0x1414('0x3d')]:_0x3fe4c5['model'];if(_0x4a2f79[_0x1414('0x3b')][_0x1414('0x47')]){_0x3c1be3[_0x1414('0x48')]=[{'all':!![]}];}_0x3c1be3=_[_0x1414('0x45')]({},_0x3c1be3,_0x4a2f79[_0x1414('0x4d')]);return db[_0x1414('0x46')]['find'](_0x3c1be3)[_0x1414('0x1d')](handleEntityNotFound(_0x15466e,null))[_0x1414('0x1d')](respondWithResult(_0x15466e,null))[_0x1414('0x27')](handleError(_0x15466e,null));};exports[_0x1414('0x4e')]=function(_0x6fa3be,_0x4f6079){return db['Dynamics365Account']['create'](_0x6fa3be[_0x1414('0x4f')],{})[_0x1414('0x1d')](respondWithResult(_0x4f6079,0xc9))[_0x1414('0x27')](handleError(_0x4f6079,null));};exports[_0x1414('0x30')]=function(_0xf6ebd3,_0x78480){if(_0xf6ebd3[_0x1414('0x4f')]['id']){delete _0xf6ebd3[_0x1414('0x4f')]['id'];}return db['Dynamics365Account'][_0x1414('0x50')]({'where':{'id':_0xf6ebd3[_0x1414('0x4b')]['id']}})[_0x1414('0x1d')](handleEntityNotFound(_0x78480,null))[_0x1414('0x1d')](saveUpdates(_0xf6ebd3[_0x1414('0x4f')],null))[_0x1414('0x1d')](respondWithResult(_0x78480,null))[_0x1414('0x27')](handleError(_0x78480,null));};exports['destroy']=function(_0x5104fd,_0x426f5a){return db['Dynamics365Account'][_0x1414('0x50')]({'where':{'id':_0x5104fd['params']['id']}})[_0x1414('0x1d')](handleEntityNotFound(_0x426f5a,null))['then'](removeEntity(_0x426f5a,null))[_0x1414('0x27')](handleError(_0x426f5a,null));};exports[_0x1414('0x51')]=function(_0x5130c1,_0x27f751,_0x361155){var _0x2d7ce4={};var _0x2da5f8={};var _0x373b1b;var _0x43a25e;return db[_0x1414('0x46')][_0x1414('0x52')]({'where':{'id':_0x5130c1[_0x1414('0x4b')]['id']}})[_0x1414('0x1d')](handleEntityNotFound(_0x27f751,null))[_0x1414('0x1d')](function(_0x31495e){if(_0x31495e){_0x373b1b=_0x31495e;_0x2da5f8['model']=_[_0x1414('0x4c')](db[_0x1414('0x53')][_0x1414('0x38')]);_0x2da5f8[_0x1414('0x3b')]=_[_0x1414('0x4c')](_0x5130c1[_0x1414('0x3b')]);_0x2da5f8[_0x1414('0x3c')]=_[_0x1414('0x3e')](_0x2da5f8[_0x1414('0x3a')],_0x2da5f8[_0x1414('0x3b')]);_0x2d7ce4[_0x1414('0x3d')]=_[_0x1414('0x3e')](_0x2da5f8[_0x1414('0x3a')],qs[_0x1414('0x3f')](_0x5130c1[_0x1414('0x3b')][_0x1414('0x3f')]));_0x2d7ce4[_0x1414('0x3d')]=_0x2d7ce4[_0x1414('0x3d')][_0x1414('0x40')]?_0x2d7ce4[_0x1414('0x3d')]:_0x2da5f8[_0x1414('0x3a')];_0x2d7ce4[_0x1414('0x41')]=qs['sort'](_0x5130c1[_0x1414('0x3b')][_0x1414('0x42')]);_0x2d7ce4[_0x1414('0x43')]=qs[_0x1414('0x3c')](_[_0x1414('0x54')](_0x5130c1[_0x1414('0x3b')],_0x2da5f8['filters']));if(_0x5130c1[_0x1414('0x3b')][_0x1414('0x44')]){_0x2d7ce4[_0x1414('0x43')]=_[_0x1414('0x45')](_0x2d7ce4[_0x1414('0x43')],{'$or':_[_0x1414('0x37')](_0x2d7ce4[_0x1414('0x3d')],function(_0x544896){var _0x5c28b9={};_0x5c28b9[_0x544896]={'$like':'%'+_0x5130c1[_0x1414('0x3b')][_0x1414('0x44')]+'%'};return _0x5c28b9;})});}_0x2d7ce4=_[_0x1414('0x45')]({},_0x2d7ce4,_0x5130c1[_0x1414('0x4d')]);return _0x373b1b[_0x1414('0x51')](_0x2d7ce4);}})[_0x1414('0x1d')](function(_0x55a410){if(_0x55a410){_0x43a25e=_0x55a410['length'];if(!_0x5130c1['query']['hasOwnProperty'](_0x1414('0x55'))){_0x2d7ce4[_0x1414('0x2d')]=qs[_0x1414('0x2d')](_0x5130c1[_0x1414('0x3b')]['limit']);_0x2d7ce4[_0x1414('0x2c')]=qs['offset'](_0x5130c1[_0x1414('0x3b')][_0x1414('0x2c')]);}return _0x373b1b[_0x1414('0x51')](_0x2d7ce4);}})[_0x1414('0x1d')](function(_0x16c6d0){if(_0x16c6d0){return _0x16c6d0?{'count':_0x43a25e,'rows':_0x16c6d0}:null;}})[_0x1414('0x1d')](respondWithResult(_0x27f751,null))[_0x1414('0x27')](handleError(_0x27f751,null));};exports[_0x1414('0x56')]=function(_0x2dcb92,_0x4bd302,_0x4ef126){if(_0x2dcb92[_0x1414('0x4f')]['id']){delete _0x2dcb92['body']['id'];}return db[_0x1414('0x46')][_0x1414('0x52')]({'where':{'id':_0x2dcb92[_0x1414('0x4b')]['id']}})[_0x1414('0x1d')](handleEntityNotFound(_0x4bd302,null))[_0x1414('0x1d')](function(_0xb5e16f){if(_0xb5e16f){_0x2dcb92[_0x1414('0x4f')]['AccountId']=_0xb5e16f['id'];_0x2dcb92[_0x1414('0x4f')][_0x1414('0x57')]=integrations['getSubjects'](_0x2dcb92[_0x1414('0x4f')][_0x1414('0x58')],_0x2dcb92[_0x1414('0x4f')][_0x1414('0x59')]);_0x2dcb92[_0x1414('0x4f')]['Descriptions']=integrations[_0x1414('0x5a')](_0x2dcb92[_0x1414('0x4f')]['channel'],_0x2dcb92[_0x1414('0x4f')][_0x1414('0x59')]);return db[_0x1414('0x53')][_0x1414('0x4e')](_0x2dcb92[_0x1414('0x4f')],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':_0x1414('0x5b')}]});}return null;})['then'](respondWithResult(_0x4bd302,null))[_0x1414('0x27')](handleError(_0x4bd302,null));};exports[_0x1414('0x5c')]=function(_0x4fe9bc,_0x1e1034,_0x2df171){var _0x1ee54a=_0x4fe9bc['query']['ticketType'];var _0x2d3a66=_0x1ee54a===_0x1414('0x5d')?_0x1414('0x5e'):'PhoneCall';var _0xb0b131='';var _0x16da10='';var _0x433a69='';var _0x5d1e6d='';var _0xdde799='';var _0x37d8df='';var _0x20bf94='';var _0x212ef6='';var _0x4bd379=[_0x1414('0x5f'),_0x1414('0x60'),_0x1414('0x61'),_0x1414('0x62'),_0x1414('0x63'),_0x1414('0x64'),_0x1414('0x65'),_0x1414('0x66'),_0x1414('0x67'),'phonecall_activity_parties'];var _0x2a592b=['accountidname','accountidyominame',_0x1414('0x68'),_0x1414('0x69'),_0x1414('0x6a'),_0x1414('0x6b'),_0x1414('0x6c'),'contractidname',_0x1414('0x6d'),_0x1414('0x6e'),'createdbyname',_0x1414('0x6f'),'createdon','createdonbehalfbyname',_0x1414('0x70'),_0x1414('0x71'),'customeridtype',_0x1414('0x72'),_0x1414('0x73'),_0x1414('0x74'),_0x1414('0x75'),_0x1414('0x76'),_0x1414('0x77'),_0x1414('0x78'),_0x1414('0x79'),_0x1414('0x7a'),_0x1414('0x7b'),_0x1414('0x7c'),_0x1414('0x7d'),_0x1414('0x7e'),_0x1414('0x7f'),_0x1414('0x80'),_0x1414('0x81'),_0x1414('0x82'),_0x1414('0x83'),_0x1414('0x84'),'modifiedonbehalfbyname',_0x1414('0x85'),_0x1414('0x86'),_0x1414('0x87'),_0x1414('0x88'),_0x1414('0x89'),_0x1414('0x8a'),_0x1414('0x8b'),_0x1414('0x8c'),_0x1414('0x8d'),_0x1414('0x8e'),'primarycontactidname','primarycontactidyominame','prioritycodename',_0x1414('0x8f'),'productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname',_0x1414('0x90'),_0x1414('0x91'),_0x1414('0x92'),_0x1414('0x93'),_0x1414('0x94'),_0x1414('0x95'),_0x1414('0x96'),_0x1414('0x97'),'ticketnumber',_0x1414('0x98'),'transactioncurrencyidname',_0x1414('0x99'),'utcconversiontimezonecode',_0x1414('0x9a')];var _0x3f6c80=_0x4bd379['concat'](_0x2a592b);return db['Dynamics365Account'][_0x1414('0x52')]({'where':{'id':_0x4fe9bc[_0x1414('0x4b')]['id']},'attributes':['id',_0x1414('0x9b'),_0x1414('0x9c'),_0x1414('0x9d'),'tenantId',_0x1414('0x9e'),_0x1414('0x9f')]})['then'](handleEntityNotFound(_0x1e1034,null))[_0x1414('0x1d')](function(_0x5928bd){if(_0x5928bd){_0x212ef6=_0x5928bd['remoteUri'];var _0x24c5d0=_0x212ef6[_0x1414('0xa0')](-0x1);if(_0x24c5d0==='/'){_0x212ef6=_0x212ef6[_0x1414('0xa1')](0x0,_0x212ef6[_0x1414('0xa2')](_0x24c5d0));}_0x20bf94=util[_0x1414('0xa3')](_0x1414('0xa4'),_0x212ef6);var _0x5f250e={'method':_0x1414('0xa5'),'uri':_0x1414('0xa6')+_0x5928bd['tenantId']+_0x1414('0xa7'),'form':{'client_id':_0x5928bd[_0x1414('0x9e')],'resource':_0x212ef6,'username':_0x5928bd[_0x1414('0x9b')],'password':_0x5928bd[_0x1414('0x9c')],'grant_type':_0x1414('0x9c'),'client_secret':_0x5928bd[_0x1414('0x9f')]},'json':!![]};return rp(_0x5f250e);}})[_0x1414('0x1d')](function(_0x5b4085){_0x37d8df=_0x5b4085[_0x1414('0xa8')];var _0x3d396d={'method':'GET','uri':encodeURI(_0x20bf94+_0x1414('0xa9')+_0x2d3a66+'\x27'),'headers':{'Authorization':_0x1414('0xaa')+_0x37d8df,'If-None-Match':null,'OData-Version':_0x1414('0xab')},'json':!![]};return rp(_0x3d396d);})[_0x1414('0x1d')](function(_0x482ff8){var _0x34afd4=_0x482ff8['value'][0x0];var _0x5f19aa=_0x34afd4[_0x1414('0xac')];var _0x3aa9de={'method':_0x1414('0xad'),'uri':_0x20bf94+_0x1414('0xae')+_0x5f19aa+_0x1414('0xaf'),'headers':{'Authorization':_0x1414('0xaa')+_0x37d8df,'If-None-Match':null,'OData-Version':_0x1414('0xab')},'json':!![]};return rp(_0x3aa9de);})[_0x1414('0x1d')](function(_0x3cb23e){_0xb0b131=_0x3cb23e;_0x16da10=_0xb0b131[_0x1414('0xb0')];_0x16da10=_['remove'](_0x16da10,function(_0x5560d4){return!_0x3f6c80[_0x1414('0xb1')](_0x5560d4[_0x1414('0xb2')]);});var _0x4aaacb=[];var _0x42540c=[];_0x16da10[_0x1414('0xb3')](function(_0x53eb09){if(_0x53eb09[_0x1414('0xb4')]){var _0x5e0ea8=_0x53eb09[_0x1414('0xb4')]['substring'](_0x53eb09[_0x1414('0xb4')]['lastIndexOf']('.')+0x1);if(_0x5e0ea8===_0x1414('0xb5')){_0x4aaacb[_0x1414('0xb6')](getSelectList(_0x20bf94,_0x1ee54a,_0x42540c,_0xb0b131[_0x1414('0xac')],_0x53eb09[_0x1414('0xac')],_0x37d8df));}}});return Promise[_0x1414('0xb7')](_0x4aaacb);})[_0x1414('0x1d')](function(_0x35fdb3){_0x433a69=_0x35fdb3[0x0];var _0x6c3c48=[];var _0xd873a4=[];_0x16da10[_0x1414('0xb3')](function(_0x10f336){if(!_[_0x1414('0xb8')](_0x10f336['@odata.type'])){var _0x4efbc0=_0x10f336[_0x1414('0xb4')][_0x1414('0xa1')](_0x10f336[_0x1414('0xb4')][_0x1414('0xa2')]('.')+0x1);if(_0x4efbc0===_0x1414('0xb9')){_0x6c3c48[_0x1414('0xb6')](getBooleanList(_0x20bf94,_0x1ee54a,_0xd873a4,_0xb0b131['MetadataId'],_0x10f336[_0x1414('0xac')],_0x37d8df));}}});return Promise[_0x1414('0xb7')](_0x6c3c48);})[_0x1414('0x1d')](function(_0x532c9d){_0x5d1e6d=_0x532c9d[0x0];var _0x2207e8=[];var _0xc7a67f=[];_0x16da10[_0x1414('0xb3')](function(_0xa3d528){if(_0xa3d528[_0x1414('0xb4')]){var _0x3965d6=_0xa3d528[_0x1414('0xb4')][_0x1414('0xa1')](_0xa3d528[_0x1414('0xb4')]['lastIndexOf']('.')+0x1);if(_0x3965d6===_0x1414('0xba')||_0x3965d6===_0x1414('0xbb')||_0x3965d6==='BigIntAttributeMetadata'||_0x3965d6===_0x1414('0xbc')||_0x3965d6===_0x1414('0xbd')||_0x3965d6===_0x1414('0xbe')||_0x3965d6===_0x1414('0xbf')||_0x3965d6===_0x1414('0xc0')||_0x3965d6===_0x1414('0xc1')||_0x3965d6===_0x1414('0xc2')){_0x2207e8['push'](getInputList(_0x20bf94,_0x1ee54a,_0x3965d6,_0xc7a67f,_0xb0b131[_0x1414('0xac')],_0xa3d528[_0x1414('0xac')],_0x37d8df));}}});return Promise[_0x1414('0xb7')](_0x2207e8);})[_0x1414('0x1d')](function(_0x141717){_0xdde799=_0x141717[0x0];var _0x556611=_0x433a69[_0x1414('0xc3')](_0x5d1e6d)[_0x1414('0xc3')](_0xdde799);var _0x104522={'count':_0x556611[_0x1414('0x40')],'rows':_0x556611};return _0x104522;})[_0x1414('0x1d')](respondWithResult(_0x1e1034,null))[_0x1414('0x27')](function(_0x1096a0){var _0x4dadd2=_0x4fe9bc[_0x1414('0x3b')][_0x1414('0x19')]?0x1f4:_0x1096a0['statusCode']||0x1f4;logger['error'](_0x1096a0[_0x1414('0x33')]);delete _0x1096a0[_0x1414('0x34')];if(_0x4dadd2===0x191){_0x4dadd2=0x190;}_0x1e1034[_0x1414('0x28')](_0x4dadd2)[_0x1414('0x35')](_0x4fe9bc['query']['test']?{'message':_0x1414('0xc4'),'statusCode':_0x1096a0['statusCode']}:_0x1096a0);});};function getSelectList(_0x3e10e6,_0x580a,_0x84935,_0x5453f4,_0x26ea88,_0xa48524){var _0x12da7c={'method':_0x1414('0xad'),'uri':_0x3e10e6+'EntityDefinitions('+_0x5453f4+')/Attributes('+_0x26ea88+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x1414('0xaa')+_0xa48524,'If-None-Match':null,'OData-Version':_0x1414('0xab')},'json':!![]};return rp(_0x12da7c)[_0x1414('0x1d')](function(_0x4cfd8a){var _0x29c986=[];var _0x5466a7=_0x4cfd8a['OptionSet']['Options'];_0x5466a7[_0x1414('0xb3')](function(_0x4538a3){_0x29c986[_0x1414('0xb6')]({'name':_0x4538a3['Label'][_0x1414('0xc5')][_0x1414('0xc6')],'value':String(_0x4538a3['Value'])});});var _0x22e433={'id':_0x580a+'_'+_0x4cfd8a[_0x1414('0xb2')],'name':_0x4cfd8a['DisplayName'][_0x1414('0xc5')][_0x1414('0xc6')],'custom':![],'options':_0x29c986};_0x84935[_0x1414('0xb6')](_0x22e433);return _0x84935;});}function getBooleanList(_0x3c09b6,_0x2ee9b8,_0x19c7ec,_0x11d60b,_0x56f1b6,_0x566549){var _0x4c3124={'method':'GET','uri':_0x3c09b6+_0x1414('0xae')+_0x11d60b+_0x1414('0xc7')+_0x56f1b6+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x1414('0xaa')+_0x566549,'If-None-Match':null,'OData-Version':_0x1414('0xab')},'json':!![]};return rp(_0x4c3124)['then'](function(_0xcdf695){var _0x51fb18=[];_0x51fb18[_0x1414('0xb6')]({'name':_0xcdf695[_0x1414('0xc8')][_0x1414('0xc9')][_0x1414('0xc6')][_0x1414('0xc5')]['Label'],'value':_0x1414('0xca')},{'name':_0xcdf695[_0x1414('0xc8')]['FalseOption'][_0x1414('0xc6')][_0x1414('0xc5')][_0x1414('0xc6')],'value':_0x1414('0xcb')});var _0x4487dd={'id':_0x2ee9b8+'_'+_0xcdf695[_0x1414('0xb2')],'name':_0xcdf695[_0x1414('0xcc')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x51fb18};_0x19c7ec[_0x1414('0xb6')](_0x4487dd);return _0x19c7ec;});}function getInputList(_0x2d873a,_0x38aee8,_0x36cf32,_0x120daf,_0x12ad68,_0x20006b,_0x183bfe){var _0x4b3fab={'method':_0x1414('0xad'),'uri':_0x2d873a+_0x1414('0xae')+_0x12ad68+_0x1414('0xc7')+_0x20006b+_0x1414('0xcd')+_0x36cf32+_0x1414('0xce'),'headers':{'Authorization':_0x1414('0xaa')+_0x183bfe,'If-None-Match':null,'OData-Version':_0x1414('0xab')},'json':!![]};return rp(_0x4b3fab)['then'](function(_0x44bcb3){var _0x9c3f2b={'id':_0x38aee8+'_'+_0x44bcb3[_0x1414('0xb2')],'name':_0x44bcb3[_0x1414('0xcc')][_0x1414('0xc5')]?_0x44bcb3[_0x1414('0xcc')][_0x1414('0xc5')]['Label']:_0x44bcb3[_0x1414('0xb2')],'custom':![],'options':[]};_0x120daf[_0x1414('0xb6')](_0x9c3f2b);return _0x120daf;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 5557b8d..47ac9ad 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 _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 +var _0x71c3=['define','int_dynamics365_accounts','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports'];(function(_0x8dc6c,_0x13ebb3){var _0x16a7aa=function(_0x352ecd){while(--_0x352ecd){_0x8dc6c['push'](_0x8dc6c['shift']());}};_0x16a7aa(++_0x13ebb3);}(_0x71c3,0x146));var _0x371c=function(_0x593822,_0x43d0b){_0x593822=_0x593822-0x0;var _0x58c413=_0x71c3[_0x593822];return _0x58c413;};'use strict';var _=require('lodash');var util=require(_0x371c('0x0'));var logger=require(_0x371c('0x1'))(_0x371c('0x2'));var moment=require('moment');var BPromise=require(_0x371c('0x3'));var rp=require(_0x371c('0x4'));var fs=require('fs');var path=require(_0x371c('0x5'));var rimraf=require('rimraf');var config=require(_0x371c('0x6'));var attributes=require(_0x371c('0x7'));var integrations=require(_0x371c('0x8'));module[_0x371c('0x9')]=function(_0x5c5ab8,_0x12b001){return _0x5c5ab8[_0x371c('0xa')]('Dynamics365Account',attributes,{'tableName':_0x371c('0xb'),'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 f0adc0d..bb2df72 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 _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 +var _0xc9ab=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','then','info','GetDynamics365Account','stringify','ShowDynamics365Account','find','lodash','util','moment'];(function(_0x2d92cf,_0x434a92){var _0x592841=function(_0x4e5c22){while(--_0x4e5c22){_0x2d92cf['push'](_0x2d92cf['shift']());}};_0x592841(++_0x434a92);}(_0xc9ab,0x125));var _0xbc9a=function(_0x4b3b26,_0x44a22a){_0x4b3b26=_0x4b3b26-0x0;var _0x464112=_0xc9ab[_0x4b3b26];return _0x464112;};'use strict';var _=require(_0xbc9a('0x0'));var util=require(_0xbc9a('0x1'));var moment=require(_0xbc9a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc9a('0x3'))['db'];var utils=require(_0xbc9a('0x4'));var logger=require(_0xbc9a('0x5'))(_0xbc9a('0x6'));var config=require(_0xbc9a('0x7'));var jayson=require(_0xbc9a('0x8'));var client=jayson[_0xbc9a('0x9')][_0xbc9a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x477055,_0x3baf56,_0x26f5f4){return new BPromise(function(_0x14c87a,_0x18beac){return client[_0xbc9a('0xb')](_0x477055,_0x26f5f4)['then'](function(_0x54caf0){logger['info'](_0xbc9a('0xc'),_0x3baf56,'request\x20sent');logger[_0xbc9a('0xd')](_0xbc9a('0xe'),_0x3baf56,'request\x20sent',JSON['stringify'](_0x54caf0));if(_0x54caf0['error']){if(_0x54caf0[_0xbc9a('0xf')][_0xbc9a('0x10')]===0x1f4){logger['error'](_0xbc9a('0xc'),_0x3baf56,_0x54caf0[_0xbc9a('0xf')][_0xbc9a('0x11')]);return _0x18beac(_0x54caf0[_0xbc9a('0xf')][_0xbc9a('0x11')]);}logger[_0xbc9a('0xf')](_0xbc9a('0xc'),_0x3baf56,_0x54caf0['error'][_0xbc9a('0x11')]);return _0x14c87a(_0x54caf0[_0xbc9a('0xf')][_0xbc9a('0x11')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x3baf56,_0xbc9a('0x12'));_0x14c87a(_0x54caf0[_0xbc9a('0x13')][_0xbc9a('0x11')]);}})[_0xbc9a('0x14')](function(_0x35dacf){logger[_0xbc9a('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x3baf56,_0x35dacf);_0x18beac(_0x35dacf);});});}exports['GetDynamics365Account']=function(_0x1f11ca){var _0x3cc279=this;return new Promise(function(_0x5b44fe,_0xf036b0){return db[_0xbc9a('0x15')][_0xbc9a('0x16')]({'raw':_0x1f11ca['options']?_0x1f11ca[_0xbc9a('0x17')][_0xbc9a('0x18')]===undefined?!![]:![]:!![],'where':_0x1f11ca[_0xbc9a('0x17')]?_0x1f11ca[_0xbc9a('0x17')][_0xbc9a('0x19')]||null:null,'attributes':_0x1f11ca[_0xbc9a('0x17')]?_0x1f11ca[_0xbc9a('0x17')][_0xbc9a('0x1a')]||null:null,'limit':_0x1f11ca[_0xbc9a('0x17')]?_0x1f11ca[_0xbc9a('0x17')][_0xbc9a('0x1b')]||null:null,'include':_0x1f11ca['options']?_0x1f11ca['options'][_0xbc9a('0x1c')]?_[_0xbc9a('0x1d')](_0x1f11ca[_0xbc9a('0x17')][_0xbc9a('0x1c')],function(_0x46e932){return{'model':db[_0x46e932[_0xbc9a('0x1e')]],'as':_0x46e932['as'],'attributes':_0x46e932[_0xbc9a('0x1a')],'include':_0x46e932[_0xbc9a('0x1c')]?_[_0xbc9a('0x1d')](_0x46e932[_0xbc9a('0x1c')],function(_0x141b3f){return{'model':db[_0x141b3f[_0xbc9a('0x1e')]],'as':_0x141b3f['as'],'attributes':_0x141b3f['attributes'],'include':_0x141b3f[_0xbc9a('0x1c')]?_[_0xbc9a('0x1d')](_0x141b3f[_0xbc9a('0x1c')],function(_0x1acae8){return{'model':db[_0x1acae8[_0xbc9a('0x1e')]],'as':_0x1acae8['as'],'attributes':_0x1acae8[_0xbc9a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbc9a('0x1f')](function(_0x47fff5){logger[_0xbc9a('0x20')](_0xbc9a('0x21'),_0x1f11ca);logger[_0xbc9a('0xd')]('GetDynamics365Account',_0x1f11ca,JSON[_0xbc9a('0x22')](_0x47fff5));_0x5b44fe(_0x47fff5);})[_0xbc9a('0x14')](function(_0x3c4310){logger[_0xbc9a('0xf')](_0xbc9a('0x21'),_0x3c4310[_0xbc9a('0x11')],_0x1f11ca);_0xf036b0(_0x3cc279[_0xbc9a('0xf')](0x1f4,_0x3c4310[_0xbc9a('0x11')]));});});};exports[_0xbc9a('0x23')]=function(_0x4eaa7d){var _0x2d3231=this;return new Promise(function(_0xce0671,_0x561257){return db['Dynamics365Account'][_0xbc9a('0x24')]({'raw':_0x4eaa7d[_0xbc9a('0x17')]?_0x4eaa7d[_0xbc9a('0x17')][_0xbc9a('0x18')]===undefined?!![]:![]:!![],'where':_0x4eaa7d[_0xbc9a('0x17')]?_0x4eaa7d[_0xbc9a('0x17')][_0xbc9a('0x19')]||null:null,'attributes':_0x4eaa7d[_0xbc9a('0x17')]?_0x4eaa7d[_0xbc9a('0x17')]['attributes']||null:null,'include':_0x4eaa7d[_0xbc9a('0x17')]?_0x4eaa7d[_0xbc9a('0x17')][_0xbc9a('0x1c')]?_[_0xbc9a('0x1d')](_0x4eaa7d['options'][_0xbc9a('0x1c')],function(_0x2b03de){return{'model':db[_0x2b03de[_0xbc9a('0x1e')]],'as':_0x2b03de['as'],'attributes':_0x2b03de[_0xbc9a('0x1a')],'include':_0x2b03de[_0xbc9a('0x1c')]?_[_0xbc9a('0x1d')](_0x2b03de['include'],function(_0x2b2996){return{'model':db[_0x2b2996['model']],'as':_0x2b2996['as'],'attributes':_0x2b2996['attributes'],'include':_0x2b2996[_0xbc9a('0x1c')]?_['map'](_0x2b2996[_0xbc9a('0x1c')],function(_0x4cbc7d){return{'model':db[_0x4cbc7d[_0xbc9a('0x1e')]],'as':_0x4cbc7d['as'],'attributes':_0x4cbc7d[_0xbc9a('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x396400){logger['info'](_0xbc9a('0x23'),_0x4eaa7d);logger[_0xbc9a('0xd')](_0xbc9a('0x23'),_0x4eaa7d,JSON[_0xbc9a('0x22')](_0x396400));_0xce0671(_0x396400);})[_0xbc9a('0x14')](function(_0x53601a){logger[_0xbc9a('0xf')](_0xbc9a('0x23'),_0x53601a[_0xbc9a('0x11')],_0x4eaa7d);_0x561257(_0x2d3231[_0xbc9a('0xf')](0x1f4,_0x53601a[_0xbc9a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index cce3ef8..7e0dc9b 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 _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 +var _0x1230=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x1230,0x135));var _0x0123=function(_0x3b408e,_0x221eba){_0x3b408e=_0x3b408e-0x0;var _0x517c43=_0x1230[_0x3b408e];return _0x517c43;};'use strict';var multer=require(_0x0123('0x0'));var util=require(_0x0123('0x1'));var path=require(_0x0123('0x2'));var timeout=require(_0x0123('0x3'));var express=require('express');var router=express[_0x0123('0x4')]();var auth=require(_0x0123('0x5'));var interaction=require(_0x0123('0x6'));var config=require(_0x0123('0x7'));var controller=require(_0x0123('0x8'));router[_0x0123('0x9')]('/',auth[_0x0123('0xa')](),controller[_0x0123('0xb')]);router[_0x0123('0x9')](_0x0123('0xc'),auth[_0x0123('0xa')](),controller[_0x0123('0xd')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x0123('0xe')]);router[_0x0123('0x9')](_0x0123('0xf'),auth[_0x0123('0xa')](),controller[_0x0123('0x10')]);router[_0x0123('0x9')](_0x0123('0x11'),auth['isAuthenticated'](),controller[_0x0123('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x0123('0x13')]('/:id',auth[_0x0123('0xa')](),controller[_0x0123('0x14')]);router[_0x0123('0x15')](_0x0123('0xc'),auth['isAuthenticated'](),controller[_0x0123('0x16')]);module[_0x0123('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 cd601e1..97fad3f 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 _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 +var _0xa6b7=['STRING','ENUM','incident','sequelize','exports'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xa6b7,0x1a2));var _0x7a6b=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0xa6b7[_0xc67528];return _0x38e26d;};'use strict';var Sequelize=require(_0x7a6b('0x0'));module[_0x7a6b('0x1')]={'name':{'type':Sequelize[_0x7a6b('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x7a6b('0x3')](_0x7a6b('0x4'),'phonecall'),'defaultValue':_0x7a6b('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index ab53259..947fc28 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 _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 +var _0x4876=['find','getFields','findOne','Dynamics365Field','length','map','getSubjects','getDescriptions','html-pdf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../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','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','Dynamics365Configuration','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','includeAll','rows','show','params','include','options','create','body'];(function(_0x511ec9,_0x2d543b){var _0x5e7af2=function(_0x30bc14){while(--_0x30bc14){_0x511ec9['push'](_0x511ec9['shift']());}};_0x5e7af2(++_0x2d543b);}(_0x4876,0x67));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x6487('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6487('0x1'));var rp=require(_0x6487('0x2'));var moment=require('moment');var BPromise=require(_0x6487('0x3'));var Mustache=require(_0x6487('0x4'));var util=require(_0x6487('0x5'));var path=require(_0x6487('0x6'));var sox=require('sox');var csv=require(_0x6487('0x7'));var ejs=require(_0x6487('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6487('0x9'));var crypto=require(_0x6487('0xa'));var jsforce=require(_0x6487('0xb'));var deskjs=require(_0x6487('0xc'));var toCsv=require(_0x6487('0x7'));var querystring=require(_0x6487('0xd'));var Papa=require(_0x6487('0xe'));var Redis=require('ioredis');var authService=require(_0x6487('0xf'));var qs=require(_0x6487('0x10'));var as=require(_0x6487('0x11'));var hardwareService=require(_0x6487('0x12'));var logger=require(_0x6487('0x13'))(_0x6487('0x14'));var utils=require(_0x6487('0x15'));var config=require(_0x6487('0x16'));var db=require(_0x6487('0x17'))['db'];var jayson=require(_0x6487('0x18'));var client=jayson[_0x6487('0x19')][_0x6487('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x25eb49,_0x2d1d1e,_0x18673f){if(_0x18673f){var _0x434935=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x434935[_0x6487('0x1b')](_0x2d1d1e)){return _0x25eb49;}else{throw new db[(_0x6487('0x1c'))][(_0x6487('0x1d'))](_0x6487('0x1e'));}}else{return _0x25eb49;}}function respondWithRpcPromise(_0x4459cd,_0x59fef9,_0x14f2a2,_0x442788){return new BPromise(function(_0x390c99,_0x4cc1cc){var _0xa47638=_0x442788||client;return _0xa47638[_0x6487('0x1f')](_0x4459cd,_0x14f2a2)[_0x6487('0x20')](function(_0x542b57){logger[_0x6487('0x21')]('Dynamics365Configuration,\x20%s,\x20%s',_0x59fef9,_0x6487('0x22'));logger[_0x6487('0x23')](_0x6487('0x24'),_0x59fef9,_0x6487('0x22'),JSON['stringify'](_0x542b57));if(_0x542b57[_0x6487('0x25')]){if(_0x542b57['error'][_0x6487('0x26')]===0x1f4){logger[_0x6487('0x25')](_0x6487('0x27'),_0x59fef9,_0x542b57[_0x6487('0x25')][_0x6487('0x28')]);return _0x4cc1cc(_0x542b57[_0x6487('0x25')][_0x6487('0x28')]);}logger[_0x6487('0x25')](_0x6487('0x27'),_0x59fef9,_0x542b57[_0x6487('0x25')]['message']);return _0x390c99(_0x542b57[_0x6487('0x25')]['message']);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x59fef9,'request\x20sent');_0x390c99(_0x542b57[_0x6487('0x29')][_0x6487('0x28')]);}})[_0x6487('0x2a')](function(_0xba02c3){logger[_0x6487('0x25')](_0x6487('0x27'),_0x59fef9,_0xba02c3);_0x4cc1cc(_0xba02c3);});});}function respondWithStatusCode(_0x2381f1,_0x569908){_0x569908=_0x569908||0xcc;return function(_0x3abcd1){if(_0x3abcd1){return _0x2381f1[_0x6487('0x2b')](_0x569908);}return _0x2381f1[_0x6487('0x2c')](_0x569908)[_0x6487('0x2d')]();};}function respondWithResult(_0xe8c34a,_0x5a5c7f){_0x5a5c7f=_0x5a5c7f||0xc8;return function(_0x31f229){if(_0x31f229){return _0xe8c34a[_0x6487('0x2c')](_0x5a5c7f)[_0x6487('0x2e')](_0x31f229);}};}function respondWithFilteredResult(_0x465dd7,_0x509559){return function(_0x576c26){if(_0x576c26){var _0x4f82a8=_0x576c26[_0x6487('0x2f')],_0x2deab4=_0x509559['offset'],_0x19e7a3=_0x509559[_0x6487('0x30')]+_0x509559['limit'],_0x57488a;if(_0x19e7a3>=_0x4f82a8){_0x19e7a3=_0x4f82a8;_0x57488a=0xc8;}else{_0x57488a=0xce;}_0x465dd7[_0x6487('0x2c')](_0x57488a);return _0x465dd7[_0x6487('0x31')](_0x6487('0x32'),_0x2deab4+'-'+_0x19e7a3+'/'+_0x4f82a8)[_0x6487('0x2e')](_0x576c26);}return null;};}function patchUpdates(_0x20cba4){return function(_0x38fba0){try{jsonpatch[_0x6487('0x33')](_0x38fba0,_0x20cba4,!![]);}catch(_0xe3e5ea){return BPromise[_0x6487('0x34')](_0xe3e5ea);}return _0x38fba0[_0x6487('0x35')]();};}function saveUpdates(_0x1090ec,_0xb33511){return function(_0x4f28a7){if(_0x4f28a7){return _0x4f28a7[_0x6487('0x36')](_0x1090ec)[_0x6487('0x20')](function(_0x1a4441){return _0x1a4441;});}return null;};}function removeEntity(_0x130726,_0x57040a){return function(_0x51d4a6){if(_0x51d4a6){return _0x51d4a6[_0x6487('0x37')]()[_0x6487('0x20')](function(){_0x130726['status'](0xcc)[_0x6487('0x2d')]();});}};}function handleEntityNotFound(_0x59571a,_0x169d86){return function(_0x57b4e7){if(!_0x57b4e7){_0x59571a['sendStatus'](0x194);}return _0x57b4e7;};}function handleError(_0x1667ec,_0x476d18){_0x476d18=_0x476d18||0x1f4;return function(_0xa14545){logger[_0x6487('0x25')](_0xa14545[_0x6487('0x38')]);if(_0xa14545[_0x6487('0x39')]){delete _0xa14545[_0x6487('0x39')];}_0x1667ec[_0x6487('0x2c')](_0x476d18)[_0x6487('0x3a')](_0xa14545);};}exports[_0x6487('0x3b')]=function(_0x5ceebf,_0x1d80aa){var _0x33dafb={},_0x48fa0c={},_0x3a0f25={'count':0x0,'rows':[]};var _0x3daebe=_['map'](db[_0x6487('0x3c')][_0x6487('0x3d')],function(_0x23fdaa){return{'name':_0x23fdaa['fieldName'],'type':_0x23fdaa[_0x6487('0x3e')]['key']};});_0x48fa0c[_0x6487('0x3f')]=_['map'](_0x3daebe,_0x6487('0x39'));_0x48fa0c[_0x6487('0x40')]=_[_0x6487('0x41')](_0x5ceebf[_0x6487('0x40')]);_0x48fa0c[_0x6487('0x42')]=_['intersection'](_0x48fa0c[_0x6487('0x3f')],_0x48fa0c['query']);_0x33dafb['attributes']=_[_0x6487('0x43')](_0x48fa0c[_0x6487('0x3f')],qs[_0x6487('0x44')](_0x5ceebf[_0x6487('0x40')][_0x6487('0x44')]));_0x33dafb[_0x6487('0x45')]=_0x33dafb[_0x6487('0x45')]['length']?_0x33dafb[_0x6487('0x45')]:_0x48fa0c['model'];if(!_0x5ceebf[_0x6487('0x40')][_0x6487('0x46')](_0x6487('0x47'))){_0x33dafb[_0x6487('0x48')]=qs[_0x6487('0x48')](_0x5ceebf[_0x6487('0x40')][_0x6487('0x48')]);_0x33dafb[_0x6487('0x30')]=qs[_0x6487('0x30')](_0x5ceebf[_0x6487('0x40')][_0x6487('0x30')]);}_0x33dafb[_0x6487('0x49')]=qs['sort'](_0x5ceebf[_0x6487('0x40')][_0x6487('0x4a')]);_0x33dafb[_0x6487('0x4b')]=qs['filters'](_[_0x6487('0x4c')](_0x5ceebf[_0x6487('0x40')],_0x48fa0c[_0x6487('0x42')]),_0x3daebe);if(_0x5ceebf[_0x6487('0x40')][_0x6487('0x4d')]){_0x33dafb['where']=_[_0x6487('0x4e')](_0x33dafb[_0x6487('0x4b')],{'$or':_['map'](_0x3daebe,function(_0x16af17){if(_0x16af17[_0x6487('0x3e')]!=='VIRTUAL'){var _0x24d441={};_0x24d441[_0x16af17[_0x6487('0x39')]]={'$like':'%'+_0x5ceebf[_0x6487('0x40')][_0x6487('0x4d')]+'%'};return _0x24d441;}})});}_0x33dafb=_[_0x6487('0x4e')]({},_0x33dafb,_0x5ceebf['options']);var _0x15630b={'where':_0x33dafb[_0x6487('0x4b')]};return db[_0x6487('0x3c')][_0x6487('0x2f')](_0x15630b)['then'](function(_0x263f4a){_0x3a0f25[_0x6487('0x2f')]=_0x263f4a;if(_0x5ceebf[_0x6487('0x40')][_0x6487('0x4f')]){_0x33dafb['include']=[{'all':!![]}];}return db[_0x6487('0x3c')]['findAll'](_0x33dafb);})[_0x6487('0x20')](function(_0x4a4042){_0x3a0f25[_0x6487('0x50')]=_0x4a4042;return _0x3a0f25;})[_0x6487('0x20')](respondWithFilteredResult(_0x1d80aa,_0x33dafb))[_0x6487('0x2a')](handleError(_0x1d80aa,null));};exports[_0x6487('0x51')]=function(_0x5d7c76,_0x1e5711){var _0x2f6846={'raw':![],'where':{'id':_0x5d7c76[_0x6487('0x52')]['id']}},_0x1b68c9={};_0x1b68c9['model']=_['keys'](db[_0x6487('0x3c')][_0x6487('0x3d')]);_0x1b68c9['query']=_[_0x6487('0x41')](_0x5d7c76[_0x6487('0x40')]);_0x1b68c9['filters']=_['intersection'](_0x1b68c9[_0x6487('0x3f')],_0x1b68c9[_0x6487('0x40')]);_0x2f6846[_0x6487('0x45')]=_[_0x6487('0x43')](_0x1b68c9[_0x6487('0x3f')],qs[_0x6487('0x44')](_0x5d7c76['query'][_0x6487('0x44')]));_0x2f6846[_0x6487('0x45')]=_0x2f6846['attributes']['length']?_0x2f6846[_0x6487('0x45')]:_0x1b68c9[_0x6487('0x3f')];if(_0x5d7c76[_0x6487('0x40')][_0x6487('0x4f')]){_0x2f6846[_0x6487('0x53')]=[{'all':!![]}];}_0x2f6846=_[_0x6487('0x4e')]({},_0x2f6846,_0x5d7c76[_0x6487('0x54')]);return db['Dynamics365Configuration']['find'](_0x2f6846)[_0x6487('0x20')](handleEntityNotFound(_0x1e5711,null))[_0x6487('0x20')](respondWithResult(_0x1e5711,null))[_0x6487('0x2a')](handleError(_0x1e5711,null));};exports[_0x6487('0x55')]=function(_0x362c04,_0x5d5848){return db['Dynamics365Configuration']['create'](_0x362c04[_0x6487('0x56')],{})[_0x6487('0x20')](respondWithResult(_0x5d5848,0xc9))[_0x6487('0x2a')](handleError(_0x5d5848,null));};exports[_0x6487('0x36')]=function(_0x3d0908,_0x985838){if(_0x3d0908['body']['id']){delete _0x3d0908[_0x6487('0x56')]['id'];}return db[_0x6487('0x3c')][_0x6487('0x57')]({'where':{'id':_0x3d0908['params']['id']}})['then'](handleEntityNotFound(_0x985838,null))[_0x6487('0x20')](saveUpdates(_0x3d0908[_0x6487('0x56')],null))[_0x6487('0x20')](respondWithResult(_0x985838,null))[_0x6487('0x2a')](handleError(_0x985838,null));};exports[_0x6487('0x37')]=function(_0x45d7f4,_0x301213){return db['Dynamics365Configuration'][_0x6487('0x57')]({'where':{'id':_0x45d7f4[_0x6487('0x52')]['id']}})['then'](handleEntityNotFound(_0x301213,null))['then'](removeEntity(_0x301213,null))[_0x6487('0x2a')](handleError(_0x301213,null));};exports[_0x6487('0x58')]=function(_0x56cb44,_0x212260,_0x2e6e54){var _0x4ada17={};var _0x4ac0f5={};var _0x1983c6;var _0x2b2ff1;return db[_0x6487('0x3c')][_0x6487('0x59')]({'where':{'id':_0x56cb44[_0x6487('0x52')]['id']}})[_0x6487('0x20')](handleEntityNotFound(_0x212260,null))[_0x6487('0x20')](function(_0xc8942){if(_0xc8942){_0x1983c6=_0xc8942;_0x4ac0f5[_0x6487('0x3f')]=_['keys'](db[_0x6487('0x5a')][_0x6487('0x3d')]);_0x4ac0f5[_0x6487('0x40')]=_[_0x6487('0x41')](_0x56cb44[_0x6487('0x40')]);_0x4ac0f5[_0x6487('0x42')]=_[_0x6487('0x43')](_0x4ac0f5[_0x6487('0x3f')],_0x4ac0f5['query']);_0x4ada17[_0x6487('0x45')]=_[_0x6487('0x43')](_0x4ac0f5[_0x6487('0x3f')],qs['fields'](_0x56cb44['query']['fields']));_0x4ada17[_0x6487('0x45')]=_0x4ada17['attributes'][_0x6487('0x5b')]?_0x4ada17[_0x6487('0x45')]:_0x4ac0f5['model'];_0x4ada17[_0x6487('0x49')]=qs[_0x6487('0x4a')](_0x56cb44[_0x6487('0x40')][_0x6487('0x4a')]);_0x4ada17[_0x6487('0x4b')]=qs['filters'](_['pick'](_0x56cb44[_0x6487('0x40')],_0x4ac0f5['filters']));if(_0x56cb44[_0x6487('0x40')][_0x6487('0x4d')]){_0x4ada17['where']=_['merge'](_0x4ada17['where'],{'$or':_[_0x6487('0x5c')](_0x4ada17['attributes'],function(_0x2fb172){var _0x277d60={};_0x277d60[_0x2fb172]={'$like':'%'+_0x56cb44[_0x6487('0x40')][_0x6487('0x4d')]+'%'};return _0x277d60;})});}_0x4ada17=_[_0x6487('0x4e')]({},_0x4ada17,_0x56cb44[_0x6487('0x54')]);return _0x1983c6[_0x6487('0x58')](_0x4ada17);}})['then'](function(_0x2d4d5b){if(_0x2d4d5b){_0x2b2ff1=_0x2d4d5b['length'];if(!_0x56cb44[_0x6487('0x40')][_0x6487('0x46')](_0x6487('0x47'))){_0x4ada17[_0x6487('0x48')]=qs[_0x6487('0x48')](_0x56cb44[_0x6487('0x40')]['limit']);_0x4ada17[_0x6487('0x30')]=qs[_0x6487('0x30')](_0x56cb44[_0x6487('0x40')][_0x6487('0x30')]);}return _0x1983c6[_0x6487('0x58')](_0x4ada17);}})[_0x6487('0x20')](function(_0x129dd8){if(_0x129dd8){return _0x129dd8?{'count':_0x2b2ff1,'rows':_0x129dd8}:null;}})['then'](respondWithResult(_0x212260,null))[_0x6487('0x2a')](handleError(_0x212260,null));};exports['getSubjects']=function(_0x460fdd,_0x27bafd,_0x602fbc){var _0x3b04b4={};var _0x489a09={};var _0x4b9c91;var _0x3e6ac3;return db[_0x6487('0x3c')][_0x6487('0x59')]({'where':{'id':_0x460fdd[_0x6487('0x52')]['id']}})[_0x6487('0x20')](handleEntityNotFound(_0x27bafd,null))[_0x6487('0x20')](function(_0x5e6e53){if(_0x5e6e53){_0x4b9c91=_0x5e6e53;_0x489a09['model']=_[_0x6487('0x41')](db[_0x6487('0x5a')][_0x6487('0x3d')]);_0x489a09[_0x6487('0x40')]=_[_0x6487('0x41')](_0x460fdd[_0x6487('0x40')]);_0x489a09[_0x6487('0x42')]=_['intersection'](_0x489a09[_0x6487('0x3f')],_0x489a09[_0x6487('0x40')]);_0x3b04b4['attributes']=_[_0x6487('0x43')](_0x489a09['model'],qs[_0x6487('0x44')](_0x460fdd[_0x6487('0x40')]['fields']));_0x3b04b4[_0x6487('0x45')]=_0x3b04b4['attributes']['length']?_0x3b04b4[_0x6487('0x45')]:_0x489a09[_0x6487('0x3f')];_0x3b04b4[_0x6487('0x49')]=qs[_0x6487('0x4a')](_0x460fdd['query'][_0x6487('0x4a')]);_0x3b04b4['where']=qs[_0x6487('0x42')](_[_0x6487('0x4c')](_0x460fdd['query'],_0x489a09[_0x6487('0x42')]));if(_0x460fdd[_0x6487('0x40')][_0x6487('0x4d')]){_0x3b04b4[_0x6487('0x4b')]=_[_0x6487('0x4e')](_0x3b04b4[_0x6487('0x4b')],{'$or':_[_0x6487('0x5c')](_0x3b04b4[_0x6487('0x45')],function(_0x399476){var _0x1eb3d9={};_0x1eb3d9[_0x399476]={'$like':'%'+_0x460fdd[_0x6487('0x40')][_0x6487('0x4d')]+'%'};return _0x1eb3d9;})});}_0x3b04b4=_[_0x6487('0x4e')]({},_0x3b04b4,_0x460fdd[_0x6487('0x54')]);return _0x4b9c91[_0x6487('0x5d')](_0x3b04b4);}})[_0x6487('0x20')](function(_0x5a42e3){if(_0x5a42e3){_0x3e6ac3=_0x5a42e3['length'];if(!_0x460fdd[_0x6487('0x40')][_0x6487('0x46')]('nolimit')){_0x3b04b4[_0x6487('0x48')]=qs[_0x6487('0x48')](_0x460fdd[_0x6487('0x40')][_0x6487('0x48')]);_0x3b04b4['offset']=qs[_0x6487('0x30')](_0x460fdd['query'][_0x6487('0x30')]);}return _0x4b9c91[_0x6487('0x5d')](_0x3b04b4);}})['then'](function(_0x1a190c){if(_0x1a190c){return _0x1a190c?{'count':_0x3e6ac3,'rows':_0x1a190c}:null;}})[_0x6487('0x20')](respondWithResult(_0x27bafd,null))[_0x6487('0x2a')](handleError(_0x27bafd,null));};exports['getDescriptions']=function(_0x3a81de,_0x29ff22,_0x3f215c){var _0x460e9e={};var _0x123f86={};var _0x284639;var _0x40bb16;return db['Dynamics365Configuration'][_0x6487('0x59')]({'where':{'id':_0x3a81de[_0x6487('0x52')]['id']}})[_0x6487('0x20')](handleEntityNotFound(_0x29ff22,null))['then'](function(_0x25d449){if(_0x25d449){_0x284639=_0x25d449;_0x123f86['model']=_['keys'](db[_0x6487('0x5a')]['rawAttributes']);_0x123f86[_0x6487('0x40')]=_[_0x6487('0x41')](_0x3a81de[_0x6487('0x40')]);_0x123f86[_0x6487('0x42')]=_[_0x6487('0x43')](_0x123f86['model'],_0x123f86[_0x6487('0x40')]);_0x460e9e['attributes']=_[_0x6487('0x43')](_0x123f86[_0x6487('0x3f')],qs[_0x6487('0x44')](_0x3a81de[_0x6487('0x40')][_0x6487('0x44')]));_0x460e9e[_0x6487('0x45')]=_0x460e9e[_0x6487('0x45')][_0x6487('0x5b')]?_0x460e9e[_0x6487('0x45')]:_0x123f86['model'];_0x460e9e['order']=qs[_0x6487('0x4a')](_0x3a81de['query']['sort']);_0x460e9e[_0x6487('0x4b')]=qs[_0x6487('0x42')](_['pick'](_0x3a81de[_0x6487('0x40')],_0x123f86['filters']));if(_0x3a81de[_0x6487('0x40')][_0x6487('0x4d')]){_0x460e9e[_0x6487('0x4b')]=_[_0x6487('0x4e')](_0x460e9e['where'],{'$or':_[_0x6487('0x5c')](_0x460e9e[_0x6487('0x45')],function(_0xb88473){var _0x25e560={};_0x25e560[_0xb88473]={'$like':'%'+_0x3a81de[_0x6487('0x40')][_0x6487('0x4d')]+'%'};return _0x25e560;})});}_0x460e9e=_[_0x6487('0x4e')]({},_0x460e9e,_0x3a81de[_0x6487('0x54')]);return _0x284639[_0x6487('0x5e')](_0x460e9e);}})[_0x6487('0x20')](function(_0x3fba4f){if(_0x3fba4f){_0x40bb16=_0x3fba4f[_0x6487('0x5b')];if(!_0x3a81de[_0x6487('0x40')][_0x6487('0x46')](_0x6487('0x47'))){_0x460e9e[_0x6487('0x48')]=qs[_0x6487('0x48')](_0x3a81de[_0x6487('0x40')][_0x6487('0x48')]);_0x460e9e[_0x6487('0x30')]=qs['offset'](_0x3a81de[_0x6487('0x40')][_0x6487('0x30')]);}return _0x284639[_0x6487('0x5e')](_0x460e9e);}})[_0x6487('0x20')](function(_0x11afbb){if(_0x11afbb){return _0x11afbb?{'count':_0x40bb16,'rows':_0x11afbb}:null;}})['then'](respondWithResult(_0x29ff22,null))['catch'](handleError(_0x29ff22,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 8c6112f..e67defd 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 _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 +var _0x22b0=['./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','int_dynamics365_configurations','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2b882b,_0x4fbea6){var _0x591869=function(_0x2460fd){while(--_0x2460fd){_0x2b882b['push'](_0x2b882b['shift']());}};_0x591869(++_0x4fbea6);}(_0x22b0,0xe0));var _0x022b=function(_0x33b4e7,_0x151401){_0x33b4e7=_0x33b4e7-0x0;var _0x29e187=_0x22b0[_0x33b4e7];return _0x29e187;};'use strict';var _=require(_0x022b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x022b('0x1'));var moment=require(_0x022b('0x2'));var BPromise=require(_0x022b('0x3'));var rp=require(_0x022b('0x4'));var fs=require('fs');var path=require(_0x022b('0x5'));var rimraf=require(_0x022b('0x6'));var config=require('../../config/environment');var attributes=require(_0x022b('0x7'));module[_0x022b('0x8')]=function(_0x2c02c7,_0x42290c){return _0x2c02c7['define'](_0x022b('0x9'),attributes,{'tableName':_0x022b('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 91d1943..c9c35a5 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 _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 +var _0xd8b1=['stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x279702,_0x12e9b5){var _0x34f62e=function(_0x3f65e8){while(--_0x3f65e8){_0x279702['push'](_0x279702['shift']());}};_0x34f62e(++_0x12e9b5);}(_0xd8b1,0x195));var _0x1d8b=function(_0x4893c0,_0x30df8d){_0x4893c0=_0x4893c0-0x0;var _0x5f2934=_0xd8b1[_0x4893c0];return _0x5f2934;};'use strict';var _=require(_0x1d8b('0x0'));var util=require(_0x1d8b('0x1'));var moment=require('moment');var BPromise=require(_0x1d8b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d8b('0x3'))['db'];var utils=require(_0x1d8b('0x4'));var logger=require(_0x1d8b('0x5'))('rpc');var config=require(_0x1d8b('0x6'));var jayson=require(_0x1d8b('0x7'));var client=jayson['client'][_0x1d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x510be9,_0x15f150,_0x5f2758){return new BPromise(function(_0x3f2887,_0x3d01c3){return client[_0x1d8b('0x9')](_0x510be9,_0x5f2758)['then'](function(_0xa32e78){logger[_0x1d8b('0xa')](_0x1d8b('0xb'),_0x15f150,'request\x20sent');logger[_0x1d8b('0xc')](_0x1d8b('0xd'),_0x15f150,_0x1d8b('0xe'),JSON[_0x1d8b('0xf')](_0xa32e78));if(_0xa32e78[_0x1d8b('0x10')]){if(_0xa32e78[_0x1d8b('0x10')][_0x1d8b('0x11')]===0x1f4){logger['error'](_0x1d8b('0xb'),_0x15f150,_0xa32e78[_0x1d8b('0x10')][_0x1d8b('0x12')]);return _0x3d01c3(_0xa32e78[_0x1d8b('0x10')][_0x1d8b('0x12')]);}logger[_0x1d8b('0x10')](_0x1d8b('0xb'),_0x15f150,_0xa32e78['error']['message']);return _0x3f2887(_0xa32e78[_0x1d8b('0x10')][_0x1d8b('0x12')]);}else{logger[_0x1d8b('0xa')](_0x1d8b('0xb'),_0x15f150,'request\x20sent');_0x3f2887(_0xa32e78[_0x1d8b('0x13')][_0x1d8b('0x12')]);}})[_0x1d8b('0x14')](function(_0x3dad87){logger['error'](_0x1d8b('0xb'),_0x15f150,_0x3dad87);_0x3d01c3(_0x3dad87);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index ac4e1a4..ce8417f 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 _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 +var _0xae79=['create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x1750f4,_0x2ae878){var _0x2611f3=function(_0x1c94c8){while(--_0x1c94c8){_0x1750f4['push'](_0x1750f4['shift']());}};_0x2611f3(++_0x2ae878);}(_0xae79,0x1d3));var _0x9ae7=function(_0x3a675b,_0x29e475){_0x3a675b=_0x3a675b-0x0;var _0x48e9fe=_0xae79[_0x3a675b];return _0x48e9fe;};'use strict';var multer=require(_0x9ae7('0x0'));var util=require(_0x9ae7('0x1'));var path=require(_0x9ae7('0x2'));var timeout=require(_0x9ae7('0x3'));var express=require(_0x9ae7('0x4'));var router=express[_0x9ae7('0x5')]();var auth=require(_0x9ae7('0x6'));var interaction=require(_0x9ae7('0x7'));var config=require(_0x9ae7('0x8'));var controller=require(_0x9ae7('0x9'));router[_0x9ae7('0xa')]('/',auth[_0x9ae7('0xb')](),controller[_0x9ae7('0xc')]);router[_0x9ae7('0xa')](_0x9ae7('0xd'),auth['isAuthenticated'](),controller[_0x9ae7('0xe')]);router[_0x9ae7('0xf')]('/',auth[_0x9ae7('0xb')](),controller[_0x9ae7('0x10')]);router[_0x9ae7('0x11')](_0x9ae7('0xd'),auth['isAuthenticated'](),controller[_0x9ae7('0x12')]);router['delete'](_0x9ae7('0xd'),auth[_0x9ae7('0xb')](),controller[_0x9ae7('0x13')]);module[_0x9ae7('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 17c047f..cef33ec 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 _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 +var _0x843b=['exports','ENUM','variable','customVariable','keyValue','string','STRING','BOOLEAN','sequelize'];(function(_0x568dc2,_0x4657c6){var _0x2a879d=function(_0x40832a){while(--_0x40832a){_0x568dc2['push'](_0x568dc2['shift']());}};_0x2a879d(++_0x4657c6);}(_0x843b,0xc5));var _0xb843=function(_0x568e21,_0x524fea){_0x568e21=_0x568e21-0x0;var _0x1a8162=_0x843b[_0x568e21];return _0x1a8162;};'use strict';var Sequelize=require(_0xb843('0x0'));module[_0xb843('0x1')]={'type':{'type':Sequelize[_0xb843('0x2')]('string',_0xb843('0x3'),_0xb843('0x4'),_0xb843('0x5')),'defaultValue':_0xb843('0x6')},'content':{'type':Sequelize[_0xb843('0x7')]},'key':{'type':Sequelize[_0xb843('0x7')]},'keyType':{'type':Sequelize[_0xb843('0x2')](_0xb843('0x6'),_0xb843('0x3'),_0xb843('0x4'))},'keyContent':{'type':Sequelize[_0xb843('0x7')]},'idField':{'type':Sequelize[_0xb843('0x7')]},'nameField':{'type':Sequelize[_0xb843('0x7')]},'customField':{'type':Sequelize[_0xb843('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb843('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 309ae5c..889111f 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 _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 +var _0xe5f7=['catch','params','find','create','body','update','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows'];(function(_0xe86c6d,_0x19a07f){var _0x26fbff=function(_0x3f254b){while(--_0x3f254b){_0xe86c6d['push'](_0xe86c6d['shift']());}};_0x26fbff(++_0x19a07f);}(_0xe5f7,0x178));var _0x7e5f=function(_0x1c35bb,_0x38051e){_0x1c35bb=_0x1c35bb-0x0;var _0x5b9842=_0xe5f7[_0x1c35bb];return _0x5b9842;};'use strict';var pdf=require(_0x7e5f('0x0'));var emlformat=require(_0x7e5f('0x1'));var rimraf=require(_0x7e5f('0x2'));var zipdir=require(_0x7e5f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7e5f('0x4'));var BPromise=require(_0x7e5f('0x5'));var Mustache=require(_0x7e5f('0x6'));var util=require('util');var path=require(_0x7e5f('0x7'));var sox=require(_0x7e5f('0x8'));var csv=require('to-csv');var ejs=require(_0x7e5f('0x9'));var fs=require('fs');var _=require(_0x7e5f('0xa'));var squel=require(_0x7e5f('0xb'));var crypto=require(_0x7e5f('0xc'));var jsforce=require(_0x7e5f('0xd'));var deskjs=require(_0x7e5f('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7e5f('0xf'));var Redis=require(_0x7e5f('0x10'));var authService=require(_0x7e5f('0x11'));var qs=require(_0x7e5f('0x12'));var as=require(_0x7e5f('0x13'));var hardwareService=require(_0x7e5f('0x14'));var logger=require(_0x7e5f('0x15'))(_0x7e5f('0x16'));var utils=require(_0x7e5f('0x17'));var config=require(_0x7e5f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3dc3c8,_0x505fbb){_0x505fbb=_0x505fbb||0xcc;return function(_0x29d0e0){if(_0x29d0e0){return _0x3dc3c8[_0x7e5f('0x19')](_0x505fbb);}return _0x3dc3c8[_0x7e5f('0x1a')](_0x505fbb)[_0x7e5f('0x1b')]();};}function respondWithResult(_0x23e241,_0x282866){_0x282866=_0x282866||0xc8;return function(_0x1eddfd){if(_0x1eddfd){return _0x23e241[_0x7e5f('0x1a')](_0x282866)[_0x7e5f('0x1c')](_0x1eddfd);}};}function respondWithFilteredResult(_0x199712,_0x5ba25b){return function(_0x40c6ee){if(_0x40c6ee){var _0x39b644=_0x40c6ee['count'],_0x25448c=_0x5ba25b['offset'],_0x62cdf5=_0x5ba25b[_0x7e5f('0x1d')]+_0x5ba25b[_0x7e5f('0x1e')],_0x5a0c96;if(_0x62cdf5>=_0x39b644){_0x62cdf5=_0x39b644;_0x5a0c96=0xc8;}else{_0x5a0c96=0xce;}_0x199712['status'](_0x5a0c96);return _0x199712[_0x7e5f('0x1f')](_0x7e5f('0x20'),_0x25448c+'-'+_0x62cdf5+'/'+_0x39b644)[_0x7e5f('0x1c')](_0x40c6ee);}return null;};}function patchUpdates(_0xd97c29){return function(_0x16754e){try{jsonpatch[_0x7e5f('0x21')](_0x16754e,_0xd97c29,!![]);}catch(_0x2e2385){return BPromise['reject'](_0x2e2385);}return _0x16754e[_0x7e5f('0x22')]();};}function saveUpdates(_0x5a2624,_0x1d77fe){return function(_0x26a574){if(_0x26a574){return _0x26a574['update'](_0x5a2624)[_0x7e5f('0x23')](function(_0x4c81d5){return _0x4c81d5;});}return null;};}function removeEntity(_0x4997a7,_0x273c9b){return function(_0x5b4aaa){if(_0x5b4aaa){return _0x5b4aaa[_0x7e5f('0x24')]()['then'](function(){_0x4997a7[_0x7e5f('0x1a')](0xcc)[_0x7e5f('0x1b')]();});}};}function handleEntityNotFound(_0xd997bf,_0x50cfc6){return function(_0x5137a6){if(!_0x5137a6){_0xd997bf['sendStatus'](0x194);}return _0x5137a6;};}function handleError(_0x33b4f6,_0x3e7191){_0x3e7191=_0x3e7191||0x1f4;return function(_0x372eb9){logger[_0x7e5f('0x25')](_0x372eb9[_0x7e5f('0x26')]);if(_0x372eb9[_0x7e5f('0x27')]){delete _0x372eb9[_0x7e5f('0x27')];}_0x33b4f6[_0x7e5f('0x1a')](_0x3e7191)['send'](_0x372eb9);};}exports['index']=function(_0x7b83a3,_0x455071){var _0x3fe09d={},_0x26d09d={},_0x62f838={'count':0x0,'rows':[]};var _0x16a06e=_[_0x7e5f('0x28')](db[_0x7e5f('0x29')][_0x7e5f('0x2a')],function(_0x3b73c6){return{'name':_0x3b73c6[_0x7e5f('0x2b')],'type':_0x3b73c6[_0x7e5f('0x2c')][_0x7e5f('0x2d')]};});_0x26d09d[_0x7e5f('0x2e')]=_[_0x7e5f('0x28')](_0x16a06e,_0x7e5f('0x27'));_0x26d09d['query']=_[_0x7e5f('0x2f')](_0x7b83a3[_0x7e5f('0x30')]);_0x26d09d[_0x7e5f('0x31')]=_[_0x7e5f('0x32')](_0x26d09d[_0x7e5f('0x2e')],_0x26d09d[_0x7e5f('0x30')]);_0x3fe09d['attributes']=_['intersection'](_0x26d09d[_0x7e5f('0x2e')],qs[_0x7e5f('0x33')](_0x7b83a3[_0x7e5f('0x30')][_0x7e5f('0x33')]));_0x3fe09d[_0x7e5f('0x34')]=_0x3fe09d[_0x7e5f('0x34')][_0x7e5f('0x35')]?_0x3fe09d[_0x7e5f('0x34')]:_0x26d09d['model'];if(!_0x7b83a3[_0x7e5f('0x30')][_0x7e5f('0x36')](_0x7e5f('0x37'))){_0x3fe09d[_0x7e5f('0x1e')]=qs[_0x7e5f('0x1e')](_0x7b83a3[_0x7e5f('0x30')][_0x7e5f('0x1e')]);_0x3fe09d[_0x7e5f('0x1d')]=qs[_0x7e5f('0x1d')](_0x7b83a3[_0x7e5f('0x30')][_0x7e5f('0x1d')]);}_0x3fe09d[_0x7e5f('0x38')]=qs['sort'](_0x7b83a3[_0x7e5f('0x30')]['sort']);_0x3fe09d[_0x7e5f('0x39')]=qs[_0x7e5f('0x31')](_[_0x7e5f('0x3a')](_0x7b83a3[_0x7e5f('0x30')],_0x26d09d[_0x7e5f('0x31')]),_0x16a06e);if(_0x7b83a3[_0x7e5f('0x30')][_0x7e5f('0x3b')]){_0x3fe09d[_0x7e5f('0x39')]=_[_0x7e5f('0x3c')](_0x3fe09d[_0x7e5f('0x39')],{'$or':_[_0x7e5f('0x28')](_0x16a06e,function(_0x2430ad){if(_0x2430ad['type']!==_0x7e5f('0x3d')){var _0x423735={};_0x423735[_0x2430ad[_0x7e5f('0x27')]]={'$like':'%'+_0x7b83a3[_0x7e5f('0x30')]['filter']+'%'};return _0x423735;}})});}_0x3fe09d=_['merge']({},_0x3fe09d,_0x7b83a3[_0x7e5f('0x3e')]);var _0x7abca4={'where':_0x3fe09d[_0x7e5f('0x39')]};return db[_0x7e5f('0x29')][_0x7e5f('0x3f')](_0x7abca4)[_0x7e5f('0x23')](function(_0x92955d){_0x62f838[_0x7e5f('0x3f')]=_0x92955d;if(_0x7b83a3[_0x7e5f('0x30')][_0x7e5f('0x40')]){_0x3fe09d[_0x7e5f('0x41')]=[{'all':!![]}];}return db[_0x7e5f('0x29')][_0x7e5f('0x42')](_0x3fe09d);})['then'](function(_0x1e3eca){_0x62f838[_0x7e5f('0x43')]=_0x1e3eca;return _0x62f838;})[_0x7e5f('0x23')](respondWithFilteredResult(_0x455071,_0x3fe09d))[_0x7e5f('0x44')](handleError(_0x455071,null));};exports['show']=function(_0x1835f2,_0x581ab3){var _0xaee3ce={'raw':!![],'where':{'id':_0x1835f2[_0x7e5f('0x45')]['id']}},_0x108342={};_0x108342[_0x7e5f('0x2e')]=_[_0x7e5f('0x2f')](db['Dynamics365Field'][_0x7e5f('0x2a')]);_0x108342[_0x7e5f('0x30')]=_[_0x7e5f('0x2f')](_0x1835f2[_0x7e5f('0x30')]);_0x108342['filters']=_[_0x7e5f('0x32')](_0x108342[_0x7e5f('0x2e')],_0x108342[_0x7e5f('0x30')]);_0xaee3ce[_0x7e5f('0x34')]=_['intersection'](_0x108342[_0x7e5f('0x2e')],qs['fields'](_0x1835f2[_0x7e5f('0x30')]['fields']));_0xaee3ce[_0x7e5f('0x34')]=_0xaee3ce[_0x7e5f('0x34')][_0x7e5f('0x35')]?_0xaee3ce['attributes']:_0x108342[_0x7e5f('0x2e')];if(_0x1835f2[_0x7e5f('0x30')][_0x7e5f('0x40')]){_0xaee3ce[_0x7e5f('0x41')]=[{'all':!![]}];}_0xaee3ce=_[_0x7e5f('0x3c')]({},_0xaee3ce,_0x1835f2[_0x7e5f('0x3e')]);return db[_0x7e5f('0x29')][_0x7e5f('0x46')](_0xaee3ce)['then'](handleEntityNotFound(_0x581ab3,null))[_0x7e5f('0x23')](respondWithResult(_0x581ab3,null))['catch'](handleError(_0x581ab3,null));};exports[_0x7e5f('0x47')]=function(_0x1633fc,_0x36dd38){return db[_0x7e5f('0x29')][_0x7e5f('0x47')](_0x1633fc[_0x7e5f('0x48')],{})[_0x7e5f('0x23')](respondWithResult(_0x36dd38,0xc9))['catch'](handleError(_0x36dd38,null));};exports[_0x7e5f('0x49')]=function(_0x366859,_0x4b7fe2){if(_0x366859[_0x7e5f('0x48')]['id']){delete _0x366859[_0x7e5f('0x48')]['id'];}return db[_0x7e5f('0x29')][_0x7e5f('0x46')]({'where':{'id':_0x366859[_0x7e5f('0x45')]['id']}})[_0x7e5f('0x23')](handleEntityNotFound(_0x4b7fe2,null))[_0x7e5f('0x23')](saveUpdates(_0x366859[_0x7e5f('0x48')],null))['then'](respondWithResult(_0x4b7fe2,null))['catch'](handleError(_0x4b7fe2,null));};exports['destroy']=function(_0x39d8ee,_0x497155){return db[_0x7e5f('0x29')][_0x7e5f('0x46')]({'where':{'id':_0x39d8ee['params']['id']}})[_0x7e5f('0x23')](handleEntityNotFound(_0x497155,null))[_0x7e5f('0x23')](removeEntity(_0x497155,null))['catch'](handleError(_0x497155,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 1069dce..c2d73e2 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 _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 +var _0x49e7=['rimraf','../../config/environment','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3aec49,_0x30d0f8){var _0x41d74e=function(_0x34faa1){while(--_0x34faa1){_0x3aec49['push'](_0x3aec49['shift']());}};_0x41d74e(++_0x30d0f8);}(_0x49e7,0xda));var _0x749e=function(_0x4ec964,_0x3b9bd8){_0x4ec964=_0x4ec964-0x0;var _0x5943e2=_0x49e7[_0x4ec964];return _0x5943e2;};'use strict';var _=require('lodash');var util=require(_0x749e('0x0'));var logger=require(_0x749e('0x1'))('api');var moment=require(_0x749e('0x2'));var BPromise=require(_0x749e('0x3'));var rp=require(_0x749e('0x4'));var fs=require('fs');var path=require(_0x749e('0x5'));var rimraf=require(_0x749e('0x6'));var config=require(_0x749e('0x7'));var attributes=require(_0x749e('0x8'));module[_0x749e('0x9')]=function(_0xa71346,_0x4507a6){return _0xa71346['define'](_0x749e('0xa'),attributes,{'tableName':_0x749e('0xb'),'paranoid':![],'indexes':[{'name':_0x749e('0xc'),'fields':[_0x749e('0xd'),'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 ba31b92..973a01c 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 _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 +var _0xbd0a=['catch','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','error','code','result','message'];(function(_0x3250f5,_0x5d856a){var _0x589823=function(_0x38dfee){while(--_0x38dfee){_0x3250f5['push'](_0x3250f5['shift']());}};_0x589823(++_0x5d856a);}(_0xbd0a,0x1b9));var _0xabd0=function(_0x6ed5fd,_0x436c31){_0x6ed5fd=_0x6ed5fd-0x0;var _0x5dc8b9=_0xbd0a[_0x6ed5fd];return _0x5dc8b9;};'use strict';var _=require(_0xabd0('0x0'));var util=require('util');var moment=require(_0xabd0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xabd0('0x2'))['db'];var utils=require(_0xabd0('0x3'));var logger=require(_0xabd0('0x4'))(_0xabd0('0x5'));var config=require(_0xabd0('0x6'));var jayson=require(_0xabd0('0x7'));var client=jayson[_0xabd0('0x8')][_0xabd0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe18a18,_0x4ac4ad,_0xf44097){return new BPromise(function(_0xb60e77,_0x2b50c1){return client['request'](_0xe18a18,_0xf44097)[_0xabd0('0xa')](function(_0x4830c4){logger[_0xabd0('0xb')](_0xabd0('0xc'),_0x4ac4ad,_0xabd0('0xd'));logger[_0xabd0('0xe')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x4ac4ad,_0xabd0('0xd'),JSON['stringify'](_0x4830c4));if(_0x4830c4[_0xabd0('0xf')]){if(_0x4830c4[_0xabd0('0xf')][_0xabd0('0x10')]===0x1f4){logger[_0xabd0('0xf')](_0xabd0('0xc'),_0x4ac4ad,_0x4830c4[_0xabd0('0xf')]['message']);return _0x2b50c1(_0x4830c4[_0xabd0('0xf')]['message']);}logger[_0xabd0('0xf')](_0xabd0('0xc'),_0x4ac4ad,_0x4830c4['error']['message']);return _0xb60e77(_0x4830c4['error']['message']);}else{logger[_0xabd0('0xb')](_0xabd0('0xc'),_0x4ac4ad,_0xabd0('0xd'));_0xb60e77(_0x4830c4[_0xabd0('0x11')][_0xabd0('0x12')]);}})[_0xabd0('0x13')](function(_0x389e1e){logger[_0xabd0('0xf')](_0xabd0('0xc'),_0x4ac4ad,_0x389e1e);_0x2b50c1(_0x389e1e);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index ab6067b..1e61ae1 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 _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 +var _0x5aa8=['./intFreshdeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment'];(function(_0xcb5f3c,_0x11ffbb){var _0x3c2a15=function(_0x7c0b41){while(--_0x7c0b41){_0xcb5f3c['push'](_0xcb5f3c['shift']());}};_0x3c2a15(++_0x11ffbb);}(_0x5aa8,0x13b));var _0x85aa=function(_0x3b84f7,_0x55dd20){_0x3b84f7=_0x3b84f7-0x0;var _0x3c9a6c=_0x5aa8[_0x3b84f7];return _0x3c9a6c;};'use strict';var multer=require(_0x85aa('0x0'));var util=require(_0x85aa('0x1'));var path=require(_0x85aa('0x2'));var timeout=require('connect-timeout');var express=require(_0x85aa('0x3'));var router=express[_0x85aa('0x4')]();var auth=require(_0x85aa('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x85aa('0x6'));var controller=require(_0x85aa('0x7'));router[_0x85aa('0x8')]('/',auth[_0x85aa('0x9')](),controller[_0x85aa('0xa')]);router[_0x85aa('0x8')]('/:id',auth[_0x85aa('0x9')](),controller[_0x85aa('0xb')]);router[_0x85aa('0x8')](_0x85aa('0xc'),auth['isAuthenticated'](),controller[_0x85aa('0xd')]);router[_0x85aa('0x8')](_0x85aa('0xe'),auth[_0x85aa('0x9')](),controller[_0x85aa('0xf')]);router[_0x85aa('0x10')]('/',auth[_0x85aa('0x9')](),controller[_0x85aa('0x11')]);router[_0x85aa('0x10')](_0x85aa('0xc'),auth[_0x85aa('0x9')](),controller[_0x85aa('0x12')]);router[_0x85aa('0x13')](_0x85aa('0x14'),auth['isAuthenticated'](),controller['update']);router[_0x85aa('0x15')](_0x85aa('0x14'),auth[_0x85aa('0x9')](),controller['destroy']);module[_0x85aa('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 7711645..7611c88 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 _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 +var _0xd26f=['sequelize','exports','STRING','username','remoteUri'];(function(_0x55ed34,_0x369cc2){var _0x158abf=function(_0x2b7ff4){while(--_0x2b7ff4){_0x55ed34['push'](_0x55ed34['shift']());}};_0x158abf(++_0x369cc2);}(_0xd26f,0x113));var _0xfd26=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xd26f[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0xfd26('0x0'));module[_0xfd26('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xfd26('0x2')],'unique':_0xfd26('0x3')},'apiKey':{'type':Sequelize[_0xfd26('0x2')]},'remoteUri':{'type':Sequelize[_0xfd26('0x2')],'unique':_0xfd26('0x4')},'serverUrl':{'type':Sequelize[_0xfd26('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index e2ef9f8..cc8023f 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 _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 +var _0xa41a=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','jayson/promise','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','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','end','status','json','count','offset','limit','Content-Range','apply','update','destroy','sendStatus','name','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','getConfigurations','FreshdeskConfiguration','map','addConfiguration','findOne','AccountId','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','requester','subject','description','priority','source','ticket_type','company','includes','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','send','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce'];(function(_0x3dfcaf,_0x2dff56){var _0x2cdd63=function(_0xcaaf9d){while(--_0xcaaf9d){_0x3dfcaf['push'](_0x3dfcaf['shift']());}};_0x2cdd63(++_0x2dff56);}(_0xa41a,0x6b));var _0xaa41=function(_0x30913b,_0x26abea){_0x30913b=_0x30913b-0x0;var _0x34675b=_0xa41a[_0x30913b];return _0x34675b;};'use strict';var pdf=require(_0xaa41('0x0'));var emlformat=require(_0xaa41('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xaa41('0x2'));var jsonpatch=require(_0xaa41('0x3'));var rp=require(_0xaa41('0x4'));var moment=require(_0xaa41('0x5'));var BPromise=require(_0xaa41('0x6'));var Mustache=require(_0xaa41('0x7'));var util=require(_0xaa41('0x8'));var path=require(_0xaa41('0x9'));var sox=require('sox');var csv=require(_0xaa41('0xa'));var ejs=require(_0xaa41('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa41('0xc'));var jsforce=require(_0xaa41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa41('0xa'));var querystring=require(_0xaa41('0xe'));var Papa=require(_0xaa41('0xf'));var Redis=require(_0xaa41('0x10'));var authService=require(_0xaa41('0x11'));var qs=require(_0xaa41('0x12'));var as=require(_0xaa41('0x13'));var hardwareService=require(_0xaa41('0x14'));var logger=require(_0xaa41('0x15'))('api');var utils=require(_0xaa41('0x16'));var config=require(_0xaa41('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xaa41('0x18'));var client=jayson['client'][_0xaa41('0x19')]({'port':0x232a});function checkPasswordPattern(_0x12d9e6,_0x2f64bc,_0x889d44){if(_0x889d44){var _0x6f9ade=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x6f9ade['test'](_0x2f64bc)){return _0x12d9e6;}else{throw new db[(_0xaa41('0x1a'))][(_0xaa41('0x1b'))](_0xaa41('0x1c'));}}else{return _0x12d9e6;}}function respondWithRpcPromise(_0x1ef7d9,_0x2a6988,_0x2005ae,_0x1e1e02){return new BPromise(function(_0x550ad5,_0x2d868a){var _0x16b930=_0x1e1e02||client;return _0x16b930[_0xaa41('0x1d')](_0x1ef7d9,_0x2005ae)[_0xaa41('0x1e')](function(_0x230a6a){logger[_0xaa41('0x1f')](_0xaa41('0x20'),_0x2a6988,_0xaa41('0x21'));logger[_0xaa41('0x22')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x2a6988,'request\x20sent',JSON[_0xaa41('0x23')](_0x230a6a));if(_0x230a6a[_0xaa41('0x24')]){if(_0x230a6a[_0xaa41('0x24')]['code']===0x1f4){logger[_0xaa41('0x24')](_0xaa41('0x20'),_0x2a6988,_0x230a6a['error']['message']);return _0x2d868a(_0x230a6a[_0xaa41('0x24')]['message']);}logger[_0xaa41('0x24')](_0xaa41('0x20'),_0x2a6988,_0x230a6a[_0xaa41('0x24')][_0xaa41('0x25')]);return _0x550ad5(_0x230a6a[_0xaa41('0x24')]['message']);}else{logger[_0xaa41('0x1f')](_0xaa41('0x20'),_0x2a6988,_0xaa41('0x21'));_0x550ad5(_0x230a6a[_0xaa41('0x26')][_0xaa41('0x25')]);}})[_0xaa41('0x27')](function(_0x5c3074){logger['error'](_0xaa41('0x20'),_0x2a6988,_0x5c3074);_0x2d868a(_0x5c3074);});});}function respondWithStatusCode(_0x527cac,_0x493a10){_0x493a10=_0x493a10||0xcc;return function(_0x12e362){if(_0x12e362){return _0x527cac['sendStatus'](_0x493a10);}return _0x527cac['status'](_0x493a10)[_0xaa41('0x28')]();};}function respondWithResult(_0x9c8c21,_0x392214){_0x392214=_0x392214||0xc8;return function(_0x632fd2){if(_0x632fd2){return _0x9c8c21[_0xaa41('0x29')](_0x392214)[_0xaa41('0x2a')](_0x632fd2);}};}function respondWithFilteredResult(_0x57ef96,_0x30a174){return function(_0x1f0275){if(_0x1f0275){var _0x63c18c=_0x1f0275[_0xaa41('0x2b')],_0x9a16e3=_0x30a174[_0xaa41('0x2c')],_0x1d8c2b=_0x30a174['offset']+_0x30a174[_0xaa41('0x2d')],_0x4466a3;if(_0x1d8c2b>=_0x63c18c){_0x1d8c2b=_0x63c18c;_0x4466a3=0xc8;}else{_0x4466a3=0xce;}_0x57ef96['status'](_0x4466a3);return _0x57ef96['set'](_0xaa41('0x2e'),_0x9a16e3+'-'+_0x1d8c2b+'/'+_0x63c18c)[_0xaa41('0x2a')](_0x1f0275);}return null;};}function patchUpdates(_0x534a85){return function(_0x392b5d){try{jsonpatch[_0xaa41('0x2f')](_0x392b5d,_0x534a85,!![]);}catch(_0x4e3b44){return BPromise['reject'](_0x4e3b44);}return _0x392b5d['save']();};}function saveUpdates(_0x1cf3da,_0x2f5cc0){return function(_0x2a186e){if(_0x2a186e){return _0x2a186e[_0xaa41('0x30')](_0x1cf3da)['then'](function(_0x289c4a){return _0x289c4a;});}return null;};}function removeEntity(_0x45c8fe,_0x3e0204){return function(_0x4de770){if(_0x4de770){return _0x4de770[_0xaa41('0x31')]()[_0xaa41('0x1e')](function(){_0x45c8fe[_0xaa41('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x252c62,_0x374117){return function(_0x57fe1d){if(!_0x57fe1d){_0x252c62[_0xaa41('0x32')](0x194);}return _0x57fe1d;};}function handleError(_0x13b6d4,_0x2298ed){_0x2298ed=_0x2298ed||0x1f4;return function(_0x5cec87){logger[_0xaa41('0x24')](_0x5cec87['stack']);if(_0x5cec87[_0xaa41('0x33')]){delete _0x5cec87[_0xaa41('0x33')];}_0x13b6d4[_0xaa41('0x29')](_0x2298ed)['send'](_0x5cec87);};}exports['index']=function(_0x4cdd42,_0x2dc05a){var _0x2e785f={},_0x1334c8={},_0x224eb3={'count':0x0,'rows':[]};var _0x4fbb92=_['map'](db[_0xaa41('0x34')][_0xaa41('0x35')],function(_0x951e52){return{'name':_0x951e52[_0xaa41('0x36')],'type':_0x951e52[_0xaa41('0x37')][_0xaa41('0x38')]};});_0x1334c8[_0xaa41('0x39')]=_['map'](_0x4fbb92,_0xaa41('0x33'));_0x1334c8[_0xaa41('0x3a')]=_[_0xaa41('0x3b')](_0x4cdd42[_0xaa41('0x3a')]);_0x1334c8['filters']=_['intersection'](_0x1334c8[_0xaa41('0x39')],_0x1334c8[_0xaa41('0x3a')]);_0x2e785f['attributes']=_[_0xaa41('0x3c')](_0x1334c8['model'],qs[_0xaa41('0x3d')](_0x4cdd42[_0xaa41('0x3a')][_0xaa41('0x3d')]));_0x2e785f[_0xaa41('0x3e')]=_0x2e785f[_0xaa41('0x3e')][_0xaa41('0x3f')]?_0x2e785f[_0xaa41('0x3e')]:_0x1334c8[_0xaa41('0x39')];if(!_0x4cdd42['query'][_0xaa41('0x40')](_0xaa41('0x41'))){_0x2e785f[_0xaa41('0x2d')]=qs[_0xaa41('0x2d')](_0x4cdd42[_0xaa41('0x3a')][_0xaa41('0x2d')]);_0x2e785f['offset']=qs['offset'](_0x4cdd42[_0xaa41('0x3a')]['offset']);}_0x2e785f[_0xaa41('0x42')]=qs[_0xaa41('0x43')](_0x4cdd42[_0xaa41('0x3a')][_0xaa41('0x43')]);_0x2e785f[_0xaa41('0x44')]=qs[_0xaa41('0x45')](_[_0xaa41('0x46')](_0x4cdd42['query'],_0x1334c8[_0xaa41('0x45')]),_0x4fbb92);if(_0x4cdd42['query']['filter']){_0x2e785f[_0xaa41('0x44')]=_['merge'](_0x2e785f['where'],{'$or':_['map'](_0x4fbb92,function(_0x3bad48){if(_0x3bad48['type']!==_0xaa41('0x47')){var _0x198716={};_0x198716[_0x3bad48['name']]={'$like':'%'+_0x4cdd42['query'][_0xaa41('0x48')]+'%'};return _0x198716;}})});}_0x2e785f=_[_0xaa41('0x49')]({},_0x2e785f,_0x4cdd42[_0xaa41('0x4a')]);var _0x2af8ba={'where':_0x2e785f[_0xaa41('0x44')]};return db[_0xaa41('0x34')][_0xaa41('0x2b')](_0x2af8ba)[_0xaa41('0x1e')](function(_0x2fa6ec){_0x224eb3['count']=_0x2fa6ec;if(_0x4cdd42[_0xaa41('0x3a')][_0xaa41('0x4b')]){_0x2e785f[_0xaa41('0x4c')]=[{'all':!![]}];}return db[_0xaa41('0x34')][_0xaa41('0x4d')](_0x2e785f);})[_0xaa41('0x1e')](function(_0x538b12){_0x224eb3[_0xaa41('0x4e')]=_0x538b12;return _0x224eb3;})[_0xaa41('0x1e')](respondWithFilteredResult(_0x2dc05a,_0x2e785f))[_0xaa41('0x27')](handleError(_0x2dc05a,null));};exports[_0xaa41('0x4f')]=function(_0x57d1f6,_0x23bc61){var _0x5787f3={'raw':![],'where':{'id':_0x57d1f6[_0xaa41('0x50')]['id']}},_0x49fedd={};_0x49fedd[_0xaa41('0x39')]=_[_0xaa41('0x3b')](db['FreshdeskAccount'][_0xaa41('0x35')]);_0x49fedd[_0xaa41('0x3a')]=_[_0xaa41('0x3b')](_0x57d1f6['query']);_0x49fedd[_0xaa41('0x45')]=_[_0xaa41('0x3c')](_0x49fedd[_0xaa41('0x39')],_0x49fedd[_0xaa41('0x3a')]);_0x5787f3[_0xaa41('0x3e')]=_[_0xaa41('0x3c')](_0x49fedd[_0xaa41('0x39')],qs[_0xaa41('0x3d')](_0x57d1f6['query'][_0xaa41('0x3d')]));_0x5787f3['attributes']=_0x5787f3['attributes'][_0xaa41('0x3f')]?_0x5787f3[_0xaa41('0x3e')]:_0x49fedd[_0xaa41('0x39')];if(_0x57d1f6[_0xaa41('0x3a')][_0xaa41('0x4b')]){_0x5787f3[_0xaa41('0x4c')]=[{'all':!![]}];}_0x5787f3=_[_0xaa41('0x49')]({},_0x5787f3,_0x57d1f6[_0xaa41('0x4a')]);return db['FreshdeskAccount'][_0xaa41('0x51')](_0x5787f3)[_0xaa41('0x1e')](handleEntityNotFound(_0x23bc61,null))[_0xaa41('0x1e')](respondWithResult(_0x23bc61,null))['catch'](handleError(_0x23bc61,null));};exports[_0xaa41('0x52')]=function(_0x35f664,_0x4cf674){return db[_0xaa41('0x34')][_0xaa41('0x52')](_0x35f664[_0xaa41('0x53')],{})['then'](respondWithResult(_0x4cf674,0xc9))[_0xaa41('0x27')](handleError(_0x4cf674,null));};exports[_0xaa41('0x30')]=function(_0x4e3b13,_0x49789a){if(_0x4e3b13[_0xaa41('0x53')]['id']){delete _0x4e3b13[_0xaa41('0x53')]['id'];}return db[_0xaa41('0x34')]['find']({'where':{'id':_0x4e3b13[_0xaa41('0x50')]['id']}})[_0xaa41('0x1e')](handleEntityNotFound(_0x49789a,null))[_0xaa41('0x1e')](saveUpdates(_0x4e3b13[_0xaa41('0x53')],null))[_0xaa41('0x1e')](respondWithResult(_0x49789a,null))['catch'](handleError(_0x49789a,null));};exports[_0xaa41('0x31')]=function(_0x57cb70,_0x555186){return db[_0xaa41('0x34')]['find']({'where':{'id':_0x57cb70[_0xaa41('0x50')]['id']}})[_0xaa41('0x1e')](handleEntityNotFound(_0x555186,null))[_0xaa41('0x1e')](removeEntity(_0x555186,null))['catch'](handleError(_0x555186,null));};exports[_0xaa41('0x54')]=function(_0x41c7f4,_0x36154e,_0x857bbc){var _0xa1f9f9={};var _0x332a3c={};var _0xc56018;var _0x337059;return db[_0xaa41('0x34')]['findOne']({'where':{'id':_0x41c7f4[_0xaa41('0x50')]['id']}})[_0xaa41('0x1e')](handleEntityNotFound(_0x36154e,null))[_0xaa41('0x1e')](function(_0x5a5a55){if(_0x5a5a55){_0xc56018=_0x5a5a55;_0x332a3c[_0xaa41('0x39')]=_[_0xaa41('0x3b')](db[_0xaa41('0x55')][_0xaa41('0x35')]);_0x332a3c[_0xaa41('0x3a')]=_[_0xaa41('0x3b')](_0x41c7f4[_0xaa41('0x3a')]);_0x332a3c['filters']=_['intersection'](_0x332a3c['model'],_0x332a3c['query']);_0xa1f9f9['attributes']=_['intersection'](_0x332a3c[_0xaa41('0x39')],qs['fields'](_0x41c7f4['query'][_0xaa41('0x3d')]));_0xa1f9f9[_0xaa41('0x3e')]=_0xa1f9f9[_0xaa41('0x3e')][_0xaa41('0x3f')]?_0xa1f9f9['attributes']:_0x332a3c[_0xaa41('0x39')];_0xa1f9f9[_0xaa41('0x42')]=qs[_0xaa41('0x43')](_0x41c7f4[_0xaa41('0x3a')][_0xaa41('0x43')]);_0xa1f9f9[_0xaa41('0x44')]=qs[_0xaa41('0x45')](_[_0xaa41('0x46')](_0x41c7f4[_0xaa41('0x3a')],_0x332a3c['filters']));if(_0x41c7f4[_0xaa41('0x3a')][_0xaa41('0x48')]){_0xa1f9f9['where']=_['merge'](_0xa1f9f9['where'],{'$or':_[_0xaa41('0x56')](_0xa1f9f9['attributes'],function(_0x1eac4a){var _0x5c8028={};_0x5c8028[_0x1eac4a]={'$like':'%'+_0x41c7f4[_0xaa41('0x3a')][_0xaa41('0x48')]+'%'};return _0x5c8028;})});}_0xa1f9f9=_['merge']({},_0xa1f9f9,_0x41c7f4[_0xaa41('0x4a')]);return _0xc56018[_0xaa41('0x54')](_0xa1f9f9);}})[_0xaa41('0x1e')](function(_0x33f5c2){if(_0x33f5c2){_0x337059=_0x33f5c2['length'];if(!_0x41c7f4['query'][_0xaa41('0x40')](_0xaa41('0x41'))){_0xa1f9f9['limit']=qs['limit'](_0x41c7f4[_0xaa41('0x3a')][_0xaa41('0x2d')]);_0xa1f9f9[_0xaa41('0x2c')]=qs[_0xaa41('0x2c')](_0x41c7f4[_0xaa41('0x3a')]['offset']);}return _0xc56018[_0xaa41('0x54')](_0xa1f9f9);}})['then'](function(_0x5062db){if(_0x5062db){return _0x5062db?{'count':_0x337059,'rows':_0x5062db}:null;}})['then'](respondWithResult(_0x36154e,null))[_0xaa41('0x27')](handleError(_0x36154e,null));};exports[_0xaa41('0x57')]=function(_0x436362,_0x5bad74,_0x229297){if(_0x436362[_0xaa41('0x53')]['id']){delete _0x436362[_0xaa41('0x53')]['id'];}return db[_0xaa41('0x34')][_0xaa41('0x58')]({'where':{'id':_0x436362[_0xaa41('0x50')]['id']}})[_0xaa41('0x1e')](handleEntityNotFound(_0x5bad74,null))['then'](function(_0x1d2978){if(_0x1d2978){_0x436362[_0xaa41('0x53')][_0xaa41('0x59')]=_0x1d2978['id'];_0x436362[_0xaa41('0x53')]['Subjects']=integrations[_0xaa41('0x5a')](_0x436362['body'][_0xaa41('0x5b')],_0x436362[_0xaa41('0x53')][_0xaa41('0x37')]);_0x436362[_0xaa41('0x53')]['Descriptions']=integrations[_0xaa41('0x5c')](_0x436362[_0xaa41('0x53')][_0xaa41('0x5b')],_0x436362[_0xaa41('0x53')]['type']);return db[_0xaa41('0x55')]['create'](_0x436362[_0xaa41('0x53')],{'include':[{'model':db[_0xaa41('0x5d')],'as':'Subjects'},{'model':db[_0xaa41('0x5d')],'as':_0xaa41('0x5e')}]});}return null;})[_0xaa41('0x1e')](respondWithResult(_0x5bad74,null))[_0xaa41('0x27')](handleError(_0x5bad74,null));};exports[_0xaa41('0x5f')]=function(_0x1338d3,_0x384aba,_0x297ec6){var _0x33b5f4='';return db[_0xaa41('0x34')][_0xaa41('0x58')]({'where':{'id':_0x1338d3['params']['id']},'attributes':['id',_0xaa41('0x60'),_0xaa41('0x61')]})[_0xaa41('0x1e')](handleEntityNotFound(_0x384aba,null))['then'](function(_0x5ec19b){if(_0x5ec19b){_0x33b5f4=_0x5ec19b[_0xaa41('0x60')];var _0x39da69=_0x33b5f4['slice'](-0x1);if(_0x39da69==='/'){_0x33b5f4=_0x33b5f4[_0xaa41('0x62')](0x0,_0x33b5f4[_0xaa41('0x63')](_0x39da69));}return rp({'method':'GET','uri':util[_0xaa41('0x64')](_0xaa41('0x65'),_0x33b5f4,_0xaa41('0x66')),'headers':{'Authorization':util[_0xaa41('0x64')](_0xaa41('0x67'),new Buffer(util[_0xaa41('0x64')](_0xaa41('0x68'),_0x5ec19b[_0xaa41('0x61')]))['toString']('base64'))},'json':!![]});}})[_0xaa41('0x1e')](function(_0x481db9){if(_0x481db9){var _0x654594=[_0xaa41('0x69'),_0xaa41('0x6a'),'agent',_0xaa41('0x6b'),_0xaa41('0x29'),_0xaa41('0x6c'),'group',_0xaa41('0x6d'),_0xaa41('0x6e'),'group',_0xaa41('0x6f')];_['remove'](_0x481db9,function(_0x53faf4){return _0x654594[_0xaa41('0x70')](_0x53faf4[_0xaa41('0x33')])||!_0x53faf4['default']&&_0x53faf4['type']!==_0xaa41('0x71')&&_0x53faf4[_0xaa41('0x37')]!==_0xaa41('0x72');});return{'count':_0x481db9[_0xaa41('0x3f')],'rows':_['map'](_0x481db9,function(_0x9741a8){return{'id':_0x9741a8[_0xaa41('0x33')],'name':_0x9741a8[_0xaa41('0x73')],'custom':!_0x9741a8['default'],'options':_0x9741a8[_0xaa41('0x74')]?_[_0xaa41('0x56')](_0x9741a8[_0xaa41('0x74')],function(_0x5697b6){return{'name':_[_0xaa41('0x75')](_0x5697b6),'value':_0x5697b6};}):[]};})};}})['then'](respondWithResult(_0x384aba,null))['catch'](function(_0x364d24){var _0x25c4d0=_0x1338d3['query'][_0xaa41('0x76')]?0x1f4:_0x364d24[_0xaa41('0x77')]||0x1f4;logger[_0xaa41('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0xaa41('0x5f'),_0x25c4d0,JSON[_0xaa41('0x23')](_0x364d24));delete _0x364d24[_0xaa41('0x33')];if(_0x25c4d0===0x191){_0x25c4d0=0x190;}_0x384aba[_0xaa41('0x29')](_0x25c4d0)[_0xaa41('0x78')](_0x1338d3['query'][_0xaa41('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x364d24[_0xaa41('0x77')]}:_0x364d24);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index be1fa09..6d9ff6a 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 _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 +var _0x14a6=['./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0xf40d11,_0xb4dd63){var _0x2c21c8=function(_0x14a2cc){while(--_0x14a2cc){_0xf40d11['push'](_0xf40d11['shift']());}};_0x2c21c8(++_0xb4dd63);}(_0x14a6,0x6f));var _0x614a=function(_0xf20b6,_0x49ddbb){_0xf20b6=_0xf20b6-0x0;var _0x4ff567=_0x14a6[_0xf20b6];return _0x4ff567;};'use strict';var _=require(_0x614a('0x0'));var util=require(_0x614a('0x1'));var logger=require(_0x614a('0x2'))(_0x614a('0x3'));var moment=require(_0x614a('0x4'));var BPromise=require(_0x614a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x614a('0x6'));var rimraf=require(_0x614a('0x7'));var config=require(_0x614a('0x8'));var attributes=require(_0x614a('0x9'));var integrations=require(_0x614a('0xa'));module[_0x614a('0xb')]=function(_0x2ba9c2,_0x2ae876){return _0x2ba9c2[_0x614a('0xc')](_0x614a('0xd'),attributes,{'tableName':_0x614a('0xe'),'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 13c2c4a..945fa1f 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 _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 +var _0x3236=['../../config/utils','../../config/logger','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x39d83b,_0x1d8565){var _0x33a3d8=function(_0x51f039){while(--_0x51f039){_0x39d83b['push'](_0x39d83b['shift']());}};_0x33a3d8(++_0x1d8565);}(_0x3236,0xc0));var _0x6323=function(_0x1a126b,_0x200dca){_0x1a126b=_0x1a126b-0x0;var _0x3ef243=_0x3236[_0x1a126b];return _0x3ef243;};'use strict';var _=require(_0x6323('0x0'));var util=require(_0x6323('0x1'));var moment=require(_0x6323('0x2'));var BPromise=require(_0x6323('0x3'));var rs=require(_0x6323('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6323('0x5'))['db'];var utils=require(_0x6323('0x6'));var logger=require(_0x6323('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6323('0x8')][_0x6323('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30ddfc,_0x22c73e,_0x8913f9){return new BPromise(function(_0xd71fca,_0x4298a5){return client['request'](_0x30ddfc,_0x8913f9)[_0x6323('0xa')](function(_0xbfb7d2){logger[_0x6323('0xb')](_0x6323('0xc'),_0x22c73e,'request\x20sent');logger[_0x6323('0xd')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x22c73e,_0x6323('0xe'),JSON[_0x6323('0xf')](_0xbfb7d2));if(_0xbfb7d2['error']){if(_0xbfb7d2[_0x6323('0x10')]['code']===0x1f4){logger[_0x6323('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x22c73e,_0xbfb7d2['error'][_0x6323('0x11')]);return _0x4298a5(_0xbfb7d2['error'][_0x6323('0x11')]);}logger[_0x6323('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x22c73e,_0xbfb7d2[_0x6323('0x10')][_0x6323('0x11')]);return _0xd71fca(_0xbfb7d2[_0x6323('0x10')][_0x6323('0x11')]);}else{logger[_0x6323('0xb')](_0x6323('0xc'),_0x22c73e,_0x6323('0xe'));_0xd71fca(_0xbfb7d2[_0x6323('0x12')][_0x6323('0x11')]);}})['catch'](function(_0x367f1c){logger[_0x6323('0x10')](_0x6323('0xc'),_0x22c73e,_0x367f1c);_0x4298a5(_0x367f1c);});});}exports[_0x6323('0x13')]=function(_0x27ad83){var _0x435956=this;return new Promise(function(_0x51b5f0,_0x446eb6){return db[_0x6323('0x14')][_0x6323('0x15')]({'raw':_0x27ad83[_0x6323('0x16')]?_0x27ad83[_0x6323('0x16')][_0x6323('0x17')]===undefined?!![]:![]:!![],'where':_0x27ad83['options']?_0x27ad83[_0x6323('0x16')][_0x6323('0x18')]||null:null,'attributes':_0x27ad83[_0x6323('0x16')]?_0x27ad83[_0x6323('0x16')][_0x6323('0x19')]||null:null,'limit':_0x27ad83[_0x6323('0x16')]?_0x27ad83[_0x6323('0x16')][_0x6323('0x1a')]||null:null,'include':_0x27ad83[_0x6323('0x16')]?_0x27ad83[_0x6323('0x16')][_0x6323('0x1b')]?_[_0x6323('0x1c')](_0x27ad83[_0x6323('0x16')][_0x6323('0x1b')],function(_0x165114){return{'model':db[_0x165114[_0x6323('0x1d')]],'as':_0x165114['as'],'attributes':_0x165114[_0x6323('0x19')],'include':_0x165114[_0x6323('0x1b')]?_[_0x6323('0x1c')](_0x165114[_0x6323('0x1b')],function(_0x327bcd){return{'model':db[_0x327bcd['model']],'as':_0x327bcd['as'],'attributes':_0x327bcd[_0x6323('0x19')],'include':_0x327bcd[_0x6323('0x1b')]?_[_0x6323('0x1c')](_0x327bcd[_0x6323('0x1b')],function(_0x46beba){return{'model':db[_0x46beba['model']],'as':_0x46beba['as'],'attributes':_0x46beba[_0x6323('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4aadf5){logger[_0x6323('0xb')](_0x6323('0x13'),_0x27ad83);logger[_0x6323('0xd')](_0x6323('0x13'),_0x27ad83,JSON['stringify'](_0x4aadf5));_0x51b5f0(_0x4aadf5);})[_0x6323('0x1e')](function(_0x5d410a){logger[_0x6323('0x10')](_0x6323('0x13'),_0x5d410a[_0x6323('0x11')],_0x27ad83);_0x446eb6(_0x435956[_0x6323('0x10')](0x1f4,_0x5d410a['message']));});});};exports[_0x6323('0x1f')]=function(_0x4b8848){var _0x317866=this;return new Promise(function(_0x93185c,_0x25d21d){return db[_0x6323('0x14')][_0x6323('0x20')]({'raw':_0x4b8848[_0x6323('0x16')]?_0x4b8848[_0x6323('0x16')][_0x6323('0x17')]===undefined?!![]:![]:!![],'where':_0x4b8848['options']?_0x4b8848[_0x6323('0x16')]['where']||null:null,'attributes':_0x4b8848[_0x6323('0x16')]?_0x4b8848[_0x6323('0x16')][_0x6323('0x19')]||null:null,'include':_0x4b8848[_0x6323('0x16')]?_0x4b8848[_0x6323('0x16')]['include']?_[_0x6323('0x1c')](_0x4b8848[_0x6323('0x16')][_0x6323('0x1b')],function(_0xd06fd4){return{'model':db[_0xd06fd4[_0x6323('0x1d')]],'as':_0xd06fd4['as'],'attributes':_0xd06fd4['attributes'],'include':_0xd06fd4[_0x6323('0x1b')]?_[_0x6323('0x1c')](_0xd06fd4[_0x6323('0x1b')],function(_0x5e9a58){return{'model':db[_0x5e9a58[_0x6323('0x1d')]],'as':_0x5e9a58['as'],'attributes':_0x5e9a58[_0x6323('0x19')],'include':_0x5e9a58[_0x6323('0x1b')]?_[_0x6323('0x1c')](_0x5e9a58[_0x6323('0x1b')],function(_0x59c044){return{'model':db[_0x59c044[_0x6323('0x1d')]],'as':_0x59c044['as'],'attributes':_0x59c044[_0x6323('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6323('0xa')](function(_0x366785){logger[_0x6323('0xb')]('ShowFreshdeskAccount',_0x4b8848);logger[_0x6323('0xd')](_0x6323('0x1f'),_0x4b8848,JSON[_0x6323('0xf')](_0x366785));_0x93185c(_0x366785);})['catch'](function(_0x2c3505){logger['error']('ShowFreshdeskAccount',_0x2c3505[_0x6323('0x11')],_0x4b8848);_0x25d21d(_0x317866['error'](0x1f4,_0x2c3505[_0x6323('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 588b7ee..c28c70f 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 _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 +var _0x45f9=['/:id/descriptions','getTags','post','put','update','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x156913,_0x2700bc){var _0x3781aa=function(_0x594527){while(--_0x594527){_0x156913['push'](_0x156913['shift']());}};_0x3781aa(++_0x2700bc);}(_0x45f9,0x79));var _0x945f=function(_0x22d210,_0x2c1dfc){_0x22d210=_0x22d210-0x0;var _0x394e97=_0x45f9[_0x22d210];return _0x394e97;};'use strict';var multer=require(_0x945f('0x0'));var util=require(_0x945f('0x1'));var path=require(_0x945f('0x2'));var timeout=require(_0x945f('0x3'));var express=require(_0x945f('0x4'));var router=express['Router']();var auth=require(_0x945f('0x5'));var interaction=require(_0x945f('0x6'));var config=require(_0x945f('0x7'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x945f('0x8')]('/',auth[_0x945f('0x9')](),controller[_0x945f('0xa')]);router[_0x945f('0x8')](_0x945f('0xb'),auth[_0x945f('0x9')](),controller[_0x945f('0xc')]);router['get'](_0x945f('0xd'),auth[_0x945f('0x9')](),controller[_0x945f('0xe')]);router['get'](_0x945f('0xf'),auth[_0x945f('0x9')](),controller[_0x945f('0x10')]);router['get'](_0x945f('0x11'),auth[_0x945f('0x9')](),controller['getDescriptions']);router['get']('/:id/tags',auth[_0x945f('0x9')](),controller[_0x945f('0x12')]);router[_0x945f('0x13')]('/',auth[_0x945f('0x9')](),controller['create']);router[_0x945f('0x13')]('/:id/tags',auth[_0x945f('0x9')](),controller['setTags']);router[_0x945f('0x14')](_0x945f('0xb'),auth[_0x945f('0x9')](),controller[_0x945f('0x15')]);router[_0x945f('0x16')](_0x945f('0xb'),auth[_0x945f('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 50e796c..3e7f526 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 _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 +var _0x1cfe=['STRING'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0x1cfe,0x1f1));var _0xe1cf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x1cfe[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe1cf('0x0')]},'description':{'type':Sequelize[_0xe1cf('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index ee90470..140b08c 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 _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 +var _0x7b4c=['../../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','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','catch','status','end','json','count','offset','set','Content-Range','apply','reject','update','sendStatus','stack','name','send','index','fieldName','key','model','map','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','sort','pick','filter','merge','where','VIRTUAL','options','FreshdeskConfiguration','includeAll','include','findAll','rows','show','params','length','find','create','body','destroy','getFields','findOne','order','getSubjects','FreshdeskField','rawAttributes','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x20b30f,_0x1a44f4){var _0x3fbda1=function(_0x19d504){while(--_0x19d504){_0x20b30f['push'](_0x20b30f['shift']());}};_0x3fbda1(++_0x1a44f4);}(_0x7b4c,0x1dc));var _0xc7b4=function(_0x340a89,_0x485978){_0x340a89=_0x340a89-0x0;var _0x598a4e=_0x7b4c[_0x340a89];return _0x598a4e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc7b4('0x0'));var rimraf=require(_0xc7b4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc7b4('0x2'));var rp=require(_0xc7b4('0x3'));var moment=require(_0xc7b4('0x4'));var BPromise=require(_0xc7b4('0x5'));var Mustache=require(_0xc7b4('0x6'));var util=require(_0xc7b4('0x7'));var path=require('path');var sox=require(_0xc7b4('0x8'));var csv=require(_0xc7b4('0x9'));var ejs=require(_0xc7b4('0xa'));var fs=require('fs');var _=require(_0xc7b4('0xb'));var squel=require('squel');var crypto=require(_0xc7b4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc7b4('0xd'));var toCsv=require(_0xc7b4('0x9'));var querystring=require(_0xc7b4('0xe'));var Papa=require(_0xc7b4('0xf'));var Redis=require(_0xc7b4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc7b4('0x11'));var as=require(_0xc7b4('0x12'));var hardwareService=require(_0xc7b4('0x13'));var logger=require(_0xc7b4('0x14'))(_0xc7b4('0x15'));var utils=require(_0xc7b4('0x16'));var config=require(_0xc7b4('0x17'));var db=require(_0xc7b4('0x18'))['db'];var jayson=require(_0xc7b4('0x19'));var client=jayson[_0xc7b4('0x1a')][_0xc7b4('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x270364,_0x4816ec,_0x12c888){if(_0x12c888){var _0x16f85f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x16f85f[_0xc7b4('0x1c')](_0x4816ec)){return _0x270364;}else{throw new db[(_0xc7b4('0x1d'))][(_0xc7b4('0x1e'))](_0xc7b4('0x1f'));}}else{return _0x270364;}}function respondWithRpcPromise(_0x38f781,_0x4fd0ad,_0x348d57,_0x4465a6){return new BPromise(function(_0x14e753,_0x44fb17){var _0x46ba76=_0x4465a6||client;return _0x46ba76[_0xc7b4('0x20')](_0x38f781,_0x348d57)[_0xc7b4('0x21')](function(_0x4b7433){logger[_0xc7b4('0x22')](_0xc7b4('0x23'),_0x4fd0ad,_0xc7b4('0x24'));logger[_0xc7b4('0x25')](_0xc7b4('0x26'),_0x4fd0ad,_0xc7b4('0x24'),JSON['stringify'](_0x4b7433));if(_0x4b7433[_0xc7b4('0x27')]){if(_0x4b7433[_0xc7b4('0x27')]['code']===0x1f4){logger[_0xc7b4('0x27')](_0xc7b4('0x23'),_0x4fd0ad,_0x4b7433['error'][_0xc7b4('0x28')]);return _0x44fb17(_0x4b7433[_0xc7b4('0x27')][_0xc7b4('0x28')]);}logger[_0xc7b4('0x27')](_0xc7b4('0x23'),_0x4fd0ad,_0x4b7433[_0xc7b4('0x27')]['message']);return _0x14e753(_0x4b7433[_0xc7b4('0x27')]['message']);}else{logger[_0xc7b4('0x22')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4fd0ad,_0xc7b4('0x24'));_0x14e753(_0x4b7433['result']['message']);}})[_0xc7b4('0x29')](function(_0x22045){logger['error'](_0xc7b4('0x23'),_0x4fd0ad,_0x22045);_0x44fb17(_0x22045);});});}function respondWithStatusCode(_0x5936a6,_0x169cf2){_0x169cf2=_0x169cf2||0xcc;return function(_0x274374){if(_0x274374){return _0x5936a6['sendStatus'](_0x169cf2);}return _0x5936a6[_0xc7b4('0x2a')](_0x169cf2)[_0xc7b4('0x2b')]();};}function respondWithResult(_0x1fcb34,_0x56c2ea){_0x56c2ea=_0x56c2ea||0xc8;return function(_0x860c57){if(_0x860c57){return _0x1fcb34[_0xc7b4('0x2a')](_0x56c2ea)[_0xc7b4('0x2c')](_0x860c57);}};}function respondWithFilteredResult(_0xb8ad13,_0x5b8ca6){return function(_0x3c6fcf){if(_0x3c6fcf){var _0x12d4e5=_0x3c6fcf[_0xc7b4('0x2d')],_0x17b935=_0x5b8ca6[_0xc7b4('0x2e')],_0xd86062=_0x5b8ca6[_0xc7b4('0x2e')]+_0x5b8ca6['limit'],_0x2e6e4f;if(_0xd86062>=_0x12d4e5){_0xd86062=_0x12d4e5;_0x2e6e4f=0xc8;}else{_0x2e6e4f=0xce;}_0xb8ad13[_0xc7b4('0x2a')](_0x2e6e4f);return _0xb8ad13[_0xc7b4('0x2f')](_0xc7b4('0x30'),_0x17b935+'-'+_0xd86062+'/'+_0x12d4e5)[_0xc7b4('0x2c')](_0x3c6fcf);}return null;};}function patchUpdates(_0x1ceda1){return function(_0x2caf57){try{jsonpatch[_0xc7b4('0x31')](_0x2caf57,_0x1ceda1,!![]);}catch(_0x568b6){return BPromise[_0xc7b4('0x32')](_0x568b6);}return _0x2caf57['save']();};}function saveUpdates(_0x3009b5,_0x46c336){return function(_0x18d88f){if(_0x18d88f){return _0x18d88f[_0xc7b4('0x33')](_0x3009b5)['then'](function(_0x4ae0ce){return _0x4ae0ce;});}return null;};}function removeEntity(_0x30231f,_0x1bd5ed){return function(_0x3d510e){if(_0x3d510e){return _0x3d510e['destroy']()[_0xc7b4('0x21')](function(){_0x30231f[_0xc7b4('0x2a')](0xcc)[_0xc7b4('0x2b')]();});}};}function handleEntityNotFound(_0x575191,_0x3bed31){return function(_0x3066d6){if(!_0x3066d6){_0x575191[_0xc7b4('0x34')](0x194);}return _0x3066d6;};}function handleError(_0x34956e,_0x540ac7){_0x540ac7=_0x540ac7||0x1f4;return function(_0x24d671){logger[_0xc7b4('0x27')](_0x24d671[_0xc7b4('0x35')]);if(_0x24d671[_0xc7b4('0x36')]){delete _0x24d671[_0xc7b4('0x36')];}_0x34956e[_0xc7b4('0x2a')](_0x540ac7)[_0xc7b4('0x37')](_0x24d671);};}exports[_0xc7b4('0x38')]=function(_0x42cfce,_0x47f888){var _0x216d50={},_0x188e50={},_0x578957={'count':0x0,'rows':[]};var _0x2652d2=_['map'](db['FreshdeskConfiguration']['rawAttributes'],function(_0x271396){return{'name':_0x271396[_0xc7b4('0x39')],'type':_0x271396['type'][_0xc7b4('0x3a')]};});_0x188e50[_0xc7b4('0x3b')]=_[_0xc7b4('0x3c')](_0x2652d2,_0xc7b4('0x36'));_0x188e50['query']=_[_0xc7b4('0x3d')](_0x42cfce[_0xc7b4('0x3e')]);_0x188e50[_0xc7b4('0x3f')]=_['intersection'](_0x188e50['model'],_0x188e50[_0xc7b4('0x3e')]);_0x216d50[_0xc7b4('0x40')]=_[_0xc7b4('0x41')](_0x188e50[_0xc7b4('0x3b')],qs[_0xc7b4('0x42')](_0x42cfce[_0xc7b4('0x3e')][_0xc7b4('0x42')]));_0x216d50[_0xc7b4('0x40')]=_0x216d50['attributes']['length']?_0x216d50[_0xc7b4('0x40')]:_0x188e50[_0xc7b4('0x3b')];if(!_0x42cfce[_0xc7b4('0x3e')][_0xc7b4('0x43')](_0xc7b4('0x44'))){_0x216d50['limit']=qs['limit'](_0x42cfce[_0xc7b4('0x3e')][_0xc7b4('0x45')]);_0x216d50[_0xc7b4('0x2e')]=qs[_0xc7b4('0x2e')](_0x42cfce[_0xc7b4('0x3e')]['offset']);}_0x216d50['order']=qs['sort'](_0x42cfce[_0xc7b4('0x3e')][_0xc7b4('0x46')]);_0x216d50['where']=qs[_0xc7b4('0x3f')](_[_0xc7b4('0x47')](_0x42cfce['query'],_0x188e50[_0xc7b4('0x3f')]),_0x2652d2);if(_0x42cfce[_0xc7b4('0x3e')][_0xc7b4('0x48')]){_0x216d50['where']=_[_0xc7b4('0x49')](_0x216d50[_0xc7b4('0x4a')],{'$or':_[_0xc7b4('0x3c')](_0x2652d2,function(_0x437886){if(_0x437886['type']!==_0xc7b4('0x4b')){var _0x7fb738={};_0x7fb738[_0x437886['name']]={'$like':'%'+_0x42cfce[_0xc7b4('0x3e')][_0xc7b4('0x48')]+'%'};return _0x7fb738;}})});}_0x216d50=_[_0xc7b4('0x49')]({},_0x216d50,_0x42cfce[_0xc7b4('0x4c')]);var _0x5af25c={'where':_0x216d50['where']};return db[_0xc7b4('0x4d')]['count'](_0x5af25c)['then'](function(_0x5e57d0){_0x578957[_0xc7b4('0x2d')]=_0x5e57d0;if(_0x42cfce[_0xc7b4('0x3e')][_0xc7b4('0x4e')]){_0x216d50[_0xc7b4('0x4f')]=[{'all':!![]}];}return db[_0xc7b4('0x4d')][_0xc7b4('0x50')](_0x216d50);})['then'](function(_0x3d0508){_0x578957[_0xc7b4('0x51')]=_0x3d0508;return _0x578957;})[_0xc7b4('0x21')](respondWithFilteredResult(_0x47f888,_0x216d50))['catch'](handleError(_0x47f888,null));};exports[_0xc7b4('0x52')]=function(_0x4b9f30,_0x37c3d9){var _0x29e679={'raw':![],'where':{'id':_0x4b9f30[_0xc7b4('0x53')]['id']}},_0x4b1da3={};_0x4b1da3[_0xc7b4('0x3b')]=_[_0xc7b4('0x3d')](db['FreshdeskConfiguration']['rawAttributes']);_0x4b1da3[_0xc7b4('0x3e')]=_[_0xc7b4('0x3d')](_0x4b9f30['query']);_0x4b1da3[_0xc7b4('0x3f')]=_['intersection'](_0x4b1da3[_0xc7b4('0x3b')],_0x4b1da3[_0xc7b4('0x3e')]);_0x29e679[_0xc7b4('0x40')]=_[_0xc7b4('0x41')](_0x4b1da3[_0xc7b4('0x3b')],qs['fields'](_0x4b9f30['query'][_0xc7b4('0x42')]));_0x29e679['attributes']=_0x29e679[_0xc7b4('0x40')][_0xc7b4('0x54')]?_0x29e679[_0xc7b4('0x40')]:_0x4b1da3['model'];if(_0x4b9f30[_0xc7b4('0x3e')][_0xc7b4('0x4e')]){_0x29e679[_0xc7b4('0x4f')]=[{'all':!![]}];}_0x29e679=_[_0xc7b4('0x49')]({},_0x29e679,_0x4b9f30[_0xc7b4('0x4c')]);return db['FreshdeskConfiguration'][_0xc7b4('0x55')](_0x29e679)['then'](handleEntityNotFound(_0x37c3d9,null))['then'](respondWithResult(_0x37c3d9,null))[_0xc7b4('0x29')](handleError(_0x37c3d9,null));};exports['create']=function(_0x20e1ad,_0xd3337a){return db[_0xc7b4('0x4d')][_0xc7b4('0x56')](_0x20e1ad['body'],{})[_0xc7b4('0x21')](respondWithResult(_0xd3337a,0xc9))['catch'](handleError(_0xd3337a,null));};exports[_0xc7b4('0x33')]=function(_0x435e53,_0x2c7eb1){if(_0x435e53[_0xc7b4('0x57')]['id']){delete _0x435e53[_0xc7b4('0x57')]['id'];}return db[_0xc7b4('0x4d')][_0xc7b4('0x55')]({'where':{'id':_0x435e53[_0xc7b4('0x53')]['id']}})[_0xc7b4('0x21')](handleEntityNotFound(_0x2c7eb1,null))['then'](saveUpdates(_0x435e53['body'],null))[_0xc7b4('0x21')](respondWithResult(_0x2c7eb1,null))[_0xc7b4('0x29')](handleError(_0x2c7eb1,null));};exports[_0xc7b4('0x58')]=function(_0x321162,_0x45cac8){return db[_0xc7b4('0x4d')][_0xc7b4('0x55')]({'where':{'id':_0x321162[_0xc7b4('0x53')]['id']}})[_0xc7b4('0x21')](handleEntityNotFound(_0x45cac8,null))[_0xc7b4('0x21')](removeEntity(_0x45cac8,null))[_0xc7b4('0x29')](handleError(_0x45cac8,null));};exports[_0xc7b4('0x59')]=function(_0x154ed8,_0x47b1bb,_0x19352a){var _0x2c9ac9={};var _0x54cc99={};var _0x361d62;var _0xd6d004;return db[_0xc7b4('0x4d')][_0xc7b4('0x5a')]({'where':{'id':_0x154ed8[_0xc7b4('0x53')]['id']}})[_0xc7b4('0x21')](handleEntityNotFound(_0x47b1bb,null))['then'](function(_0x3f9590){if(_0x3f9590){_0x361d62=_0x3f9590;_0x54cc99['model']=_['keys'](db['FreshdeskField']['rawAttributes']);_0x54cc99[_0xc7b4('0x3e')]=_[_0xc7b4('0x3d')](_0x154ed8[_0xc7b4('0x3e')]);_0x54cc99[_0xc7b4('0x3f')]=_[_0xc7b4('0x41')](_0x54cc99[_0xc7b4('0x3b')],_0x54cc99[_0xc7b4('0x3e')]);_0x2c9ac9[_0xc7b4('0x40')]=_[_0xc7b4('0x41')](_0x54cc99[_0xc7b4('0x3b')],qs[_0xc7b4('0x42')](_0x154ed8[_0xc7b4('0x3e')]['fields']));_0x2c9ac9[_0xc7b4('0x40')]=_0x2c9ac9['attributes'][_0xc7b4('0x54')]?_0x2c9ac9[_0xc7b4('0x40')]:_0x54cc99['model'];_0x2c9ac9[_0xc7b4('0x5b')]=qs[_0xc7b4('0x46')](_0x154ed8[_0xc7b4('0x3e')][_0xc7b4('0x46')]);_0x2c9ac9[_0xc7b4('0x4a')]=qs[_0xc7b4('0x3f')](_[_0xc7b4('0x47')](_0x154ed8['query'],_0x54cc99['filters']));if(_0x154ed8['query'][_0xc7b4('0x48')]){_0x2c9ac9[_0xc7b4('0x4a')]=_[_0xc7b4('0x49')](_0x2c9ac9[_0xc7b4('0x4a')],{'$or':_[_0xc7b4('0x3c')](_0x2c9ac9[_0xc7b4('0x40')],function(_0x47e5fc){var _0x4a65db={};_0x4a65db[_0x47e5fc]={'$like':'%'+_0x154ed8[_0xc7b4('0x3e')][_0xc7b4('0x48')]+'%'};return _0x4a65db;})});}_0x2c9ac9=_[_0xc7b4('0x49')]({},_0x2c9ac9,_0x154ed8[_0xc7b4('0x4c')]);return _0x361d62[_0xc7b4('0x59')](_0x2c9ac9);}})[_0xc7b4('0x21')](function(_0x354db8){if(_0x354db8){_0xd6d004=_0x354db8[_0xc7b4('0x54')];if(!_0x154ed8[_0xc7b4('0x3e')][_0xc7b4('0x43')](_0xc7b4('0x44'))){_0x2c9ac9['limit']=qs[_0xc7b4('0x45')](_0x154ed8[_0xc7b4('0x3e')][_0xc7b4('0x45')]);_0x2c9ac9[_0xc7b4('0x2e')]=qs['offset'](_0x154ed8['query'][_0xc7b4('0x2e')]);}return _0x361d62[_0xc7b4('0x59')](_0x2c9ac9);}})[_0xc7b4('0x21')](function(_0x47ceda){if(_0x47ceda){return _0x47ceda?{'count':_0xd6d004,'rows':_0x47ceda}:null;}})['then'](respondWithResult(_0x47b1bb,null))[_0xc7b4('0x29')](handleError(_0x47b1bb,null));};exports[_0xc7b4('0x5c')]=function(_0x2759ad,_0x589a0a,_0x35af34){var _0x4f379b={};var _0x5af8d5={};var _0x17aeb6;var _0x158b1e;return db[_0xc7b4('0x4d')][_0xc7b4('0x5a')]({'where':{'id':_0x2759ad['params']['id']}})['then'](handleEntityNotFound(_0x589a0a,null))[_0xc7b4('0x21')](function(_0x5772ea){if(_0x5772ea){_0x17aeb6=_0x5772ea;_0x5af8d5[_0xc7b4('0x3b')]=_[_0xc7b4('0x3d')](db[_0xc7b4('0x5d')][_0xc7b4('0x5e')]);_0x5af8d5['query']=_[_0xc7b4('0x3d')](_0x2759ad['query']);_0x5af8d5['filters']=_[_0xc7b4('0x41')](_0x5af8d5[_0xc7b4('0x3b')],_0x5af8d5['query']);_0x4f379b[_0xc7b4('0x40')]=_[_0xc7b4('0x41')](_0x5af8d5['model'],qs[_0xc7b4('0x42')](_0x2759ad['query'][_0xc7b4('0x42')]));_0x4f379b[_0xc7b4('0x40')]=_0x4f379b[_0xc7b4('0x40')][_0xc7b4('0x54')]?_0x4f379b[_0xc7b4('0x40')]:_0x5af8d5['model'];_0x4f379b[_0xc7b4('0x5b')]=qs[_0xc7b4('0x46')](_0x2759ad[_0xc7b4('0x3e')][_0xc7b4('0x46')]);_0x4f379b[_0xc7b4('0x4a')]=qs[_0xc7b4('0x3f')](_[_0xc7b4('0x47')](_0x2759ad[_0xc7b4('0x3e')],_0x5af8d5['filters']));if(_0x2759ad[_0xc7b4('0x3e')][_0xc7b4('0x48')]){_0x4f379b[_0xc7b4('0x4a')]=_[_0xc7b4('0x49')](_0x4f379b[_0xc7b4('0x4a')],{'$or':_[_0xc7b4('0x3c')](_0x4f379b[_0xc7b4('0x40')],function(_0x40d9d2){var _0x3b365a={};_0x3b365a[_0x40d9d2]={'$like':'%'+_0x2759ad[_0xc7b4('0x3e')]['filter']+'%'};return _0x3b365a;})});}_0x4f379b=_[_0xc7b4('0x49')]({},_0x4f379b,_0x2759ad['options']);return _0x17aeb6['getSubjects'](_0x4f379b);}})['then'](function(_0x47fe98){if(_0x47fe98){_0x158b1e=_0x47fe98[_0xc7b4('0x54')];if(!_0x2759ad[_0xc7b4('0x3e')][_0xc7b4('0x43')](_0xc7b4('0x44'))){_0x4f379b[_0xc7b4('0x45')]=qs[_0xc7b4('0x45')](_0x2759ad[_0xc7b4('0x3e')][_0xc7b4('0x45')]);_0x4f379b[_0xc7b4('0x2e')]=qs[_0xc7b4('0x2e')](_0x2759ad[_0xc7b4('0x3e')][_0xc7b4('0x2e')]);}return _0x17aeb6[_0xc7b4('0x5c')](_0x4f379b);}})['then'](function(_0x3f038d){if(_0x3f038d){return _0x3f038d?{'count':_0x158b1e,'rows':_0x3f038d}:null;}})['then'](respondWithResult(_0x589a0a,null))[_0xc7b4('0x29')](handleError(_0x589a0a,null));};exports[_0xc7b4('0x5f')]=function(_0x3b863f,_0x14f22c,_0x3064d1){var _0x475e7e={};var _0x931c53={};var _0x41d3b5;var _0x11e126;return db[_0xc7b4('0x4d')]['findOne']({'where':{'id':_0x3b863f['params']['id']}})[_0xc7b4('0x21')](handleEntityNotFound(_0x14f22c,null))[_0xc7b4('0x21')](function(_0x135c46){if(_0x135c46){_0x41d3b5=_0x135c46;_0x931c53['model']=_[_0xc7b4('0x3d')](db[_0xc7b4('0x5d')][_0xc7b4('0x5e')]);_0x931c53['query']=_[_0xc7b4('0x3d')](_0x3b863f['query']);_0x931c53[_0xc7b4('0x3f')]=_[_0xc7b4('0x41')](_0x931c53[_0xc7b4('0x3b')],_0x931c53['query']);_0x475e7e[_0xc7b4('0x40')]=_['intersection'](_0x931c53[_0xc7b4('0x3b')],qs['fields'](_0x3b863f[_0xc7b4('0x3e')]['fields']));_0x475e7e[_0xc7b4('0x40')]=_0x475e7e['attributes']['length']?_0x475e7e[_0xc7b4('0x40')]:_0x931c53[_0xc7b4('0x3b')];_0x475e7e['order']=qs[_0xc7b4('0x46')](_0x3b863f[_0xc7b4('0x3e')][_0xc7b4('0x46')]);_0x475e7e['where']=qs[_0xc7b4('0x3f')](_[_0xc7b4('0x47')](_0x3b863f[_0xc7b4('0x3e')],_0x931c53[_0xc7b4('0x3f')]));if(_0x3b863f[_0xc7b4('0x3e')][_0xc7b4('0x48')]){_0x475e7e['where']=_[_0xc7b4('0x49')](_0x475e7e[_0xc7b4('0x4a')],{'$or':_[_0xc7b4('0x3c')](_0x475e7e[_0xc7b4('0x40')],function(_0x353d2a){var _0x288e39={};_0x288e39[_0x353d2a]={'$like':'%'+_0x3b863f[_0xc7b4('0x3e')][_0xc7b4('0x48')]+'%'};return _0x288e39;})});}_0x475e7e=_[_0xc7b4('0x49')]({},_0x475e7e,_0x3b863f[_0xc7b4('0x4c')]);return _0x41d3b5[_0xc7b4('0x5f')](_0x475e7e);}})['then'](function(_0x16433e){if(_0x16433e){_0x11e126=_0x16433e[_0xc7b4('0x54')];if(!_0x3b863f['query'][_0xc7b4('0x43')]('nolimit')){_0x475e7e[_0xc7b4('0x45')]=qs[_0xc7b4('0x45')](_0x3b863f[_0xc7b4('0x3e')][_0xc7b4('0x45')]);_0x475e7e[_0xc7b4('0x2e')]=qs[_0xc7b4('0x2e')](_0x3b863f['query']['offset']);}return _0x41d3b5[_0xc7b4('0x5f')](_0x475e7e);}})[_0xc7b4('0x21')](function(_0x79f528){if(_0x79f528){return _0x79f528?{'count':_0x11e126,'rows':_0x79f528}:null;}})[_0xc7b4('0x21')](respondWithResult(_0x14f22c,null))[_0xc7b4('0x29')](handleError(_0x14f22c,null));};exports[_0xc7b4('0x60')]=function(_0x16dd04,_0x46031c,_0x38a99e){var _0xf77b1c={};var _0x48b849={};var _0x5a0830;var _0x1e71ba;return db['FreshdeskConfiguration'][_0xc7b4('0x5a')]({'where':{'id':_0x16dd04[_0xc7b4('0x53')]['id']}})[_0xc7b4('0x21')](handleEntityNotFound(_0x46031c,null))['then'](function(_0x4f2aea){if(_0x4f2aea){_0x5a0830=_0x4f2aea;_0x48b849[_0xc7b4('0x3b')]=_[_0xc7b4('0x3d')](db[_0xc7b4('0x61')][_0xc7b4('0x5e')]);_0x48b849[_0xc7b4('0x3e')]=_['keys'](_0x16dd04[_0xc7b4('0x3e')]);_0x48b849[_0xc7b4('0x3f')]=_[_0xc7b4('0x41')](_0x48b849['model'],_0x48b849[_0xc7b4('0x3e')]);_0xf77b1c[_0xc7b4('0x40')]=_['intersection'](_0x48b849[_0xc7b4('0x3b')],qs[_0xc7b4('0x42')](_0x16dd04[_0xc7b4('0x3e')]['fields']));_0xf77b1c[_0xc7b4('0x40')]=_0xf77b1c['attributes']['length']?_0xf77b1c[_0xc7b4('0x40')]:_0x48b849['model'];_0xf77b1c[_0xc7b4('0x5b')]=qs[_0xc7b4('0x46')](_0x16dd04[_0xc7b4('0x3e')][_0xc7b4('0x46')]);_0xf77b1c[_0xc7b4('0x4a')]=qs['filters'](_[_0xc7b4('0x47')](_0x16dd04[_0xc7b4('0x3e')],_0x48b849[_0xc7b4('0x3f')]));if(_0x16dd04[_0xc7b4('0x3e')][_0xc7b4('0x48')]){_0xf77b1c[_0xc7b4('0x4a')]=_['merge'](_0xf77b1c[_0xc7b4('0x4a')],{'$or':_['map'](_0xf77b1c[_0xc7b4('0x40')],function(_0x373cb5){var _0xe3722e={};_0xe3722e[_0x373cb5]={'$like':'%'+_0x16dd04[_0xc7b4('0x3e')][_0xc7b4('0x48')]+'%'};return _0xe3722e;})});}_0xf77b1c=_[_0xc7b4('0x49')]({},_0xf77b1c,_0x16dd04[_0xc7b4('0x4c')]);return _0x5a0830['getTags'](_0xf77b1c);}})[_0xc7b4('0x21')](function(_0x5d67b0){if(_0x5d67b0){_0x1e71ba=_0x5d67b0[_0xc7b4('0x54')];if(!_0x16dd04[_0xc7b4('0x3e')][_0xc7b4('0x43')](_0xc7b4('0x44'))){_0xf77b1c['limit']=qs[_0xc7b4('0x45')](_0x16dd04[_0xc7b4('0x3e')][_0xc7b4('0x45')]);_0xf77b1c[_0xc7b4('0x2e')]=qs['offset'](_0x16dd04[_0xc7b4('0x3e')][_0xc7b4('0x2e')]);}return _0x5a0830[_0xc7b4('0x60')](_0xf77b1c);}})[_0xc7b4('0x21')](function(_0x4ec793){if(_0x4ec793){return _0x4ec793?{'count':_0x1e71ba,'rows':_0x4ec793}:null;}})[_0xc7b4('0x21')](respondWithResult(_0x46031c,null))['catch'](handleError(_0x46031c,null));};exports['setTags']=function(_0x5696e8,_0x71d086,_0x552260){if(_0x5696e8[_0xc7b4('0x57')]['id']){delete _0x5696e8[_0xc7b4('0x57')]['id'];}return db[_0xc7b4('0x4d')][_0xc7b4('0x5a')]({'where':{'id':_0x5696e8[_0xc7b4('0x53')]['id']}})[_0xc7b4('0x21')](handleEntityNotFound(_0x71d086,null))['then'](function(_0x322559){if(_0x322559){return _0x322559[_0xc7b4('0x62')](_0x5696e8['body'][_0xc7b4('0x63')]||[]);}return null;})[_0xc7b4('0x21')](respondWithResult(_0x71d086,null))[_0xc7b4('0x29')](handleError(_0x71d086,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index b9f1548..b9f4832 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 _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 +var _0x41cb=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','int_freshdesk_configurations'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x41cb,0xf0));var _0xb41c=function(_0x2544d1,_0x3e78fa){_0x2544d1=_0x2544d1-0x0;var _0x5acf94=_0x41cb[_0x2544d1];return _0x5acf94;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb41c('0x0'))(_0xb41c('0x1'));var moment=require('moment');var BPromise=require(_0xb41c('0x2'));var rp=require(_0xb41c('0x3'));var fs=require('fs');var path=require(_0xb41c('0x4'));var rimraf=require(_0xb41c('0x5'));var config=require(_0xb41c('0x6'));var attributes=require(_0xb41c('0x7'));module['exports']=function(_0x5c826d,_0x7b23f7){return _0x5c826d[_0xb41c('0x8')]('FreshdeskConfiguration',attributes,{'tableName':_0xb41c('0x9'),'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 9840261..3cecb41 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 _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 +var _0x56c6=['catch','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x53b49f,_0x1f18bf){var _0x891e21=function(_0x476bc5){while(--_0x476bc5){_0x53b49f['push'](_0x53b49f['shift']());}};_0x891e21(++_0x1f18bf);}(_0x56c6,0x119));var _0x656c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x56c6[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0x656c('0x0'));var moment=require(_0x656c('0x1'));var BPromise=require(_0x656c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x656c('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x656c('0x4'))(_0x656c('0x5'));var config=require(_0x656c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x656c('0x7')][_0x656c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4dcaec,_0x5b6e10,_0x151b66){return new BPromise(function(_0x1839aa,_0x4fcac4){return client['request'](_0x4dcaec,_0x151b66)[_0x656c('0x9')](function(_0x1ff050){logger[_0x656c('0xa')](_0x656c('0xb'),_0x5b6e10,_0x656c('0xc'));logger[_0x656c('0xd')](_0x656c('0xe'),_0x5b6e10,_0x656c('0xc'),JSON[_0x656c('0xf')](_0x1ff050));if(_0x1ff050['error']){if(_0x1ff050['error'][_0x656c('0x10')]===0x1f4){logger[_0x656c('0x11')](_0x656c('0xb'),_0x5b6e10,_0x1ff050[_0x656c('0x11')][_0x656c('0x12')]);return _0x4fcac4(_0x1ff050[_0x656c('0x11')]['message']);}logger[_0x656c('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5b6e10,_0x1ff050['error'][_0x656c('0x12')]);return _0x1839aa(_0x1ff050[_0x656c('0x11')][_0x656c('0x12')]);}else{logger['info'](_0x656c('0xb'),_0x5b6e10,'request\x20sent');_0x1839aa(_0x1ff050['result'][_0x656c('0x12')]);}})[_0x656c('0x13')](function(_0x5ccdec){logger[_0x656c('0x11')](_0x656c('0xb'),_0x5b6e10,_0x5ccdec);_0x4fcac4(_0x5ccdec);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 8db2be2..af097d9 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 _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 +var _0x9c44=['/:id','isAuthenticated','show','create','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x1a3fe2,_0x553b71){var _0x490ee2=function(_0xc569b4){while(--_0xc569b4){_0x1a3fe2['push'](_0x1a3fe2['shift']());}};_0x490ee2(++_0x553b71);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['post']('/',auth[_0x49c4('0x9')](),controller[_0x49c4('0xb')]);router[_0x49c4('0xc')](_0x49c4('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x49c4('0xd')](_0x49c4('0x8'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);module[_0x49c4('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 3bb37f1..32762ac 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 _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 +var _0x5636=['keyValue','string','STRING','ENUM','variable','BOOLEAN','sequelize','exports','customVariable'];(function(_0x3660b8,_0x404ee8){var _0x56f4c9=function(_0x17e59e){while(--_0x17e59e){_0x3660b8['push'](_0x3660b8['shift']());}};_0x56f4c9(++_0x404ee8);}(_0x5636,0x102));var _0x6563=function(_0x3b97ca,_0x4c91b5){_0x3b97ca=_0x3b97ca-0x0;var _0x38f507=_0x5636[_0x3b97ca];return _0x38f507;};'use strict';var Sequelize=require(_0x6563('0x0'));module[_0x6563('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0x6563('0x2'),_0x6563('0x3')),'defaultValue':_0x6563('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6563('0x5')]},'keyType':{'type':Sequelize[_0x6563('0x6')](_0x6563('0x4'),_0x6563('0x7'),_0x6563('0x2'))},'keyContent':{'type':Sequelize[_0x6563('0x5')]},'idField':{'type':Sequelize[_0x6563('0x5')]},'nameField':{'type':Sequelize[_0x6563('0x5')]},'customField':{'type':Sequelize[_0x6563('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6563('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 395313d..9c53567 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 _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 +var _0x0a9f=['limit','order','sort','filters','pick','where','type','VIRTUAL','merge','options','count','includeAll','findAll','rows','catch','show','length','include','create','body','find','params','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','FreshdeskField','rawAttributes','model','keys','query','intersection','attributes','fields','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0a9f,0xe2));var _0xf0a9=function(_0x137815,_0x78dd4b){_0x137815=_0x137815-0x0;var _0x29ded1=_0x0a9f[_0x137815];return _0x29ded1;};'use strict';var pdf=require(_0xf0a9('0x0'));var emlformat=require(_0xf0a9('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf0a9('0x2'));var moment=require(_0xf0a9('0x3'));var BPromise=require(_0xf0a9('0x4'));var Mustache=require(_0xf0a9('0x5'));var util=require(_0xf0a9('0x6'));var path=require(_0xf0a9('0x7'));var sox=require('sox');var csv=require(_0xf0a9('0x8'));var ejs=require(_0xf0a9('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf0a9('0xa'));var crypto=require(_0xf0a9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf0a9('0xc'));var toCsv=require(_0xf0a9('0x8'));var querystring=require(_0xf0a9('0xd'));var Papa=require(_0xf0a9('0xe'));var Redis=require('ioredis');var authService=require(_0xf0a9('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0a9('0x10'));var logger=require(_0xf0a9('0x11'))(_0xf0a9('0x12'));var utils=require(_0xf0a9('0x13'));var config=require('../../config/environment');var db=require(_0xf0a9('0x14'))['db'];function respondWithStatusCode(_0x4ede97,_0x2572a2){_0x2572a2=_0x2572a2||0xcc;return function(_0x1699a1){if(_0x1699a1){return _0x4ede97[_0xf0a9('0x15')](_0x2572a2);}return _0x4ede97[_0xf0a9('0x16')](_0x2572a2)['end']();};}function respondWithResult(_0x57d459,_0x250a73){_0x250a73=_0x250a73||0xc8;return function(_0xff655){if(_0xff655){return _0x57d459[_0xf0a9('0x16')](_0x250a73)[_0xf0a9('0x17')](_0xff655);}};}function respondWithFilteredResult(_0x31a175,_0x4a7708){return function(_0x25bec4){if(_0x25bec4){var _0x133d34=_0x25bec4['count'],_0xca15c=_0x4a7708[_0xf0a9('0x18')],_0x2b1848=_0x4a7708['offset']+_0x4a7708['limit'],_0x1be482;if(_0x2b1848>=_0x133d34){_0x2b1848=_0x133d34;_0x1be482=0xc8;}else{_0x1be482=0xce;}_0x31a175[_0xf0a9('0x16')](_0x1be482);return _0x31a175[_0xf0a9('0x19')]('Content-Range',_0xca15c+'-'+_0x2b1848+'/'+_0x133d34)[_0xf0a9('0x17')](_0x25bec4);}return null;};}function patchUpdates(_0x339c16){return function(_0x5f2d19){try{jsonpatch[_0xf0a9('0x1a')](_0x5f2d19,_0x339c16,!![]);}catch(_0x2534b5){return BPromise[_0xf0a9('0x1b')](_0x2534b5);}return _0x5f2d19['save']();};}function saveUpdates(_0x4e41e7,_0x1e5307){return function(_0x52c0b2){if(_0x52c0b2){return _0x52c0b2[_0xf0a9('0x1c')](_0x4e41e7)[_0xf0a9('0x1d')](function(_0x7e5cd0){return _0x7e5cd0;});}return null;};}function removeEntity(_0x56ac61,_0x478b1d){return function(_0x1badde){if(_0x1badde){return _0x1badde[_0xf0a9('0x1e')]()[_0xf0a9('0x1d')](function(){_0x56ac61[_0xf0a9('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x534e01,_0x250a70){return function(_0x364cf7){if(!_0x364cf7){_0x534e01['sendStatus'](0x194);}return _0x364cf7;};}function handleError(_0x170415,_0x75dfe6){_0x75dfe6=_0x75dfe6||0x1f4;return function(_0x1596c2){logger[_0xf0a9('0x1f')](_0x1596c2[_0xf0a9('0x20')]);if(_0x1596c2[_0xf0a9('0x21')]){delete _0x1596c2['name'];}_0x170415[_0xf0a9('0x16')](_0x75dfe6)[_0xf0a9('0x22')](_0x1596c2);};}exports[_0xf0a9('0x23')]=function(_0x4ab6dc,_0x59d33a){var _0x5697f1={},_0x43be45={},_0x3607da={'count':0x0,'rows':[]};var _0x170746=_[_0xf0a9('0x24')](db[_0xf0a9('0x25')][_0xf0a9('0x26')],function(_0x25adf0){return{'name':_0x25adf0['fieldName'],'type':_0x25adf0['type']['key']};});_0x43be45[_0xf0a9('0x27')]=_[_0xf0a9('0x24')](_0x170746,'name');_0x43be45['query']=_[_0xf0a9('0x28')](_0x4ab6dc[_0xf0a9('0x29')]);_0x43be45['filters']=_[_0xf0a9('0x2a')](_0x43be45[_0xf0a9('0x27')],_0x43be45[_0xf0a9('0x29')]);_0x5697f1[_0xf0a9('0x2b')]=_[_0xf0a9('0x2a')](_0x43be45[_0xf0a9('0x27')],qs[_0xf0a9('0x2c')](_0x4ab6dc['query'][_0xf0a9('0x2c')]));_0x5697f1[_0xf0a9('0x2b')]=_0x5697f1[_0xf0a9('0x2b')]['length']?_0x5697f1[_0xf0a9('0x2b')]:_0x43be45[_0xf0a9('0x27')];if(!_0x4ab6dc[_0xf0a9('0x29')][_0xf0a9('0x2d')]('nolimit')){_0x5697f1[_0xf0a9('0x2e')]=qs[_0xf0a9('0x2e')](_0x4ab6dc['query'][_0xf0a9('0x2e')]);_0x5697f1[_0xf0a9('0x18')]=qs[_0xf0a9('0x18')](_0x4ab6dc[_0xf0a9('0x29')][_0xf0a9('0x18')]);}_0x5697f1[_0xf0a9('0x2f')]=qs[_0xf0a9('0x30')](_0x4ab6dc[_0xf0a9('0x29')]['sort']);_0x5697f1['where']=qs[_0xf0a9('0x31')](_[_0xf0a9('0x32')](_0x4ab6dc[_0xf0a9('0x29')],_0x43be45['filters']),_0x170746);if(_0x4ab6dc['query']['filter']){_0x5697f1[_0xf0a9('0x33')]=_['merge'](_0x5697f1[_0xf0a9('0x33')],{'$or':_[_0xf0a9('0x24')](_0x170746,function(_0x4e9186){if(_0x4e9186[_0xf0a9('0x34')]!==_0xf0a9('0x35')){var _0x260b8f={};_0x260b8f[_0x4e9186['name']]={'$like':'%'+_0x4ab6dc[_0xf0a9('0x29')]['filter']+'%'};return _0x260b8f;}})});}_0x5697f1=_[_0xf0a9('0x36')]({},_0x5697f1,_0x4ab6dc[_0xf0a9('0x37')]);var _0x1fb2ec={'where':_0x5697f1[_0xf0a9('0x33')]};return db['FreshdeskField'][_0xf0a9('0x38')](_0x1fb2ec)[_0xf0a9('0x1d')](function(_0xdd465){_0x3607da[_0xf0a9('0x38')]=_0xdd465;if(_0x4ab6dc[_0xf0a9('0x29')][_0xf0a9('0x39')]){_0x5697f1['include']=[{'all':!![]}];}return db['FreshdeskField'][_0xf0a9('0x3a')](_0x5697f1);})[_0xf0a9('0x1d')](function(_0x581c0c){_0x3607da[_0xf0a9('0x3b')]=_0x581c0c;return _0x3607da;})[_0xf0a9('0x1d')](respondWithFilteredResult(_0x59d33a,_0x5697f1))[_0xf0a9('0x3c')](handleError(_0x59d33a,null));};exports[_0xf0a9('0x3d')]=function(_0x4d7227,_0x12cc87){var _0x3c86d3={'raw':!![],'where':{'id':_0x4d7227['params']['id']}},_0x182ac3={};_0x182ac3[_0xf0a9('0x27')]=_[_0xf0a9('0x28')](db['FreshdeskField']['rawAttributes']);_0x182ac3[_0xf0a9('0x29')]=_['keys'](_0x4d7227[_0xf0a9('0x29')]);_0x182ac3[_0xf0a9('0x31')]=_[_0xf0a9('0x2a')](_0x182ac3[_0xf0a9('0x27')],_0x182ac3['query']);_0x3c86d3[_0xf0a9('0x2b')]=_[_0xf0a9('0x2a')](_0x182ac3['model'],qs[_0xf0a9('0x2c')](_0x4d7227[_0xf0a9('0x29')][_0xf0a9('0x2c')]));_0x3c86d3[_0xf0a9('0x2b')]=_0x3c86d3[_0xf0a9('0x2b')][_0xf0a9('0x3e')]?_0x3c86d3[_0xf0a9('0x2b')]:_0x182ac3[_0xf0a9('0x27')];if(_0x4d7227[_0xf0a9('0x29')][_0xf0a9('0x39')]){_0x3c86d3[_0xf0a9('0x3f')]=[{'all':!![]}];}_0x3c86d3=_[_0xf0a9('0x36')]({},_0x3c86d3,_0x4d7227[_0xf0a9('0x37')]);return db[_0xf0a9('0x25')]['find'](_0x3c86d3)[_0xf0a9('0x1d')](handleEntityNotFound(_0x12cc87,null))[_0xf0a9('0x1d')](respondWithResult(_0x12cc87,null))[_0xf0a9('0x3c')](handleError(_0x12cc87,null));};exports[_0xf0a9('0x40')]=function(_0x289003,_0x1c98e6){return db[_0xf0a9('0x25')][_0xf0a9('0x40')](_0x289003['body'],{})[_0xf0a9('0x1d')](respondWithResult(_0x1c98e6,0xc9))[_0xf0a9('0x3c')](handleError(_0x1c98e6,null));};exports[_0xf0a9('0x1c')]=function(_0x1e914d,_0x352c0c){if(_0x1e914d[_0xf0a9('0x41')]['id']){delete _0x1e914d['body']['id'];}return db[_0xf0a9('0x25')]['find']({'where':{'id':_0x1e914d['params']['id']}})[_0xf0a9('0x1d')](handleEntityNotFound(_0x352c0c,null))['then'](saveUpdates(_0x1e914d['body'],null))['then'](respondWithResult(_0x352c0c,null))[_0xf0a9('0x3c')](handleError(_0x352c0c,null));};exports[_0xf0a9('0x1e')]=function(_0x364981,_0x2d1b7b){return db[_0xf0a9('0x25')][_0xf0a9('0x42')]({'where':{'id':_0x364981[_0xf0a9('0x43')]['id']}})['then'](handleEntityNotFound(_0x2d1b7b,null))[_0xf0a9('0x1d')](removeEntity(_0x2d1b7b,null))[_0xf0a9('0x3c')](handleError(_0x2d1b7b,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index a0d0293..da2d52d 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 _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 +var _0x388c=['lodash','util','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskField.attributes','FreshdeskField','int_freshdesk_fields','idField','FieldId'];(function(_0x25d110,_0x50be7d){var _0x182baf=function(_0x10338e){while(--_0x10338e){_0x25d110['push'](_0x25d110['shift']());}};_0x182baf(++_0x50be7d);}(_0x388c,0x18c));var _0xc388=function(_0x450bbc,_0x1b7af3){_0x450bbc=_0x450bbc-0x0;var _0x3f558a=_0x388c[_0x450bbc];return _0x3f558a;};'use strict';var _=require(_0xc388('0x0'));var util=require(_0xc388('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc388('0x2'));var BPromise=require(_0xc388('0x3'));var rp=require(_0xc388('0x4'));var fs=require('fs');var path=require(_0xc388('0x5'));var rimraf=require('rimraf');var config=require(_0xc388('0x6'));var attributes=require(_0xc388('0x7'));module['exports']=function(_0x4421f8,_0x1724c7){return _0x4421f8['define'](_0xc388('0x8'),attributes,{'tableName':_0xc388('0x9'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0xc388('0xa'),_0xc388('0xb')],'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 5d535db..7c252c4 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(_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 +var _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x5df1f8,_0x49cffc){_0x5df1f8=_0x5df1f8-0x0;var _0xed191e=_0x7a54[_0x5df1f8];return _0xed191e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 341c301..5a1dc0d 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 _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 +var _0xe6ff=['/:id/configurations','/:id/fields','post','create','put','/:id','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','index','isAuthenticated','show'];(function(_0x392c04,_0x165501){var _0x5dddf4=function(_0x3f9972){while(--_0x3f9972){_0x392c04['push'](_0x392c04['shift']());}};_0x5dddf4(++_0x165501);}(_0xe6ff,0xa7));var _0xfe6f=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xe6ff[_0xa148b7];return _0x51efd3;};'use strict';var multer=require(_0xfe6f('0x0'));var util=require(_0xfe6f('0x1'));var path=require(_0xfe6f('0x2'));var timeout=require(_0xfe6f('0x3'));var express=require(_0xfe6f('0x4'));var router=express[_0xfe6f('0x5')]();var auth=require(_0xfe6f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfe6f('0x7'));var controller=require(_0xfe6f('0x8'));router[_0xfe6f('0x9')]('/',auth['isAuthenticated'](),controller[_0xfe6f('0xa')]);router['get']('/:id',auth[_0xfe6f('0xb')](),controller[_0xfe6f('0xc')]);router[_0xfe6f('0x9')](_0xfe6f('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0xfe6f('0xe'),auth[_0xfe6f('0xb')](),controller['getFields']);router[_0xfe6f('0xf')]('/',auth[_0xfe6f('0xb')](),controller[_0xfe6f('0x10')]);router['post'](_0xfe6f('0xd'),auth[_0xfe6f('0xb')](),controller['addConfiguration']);router[_0xfe6f('0x11')]('/:id',auth[_0xfe6f('0xb')](),controller['update']);router['delete'](_0xfe6f('0x12'),auth[_0xfe6f('0xb')](),controller['destroy']);module[_0xfe6f('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 3531a6f..e375194 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 _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 +var _0x70e3=['username','sequelize','exports','STRING'];(function(_0x303051,_0x4943ac){var _0x51f377=function(_0x76b626){while(--_0x76b626){_0x303051['push'](_0x303051['shift']());}};_0x51f377(++_0x4943ac);}(_0x70e3,0x9d));var _0x370e=function(_0x1d558c,_0x1e497c){_0x1d558c=_0x1d558c-0x0;var _0x15767d=_0x70e3[_0x1d558c];return _0x15767d;};'use strict';var Sequelize=require(_0x370e('0x0'));module[_0x370e('0x1')]={'name':{'type':Sequelize[_0x370e('0x2')]},'description':{'type':Sequelize[_0x370e('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x370e('0x3')},'apiKey':{'type':Sequelize[_0x370e('0x2')]},'remoteUri':{'type':Sequelize[_0x370e('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x370e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 8054c17..17fffa3 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 _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 +var _0xf2e3=['../../config/utils','../../components/integrations/configuration','jayson/promise','client','http','Sequelize','ValidationError','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','includeAll','include','rows','show','attributes','options','find','create','body','params','getConfigurations','findOne','FreshsalesConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','username','remoteUri','apiKey','slice','GET','format','/api/selector/owners','Token\x20token=','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields','test','Wrong\x20credentials','html-pdf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger'];(function(_0x3c498f,_0x1a9eef){var _0x2104b8=function(_0x2d8b1a){while(--_0x2d8b1a){_0x3c498f['push'](_0x3c498f['shift']());}};_0x2104b8(++_0x1a9eef);}(_0xf2e3,0xc8));var _0x3f2e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf2e3[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0x3f2e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3f2e('0x1'));var rp=require(_0x3f2e('0x2'));var moment=require(_0x3f2e('0x3'));var BPromise=require(_0x3f2e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3f2e('0x5'));var sox=require(_0x3f2e('0x6'));var csv=require(_0x3f2e('0x7'));var ejs=require(_0x3f2e('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3f2e('0x9'));var crypto=require('crypto');var jsforce=require(_0x3f2e('0xa'));var deskjs=require(_0x3f2e('0xb'));var toCsv=require(_0x3f2e('0x7'));var querystring=require(_0x3f2e('0xc'));var Papa=require('papaparse');var Redis=require(_0x3f2e('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f2e('0xe'));var logger=require(_0x3f2e('0xf'))('api');var utils=require(_0x3f2e('0x10'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0x3f2e('0x11'));var jayson=require(_0x3f2e('0x12'));var client=jayson[_0x3f2e('0x13')][_0x3f2e('0x14')]({'port':0x232a});function checkPasswordPattern(_0x4943c5,_0x51c676,_0x54b832){if(_0x54b832){var _0x1a988f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1a988f['test'](_0x51c676)){return _0x4943c5;}else{throw new db[(_0x3f2e('0x15'))][(_0x3f2e('0x16'))]('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 _0x4943c5;}}function respondWithRpcPromise(_0x5ba0b9,_0x534baa,_0x3ac049,_0x5a52d5){return new BPromise(function(_0x59c824,_0x8e90c1){var _0x3a3d51=_0x5a52d5||client;return _0x3a3d51[_0x3f2e('0x17')](_0x5ba0b9,_0x3ac049)[_0x3f2e('0x18')](function(_0x55fdd4){logger[_0x3f2e('0x19')](_0x3f2e('0x1a'),_0x534baa,_0x3f2e('0x1b'));logger[_0x3f2e('0x1c')](_0x3f2e('0x1d'),_0x534baa,_0x3f2e('0x1b'),JSON[_0x3f2e('0x1e')](_0x55fdd4));if(_0x55fdd4[_0x3f2e('0x1f')]){if(_0x55fdd4[_0x3f2e('0x1f')][_0x3f2e('0x20')]===0x1f4){logger[_0x3f2e('0x1f')](_0x3f2e('0x1a'),_0x534baa,_0x55fdd4[_0x3f2e('0x1f')]['message']);return _0x8e90c1(_0x55fdd4[_0x3f2e('0x1f')][_0x3f2e('0x21')]);}logger[_0x3f2e('0x1f')](_0x3f2e('0x1a'),_0x534baa,_0x55fdd4[_0x3f2e('0x1f')][_0x3f2e('0x21')]);return _0x59c824(_0x55fdd4[_0x3f2e('0x1f')][_0x3f2e('0x21')]);}else{logger[_0x3f2e('0x19')]('FreshsalesAccount,\x20%s,\x20%s',_0x534baa,_0x3f2e('0x1b'));_0x59c824(_0x55fdd4['result'][_0x3f2e('0x21')]);}})[_0x3f2e('0x22')](function(_0x1d3a83){logger[_0x3f2e('0x1f')](_0x3f2e('0x1a'),_0x534baa,_0x1d3a83);_0x8e90c1(_0x1d3a83);});});}function respondWithStatusCode(_0x871642,_0x490e90){_0x490e90=_0x490e90||0xcc;return function(_0x1bae33){if(_0x1bae33){return _0x871642[_0x3f2e('0x23')](_0x490e90);}return _0x871642[_0x3f2e('0x24')](_0x490e90)[_0x3f2e('0x25')]();};}function respondWithResult(_0x2c83bf,_0x57899c){_0x57899c=_0x57899c||0xc8;return function(_0x5e52f4){if(_0x5e52f4){return _0x2c83bf[_0x3f2e('0x24')](_0x57899c)[_0x3f2e('0x26')](_0x5e52f4);}};}function respondWithFilteredResult(_0x2c3012,_0x1c56ec){return function(_0x4cc63f){if(_0x4cc63f){var _0x1ebede=_0x4cc63f[_0x3f2e('0x27')],_0x5c95ea=_0x1c56ec[_0x3f2e('0x28')],_0x186833=_0x1c56ec[_0x3f2e('0x28')]+_0x1c56ec['limit'],_0x1bf694;if(_0x186833>=_0x1ebede){_0x186833=_0x1ebede;_0x1bf694=0xc8;}else{_0x1bf694=0xce;}_0x2c3012[_0x3f2e('0x24')](_0x1bf694);return _0x2c3012[_0x3f2e('0x29')](_0x3f2e('0x2a'),_0x5c95ea+'-'+_0x186833+'/'+_0x1ebede)[_0x3f2e('0x26')](_0x4cc63f);}return null;};}function patchUpdates(_0x46e047){return function(_0x2ac1de){try{jsonpatch[_0x3f2e('0x2b')](_0x2ac1de,_0x46e047,!![]);}catch(_0xbb01d6){return BPromise[_0x3f2e('0x2c')](_0xbb01d6);}return _0x2ac1de[_0x3f2e('0x2d')]();};}function saveUpdates(_0x122831,_0x1bede2){return function(_0x27933e){if(_0x27933e){return _0x27933e[_0x3f2e('0x2e')](_0x122831)[_0x3f2e('0x18')](function(_0x59b745){return _0x59b745;});}return null;};}function removeEntity(_0x2c4e90,_0x4e2363){return function(_0x36f76f){if(_0x36f76f){return _0x36f76f[_0x3f2e('0x2f')]()[_0x3f2e('0x18')](function(){_0x2c4e90[_0x3f2e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc76f93,_0x52378a){return function(_0x40a139){if(!_0x40a139){_0xc76f93[_0x3f2e('0x23')](0x194);}return _0x40a139;};}function handleError(_0x4b5f66,_0x1fd634){_0x1fd634=_0x1fd634||0x1f4;return function(_0x5b1ccf){logger[_0x3f2e('0x1f')](_0x5b1ccf[_0x3f2e('0x30')]);if(_0x5b1ccf['name']){delete _0x5b1ccf['name'];}_0x4b5f66['status'](_0x1fd634)[_0x3f2e('0x31')](_0x5b1ccf);};}exports[_0x3f2e('0x32')]=function(_0x1097cd,_0x4ac4d4){var _0x3c08b9={},_0x44a29c={},_0x468c0a={'count':0x0,'rows':[]};var _0x10ca59=_[_0x3f2e('0x33')](db[_0x3f2e('0x34')][_0x3f2e('0x35')],function(_0x7c4ec8){return{'name':_0x7c4ec8[_0x3f2e('0x36')],'type':_0x7c4ec8[_0x3f2e('0x37')][_0x3f2e('0x38')]};});_0x44a29c['model']=_[_0x3f2e('0x33')](_0x10ca59,_0x3f2e('0x39'));_0x44a29c[_0x3f2e('0x3a')]=_[_0x3f2e('0x3b')](_0x1097cd[_0x3f2e('0x3a')]);_0x44a29c[_0x3f2e('0x3c')]=_[_0x3f2e('0x3d')](_0x44a29c[_0x3f2e('0x3e')],_0x44a29c[_0x3f2e('0x3a')]);_0x3c08b9['attributes']=_[_0x3f2e('0x3d')](_0x44a29c[_0x3f2e('0x3e')],qs[_0x3f2e('0x3f')](_0x1097cd[_0x3f2e('0x3a')][_0x3f2e('0x3f')]));_0x3c08b9['attributes']=_0x3c08b9['attributes'][_0x3f2e('0x40')]?_0x3c08b9['attributes']:_0x44a29c['model'];if(!_0x1097cd['query'][_0x3f2e('0x41')](_0x3f2e('0x42'))){_0x3c08b9[_0x3f2e('0x43')]=qs[_0x3f2e('0x43')](_0x1097cd['query']['limit']);_0x3c08b9[_0x3f2e('0x28')]=qs[_0x3f2e('0x28')](_0x1097cd[_0x3f2e('0x3a')][_0x3f2e('0x28')]);}_0x3c08b9['order']=qs['sort'](_0x1097cd['query'][_0x3f2e('0x44')]);_0x3c08b9[_0x3f2e('0x45')]=qs[_0x3f2e('0x3c')](_['pick'](_0x1097cd['query'],_0x44a29c[_0x3f2e('0x3c')]),_0x10ca59);if(_0x1097cd[_0x3f2e('0x3a')][_0x3f2e('0x46')]){_0x3c08b9[_0x3f2e('0x45')]=_[_0x3f2e('0x47')](_0x3c08b9[_0x3f2e('0x45')],{'$or':_[_0x3f2e('0x33')](_0x10ca59,function(_0x2f390e){if(_0x2f390e['type']!=='VIRTUAL'){var _0x584bc4={};_0x584bc4[_0x2f390e[_0x3f2e('0x39')]]={'$like':'%'+_0x1097cd[_0x3f2e('0x3a')][_0x3f2e('0x46')]+'%'};return _0x584bc4;}})});}_0x3c08b9=_[_0x3f2e('0x47')]({},_0x3c08b9,_0x1097cd['options']);var _0x5b7368={'where':_0x3c08b9[_0x3f2e('0x45')]};return db['FreshsalesAccount']['count'](_0x5b7368)[_0x3f2e('0x18')](function(_0x28e9d4){_0x468c0a[_0x3f2e('0x27')]=_0x28e9d4;if(_0x1097cd[_0x3f2e('0x3a')][_0x3f2e('0x48')]){_0x3c08b9[_0x3f2e('0x49')]=[{'all':!![]}];}return db[_0x3f2e('0x34')]['findAll'](_0x3c08b9);})[_0x3f2e('0x18')](function(_0x317acb){_0x468c0a[_0x3f2e('0x4a')]=_0x317acb;return _0x468c0a;})[_0x3f2e('0x18')](respondWithFilteredResult(_0x4ac4d4,_0x3c08b9))[_0x3f2e('0x22')](handleError(_0x4ac4d4,null));};exports[_0x3f2e('0x4b')]=function(_0x1aaf1b,_0x50df15){var _0x47190f={'raw':![],'where':{'id':_0x1aaf1b['params']['id']}},_0x13c435={};_0x13c435['model']=_[_0x3f2e('0x3b')](db[_0x3f2e('0x34')][_0x3f2e('0x35')]);_0x13c435[_0x3f2e('0x3a')]=_[_0x3f2e('0x3b')](_0x1aaf1b['query']);_0x13c435[_0x3f2e('0x3c')]=_['intersection'](_0x13c435[_0x3f2e('0x3e')],_0x13c435['query']);_0x47190f['attributes']=_['intersection'](_0x13c435[_0x3f2e('0x3e')],qs['fields'](_0x1aaf1b[_0x3f2e('0x3a')]['fields']));_0x47190f[_0x3f2e('0x4c')]=_0x47190f['attributes'][_0x3f2e('0x40')]?_0x47190f[_0x3f2e('0x4c')]:_0x13c435['model'];if(_0x1aaf1b['query']['includeAll']){_0x47190f[_0x3f2e('0x49')]=[{'all':!![]}];}_0x47190f=_['merge']({},_0x47190f,_0x1aaf1b[_0x3f2e('0x4d')]);return db[_0x3f2e('0x34')][_0x3f2e('0x4e')](_0x47190f)[_0x3f2e('0x18')](handleEntityNotFound(_0x50df15,null))[_0x3f2e('0x18')](respondWithResult(_0x50df15,null))[_0x3f2e('0x22')](handleError(_0x50df15,null));};exports['create']=function(_0x57a4f9,_0x553b29){return db[_0x3f2e('0x34')][_0x3f2e('0x4f')](_0x57a4f9[_0x3f2e('0x50')],{})[_0x3f2e('0x18')](respondWithResult(_0x553b29,0xc9))[_0x3f2e('0x22')](handleError(_0x553b29,null));};exports[_0x3f2e('0x2e')]=function(_0x5abcb8,_0x3faffc){if(_0x5abcb8[_0x3f2e('0x50')]['id']){delete _0x5abcb8['body']['id'];}return db[_0x3f2e('0x34')]['find']({'where':{'id':_0x5abcb8['params']['id']}})[_0x3f2e('0x18')](handleEntityNotFound(_0x3faffc,null))[_0x3f2e('0x18')](saveUpdates(_0x5abcb8['body'],null))['then'](respondWithResult(_0x3faffc,null))[_0x3f2e('0x22')](handleError(_0x3faffc,null));};exports[_0x3f2e('0x2f')]=function(_0x1402f5,_0x368c07){return db[_0x3f2e('0x34')]['find']({'where':{'id':_0x1402f5[_0x3f2e('0x51')]['id']}})[_0x3f2e('0x18')](handleEntityNotFound(_0x368c07,null))[_0x3f2e('0x18')](removeEntity(_0x368c07,null))[_0x3f2e('0x22')](handleError(_0x368c07,null));};exports[_0x3f2e('0x52')]=function(_0x526a8a,_0x4fa458,_0x549d2e){var _0x2ae135={};var _0x28d839={};var _0x3824e9;var _0xa1dd89;return db['FreshsalesAccount'][_0x3f2e('0x53')]({'where':{'id':_0x526a8a['params']['id']}})[_0x3f2e('0x18')](handleEntityNotFound(_0x4fa458,null))[_0x3f2e('0x18')](function(_0x25ecfd){if(_0x25ecfd){_0x3824e9=_0x25ecfd;_0x28d839[_0x3f2e('0x3e')]=_[_0x3f2e('0x3b')](db[_0x3f2e('0x54')]['rawAttributes']);_0x28d839[_0x3f2e('0x3a')]=_['keys'](_0x526a8a['query']);_0x28d839[_0x3f2e('0x3c')]=_[_0x3f2e('0x3d')](_0x28d839[_0x3f2e('0x3e')],_0x28d839[_0x3f2e('0x3a')]);_0x2ae135['attributes']=_[_0x3f2e('0x3d')](_0x28d839[_0x3f2e('0x3e')],qs[_0x3f2e('0x3f')](_0x526a8a['query'][_0x3f2e('0x3f')]));_0x2ae135['attributes']=_0x2ae135[_0x3f2e('0x4c')][_0x3f2e('0x40')]?_0x2ae135[_0x3f2e('0x4c')]:_0x28d839[_0x3f2e('0x3e')];_0x2ae135['order']=qs[_0x3f2e('0x44')](_0x526a8a[_0x3f2e('0x3a')][_0x3f2e('0x44')]);_0x2ae135[_0x3f2e('0x45')]=qs['filters'](_[_0x3f2e('0x55')](_0x526a8a['query'],_0x28d839['filters']));if(_0x526a8a[_0x3f2e('0x3a')][_0x3f2e('0x46')]){_0x2ae135[_0x3f2e('0x45')]=_['merge'](_0x2ae135[_0x3f2e('0x45')],{'$or':_['map'](_0x2ae135['attributes'],function(_0x77f1bc){var _0x2d9c7f={};_0x2d9c7f[_0x77f1bc]={'$like':'%'+_0x526a8a['query']['filter']+'%'};return _0x2d9c7f;})});}_0x2ae135=_[_0x3f2e('0x47')]({},_0x2ae135,_0x526a8a['options']);return _0x3824e9[_0x3f2e('0x52')](_0x2ae135);}})[_0x3f2e('0x18')](function(_0x1e89c6){if(_0x1e89c6){_0xa1dd89=_0x1e89c6['length'];if(!_0x526a8a['query'][_0x3f2e('0x41')](_0x3f2e('0x42'))){_0x2ae135['limit']=qs[_0x3f2e('0x43')](_0x526a8a['query'][_0x3f2e('0x43')]);_0x2ae135[_0x3f2e('0x28')]=qs[_0x3f2e('0x28')](_0x526a8a[_0x3f2e('0x3a')][_0x3f2e('0x28')]);}return _0x3824e9['getConfigurations'](_0x2ae135);}})[_0x3f2e('0x18')](function(_0x1fbc48){if(_0x1fbc48){return _0x1fbc48?{'count':_0xa1dd89,'rows':_0x1fbc48}:null;}})[_0x3f2e('0x18')](respondWithResult(_0x4fa458,null))['catch'](handleError(_0x4fa458,null));};exports[_0x3f2e('0x56')]=function(_0x375546,_0x39c0c7,_0x220f29){if(_0x375546[_0x3f2e('0x50')]['id']){delete _0x375546[_0x3f2e('0x50')]['id'];}return db[_0x3f2e('0x34')][_0x3f2e('0x53')]({'where':{'id':_0x375546[_0x3f2e('0x51')]['id']}})[_0x3f2e('0x18')](handleEntityNotFound(_0x39c0c7,null))[_0x3f2e('0x18')](function(_0x259372){if(_0x259372){_0x375546[_0x3f2e('0x50')][_0x3f2e('0x57')]=_0x259372['id'];_0x375546['body'][_0x3f2e('0x58')]=integrations[_0x3f2e('0x59')](_0x375546[_0x3f2e('0x50')][_0x3f2e('0x5a')],_0x375546[_0x3f2e('0x50')][_0x3f2e('0x37')]);_0x375546['body'][_0x3f2e('0x5b')]=integrations[_0x3f2e('0x5c')](_0x375546[_0x3f2e('0x50')][_0x3f2e('0x5a')],_0x375546[_0x3f2e('0x50')][_0x3f2e('0x37')]);return db[_0x3f2e('0x54')][_0x3f2e('0x4f')](_0x375546[_0x3f2e('0x50')],{'include':[{'model':db[_0x3f2e('0x5d')],'as':_0x3f2e('0x58')},{'model':db[_0x3f2e('0x5d')],'as':_0x3f2e('0x5b')}]});}return null;})[_0x3f2e('0x18')](respondWithResult(_0x39c0c7,null))[_0x3f2e('0x22')](handleError(_0x39c0c7,null));};exports['getFields']=function(_0x4b70b6,_0x52b293,_0x243fb4){var _0x2c6a78='';var _0x4a817e='';return db[_0x3f2e('0x34')][_0x3f2e('0x53')]({'where':{'id':_0x4b70b6['params']['id']},'attributes':['id',_0x3f2e('0x5e'),_0x3f2e('0x5f'),_0x3f2e('0x60')]})[_0x3f2e('0x18')](handleEntityNotFound(_0x52b293,null))['then'](function(_0x44a51e){if(_0x44a51e){_0x4a817e=_0x44a51e['username'];_0x2c6a78=_0x44a51e[_0x3f2e('0x5f')];var _0x328b0c=_0x44a51e[_0x3f2e('0x5f')][_0x3f2e('0x61')](-0x1);if(_0x328b0c==='/'){_0x2c6a78=_0x2c6a78['substring'](0x0,_0x2c6a78['lastIndexOf'](_0x328b0c));}return rp({'method':_0x3f2e('0x62'),'uri':util[_0x3f2e('0x63')]('%s%s',_0x2c6a78,_0x3f2e('0x64')),'headers':{'Authorization':_0x3f2e('0x65')+_0x44a51e[_0x3f2e('0x60')]},'json':!![]});}})[_0x3f2e('0x18')](function(_0x99ede4){if(_0x99ede4){var _0x3ad8b4=_0x99ede4['users'];var _0x47da96=![];var _0x1e1cb8=null;for(_0x1e1cb8=0x0;_0x1e1cb8<_0x3ad8b4[_0x3f2e('0x40')];_0x1e1cb8++){if(_0x3ad8b4[_0x1e1cb8][_0x3f2e('0x66')]===_0x4a817e){_0x47da96=!![];}}if(_0x47da96){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x3f2e('0x67')});}}})[_0x3f2e('0x18')](respondWithResult(_0x52b293,null))[_0x3f2e('0x22')](function(_0x25c992){var _0x196c7a=_0x4b70b6[_0x3f2e('0x3a')]['test']?0x1f4:_0x25c992[_0x3f2e('0x68')]||0x1f4;logger[_0x3f2e('0x1f')]('getFields,\x20%s,\x20%s,\x20%s',_0x3f2e('0x69'),_0x196c7a,JSON[_0x3f2e('0x1e')](_0x25c992));delete _0x25c992[_0x3f2e('0x39')];if(_0x196c7a===0x191){_0x196c7a=0x190;}_0x52b293[_0x3f2e('0x24')](_0x196c7a)[_0x3f2e('0x31')](_0x4b70b6['query'][_0x3f2e('0x6a')]?{'message':_0x3f2e('0x6b'),'statusCode':_0x25c992[_0x3f2e('0x68')]}:_0x25c992);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 76eb2ea..b307889 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 _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 +var _0x1ebb=['int_freshsales_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1ebb,0x1d2));var _0xb1eb=function(_0x216d4c,_0x5c989d){_0x216d4c=_0x216d4c-0x0;var _0x51dd62=_0x1ebb[_0x216d4c];return _0x51dd62;};'use strict';var _=require(_0xb1eb('0x0'));var util=require(_0xb1eb('0x1'));var logger=require(_0xb1eb('0x2'))(_0xb1eb('0x3'));var moment=require('moment');var BPromise=require(_0xb1eb('0x4'));var rp=require(_0xb1eb('0x5'));var fs=require('fs');var path=require(_0xb1eb('0x6'));var rimraf=require(_0xb1eb('0x7'));var config=require(_0xb1eb('0x8'));var attributes=require(_0xb1eb('0x9'));var integrations=require(_0xb1eb('0xa'));module[_0xb1eb('0xb')]=function(_0x3865ef,_0x539a64){return _0x3865ef[_0xb1eb('0xc')](_0xb1eb('0xd'),attributes,{'tableName':_0xb1eb('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index b966faa..558448f 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 _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 +var _0xdab3=['http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','attributes','limit','map','include','model','ShowFreshsalesAccount','find','raw','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0xa931db,_0x38d04f){var _0x384a50=function(_0x41baa1){while(--_0x41baa1){_0xa931db['push'](_0xa931db['shift']());}};_0x384a50(++_0x38d04f);}(_0xdab3,0xeb));var _0x3dab=function(_0x78c768,_0x3c59f5){_0x78c768=_0x78c768-0x0;var _0x542828=_0xdab3[_0x78c768];return _0x542828;};'use strict';var _=require(_0x3dab('0x0'));var util=require(_0x3dab('0x1'));var moment=require('moment');var BPromise=require(_0x3dab('0x2'));var rs=require(_0x3dab('0x3'));var fs=require('fs');var Redis=require(_0x3dab('0x4'));var db=require(_0x3dab('0x5'))['db'];var utils=require(_0x3dab('0x6'));var logger=require(_0x3dab('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3dab('0x8'));var client=jayson[_0x3dab('0x9')][_0x3dab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x415608,_0x3bdacb,_0x2d6b5c){return new BPromise(function(_0x5ae18c,_0x46a6d7){return client[_0x3dab('0xb')](_0x415608,_0x2d6b5c)[_0x3dab('0xc')](function(_0x2ab58a){logger[_0x3dab('0xd')](_0x3dab('0xe'),_0x3bdacb,_0x3dab('0xf'));logger['debug'](_0x3dab('0x10'),_0x3bdacb,_0x3dab('0xf'),JSON[_0x3dab('0x11')](_0x2ab58a));if(_0x2ab58a[_0x3dab('0x12')]){if(_0x2ab58a[_0x3dab('0x12')]['code']===0x1f4){logger['error'](_0x3dab('0xe'),_0x3bdacb,_0x2ab58a[_0x3dab('0x12')][_0x3dab('0x13')]);return _0x46a6d7(_0x2ab58a[_0x3dab('0x12')][_0x3dab('0x13')]);}logger[_0x3dab('0x12')](_0x3dab('0xe'),_0x3bdacb,_0x2ab58a[_0x3dab('0x12')]['message']);return _0x5ae18c(_0x2ab58a[_0x3dab('0x12')][_0x3dab('0x13')]);}else{logger[_0x3dab('0xd')](_0x3dab('0xe'),_0x3bdacb,_0x3dab('0xf'));_0x5ae18c(_0x2ab58a['result']['message']);}})[_0x3dab('0x14')](function(_0x2e9933){logger[_0x3dab('0x12')](_0x3dab('0xe'),_0x3bdacb,_0x2e9933);_0x46a6d7(_0x2e9933);});});}exports[_0x3dab('0x15')]=function(_0x4f71e1){var _0x83a01c=this;return new Promise(function(_0x2cca19,_0x578c5e){return db[_0x3dab('0x16')][_0x3dab('0x17')]({'raw':_0x4f71e1[_0x3dab('0x18')]?_0x4f71e1[_0x3dab('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4f71e1[_0x3dab('0x18')]?_0x4f71e1[_0x3dab('0x18')][_0x3dab('0x19')]||null:null,'attributes':_0x4f71e1[_0x3dab('0x18')]?_0x4f71e1[_0x3dab('0x18')][_0x3dab('0x1a')]||null:null,'limit':_0x4f71e1[_0x3dab('0x18')]?_0x4f71e1[_0x3dab('0x18')][_0x3dab('0x1b')]||null:null,'include':_0x4f71e1['options']?_0x4f71e1[_0x3dab('0x18')]['include']?_[_0x3dab('0x1c')](_0x4f71e1[_0x3dab('0x18')][_0x3dab('0x1d')],function(_0x227c86){return{'model':db[_0x227c86[_0x3dab('0x1e')]],'as':_0x227c86['as'],'attributes':_0x227c86[_0x3dab('0x1a')],'include':_0x227c86['include']?_['map'](_0x227c86[_0x3dab('0x1d')],function(_0x10f848){return{'model':db[_0x10f848['model']],'as':_0x10f848['as'],'attributes':_0x10f848[_0x3dab('0x1a')],'include':_0x10f848[_0x3dab('0x1d')]?_[_0x3dab('0x1c')](_0x10f848[_0x3dab('0x1d')],function(_0x5acc7b){return{'model':db[_0x5acc7b[_0x3dab('0x1e')]],'as':_0x5acc7b['as'],'attributes':_0x5acc7b['attributes']};}):[]};}):[]};}):[]:[]})[_0x3dab('0xc')](function(_0x1ed38d){logger[_0x3dab('0xd')](_0x3dab('0x15'),_0x4f71e1);logger['debug']('GetFreshsalesAccount',_0x4f71e1,JSON[_0x3dab('0x11')](_0x1ed38d));_0x2cca19(_0x1ed38d);})['catch'](function(_0x483bce){logger['error']('GetFreshsalesAccount',_0x483bce[_0x3dab('0x13')],_0x4f71e1);_0x578c5e(_0x83a01c[_0x3dab('0x12')](0x1f4,_0x483bce[_0x3dab('0x13')]));});});};exports[_0x3dab('0x1f')]=function(_0x2088cc){var _0x3f612a=this;return new Promise(function(_0xf2c487,_0x9d2420){return db[_0x3dab('0x16')][_0x3dab('0x20')]({'raw':_0x2088cc[_0x3dab('0x18')]?_0x2088cc[_0x3dab('0x18')][_0x3dab('0x21')]===undefined?!![]:![]:!![],'where':_0x2088cc[_0x3dab('0x18')]?_0x2088cc[_0x3dab('0x18')][_0x3dab('0x19')]||null:null,'attributes':_0x2088cc[_0x3dab('0x18')]?_0x2088cc[_0x3dab('0x18')][_0x3dab('0x1a')]||null:null,'include':_0x2088cc[_0x3dab('0x18')]?_0x2088cc['options']['include']?_[_0x3dab('0x1c')](_0x2088cc['options'][_0x3dab('0x1d')],function(_0x457d80){return{'model':db[_0x457d80['model']],'as':_0x457d80['as'],'attributes':_0x457d80[_0x3dab('0x1a')],'include':_0x457d80[_0x3dab('0x1d')]?_[_0x3dab('0x1c')](_0x457d80[_0x3dab('0x1d')],function(_0x5430e3){return{'model':db[_0x5430e3['model']],'as':_0x5430e3['as'],'attributes':_0x5430e3[_0x3dab('0x1a')],'include':_0x5430e3['include']?_[_0x3dab('0x1c')](_0x5430e3[_0x3dab('0x1d')],function(_0x414dba){return{'model':db[_0x414dba['model']],'as':_0x414dba['as'],'attributes':_0x414dba['attributes']};}):[]};}):[]};}):[]:[]})[_0x3dab('0xc')](function(_0x20ab66){logger[_0x3dab('0xd')]('ShowFreshsalesAccount',_0x2088cc);logger[_0x3dab('0x22')](_0x3dab('0x1f'),_0x2088cc,JSON[_0x3dab('0x11')](_0x20ab66));_0xf2c487(_0x20ab66);})[_0x3dab('0x14')](function(_0xc2e1f7){logger['error'](_0x3dab('0x1f'),_0xc2e1f7[_0x3dab('0x13')],_0x2088cc);_0x9d2420(_0x3f612a[_0x3dab('0x12')](0x1f4,_0xc2e1f7[_0x3dab('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 1f02c34..b5145dd 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 _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 +var _0xba1b=['/:id','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','delete','multer','express','Router','../../components/auth/service','get','isAuthenticated'];(function(_0x446b3f,_0x1921e4){var _0x5f0ab1=function(_0x5b1775){while(--_0x5b1775){_0x446b3f['push'](_0x446b3f['shift']());}};_0x5f0ab1(++_0x1921e4);}(_0xba1b,0x1ba));var _0xbba1=function(_0x49cd29,_0x5c0d30){_0x49cd29=_0x49cd29-0x0;var _0x556ab9=_0xba1b[_0x49cd29];return _0x556ab9;};'use strict';var multer=require(_0xbba1('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbba1('0x1'));var router=express[_0xbba1('0x2')]();var auth=require(_0xbba1('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshsalesConfiguration.controller');router[_0xbba1('0x4')]('/',auth[_0xbba1('0x5')](),controller['index']);router['get'](_0xbba1('0x6'),auth[_0xbba1('0x5')](),controller['show']);router[_0xbba1('0x4')]('/:id/subjects',auth[_0xbba1('0x5')](),controller[_0xbba1('0x7')]);router['get'](_0xbba1('0x8'),auth[_0xbba1('0x5')](),controller[_0xbba1('0x9')]);router[_0xbba1('0x4')](_0xbba1('0xa'),auth[_0xbba1('0x5')](),controller[_0xbba1('0xb')]);router[_0xbba1('0xc')]('/',auth[_0xbba1('0x5')](),controller[_0xbba1('0xd')]);router[_0xbba1('0xe')]('/:id',auth[_0xbba1('0x5')](),controller['update']);router[_0xbba1('0xf')](_0xbba1('0x6'),auth[_0xbba1('0x5')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index a7ea191..496302f 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 _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 +var _0xf0e9=['STRING','sequelize','exports'];(function(_0x4436e1,_0x282b67){var _0x2d7637=function(_0x4f13dc){while(--_0x4f13dc){_0x4436e1['push'](_0x4436e1['shift']());}};_0x2d7637(++_0x282b67);}(_0xf0e9,0x64));var _0x9f0e=function(_0x29a028,_0x40b2de){_0x29a028=_0x29a028-0x0;var _0x7ec863=_0xf0e9[_0x29a028];return _0x7ec863;};'use strict';var Sequelize=require(_0x9f0e('0x0'));module[_0x9f0e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9f0e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 1f748d3..5a03532 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 _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 +var _0x08f2=['sendStatus','stack','name','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','fields','find','create','update','body','getSubjects','findOne','FreshsalesField','filter','getDescriptions','getFields','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','jayson/promise','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','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','status','end','count','offset','limit','set','json','apply','destroy'];(function(_0x31ab8c,_0xebf305){var _0x4f7acc=function(_0x597573){while(--_0x597573){_0x31ab8c['push'](_0x31ab8c['shift']());}};_0x4f7acc(++_0xebf305);}(_0x08f2,0xd6));var _0x208f=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x08f2[_0x4cf98e];return _0x1623ac;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x208f('0x0'));var rimraf=require(_0x208f('0x1'));var zipdir=require(_0x208f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x208f('0x3'));var moment=require(_0x208f('0x4'));var BPromise=require(_0x208f('0x5'));var Mustache=require(_0x208f('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x208f('0x7'));var ejs=require(_0x208f('0x8'));var fs=require('fs');var _=require(_0x208f('0x9'));var squel=require(_0x208f('0xa'));var crypto=require(_0x208f('0xb'));var jsforce=require(_0x208f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x208f('0x7'));var querystring=require(_0x208f('0xd'));var Papa=require('papaparse');var Redis=require(_0x208f('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x208f('0xf'));var hardwareService=require(_0x208f('0x10'));var logger=require(_0x208f('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x208f('0x12'));var db=require('../../mysqldb')['db'];var jayson=require(_0x208f('0x13'));var client=jayson['client'][_0x208f('0x14')]({'port':0x232a});function checkPasswordPattern(_0x27df4f,_0x55c4fa,_0x3c745c){if(_0x3c745c){var _0x308cbf=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x308cbf[_0x208f('0x15')](_0x55c4fa)){return _0x27df4f;}else{throw new db['Sequelize']['ValidationError'](_0x208f('0x16'));}}else{return _0x27df4f;}}function respondWithRpcPromise(_0x49b27a,_0x28ac76,_0x3214a5,_0xbba3a3){return new BPromise(function(_0x36c26a,_0x34e11f){var _0x14eee1=_0xbba3a3||client;return _0x14eee1[_0x208f('0x17')](_0x49b27a,_0x3214a5)[_0x208f('0x18')](function(_0xc83cb){logger[_0x208f('0x19')](_0x208f('0x1a'),_0x28ac76,'request\x20sent');logger[_0x208f('0x1b')](_0x208f('0x1c'),_0x28ac76,_0x208f('0x1d'),JSON[_0x208f('0x1e')](_0xc83cb));if(_0xc83cb[_0x208f('0x1f')]){if(_0xc83cb['error'][_0x208f('0x20')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x28ac76,_0xc83cb[_0x208f('0x1f')]['message']);return _0x34e11f(_0xc83cb['error'][_0x208f('0x21')]);}logger[_0x208f('0x1f')](_0x208f('0x1a'),_0x28ac76,_0xc83cb[_0x208f('0x1f')][_0x208f('0x21')]);return _0x36c26a(_0xc83cb['error'][_0x208f('0x21')]);}else{logger[_0x208f('0x19')](_0x208f('0x1a'),_0x28ac76,_0x208f('0x1d'));_0x36c26a(_0xc83cb[_0x208f('0x22')][_0x208f('0x21')]);}})['catch'](function(_0x464596){logger[_0x208f('0x1f')](_0x208f('0x1a'),_0x28ac76,_0x464596);_0x34e11f(_0x464596);});});}function respondWithStatusCode(_0x3bf2b3,_0x31d77a){_0x31d77a=_0x31d77a||0xcc;return function(_0x1f93be){if(_0x1f93be){return _0x3bf2b3['sendStatus'](_0x31d77a);}return _0x3bf2b3[_0x208f('0x23')](_0x31d77a)[_0x208f('0x24')]();};}function respondWithResult(_0x10a0b1,_0x4bfbda){_0x4bfbda=_0x4bfbda||0xc8;return function(_0x2fcf38){if(_0x2fcf38){return _0x10a0b1['status'](_0x4bfbda)['json'](_0x2fcf38);}};}function respondWithFilteredResult(_0x5e429c,_0x1b35dc){return function(_0x4312b2){if(_0x4312b2){var _0x1bf863=_0x4312b2[_0x208f('0x25')],_0x5c5bed=_0x1b35dc[_0x208f('0x26')],_0x227e7d=_0x1b35dc[_0x208f('0x26')]+_0x1b35dc[_0x208f('0x27')],_0x39d527;if(_0x227e7d>=_0x1bf863){_0x227e7d=_0x1bf863;_0x39d527=0xc8;}else{_0x39d527=0xce;}_0x5e429c[_0x208f('0x23')](_0x39d527);return _0x5e429c[_0x208f('0x28')]('Content-Range',_0x5c5bed+'-'+_0x227e7d+'/'+_0x1bf863)[_0x208f('0x29')](_0x4312b2);}return null;};}function patchUpdates(_0x767ea0){return function(_0x5cb12b){try{jsonpatch[_0x208f('0x2a')](_0x5cb12b,_0x767ea0,!![]);}catch(_0x4f8a80){return BPromise['reject'](_0x4f8a80);}return _0x5cb12b['save']();};}function saveUpdates(_0x477b03,_0x2320c8){return function(_0x3c55f3){if(_0x3c55f3){return _0x3c55f3['update'](_0x477b03)[_0x208f('0x18')](function(_0x40bed8){return _0x40bed8;});}return null;};}function removeEntity(_0x1bfca0,_0xfac890){return function(_0x3131a3){if(_0x3131a3){return _0x3131a3[_0x208f('0x2b')]()[_0x208f('0x18')](function(){_0x1bfca0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4973ec,_0x137d19){return function(_0x523f79){if(!_0x523f79){_0x4973ec[_0x208f('0x2c')](0x194);}return _0x523f79;};}function handleError(_0x3fca25,_0x512201){_0x512201=_0x512201||0x1f4;return function(_0x2361ab){logger[_0x208f('0x1f')](_0x2361ab[_0x208f('0x2d')]);if(_0x2361ab[_0x208f('0x2e')]){delete _0x2361ab['name'];}_0x3fca25[_0x208f('0x23')](_0x512201)['send'](_0x2361ab);};}exports['index']=function(_0x4ada58,_0x3278aa){var _0x2f3edc={},_0xd4da81={},_0x1f4dd1={'count':0x0,'rows':[]};var _0x26d671=_[_0x208f('0x2f')](db[_0x208f('0x30')][_0x208f('0x31')],function(_0x5bbbe3){return{'name':_0x5bbbe3[_0x208f('0x32')],'type':_0x5bbbe3[_0x208f('0x33')][_0x208f('0x34')]};});_0xd4da81['model']=_['map'](_0x26d671,_0x208f('0x2e'));_0xd4da81['query']=_[_0x208f('0x35')](_0x4ada58[_0x208f('0x36')]);_0xd4da81[_0x208f('0x37')]=_[_0x208f('0x38')](_0xd4da81[_0x208f('0x39')],_0xd4da81[_0x208f('0x36')]);_0x2f3edc['attributes']=_[_0x208f('0x38')](_0xd4da81[_0x208f('0x39')],qs['fields'](_0x4ada58['query']['fields']));_0x2f3edc[_0x208f('0x3a')]=_0x2f3edc[_0x208f('0x3a')][_0x208f('0x3b')]?_0x2f3edc[_0x208f('0x3a')]:_0xd4da81['model'];if(!_0x4ada58[_0x208f('0x36')][_0x208f('0x3c')](_0x208f('0x3d'))){_0x2f3edc[_0x208f('0x27')]=qs[_0x208f('0x27')](_0x4ada58[_0x208f('0x36')][_0x208f('0x27')]);_0x2f3edc[_0x208f('0x26')]=qs[_0x208f('0x26')](_0x4ada58[_0x208f('0x36')]['offset']);}_0x2f3edc[_0x208f('0x3e')]=qs[_0x208f('0x3f')](_0x4ada58['query'][_0x208f('0x3f')]);_0x2f3edc[_0x208f('0x40')]=qs[_0x208f('0x37')](_[_0x208f('0x41')](_0x4ada58[_0x208f('0x36')],_0xd4da81[_0x208f('0x37')]),_0x26d671);if(_0x4ada58[_0x208f('0x36')]['filter']){_0x2f3edc[_0x208f('0x40')]=_[_0x208f('0x42')](_0x2f3edc[_0x208f('0x40')],{'$or':_[_0x208f('0x2f')](_0x26d671,function(_0x2984ad){if(_0x2984ad[_0x208f('0x33')]!==_0x208f('0x43')){var _0x53219a={};_0x53219a[_0x2984ad[_0x208f('0x2e')]]={'$like':'%'+_0x4ada58[_0x208f('0x36')]['filter']+'%'};return _0x53219a;}})});}_0x2f3edc=_[_0x208f('0x42')]({},_0x2f3edc,_0x4ada58[_0x208f('0x44')]);var _0xbc39a3={'where':_0x2f3edc[_0x208f('0x40')]};return db[_0x208f('0x30')][_0x208f('0x25')](_0xbc39a3)[_0x208f('0x18')](function(_0x28bf73){_0x1f4dd1[_0x208f('0x25')]=_0x28bf73;if(_0x4ada58[_0x208f('0x36')][_0x208f('0x45')]){_0x2f3edc[_0x208f('0x46')]=[{'all':!![]}];}return db[_0x208f('0x30')][_0x208f('0x47')](_0x2f3edc);})['then'](function(_0x426ff2){_0x1f4dd1[_0x208f('0x48')]=_0x426ff2;return _0x1f4dd1;})['then'](respondWithFilteredResult(_0x3278aa,_0x2f3edc))[_0x208f('0x49')](handleError(_0x3278aa,null));};exports['show']=function(_0x4ca3ce,_0x499fce){var _0xebd522={'raw':![],'where':{'id':_0x4ca3ce[_0x208f('0x4a')]['id']}},_0x3b89cf={};_0x3b89cf[_0x208f('0x39')]=_[_0x208f('0x35')](db[_0x208f('0x30')][_0x208f('0x31')]);_0x3b89cf[_0x208f('0x36')]=_['keys'](_0x4ca3ce[_0x208f('0x36')]);_0x3b89cf[_0x208f('0x37')]=_[_0x208f('0x38')](_0x3b89cf[_0x208f('0x39')],_0x3b89cf[_0x208f('0x36')]);_0xebd522[_0x208f('0x3a')]=_[_0x208f('0x38')](_0x3b89cf['model'],qs[_0x208f('0x4b')](_0x4ca3ce[_0x208f('0x36')]['fields']));_0xebd522[_0x208f('0x3a')]=_0xebd522[_0x208f('0x3a')][_0x208f('0x3b')]?_0xebd522[_0x208f('0x3a')]:_0x3b89cf['model'];if(_0x4ca3ce[_0x208f('0x36')]['includeAll']){_0xebd522[_0x208f('0x46')]=[{'all':!![]}];}_0xebd522=_[_0x208f('0x42')]({},_0xebd522,_0x4ca3ce[_0x208f('0x44')]);return db[_0x208f('0x30')][_0x208f('0x4c')](_0xebd522)['then'](handleEntityNotFound(_0x499fce,null))[_0x208f('0x18')](respondWithResult(_0x499fce,null))[_0x208f('0x49')](handleError(_0x499fce,null));};exports[_0x208f('0x4d')]=function(_0x225dcd,_0x1b865b){return db[_0x208f('0x30')][_0x208f('0x4d')](_0x225dcd['body'],{})[_0x208f('0x18')](respondWithResult(_0x1b865b,0xc9))[_0x208f('0x49')](handleError(_0x1b865b,null));};exports[_0x208f('0x4e')]=function(_0x9afdef,_0x7da4de){if(_0x9afdef[_0x208f('0x4f')]['id']){delete _0x9afdef['body']['id'];}return db[_0x208f('0x30')][_0x208f('0x4c')]({'where':{'id':_0x9afdef[_0x208f('0x4a')]['id']}})[_0x208f('0x18')](handleEntityNotFound(_0x7da4de,null))[_0x208f('0x18')](saveUpdates(_0x9afdef[_0x208f('0x4f')],null))[_0x208f('0x18')](respondWithResult(_0x7da4de,null))[_0x208f('0x49')](handleError(_0x7da4de,null));};exports['destroy']=function(_0x1c9692,_0x4035c8){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x1c9692[_0x208f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4035c8,null))['then'](removeEntity(_0x4035c8,null))[_0x208f('0x49')](handleError(_0x4035c8,null));};exports[_0x208f('0x50')]=function(_0x16ffe0,_0x5cd2f5,_0xc146b7){var _0x131bcf={};var _0xab45ae={};var _0x2ba56b;var _0x3dac1a;return db[_0x208f('0x30')][_0x208f('0x51')]({'where':{'id':_0x16ffe0[_0x208f('0x4a')]['id']}})[_0x208f('0x18')](handleEntityNotFound(_0x5cd2f5,null))[_0x208f('0x18')](function(_0x54faa2){if(_0x54faa2){_0x2ba56b=_0x54faa2;_0xab45ae[_0x208f('0x39')]=_[_0x208f('0x35')](db[_0x208f('0x52')][_0x208f('0x31')]);_0xab45ae[_0x208f('0x36')]=_[_0x208f('0x35')](_0x16ffe0[_0x208f('0x36')]);_0xab45ae[_0x208f('0x37')]=_[_0x208f('0x38')](_0xab45ae[_0x208f('0x39')],_0xab45ae[_0x208f('0x36')]);_0x131bcf[_0x208f('0x3a')]=_[_0x208f('0x38')](_0xab45ae[_0x208f('0x39')],qs[_0x208f('0x4b')](_0x16ffe0['query'][_0x208f('0x4b')]));_0x131bcf[_0x208f('0x3a')]=_0x131bcf[_0x208f('0x3a')][_0x208f('0x3b')]?_0x131bcf[_0x208f('0x3a')]:_0xab45ae[_0x208f('0x39')];_0x131bcf['order']=qs[_0x208f('0x3f')](_0x16ffe0[_0x208f('0x36')][_0x208f('0x3f')]);_0x131bcf['where']=qs[_0x208f('0x37')](_[_0x208f('0x41')](_0x16ffe0[_0x208f('0x36')],_0xab45ae[_0x208f('0x37')]));if(_0x16ffe0['query'][_0x208f('0x53')]){_0x131bcf[_0x208f('0x40')]=_[_0x208f('0x42')](_0x131bcf['where'],{'$or':_['map'](_0x131bcf['attributes'],function(_0x41cb75){var _0x16a3db={};_0x16a3db[_0x41cb75]={'$like':'%'+_0x16ffe0[_0x208f('0x36')][_0x208f('0x53')]+'%'};return _0x16a3db;})});}_0x131bcf=_[_0x208f('0x42')]({},_0x131bcf,_0x16ffe0['options']);return _0x2ba56b['getSubjects'](_0x131bcf);}})['then'](function(_0x44f5fb){if(_0x44f5fb){_0x3dac1a=_0x44f5fb[_0x208f('0x3b')];if(!_0x16ffe0['query'][_0x208f('0x3c')](_0x208f('0x3d'))){_0x131bcf[_0x208f('0x27')]=qs[_0x208f('0x27')](_0x16ffe0[_0x208f('0x36')]['limit']);_0x131bcf[_0x208f('0x26')]=qs['offset'](_0x16ffe0[_0x208f('0x36')][_0x208f('0x26')]);}return _0x2ba56b[_0x208f('0x50')](_0x131bcf);}})['then'](function(_0x1bf7b9){if(_0x1bf7b9){return _0x1bf7b9?{'count':_0x3dac1a,'rows':_0x1bf7b9}:null;}})[_0x208f('0x18')](respondWithResult(_0x5cd2f5,null))[_0x208f('0x49')](handleError(_0x5cd2f5,null));};exports[_0x208f('0x54')]=function(_0xcbdc10,_0x208967,_0x4bcec5){var _0x17dd79={};var _0x55cd19={};var _0x5bd1c8;var _0x2a9e8e;return db[_0x208f('0x30')][_0x208f('0x51')]({'where':{'id':_0xcbdc10[_0x208f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x208967,null))[_0x208f('0x18')](function(_0x1efbf6){if(_0x1efbf6){_0x5bd1c8=_0x1efbf6;_0x55cd19[_0x208f('0x39')]=_[_0x208f('0x35')](db['FreshsalesField'][_0x208f('0x31')]);_0x55cd19[_0x208f('0x36')]=_[_0x208f('0x35')](_0xcbdc10[_0x208f('0x36')]);_0x55cd19['filters']=_[_0x208f('0x38')](_0x55cd19[_0x208f('0x39')],_0x55cd19[_0x208f('0x36')]);_0x17dd79['attributes']=_[_0x208f('0x38')](_0x55cd19[_0x208f('0x39')],qs['fields'](_0xcbdc10['query']['fields']));_0x17dd79[_0x208f('0x3a')]=_0x17dd79[_0x208f('0x3a')][_0x208f('0x3b')]?_0x17dd79[_0x208f('0x3a')]:_0x55cd19[_0x208f('0x39')];_0x17dd79[_0x208f('0x3e')]=qs[_0x208f('0x3f')](_0xcbdc10[_0x208f('0x36')]['sort']);_0x17dd79['where']=qs[_0x208f('0x37')](_[_0x208f('0x41')](_0xcbdc10[_0x208f('0x36')],_0x55cd19[_0x208f('0x37')]));if(_0xcbdc10[_0x208f('0x36')][_0x208f('0x53')]){_0x17dd79[_0x208f('0x40')]=_[_0x208f('0x42')](_0x17dd79['where'],{'$or':_[_0x208f('0x2f')](_0x17dd79[_0x208f('0x3a')],function(_0x247a95){var _0x3ccf2d={};_0x3ccf2d[_0x247a95]={'$like':'%'+_0xcbdc10[_0x208f('0x36')][_0x208f('0x53')]+'%'};return _0x3ccf2d;})});}_0x17dd79=_[_0x208f('0x42')]({},_0x17dd79,_0xcbdc10[_0x208f('0x44')]);return _0x5bd1c8[_0x208f('0x54')](_0x17dd79);}})[_0x208f('0x18')](function(_0xf0d348){if(_0xf0d348){_0x2a9e8e=_0xf0d348[_0x208f('0x3b')];if(!_0xcbdc10[_0x208f('0x36')]['hasOwnProperty'](_0x208f('0x3d'))){_0x17dd79['limit']=qs[_0x208f('0x27')](_0xcbdc10[_0x208f('0x36')][_0x208f('0x27')]);_0x17dd79['offset']=qs[_0x208f('0x26')](_0xcbdc10['query'][_0x208f('0x26')]);}return _0x5bd1c8[_0x208f('0x54')](_0x17dd79);}})['then'](function(_0x3f7be3){if(_0x3f7be3){return _0x3f7be3?{'count':_0x2a9e8e,'rows':_0x3f7be3}:null;}})['then'](respondWithResult(_0x208967,null))[_0x208f('0x49')](handleError(_0x208967,null));};exports[_0x208f('0x55')]=function(_0xdbf70e,_0xf322ba,_0x55c2a9){var _0x2f4e26={};var _0x19fc03={};var _0x15e04e;var _0x2dc68d;return db[_0x208f('0x30')][_0x208f('0x51')]({'where':{'id':_0xdbf70e[_0x208f('0x4a')]['id']}})[_0x208f('0x18')](handleEntityNotFound(_0xf322ba,null))[_0x208f('0x18')](function(_0x169cca){if(_0x169cca){_0x15e04e=_0x169cca;_0x19fc03[_0x208f('0x39')]=_[_0x208f('0x35')](db['FreshsalesField'][_0x208f('0x31')]);_0x19fc03['query']=_[_0x208f('0x35')](_0xdbf70e[_0x208f('0x36')]);_0x19fc03[_0x208f('0x37')]=_['intersection'](_0x19fc03[_0x208f('0x39')],_0x19fc03[_0x208f('0x36')]);_0x2f4e26[_0x208f('0x3a')]=_[_0x208f('0x38')](_0x19fc03[_0x208f('0x39')],qs[_0x208f('0x4b')](_0xdbf70e[_0x208f('0x36')]['fields']));_0x2f4e26['attributes']=_0x2f4e26['attributes'][_0x208f('0x3b')]?_0x2f4e26[_0x208f('0x3a')]:_0x19fc03[_0x208f('0x39')];_0x2f4e26[_0x208f('0x3e')]=qs[_0x208f('0x3f')](_0xdbf70e['query'][_0x208f('0x3f')]);_0x2f4e26[_0x208f('0x40')]=qs['filters'](_[_0x208f('0x41')](_0xdbf70e['query'],_0x19fc03[_0x208f('0x37')]));if(_0xdbf70e['query'][_0x208f('0x53')]){_0x2f4e26[_0x208f('0x40')]=_[_0x208f('0x42')](_0x2f4e26[_0x208f('0x40')],{'$or':_[_0x208f('0x2f')](_0x2f4e26['attributes'],function(_0x1bf5b4){var _0x5843a1={};_0x5843a1[_0x1bf5b4]={'$like':'%'+_0xdbf70e[_0x208f('0x36')][_0x208f('0x53')]+'%'};return _0x5843a1;})});}_0x2f4e26=_[_0x208f('0x42')]({},_0x2f4e26,_0xdbf70e[_0x208f('0x44')]);return _0x15e04e[_0x208f('0x55')](_0x2f4e26);}})[_0x208f('0x18')](function(_0x462a7e){if(_0x462a7e){_0x2dc68d=_0x462a7e[_0x208f('0x3b')];if(!_0xdbf70e[_0x208f('0x36')][_0x208f('0x3c')](_0x208f('0x3d'))){_0x2f4e26[_0x208f('0x27')]=qs[_0x208f('0x27')](_0xdbf70e['query'][_0x208f('0x27')]);_0x2f4e26[_0x208f('0x26')]=qs[_0x208f('0x26')](_0xdbf70e[_0x208f('0x36')]['offset']);}return _0x15e04e[_0x208f('0x55')](_0x2f4e26);}})[_0x208f('0x18')](function(_0x1f7eb7){if(_0x1f7eb7){return _0x1f7eb7?{'count':_0x2dc68d,'rows':_0x1f7eb7}:null;}})['then'](respondWithResult(_0xf322ba,null))['catch'](handleError(_0xf322ba,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 9620880..446fe77 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 _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 +var _0xfccd=['FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./intFreshsalesConfiguration.attributes','exports','define'];(function(_0x2eacf4,_0x214ca7){var _0x2e3361=function(_0x5486ff){while(--_0x5486ff){_0x2eacf4['push'](_0x2eacf4['shift']());}};_0x2e3361(++_0x214ca7);}(_0xfccd,0xc2));var _0xdfcc=function(_0x27f88b,_0x526bad){_0x27f88b=_0x27f88b-0x0;var _0x2114f4=_0xfccd[_0x27f88b];return _0x2114f4;};'use strict';var _=require(_0xdfcc('0x0'));var util=require(_0xdfcc('0x1'));var logger=require(_0xdfcc('0x2'))('api');var moment=require(_0xdfcc('0x3'));var BPromise=require(_0xdfcc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdfcc('0x5'));var rimraf=require(_0xdfcc('0x6'));var config=require('../../config/environment');var attributes=require(_0xdfcc('0x7'));module[_0xdfcc('0x8')]=function(_0x447008,_0x7f9ad6){return _0x447008[_0xdfcc('0x9')](_0xdfcc('0xa'),attributes,{'tableName':_0xdfcc('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 d6d7428..cbc91f0 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 _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 +var _0xd523=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x101a17,_0x5d047a){var _0x3b76ee=function(_0x89be1b){while(--_0x89be1b){_0x101a17['push'](_0x101a17['shift']());}};_0x3b76ee(++_0x5d047a);}(_0xd523,0x153));var _0x3d52=function(_0x2ec041,_0xdd86b2){_0x2ec041=_0x2ec041-0x0;var _0x2ae0cc=_0xd523[_0x2ec041];return _0x2ae0cc;};'use strict';var _=require(_0x3d52('0x0'));var util=require(_0x3d52('0x1'));var moment=require(_0x3d52('0x2'));var BPromise=require(_0x3d52('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d52('0x4'));var db=require(_0x3d52('0x5'))['db'];var utils=require(_0x3d52('0x6'));var logger=require('../../config/logger')(_0x3d52('0x7'));var config=require(_0x3d52('0x8'));var jayson=require(_0x3d52('0x9'));var client=jayson[_0x3d52('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fcc92,_0x189147,_0x2f3ebc){return new BPromise(function(_0x232bd4,_0x2e03c0){return client[_0x3d52('0xb')](_0x4fcc92,_0x2f3ebc)[_0x3d52('0xc')](function(_0x34c184){logger[_0x3d52('0xd')](_0x3d52('0xe'),_0x189147,'request\x20sent');logger[_0x3d52('0xf')](_0x3d52('0x10'),_0x189147,_0x3d52('0x11'),JSON[_0x3d52('0x12')](_0x34c184));if(_0x34c184[_0x3d52('0x13')]){if(_0x34c184['error'][_0x3d52('0x14')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x189147,_0x34c184[_0x3d52('0x13')][_0x3d52('0x15')]);return _0x2e03c0(_0x34c184['error']['message']);}logger['error'](_0x3d52('0xe'),_0x189147,_0x34c184[_0x3d52('0x13')][_0x3d52('0x15')]);return _0x232bd4(_0x34c184[_0x3d52('0x13')][_0x3d52('0x15')]);}else{logger[_0x3d52('0xd')](_0x3d52('0xe'),_0x189147,_0x3d52('0x11'));_0x232bd4(_0x34c184[_0x3d52('0x16')][_0x3d52('0x15')]);}})[_0x3d52('0x17')](function(_0x15cc02){logger[_0x3d52('0x13')](_0x3d52('0xe'),_0x189147,_0x15cc02);_0x2e03c0(_0x15cc02);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index f354da9..a3a17b9 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 _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 +var _0x9fa8=['post','isAuthenticated','create','put','update','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show'];(function(_0x5a6916,_0x4e0d40){var _0x8cba91=function(_0x1670ed){while(--_0x1670ed){_0x5a6916['push'](_0x5a6916['shift']());}};_0x8cba91(++_0x4e0d40);}(_0x9fa8,0x193));var _0x89fa=function(_0x3a221b,_0x17f700){_0x3a221b=_0x3a221b-0x0;var _0x119e82=_0x9fa8[_0x3a221b];return _0x119e82;};'use strict';var multer=require('multer');var util=require(_0x89fa('0x0'));var path=require(_0x89fa('0x1'));var timeout=require(_0x89fa('0x2'));var express=require(_0x89fa('0x3'));var router=express['Router']();var auth=require(_0x89fa('0x4'));var interaction=require(_0x89fa('0x5'));var config=require(_0x89fa('0x6'));var controller=require('./intFreshsalesField.controller');router[_0x89fa('0x7')]('/',auth['isAuthenticated'](),controller[_0x89fa('0x8')]);router[_0x89fa('0x7')](_0x89fa('0x9'),auth['isAuthenticated'](),controller[_0x89fa('0xa')]);router[_0x89fa('0xb')]('/',auth[_0x89fa('0xc')](),controller[_0x89fa('0xd')]);router[_0x89fa('0xe')](_0x89fa('0x9'),auth['isAuthenticated'](),controller[_0x89fa('0xf')]);router['delete'](_0x89fa('0x9'),auth['isAuthenticated'](),controller[_0x89fa('0x10')]);module[_0x89fa('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 68fb304..4943ae8 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 _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 +var _0x765e=['STRING','variable','BOOLEAN','sequelize','ENUM','customVariable','string'];(function(_0x5ed70a,_0x5c3eeb){var _0x4eb166=function(_0x3e7ef9){while(--_0x3e7ef9){_0x5ed70a['push'](_0x5ed70a['shift']());}};_0x4eb166(++_0x5c3eeb);}(_0x765e,0x153));var _0xe765=function(_0x5c38f4,_0x5e0d4c){_0x5c38f4=_0x5c38f4-0x0;var _0x1a8d84=_0x765e[_0x5c38f4];return _0x1a8d84;};'use strict';var Sequelize=require(_0xe765('0x0'));module['exports']={'type':{'type':Sequelize[_0xe765('0x1')]('string','variable',_0xe765('0x2'),'keyValue'),'defaultValue':_0xe765('0x3')},'content':{'type':Sequelize[_0xe765('0x4')]},'key':{'type':Sequelize[_0xe765('0x4')]},'keyType':{'type':Sequelize[_0xe765('0x1')](_0xe765('0x3'),_0xe765('0x5'),_0xe765('0x2'))},'keyContent':{'type':Sequelize[_0xe765('0x4')]},'idField':{'type':Sequelize[_0xe765('0x4')]},'nameField':{'type':Sequelize[_0xe765('0x4')]},'customField':{'type':Sequelize[_0xe765('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 821728f..9fc569c 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 _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 +var _0x5fd7=['offset','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','FreshsalesField','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json'];(function(_0x28f579,_0x4778a0){var _0xdbda7=function(_0x347432){while(--_0x347432){_0x28f579['push'](_0x28f579['shift']());}};_0xdbda7(++_0x4778a0);}(_0x5fd7,0x19b));var _0x75fd=function(_0x3f3127,_0xb3d6bd){_0x3f3127=_0x3f3127-0x0;var _0x1fcbcd=_0x5fd7[_0x3f3127];return _0x1fcbcd;};'use strict';var pdf=require(_0x75fd('0x0'));var emlformat=require(_0x75fd('0x1'));var rimraf=require(_0x75fd('0x2'));var zipdir=require(_0x75fd('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x75fd('0x4'));var moment=require(_0x75fd('0x5'));var BPromise=require(_0x75fd('0x6'));var Mustache=require(_0x75fd('0x7'));var util=require(_0x75fd('0x8'));var path=require(_0x75fd('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x75fd('0xa'));var squel=require('squel');var crypto=require(_0x75fd('0xb'));var jsforce=require(_0x75fd('0xc'));var deskjs=require(_0x75fd('0xd'));var toCsv=require(_0x75fd('0xe'));var querystring=require('querystring');var Papa=require(_0x75fd('0xf'));var Redis=require(_0x75fd('0x10'));var authService=require(_0x75fd('0x11'));var qs=require(_0x75fd('0x12'));var as=require(_0x75fd('0x13'));var hardwareService=require(_0x75fd('0x14'));var logger=require(_0x75fd('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x75fd('0x16'));var db=require(_0x75fd('0x17'))['db'];function respondWithStatusCode(_0x3525ae,_0x9e3ef){_0x9e3ef=_0x9e3ef||0xcc;return function(_0x42c7e2){if(_0x42c7e2){return _0x3525ae[_0x75fd('0x18')](_0x9e3ef);}return _0x3525ae[_0x75fd('0x19')](_0x9e3ef)['end']();};}function respondWithResult(_0x54ae4a,_0x3b24f4){_0x3b24f4=_0x3b24f4||0xc8;return function(_0x402ab0){if(_0x402ab0){return _0x54ae4a[_0x75fd('0x19')](_0x3b24f4)[_0x75fd('0x1a')](_0x402ab0);}};}function respondWithFilteredResult(_0x59dd64,_0x100f50){return function(_0x581eb1){if(_0x581eb1){var _0x3ac12b=_0x581eb1['count'],_0x5125f8=_0x100f50['offset'],_0x50fef0=_0x100f50[_0x75fd('0x1b')]+_0x100f50['limit'],_0x80620c;if(_0x50fef0>=_0x3ac12b){_0x50fef0=_0x3ac12b;_0x80620c=0xc8;}else{_0x80620c=0xce;}_0x59dd64[_0x75fd('0x19')](_0x80620c);return _0x59dd64['set'](_0x75fd('0x1c'),_0x5125f8+'-'+_0x50fef0+'/'+_0x3ac12b)[_0x75fd('0x1a')](_0x581eb1);}return null;};}function patchUpdates(_0x1d57ef){return function(_0x2ad529){try{jsonpatch[_0x75fd('0x1d')](_0x2ad529,_0x1d57ef,!![]);}catch(_0x597d62){return BPromise[_0x75fd('0x1e')](_0x597d62);}return _0x2ad529['save']();};}function saveUpdates(_0x29f7e4,_0x848ff5){return function(_0x106cb4){if(_0x106cb4){return _0x106cb4[_0x75fd('0x1f')](_0x29f7e4)[_0x75fd('0x20')](function(_0x515bc1){return _0x515bc1;});}return null;};}function removeEntity(_0x11edf1,_0x9f3541){return function(_0x4582c9){if(_0x4582c9){return _0x4582c9[_0x75fd('0x21')]()[_0x75fd('0x20')](function(){_0x11edf1[_0x75fd('0x19')](0xcc)[_0x75fd('0x22')]();});}};}function handleEntityNotFound(_0x4a4abd,_0x23637f){return function(_0x54f78d){if(!_0x54f78d){_0x4a4abd[_0x75fd('0x18')](0x194);}return _0x54f78d;};}function handleError(_0x317b86,_0x1645ed){_0x1645ed=_0x1645ed||0x1f4;return function(_0x5b87ea){logger[_0x75fd('0x23')](_0x5b87ea[_0x75fd('0x24')]);if(_0x5b87ea[_0x75fd('0x25')]){delete _0x5b87ea['name'];}_0x317b86[_0x75fd('0x19')](_0x1645ed)[_0x75fd('0x26')](_0x5b87ea);};}exports[_0x75fd('0x27')]=function(_0x4f184f,_0x5830e6){var _0x218845={},_0x20869a={},_0x271986={'count':0x0,'rows':[]};var _0x1e9d13=_[_0x75fd('0x28')](db[_0x75fd('0x29')]['rawAttributes'],function(_0x22bbeb){return{'name':_0x22bbeb[_0x75fd('0x2a')],'type':_0x22bbeb['type'][_0x75fd('0x2b')]};});_0x20869a['model']=_[_0x75fd('0x28')](_0x1e9d13,'name');_0x20869a[_0x75fd('0x2c')]=_[_0x75fd('0x2d')](_0x4f184f['query']);_0x20869a[_0x75fd('0x2e')]=_['intersection'](_0x20869a[_0x75fd('0x2f')],_0x20869a[_0x75fd('0x2c')]);_0x218845[_0x75fd('0x30')]=_[_0x75fd('0x31')](_0x20869a['model'],qs[_0x75fd('0x32')](_0x4f184f[_0x75fd('0x2c')][_0x75fd('0x32')]));_0x218845[_0x75fd('0x30')]=_0x218845[_0x75fd('0x30')][_0x75fd('0x33')]?_0x218845[_0x75fd('0x30')]:_0x20869a[_0x75fd('0x2f')];if(!_0x4f184f[_0x75fd('0x2c')][_0x75fd('0x34')]('nolimit')){_0x218845[_0x75fd('0x35')]=qs['limit'](_0x4f184f['query'][_0x75fd('0x35')]);_0x218845[_0x75fd('0x1b')]=qs[_0x75fd('0x1b')](_0x4f184f[_0x75fd('0x2c')][_0x75fd('0x1b')]);}_0x218845['order']=qs[_0x75fd('0x36')](_0x4f184f[_0x75fd('0x2c')]['sort']);_0x218845[_0x75fd('0x37')]=qs[_0x75fd('0x2e')](_[_0x75fd('0x38')](_0x4f184f['query'],_0x20869a[_0x75fd('0x2e')]),_0x1e9d13);if(_0x4f184f[_0x75fd('0x2c')][_0x75fd('0x39')]){_0x218845[_0x75fd('0x37')]=_[_0x75fd('0x3a')](_0x218845[_0x75fd('0x37')],{'$or':_[_0x75fd('0x28')](_0x1e9d13,function(_0x52f74a){if(_0x52f74a[_0x75fd('0x3b')]!==_0x75fd('0x3c')){var _0x163e6f={};_0x163e6f[_0x52f74a['name']]={'$like':'%'+_0x4f184f['query'][_0x75fd('0x39')]+'%'};return _0x163e6f;}})});}_0x218845=_[_0x75fd('0x3a')]({},_0x218845,_0x4f184f[_0x75fd('0x3d')]);var _0x26150c={'where':_0x218845[_0x75fd('0x37')]};return db[_0x75fd('0x29')][_0x75fd('0x3e')](_0x26150c)[_0x75fd('0x20')](function(_0x10ee62){_0x271986[_0x75fd('0x3e')]=_0x10ee62;if(_0x4f184f[_0x75fd('0x2c')][_0x75fd('0x3f')]){_0x218845['include']=[{'all':!![]}];}return db[_0x75fd('0x29')][_0x75fd('0x40')](_0x218845);})[_0x75fd('0x20')](function(_0x5b8a82){_0x271986[_0x75fd('0x41')]=_0x5b8a82;return _0x271986;})[_0x75fd('0x20')](respondWithFilteredResult(_0x5830e6,_0x218845))[_0x75fd('0x42')](handleError(_0x5830e6,null));};exports[_0x75fd('0x43')]=function(_0x48663f,_0xef9f32){var _0x17193c={'raw':!![],'where':{'id':_0x48663f[_0x75fd('0x44')]['id']}},_0x1062c4={};_0x1062c4[_0x75fd('0x2f')]=_[_0x75fd('0x2d')](db[_0x75fd('0x29')][_0x75fd('0x45')]);_0x1062c4['query']=_[_0x75fd('0x2d')](_0x48663f[_0x75fd('0x2c')]);_0x1062c4['filters']=_['intersection'](_0x1062c4[_0x75fd('0x2f')],_0x1062c4[_0x75fd('0x2c')]);_0x17193c[_0x75fd('0x30')]=_[_0x75fd('0x31')](_0x1062c4[_0x75fd('0x2f')],qs[_0x75fd('0x32')](_0x48663f[_0x75fd('0x2c')]['fields']));_0x17193c[_0x75fd('0x30')]=_0x17193c[_0x75fd('0x30')]['length']?_0x17193c['attributes']:_0x1062c4['model'];if(_0x48663f[_0x75fd('0x2c')][_0x75fd('0x3f')]){_0x17193c[_0x75fd('0x46')]=[{'all':!![]}];}_0x17193c=_[_0x75fd('0x3a')]({},_0x17193c,_0x48663f[_0x75fd('0x3d')]);return db['FreshsalesField'][_0x75fd('0x47')](_0x17193c)[_0x75fd('0x20')](handleEntityNotFound(_0xef9f32,null))[_0x75fd('0x20')](respondWithResult(_0xef9f32,null))[_0x75fd('0x42')](handleError(_0xef9f32,null));};exports['create']=function(_0x56bf32,_0x53b2d0){return db[_0x75fd('0x29')]['create'](_0x56bf32[_0x75fd('0x48')],{})[_0x75fd('0x20')](respondWithResult(_0x53b2d0,0xc9))[_0x75fd('0x42')](handleError(_0x53b2d0,null));};exports['update']=function(_0x21175e,_0xb92cb3){if(_0x21175e[_0x75fd('0x48')]['id']){delete _0x21175e[_0x75fd('0x48')]['id'];}return db[_0x75fd('0x29')][_0x75fd('0x47')]({'where':{'id':_0x21175e['params']['id']}})['then'](handleEntityNotFound(_0xb92cb3,null))['then'](saveUpdates(_0x21175e[_0x75fd('0x48')],null))[_0x75fd('0x20')](respondWithResult(_0xb92cb3,null))[_0x75fd('0x42')](handleError(_0xb92cb3,null));};exports[_0x75fd('0x21')]=function(_0x8b524f,_0x408871){return db[_0x75fd('0x29')][_0x75fd('0x47')]({'where':{'id':_0x8b524f['params']['id']}})[_0x75fd('0x20')](handleEntityNotFound(_0x408871,null))[_0x75fd('0x20')](removeEntity(_0x408871,null))[_0x75fd('0x42')](handleError(_0x408871,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index bea1f6d..93c98d8 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 _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 +var _0xd9b9=['api','bluebird','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','idField','FieldId','util','../../config/logger'];(function(_0x3b5049,_0x495a94){var _0x12454e=function(_0x3988d3){while(--_0x3988d3){_0x3b5049['push'](_0x3b5049['shift']());}};_0x12454e(++_0x495a94);}(_0xd9b9,0x111));var _0x9d9b=function(_0x6f7ebb,_0xb330f5){_0x6f7ebb=_0x6f7ebb-0x0;var _0x2f32dd=_0xd9b9[_0x6f7ebb];return _0x2f32dd;};'use strict';var _=require('lodash');var util=require(_0x9d9b('0x0'));var logger=require(_0x9d9b('0x1'))(_0x9d9b('0x2'));var moment=require('moment');var BPromise=require(_0x9d9b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9d9b('0x4'));var config=require(_0x9d9b('0x5'));var attributes=require(_0x9d9b('0x6'));module[_0x9d9b('0x7')]=function(_0x442aba,_0x1cbf4e){return _0x442aba[_0x9d9b('0x8')]('FreshsalesField',attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x9d9b('0x9'),_0x9d9b('0xa')],'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 123d119..25bae71 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 _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 +var _0x347a=['util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash'];(function(_0x1c448d,_0x54a98d){var _0x171650=function(_0x14321d){while(--_0x14321d){_0x1c448d['push'](_0x1c448d['shift']());}};_0x171650(++_0x54a98d);}(_0x347a,0x153));var _0xa347=function(_0x39a99d,_0x36fdec){_0x39a99d=_0x39a99d-0x0;var _0x229fd5=_0x347a[_0x39a99d];return _0x229fd5;};'use strict';var _=require(_0xa347('0x0'));var util=require(_0xa347('0x1'));var moment=require('moment');var BPromise=require(_0xa347('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa347('0x3'));var db=require(_0xa347('0x4'))['db'];var utils=require(_0xa347('0x5'));var logger=require(_0xa347('0x6'))(_0xa347('0x7'));var config=require(_0xa347('0x8'));var jayson=require(_0xa347('0x9'));var client=jayson[_0xa347('0xa')][_0xa347('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3191f2,_0x3edeca,_0x211fbe){return new BPromise(function(_0x2e71c3,_0x3f83c3){return client['request'](_0x3191f2,_0x211fbe)['then'](function(_0x694643){logger[_0xa347('0xc')](_0xa347('0xd'),_0x3edeca,_0xa347('0xe'));logger[_0xa347('0xf')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x3edeca,_0xa347('0xe'),JSON[_0xa347('0x10')](_0x694643));if(_0x694643[_0xa347('0x11')]){if(_0x694643[_0xa347('0x11')][_0xa347('0x12')]===0x1f4){logger[_0xa347('0x11')](_0xa347('0xd'),_0x3edeca,_0x694643[_0xa347('0x11')][_0xa347('0x13')]);return _0x3f83c3(_0x694643['error'][_0xa347('0x13')]);}logger[_0xa347('0x11')](_0xa347('0xd'),_0x3edeca,_0x694643[_0xa347('0x11')][_0xa347('0x13')]);return _0x2e71c3(_0x694643[_0xa347('0x11')][_0xa347('0x13')]);}else{logger['info'](_0xa347('0xd'),_0x3edeca,'request\x20sent');_0x2e71c3(_0x694643['result'][_0xa347('0x13')]);}})['catch'](function(_0x2e89be){logger[_0xa347('0x11')](_0xa347('0xd'),_0x3edeca,_0x2e89be);_0x3f83c3(_0x2e89be);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index a401691..ee25fbe 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 _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 +var _0xa5fc=['isAuthenticated','index','show','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSalesforceAccount.controller','get'];(function(_0x524c6d,_0x40e4f7){var _0x266c61=function(_0x4a7e24){while(--_0x4a7e24){_0x524c6d['push'](_0x524c6d['shift']());}};_0x266c61(++_0x40e4f7);}(_0xa5fc,0x146));var _0xca5f=function(_0x3ff600,_0x2af9f2){_0x3ff600=_0x3ff600-0x0;var _0x4c749f=_0xa5fc[_0x3ff600];return _0x4c749f;};'use strict';var multer=require(_0xca5f('0x0'));var util=require(_0xca5f('0x1'));var path=require(_0xca5f('0x2'));var timeout=require(_0xca5f('0x3'));var express=require(_0xca5f('0x4'));var router=express[_0xca5f('0x5')]();var auth=require(_0xca5f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xca5f('0x7'));var controller=require(_0xca5f('0x8'));router[_0xca5f('0x9')]('/',auth[_0xca5f('0xa')](),controller[_0xca5f('0xb')]);router['get']('/:id',auth[_0xca5f('0xa')](),controller[_0xca5f('0xc')]);router[_0xca5f('0x9')](_0xca5f('0xd'),auth[_0xca5f('0xa')](),controller[_0xca5f('0xe')]);router[_0xca5f('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0xca5f('0xf')]);router['post']('/',auth[_0xca5f('0xa')](),controller[_0xca5f('0x10')]);router[_0xca5f('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xca5f('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xca5f('0x13')]);router[_0xca5f('0x14')](_0xca5f('0x15'),auth[_0xca5f('0xa')](),controller[_0xca5f('0x16')]);module[_0xca5f('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index b1b8f3e..0537828 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 _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 +var _0xc4aa=['STRING','username','ENUM','integrationTab','newTab','sequelize','exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc4aa[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'name':{'type':Sequelize[_0xac4a('0x2')]},'description':{'type':Sequelize[_0xac4a('0x2')]},'username':{'type':Sequelize[_0xac4a('0x2')],'unique':_0xac4a('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xac4a('0x2')]},'securityToken':{'type':Sequelize[_0xac4a('0x2')]},'serverUrl':{'type':Sequelize[_0xac4a('0x2')]},'type':{'type':Sequelize[_0xac4a('0x4')](_0xac4a('0x5'),_0xac4a('0x6')),'defaultValue':_0xac4a('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index a8f5cc0..3184762 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 _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 +var _0x014d=['name','send','index','map','SalesforceAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','rawAttributes','length','create','body','update','find','params','getConfigurations','findOne','SalesforceConfiguration','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','SalesforceField','remoteUri','clientId','clientSecret','username','securityToken','slice','substring','lastIndexOf','password','concat','isNil','ticketType','sobject','describe','CallDisposition','CallDurationInSeconds','CallType','IsArchived','Priority','Status','Type','Case','Origin','SuppliedName','SuppliedCompany','remove','custom','label','value','boolean','True','true','False','false','statusCode','getFields','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','test','Sequelize','ValidationError','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','json','limit','set','Content-Range','apply','reject','then','destroy','sendStatus','stack'];(function(_0x102f97,_0x5bda2f){var _0xd22058=function(_0x2ccc1f){while(--_0x2ccc1f){_0x102f97['push'](_0x102f97['shift']());}};_0xd22058(++_0x5bda2f);}(_0x014d,0x159));var _0xd014=function(_0x49a3e2,_0x19aecb){_0x49a3e2=_0x49a3e2-0x0;var _0x3c6500=_0x014d[_0x49a3e2];return _0x3c6500;};'use strict';var pdf=require(_0xd014('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd014('0x1'));var zipdir=require(_0xd014('0x2'));var jsonpatch=require(_0xd014('0x3'));var rp=require('request-promise');var moment=require(_0xd014('0x4'));var BPromise=require(_0xd014('0x5'));var Mustache=require(_0xd014('0x6'));var util=require('util');var path=require(_0xd014('0x7'));var sox=require(_0xd014('0x8'));var csv=require(_0xd014('0x9'));var ejs=require(_0xd014('0xa'));var fs=require('fs');var _=require(_0xd014('0xb'));var squel=require(_0xd014('0xc'));var crypto=require('crypto');var jsforce=require(_0xd014('0xd'));var deskjs=require(_0xd014('0xe'));var toCsv=require(_0xd014('0x9'));var querystring=require(_0xd014('0xf'));var Papa=require('papaparse');var Redis=require(_0xd014('0x10'));var authService=require(_0xd014('0x11'));var qs=require(_0xd014('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd014('0x13'));var logger=require(_0xd014('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xd014('0x15'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x5d7d39,_0x393bb4,_0x305a0f){if(_0x305a0f){var _0x5eeddc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5eeddc[_0xd014('0x16')](_0x393bb4)){return _0x5d7d39;}else{throw new db[(_0xd014('0x17'))][(_0xd014('0x18'))]('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 _0x5d7d39;}}function respondWithRpcPromise(_0x2faef4,_0x462578,_0x56cacd,_0x4b25a4){return new BPromise(function(_0x23043e,_0x4c39f4){var _0xfff186=_0x4b25a4||client;return _0xfff186[_0xd014('0x19')](_0x2faef4,_0x56cacd)['then'](function(_0x3ba248){logger[_0xd014('0x1a')](_0xd014('0x1b'),_0x462578,_0xd014('0x1c'));logger['debug'](_0xd014('0x1d'),_0x462578,'request\x20sent',JSON[_0xd014('0x1e')](_0x3ba248));if(_0x3ba248[_0xd014('0x1f')]){if(_0x3ba248[_0xd014('0x1f')][_0xd014('0x20')]===0x1f4){logger[_0xd014('0x1f')]('SalesforceAccount,\x20%s,\x20%s',_0x462578,_0x3ba248[_0xd014('0x1f')]['message']);return _0x4c39f4(_0x3ba248[_0xd014('0x1f')][_0xd014('0x21')]);}logger[_0xd014('0x1f')](_0xd014('0x1b'),_0x462578,_0x3ba248[_0xd014('0x1f')][_0xd014('0x21')]);return _0x23043e(_0x3ba248['error'][_0xd014('0x21')]);}else{logger[_0xd014('0x1a')](_0xd014('0x1b'),_0x462578,_0xd014('0x1c'));_0x23043e(_0x3ba248['result']['message']);}})['catch'](function(_0x25ca20){logger[_0xd014('0x1f')]('SalesforceAccount,\x20%s,\x20%s',_0x462578,_0x25ca20);_0x4c39f4(_0x25ca20);});});}function respondWithStatusCode(_0x3fb426,_0x128912){_0x128912=_0x128912||0xcc;return function(_0x270145){if(_0x270145){return _0x3fb426['sendStatus'](_0x128912);}return _0x3fb426[_0xd014('0x22')](_0x128912)['end']();};}function respondWithResult(_0x3d6e8d,_0x2c0b34){_0x2c0b34=_0x2c0b34||0xc8;return function(_0x3df8ea){if(_0x3df8ea){return _0x3d6e8d[_0xd014('0x22')](_0x2c0b34)[_0xd014('0x23')](_0x3df8ea);}};}function respondWithFilteredResult(_0x3e9dfb,_0x9b241b){return function(_0x2c44c1){if(_0x2c44c1){var _0x33bcd8=_0x2c44c1['count'],_0x47b722=_0x9b241b['offset'],_0x13b043=_0x9b241b['offset']+_0x9b241b[_0xd014('0x24')],_0x315798;if(_0x13b043>=_0x33bcd8){_0x13b043=_0x33bcd8;_0x315798=0xc8;}else{_0x315798=0xce;}_0x3e9dfb['status'](_0x315798);return _0x3e9dfb[_0xd014('0x25')](_0xd014('0x26'),_0x47b722+'-'+_0x13b043+'/'+_0x33bcd8)[_0xd014('0x23')](_0x2c44c1);}return null;};}function patchUpdates(_0x3e6075){return function(_0x3e4431){try{jsonpatch[_0xd014('0x27')](_0x3e4431,_0x3e6075,!![]);}catch(_0x568ccc){return BPromise[_0xd014('0x28')](_0x568ccc);}return _0x3e4431['save']();};}function saveUpdates(_0x1d17c9,_0xf0573){return function(_0x595262){if(_0x595262){return _0x595262['update'](_0x1d17c9)[_0xd014('0x29')](function(_0x21a49f){return _0x21a49f;});}return null;};}function removeEntity(_0x4e5b3f,_0x114dff){return function(_0x48fee3){if(_0x48fee3){return _0x48fee3[_0xd014('0x2a')]()[_0xd014('0x29')](function(){_0x4e5b3f[_0xd014('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1de349,_0x26995d){return function(_0xd3a076){if(!_0xd3a076){_0x1de349[_0xd014('0x2b')](0x194);}return _0xd3a076;};}function handleError(_0x154368,_0xddfac6){_0xddfac6=_0xddfac6||0x1f4;return function(_0x51a272){logger[_0xd014('0x1f')](_0x51a272[_0xd014('0x2c')]);if(_0x51a272[_0xd014('0x2d')]){delete _0x51a272['name'];}_0x154368[_0xd014('0x22')](_0xddfac6)[_0xd014('0x2e')](_0x51a272);};}exports[_0xd014('0x2f')]=function(_0xcb8980,_0x5b0194){var _0xf051c4={},_0x333359={},_0xc76d45={'count':0x0,'rows':[]};var _0x4215e9=_[_0xd014('0x30')](db[_0xd014('0x31')]['rawAttributes'],function(_0x4c4995){return{'name':_0x4c4995[_0xd014('0x32')],'type':_0x4c4995[_0xd014('0x33')][_0xd014('0x34')]};});_0x333359[_0xd014('0x35')]=_[_0xd014('0x30')](_0x4215e9,_0xd014('0x2d'));_0x333359[_0xd014('0x36')]=_[_0xd014('0x37')](_0xcb8980[_0xd014('0x36')]);_0x333359[_0xd014('0x38')]=_[_0xd014('0x39')](_0x333359[_0xd014('0x35')],_0x333359[_0xd014('0x36')]);_0xf051c4[_0xd014('0x3a')]=_[_0xd014('0x39')](_0x333359[_0xd014('0x35')],qs[_0xd014('0x3b')](_0xcb8980[_0xd014('0x36')][_0xd014('0x3b')]));_0xf051c4[_0xd014('0x3a')]=_0xf051c4[_0xd014('0x3a')]['length']?_0xf051c4['attributes']:_0x333359[_0xd014('0x35')];if(!_0xcb8980[_0xd014('0x36')][_0xd014('0x3c')]('nolimit')){_0xf051c4[_0xd014('0x24')]=qs['limit'](_0xcb8980[_0xd014('0x36')][_0xd014('0x24')]);_0xf051c4['offset']=qs[_0xd014('0x3d')](_0xcb8980[_0xd014('0x36')][_0xd014('0x3d')]);}_0xf051c4[_0xd014('0x3e')]=qs[_0xd014('0x3f')](_0xcb8980[_0xd014('0x36')]['sort']);_0xf051c4[_0xd014('0x40')]=qs[_0xd014('0x38')](_[_0xd014('0x41')](_0xcb8980[_0xd014('0x36')],_0x333359[_0xd014('0x38')]),_0x4215e9);if(_0xcb8980[_0xd014('0x36')][_0xd014('0x42')]){_0xf051c4[_0xd014('0x40')]=_[_0xd014('0x43')](_0xf051c4['where'],{'$or':_[_0xd014('0x30')](_0x4215e9,function(_0x49f481){if(_0x49f481[_0xd014('0x33')]!==_0xd014('0x44')){var _0x5d350e={};_0x5d350e[_0x49f481['name']]={'$like':'%'+_0xcb8980[_0xd014('0x36')]['filter']+'%'};return _0x5d350e;}})});}_0xf051c4=_[_0xd014('0x43')]({},_0xf051c4,_0xcb8980[_0xd014('0x45')]);var _0x5d2bbc={'where':_0xf051c4[_0xd014('0x40')]};return db[_0xd014('0x31')]['count'](_0x5d2bbc)[_0xd014('0x29')](function(_0xa3e0eb){_0xc76d45[_0xd014('0x46')]=_0xa3e0eb;if(_0xcb8980['query'][_0xd014('0x47')]){_0xf051c4[_0xd014('0x48')]=[{'all':!![]}];}return db[_0xd014('0x31')][_0xd014('0x49')](_0xf051c4);})[_0xd014('0x29')](function(_0x1373d9){_0xc76d45[_0xd014('0x4a')]=_0x1373d9;return _0xc76d45;})[_0xd014('0x29')](respondWithFilteredResult(_0x5b0194,_0xf051c4))[_0xd014('0x4b')](handleError(_0x5b0194,null));};exports['show']=function(_0x30b13e,_0x4c828a){var _0x4c365d={'raw':![],'where':{'id':_0x30b13e['params']['id']}},_0x4a47d1={};_0x4a47d1[_0xd014('0x35')]=_[_0xd014('0x37')](db[_0xd014('0x31')][_0xd014('0x4c')]);_0x4a47d1['query']=_[_0xd014('0x37')](_0x30b13e[_0xd014('0x36')]);_0x4a47d1[_0xd014('0x38')]=_[_0xd014('0x39')](_0x4a47d1[_0xd014('0x35')],_0x4a47d1['query']);_0x4c365d['attributes']=_[_0xd014('0x39')](_0x4a47d1['model'],qs['fields'](_0x30b13e['query'][_0xd014('0x3b')]));_0x4c365d[_0xd014('0x3a')]=_0x4c365d[_0xd014('0x3a')][_0xd014('0x4d')]?_0x4c365d[_0xd014('0x3a')]:_0x4a47d1[_0xd014('0x35')];if(_0x30b13e[_0xd014('0x36')]['includeAll']){_0x4c365d['include']=[{'all':!![]}];}_0x4c365d=_[_0xd014('0x43')]({},_0x4c365d,_0x30b13e[_0xd014('0x45')]);return db[_0xd014('0x31')]['find'](_0x4c365d)[_0xd014('0x29')](handleEntityNotFound(_0x4c828a,null))[_0xd014('0x29')](respondWithResult(_0x4c828a,null))['catch'](handleError(_0x4c828a,null));};exports[_0xd014('0x4e')]=function(_0x23c85a,_0x145b99){return db[_0xd014('0x31')][_0xd014('0x4e')](_0x23c85a[_0xd014('0x4f')],{})['then'](respondWithResult(_0x145b99,0xc9))[_0xd014('0x4b')](handleError(_0x145b99,null));};exports[_0xd014('0x50')]=function(_0x172bbb,_0x409c15){if(_0x172bbb[_0xd014('0x4f')]['id']){delete _0x172bbb[_0xd014('0x4f')]['id'];}return db[_0xd014('0x31')][_0xd014('0x51')]({'where':{'id':_0x172bbb[_0xd014('0x52')]['id']}})[_0xd014('0x29')](handleEntityNotFound(_0x409c15,null))['then'](saveUpdates(_0x172bbb[_0xd014('0x4f')],null))[_0xd014('0x29')](respondWithResult(_0x409c15,null))['catch'](handleError(_0x409c15,null));};exports[_0xd014('0x2a')]=function(_0x2ebc2d,_0x5efca6){return db[_0xd014('0x31')]['find']({'where':{'id':_0x2ebc2d[_0xd014('0x52')]['id']}})[_0xd014('0x29')](handleEntityNotFound(_0x5efca6,null))['then'](removeEntity(_0x5efca6,null))[_0xd014('0x4b')](handleError(_0x5efca6,null));};exports[_0xd014('0x53')]=function(_0x4f3181,_0x1739da,_0x2b6c61){var _0x21ded9={};var _0x582603={};var _0x15ed40;var _0x7b1e50;return db[_0xd014('0x31')][_0xd014('0x54')]({'where':{'id':_0x4f3181[_0xd014('0x52')]['id']}})[_0xd014('0x29')](handleEntityNotFound(_0x1739da,null))[_0xd014('0x29')](function(_0x1bb749){if(_0x1bb749){_0x15ed40=_0x1bb749;_0x582603[_0xd014('0x35')]=_[_0xd014('0x37')](db[_0xd014('0x55')]['rawAttributes']);_0x582603['query']=_[_0xd014('0x37')](_0x4f3181['query']);_0x582603[_0xd014('0x38')]=_[_0xd014('0x39')](_0x582603[_0xd014('0x35')],_0x582603['query']);_0x21ded9[_0xd014('0x3a')]=_[_0xd014('0x39')](_0x582603[_0xd014('0x35')],qs['fields'](_0x4f3181['query'][_0xd014('0x3b')]));_0x21ded9[_0xd014('0x3a')]=_0x21ded9['attributes'][_0xd014('0x4d')]?_0x21ded9[_0xd014('0x3a')]:_0x582603[_0xd014('0x35')];_0x21ded9[_0xd014('0x3e')]=qs['sort'](_0x4f3181[_0xd014('0x36')][_0xd014('0x3f')]);_0x21ded9[_0xd014('0x40')]=qs[_0xd014('0x38')](_['pick'](_0x4f3181[_0xd014('0x36')],_0x582603['filters']));if(_0x4f3181['query'][_0xd014('0x42')]){_0x21ded9[_0xd014('0x40')]=_[_0xd014('0x43')](_0x21ded9[_0xd014('0x40')],{'$or':_[_0xd014('0x30')](_0x21ded9['attributes'],function(_0x2d8bb4){var _0x89ddb8={};_0x89ddb8[_0x2d8bb4]={'$like':'%'+_0x4f3181[_0xd014('0x36')][_0xd014('0x42')]+'%'};return _0x89ddb8;})});}_0x21ded9=_[_0xd014('0x43')]({},_0x21ded9,_0x4f3181[_0xd014('0x45')]);return _0x15ed40[_0xd014('0x53')](_0x21ded9);}})[_0xd014('0x29')](function(_0x465000){if(_0x465000){_0x7b1e50=_0x465000[_0xd014('0x4d')];if(!_0x4f3181[_0xd014('0x36')][_0xd014('0x3c')](_0xd014('0x56'))){_0x21ded9[_0xd014('0x24')]=qs[_0xd014('0x24')](_0x4f3181[_0xd014('0x36')]['limit']);_0x21ded9[_0xd014('0x3d')]=qs[_0xd014('0x3d')](_0x4f3181['query'][_0xd014('0x3d')]);}return _0x15ed40[_0xd014('0x53')](_0x21ded9);}})[_0xd014('0x29')](function(_0x48829c){if(_0x48829c){return _0x48829c?{'count':_0x7b1e50,'rows':_0x48829c}:null;}})['then'](respondWithResult(_0x1739da,null))[_0xd014('0x4b')](handleError(_0x1739da,null));};exports[_0xd014('0x57')]=function(_0x2c11ab,_0x49373d,_0x1b2276){if(_0x2c11ab[_0xd014('0x4f')]['id']){delete _0x2c11ab[_0xd014('0x4f')]['id'];}return db['SalesforceAccount'][_0xd014('0x54')]({'where':{'id':_0x2c11ab[_0xd014('0x52')]['id']}})[_0xd014('0x29')](handleEntityNotFound(_0x49373d,null))['then'](function(_0x5b953a){if(_0x5b953a){_0x2c11ab[_0xd014('0x4f')]['AccountId']=_0x5b953a['id'];_0x2c11ab[_0xd014('0x4f')][_0xd014('0x58')]=integrations[_0xd014('0x59')](_0x2c11ab[_0xd014('0x4f')][_0xd014('0x5a')],_0x2c11ab['body'][_0xd014('0x33')]);_0x2c11ab[_0xd014('0x4f')][_0xd014('0x5b')]=integrations['getDescriptions'](_0x2c11ab['body'][_0xd014('0x5a')],_0x2c11ab[_0xd014('0x4f')][_0xd014('0x33')]);return db[_0xd014('0x55')]['create'](_0x2c11ab['body'],{'include':[{'model':db['SalesforceField'],'as':_0xd014('0x58')},{'model':db[_0xd014('0x5c')],'as':_0xd014('0x5b')}]});}return null;})[_0xd014('0x29')](respondWithResult(_0x49373d,null))[_0xd014('0x4b')](handleError(_0x49373d,null));};exports['getFields']=function(_0x560a6e,_0x105c46,_0x19e995){var _0x3cac19;var _0x1886bf='';var _0x39148b='Task';return db[_0xd014('0x31')][_0xd014('0x54')]({'where':{'id':_0x560a6e['params']['id']},'attributes':['id',_0xd014('0x5d'),_0xd014('0x5e'),_0xd014('0x5f'),_0xd014('0x60'),'password',_0xd014('0x61')]})[_0xd014('0x29')](handleEntityNotFound(_0x105c46,null))[_0xd014('0x29')](function(_0x4a0c29){if(_0x4a0c29){_0x1886bf=_0x4a0c29[_0xd014('0x5d')];var _0x9f7d80=_0x1886bf[_0xd014('0x62')](-0x1);if(_0x9f7d80==='/'){_0x1886bf=_0x1886bf[_0xd014('0x63')](0x0,_0x1886bf[_0xd014('0x64')](_0x9f7d80));}_0x3cac19=new jsforce['Connection']({'oauth2':{'loginUrl':_0x1886bf,'clientId':_0x4a0c29[_0xd014('0x5e')],'clientSecret':_0x4a0c29['clientSecret']}});return _0x3cac19['login'](_0x4a0c29[_0xd014('0x60')],_0x4a0c29[_0xd014('0x65')][_0xd014('0x66')](_0x4a0c29['securityToken']));}})[_0xd014('0x29')](function(_0x20ef95){if(_0x20ef95){if(!_[_0xd014('0x67')](_0x560a6e['query'][_0xd014('0x68')])){_0x39148b=_0x560a6e[_0xd014('0x36')][_0xd014('0x68')];}return _0x3cac19[_0xd014('0x69')](_0x39148b)[_0xd014('0x6a')]();}})[_0xd014('0x29')](function(_0x23525f){var _0x157470=[_0xd014('0x6b'),_0xd014('0x6c'),'CallObject',_0xd014('0x6d'),_0xd014('0x6e'),_0xd014('0x6f'),_0xd014('0x70'),_0xd014('0x71')];if(!_[_0xd014('0x67')](_0x560a6e['query'][_0xd014('0x68')])&&_0x560a6e[_0xd014('0x36')][_0xd014('0x68')]===_0xd014('0x72')){_0x157470=[_0xd014('0x71'),_0xd014('0x73'),'Reason',_0xd014('0x70'),_0xd014('0x6f'),'IsEscalated',_0xd014('0x74'),_0xd014('0x75')];}if(_0x23525f){_[_0xd014('0x76')](_0x23525f['fields'],function(_0x18be6e){return _0x18be6e[_0xd014('0x77')]===![]&&!_0x157470['includes'](_0x18be6e[_0xd014('0x2d')]);});return{'count':_0x23525f[_0xd014('0x3b')]['length'],'rows':_['map'](_0x23525f[_0xd014('0x3b')],function(_0x98d070){return{'id':_0x98d070[_0xd014('0x2d')],'name':_0x98d070[_0xd014('0x78')],'custom':_0x98d070[_0xd014('0x77')],'options':_0x98d070['picklistValues'][_0xd014('0x4d')]>0x0?_[_0xd014('0x30')](_0x98d070['picklistValues'],function(_0x449a63){return{'name':_0x449a63[_0xd014('0x78')],'value':_0x449a63[_0xd014('0x79')]};}):_0x98d070['type']==_0xd014('0x7a')?[{'name':_0xd014('0x7b'),'value':_0xd014('0x7c')},{'name':_0xd014('0x7d'),'value':_0xd014('0x7e')}]:[]};})};}})[_0xd014('0x29')](respondWithResult(_0x105c46,null))['catch'](function(_0x3066c2){var _0x246b6c=_0x560a6e[_0xd014('0x36')][_0xd014('0x16')]?0x1f4:_0x3066c2[_0xd014('0x7f')]||0x1f4;logger[_0xd014('0x1f')]('getFields,\x20%s,\x20%s,\x20%s',_0xd014('0x80'),_0x246b6c,JSON[_0xd014('0x1e')](_0x3066c2));delete _0x3066c2['name'];if(_0x246b6c===0x191){_0x246b6c=0x190;}_0x105c46['status'](_0x246b6c)['send'](_0x560a6e[_0xd014('0x36')]['test']?{'message':_0xd014('0x81'),'statusCode':_0x3066c2[_0xd014('0x7f')]}:_0x3066c2);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index f2e2c8f..c487288 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 _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 +var _0xa469=['rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','request-promise','path'];(function(_0x36587e,_0x4fdd5e){var _0x73e98d=function(_0x345401){while(--_0x345401){_0x36587e['push'](_0x36587e['shift']());}};_0x73e98d(++_0x4fdd5e);}(_0xa469,0x133));var _0x9a46=function(_0xde67b8,_0x47d99e){_0xde67b8=_0xde67b8-0x0;var _0x5e06a5=_0xa469[_0xde67b8];return _0x5e06a5;};'use strict';var _=require(_0x9a46('0x0'));var util=require(_0x9a46('0x1'));var logger=require(_0x9a46('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9a46('0x3'));var fs=require('fs');var path=require(_0x9a46('0x4'));var rimraf=require(_0x9a46('0x5'));var config=require('../../config/environment');var attributes=require(_0x9a46('0x6'));var integrations=require(_0x9a46('0x7'));module[_0x9a46('0x8')]=function(_0x22c9d7,_0x1c200c){return _0x22c9d7[_0x9a46('0x9')](_0x9a46('0xa'),attributes,{'tableName':_0x9a46('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 4e91f89..47eb696 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 _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 +var _0xe205=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetSalesforceAccount','SalesforceAccount','options','raw','where','include','map','model','attributes','ShowSalesforceAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0xe205,0xa7));var _0x5e20=function(_0x5c431d,_0x303e10){_0x5c431d=_0x5c431d-0x0;var _0x2e5734=_0xe205[_0x5c431d];return _0x2e5734;};'use strict';var _=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var moment=require(_0x5e20('0x2'));var BPromise=require(_0x5e20('0x3'));var rs=require(_0x5e20('0x4'));var fs=require('fs');var Redis=require(_0x5e20('0x5'));var db=require(_0x5e20('0x6'))['db'];var utils=require(_0x5e20('0x7'));var logger=require(_0x5e20('0x8'))('rpc');var config=require(_0x5e20('0x9'));var jayson=require(_0x5e20('0xa'));var client=jayson[_0x5e20('0xb')][_0x5e20('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5eca5c,_0x4cc88d,_0x3a382f){return new BPromise(function(_0x4c9332,_0x533e18){return client[_0x5e20('0xd')](_0x5eca5c,_0x3a382f)[_0x5e20('0xe')](function(_0x5c1eee){logger[_0x5e20('0xf')](_0x5e20('0x10'),_0x4cc88d,_0x5e20('0x11'));logger[_0x5e20('0x12')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x4cc88d,_0x5e20('0x11'),JSON[_0x5e20('0x13')](_0x5c1eee));if(_0x5c1eee[_0x5e20('0x14')]){if(_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x15')]===0x1f4){logger[_0x5e20('0x14')]('SalesforceAccount,\x20%s,\x20%s',_0x4cc88d,_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x16')]);return _0x533e18(_0x5c1eee[_0x5e20('0x14')]['message']);}logger[_0x5e20('0x14')]('SalesforceAccount,\x20%s,\x20%s',_0x4cc88d,_0x5c1eee[_0x5e20('0x14')]['message']);return _0x4c9332(_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x16')]);}else{logger[_0x5e20('0xf')](_0x5e20('0x10'),_0x4cc88d,_0x5e20('0x11'));_0x4c9332(_0x5c1eee['result'][_0x5e20('0x16')]);}})[_0x5e20('0x17')](function(_0x166ffd){logger[_0x5e20('0x14')](_0x5e20('0x10'),_0x4cc88d,_0x166ffd);_0x533e18(_0x166ffd);});});}exports[_0x5e20('0x18')]=function(_0x1cc706){var _0xf3488f=this;return new Promise(function(_0x4d3e4a,_0x434686){return db[_0x5e20('0x19')]['findAll']({'raw':_0x1cc706[_0x5e20('0x1a')]?_0x1cc706[_0x5e20('0x1a')][_0x5e20('0x1b')]===undefined?!![]:![]:!![],'where':_0x1cc706[_0x5e20('0x1a')]?_0x1cc706['options'][_0x5e20('0x1c')]||null:null,'attributes':_0x1cc706['options']?_0x1cc706['options']['attributes']||null:null,'limit':_0x1cc706['options']?_0x1cc706[_0x5e20('0x1a')]['limit']||null:null,'include':_0x1cc706[_0x5e20('0x1a')]?_0x1cc706[_0x5e20('0x1a')][_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x1cc706[_0x5e20('0x1a')][_0x5e20('0x1d')],function(_0x4c5732){return{'model':db[_0x4c5732[_0x5e20('0x1f')]],'as':_0x4c5732['as'],'attributes':_0x4c5732['attributes'],'include':_0x4c5732['include']?_[_0x5e20('0x1e')](_0x4c5732[_0x5e20('0x1d')],function(_0x2bae08){return{'model':db[_0x2bae08[_0x5e20('0x1f')]],'as':_0x2bae08['as'],'attributes':_0x2bae08[_0x5e20('0x20')],'include':_0x2bae08[_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x2bae08['include'],function(_0x3bf4f4){return{'model':db[_0x3bf4f4[_0x5e20('0x1f')]],'as':_0x3bf4f4['as'],'attributes':_0x3bf4f4[_0x5e20('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5e20('0xe')](function(_0x4c799d){logger[_0x5e20('0xf')](_0x5e20('0x18'),_0x1cc706);logger[_0x5e20('0x12')](_0x5e20('0x18'),_0x1cc706,JSON[_0x5e20('0x13')](_0x4c799d));_0x4d3e4a(_0x4c799d);})[_0x5e20('0x17')](function(_0x5ec45b){logger[_0x5e20('0x14')](_0x5e20('0x18'),_0x5ec45b['message'],_0x1cc706);_0x434686(_0xf3488f[_0x5e20('0x14')](0x1f4,_0x5ec45b[_0x5e20('0x16')]));});});};exports[_0x5e20('0x21')]=function(_0x4196a3){var _0x1548c8=this;return new Promise(function(_0x395a27,_0x4ff715){return db[_0x5e20('0x19')][_0x5e20('0x22')]({'raw':_0x4196a3[_0x5e20('0x1a')]?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x1b')]===undefined?!![]:![]:!![],'where':_0x4196a3[_0x5e20('0x1a')]?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x1c')]||null:null,'attributes':_0x4196a3[_0x5e20('0x1a')]?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x20')]||null:null,'include':_0x4196a3['options']?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x4196a3['options'][_0x5e20('0x1d')],function(_0x2d397b){return{'model':db[_0x2d397b[_0x5e20('0x1f')]],'as':_0x2d397b['as'],'attributes':_0x2d397b[_0x5e20('0x20')],'include':_0x2d397b[_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x2d397b[_0x5e20('0x1d')],function(_0x173165){return{'model':db[_0x173165[_0x5e20('0x1f')]],'as':_0x173165['as'],'attributes':_0x173165[_0x5e20('0x20')],'include':_0x173165[_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x173165[_0x5e20('0x1d')],function(_0x255b67){return{'model':db[_0x255b67['model']],'as':_0x255b67['as'],'attributes':_0x255b67[_0x5e20('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x549f01){logger[_0x5e20('0xf')](_0x5e20('0x21'),_0x4196a3);logger['debug'](_0x5e20('0x21'),_0x4196a3,JSON[_0x5e20('0x13')](_0x549f01));_0x395a27(_0x549f01);})['catch'](function(_0x3f3908){logger[_0x5e20('0x14')](_0x5e20('0x21'),_0x3f3908[_0x5e20('0x16')],_0x4196a3);_0x4ff715(_0x1548c8[_0x5e20('0x14')](0x1f4,_0x3f3908[_0x5e20('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 45e2269..ef82e81 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 _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 +var _0x32aa=['get','/:id','show','/:id/subjects','getSubjects','create','put','update','delete','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./intSalesforceConfiguration.controller','isAuthenticated','index'];(function(_0x203597,_0x16acd8){var _0x5ea0ce=function(_0x466105){while(--_0x466105){_0x203597['push'](_0x203597['shift']());}};_0x5ea0ce(++_0x16acd8);}(_0x32aa,0x127));var _0xa32a=function(_0x3ae516,_0x4b97c5){_0x3ae516=_0x3ae516-0x0;var _0x2b257a=_0x32aa[_0x3ae516];return _0x2b257a;};'use strict';var multer=require(_0xa32a('0x0'));var util=require(_0xa32a('0x1'));var path=require('path');var timeout=require(_0xa32a('0x2'));var express=require('express');var router=express[_0xa32a('0x3')]();var auth=require(_0xa32a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa32a('0x5'));var controller=require(_0xa32a('0x6'));router['get']('/',auth[_0xa32a('0x7')](),controller[_0xa32a('0x8')]);router[_0xa32a('0x9')](_0xa32a('0xa'),auth['isAuthenticated'](),controller[_0xa32a('0xb')]);router[_0xa32a('0x9')]('/:id/fields',auth[_0xa32a('0x7')](),controller['getFields']);router[_0xa32a('0x9')](_0xa32a('0xc'),auth[_0xa32a('0x7')](),controller[_0xa32a('0xd')]);router['get']('/:id/descriptions',auth[_0xa32a('0x7')](),controller['getDescriptions']);router['post']('/',auth[_0xa32a('0x7')](),controller[_0xa32a('0xe')]);router[_0xa32a('0xf')](_0xa32a('0xa'),auth['isAuthenticated'](),controller[_0xa32a('0x10')]);router[_0xa32a('0x11')](_0xa32a('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xa32a('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index fed2941..be45802 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 _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 +var _0x9551=['Task','contact_lead','contact','lead','nothing','sequelize','STRING','ENUM'];(function(_0x2f4c1c,_0x5a3dd4){var _0x25e0f2=function(_0x46ea31){while(--_0x46ea31){_0x2f4c1c['push'](_0x2f4c1c['shift']());}};_0x25e0f2(++_0x5a3dd4);}(_0x9551,0x1cd));var _0x1955=function(_0x124c75,_0x332013){_0x124c75=_0x124c75-0x0;var _0x5c5471=_0x9551[_0x124c75];return _0x5c5471;};'use strict';var Sequelize=require(_0x1955('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1955('0x1')]},'ticketType':{'type':Sequelize[_0x1955('0x2')](_0x1955('0x3'),'Case'),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x1955('0x2')](_0x1955('0x4'),_0x1955('0x5'),_0x1955('0x6')),'defaultValue':_0x1955('0x4')},'moduleCreate':{'type':Sequelize[_0x1955('0x2')](_0x1955('0x7'),_0x1955('0x5'),_0x1955('0x6')),'defaultValue':_0x1955('0x6')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index b6881b6..e377e3d 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 _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 +var _0x2cc1=['debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','show','keys','includeAll','options','find','create','body','params','SalesforceField','getFields','nolimit','getSubjects','findOne','hasOwnProperty','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../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~!@#$%^&-_=+[{]}.','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x19d3a2,_0x285f13){var _0x58dcb2=function(_0x58a669){while(--_0x58a669){_0x19d3a2['push'](_0x19d3a2['shift']());}};_0x58dcb2(++_0x285f13);}(_0x2cc1,0x1bd));var _0x12cc=function(_0x30a956,_0x11222e){_0x30a956=_0x30a956-0x0;var _0x2ac17d=_0x2cc1[_0x30a956];return _0x2ac17d;};'use strict';var pdf=require(_0x12cc('0x0'));var emlformat=require(_0x12cc('0x1'));var rimraf=require(_0x12cc('0x2'));var zipdir=require(_0x12cc('0x3'));var jsonpatch=require(_0x12cc('0x4'));var rp=require(_0x12cc('0x5'));var moment=require(_0x12cc('0x6'));var BPromise=require(_0x12cc('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x12cc('0x8'));var sox=require(_0x12cc('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x12cc('0xa'));var squel=require(_0x12cc('0xb'));var crypto=require(_0x12cc('0xc'));var jsforce=require(_0x12cc('0xd'));var deskjs=require(_0x12cc('0xe'));var toCsv=require(_0x12cc('0xf'));var querystring=require(_0x12cc('0x10'));var Papa=require(_0x12cc('0x11'));var Redis=require(_0x12cc('0x12'));var authService=require(_0x12cc('0x13'));var qs=require(_0x12cc('0x14'));var as=require(_0x12cc('0x15'));var hardwareService=require(_0x12cc('0x16'));var logger=require('../../config/logger')(_0x12cc('0x17'));var utils=require('../../config/utils');var config=require(_0x12cc('0x18'));var db=require(_0x12cc('0x19'))['db'];var jayson=require(_0x12cc('0x1a'));var client=jayson[_0x12cc('0x1b')][_0x12cc('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x7bf7fc,_0x5f3fb6,_0x5909d3){if(_0x5909d3){var _0x45e5aa=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x45e5aa['test'](_0x5f3fb6)){return _0x7bf7fc;}else{throw new db[(_0x12cc('0x1d'))]['ValidationError'](_0x12cc('0x1e'));}}else{return _0x7bf7fc;}}function respondWithRpcPromise(_0xcc08c2,_0x3d9e6f,_0xc0a469,_0x10e22a){return new BPromise(function(_0x33753a,_0x511857){var _0x47fa45=_0x10e22a||client;return _0x47fa45[_0x12cc('0x1f')](_0xcc08c2,_0xc0a469)['then'](function(_0x16a709){logger[_0x12cc('0x20')](_0x12cc('0x21'),_0x3d9e6f,_0x12cc('0x22'));logger[_0x12cc('0x23')](_0x12cc('0x24'),_0x3d9e6f,_0x12cc('0x22'),JSON[_0x12cc('0x25')](_0x16a709));if(_0x16a709[_0x12cc('0x26')]){if(_0x16a709['error']['code']===0x1f4){logger['error'](_0x12cc('0x21'),_0x3d9e6f,_0x16a709[_0x12cc('0x26')][_0x12cc('0x27')]);return _0x511857(_0x16a709[_0x12cc('0x26')][_0x12cc('0x27')]);}logger[_0x12cc('0x26')](_0x12cc('0x21'),_0x3d9e6f,_0x16a709[_0x12cc('0x26')][_0x12cc('0x27')]);return _0x33753a(_0x16a709['error'][_0x12cc('0x27')]);}else{logger['info'](_0x12cc('0x21'),_0x3d9e6f,_0x12cc('0x22'));_0x33753a(_0x16a709[_0x12cc('0x28')][_0x12cc('0x27')]);}})[_0x12cc('0x29')](function(_0x5170ec){logger['error'](_0x12cc('0x21'),_0x3d9e6f,_0x5170ec);_0x511857(_0x5170ec);});});}function respondWithStatusCode(_0x5ab109,_0x3769b2){_0x3769b2=_0x3769b2||0xcc;return function(_0x11d4bc){if(_0x11d4bc){return _0x5ab109[_0x12cc('0x2a')](_0x3769b2);}return _0x5ab109[_0x12cc('0x2b')](_0x3769b2)[_0x12cc('0x2c')]();};}function respondWithResult(_0x281da6,_0x30439d){_0x30439d=_0x30439d||0xc8;return function(_0x17a66b){if(_0x17a66b){return _0x281da6[_0x12cc('0x2b')](_0x30439d)[_0x12cc('0x2d')](_0x17a66b);}};}function respondWithFilteredResult(_0x283977,_0x102654){return function(_0x420222){if(_0x420222){var _0x435a28=_0x420222[_0x12cc('0x2e')],_0x214f24=_0x102654[_0x12cc('0x2f')],_0x1c8bca=_0x102654[_0x12cc('0x2f')]+_0x102654[_0x12cc('0x30')],_0x5cb159;if(_0x1c8bca>=_0x435a28){_0x1c8bca=_0x435a28;_0x5cb159=0xc8;}else{_0x5cb159=0xce;}_0x283977[_0x12cc('0x2b')](_0x5cb159);return _0x283977[_0x12cc('0x31')](_0x12cc('0x32'),_0x214f24+'-'+_0x1c8bca+'/'+_0x435a28)['json'](_0x420222);}return null;};}function patchUpdates(_0x307f91){return function(_0x290586){try{jsonpatch[_0x12cc('0x33')](_0x290586,_0x307f91,!![]);}catch(_0xfdb7a3){return BPromise[_0x12cc('0x34')](_0xfdb7a3);}return _0x290586['save']();};}function saveUpdates(_0x312c38,_0x41e969){return function(_0x3f27be){if(_0x3f27be){return _0x3f27be[_0x12cc('0x35')](_0x312c38)[_0x12cc('0x36')](function(_0x32778c){return _0x32778c;});}return null;};}function removeEntity(_0x14b661,_0x30e694){return function(_0x3d72c8){if(_0x3d72c8){return _0x3d72c8[_0x12cc('0x37')]()[_0x12cc('0x36')](function(){_0x14b661[_0x12cc('0x2b')](0xcc)[_0x12cc('0x2c')]();});}};}function handleEntityNotFound(_0xeff133,_0x1f4b80){return function(_0x4c8b42){if(!_0x4c8b42){_0xeff133[_0x12cc('0x2a')](0x194);}return _0x4c8b42;};}function handleError(_0x70e25b,_0x310b96){_0x310b96=_0x310b96||0x1f4;return function(_0x1d51ea){logger[_0x12cc('0x26')](_0x1d51ea[_0x12cc('0x38')]);if(_0x1d51ea['name']){delete _0x1d51ea[_0x12cc('0x39')];}_0x70e25b[_0x12cc('0x2b')](_0x310b96)[_0x12cc('0x3a')](_0x1d51ea);};}exports['index']=function(_0x34bf5a,_0x30ddb9){var _0x1f6aba={},_0x46f6a3={},_0x158209={'count':0x0,'rows':[]};var _0x5e9cf4=_[_0x12cc('0x3b')](db[_0x12cc('0x3c')][_0x12cc('0x3d')],function(_0x1c17f8){return{'name':_0x1c17f8[_0x12cc('0x3e')],'type':_0x1c17f8[_0x12cc('0x3f')][_0x12cc('0x40')]};});_0x46f6a3[_0x12cc('0x41')]=_[_0x12cc('0x3b')](_0x5e9cf4,_0x12cc('0x39'));_0x46f6a3[_0x12cc('0x42')]=_['keys'](_0x34bf5a[_0x12cc('0x42')]);_0x46f6a3[_0x12cc('0x43')]=_[_0x12cc('0x44')](_0x46f6a3[_0x12cc('0x41')],_0x46f6a3[_0x12cc('0x42')]);_0x1f6aba['attributes']=_[_0x12cc('0x44')](_0x46f6a3['model'],qs[_0x12cc('0x45')](_0x34bf5a[_0x12cc('0x42')][_0x12cc('0x45')]));_0x1f6aba[_0x12cc('0x46')]=_0x1f6aba[_0x12cc('0x46')][_0x12cc('0x47')]?_0x1f6aba[_0x12cc('0x46')]:_0x46f6a3[_0x12cc('0x41')];if(!_0x34bf5a['query']['hasOwnProperty']('nolimit')){_0x1f6aba['limit']=qs[_0x12cc('0x30')](_0x34bf5a[_0x12cc('0x42')][_0x12cc('0x30')]);_0x1f6aba[_0x12cc('0x2f')]=qs[_0x12cc('0x2f')](_0x34bf5a[_0x12cc('0x42')][_0x12cc('0x2f')]);}_0x1f6aba[_0x12cc('0x48')]=qs[_0x12cc('0x49')](_0x34bf5a['query'][_0x12cc('0x49')]);_0x1f6aba[_0x12cc('0x4a')]=qs[_0x12cc('0x43')](_[_0x12cc('0x4b')](_0x34bf5a['query'],_0x46f6a3['filters']),_0x5e9cf4);if(_0x34bf5a[_0x12cc('0x42')][_0x12cc('0x4c')]){_0x1f6aba[_0x12cc('0x4a')]=_[_0x12cc('0x4d')](_0x1f6aba[_0x12cc('0x4a')],{'$or':_[_0x12cc('0x3b')](_0x5e9cf4,function(_0x123905){if(_0x123905[_0x12cc('0x3f')]!==_0x12cc('0x4e')){var _0x59269d={};_0x59269d[_0x123905[_0x12cc('0x39')]]={'$like':'%'+_0x34bf5a[_0x12cc('0x42')]['filter']+'%'};return _0x59269d;}})});}_0x1f6aba=_[_0x12cc('0x4d')]({},_0x1f6aba,_0x34bf5a['options']);var _0x370749={'where':_0x1f6aba[_0x12cc('0x4a')]};return db['SalesforceConfiguration'][_0x12cc('0x2e')](_0x370749)['then'](function(_0x133aac){_0x158209['count']=_0x133aac;if(_0x34bf5a[_0x12cc('0x42')]['includeAll']){_0x1f6aba[_0x12cc('0x4f')]=[{'all':!![]}];}return db[_0x12cc('0x3c')]['findAll'](_0x1f6aba);})[_0x12cc('0x36')](function(_0x8e888d){_0x158209[_0x12cc('0x50')]=_0x8e888d;return _0x158209;})[_0x12cc('0x36')](respondWithFilteredResult(_0x30ddb9,_0x1f6aba))[_0x12cc('0x29')](handleError(_0x30ddb9,null));};exports[_0x12cc('0x51')]=function(_0x16c44e,_0x426ec5){var _0x37baac={'raw':![],'where':{'id':_0x16c44e['params']['id']}},_0x2b3462={};_0x2b3462[_0x12cc('0x41')]=_['keys'](db[_0x12cc('0x3c')]['rawAttributes']);_0x2b3462[_0x12cc('0x42')]=_[_0x12cc('0x52')](_0x16c44e[_0x12cc('0x42')]);_0x2b3462[_0x12cc('0x43')]=_[_0x12cc('0x44')](_0x2b3462[_0x12cc('0x41')],_0x2b3462[_0x12cc('0x42')]);_0x37baac[_0x12cc('0x46')]=_[_0x12cc('0x44')](_0x2b3462[_0x12cc('0x41')],qs[_0x12cc('0x45')](_0x16c44e[_0x12cc('0x42')][_0x12cc('0x45')]));_0x37baac[_0x12cc('0x46')]=_0x37baac['attributes']['length']?_0x37baac[_0x12cc('0x46')]:_0x2b3462[_0x12cc('0x41')];if(_0x16c44e['query'][_0x12cc('0x53')]){_0x37baac[_0x12cc('0x4f')]=[{'all':!![]}];}_0x37baac=_[_0x12cc('0x4d')]({},_0x37baac,_0x16c44e[_0x12cc('0x54')]);return db[_0x12cc('0x3c')][_0x12cc('0x55')](_0x37baac)[_0x12cc('0x36')](handleEntityNotFound(_0x426ec5,null))[_0x12cc('0x36')](respondWithResult(_0x426ec5,null))[_0x12cc('0x29')](handleError(_0x426ec5,null));};exports[_0x12cc('0x56')]=function(_0xb651dd,_0x2740b2){return db[_0x12cc('0x3c')][_0x12cc('0x56')](_0xb651dd[_0x12cc('0x57')],{})[_0x12cc('0x36')](respondWithResult(_0x2740b2,0xc9))[_0x12cc('0x29')](handleError(_0x2740b2,null));};exports[_0x12cc('0x35')]=function(_0x592958,_0x202613){if(_0x592958[_0x12cc('0x57')]['id']){delete _0x592958[_0x12cc('0x57')]['id'];}return db[_0x12cc('0x3c')][_0x12cc('0x55')]({'where':{'id':_0x592958[_0x12cc('0x58')]['id']}})[_0x12cc('0x36')](handleEntityNotFound(_0x202613,null))[_0x12cc('0x36')](saveUpdates(_0x592958[_0x12cc('0x57')],null))[_0x12cc('0x36')](respondWithResult(_0x202613,null))[_0x12cc('0x29')](handleError(_0x202613,null));};exports['destroy']=function(_0x4af4b9,_0x504180){return db[_0x12cc('0x3c')][_0x12cc('0x55')]({'where':{'id':_0x4af4b9[_0x12cc('0x58')]['id']}})['then'](handleEntityNotFound(_0x504180,null))[_0x12cc('0x36')](removeEntity(_0x504180,null))[_0x12cc('0x29')](handleError(_0x504180,null));};exports['getFields']=function(_0x5abd95,_0x449e62,_0x280a71){var _0xa7fea6={};var _0x255ed9={};var _0x5bd031;var _0x547a19;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x5abd95[_0x12cc('0x58')]['id']}})[_0x12cc('0x36')](handleEntityNotFound(_0x449e62,null))[_0x12cc('0x36')](function(_0x3520b7){if(_0x3520b7){_0x5bd031=_0x3520b7;_0x255ed9[_0x12cc('0x41')]=_[_0x12cc('0x52')](db[_0x12cc('0x59')][_0x12cc('0x3d')]);_0x255ed9[_0x12cc('0x42')]=_['keys'](_0x5abd95[_0x12cc('0x42')]);_0x255ed9[_0x12cc('0x43')]=_['intersection'](_0x255ed9[_0x12cc('0x41')],_0x255ed9[_0x12cc('0x42')]);_0xa7fea6[_0x12cc('0x46')]=_[_0x12cc('0x44')](_0x255ed9['model'],qs['fields'](_0x5abd95[_0x12cc('0x42')][_0x12cc('0x45')]));_0xa7fea6[_0x12cc('0x46')]=_0xa7fea6[_0x12cc('0x46')]['length']?_0xa7fea6['attributes']:_0x255ed9['model'];_0xa7fea6['order']=qs[_0x12cc('0x49')](_0x5abd95[_0x12cc('0x42')]['sort']);_0xa7fea6[_0x12cc('0x4a')]=qs[_0x12cc('0x43')](_[_0x12cc('0x4b')](_0x5abd95[_0x12cc('0x42')],_0x255ed9['filters']));if(_0x5abd95[_0x12cc('0x42')]['filter']){_0xa7fea6[_0x12cc('0x4a')]=_[_0x12cc('0x4d')](_0xa7fea6[_0x12cc('0x4a')],{'$or':_['map'](_0xa7fea6['attributes'],function(_0xeee115){var _0x52cfd9={};_0x52cfd9[_0xeee115]={'$like':'%'+_0x5abd95[_0x12cc('0x42')][_0x12cc('0x4c')]+'%'};return _0x52cfd9;})});}_0xa7fea6=_['merge']({},_0xa7fea6,_0x5abd95[_0x12cc('0x54')]);return _0x5bd031[_0x12cc('0x5a')](_0xa7fea6);}})[_0x12cc('0x36')](function(_0x52b9c0){if(_0x52b9c0){_0x547a19=_0x52b9c0[_0x12cc('0x47')];if(!_0x5abd95[_0x12cc('0x42')]['hasOwnProperty'](_0x12cc('0x5b'))){_0xa7fea6[_0x12cc('0x30')]=qs[_0x12cc('0x30')](_0x5abd95[_0x12cc('0x42')][_0x12cc('0x30')]);_0xa7fea6[_0x12cc('0x2f')]=qs[_0x12cc('0x2f')](_0x5abd95[_0x12cc('0x42')][_0x12cc('0x2f')]);}return _0x5bd031[_0x12cc('0x5a')](_0xa7fea6);}})['then'](function(_0x414966){if(_0x414966){return _0x414966?{'count':_0x547a19,'rows':_0x414966}:null;}})[_0x12cc('0x36')](respondWithResult(_0x449e62,null))[_0x12cc('0x29')](handleError(_0x449e62,null));};exports[_0x12cc('0x5c')]=function(_0x27d08d,_0x3f0b68,_0x12a187){var _0x301fb8={};var _0x54a876={};var _0x390ef9;var _0x2c4402;return db['SalesforceConfiguration'][_0x12cc('0x5d')]({'where':{'id':_0x27d08d[_0x12cc('0x58')]['id']}})[_0x12cc('0x36')](handleEntityNotFound(_0x3f0b68,null))['then'](function(_0x1492ae){if(_0x1492ae){_0x390ef9=_0x1492ae;_0x54a876[_0x12cc('0x41')]=_[_0x12cc('0x52')](db[_0x12cc('0x59')][_0x12cc('0x3d')]);_0x54a876['query']=_[_0x12cc('0x52')](_0x27d08d[_0x12cc('0x42')]);_0x54a876[_0x12cc('0x43')]=_[_0x12cc('0x44')](_0x54a876['model'],_0x54a876['query']);_0x301fb8[_0x12cc('0x46')]=_['intersection'](_0x54a876[_0x12cc('0x41')],qs['fields'](_0x27d08d['query'][_0x12cc('0x45')]));_0x301fb8['attributes']=_0x301fb8[_0x12cc('0x46')][_0x12cc('0x47')]?_0x301fb8[_0x12cc('0x46')]:_0x54a876[_0x12cc('0x41')];_0x301fb8[_0x12cc('0x48')]=qs[_0x12cc('0x49')](_0x27d08d[_0x12cc('0x42')][_0x12cc('0x49')]);_0x301fb8[_0x12cc('0x4a')]=qs[_0x12cc('0x43')](_[_0x12cc('0x4b')](_0x27d08d[_0x12cc('0x42')],_0x54a876[_0x12cc('0x43')]));if(_0x27d08d['query'][_0x12cc('0x4c')]){_0x301fb8['where']=_[_0x12cc('0x4d')](_0x301fb8[_0x12cc('0x4a')],{'$or':_[_0x12cc('0x3b')](_0x301fb8[_0x12cc('0x46')],function(_0x52df66){var _0xc150e1={};_0xc150e1[_0x52df66]={'$like':'%'+_0x27d08d[_0x12cc('0x42')][_0x12cc('0x4c')]+'%'};return _0xc150e1;})});}_0x301fb8=_['merge']({},_0x301fb8,_0x27d08d[_0x12cc('0x54')]);return _0x390ef9[_0x12cc('0x5c')](_0x301fb8);}})['then'](function(_0x2169dd){if(_0x2169dd){_0x2c4402=_0x2169dd[_0x12cc('0x47')];if(!_0x27d08d['query'][_0x12cc('0x5e')](_0x12cc('0x5b'))){_0x301fb8[_0x12cc('0x30')]=qs[_0x12cc('0x30')](_0x27d08d[_0x12cc('0x42')][_0x12cc('0x30')]);_0x301fb8[_0x12cc('0x2f')]=qs[_0x12cc('0x2f')](_0x27d08d[_0x12cc('0x42')]['offset']);}return _0x390ef9[_0x12cc('0x5c')](_0x301fb8);}})[_0x12cc('0x36')](function(_0x137ebd){if(_0x137ebd){return _0x137ebd?{'count':_0x2c4402,'rows':_0x137ebd}:null;}})['then'](respondWithResult(_0x3f0b68,null))['catch'](handleError(_0x3f0b68,null));};exports[_0x12cc('0x5f')]=function(_0xee4ab4,_0x4059cd,_0x51f36f){var _0x2570ed={};var _0x9b273e={};var _0xd29bd2;var _0xe1079b;return db[_0x12cc('0x3c')]['findOne']({'where':{'id':_0xee4ab4[_0x12cc('0x58')]['id']}})[_0x12cc('0x36')](handleEntityNotFound(_0x4059cd,null))['then'](function(_0x1630aa){if(_0x1630aa){_0xd29bd2=_0x1630aa;_0x9b273e[_0x12cc('0x41')]=_[_0x12cc('0x52')](db[_0x12cc('0x59')][_0x12cc('0x3d')]);_0x9b273e[_0x12cc('0x42')]=_['keys'](_0xee4ab4[_0x12cc('0x42')]);_0x9b273e[_0x12cc('0x43')]=_[_0x12cc('0x44')](_0x9b273e[_0x12cc('0x41')],_0x9b273e[_0x12cc('0x42')]);_0x2570ed[_0x12cc('0x46')]=_[_0x12cc('0x44')](_0x9b273e['model'],qs[_0x12cc('0x45')](_0xee4ab4['query'][_0x12cc('0x45')]));_0x2570ed[_0x12cc('0x46')]=_0x2570ed[_0x12cc('0x46')][_0x12cc('0x47')]?_0x2570ed[_0x12cc('0x46')]:_0x9b273e['model'];_0x2570ed[_0x12cc('0x48')]=qs[_0x12cc('0x49')](_0xee4ab4[_0x12cc('0x42')][_0x12cc('0x49')]);_0x2570ed[_0x12cc('0x4a')]=qs['filters'](_[_0x12cc('0x4b')](_0xee4ab4[_0x12cc('0x42')],_0x9b273e[_0x12cc('0x43')]));if(_0xee4ab4[_0x12cc('0x42')][_0x12cc('0x4c')]){_0x2570ed[_0x12cc('0x4a')]=_[_0x12cc('0x4d')](_0x2570ed[_0x12cc('0x4a')],{'$or':_[_0x12cc('0x3b')](_0x2570ed[_0x12cc('0x46')],function(_0x4b8671){var _0x2153f3={};_0x2153f3[_0x4b8671]={'$like':'%'+_0xee4ab4['query'][_0x12cc('0x4c')]+'%'};return _0x2153f3;})});}_0x2570ed=_[_0x12cc('0x4d')]({},_0x2570ed,_0xee4ab4['options']);return _0xd29bd2['getDescriptions'](_0x2570ed);}})[_0x12cc('0x36')](function(_0x31471b){if(_0x31471b){_0xe1079b=_0x31471b[_0x12cc('0x47')];if(!_0xee4ab4[_0x12cc('0x42')][_0x12cc('0x5e')]('nolimit')){_0x2570ed[_0x12cc('0x30')]=qs[_0x12cc('0x30')](_0xee4ab4[_0x12cc('0x42')][_0x12cc('0x30')]);_0x2570ed[_0x12cc('0x2f')]=qs[_0x12cc('0x2f')](_0xee4ab4[_0x12cc('0x42')][_0x12cc('0x2f')]);}return _0xd29bd2[_0x12cc('0x5f')](_0x2570ed);}})[_0x12cc('0x36')](function(_0x33b1d3){if(_0x33b1d3){return _0x33b1d3?{'count':_0xe1079b,'rows':_0x33b1d3}:null;}})[_0x12cc('0x36')](respondWithResult(_0x4059cd,null))[_0x12cc('0x29')](handleError(_0x4059cd,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 796cd83..16ce7fa 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 _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 +var _0x6b1e=['path','rimraf','../../config/environment','SalesforceConfiguration','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x1c6873,_0x96f1aa){var _0x31dac9=function(_0x33f51c){while(--_0x33f51c){_0x1c6873['push'](_0x1c6873['shift']());}};_0x31dac9(++_0x96f1aa);}(_0x6b1e,0x162));var _0xe6b1=function(_0x475839,_0x226b5e){_0x475839=_0x475839-0x0;var _0x449022=_0x6b1e[_0x475839];return _0x449022;};'use strict';var _=require(_0xe6b1('0x0'));var util=require(_0xe6b1('0x1'));var logger=require(_0xe6b1('0x2'))('api');var moment=require(_0xe6b1('0x3'));var BPromise=require(_0xe6b1('0x4'));var rp=require(_0xe6b1('0x5'));var fs=require('fs');var path=require(_0xe6b1('0x6'));var rimraf=require(_0xe6b1('0x7'));var config=require(_0xe6b1('0x8'));var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0x296c91,_0x3747d9){return _0x296c91['define'](_0xe6b1('0x9'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index c12c815..172cce1 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 _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 +var _0x5e8a=['info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','ioredis','../../config/utils','../../config/environment','client','http','request','then'];(function(_0x50e07,_0x1879a7){var _0x2ac2db=function(_0x17c30c){while(--_0x17c30c){_0x50e07['push'](_0x50e07['shift']());}};_0x2ac2db(++_0x1879a7);}(_0x5e8a,0xe5));var _0xa5e8=function(_0xd150a1,_0x2ae22d){_0xd150a1=_0xd150a1-0x0;var _0x275488=_0x5e8a[_0xd150a1];return _0x275488;};'use strict';var _=require(_0xa5e8('0x0'));var util=require('util');var moment=require(_0xa5e8('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa5e8('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa5e8('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xa5e8('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xa5e8('0x5')][_0xa5e8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4b01ed,_0xb537df,_0x3473b3){return new BPromise(function(_0x341d9e,_0x456a8d){return client[_0xa5e8('0x7')](_0x4b01ed,_0x3473b3)[_0xa5e8('0x8')](function(_0x307324){logger[_0xa5e8('0x9')](_0xa5e8('0xa'),_0xb537df,'request\x20sent');logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0xb537df,_0xa5e8('0xb'),JSON['stringify'](_0x307324));if(_0x307324[_0xa5e8('0xc')]){if(_0x307324[_0xa5e8('0xc')][_0xa5e8('0xd')]===0x1f4){logger[_0xa5e8('0xc')](_0xa5e8('0xa'),_0xb537df,_0x307324[_0xa5e8('0xc')][_0xa5e8('0xe')]);return _0x456a8d(_0x307324[_0xa5e8('0xc')][_0xa5e8('0xe')]);}logger[_0xa5e8('0xc')](_0xa5e8('0xa'),_0xb537df,_0x307324[_0xa5e8('0xc')][_0xa5e8('0xe')]);return _0x341d9e(_0x307324['error'][_0xa5e8('0xe')]);}else{logger[_0xa5e8('0x9')]('SalesforceConfiguration,\x20%s,\x20%s',_0xb537df,_0xa5e8('0xb'));_0x341d9e(_0x307324[_0xa5e8('0xf')]['message']);}})[_0xa5e8('0x10')](function(_0x611c7c){logger[_0xa5e8('0xc')](_0xa5e8('0xa'),_0xb537df,_0x611c7c);_0x456a8d(_0x611c7c);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index aa150a8..c09a01b 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 _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 +var _0x81c6=['index','/:id','create','put','update','destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated'];(function(_0x2adfb1,_0x406e6e){var _0xa52d45=function(_0x2de16c){while(--_0x2de16c){_0x2adfb1['push'](_0x2adfb1['shift']());}};_0xa52d45(++_0x406e6e);}(_0x81c6,0x1d5));var _0x681c=function(_0x2f6799,_0x4e7f00){_0x2f6799=_0x2f6799-0x0;var _0x3cb26f=_0x81c6[_0x2f6799];return _0x3cb26f;};'use strict';var multer=require('multer');var util=require(_0x681c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x681c('0x1')]();var auth=require(_0x681c('0x2'));var interaction=require(_0x681c('0x3'));var config=require('../../config/environment');var controller=require(_0x681c('0x4'));router[_0x681c('0x5')]('/',auth[_0x681c('0x6')](),controller[_0x681c('0x7')]);router['get'](_0x681c('0x8'),auth[_0x681c('0x6')](),controller['show']);router['post']('/',auth[_0x681c('0x6')](),controller[_0x681c('0x9')]);router[_0x681c('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x681c('0xb')]);router['delete'](_0x681c('0x8'),auth[_0x681c('0x6')](),controller[_0x681c('0xc')]);module[_0x681c('0xd')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index a55b658..1c6f66b 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 _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 +var _0xdcbf=['ENUM','string','variable','customVariable','STRING','sequelize','exports'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0xdcbf,0x6e));var _0xfdcb=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xdcbf[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0xfdcb('0x0'));module[_0xfdcb('0x1')]={'type':{'type':Sequelize[_0xfdcb('0x2')](_0xfdcb('0x3'),'variable','customVariable','keyValue'),'defaultValue':_0xfdcb('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xfdcb('0x3'),_0xfdcb('0x4'),_0xfdcb('0x5'))},'keyContent':{'type':Sequelize[_0xfdcb('0x6')]},'idField':{'type':Sequelize[_0xfdcb('0x6')]},'variableName':{'type':Sequelize[_0xfdcb('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 226fea5..2c1ca8c 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 _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 +var _0xc3c9=['query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','SalesforceField','rawAttributes','length','options','find','create','body','catch','html-pdf','rimraf','zip-dir','moment','bluebird','util','path','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','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','update','then','destroy','end','stack','name','send','index','fieldName','type','key','model','map'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xc3c9,0x1c6));var _0x9c3c=function(_0x1e63f1,_0xe3c3cc){_0x1e63f1=_0x1e63f1-0x0;var _0x5bc880=_0xc3c9[_0x1e63f1];return _0x5bc880;};'use strict';var pdf=require(_0x9c3c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9c3c('0x1'));var zipdir=require(_0x9c3c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9c3c('0x3'));var BPromise=require(_0x9c3c('0x4'));var Mustache=require('mustache');var util=require(_0x9c3c('0x5'));var path=require(_0x9c3c('0x6'));var sox=require('sox');var csv=require(_0x9c3c('0x7'));var ejs=require(_0x9c3c('0x8'));var fs=require('fs');var _=require(_0x9c3c('0x9'));var squel=require(_0x9c3c('0xa'));var crypto=require(_0x9c3c('0xb'));var jsforce=require(_0x9c3c('0xc'));var deskjs=require(_0x9c3c('0xd'));var toCsv=require(_0x9c3c('0x7'));var querystring=require(_0x9c3c('0xe'));var Papa=require(_0x9c3c('0xf'));var Redis=require('ioredis');var authService=require(_0x9c3c('0x10'));var qs=require(_0x9c3c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c3c('0x12'));var logger=require('../../config/logger')(_0x9c3c('0x13'));var utils=require(_0x9c3c('0x14'));var config=require(_0x9c3c('0x15'));var db=require(_0x9c3c('0x16'))['db'];function respondWithStatusCode(_0x511d99,_0x2f2fd5){_0x2f2fd5=_0x2f2fd5||0xcc;return function(_0x38ea76){if(_0x38ea76){return _0x511d99[_0x9c3c('0x17')](_0x2f2fd5);}return _0x511d99[_0x9c3c('0x18')](_0x2f2fd5)['end']();};}function respondWithResult(_0x24ec14,_0x3c853c){_0x3c853c=_0x3c853c||0xc8;return function(_0x31397e){if(_0x31397e){return _0x24ec14[_0x9c3c('0x18')](_0x3c853c)[_0x9c3c('0x19')](_0x31397e);}};}function respondWithFilteredResult(_0x4c4ca1,_0x3d088a){return function(_0x51043e){if(_0x51043e){var _0x3b67da=_0x51043e[_0x9c3c('0x1a')],_0x1cf5fa=_0x3d088a[_0x9c3c('0x1b')],_0x2c4018=_0x3d088a[_0x9c3c('0x1b')]+_0x3d088a[_0x9c3c('0x1c')],_0x48aa12;if(_0x2c4018>=_0x3b67da){_0x2c4018=_0x3b67da;_0x48aa12=0xc8;}else{_0x48aa12=0xce;}_0x4c4ca1[_0x9c3c('0x18')](_0x48aa12);return _0x4c4ca1['set']('Content-Range',_0x1cf5fa+'-'+_0x2c4018+'/'+_0x3b67da)[_0x9c3c('0x19')](_0x51043e);}return null;};}function patchUpdates(_0x4756de){return function(_0x4613c4){try{jsonpatch[_0x9c3c('0x1d')](_0x4613c4,_0x4756de,!![]);}catch(_0xca3807){return BPromise['reject'](_0xca3807);}return _0x4613c4['save']();};}function saveUpdates(_0x417c4b,_0x280d87){return function(_0x5bbbe2){if(_0x5bbbe2){return _0x5bbbe2[_0x9c3c('0x1e')](_0x417c4b)[_0x9c3c('0x1f')](function(_0x3a48eb){return _0x3a48eb;});}return null;};}function removeEntity(_0x49e167,_0x499ed5){return function(_0x305c1c){if(_0x305c1c){return _0x305c1c[_0x9c3c('0x20')]()['then'](function(){_0x49e167[_0x9c3c('0x18')](0xcc)[_0x9c3c('0x21')]();});}};}function handleEntityNotFound(_0x128ab6,_0x295d8e){return function(_0x4853c0){if(!_0x4853c0){_0x128ab6['sendStatus'](0x194);}return _0x4853c0;};}function handleError(_0xd50526,_0x4de59d){_0x4de59d=_0x4de59d||0x1f4;return function(_0x3a9035){logger['error'](_0x3a9035[_0x9c3c('0x22')]);if(_0x3a9035[_0x9c3c('0x23')]){delete _0x3a9035[_0x9c3c('0x23')];}_0xd50526[_0x9c3c('0x18')](_0x4de59d)[_0x9c3c('0x24')](_0x3a9035);};}exports[_0x9c3c('0x25')]=function(_0x12288d,_0x309284){var _0x35e96e={},_0x3e5756={},_0x3bcc19={'count':0x0,'rows':[]};var _0x59f323=_['map'](db['SalesforceField']['rawAttributes'],function(_0x4c8bd9){return{'name':_0x4c8bd9[_0x9c3c('0x26')],'type':_0x4c8bd9[_0x9c3c('0x27')][_0x9c3c('0x28')]};});_0x3e5756[_0x9c3c('0x29')]=_[_0x9c3c('0x2a')](_0x59f323,_0x9c3c('0x23'));_0x3e5756[_0x9c3c('0x2b')]=_[_0x9c3c('0x2c')](_0x12288d[_0x9c3c('0x2b')]);_0x3e5756[_0x9c3c('0x2d')]=_[_0x9c3c('0x2e')](_0x3e5756[_0x9c3c('0x29')],_0x3e5756['query']);_0x35e96e[_0x9c3c('0x2f')]=_[_0x9c3c('0x2e')](_0x3e5756[_0x9c3c('0x29')],qs['fields'](_0x12288d[_0x9c3c('0x2b')][_0x9c3c('0x30')]));_0x35e96e[_0x9c3c('0x2f')]=_0x35e96e[_0x9c3c('0x2f')]['length']?_0x35e96e[_0x9c3c('0x2f')]:_0x3e5756[_0x9c3c('0x29')];if(!_0x12288d[_0x9c3c('0x2b')][_0x9c3c('0x31')](_0x9c3c('0x32'))){_0x35e96e[_0x9c3c('0x1c')]=qs['limit'](_0x12288d['query'][_0x9c3c('0x1c')]);_0x35e96e[_0x9c3c('0x1b')]=qs[_0x9c3c('0x1b')](_0x12288d[_0x9c3c('0x2b')]['offset']);}_0x35e96e[_0x9c3c('0x33')]=qs['sort'](_0x12288d[_0x9c3c('0x2b')]['sort']);_0x35e96e[_0x9c3c('0x34')]=qs['filters'](_[_0x9c3c('0x35')](_0x12288d[_0x9c3c('0x2b')],_0x3e5756[_0x9c3c('0x2d')]),_0x59f323);if(_0x12288d[_0x9c3c('0x2b')][_0x9c3c('0x36')]){_0x35e96e[_0x9c3c('0x34')]=_[_0x9c3c('0x37')](_0x35e96e[_0x9c3c('0x34')],{'$or':_[_0x9c3c('0x2a')](_0x59f323,function(_0x5b3dbb){if(_0x5b3dbb[_0x9c3c('0x27')]!==_0x9c3c('0x38')){var _0x402914={};_0x402914[_0x5b3dbb[_0x9c3c('0x23')]]={'$like':'%'+_0x12288d[_0x9c3c('0x2b')][_0x9c3c('0x36')]+'%'};return _0x402914;}})});}_0x35e96e=_['merge']({},_0x35e96e,_0x12288d['options']);var _0x5cd428={'where':_0x35e96e[_0x9c3c('0x34')]};return db['SalesforceField'][_0x9c3c('0x1a')](_0x5cd428)[_0x9c3c('0x1f')](function(_0x5eb35f){_0x3bcc19[_0x9c3c('0x1a')]=_0x5eb35f;if(_0x12288d[_0x9c3c('0x2b')][_0x9c3c('0x39')]){_0x35e96e[_0x9c3c('0x3a')]=[{'all':!![]}];}return db['SalesforceField'][_0x9c3c('0x3b')](_0x35e96e);})[_0x9c3c('0x1f')](function(_0x4dca39){_0x3bcc19[_0x9c3c('0x3c')]=_0x4dca39;return _0x3bcc19;})[_0x9c3c('0x1f')](respondWithFilteredResult(_0x309284,_0x35e96e))['catch'](handleError(_0x309284,null));};exports[_0x9c3c('0x3d')]=function(_0xbd971c,_0x78b025){var _0x5dbf2b={'raw':!![],'where':{'id':_0xbd971c[_0x9c3c('0x3e')]['id']}},_0x323765={};_0x323765[_0x9c3c('0x29')]=_['keys'](db[_0x9c3c('0x3f')][_0x9c3c('0x40')]);_0x323765[_0x9c3c('0x2b')]=_[_0x9c3c('0x2c')](_0xbd971c[_0x9c3c('0x2b')]);_0x323765['filters']=_[_0x9c3c('0x2e')](_0x323765[_0x9c3c('0x29')],_0x323765[_0x9c3c('0x2b')]);_0x5dbf2b[_0x9c3c('0x2f')]=_[_0x9c3c('0x2e')](_0x323765['model'],qs[_0x9c3c('0x30')](_0xbd971c[_0x9c3c('0x2b')][_0x9c3c('0x30')]));_0x5dbf2b['attributes']=_0x5dbf2b[_0x9c3c('0x2f')][_0x9c3c('0x41')]?_0x5dbf2b[_0x9c3c('0x2f')]:_0x323765[_0x9c3c('0x29')];if(_0xbd971c[_0x9c3c('0x2b')][_0x9c3c('0x39')]){_0x5dbf2b[_0x9c3c('0x3a')]=[{'all':!![]}];}_0x5dbf2b=_['merge']({},_0x5dbf2b,_0xbd971c[_0x9c3c('0x42')]);return db[_0x9c3c('0x3f')][_0x9c3c('0x43')](_0x5dbf2b)[_0x9c3c('0x1f')](handleEntityNotFound(_0x78b025,null))['then'](respondWithResult(_0x78b025,null))['catch'](handleError(_0x78b025,null));};exports['create']=function(_0x4787a3,_0xa71dae){return db[_0x9c3c('0x3f')][_0x9c3c('0x44')](_0x4787a3[_0x9c3c('0x45')],{})['then'](respondWithResult(_0xa71dae,0xc9))['catch'](handleError(_0xa71dae,null));};exports[_0x9c3c('0x1e')]=function(_0x759edb,_0x562b86){if(_0x759edb[_0x9c3c('0x45')]['id']){delete _0x759edb[_0x9c3c('0x45')]['id'];}return db[_0x9c3c('0x3f')][_0x9c3c('0x43')]({'where':{'id':_0x759edb['params']['id']}})[_0x9c3c('0x1f')](handleEntityNotFound(_0x562b86,null))[_0x9c3c('0x1f')](saveUpdates(_0x759edb[_0x9c3c('0x45')],null))[_0x9c3c('0x1f')](respondWithResult(_0x562b86,null))[_0x9c3c('0x46')](handleError(_0x562b86,null));};exports[_0x9c3c('0x20')]=function(_0x597a5b,_0x250bba){return db['SalesforceField'][_0x9c3c('0x43')]({'where':{'id':_0x597a5b['params']['id']}})['then'](handleEntityNotFound(_0x250bba,null))[_0x9c3c('0x1f')](removeEntity(_0x250bba,null))['catch'](handleError(_0x250bba,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 17a30f6..a45fbf2 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 _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 +var _0x4556=['salesforce_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields'];(function(_0x2fcb8f,_0x45505c){var _0x1b0ea5=function(_0x20ac7f){while(--_0x20ac7f){_0x2fcb8f['push'](_0x2fcb8f['shift']());}};_0x1b0ea5(++_0x45505c);}(_0x4556,0x8f));var _0x6455=function(_0x43a961,_0x203922){_0x43a961=_0x43a961-0x0;var _0x12560c=_0x4556[_0x43a961];return _0x12560c;};'use strict';var _=require(_0x6455('0x0'));var util=require('util');var logger=require(_0x6455('0x1'))(_0x6455('0x2'));var moment=require(_0x6455('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6455('0x4'));var config=require(_0x6455('0x5'));var attributes=require(_0x6455('0x6'));module[_0x6455('0x7')]=function(_0x933a11,_0x2db994){return _0x933a11[_0x6455('0x8')](_0x6455('0x9'),attributes,{'tableName':_0x6455('0xa'),'paranoid':![],'indexes':[{'name':_0x6455('0xb'),'fields':[_0x6455('0xc'),_0x6455('0xd')],'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 4b4f35d..0d0c21b 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 _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 +var _0xac4a=['SalesforceField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xac4a,0x13f));var _0xaac4=function(_0x50b6f8,_0x523770){_0x50b6f8=_0x50b6f8-0x0;var _0x26f09e=_0xac4a[_0x50b6f8];return _0x26f09e;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('SalesforceField,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('SalesforceField,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 2f359b1..2f20510 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 _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 +var _0x9917=['multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy'];(function(_0x316e0a,_0xdcac19){var _0x5b668f=function(_0xb82a56){while(--_0xb82a56){_0x316e0a['push'](_0x316e0a['shift']());}};_0x5b668f(++_0xdcac19);}(_0x9917,0xe6));var _0x7991=function(_0x3c5112,_0xb7cace){_0x3c5112=_0x3c5112-0x0;var _0x5b6096=_0x9917[_0x3c5112];return _0x5b6096;};'use strict';var multer=require(_0x7991('0x0'));var util=require('util');var path=require(_0x7991('0x1'));var timeout=require(_0x7991('0x2'));var express=require(_0x7991('0x3'));var router=express['Router']();var auth=require(_0x7991('0x4'));var interaction=require(_0x7991('0x5'));var config=require(_0x7991('0x6'));var controller=require(_0x7991('0x7'));router[_0x7991('0x8')]('/',auth[_0x7991('0x9')](),controller[_0x7991('0xa')]);router[_0x7991('0x8')](_0x7991('0xb'),auth['isAuthenticated'](),controller[_0x7991('0xc')]);router[_0x7991('0x8')]('/:id/configurations',auth[_0x7991('0x9')](),controller[_0x7991('0xd')]);router['get'](_0x7991('0xe'),auth[_0x7991('0x9')](),controller[_0x7991('0xf')]);router['post']('/',auth[_0x7991('0x9')](),controller[_0x7991('0x10')]);router[_0x7991('0x11')]('/:id/configurations',auth[_0x7991('0x9')](),controller[_0x7991('0x12')]);router[_0x7991('0x13')](_0x7991('0xb'),auth[_0x7991('0x9')](),controller[_0x7991('0x14')]);router[_0x7991('0x15')](_0x7991('0xb'),auth[_0x7991('0x9')](),controller[_0x7991('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 03bcf66..2e6e8a5 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 _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 +var _0x5db5=['STRING','username','sequelize'];(function(_0x55cc8a,_0x8d1fd0){var _0x4e6197=function(_0x155bcc){while(--_0x155bcc){_0x55cc8a['push'](_0x55cc8a['shift']());}};_0x4e6197(++_0x8d1fd0);}(_0x5db5,0x125));var _0x55db=function(_0x169ff8,_0x1e5ee7){_0x169ff8=_0x169ff8-0x0;var _0x280173=_0x5db5[_0x169ff8];return _0x280173;};'use strict';var Sequelize=require(_0x55db('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x55db('0x1')]},'username':{'type':Sequelize[_0x55db('0x1')],'unique':_0x55db('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x55db('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x55db('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index cca552d..1c262d0 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 _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 +var _0xf513=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','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','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ServicenowAccount,\x20%s,\x20%s','message','result','status','end','json','count','offset','limit','Content-Range','apply','update','sendStatus','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getConfigurations','ServicenowConfiguration','length','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','ServicenowField','Descriptions','getFields','made_sla','hold_reason','knowledge','close_code','incident_state','category','watch_list','upon_reject','sys_updated_on','child_incidents','number','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','calendar_stc','closed_at','impact','active','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','correlation_display','delivery_task','assignment_group','additional_assignee_list','description','calendar_duration','notify','sys_class_name','close_notes','parent_incident','sys_id','contact_type','urgency','company','reassignment_count','activity_due','assigned_to','severity','comments','sla_due','approval','comments_and_work_notes','due_date','reopen_count','escalation','upon_approval','correlation_id','location','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','assign','forEach','push','all','TCL:\x20_object','remove','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','concat','ServiceNow\x20error:\x20','statusCode','Wrong\x20credentials','boolean','True','true','false','sys_choice?sysparm_query=name=incident^element=','value','html-pdf'];(function(_0x2f4cc9,_0x2eeb5a){var _0x318d79=function(_0x32215d){while(--_0x32215d){_0x2f4cc9['push'](_0x2f4cc9['shift']());}};_0x318d79(++_0x2eeb5a);}(_0xf513,0x181));var _0x3f51=function(_0x5ac0a9,_0x174362){_0x5ac0a9=_0x5ac0a9-0x0;var _0x59851f=_0xf513[_0x5ac0a9];return _0x59851f;};'use strict';var pdf=require(_0x3f51('0x0'));var emlformat=require(_0x3f51('0x1'));var rimraf=require(_0x3f51('0x2'));var zipdir=require(_0x3f51('0x3'));var jsonpatch=require(_0x3f51('0x4'));var rp=require(_0x3f51('0x5'));var moment=require('moment');var BPromise=require(_0x3f51('0x6'));var Mustache=require(_0x3f51('0x7'));var util=require(_0x3f51('0x8'));var path=require(_0x3f51('0x9'));var sox=require(_0x3f51('0xa'));var csv=require('to-csv');var ejs=require(_0x3f51('0xb'));var fs=require('fs');var _=require(_0x3f51('0xc'));var squel=require(_0x3f51('0xd'));var crypto=require('crypto');var jsforce=require(_0x3f51('0xe'));var deskjs=require(_0x3f51('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3f51('0x10'));var Papa=require(_0x3f51('0x11'));var Redis=require(_0x3f51('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3f51('0x13'));var as=require(_0x3f51('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f51('0x15'))(_0x3f51('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x3f51('0x17'));var client=jayson[_0x3f51('0x18')][_0x3f51('0x19')]({'port':0x232a});function checkPasswordPattern(_0x577667,_0x62f6fa,_0xd78b90){if(_0xd78b90){var _0x58551f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x58551f[_0x3f51('0x1a')](_0x62f6fa)){return _0x577667;}else{throw new db[(_0x3f51('0x1b'))][(_0x3f51('0x1c'))](_0x3f51('0x1d'));}}else{return _0x577667;}}function respondWithRpcPromise(_0x465fc8,_0x402833,_0x464355,_0x32ec85){return new BPromise(function(_0x21bed2,_0x4b9aab){var _0x28791f=_0x32ec85||client;return _0x28791f[_0x3f51('0x1e')](_0x465fc8,_0x464355)[_0x3f51('0x1f')](function(_0x26e6f0){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x402833,'request\x20sent');logger[_0x3f51('0x20')](_0x3f51('0x21'),_0x402833,_0x3f51('0x22'),JSON[_0x3f51('0x23')](_0x26e6f0));if(_0x26e6f0[_0x3f51('0x24')]){if(_0x26e6f0[_0x3f51('0x24')]['code']===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x402833,_0x26e6f0[_0x3f51('0x24')]['message']);return _0x4b9aab(_0x26e6f0[_0x3f51('0x24')]['message']);}logger[_0x3f51('0x24')](_0x3f51('0x25'),_0x402833,_0x26e6f0[_0x3f51('0x24')][_0x3f51('0x26')]);return _0x21bed2(_0x26e6f0[_0x3f51('0x24')][_0x3f51('0x26')]);}else{logger['info'](_0x3f51('0x25'),_0x402833,'request\x20sent');_0x21bed2(_0x26e6f0[_0x3f51('0x27')][_0x3f51('0x26')]);}})['catch'](function(_0x12febe){logger[_0x3f51('0x24')](_0x3f51('0x25'),_0x402833,_0x12febe);_0x4b9aab(_0x12febe);});});}function respondWithStatusCode(_0x5c37c6,_0x16a72b){_0x16a72b=_0x16a72b||0xcc;return function(_0x46c9fe){if(_0x46c9fe){return _0x5c37c6['sendStatus'](_0x16a72b);}return _0x5c37c6[_0x3f51('0x28')](_0x16a72b)[_0x3f51('0x29')]();};}function respondWithResult(_0x533c8d,_0xce3c55){_0xce3c55=_0xce3c55||0xc8;return function(_0x36cdac){if(_0x36cdac){return _0x533c8d['status'](_0xce3c55)[_0x3f51('0x2a')](_0x36cdac);}};}function respondWithFilteredResult(_0x1e61bd,_0x401087){return function(_0x397e53){if(_0x397e53){var _0x530f64=_0x397e53[_0x3f51('0x2b')],_0x1b954f=_0x401087[_0x3f51('0x2c')],_0x2942c0=_0x401087[_0x3f51('0x2c')]+_0x401087[_0x3f51('0x2d')],_0x4096b4;if(_0x2942c0>=_0x530f64){_0x2942c0=_0x530f64;_0x4096b4=0xc8;}else{_0x4096b4=0xce;}_0x1e61bd[_0x3f51('0x28')](_0x4096b4);return _0x1e61bd['set'](_0x3f51('0x2e'),_0x1b954f+'-'+_0x2942c0+'/'+_0x530f64)['json'](_0x397e53);}return null;};}function patchUpdates(_0x4aa036){return function(_0x527931){try{jsonpatch[_0x3f51('0x2f')](_0x527931,_0x4aa036,!![]);}catch(_0x525ec1){return BPromise['reject'](_0x525ec1);}return _0x527931['save']();};}function saveUpdates(_0x4edf02,_0x298964){return function(_0xef865c){if(_0xef865c){return _0xef865c[_0x3f51('0x30')](_0x4edf02)[_0x3f51('0x1f')](function(_0xe997d0){return _0xe997d0;});}return null;};}function removeEntity(_0x176252,_0x3af596){return function(_0x2df4a2){if(_0x2df4a2){return _0x2df4a2['destroy']()[_0x3f51('0x1f')](function(){_0x176252[_0x3f51('0x28')](0xcc)[_0x3f51('0x29')]();});}};}function handleEntityNotFound(_0x2cbfc5,_0x236e2a){return function(_0x2149e2){if(!_0x2149e2){_0x2cbfc5[_0x3f51('0x31')](0x194);}return _0x2149e2;};}function handleError(_0x549322,_0x2755e1){_0x2755e1=_0x2755e1||0x1f4;return function(_0x34fa6f){logger['error'](_0x34fa6f[_0x3f51('0x32')]);if(_0x34fa6f[_0x3f51('0x33')]){delete _0x34fa6f[_0x3f51('0x33')];}_0x549322['status'](_0x2755e1)[_0x3f51('0x34')](_0x34fa6f);};}exports[_0x3f51('0x35')]=function(_0x44c85,_0x3fc6ec){var _0x1bd1f7={},_0x3bea61={},_0xe0257a={'count':0x0,'rows':[]};var _0x45b53d=_[_0x3f51('0x36')](db[_0x3f51('0x37')][_0x3f51('0x38')],function(_0x106633){return{'name':_0x106633[_0x3f51('0x39')],'type':_0x106633['type'][_0x3f51('0x3a')]};});_0x3bea61[_0x3f51('0x3b')]=_['map'](_0x45b53d,_0x3f51('0x33'));_0x3bea61['query']=_[_0x3f51('0x3c')](_0x44c85[_0x3f51('0x3d')]);_0x3bea61[_0x3f51('0x3e')]=_[_0x3f51('0x3f')](_0x3bea61[_0x3f51('0x3b')],_0x3bea61[_0x3f51('0x3d')]);_0x1bd1f7[_0x3f51('0x40')]=_[_0x3f51('0x3f')](_0x3bea61[_0x3f51('0x3b')],qs['fields'](_0x44c85['query'][_0x3f51('0x41')]));_0x1bd1f7[_0x3f51('0x40')]=_0x1bd1f7[_0x3f51('0x40')]['length']?_0x1bd1f7[_0x3f51('0x40')]:_0x3bea61['model'];if(!_0x44c85['query'][_0x3f51('0x42')](_0x3f51('0x43'))){_0x1bd1f7[_0x3f51('0x2d')]=qs[_0x3f51('0x2d')](_0x44c85[_0x3f51('0x3d')][_0x3f51('0x2d')]);_0x1bd1f7[_0x3f51('0x2c')]=qs['offset'](_0x44c85['query']['offset']);}_0x1bd1f7[_0x3f51('0x44')]=qs['sort'](_0x44c85['query'][_0x3f51('0x45')]);_0x1bd1f7[_0x3f51('0x46')]=qs['filters'](_[_0x3f51('0x47')](_0x44c85[_0x3f51('0x3d')],_0x3bea61[_0x3f51('0x3e')]),_0x45b53d);if(_0x44c85['query'][_0x3f51('0x48')]){_0x1bd1f7[_0x3f51('0x46')]=_[_0x3f51('0x49')](_0x1bd1f7[_0x3f51('0x46')],{'$or':_[_0x3f51('0x36')](_0x45b53d,function(_0x308b52){if(_0x308b52[_0x3f51('0x4a')]!==_0x3f51('0x4b')){var _0x1f66fd={};_0x1f66fd[_0x308b52['name']]={'$like':'%'+_0x44c85[_0x3f51('0x3d')][_0x3f51('0x48')]+'%'};return _0x1f66fd;}})});}_0x1bd1f7=_[_0x3f51('0x49')]({},_0x1bd1f7,_0x44c85[_0x3f51('0x4c')]);var _0x5e938e={'where':_0x1bd1f7[_0x3f51('0x46')]};return db[_0x3f51('0x37')][_0x3f51('0x2b')](_0x5e938e)['then'](function(_0x2fa3f5){_0xe0257a[_0x3f51('0x2b')]=_0x2fa3f5;if(_0x44c85['query'][_0x3f51('0x4d')]){_0x1bd1f7[_0x3f51('0x4e')]=[{'all':!![]}];}return db[_0x3f51('0x37')][_0x3f51('0x4f')](_0x1bd1f7);})[_0x3f51('0x1f')](function(_0x670141){_0xe0257a[_0x3f51('0x50')]=_0x670141;return _0xe0257a;})[_0x3f51('0x1f')](respondWithFilteredResult(_0x3fc6ec,_0x1bd1f7))[_0x3f51('0x51')](handleError(_0x3fc6ec,null));};exports[_0x3f51('0x52')]=function(_0x5e828a,_0x44857b){var _0x5701ed={'raw':![],'where':{'id':_0x5e828a['params']['id']}},_0x3c0fed={};_0x3c0fed[_0x3f51('0x3b')]=_[_0x3f51('0x3c')](db['ServicenowAccount'][_0x3f51('0x38')]);_0x3c0fed[_0x3f51('0x3d')]=_[_0x3f51('0x3c')](_0x5e828a[_0x3f51('0x3d')]);_0x3c0fed[_0x3f51('0x3e')]=_[_0x3f51('0x3f')](_0x3c0fed[_0x3f51('0x3b')],_0x3c0fed[_0x3f51('0x3d')]);_0x5701ed[_0x3f51('0x40')]=_[_0x3f51('0x3f')](_0x3c0fed[_0x3f51('0x3b')],qs[_0x3f51('0x41')](_0x5e828a[_0x3f51('0x3d')][_0x3f51('0x41')]));_0x5701ed['attributes']=_0x5701ed[_0x3f51('0x40')]['length']?_0x5701ed[_0x3f51('0x40')]:_0x3c0fed[_0x3f51('0x3b')];if(_0x5e828a[_0x3f51('0x3d')][_0x3f51('0x4d')]){_0x5701ed[_0x3f51('0x4e')]=[{'all':!![]}];}_0x5701ed=_[_0x3f51('0x49')]({},_0x5701ed,_0x5e828a[_0x3f51('0x4c')]);return db['ServicenowAccount'][_0x3f51('0x53')](_0x5701ed)[_0x3f51('0x1f')](handleEntityNotFound(_0x44857b,null))[_0x3f51('0x1f')](respondWithResult(_0x44857b,null))[_0x3f51('0x51')](handleError(_0x44857b,null));};exports[_0x3f51('0x54')]=function(_0x3db007,_0x8b842){return db['ServicenowAccount']['create'](_0x3db007[_0x3f51('0x55')],{})[_0x3f51('0x1f')](respondWithResult(_0x8b842,0xc9))[_0x3f51('0x51')](handleError(_0x8b842,null));};exports['update']=function(_0x393310,_0x2e19e9){if(_0x393310[_0x3f51('0x55')]['id']){delete _0x393310['body']['id'];}return db[_0x3f51('0x37')][_0x3f51('0x53')]({'where':{'id':_0x393310[_0x3f51('0x56')]['id']}})[_0x3f51('0x1f')](handleEntityNotFound(_0x2e19e9,null))['then'](saveUpdates(_0x393310[_0x3f51('0x55')],null))[_0x3f51('0x1f')](respondWithResult(_0x2e19e9,null))[_0x3f51('0x51')](handleError(_0x2e19e9,null));};exports['destroy']=function(_0x3dbce1,_0x3e9064){return db[_0x3f51('0x37')][_0x3f51('0x53')]({'where':{'id':_0x3dbce1[_0x3f51('0x56')]['id']}})['then'](handleEntityNotFound(_0x3e9064,null))[_0x3f51('0x1f')](removeEntity(_0x3e9064,null))['catch'](handleError(_0x3e9064,null));};exports[_0x3f51('0x57')]=function(_0x3361d1,_0x274612,_0x24f261){var _0x3a9967={};var _0x77120c={};var _0x5af748;var _0x5642ec;return db['ServicenowAccount']['findOne']({'where':{'id':_0x3361d1[_0x3f51('0x56')]['id']}})[_0x3f51('0x1f')](handleEntityNotFound(_0x274612,null))[_0x3f51('0x1f')](function(_0x11c227){if(_0x11c227){_0x5af748=_0x11c227;_0x77120c['model']=_[_0x3f51('0x3c')](db[_0x3f51('0x58')][_0x3f51('0x38')]);_0x77120c[_0x3f51('0x3d')]=_['keys'](_0x3361d1[_0x3f51('0x3d')]);_0x77120c[_0x3f51('0x3e')]=_['intersection'](_0x77120c[_0x3f51('0x3b')],_0x77120c[_0x3f51('0x3d')]);_0x3a9967['attributes']=_[_0x3f51('0x3f')](_0x77120c[_0x3f51('0x3b')],qs['fields'](_0x3361d1[_0x3f51('0x3d')][_0x3f51('0x41')]));_0x3a9967[_0x3f51('0x40')]=_0x3a9967[_0x3f51('0x40')]['length']?_0x3a9967[_0x3f51('0x40')]:_0x77120c[_0x3f51('0x3b')];_0x3a9967['order']=qs['sort'](_0x3361d1[_0x3f51('0x3d')][_0x3f51('0x45')]);_0x3a9967['where']=qs['filters'](_[_0x3f51('0x47')](_0x3361d1[_0x3f51('0x3d')],_0x77120c[_0x3f51('0x3e')]));if(_0x3361d1[_0x3f51('0x3d')][_0x3f51('0x48')]){_0x3a9967[_0x3f51('0x46')]=_[_0x3f51('0x49')](_0x3a9967['where'],{'$or':_[_0x3f51('0x36')](_0x3a9967[_0x3f51('0x40')],function(_0x34fa2a){var _0x2c0777={};_0x2c0777[_0x34fa2a]={'$like':'%'+_0x3361d1['query'][_0x3f51('0x48')]+'%'};return _0x2c0777;})});}_0x3a9967=_[_0x3f51('0x49')]({},_0x3a9967,_0x3361d1[_0x3f51('0x4c')]);return _0x5af748[_0x3f51('0x57')](_0x3a9967);}})['then'](function(_0x38398f){if(_0x38398f){_0x5642ec=_0x38398f[_0x3f51('0x59')];if(!_0x3361d1[_0x3f51('0x3d')]['hasOwnProperty'](_0x3f51('0x43'))){_0x3a9967[_0x3f51('0x2d')]=qs[_0x3f51('0x2d')](_0x3361d1[_0x3f51('0x3d')][_0x3f51('0x2d')]);_0x3a9967[_0x3f51('0x2c')]=qs[_0x3f51('0x2c')](_0x3361d1[_0x3f51('0x3d')]['offset']);}return _0x5af748[_0x3f51('0x57')](_0x3a9967);}})[_0x3f51('0x1f')](function(_0x4dd9d7){if(_0x4dd9d7){return _0x4dd9d7?{'count':_0x5642ec,'rows':_0x4dd9d7}:null;}})[_0x3f51('0x1f')](respondWithResult(_0x274612,null))[_0x3f51('0x51')](handleError(_0x274612,null));};exports[_0x3f51('0x5a')]=function(_0x126dd5,_0xb8b28,_0x5d8bee){if(_0x126dd5[_0x3f51('0x55')]['id']){delete _0x126dd5[_0x3f51('0x55')]['id'];}return db[_0x3f51('0x37')][_0x3f51('0x5b')]({'where':{'id':_0x126dd5[_0x3f51('0x56')]['id']}})[_0x3f51('0x1f')](handleEntityNotFound(_0xb8b28,null))[_0x3f51('0x1f')](function(_0x3d3980){if(_0x3d3980){_0x126dd5[_0x3f51('0x55')][_0x3f51('0x5c')]=_0x3d3980['id'];_0x126dd5[_0x3f51('0x55')][_0x3f51('0x5d')]=integrations[_0x3f51('0x5e')](_0x126dd5[_0x3f51('0x55')][_0x3f51('0x5f')],_0x126dd5['body']['type']);_0x126dd5[_0x3f51('0x55')]['Descriptions']=integrations['getDescriptions'](_0x126dd5[_0x3f51('0x55')][_0x3f51('0x5f')],_0x126dd5[_0x3f51('0x55')][_0x3f51('0x4a')]);return db[_0x3f51('0x58')][_0x3f51('0x54')](_0x126dd5[_0x3f51('0x55')],{'include':[{'model':db[_0x3f51('0x60')],'as':_0x3f51('0x5d')},{'model':db[_0x3f51('0x60')],'as':_0x3f51('0x61')}]});}return null;})['then'](respondWithResult(_0xb8b28,null))['catch'](handleError(_0xb8b28,null));};exports[_0x3f51('0x62')]=function(_0x58649e,_0x8117aa,_0x4b6afa){var _0x4a93a8=[_0x3f51('0x63'),_0x3f51('0x64'),_0x3f51('0x65'),'subcategory',_0x3f51('0x66'),'notify',_0x3f51('0x67'),'severity',_0x3f51('0x68')];var _0x45b9b5=['parent',_0x3f51('0x63'),'caused_by',_0x3f51('0x69'),_0x3f51('0x6a'),_0x3f51('0x6b'),_0x3f51('0x6c'),_0x3f51('0x64'),'approval_history',_0x3f51('0x6d'),_0x3f51('0x6e'),_0x3f51('0x6f'),'opened_by',_0x3f51('0x70'),_0x3f51('0x71'),_0x3f51('0x72'),'state','sys_created_by',_0x3f51('0x65'),_0x3f51('0x44'),_0x3f51('0x73'),_0x3f51('0x74'),'cmdb_ci','delivery_plan',_0x3f51('0x75'),_0x3f51('0x76'),'work_notes_list','business_service',_0x3f51('0x77'),_0x3f51('0x78'),_0x3f51('0x79'),_0x3f51('0x7a'),_0x3f51('0x7b'),_0x3f51('0x7c'),_0x3f51('0x7d'),_0x3f51('0x7e'),_0x3f51('0x7f'),_0x3f51('0x80'),_0x3f51('0x81'),_0x3f51('0x82'),_0x3f51('0x83'),'subcategory',_0x3f51('0x84'),'short_description','close_code',_0x3f51('0x85'),_0x3f51('0x86'),'work_start',_0x3f51('0x87'),'business_stc',_0x3f51('0x88'),_0x3f51('0x89'),_0x3f51('0x8a'),_0x3f51('0x8b'),_0x3f51('0x8c'),_0x3f51('0x8d'),'closed_by','follow_up',_0x3f51('0x8e'),_0x3f51('0x8f'),_0x3f51('0x90'),'reopened_by',_0x3f51('0x67'),_0x3f51('0x91'),'problem_id',_0x3f51('0x92'),_0x3f51('0x93'),_0x3f51('0x94'),_0x3f51('0x95'),_0x3f51('0x96'),_0x3f51('0x97'),_0x3f51('0x98'),_0x3f51('0x99'),_0x3f51('0x9a'),_0x3f51('0x9b'),'sys_mod_count',_0x3f51('0x9c'),'sys_tags',_0x3f51('0x9d'),_0x3f51('0x9e'),_0x3f51('0x9f'),_0x3f51('0xa0'),_0x3f51('0x68')];var _0x1ff86d='';var _0x5bae33='';var _0x2e2b10=[];var _0x5526e2='';var _0x1f37a4='';var _0x15213b=[];var _0x466afd='';var _0x313af2='';var _0x40ec94={};var _0x2d7951='';return db['ServicenowAccount'][_0x3f51('0x5b')]({'where':{'id':_0x58649e[_0x3f51('0x56')]['id']},'attributes':['id','username',_0x3f51('0xa1'),_0x3f51('0xa2'),_0x3f51('0xa3'),_0x3f51('0xa4')]})[_0x3f51('0x1f')](handleEntityNotFound(_0x8117aa,null))[_0x3f51('0x1f')](function(_0x398963){if(_0x398963){_0x2d7951=_0x398963['remoteUri'];var _0x27d049=_0x2d7951[_0x3f51('0xa5')](-0x1);if(_0x27d049==='/'){_0x2d7951=_0x2d7951[_0x3f51('0xa6')](0x0,_0x2d7951[_0x3f51('0xa7')](_0x27d049));}_0x313af2=util[_0x3f51('0xa8')](_0x3f51('0xa9'),_0x2d7951);_0x466afd=util[_0x3f51('0xa8')](_0x3f51('0xaa'),_0x2d7951);_0x40ec94={'user':_0x398963['username'],'pass':_0x398963[_0x3f51('0xa1')]};var _0x4cb207={'method':_0x3f51('0xab'),'uri':_0x313af2+_0x3f51('0xac'),'auth':_0x40ec94,'json':!![]};return rp(_0x4cb207);}})['then'](function(_0x32f006){if(_0x32f006['result'][_0x3f51('0x59')]>0x0){_0x1ff86d=_0x32f006[_0x3f51('0x27')];}console[_0x3f51('0xad')]('incident\x20table\x20objects',_0x1ff86d);_0x15213b=[];_0x5bae33=Object[_0x3f51('0xae')]([],_0x1ff86d);_['remove'](_0x5bae33,function(_0x17204e){return!_0x4a93a8['includes'](_0x17204e[_0x3f51('0x33')]);});_0x5bae33[_0x3f51('0xaf')](function(_0x19062d){var _0x1420a8=createFieldObject(_0x466afd,_0x40ec94,_0x19062d['internalType'],_0x19062d[_0x3f51('0x33')],_0x19062d['label'],![]);_0x15213b[_0x3f51('0xb0')](_0x1420a8);});return Promise[_0x3f51('0xb1')](_0x15213b);})[_0x3f51('0x1f')](function(_0x1f2e44){_0x2e2b10=_0x1f2e44;_0x5526e2=Object[_0x3f51('0xae')]([],_0x1ff86d);console['log'](_0x3f51('0xb2'),_0x1ff86d);_[_0x3f51('0xb3')](_0x5526e2,function(_0x7b1729){return _0x45b9b5[_0x3f51('0xb4')](_0x7b1729['name']);});console[_0x3f51('0xad')](_0x3f51('0xb5'),_0x5526e2);_0x15213b=[];_0x5526e2[_0x3f51('0xaf')](function(_0x2b4c0c){var _0x28d660=createFieldObject(_0x466afd,_0x40ec94,_0x2b4c0c['internalType'],_0x2b4c0c[_0x3f51('0x33')],_0x2b4c0c[_0x3f51('0xb6')],!![]);_0x15213b[_0x3f51('0xb0')](_0x28d660);});return Promise[_0x3f51('0xb1')](_0x15213b);})['then'](function(_0x2bd607){_0x1f37a4=_0x2bd607;var _0x19eeb7=_0x2e2b10[_0x3f51('0xb7')](_0x1f37a4);return{'count':_0x19eeb7['length'],'rows':_0x19eeb7};})[_0x3f51('0x1f')](respondWithResult(_0x8117aa,null))[_0x3f51('0x51')](function(_0x37576d){console['log'](_0x3f51('0xb8')+_0x37576d);var _0x2f30a4=_0x58649e['query']['test']?0x1f4:_0x37576d[_0x3f51('0xb9')]||0x1f4;logger[_0x3f51('0x24')](_0x37576d[_0x3f51('0x32')]);delete _0x37576d[_0x3f51('0x33')];if(_0x2f30a4===0x191){_0x2f30a4=0x190;}_0x8117aa[_0x3f51('0x28')](_0x2f30a4)[_0x3f51('0x34')](_0x58649e[_0x3f51('0x3d')]['test']?{'message':_0x3f51('0xba'),'statusCode':_0x37576d[_0x3f51('0xb9')]}:_0x37576d);});};function createFieldObject(_0xfb133f,_0x2d55fb,_0x141e76,_0x3a7cc1,_0x4a1315,_0x4b4378){return new Promise(function(_0x172b62,_0x16a538){var _0x8269f5={'id':_0x3a7cc1,'name':_0x4a1315,'custom':_0x4b4378};if(_0x141e76===_0x3f51('0xbb')){_0x8269f5[_0x3f51('0x4c')]=[{'name':_0x3f51('0xbc'),'value':_0x3f51('0xbd')},{'name':'False','value':_0x3f51('0xbe')}];_0x172b62(_0x8269f5);}else{var _0x1b67ce={'method':_0x3f51('0xab'),'uri':_0xfb133f+_0x3f51('0xbf')+_0x3a7cc1,'auth':_0x2d55fb,'json':!![]};return rp(_0x1b67ce)[_0x3f51('0x1f')](function(_0x361f44){var _0x44b780=[];if(_0x361f44[_0x3f51('0x27')][_0x3f51('0x59')]>0x0){_0x361f44[_0x3f51('0x27')][_0x3f51('0xaf')](function(_0x504939){if(_0x504939['inactive']===_0x3f51('0xbe')){var _0x4fa7fe={'name':_0x504939[_0x3f51('0xb6')],'value':_0x504939[_0x3f51('0xc0')]};_0x44b780[_0x3f51('0xb0')](_0x4fa7fe);}});}_0x8269f5[_0x3f51('0x4c')]=_0x44b780;if(_0x8269f5[_0x3f51('0x4c')][_0x3f51('0x59')]>0x0){_0x172b62(_0x8269f5);}else{if(_0x4b4378==![]){_0x172b62();}else{_0x172b62(_0x8269f5);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 72e82bf..93671e6 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 _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 +var _0x50a6=['define','ServicenowAccount','lodash','util','moment','request-promise','path','rimraf','./intServicenowAccount.attributes'];(function(_0x3b6ad7,_0x499b03){var _0x280223=function(_0xd2b376){while(--_0xd2b376){_0x3b6ad7['push'](_0x3b6ad7['shift']());}};_0x280223(++_0x499b03);}(_0x50a6,0xa4));var _0x650a=function(_0x2cd809,_0x4cdedd){_0x2cd809=_0x2cd809-0x0;var _0x5a1519=_0x50a6[_0x2cd809];return _0x5a1519;};'use strict';var _=require(_0x650a('0x0'));var util=require(_0x650a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x650a('0x2'));var BPromise=require('bluebird');var rp=require(_0x650a('0x3'));var fs=require('fs');var path=require(_0x650a('0x4'));var rimraf=require(_0x650a('0x5'));var config=require('../../config/environment');var attributes=require(_0x650a('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x2d486d,_0x2d1bb4){return _0x2d486d[_0x650a('0x7')](_0x650a('0x8'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 4f9ced9..e5d1d9c 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 _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 +var _0x8311=['error','code','message','request\x20sent','result','catch','options','raw','where','attributes','limit','include','map','model','then','GetServicenowAccount','ShowServicenowAccount','ServicenowAccount','find','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8311,0x1b3));var _0x1831=function(_0x47370b,_0x1c12e8){_0x47370b=_0x47370b-0x0;var _0x43e3e2=_0x8311[_0x47370b];return _0x43e3e2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1831('0x0'));var BPromise=require('bluebird');var rs=require(_0x1831('0x1'));var fs=require('fs');var Redis=require(_0x1831('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1831('0x3'));var logger=require(_0x1831('0x4'))(_0x1831('0x5'));var config=require('../../config/environment');var jayson=require(_0x1831('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5e61fc,_0x2a474d,_0x295d69){return new BPromise(function(_0x5171b2,_0x771c02){return client[_0x1831('0x7')](_0x5e61fc,_0x295d69)['then'](function(_0x5a7786){logger[_0x1831('0x8')](_0x1831('0x9'),_0x2a474d,'request\x20sent');logger[_0x1831('0xa')](_0x1831('0xb'),_0x2a474d,'request\x20sent',JSON[_0x1831('0xc')](_0x5a7786));if(_0x5a7786['error']){if(_0x5a7786[_0x1831('0xd')][_0x1831('0xe')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x2a474d,_0x5a7786[_0x1831('0xd')][_0x1831('0xf')]);return _0x771c02(_0x5a7786[_0x1831('0xd')][_0x1831('0xf')]);}logger[_0x1831('0xd')](_0x1831('0x9'),_0x2a474d,_0x5a7786[_0x1831('0xd')][_0x1831('0xf')]);return _0x5171b2(_0x5a7786['error']['message']);}else{logger[_0x1831('0x8')]('ServicenowAccount,\x20%s,\x20%s',_0x2a474d,_0x1831('0x10'));_0x5171b2(_0x5a7786[_0x1831('0x11')][_0x1831('0xf')]);}})[_0x1831('0x12')](function(_0x76001e){logger[_0x1831('0xd')](_0x1831('0x9'),_0x2a474d,_0x76001e);_0x771c02(_0x76001e);});});}exports['GetServicenowAccount']=function(_0x4fcc37){var _0x3314ea=this;return new Promise(function(_0x4fb350,_0x4608a1){return db['ServicenowAccount']['findAll']({'raw':_0x4fcc37[_0x1831('0x13')]?_0x4fcc37[_0x1831('0x13')][_0x1831('0x14')]===undefined?!![]:![]:!![],'where':_0x4fcc37[_0x1831('0x13')]?_0x4fcc37['options'][_0x1831('0x15')]||null:null,'attributes':_0x4fcc37[_0x1831('0x13')]?_0x4fcc37[_0x1831('0x13')][_0x1831('0x16')]||null:null,'limit':_0x4fcc37[_0x1831('0x13')]?_0x4fcc37[_0x1831('0x13')][_0x1831('0x17')]||null:null,'include':_0x4fcc37[_0x1831('0x13')]?_0x4fcc37[_0x1831('0x13')][_0x1831('0x18')]?_[_0x1831('0x19')](_0x4fcc37[_0x1831('0x13')][_0x1831('0x18')],function(_0x3403de){return{'model':db[_0x3403de[_0x1831('0x1a')]],'as':_0x3403de['as'],'attributes':_0x3403de[_0x1831('0x16')],'include':_0x3403de['include']?_[_0x1831('0x19')](_0x3403de[_0x1831('0x18')],function(_0x4f2b62){return{'model':db[_0x4f2b62['model']],'as':_0x4f2b62['as'],'attributes':_0x4f2b62['attributes'],'include':_0x4f2b62[_0x1831('0x18')]?_[_0x1831('0x19')](_0x4f2b62[_0x1831('0x18')],function(_0x5a267d){return{'model':db[_0x5a267d[_0x1831('0x1a')]],'as':_0x5a267d['as'],'attributes':_0x5a267d[_0x1831('0x16')]};}):[]};}):[]};}):[]:[]})[_0x1831('0x1b')](function(_0x3ad678){logger[_0x1831('0x8')](_0x1831('0x1c'),_0x4fcc37);logger[_0x1831('0xa')]('GetServicenowAccount',_0x4fcc37,JSON[_0x1831('0xc')](_0x3ad678));_0x4fb350(_0x3ad678);})[_0x1831('0x12')](function(_0x2af71b){logger[_0x1831('0xd')](_0x1831('0x1c'),_0x2af71b['message'],_0x4fcc37);_0x4608a1(_0x3314ea[_0x1831('0xd')](0x1f4,_0x2af71b[_0x1831('0xf')]));});});};exports[_0x1831('0x1d')]=function(_0x1c8a78){var _0x255e52=this;return new Promise(function(_0x5d0d84,_0x255dfb){return db[_0x1831('0x1e')][_0x1831('0x1f')]({'raw':_0x1c8a78[_0x1831('0x13')]?_0x1c8a78[_0x1831('0x13')][_0x1831('0x14')]===undefined?!![]:![]:!![],'where':_0x1c8a78[_0x1831('0x13')]?_0x1c8a78[_0x1831('0x13')]['where']||null:null,'attributes':_0x1c8a78[_0x1831('0x13')]?_0x1c8a78[_0x1831('0x13')][_0x1831('0x16')]||null:null,'include':_0x1c8a78['options']?_0x1c8a78[_0x1831('0x13')][_0x1831('0x18')]?_[_0x1831('0x19')](_0x1c8a78['options'][_0x1831('0x18')],function(_0x1971e2){return{'model':db[_0x1971e2[_0x1831('0x1a')]],'as':_0x1971e2['as'],'attributes':_0x1971e2[_0x1831('0x16')],'include':_0x1971e2[_0x1831('0x18')]?_[_0x1831('0x19')](_0x1971e2['include'],function(_0x3c7f2d){return{'model':db[_0x3c7f2d[_0x1831('0x1a')]],'as':_0x3c7f2d['as'],'attributes':_0x3c7f2d[_0x1831('0x16')],'include':_0x3c7f2d[_0x1831('0x18')]?_[_0x1831('0x19')](_0x3c7f2d[_0x1831('0x18')],function(_0x4d195a){return{'model':db[_0x4d195a[_0x1831('0x1a')]],'as':_0x4d195a['as'],'attributes':_0x4d195a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x106bc5){logger['info'](_0x1831('0x1d'),_0x1c8a78);logger[_0x1831('0xa')](_0x1831('0x1d'),_0x1c8a78,JSON[_0x1831('0xc')](_0x106bc5));_0x5d0d84(_0x106bc5);})[_0x1831('0x12')](function(_0x914d3d){logger[_0x1831('0xd')](_0x1831('0x1d'),_0x914d3d[_0x1831('0xf')],_0x1c8a78);_0x255dfb(_0x255e52[_0x1831('0xd')](0x1f4,_0x914d3d[_0x1831('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index ee02364..bbd30ad 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 _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 +var _0xdc93=['../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','create','update','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service'];(function(_0x37f3c7,_0x1d116e){var _0x48f46f=function(_0x39231e){while(--_0x39231e){_0x37f3c7['push'](_0x37f3c7['shift']());}};_0x48f46f(++_0x1d116e);}(_0xdc93,0x1c7));var _0x3dc9=function(_0x56138f,_0x1e9ebb){_0x56138f=_0x56138f-0x0;var _0x1acaf7=_0xdc93[_0x56138f];return _0x1acaf7;};'use strict';var multer=require(_0x3dc9('0x0'));var util=require('util');var path=require(_0x3dc9('0x1'));var timeout=require(_0x3dc9('0x2'));var express=require('express');var router=express[_0x3dc9('0x3')]();var auth=require(_0x3dc9('0x4'));var interaction=require(_0x3dc9('0x5'));var config=require('../../config/environment');var controller=require(_0x3dc9('0x6'));router[_0x3dc9('0x7')]('/',auth[_0x3dc9('0x8')](),controller[_0x3dc9('0x9')]);router[_0x3dc9('0x7')](_0x3dc9('0xa'),auth[_0x3dc9('0x8')](),controller['show']);router[_0x3dc9('0x7')](_0x3dc9('0xb'),auth[_0x3dc9('0x8')](),controller['getFields']);router['get'](_0x3dc9('0xc'),auth['isAuthenticated'](),controller[_0x3dc9('0xd')]);router['get']('/:id/descriptions',auth[_0x3dc9('0x8')](),controller[_0x3dc9('0xe')]);router[_0x3dc9('0xf')]('/',auth[_0x3dc9('0x8')](),controller[_0x3dc9('0x10')]);router['put'](_0x3dc9('0xa'),auth[_0x3dc9('0x8')](),controller[_0x3dc9('0x11')]);router['delete'](_0x3dc9('0xa'),auth[_0x3dc9('0x8')](),controller[_0x3dc9('0x12')]);module[_0x3dc9('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index ffeed85..d5dc111 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 _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 +var _0x9254=['sequelize','exports','STRING'];(function(_0x1ea826,_0x4c891a){var _0x51fedd=function(_0x4b38ee){while(--_0x4b38ee){_0x1ea826['push'](_0x1ea826['shift']());}};_0x51fedd(++_0x4c891a);}(_0x9254,0x1e6));var _0x4925=function(_0x4b2556,_0x209cc1){_0x4b2556=_0x4b2556-0x0;var _0x3cfe79=_0x9254[_0x4b2556];return _0x3cfe79;};'use strict';var Sequelize=require(_0x4925('0x0'));module[_0x4925('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4925('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 4a5b3bd..03f4afc 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 _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 +var _0xefda=['stringify','error','code','message','result','catch','sendStatus','status','count','offset','set','Content-Range','apply','update','destroy','then','end','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','limit','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','length','find','create','body','getFields','findOne','ServicenowField','nolimit','getSubjects','getDescriptions','order','hasOwnProperty','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x1fd2e8,_0x49432f){var _0x32524e=function(_0x15a743){while(--_0x15a743){_0x1fd2e8['push'](_0x1fd2e8['shift']());}};_0x32524e(++_0x49432f);}(_0xefda,0x96));var _0xaefd=function(_0xd9e9d3,_0x124002){_0xd9e9d3=_0xd9e9d3-0x0;var _0x1d860d=_0xefda[_0xd9e9d3];return _0x1d860d;};'use strict';var pdf=require(_0xaefd('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaefd('0x1'));var jsonpatch=require(_0xaefd('0x2'));var rp=require('request-promise');var moment=require(_0xaefd('0x3'));var BPromise=require(_0xaefd('0x4'));var Mustache=require(_0xaefd('0x5'));var util=require(_0xaefd('0x6'));var path=require(_0xaefd('0x7'));var sox=require(_0xaefd('0x8'));var csv=require('to-csv');var ejs=require(_0xaefd('0x9'));var fs=require('fs');var _=require(_0xaefd('0xa'));var squel=require(_0xaefd('0xb'));var crypto=require(_0xaefd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaefd('0xd'));var toCsv=require(_0xaefd('0xe'));var querystring=require(_0xaefd('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaefd('0x10'));var as=require(_0xaefd('0x11'));var hardwareService=require(_0xaefd('0x12'));var logger=require(_0xaefd('0x13'))(_0xaefd('0x14'));var utils=require(_0xaefd('0x15'));var config=require(_0xaefd('0x16'));var db=require(_0xaefd('0x17'))['db'];var jayson=require(_0xaefd('0x18'));var client=jayson[_0xaefd('0x19')][_0xaefd('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x4b2b5c,_0x3172d3,_0x4ac467){if(_0x4ac467){var _0xd88c7c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xd88c7c[_0xaefd('0x1b')](_0x3172d3)){return _0x4b2b5c;}else{throw new db[(_0xaefd('0x1c'))][(_0xaefd('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 _0x4b2b5c;}}function respondWithRpcPromise(_0x16e4f4,_0x13492c,_0x41f345,_0x411701){return new BPromise(function(_0x10ee28,_0x32f75e){var _0x277070=_0x411701||client;return _0x277070[_0xaefd('0x1e')](_0x16e4f4,_0x41f345)['then'](function(_0x9d9c29){logger[_0xaefd('0x1f')](_0xaefd('0x20'),_0x13492c,_0xaefd('0x21'));logger[_0xaefd('0x22')](_0xaefd('0x23'),_0x13492c,'request\x20sent',JSON[_0xaefd('0x24')](_0x9d9c29));if(_0x9d9c29[_0xaefd('0x25')]){if(_0x9d9c29[_0xaefd('0x25')][_0xaefd('0x26')]===0x1f4){logger[_0xaefd('0x25')](_0xaefd('0x20'),_0x13492c,_0x9d9c29['error'][_0xaefd('0x27')]);return _0x32f75e(_0x9d9c29[_0xaefd('0x25')][_0xaefd('0x27')]);}logger[_0xaefd('0x25')](_0xaefd('0x20'),_0x13492c,_0x9d9c29['error']['message']);return _0x10ee28(_0x9d9c29['error'][_0xaefd('0x27')]);}else{logger[_0xaefd('0x1f')](_0xaefd('0x20'),_0x13492c,'request\x20sent');_0x10ee28(_0x9d9c29[_0xaefd('0x28')]['message']);}})[_0xaefd('0x29')](function(_0x3caa99){logger[_0xaefd('0x25')]('ServicenowConfiguration,\x20%s,\x20%s',_0x13492c,_0x3caa99);_0x32f75e(_0x3caa99);});});}function respondWithStatusCode(_0x435413,_0x3ffc9c){_0x3ffc9c=_0x3ffc9c||0xcc;return function(_0x18e720){if(_0x18e720){return _0x435413[_0xaefd('0x2a')](_0x3ffc9c);}return _0x435413[_0xaefd('0x2b')](_0x3ffc9c)['end']();};}function respondWithResult(_0x2fe27e,_0x58c008){_0x58c008=_0x58c008||0xc8;return function(_0x810bf){if(_0x810bf){return _0x2fe27e[_0xaefd('0x2b')](_0x58c008)['json'](_0x810bf);}};}function respondWithFilteredResult(_0x2b3d3d,_0x2a8fa8){return function(_0x521839){if(_0x521839){var _0xbeb1b8=_0x521839[_0xaefd('0x2c')],_0x114ec0=_0x2a8fa8['offset'],_0x36b6b7=_0x2a8fa8[_0xaefd('0x2d')]+_0x2a8fa8['limit'],_0x4c0898;if(_0x36b6b7>=_0xbeb1b8){_0x36b6b7=_0xbeb1b8;_0x4c0898=0xc8;}else{_0x4c0898=0xce;}_0x2b3d3d['status'](_0x4c0898);return _0x2b3d3d[_0xaefd('0x2e')](_0xaefd('0x2f'),_0x114ec0+'-'+_0x36b6b7+'/'+_0xbeb1b8)['json'](_0x521839);}return null;};}function patchUpdates(_0x578378){return function(_0x4ee0c1){try{jsonpatch[_0xaefd('0x30')](_0x4ee0c1,_0x578378,!![]);}catch(_0x280eab){return BPromise['reject'](_0x280eab);}return _0x4ee0c1['save']();};}function saveUpdates(_0x62ef86,_0x465d99){return function(_0x3f4947){if(_0x3f4947){return _0x3f4947[_0xaefd('0x31')](_0x62ef86)['then'](function(_0x3ff5b2){return _0x3ff5b2;});}return null;};}function removeEntity(_0x36854f,_0x3b11e4){return function(_0xad59fc){if(_0xad59fc){return _0xad59fc[_0xaefd('0x32')]()[_0xaefd('0x33')](function(){_0x36854f[_0xaefd('0x2b')](0xcc)[_0xaefd('0x34')]();});}};}function handleEntityNotFound(_0x3e3fe2,_0x234780){return function(_0x3744a5){if(!_0x3744a5){_0x3e3fe2[_0xaefd('0x2a')](0x194);}return _0x3744a5;};}function handleError(_0x304d34,_0x26a6bd){_0x26a6bd=_0x26a6bd||0x1f4;return function(_0x1ffec4){logger[_0xaefd('0x25')](_0x1ffec4['stack']);if(_0x1ffec4[_0xaefd('0x35')]){delete _0x1ffec4[_0xaefd('0x35')];}_0x304d34[_0xaefd('0x2b')](_0x26a6bd)['send'](_0x1ffec4);};}exports[_0xaefd('0x36')]=function(_0x577389,_0x187e76){var _0x3498d9={},_0x99a883={},_0xbbbf6d={'count':0x0,'rows':[]};var _0x2c0d72=_[_0xaefd('0x37')](db[_0xaefd('0x38')][_0xaefd('0x39')],function(_0x407bea){return{'name':_0x407bea[_0xaefd('0x3a')],'type':_0x407bea[_0xaefd('0x3b')][_0xaefd('0x3c')]};});_0x99a883[_0xaefd('0x3d')]=_[_0xaefd('0x37')](_0x2c0d72,'name');_0x99a883[_0xaefd('0x3e')]=_['keys'](_0x577389[_0xaefd('0x3e')]);_0x99a883[_0xaefd('0x3f')]=_[_0xaefd('0x40')](_0x99a883[_0xaefd('0x3d')],_0x99a883[_0xaefd('0x3e')]);_0x3498d9[_0xaefd('0x41')]=_[_0xaefd('0x40')](_0x99a883[_0xaefd('0x3d')],qs[_0xaefd('0x42')](_0x577389[_0xaefd('0x3e')]['fields']));_0x3498d9[_0xaefd('0x41')]=_0x3498d9[_0xaefd('0x41')]['length']?_0x3498d9[_0xaefd('0x41')]:_0x99a883[_0xaefd('0x3d')];if(!_0x577389[_0xaefd('0x3e')]['hasOwnProperty']('nolimit')){_0x3498d9[_0xaefd('0x43')]=qs[_0xaefd('0x43')](_0x577389[_0xaefd('0x3e')][_0xaefd('0x43')]);_0x3498d9[_0xaefd('0x2d')]=qs[_0xaefd('0x2d')](_0x577389[_0xaefd('0x3e')][_0xaefd('0x2d')]);}_0x3498d9['order']=qs[_0xaefd('0x44')](_0x577389[_0xaefd('0x3e')][_0xaefd('0x44')]);_0x3498d9[_0xaefd('0x45')]=qs[_0xaefd('0x3f')](_[_0xaefd('0x46')](_0x577389[_0xaefd('0x3e')],_0x99a883[_0xaefd('0x3f')]),_0x2c0d72);if(_0x577389['query']['filter']){_0x3498d9[_0xaefd('0x45')]=_[_0xaefd('0x47')](_0x3498d9['where'],{'$or':_['map'](_0x2c0d72,function(_0x17d611){if(_0x17d611[_0xaefd('0x3b')]!==_0xaefd('0x48')){var _0x1ba03a={};_0x1ba03a[_0x17d611[_0xaefd('0x35')]]={'$like':'%'+_0x577389[_0xaefd('0x3e')][_0xaefd('0x49')]+'%'};return _0x1ba03a;}})});}_0x3498d9=_[_0xaefd('0x47')]({},_0x3498d9,_0x577389[_0xaefd('0x4a')]);var _0x558a75={'where':_0x3498d9[_0xaefd('0x45')]};return db[_0xaefd('0x38')][_0xaefd('0x2c')](_0x558a75)[_0xaefd('0x33')](function(_0x224613){_0xbbbf6d[_0xaefd('0x2c')]=_0x224613;if(_0x577389[_0xaefd('0x3e')]['includeAll']){_0x3498d9[_0xaefd('0x4b')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0xaefd('0x4c')](_0x3498d9);})[_0xaefd('0x33')](function(_0x16c664){_0xbbbf6d[_0xaefd('0x4d')]=_0x16c664;return _0xbbbf6d;})['then'](respondWithFilteredResult(_0x187e76,_0x3498d9))['catch'](handleError(_0x187e76,null));};exports[_0xaefd('0x4e')]=function(_0x34839e,_0x179b8b){var _0x4eeb56={'raw':![],'where':{'id':_0x34839e[_0xaefd('0x4f')]['id']}},_0x2a836a={};_0x2a836a['model']=_[_0xaefd('0x50')](db[_0xaefd('0x38')][_0xaefd('0x39')]);_0x2a836a[_0xaefd('0x3e')]=_[_0xaefd('0x50')](_0x34839e[_0xaefd('0x3e')]);_0x2a836a[_0xaefd('0x3f')]=_[_0xaefd('0x40')](_0x2a836a['model'],_0x2a836a['query']);_0x4eeb56[_0xaefd('0x41')]=_[_0xaefd('0x40')](_0x2a836a['model'],qs[_0xaefd('0x42')](_0x34839e['query'][_0xaefd('0x42')]));_0x4eeb56[_0xaefd('0x41')]=_0x4eeb56[_0xaefd('0x41')][_0xaefd('0x51')]?_0x4eeb56[_0xaefd('0x41')]:_0x2a836a[_0xaefd('0x3d')];if(_0x34839e['query']['includeAll']){_0x4eeb56[_0xaefd('0x4b')]=[{'all':!![]}];}_0x4eeb56=_[_0xaefd('0x47')]({},_0x4eeb56,_0x34839e['options']);return db[_0xaefd('0x38')][_0xaefd('0x52')](_0x4eeb56)[_0xaefd('0x33')](handleEntityNotFound(_0x179b8b,null))[_0xaefd('0x33')](respondWithResult(_0x179b8b,null))['catch'](handleError(_0x179b8b,null));};exports['create']=function(_0x2b0d8e,_0x41ef40){return db[_0xaefd('0x38')][_0xaefd('0x53')](_0x2b0d8e[_0xaefd('0x54')],{})['then'](respondWithResult(_0x41ef40,0xc9))[_0xaefd('0x29')](handleError(_0x41ef40,null));};exports[_0xaefd('0x31')]=function(_0x5a54fb,_0xbeca29){if(_0x5a54fb[_0xaefd('0x54')]['id']){delete _0x5a54fb['body']['id'];}return db[_0xaefd('0x38')][_0xaefd('0x52')]({'where':{'id':_0x5a54fb[_0xaefd('0x4f')]['id']}})['then'](handleEntityNotFound(_0xbeca29,null))[_0xaefd('0x33')](saveUpdates(_0x5a54fb[_0xaefd('0x54')],null))['then'](respondWithResult(_0xbeca29,null))[_0xaefd('0x29')](handleError(_0xbeca29,null));};exports[_0xaefd('0x32')]=function(_0x14b472,_0x2dd1ee){return db['ServicenowConfiguration']['find']({'where':{'id':_0x14b472[_0xaefd('0x4f')]['id']}})[_0xaefd('0x33')](handleEntityNotFound(_0x2dd1ee,null))[_0xaefd('0x33')](removeEntity(_0x2dd1ee,null))[_0xaefd('0x29')](handleError(_0x2dd1ee,null));};exports[_0xaefd('0x55')]=function(_0x8ab9e7,_0x314660,_0x368fd3){var _0x1e519e={};var _0x133c4f={};var _0x48636d;var _0x4fc1f9;return db[_0xaefd('0x38')][_0xaefd('0x56')]({'where':{'id':_0x8ab9e7[_0xaefd('0x4f')]['id']}})[_0xaefd('0x33')](handleEntityNotFound(_0x314660,null))['then'](function(_0x13309e){if(_0x13309e){_0x48636d=_0x13309e;_0x133c4f[_0xaefd('0x3d')]=_[_0xaefd('0x50')](db[_0xaefd('0x57')][_0xaefd('0x39')]);_0x133c4f[_0xaefd('0x3e')]=_[_0xaefd('0x50')](_0x8ab9e7[_0xaefd('0x3e')]);_0x133c4f['filters']=_[_0xaefd('0x40')](_0x133c4f[_0xaefd('0x3d')],_0x133c4f[_0xaefd('0x3e')]);_0x1e519e[_0xaefd('0x41')]=_['intersection'](_0x133c4f[_0xaefd('0x3d')],qs['fields'](_0x8ab9e7[_0xaefd('0x3e')][_0xaefd('0x42')]));_0x1e519e['attributes']=_0x1e519e['attributes'][_0xaefd('0x51')]?_0x1e519e['attributes']:_0x133c4f['model'];_0x1e519e['order']=qs[_0xaefd('0x44')](_0x8ab9e7[_0xaefd('0x3e')][_0xaefd('0x44')]);_0x1e519e[_0xaefd('0x45')]=qs[_0xaefd('0x3f')](_[_0xaefd('0x46')](_0x8ab9e7['query'],_0x133c4f['filters']));if(_0x8ab9e7['query']['filter']){_0x1e519e[_0xaefd('0x45')]=_['merge'](_0x1e519e[_0xaefd('0x45')],{'$or':_['map'](_0x1e519e[_0xaefd('0x41')],function(_0x32dc0d){var _0x416241={};_0x416241[_0x32dc0d]={'$like':'%'+_0x8ab9e7[_0xaefd('0x3e')][_0xaefd('0x49')]+'%'};return _0x416241;})});}_0x1e519e=_[_0xaefd('0x47')]({},_0x1e519e,_0x8ab9e7[_0xaefd('0x4a')]);return _0x48636d['getFields'](_0x1e519e);}})[_0xaefd('0x33')](function(_0x4113e4){if(_0x4113e4){_0x4fc1f9=_0x4113e4[_0xaefd('0x51')];if(!_0x8ab9e7[_0xaefd('0x3e')]['hasOwnProperty'](_0xaefd('0x58'))){_0x1e519e['limit']=qs[_0xaefd('0x43')](_0x8ab9e7[_0xaefd('0x3e')][_0xaefd('0x43')]);_0x1e519e[_0xaefd('0x2d')]=qs[_0xaefd('0x2d')](_0x8ab9e7[_0xaefd('0x3e')]['offset']);}return _0x48636d[_0xaefd('0x55')](_0x1e519e);}})[_0xaefd('0x33')](function(_0x4a9fa5){if(_0x4a9fa5){return _0x4a9fa5?{'count':_0x4fc1f9,'rows':_0x4a9fa5}:null;}})[_0xaefd('0x33')](respondWithResult(_0x314660,null))[_0xaefd('0x29')](handleError(_0x314660,null));};exports['getSubjects']=function(_0x3a2b63,_0x2a472f,_0x4247d9){var _0x46a793={};var _0x2c4ba7={};var _0x406c6d;var _0x2d8283;return db[_0xaefd('0x38')][_0xaefd('0x56')]({'where':{'id':_0x3a2b63[_0xaefd('0x4f')]['id']}})[_0xaefd('0x33')](handleEntityNotFound(_0x2a472f,null))[_0xaefd('0x33')](function(_0x11a068){if(_0x11a068){_0x406c6d=_0x11a068;_0x2c4ba7[_0xaefd('0x3d')]=_[_0xaefd('0x50')](db[_0xaefd('0x57')][_0xaefd('0x39')]);_0x2c4ba7['query']=_[_0xaefd('0x50')](_0x3a2b63[_0xaefd('0x3e')]);_0x2c4ba7[_0xaefd('0x3f')]=_['intersection'](_0x2c4ba7[_0xaefd('0x3d')],_0x2c4ba7[_0xaefd('0x3e')]);_0x46a793[_0xaefd('0x41')]=_[_0xaefd('0x40')](_0x2c4ba7['model'],qs[_0xaefd('0x42')](_0x3a2b63['query'][_0xaefd('0x42')]));_0x46a793['attributes']=_0x46a793[_0xaefd('0x41')][_0xaefd('0x51')]?_0x46a793[_0xaefd('0x41')]:_0x2c4ba7['model'];_0x46a793['order']=qs[_0xaefd('0x44')](_0x3a2b63[_0xaefd('0x3e')][_0xaefd('0x44')]);_0x46a793[_0xaefd('0x45')]=qs[_0xaefd('0x3f')](_[_0xaefd('0x46')](_0x3a2b63['query'],_0x2c4ba7['filters']));if(_0x3a2b63['query']['filter']){_0x46a793['where']=_[_0xaefd('0x47')](_0x46a793[_0xaefd('0x45')],{'$or':_[_0xaefd('0x37')](_0x46a793[_0xaefd('0x41')],function(_0x5ae635){var _0x3ae6ba={};_0x3ae6ba[_0x5ae635]={'$like':'%'+_0x3a2b63[_0xaefd('0x3e')]['filter']+'%'};return _0x3ae6ba;})});}_0x46a793=_[_0xaefd('0x47')]({},_0x46a793,_0x3a2b63['options']);return _0x406c6d[_0xaefd('0x59')](_0x46a793);}})['then'](function(_0x21d44b){if(_0x21d44b){_0x2d8283=_0x21d44b['length'];if(!_0x3a2b63[_0xaefd('0x3e')]['hasOwnProperty'](_0xaefd('0x58'))){_0x46a793[_0xaefd('0x43')]=qs['limit'](_0x3a2b63[_0xaefd('0x3e')][_0xaefd('0x43')]);_0x46a793[_0xaefd('0x2d')]=qs['offset'](_0x3a2b63[_0xaefd('0x3e')][_0xaefd('0x2d')]);}return _0x406c6d[_0xaefd('0x59')](_0x46a793);}})[_0xaefd('0x33')](function(_0x23115d){if(_0x23115d){return _0x23115d?{'count':_0x2d8283,'rows':_0x23115d}:null;}})['then'](respondWithResult(_0x2a472f,null))[_0xaefd('0x29')](handleError(_0x2a472f,null));};exports[_0xaefd('0x5a')]=function(_0x4ebd3e,_0xdacfe3,_0x1a80ee){var _0x1298e4={};var _0x299868={};var _0x5e3743;var _0x2a62ac;return db['ServicenowConfiguration'][_0xaefd('0x56')]({'where':{'id':_0x4ebd3e[_0xaefd('0x4f')]['id']}})[_0xaefd('0x33')](handleEntityNotFound(_0xdacfe3,null))['then'](function(_0xa53ec){if(_0xa53ec){_0x5e3743=_0xa53ec;_0x299868[_0xaefd('0x3d')]=_[_0xaefd('0x50')](db['ServicenowField'][_0xaefd('0x39')]);_0x299868[_0xaefd('0x3e')]=_[_0xaefd('0x50')](_0x4ebd3e[_0xaefd('0x3e')]);_0x299868['filters']=_[_0xaefd('0x40')](_0x299868[_0xaefd('0x3d')],_0x299868[_0xaefd('0x3e')]);_0x1298e4[_0xaefd('0x41')]=_['intersection'](_0x299868[_0xaefd('0x3d')],qs[_0xaefd('0x42')](_0x4ebd3e[_0xaefd('0x3e')][_0xaefd('0x42')]));_0x1298e4['attributes']=_0x1298e4[_0xaefd('0x41')]['length']?_0x1298e4[_0xaefd('0x41')]:_0x299868['model'];_0x1298e4[_0xaefd('0x5b')]=qs[_0xaefd('0x44')](_0x4ebd3e[_0xaefd('0x3e')][_0xaefd('0x44')]);_0x1298e4[_0xaefd('0x45')]=qs['filters'](_[_0xaefd('0x46')](_0x4ebd3e['query'],_0x299868[_0xaefd('0x3f')]));if(_0x4ebd3e['query'][_0xaefd('0x49')]){_0x1298e4[_0xaefd('0x45')]=_[_0xaefd('0x47')](_0x1298e4['where'],{'$or':_[_0xaefd('0x37')](_0x1298e4['attributes'],function(_0xdb53cf){var _0x4310b1={};_0x4310b1[_0xdb53cf]={'$like':'%'+_0x4ebd3e[_0xaefd('0x3e')][_0xaefd('0x49')]+'%'};return _0x4310b1;})});}_0x1298e4=_['merge']({},_0x1298e4,_0x4ebd3e[_0xaefd('0x4a')]);return _0x5e3743[_0xaefd('0x5a')](_0x1298e4);}})[_0xaefd('0x33')](function(_0x407c6a){if(_0x407c6a){_0x2a62ac=_0x407c6a[_0xaefd('0x51')];if(!_0x4ebd3e[_0xaefd('0x3e')][_0xaefd('0x5c')](_0xaefd('0x58'))){_0x1298e4[_0xaefd('0x43')]=qs['limit'](_0x4ebd3e[_0xaefd('0x3e')][_0xaefd('0x43')]);_0x1298e4[_0xaefd('0x2d')]=qs[_0xaefd('0x2d')](_0x4ebd3e[_0xaefd('0x3e')][_0xaefd('0x2d')]);}return _0x5e3743[_0xaefd('0x5a')](_0x1298e4);}})[_0xaefd('0x33')](function(_0x190170){if(_0x190170){return _0x190170?{'count':_0x2a62ac,'rows':_0x190170}:null;}})[_0xaefd('0x33')](respondWithResult(_0xdacfe3,null))[_0xaefd('0x29')](handleError(_0xdacfe3,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 1fb6db5..5a1a390 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 _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 +var _0xe7c2=['ServicenowConfiguration','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define'];(function(_0x2142c8,_0x3001eb){var _0x4286e9=function(_0x43d768){while(--_0x43d768){_0x2142c8['push'](_0x2142c8['shift']());}};_0x4286e9(++_0x3001eb);}(_0xe7c2,0x139));var _0x2e7c=function(_0x36b4ac,_0x4a4f5f){_0x36b4ac=_0x36b4ac-0x0;var _0x578f26=_0xe7c2[_0x36b4ac];return _0x578f26;};'use strict';var _=require(_0x2e7c('0x0'));var util=require(_0x2e7c('0x1'));var logger=require(_0x2e7c('0x2'))(_0x2e7c('0x3'));var moment=require(_0x2e7c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e7c('0x5'));var rimraf=require(_0x2e7c('0x6'));var config=require(_0x2e7c('0x7'));var attributes=require(_0x2e7c('0x8'));module[_0x2e7c('0x9')]=function(_0x19e821,_0x48f84b){return _0x19e821[_0x2e7c('0xa')](_0x2e7c('0xb'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index fc13a79..eec6578 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 _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 +var _0x5ab1=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x5ab1,0x11c));var _0x15ab=function(_0x6f070c,_0x107e14){_0x6f070c=_0x6f070c-0x0;var _0x1a5833=_0x5ab1[_0x6f070c];return _0x1a5833;};'use strict';var _=require(_0x15ab('0x0'));var util=require(_0x15ab('0x1'));var moment=require(_0x15ab('0x2'));var BPromise=require(_0x15ab('0x3'));var rs=require(_0x15ab('0x4'));var fs=require('fs');var Redis=require(_0x15ab('0x5'));var db=require(_0x15ab('0x6'))['db'];var utils=require(_0x15ab('0x7'));var logger=require(_0x15ab('0x8'))(_0x15ab('0x9'));var config=require('../../config/environment');var jayson=require(_0x15ab('0xa'));var client=jayson[_0x15ab('0xb')][_0x15ab('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x325596,_0x4849f8,_0x205c2d){return new BPromise(function(_0x373fa7,_0x5065f2){return client[_0x15ab('0xd')](_0x325596,_0x205c2d)[_0x15ab('0xe')](function(_0x3456db){logger[_0x15ab('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4849f8,_0x15ab('0x10'));logger[_0x15ab('0x11')](_0x15ab('0x12'),_0x4849f8,_0x15ab('0x10'),JSON[_0x15ab('0x13')](_0x3456db));if(_0x3456db['error']){if(_0x3456db['error'][_0x15ab('0x14')]===0x1f4){logger[_0x15ab('0x15')](_0x15ab('0x16'),_0x4849f8,_0x3456db['error']['message']);return _0x5065f2(_0x3456db['error'][_0x15ab('0x17')]);}logger['error'](_0x15ab('0x16'),_0x4849f8,_0x3456db[_0x15ab('0x15')]['message']);return _0x373fa7(_0x3456db['error'][_0x15ab('0x17')]);}else{logger[_0x15ab('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4849f8,_0x15ab('0x10'));_0x373fa7(_0x3456db[_0x15ab('0x18')][_0x15ab('0x17')]);}})[_0x15ab('0x19')](function(_0x552da4){logger['error'](_0x15ab('0x16'),_0x4849f8,_0x552da4);_0x5065f2(_0x552da4);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 9952e8b..aa9cdb9 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 _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 +var _0x559b=['put','update','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','show','post','create'];(function(_0x1b313d,_0x583911){var _0x257818=function(_0x2f0190){while(--_0x2f0190){_0x1b313d['push'](_0x1b313d['shift']());}};_0x257818(++_0x583911);}(_0x559b,0x9d));var _0xb559=function(_0x2c7043,_0x7610d8){_0x2c7043=_0x2c7043-0x0;var _0x23a924=_0x559b[_0x2c7043];return _0x23a924;};'use strict';var multer=require(_0xb559('0x0'));var util=require(_0xb559('0x1'));var path=require(_0xb559('0x2'));var timeout=require(_0xb559('0x3'));var express=require(_0xb559('0x4'));var router=express[_0xb559('0x5')]();var auth=require(_0xb559('0x6'));var interaction=require(_0xb559('0x7'));var config=require(_0xb559('0x8'));var controller=require('./intServicenowField.controller');router['get']('/',auth[_0xb559('0x9')](),controller[_0xb559('0xa')]);router['get']('/:id',auth[_0xb559('0x9')](),controller[_0xb559('0xb')]);router[_0xb559('0xc')]('/',auth['isAuthenticated'](),controller[_0xb559('0xd')]);router[_0xb559('0xe')]('/:id',auth[_0xb559('0x9')](),controller[_0xb559('0xf')]);router['delete'](_0xb559('0x10'),auth[_0xb559('0x9')](),controller[_0xb559('0x11')]);module[_0xb559('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 521edc0..5851fec 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 _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 +var _0x19ea=['customVariable','keyValue','ENUM','variable','STRING','BOOLEAN','sequelize','string'];(function(_0x4c464c,_0x54d09b){var _0x258f87=function(_0x52ca36){while(--_0x52ca36){_0x4c464c['push'](_0x4c464c['shift']());}};_0x258f87(++_0x54d09b);}(_0x19ea,0xfe));var _0xa19e=function(_0x1e6e4e,_0x2b1b09){_0x1e6e4e=_0x1e6e4e-0x0;var _0x3d746b=_0x19ea[_0x1e6e4e];return _0x3d746b;};'use strict';var Sequelize=require(_0xa19e('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xa19e('0x1'),'variable',_0xa19e('0x2'),_0xa19e('0x3')),'defaultValue':_0xa19e('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa19e('0x4')](_0xa19e('0x1'),_0xa19e('0x5'),_0xa19e('0x2'))},'keyContent':{'type':Sequelize[_0xa19e('0x6')]},'idField':{'type':Sequelize[_0xa19e('0x6')]},'nameField':{'type':Sequelize[_0xa19e('0x6')]},'customField':{'type':Sequelize[_0xa19e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa19e('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 817770c..44c871d 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(_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 +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(_0x474a72,_0x439f5a){var _0x304966=function(_0x1466eb){while(--_0x1466eb){_0x474a72['push'](_0x474a72['shift']());}};_0x304966(++_0x439f5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 aba9917..5377068 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 _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 +var _0xd302=['ServicenowField','servicenow_unique_index','FieldId','lodash','path','../../config/environment','./intServicenowField.attributes','exports','define'];(function(_0x20acf2,_0x5d36f5){var _0x528060=function(_0x575c84){while(--_0x575c84){_0x20acf2['push'](_0x20acf2['shift']());}};_0x528060(++_0x5d36f5);}(_0xd302,0x1c5));var _0x2d30=function(_0x5bcb92,_0x40de87){_0x5bcb92=_0x5bcb92-0x0;var _0x9a3e07=_0xd302[_0x5bcb92];return _0x9a3e07;};'use strict';var _=require(_0x2d30('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d30('0x1'));var rimraf=require('rimraf');var config=require(_0x2d30('0x2'));var attributes=require(_0x2d30('0x3'));module[_0x2d30('0x4')]=function(_0x51aea2,_0xe1776b){return _0x51aea2[_0x2d30('0x5')](_0x2d30('0x6'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x2d30('0x7'),'fields':['idField',_0x2d30('0x8')],'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 a327796..e17a306 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 _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 +var _0x954b=['jayson/promise','client','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','code','ServicenowField,\x20%s,\x20%s','message','error','result','util','moment','bluebird','../../config/logger','rpc','../../config/environment'];(function(_0x57db49,_0x288094){var _0xd0636f=function(_0x227787){while(--_0x227787){_0x57db49['push'](_0x57db49['shift']());}};_0xd0636f(++_0x288094);}(_0x954b,0xfe));var _0xb954=function(_0x4a96ca,_0x13754e){_0x4a96ca=_0x4a96ca-0x0;var _0x2aed48=_0x954b[_0x4a96ca];return _0x2aed48;};'use strict';var _=require('lodash');var util=require(_0xb954('0x0'));var moment=require(_0xb954('0x1'));var BPromise=require(_0xb954('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb954('0x3'))(_0xb954('0x4'));var config=require(_0xb954('0x5'));var jayson=require(_0xb954('0x6'));var client=jayson[_0xb954('0x7')][_0xb954('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dca5b,_0x53b04e,_0x83ea0d){return new BPromise(function(_0x131861,_0x4d1706){return client['request'](_0x3dca5b,_0x83ea0d)[_0xb954('0x9')](function(_0x55124e){logger[_0xb954('0xa')]('ServicenowField,\x20%s,\x20%s',_0x53b04e,_0xb954('0xb'));logger[_0xb954('0xc')](_0xb954('0xd'),_0x53b04e,_0xb954('0xb'),JSON[_0xb954('0xe')](_0x55124e));if(_0x55124e['error']){if(_0x55124e['error'][_0xb954('0xf')]===0x1f4){logger['error'](_0xb954('0x10'),_0x53b04e,_0x55124e['error'][_0xb954('0x11')]);return _0x4d1706(_0x55124e[_0xb954('0x12')][_0xb954('0x11')]);}logger[_0xb954('0x12')](_0xb954('0x10'),_0x53b04e,_0x55124e['error'][_0xb954('0x11')]);return _0x131861(_0x55124e[_0xb954('0x12')][_0xb954('0x11')]);}else{logger[_0xb954('0xa')]('ServicenowField,\x20%s,\x20%s',_0x53b04e,_0xb954('0xb'));_0x131861(_0x55124e[_0xb954('0x13')]['message']);}})['catch'](function(_0x598ec2){logger[_0xb954('0x12')]('ServicenowField,\x20%s,\x20%s',_0x53b04e,_0x598ec2);_0x4d1706(_0x598ec2);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index c5a1b82..c9e7209 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 _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 +var _0x8b27=['../../config/environment','get','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x223a3f,_0x1f0236){var _0x28cf62=function(_0x2a9592){while(--_0x2a9592){_0x223a3f['push'](_0x223a3f['shift']());}};_0x28cf62(++_0x1f0236);}(_0x8b27,0x1ad));var _0x78b2=function(_0xc3ee2c,_0x301459){_0xc3ee2c=_0xc3ee2c-0x0;var _0x24925d=_0x8b27[_0xc3ee2c];return _0x24925d;};'use strict';var multer=require(_0x78b2('0x0'));var util=require(_0x78b2('0x1'));var path=require(_0x78b2('0x2'));var timeout=require(_0x78b2('0x3'));var express=require(_0x78b2('0x4'));var router=express[_0x78b2('0x5')]();var auth=require(_0x78b2('0x6'));var interaction=require(_0x78b2('0x7'));var config=require(_0x78b2('0x8'));var controller=require('./intSugarcrmAccount.controller');router[_0x78b2('0x9')]('/',auth[_0x78b2('0xa')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x78b2('0x9')](_0x78b2('0xb'),auth[_0x78b2('0xa')](),controller[_0x78b2('0xc')]);router[_0x78b2('0x9')](_0x78b2('0xd'),auth[_0x78b2('0xa')](),controller[_0x78b2('0xe')]);router[_0x78b2('0xf')]('/',auth[_0x78b2('0xa')](),controller[_0x78b2('0x10')]);router[_0x78b2('0xf')](_0x78b2('0xb'),auth[_0x78b2('0xa')](),controller[_0x78b2('0x11')]);router[_0x78b2('0x12')](_0x78b2('0x13'),auth['isAuthenticated'](),controller[_0x78b2('0x14')]);router[_0x78b2('0x15')](_0x78b2('0x13'),auth[_0x78b2('0xa')](),controller[_0x78b2('0x16')]);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 64ae54c..cda0f07 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 _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 +var _0xac83=['username','remoteUri','sequelize','exports','STRING'];(function(_0x1df874,_0x283771){var _0x1672dc=function(_0xcf1431){while(--_0xcf1431){_0x1df874['push'](_0x1df874['shift']());}};_0x1672dc(++_0x283771);}(_0xac83,0xd9));var _0x3ac8=function(_0x4bb581,_0x6f7037){_0x4bb581=_0x4bb581-0x0;var _0x316bf5=_0xac83[_0x4bb581];return _0x316bf5;};'use strict';var Sequelize=require(_0x3ac8('0x0'));module[_0x3ac8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3ac8('0x2')]},'username':{'type':Sequelize[_0x3ac8('0x2')],'unique':_0x3ac8('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x3ac8('0x2')],'unique':_0x3ac8('0x4')},'serverUrl':{'type':Sequelize[_0x3ac8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index e8e633d..d747ba0 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 _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 +var _0xec1d=['mustache','util','sox','to-csv','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../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~!@#$%^&-_=+[{]}.','info','SugarcrmAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','where','filter','type','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','params','fields','length','find','create','body','findOne','SugarcrmConfiguration','pick','getConfigurations','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','format','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','values','module_fields','remove','includes','label','endsWith','value','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird'];(function(_0x34c2d7,_0x116767){var _0x29674d=function(_0x20fd58){while(--_0x20fd58){_0x34c2d7['push'](_0x34c2d7['shift']());}};_0x29674d(++_0x116767);}(_0xec1d,0x7c));var _0xdec1=function(_0x24ccda,_0x1c3018){_0x24ccda=_0x24ccda-0x0;var _0x383213=_0xec1d[_0x24ccda];return _0x383213;};'use strict';var pdf=require(_0xdec1('0x0'));var emlformat=require(_0xdec1('0x1'));var rimraf=require(_0xdec1('0x2'));var zipdir=require(_0xdec1('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdec1('0x4'));var moment=require(_0xdec1('0x5'));var BPromise=require(_0xdec1('0x6'));var Mustache=require(_0xdec1('0x7'));var util=require(_0xdec1('0x8'));var path=require('path');var sox=require(_0xdec1('0x9'));var csv=require(_0xdec1('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xdec1('0xb'));var crypto=require('crypto');var jsforce=require(_0xdec1('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdec1('0xd'));var Redis=require(_0xdec1('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xdec1('0xf'));var as=require(_0xdec1('0x10'));var hardwareService=require(_0xdec1('0x11'));var logger=require(_0xdec1('0x12'))(_0xdec1('0x13'));var utils=require(_0xdec1('0x14'));var config=require('../../config/environment');var db=require(_0xdec1('0x15'))['db'];var integrations=require(_0xdec1('0x16'));var jayson=require(_0xdec1('0x17'));var client=jayson[_0xdec1('0x18')][_0xdec1('0x19')]({'port':0x232a});function checkPasswordPattern(_0x2c30e8,_0x191dc7,_0x4ec36e){if(_0x4ec36e){var _0x48d457=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x48d457[_0xdec1('0x1a')](_0x191dc7)){return _0x2c30e8;}else{throw new db['Sequelize'][(_0xdec1('0x1b'))](_0xdec1('0x1c'));}}else{return _0x2c30e8;}}function respondWithRpcPromise(_0xb9244a,_0x35fefd,_0x29aaec,_0x11e1ab){return new BPromise(function(_0x1b5162,_0x223019){var _0x271a7f=_0x11e1ab||client;return _0x271a7f['request'](_0xb9244a,_0x29aaec)['then'](function(_0x374e89){logger[_0xdec1('0x1d')](_0xdec1('0x1e'),_0x35fefd,'request\x20sent');logger[_0xdec1('0x1f')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x35fefd,'request\x20sent',JSON[_0xdec1('0x20')](_0x374e89));if(_0x374e89[_0xdec1('0x21')]){if(_0x374e89[_0xdec1('0x21')][_0xdec1('0x22')]===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x35fefd,_0x374e89[_0xdec1('0x21')][_0xdec1('0x23')]);return _0x223019(_0x374e89[_0xdec1('0x21')]['message']);}logger['error'](_0xdec1('0x1e'),_0x35fefd,_0x374e89[_0xdec1('0x21')]['message']);return _0x1b5162(_0x374e89[_0xdec1('0x21')][_0xdec1('0x23')]);}else{logger[_0xdec1('0x1d')](_0xdec1('0x1e'),_0x35fefd,_0xdec1('0x24'));_0x1b5162(_0x374e89['result'][_0xdec1('0x23')]);}})[_0xdec1('0x25')](function(_0x182146){logger[_0xdec1('0x21')](_0xdec1('0x1e'),_0x35fefd,_0x182146);_0x223019(_0x182146);});});}function respondWithStatusCode(_0x5f15d7,_0xc25456){_0xc25456=_0xc25456||0xcc;return function(_0x2e858c){if(_0x2e858c){return _0x5f15d7[_0xdec1('0x26')](_0xc25456);}return _0x5f15d7[_0xdec1('0x27')](_0xc25456)[_0xdec1('0x28')]();};}function respondWithResult(_0x28f2b3,_0xa25f81){_0xa25f81=_0xa25f81||0xc8;return function(_0x25bdc9){if(_0x25bdc9){return _0x28f2b3['status'](_0xa25f81)[_0xdec1('0x29')](_0x25bdc9);}};}function respondWithFilteredResult(_0x592a7f,_0x77089c){return function(_0x425a1f){if(_0x425a1f){var _0x4e8858=_0x425a1f['count'],_0x4afbd1=_0x77089c[_0xdec1('0x2a')],_0x2ea547=_0x77089c[_0xdec1('0x2a')]+_0x77089c[_0xdec1('0x2b')],_0x5b19b9;if(_0x2ea547>=_0x4e8858){_0x2ea547=_0x4e8858;_0x5b19b9=0xc8;}else{_0x5b19b9=0xce;}_0x592a7f[_0xdec1('0x27')](_0x5b19b9);return _0x592a7f[_0xdec1('0x2c')](_0xdec1('0x2d'),_0x4afbd1+'-'+_0x2ea547+'/'+_0x4e8858)[_0xdec1('0x29')](_0x425a1f);}return null;};}function patchUpdates(_0x434185){return function(_0x32c699){try{jsonpatch[_0xdec1('0x2e')](_0x32c699,_0x434185,!![]);}catch(_0x23812b){return BPromise[_0xdec1('0x2f')](_0x23812b);}return _0x32c699[_0xdec1('0x30')]();};}function saveUpdates(_0x1a1806,_0x554aae){return function(_0x5c1ddb){if(_0x5c1ddb){return _0x5c1ddb['update'](_0x1a1806)[_0xdec1('0x31')](function(_0x181fcf){return _0x181fcf;});}return null;};}function removeEntity(_0x33b25a,_0x4817f9){return function(_0x5b583c){if(_0x5b583c){return _0x5b583c[_0xdec1('0x32')]()[_0xdec1('0x31')](function(){_0x33b25a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1501b2,_0x162dbc){return function(_0x5345d4){if(!_0x5345d4){_0x1501b2['sendStatus'](0x194);}return _0x5345d4;};}function handleError(_0x172dd9,_0x2523ac){_0x2523ac=_0x2523ac||0x1f4;return function(_0x2f704b){logger[_0xdec1('0x21')](_0x2f704b[_0xdec1('0x33')]);if(_0x2f704b['name']){delete _0x2f704b[_0xdec1('0x34')];}_0x172dd9[_0xdec1('0x27')](_0x2523ac)[_0xdec1('0x35')](_0x2f704b);};}exports[_0xdec1('0x36')]=function(_0x5e68d8,_0x549994){var _0x16fadf={},_0x1c209d={},_0x2b781e={'count':0x0,'rows':[]};var _0x3e80c4=_[_0xdec1('0x37')](db[_0xdec1('0x38')][_0xdec1('0x39')],function(_0x413783){return{'name':_0x413783[_0xdec1('0x3a')],'type':_0x413783['type']['key']};});_0x1c209d[_0xdec1('0x3b')]=_[_0xdec1('0x37')](_0x3e80c4,_0xdec1('0x34'));_0x1c209d[_0xdec1('0x3c')]=_[_0xdec1('0x3d')](_0x5e68d8['query']);_0x1c209d[_0xdec1('0x3e')]=_[_0xdec1('0x3f')](_0x1c209d[_0xdec1('0x3b')],_0x1c209d[_0xdec1('0x3c')]);_0x16fadf['attributes']=_[_0xdec1('0x3f')](_0x1c209d[_0xdec1('0x3b')],qs['fields'](_0x5e68d8[_0xdec1('0x3c')]['fields']));_0x16fadf[_0xdec1('0x40')]=_0x16fadf[_0xdec1('0x40')]['length']?_0x16fadf[_0xdec1('0x40')]:_0x1c209d[_0xdec1('0x3b')];if(!_0x5e68d8[_0xdec1('0x3c')][_0xdec1('0x41')]('nolimit')){_0x16fadf[_0xdec1('0x2b')]=qs[_0xdec1('0x2b')](_0x5e68d8['query'][_0xdec1('0x2b')]);_0x16fadf[_0xdec1('0x2a')]=qs[_0xdec1('0x2a')](_0x5e68d8[_0xdec1('0x3c')][_0xdec1('0x2a')]);}_0x16fadf[_0xdec1('0x42')]=qs[_0xdec1('0x43')](_0x5e68d8[_0xdec1('0x3c')]['sort']);_0x16fadf[_0xdec1('0x44')]=qs[_0xdec1('0x3e')](_['pick'](_0x5e68d8[_0xdec1('0x3c')],_0x1c209d[_0xdec1('0x3e')]),_0x3e80c4);if(_0x5e68d8[_0xdec1('0x3c')][_0xdec1('0x45')]){_0x16fadf[_0xdec1('0x44')]=_['merge'](_0x16fadf[_0xdec1('0x44')],{'$or':_[_0xdec1('0x37')](_0x3e80c4,function(_0x19d924){if(_0x19d924[_0xdec1('0x46')]!==_0xdec1('0x47')){var _0x5627f1={};_0x5627f1[_0x19d924[_0xdec1('0x34')]]={'$like':'%'+_0x5e68d8['query']['filter']+'%'};return _0x5627f1;}})});}_0x16fadf=_[_0xdec1('0x48')]({},_0x16fadf,_0x5e68d8[_0xdec1('0x49')]);var _0x196c3b={'where':_0x16fadf[_0xdec1('0x44')]};return db[_0xdec1('0x38')][_0xdec1('0x4a')](_0x196c3b)[_0xdec1('0x31')](function(_0x5a61a8){_0x2b781e[_0xdec1('0x4a')]=_0x5a61a8;if(_0x5e68d8[_0xdec1('0x3c')][_0xdec1('0x4b')]){_0x16fadf[_0xdec1('0x4c')]=[{'all':!![]}];}return db[_0xdec1('0x38')][_0xdec1('0x4d')](_0x16fadf);})[_0xdec1('0x31')](function(_0x4d63a4){_0x2b781e[_0xdec1('0x4e')]=_0x4d63a4;return _0x2b781e;})['then'](respondWithFilteredResult(_0x549994,_0x16fadf))[_0xdec1('0x25')](handleError(_0x549994,null));};exports['show']=function(_0x448811,_0xc85144){var _0x4f3b67={'raw':![],'where':{'id':_0x448811[_0xdec1('0x4f')]['id']}},_0xb1283d={};_0xb1283d[_0xdec1('0x3b')]=_[_0xdec1('0x3d')](db[_0xdec1('0x38')][_0xdec1('0x39')]);_0xb1283d[_0xdec1('0x3c')]=_[_0xdec1('0x3d')](_0x448811[_0xdec1('0x3c')]);_0xb1283d[_0xdec1('0x3e')]=_['intersection'](_0xb1283d[_0xdec1('0x3b')],_0xb1283d[_0xdec1('0x3c')]);_0x4f3b67[_0xdec1('0x40')]=_[_0xdec1('0x3f')](_0xb1283d[_0xdec1('0x3b')],qs[_0xdec1('0x50')](_0x448811[_0xdec1('0x3c')][_0xdec1('0x50')]));_0x4f3b67[_0xdec1('0x40')]=_0x4f3b67[_0xdec1('0x40')][_0xdec1('0x51')]?_0x4f3b67[_0xdec1('0x40')]:_0xb1283d[_0xdec1('0x3b')];if(_0x448811[_0xdec1('0x3c')][_0xdec1('0x4b')]){_0x4f3b67['include']=[{'all':!![]}];}_0x4f3b67=_[_0xdec1('0x48')]({},_0x4f3b67,_0x448811['options']);return db['SugarcrmAccount'][_0xdec1('0x52')](_0x4f3b67)[_0xdec1('0x31')](handleEntityNotFound(_0xc85144,null))['then'](respondWithResult(_0xc85144,null))['catch'](handleError(_0xc85144,null));};exports[_0xdec1('0x53')]=function(_0x3f2cdb,_0x2d57a4){return db[_0xdec1('0x38')][_0xdec1('0x53')](_0x3f2cdb['body'],{})[_0xdec1('0x31')](respondWithResult(_0x2d57a4,0xc9))[_0xdec1('0x25')](handleError(_0x2d57a4,null));};exports['update']=function(_0x2a3246,_0x2c24b6){if(_0x2a3246[_0xdec1('0x54')]['id']){delete _0x2a3246[_0xdec1('0x54')]['id'];}return db[_0xdec1('0x38')][_0xdec1('0x52')]({'where':{'id':_0x2a3246['params']['id']}})[_0xdec1('0x31')](handleEntityNotFound(_0x2c24b6,null))[_0xdec1('0x31')](saveUpdates(_0x2a3246[_0xdec1('0x54')],null))['then'](respondWithResult(_0x2c24b6,null))['catch'](handleError(_0x2c24b6,null));};exports[_0xdec1('0x32')]=function(_0x17737e,_0xde0c9c){return db[_0xdec1('0x38')][_0xdec1('0x52')]({'where':{'id':_0x17737e[_0xdec1('0x4f')]['id']}})[_0xdec1('0x31')](handleEntityNotFound(_0xde0c9c,null))[_0xdec1('0x31')](removeEntity(_0xde0c9c,null))[_0xdec1('0x25')](handleError(_0xde0c9c,null));};exports['getConfigurations']=function(_0x22a519,_0x25e292,_0x2b130c){var _0x1fd1ef={};var _0x39dd28={};var _0x241d48;var _0x4b8f92;return db[_0xdec1('0x38')][_0xdec1('0x55')]({'where':{'id':_0x22a519[_0xdec1('0x4f')]['id']}})['then'](handleEntityNotFound(_0x25e292,null))[_0xdec1('0x31')](function(_0x13fe16){if(_0x13fe16){_0x241d48=_0x13fe16;_0x39dd28[_0xdec1('0x3b')]=_['keys'](db[_0xdec1('0x56')]['rawAttributes']);_0x39dd28[_0xdec1('0x3c')]=_[_0xdec1('0x3d')](_0x22a519[_0xdec1('0x3c')]);_0x39dd28['filters']=_[_0xdec1('0x3f')](_0x39dd28[_0xdec1('0x3b')],_0x39dd28[_0xdec1('0x3c')]);_0x1fd1ef[_0xdec1('0x40')]=_[_0xdec1('0x3f')](_0x39dd28['model'],qs['fields'](_0x22a519['query']['fields']));_0x1fd1ef[_0xdec1('0x40')]=_0x1fd1ef[_0xdec1('0x40')][_0xdec1('0x51')]?_0x1fd1ef[_0xdec1('0x40')]:_0x39dd28[_0xdec1('0x3b')];_0x1fd1ef[_0xdec1('0x42')]=qs['sort'](_0x22a519['query']['sort']);_0x1fd1ef[_0xdec1('0x44')]=qs[_0xdec1('0x3e')](_[_0xdec1('0x57')](_0x22a519[_0xdec1('0x3c')],_0x39dd28[_0xdec1('0x3e')]));if(_0x22a519[_0xdec1('0x3c')][_0xdec1('0x45')]){_0x1fd1ef[_0xdec1('0x44')]=_[_0xdec1('0x48')](_0x1fd1ef[_0xdec1('0x44')],{'$or':_[_0xdec1('0x37')](_0x1fd1ef[_0xdec1('0x40')],function(_0x4dc4f5){var _0x39ecbc={};_0x39ecbc[_0x4dc4f5]={'$like':'%'+_0x22a519['query'][_0xdec1('0x45')]+'%'};return _0x39ecbc;})});}_0x1fd1ef=_[_0xdec1('0x48')]({},_0x1fd1ef,_0x22a519['options']);return _0x241d48[_0xdec1('0x58')](_0x1fd1ef);}})[_0xdec1('0x31')](function(_0x415f80){if(_0x415f80){_0x4b8f92=_0x415f80[_0xdec1('0x51')];if(!_0x22a519[_0xdec1('0x3c')]['hasOwnProperty'](_0xdec1('0x59'))){_0x1fd1ef[_0xdec1('0x2b')]=qs[_0xdec1('0x2b')](_0x22a519[_0xdec1('0x3c')]['limit']);_0x1fd1ef[_0xdec1('0x2a')]=qs['offset'](_0x22a519['query'][_0xdec1('0x2a')]);}return _0x241d48[_0xdec1('0x58')](_0x1fd1ef);}})[_0xdec1('0x31')](function(_0x3d8eab){if(_0x3d8eab){return _0x3d8eab?{'count':_0x4b8f92,'rows':_0x3d8eab}:null;}})[_0xdec1('0x31')](respondWithResult(_0x25e292,null))['catch'](handleError(_0x25e292,null));};exports[_0xdec1('0x5a')]=function(_0x59637e,_0x589a84,_0x40ec2d){if(_0x59637e['body']['id']){delete _0x59637e[_0xdec1('0x54')]['id'];}return db[_0xdec1('0x38')]['findOne']({'where':{'id':_0x59637e[_0xdec1('0x4f')]['id']}})[_0xdec1('0x31')](handleEntityNotFound(_0x589a84,null))[_0xdec1('0x31')](function(_0x52d162){if(_0x52d162){_0x59637e[_0xdec1('0x54')][_0xdec1('0x5b')]=_0x52d162['id'];_0x59637e[_0xdec1('0x54')]['Subjects']=integrations[_0xdec1('0x5c')](_0x59637e[_0xdec1('0x54')][_0xdec1('0x5d')],_0x59637e['body'][_0xdec1('0x46')]);_0x59637e[_0xdec1('0x54')][_0xdec1('0x5e')]=integrations[_0xdec1('0x5f')](_0x59637e[_0xdec1('0x54')][_0xdec1('0x5d')],_0x59637e[_0xdec1('0x54')]['type']);return db['SugarcrmConfiguration'][_0xdec1('0x53')](_0x59637e['body'],{'include':[{'model':db[_0xdec1('0x60')],'as':'Subjects'},{'model':db['SugarcrmField'],'as':_0xdec1('0x5e')}]});}return null;})[_0xdec1('0x31')](respondWithResult(_0x589a84,null))[_0xdec1('0x25')](handleError(_0x589a84,null));};exports[_0xdec1('0x61')]=function(_0x5a9d73,_0x1829d8,_0x5ba384){var _0x37887c='';var _0x273422=['id',_0xdec1('0x34'),_0xdec1('0x62'),_0xdec1('0x63'),_0xdec1('0x64'),_0xdec1('0x65'),_0xdec1('0x66'),_0xdec1('0x67'),_0xdec1('0x68'),_0xdec1('0x69'),_0xdec1('0x6a'),_0xdec1('0x6b')];return db[_0xdec1('0x38')][_0xdec1('0x55')]({'where':{'id':_0x5a9d73[_0xdec1('0x4f')]['id']},'attributes':['id',_0xdec1('0x6c'),_0xdec1('0x6d'),_0xdec1('0x6e')]})[_0xdec1('0x31')](handleEntityNotFound(_0x1829d8,null))[_0xdec1('0x31')](function(_0x22277d){if(_0x22277d){_0x37887c=_0x22277d[_0xdec1('0x6e')];var _0x4465e4=_0x37887c[_0xdec1('0x6f')](-0x1);if(_0x4465e4==='/'){_0x37887c=_0x37887c[_0xdec1('0x70')](0x0,_0x37887c['lastIndexOf'](_0x4465e4));}return rp({'method':'POST','uri':util[_0xdec1('0x71')](_0xdec1('0x72'),_0x37887c,_0xdec1('0x73')),'json':!![],'form':{'method':_0xdec1('0x74'),'input_type':_0xdec1('0x75'),'response_type':_0xdec1('0x75'),'rest_data':JSON[_0xdec1('0x20')]({'user_auth':{'user_name':_0x22277d[_0xdec1('0x6c')],'password':_0x22277d[_0xdec1('0x6d')],'encryption':_0xdec1('0x76')},'application':_0xdec1('0x77')})}});}})[_0xdec1('0x31')](function(_0x22db4d){if(_0x22db4d&&_0x22db4d[_0xdec1('0x34')]!==_0xdec1('0x78')&&_0x22db4d['name']!=='Password\x20Expired'){return rp({'method':'POST','uri':util[_0xdec1('0x71')](_0xdec1('0x72'),_0x37887c,_0xdec1('0x73')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xdec1('0x75'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x22db4d['id'],'module_name':'Calls'})}})[_0xdec1('0x31')](function(_0x272863){if(_0x272863){var _0x112074=_[_0xdec1('0x79')](_0x272863[_0xdec1('0x7a')]);_[_0xdec1('0x7b')](_0x112074,function(_0x4f1fe6){return _0x273422[_0xdec1('0x7c')](_0x4f1fe6[_0xdec1('0x34')]);});return{'count':_0x112074[_0xdec1('0x51')],'rows':_[_0xdec1('0x37')](_0x112074,function(_0x4fb54b){return{'id':_0x4fb54b[_0xdec1('0x34')],'name':_0x4fb54b[_0xdec1('0x7d')],'custom':_[_0xdec1('0x7e')](_0x4fb54b[_0xdec1('0x34')],'_c')?!![]:![],'options':_0x4fb54b[_0xdec1('0x49')]?_[_0xdec1('0x37')](_[_0xdec1('0x79')](_0x4fb54b[_0xdec1('0x49')]),function(_0x3b230f){return{'name':_0x3b230f[_0xdec1('0x7f')],'value':_0x3b230f['name']};}):[]};})};}})[_0xdec1('0x31')](respondWithResult(_0x1829d8,null))[_0xdec1('0x25')](function(_0x89ce8a){var _0x4a1337=_0x5a9d73[_0xdec1('0x3c')]['test']?0x1f4:_0x89ce8a['statusCode']||0x1f4;logger[_0xdec1('0x21')](_0xdec1('0x80'),_0xdec1('0x61'),_0x4a1337,JSON[_0xdec1('0x20')](_0x89ce8a));delete _0x89ce8a[_0xdec1('0x34')];if(_0x4a1337===0x191){_0x4a1337=0x190;}_0x1829d8['status'](_0x4a1337)[_0xdec1('0x35')](_0x5a9d73[_0xdec1('0x3c')][_0xdec1('0x1a')]?{'message':_0xdec1('0x81'),'statusCode':_0x89ce8a[_0xdec1('0x82')]}:_0x89ce8a);});}else{var _0x199a00=0x1f4;_0x1829d8[_0xdec1('0x27')](_0x199a00)[_0xdec1('0x35')]({'message':_0xdec1('0x81'),'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 9c93723..1c03233 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 _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 +var _0x8301=['lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts'];(function(_0x28a41a,_0x206f94){var _0x1c83cb=function(_0x528ffb){while(--_0x528ffb){_0x28a41a['push'](_0x28a41a['shift']());}};_0x1c83cb(++_0x206f94);}(_0x8301,0x104));var _0x1830=function(_0x1e8eb4,_0x53a726){_0x1e8eb4=_0x1e8eb4-0x0;var _0x3e3e6e=_0x8301[_0x1e8eb4];return _0x3e3e6e;};'use strict';var _=require(_0x1830('0x0'));var util=require(_0x1830('0x1'));var logger=require(_0x1830('0x2'))(_0x1830('0x3'));var moment=require(_0x1830('0x4'));var BPromise=require('bluebird');var rp=require(_0x1830('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1830('0x6'));var attributes=require(_0x1830('0x7'));var integrations=require(_0x1830('0x8'));module[_0x1830('0x9')]=function(_0x1eaa32,_0xab7635){return _0x1eaa32[_0x1830('0xa')](_0x1830('0xb'),attributes,{'tableName':_0x1830('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 7deb9c2..6ed6537 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 _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 +var _0x691a=['result','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw','where','attributes','limit','map','include','model','ShowSugarcrmAccount','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message'];(function(_0x55c1f0,_0x4f574f){var _0x1530fa=function(_0x631542){while(--_0x631542){_0x55c1f0['push'](_0x55c1f0['shift']());}};_0x1530fa(++_0x4f574f);}(_0x691a,0xe0));var _0xa691=function(_0x1a6a20,_0x288d87){_0x1a6a20=_0x1a6a20-0x0;var _0x4c75d9=_0x691a[_0x1a6a20];return _0x4c75d9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa691('0x0'));var BPromise=require(_0xa691('0x1'));var rs=require(_0xa691('0x2'));var fs=require('fs');var Redis=require(_0xa691('0x3'));var db=require(_0xa691('0x4'))['db'];var utils=require(_0xa691('0x5'));var logger=require(_0xa691('0x6'))(_0xa691('0x7'));var config=require(_0xa691('0x8'));var jayson=require(_0xa691('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x894ea4,_0x45a608,_0x2ebb45){return new BPromise(function(_0x50e38f,_0x1fe627){return client[_0xa691('0xa')](_0x894ea4,_0x2ebb45)[_0xa691('0xb')](function(_0x326566){logger[_0xa691('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x45a608,_0xa691('0xd'));logger[_0xa691('0xe')](_0xa691('0xf'),_0x45a608,_0xa691('0xd'),JSON[_0xa691('0x10')](_0x326566));if(_0x326566[_0xa691('0x11')]){if(_0x326566[_0xa691('0x11')][_0xa691('0x12')]===0x1f4){logger[_0xa691('0x11')](_0xa691('0x13'),_0x45a608,_0x326566['error'][_0xa691('0x14')]);return _0x1fe627(_0x326566[_0xa691('0x11')][_0xa691('0x14')]);}logger[_0xa691('0x11')](_0xa691('0x13'),_0x45a608,_0x326566[_0xa691('0x11')][_0xa691('0x14')]);return _0x50e38f(_0x326566[_0xa691('0x11')][_0xa691('0x14')]);}else{logger[_0xa691('0xc')](_0xa691('0x13'),_0x45a608,'request\x20sent');_0x50e38f(_0x326566[_0xa691('0x15')][_0xa691('0x14')]);}})[_0xa691('0x16')](function(_0x4eee3a){logger[_0xa691('0x11')](_0xa691('0x13'),_0x45a608,_0x4eee3a);_0x1fe627(_0x4eee3a);});});}exports[_0xa691('0x17')]=function(_0x12ef5c){var _0x231543=this;return new Promise(function(_0x168a4b,_0x12ddc6){return db[_0xa691('0x18')]['findAll']({'raw':_0x12ef5c[_0xa691('0x19')]?_0x12ef5c['options'][_0xa691('0x1a')]===undefined?!![]:![]:!![],'where':_0x12ef5c[_0xa691('0x19')]?_0x12ef5c[_0xa691('0x19')][_0xa691('0x1b')]||null:null,'attributes':_0x12ef5c[_0xa691('0x19')]?_0x12ef5c[_0xa691('0x19')][_0xa691('0x1c')]||null:null,'limit':_0x12ef5c[_0xa691('0x19')]?_0x12ef5c[_0xa691('0x19')][_0xa691('0x1d')]||null:null,'include':_0x12ef5c['options']?_0x12ef5c['options']['include']?_[_0xa691('0x1e')](_0x12ef5c['options'][_0xa691('0x1f')],function(_0x33ee4b){return{'model':db[_0x33ee4b[_0xa691('0x20')]],'as':_0x33ee4b['as'],'attributes':_0x33ee4b[_0xa691('0x1c')],'include':_0x33ee4b[_0xa691('0x1f')]?_[_0xa691('0x1e')](_0x33ee4b[_0xa691('0x1f')],function(_0x52c49e){return{'model':db[_0x52c49e[_0xa691('0x20')]],'as':_0x52c49e['as'],'attributes':_0x52c49e[_0xa691('0x1c')],'include':_0x52c49e[_0xa691('0x1f')]?_[_0xa691('0x1e')](_0x52c49e[_0xa691('0x1f')],function(_0x5b5f3a){return{'model':db[_0x5b5f3a['model']],'as':_0x5b5f3a['as'],'attributes':_0x5b5f3a[_0xa691('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa691('0xb')](function(_0x4d190b){logger[_0xa691('0xc')](_0xa691('0x17'),_0x12ef5c);logger[_0xa691('0xe')](_0xa691('0x17'),_0x12ef5c,JSON[_0xa691('0x10')](_0x4d190b));_0x168a4b(_0x4d190b);})['catch'](function(_0x386355){logger[_0xa691('0x11')]('GetSugarcrmAccount',_0x386355[_0xa691('0x14')],_0x12ef5c);_0x12ddc6(_0x231543['error'](0x1f4,_0x386355[_0xa691('0x14')]));});});};exports[_0xa691('0x21')]=function(_0x15d3c0){var _0x9ead74=this;return new Promise(function(_0x562829,_0xbbbcca){return db[_0xa691('0x18')][_0xa691('0x22')]({'raw':_0x15d3c0[_0xa691('0x19')]?_0x15d3c0[_0xa691('0x19')][_0xa691('0x1a')]===undefined?!![]:![]:!![],'where':_0x15d3c0[_0xa691('0x19')]?_0x15d3c0[_0xa691('0x19')][_0xa691('0x1b')]||null:null,'attributes':_0x15d3c0[_0xa691('0x19')]?_0x15d3c0[_0xa691('0x19')][_0xa691('0x1c')]||null:null,'include':_0x15d3c0[_0xa691('0x19')]?_0x15d3c0[_0xa691('0x19')]['include']?_['map'](_0x15d3c0['options'][_0xa691('0x1f')],function(_0x5cdf5d){return{'model':db[_0x5cdf5d[_0xa691('0x20')]],'as':_0x5cdf5d['as'],'attributes':_0x5cdf5d[_0xa691('0x1c')],'include':_0x5cdf5d[_0xa691('0x1f')]?_[_0xa691('0x1e')](_0x5cdf5d[_0xa691('0x1f')],function(_0x9435b7){return{'model':db[_0x9435b7[_0xa691('0x20')]],'as':_0x9435b7['as'],'attributes':_0x9435b7[_0xa691('0x1c')],'include':_0x9435b7['include']?_[_0xa691('0x1e')](_0x9435b7[_0xa691('0x1f')],function(_0x306511){return{'model':db[_0x306511[_0xa691('0x20')]],'as':_0x306511['as'],'attributes':_0x306511[_0xa691('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26b692){logger[_0xa691('0xc')](_0xa691('0x21'),_0x15d3c0);logger[_0xa691('0xe')](_0xa691('0x21'),_0x15d3c0,JSON[_0xa691('0x10')](_0x26b692));_0x562829(_0x26b692);})[_0xa691('0x16')](function(_0xe14d86){logger[_0xa691('0x11')]('ShowSugarcrmAccount',_0xe14d86[_0xa691('0x14')],_0x15d3c0);_0xbbbcca(_0x9ead74[_0xa691('0x11')](0x1f4,_0xe14d86[_0xa691('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index b7e3b77..8137b25 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 _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 +var _0x976b=['isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','post','create','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get'];(function(_0x4b713d,_0x10779b){var _0x391704=function(_0x4213db){while(--_0x4213db){_0x4b713d['push'](_0x4b713d['shift']());}};_0x391704(++_0x10779b);}(_0x976b,0x1af));var _0xb976=function(_0x13c84b,_0x328daf){_0x13c84b=_0x13c84b-0x0;var _0x2094ce=_0x976b[_0x13c84b];return _0x2094ce;};'use strict';var multer=require('multer');var util=require(_0xb976('0x0'));var path=require('path');var timeout=require(_0xb976('0x1'));var express=require(_0xb976('0x2'));var router=express[_0xb976('0x3')]();var auth=require(_0xb976('0x4'));var interaction=require(_0xb976('0x5'));var config=require(_0xb976('0x6'));var controller=require(_0xb976('0x7'));router[_0xb976('0x8')]('/',auth[_0xb976('0x9')](),controller[_0xb976('0xa')]);router[_0xb976('0x8')](_0xb976('0xb'),auth['isAuthenticated'](),controller[_0xb976('0xc')]);router[_0xb976('0x8')](_0xb976('0xd'),auth[_0xb976('0x9')](),controller[_0xb976('0xe')]);router[_0xb976('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xb976('0xf')]);router[_0xb976('0x8')]('/:id/descriptions',auth[_0xb976('0x9')](),controller['getDescriptions']);router[_0xb976('0x10')]('/',auth[_0xb976('0x9')](),controller[_0xb976('0x11')]);router['put'](_0xb976('0xb'),auth[_0xb976('0x9')](),controller['update']);router['delete']('/:id',auth[_0xb976('0x9')](),controller[_0xb976('0x12')]);module[_0xb976('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index b382911..24ec024 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 _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 +var _0xed35=['sequelize','exports'];(function(_0x4a62dd,_0x4d6d52){var _0x290167=function(_0x5efada){while(--_0x5efada){_0x4a62dd['push'](_0x4a62dd['shift']());}};_0x290167(++_0x4d6d52);}(_0xed35,0x1d2));var _0x5ed3=function(_0x55d5ce,_0x543b5b){_0x55d5ce=_0x55d5ce-0x0;var _0x4091b9=_0xed35[_0x55d5ce];return _0x4091b9;};'use strict';var Sequelize=require(_0x5ed3('0x0'));module[_0x5ed3('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 87a4a4f..5835db3 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 _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 +var _0x881f=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','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~!@#$%^&-_=+[{]}.','info','SugarcrmConfiguration,\x20%s,\x20%s','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','apply','update','then','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','SugarcrmConfiguration','show','params','length','options','find','create','body','destroy','getFields','SugarcrmField','pick','getSubjects','getDescriptions','html-pdf','eml-format','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis'];(function(_0x45ffaa,_0x42daa5){var _0x562432=function(_0x133ee5){while(--_0x133ee5){_0x45ffaa['push'](_0x45ffaa['shift']());}};_0x562432(++_0x42daa5);}(_0x881f,0xea));var _0xf881=function(_0x2718f0,_0x3b4e6f){_0x2718f0=_0x2718f0-0x0;var _0x392037=_0x881f[_0x2718f0];return _0x392037;};'use strict';var pdf=require(_0xf881('0x0'));var emlformat=require(_0xf881('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf881('0x2'));var rp=require(_0xf881('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf881('0x4'));var util=require(_0xf881('0x5'));var path=require(_0xf881('0x6'));var sox=require(_0xf881('0x7'));var csv=require(_0xf881('0x8'));var ejs=require(_0xf881('0x9'));var fs=require('fs');var _=require(_0xf881('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf881('0xb'));var deskjs=require(_0xf881('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf881('0xd'));var Redis=require(_0xf881('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf881('0xf'));var as=require(_0xf881('0x10'));var hardwareService=require(_0xf881('0x11'));var logger=require('../../config/logger')(_0xf881('0x12'));var utils=require(_0xf881('0x13'));var config=require(_0xf881('0x14'));var db=require(_0xf881('0x15'))['db'];var jayson=require(_0xf881('0x16'));var client=jayson[_0xf881('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x4947da,_0x312ac2,_0x48857d){if(_0x48857d){var _0x395dac=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x395dac[_0xf881('0x18')](_0x312ac2)){return _0x4947da;}else{throw new db['Sequelize']['ValidationError'](_0xf881('0x19'));}}else{return _0x4947da;}}function respondWithRpcPromise(_0x3b55f2,_0x1cda50,_0x57638c,_0x2ec80a){return new BPromise(function(_0x394ab1,_0x31af69){var _0x34946d=_0x2ec80a||client;return _0x34946d['request'](_0x3b55f2,_0x57638c)['then'](function(_0x57a595){logger[_0xf881('0x1a')](_0xf881('0x1b'),_0x1cda50,'request\x20sent');logger['debug'](_0xf881('0x1c'),_0x1cda50,_0xf881('0x1d'),JSON['stringify'](_0x57a595));if(_0x57a595[_0xf881('0x1e')]){if(_0x57a595['error']['code']===0x1f4){logger[_0xf881('0x1e')](_0xf881('0x1b'),_0x1cda50,_0x57a595[_0xf881('0x1e')]['message']);return _0x31af69(_0x57a595['error'][_0xf881('0x1f')]);}logger[_0xf881('0x1e')](_0xf881('0x1b'),_0x1cda50,_0x57a595[_0xf881('0x1e')][_0xf881('0x1f')]);return _0x394ab1(_0x57a595[_0xf881('0x1e')][_0xf881('0x1f')]);}else{logger[_0xf881('0x1a')](_0xf881('0x1b'),_0x1cda50,_0xf881('0x1d'));_0x394ab1(_0x57a595[_0xf881('0x20')][_0xf881('0x1f')]);}})[_0xf881('0x21')](function(_0x1ae08f){logger[_0xf881('0x1e')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1cda50,_0x1ae08f);_0x31af69(_0x1ae08f);});});}function respondWithStatusCode(_0x2db980,_0x5e35eb){_0x5e35eb=_0x5e35eb||0xcc;return function(_0x44b60d){if(_0x44b60d){return _0x2db980[_0xf881('0x22')](_0x5e35eb);}return _0x2db980['status'](_0x5e35eb)[_0xf881('0x23')]();};}function respondWithResult(_0x547214,_0x102b10){_0x102b10=_0x102b10||0xc8;return function(_0x3fe2cd){if(_0x3fe2cd){return _0x547214[_0xf881('0x24')](_0x102b10)[_0xf881('0x25')](_0x3fe2cd);}};}function respondWithFilteredResult(_0x10128e,_0x425ed4){return function(_0x2978af){if(_0x2978af){var _0x4ab5e4=_0x2978af[_0xf881('0x26')],_0x346992=_0x425ed4[_0xf881('0x27')],_0x344d7b=_0x425ed4[_0xf881('0x27')]+_0x425ed4[_0xf881('0x28')],_0x17e6a1;if(_0x344d7b>=_0x4ab5e4){_0x344d7b=_0x4ab5e4;_0x17e6a1=0xc8;}else{_0x17e6a1=0xce;}_0x10128e[_0xf881('0x24')](_0x17e6a1);return _0x10128e[_0xf881('0x29')]('Content-Range',_0x346992+'-'+_0x344d7b+'/'+_0x4ab5e4)[_0xf881('0x25')](_0x2978af);}return null;};}function patchUpdates(_0x2a92a7){return function(_0x14ab27){try{jsonpatch[_0xf881('0x2a')](_0x14ab27,_0x2a92a7,!![]);}catch(_0x3be2f3){return BPromise['reject'](_0x3be2f3);}return _0x14ab27['save']();};}function saveUpdates(_0x4366ff,_0x55310e){return function(_0x518df5){if(_0x518df5){return _0x518df5[_0xf881('0x2b')](_0x4366ff)[_0xf881('0x2c')](function(_0x2f5a0d){return _0x2f5a0d;});}return null;};}function removeEntity(_0x3579d7,_0x40c0f0){return function(_0x305bdb){if(_0x305bdb){return _0x305bdb['destroy']()['then'](function(){_0x3579d7[_0xf881('0x24')](0xcc)[_0xf881('0x23')]();});}};}function handleEntityNotFound(_0x12c288,_0x71604b){return function(_0x2cebc9){if(!_0x2cebc9){_0x12c288['sendStatus'](0x194);}return _0x2cebc9;};}function handleError(_0x3d9ebc,_0x1409de){_0x1409de=_0x1409de||0x1f4;return function(_0x4e7329){logger[_0xf881('0x1e')](_0x4e7329['stack']);if(_0x4e7329['name']){delete _0x4e7329[_0xf881('0x2d')];}_0x3d9ebc[_0xf881('0x24')](_0x1409de)['send'](_0x4e7329);};}exports[_0xf881('0x2e')]=function(_0x32e454,_0x3cff73){var _0x110ce8={},_0x764a57={},_0x492a9f={'count':0x0,'rows':[]};var _0x1cb7bc=_[_0xf881('0x2f')](db['SugarcrmConfiguration'][_0xf881('0x30')],function(_0x18abe5){return{'name':_0x18abe5[_0xf881('0x31')],'type':_0x18abe5[_0xf881('0x32')][_0xf881('0x33')]};});_0x764a57[_0xf881('0x34')]=_[_0xf881('0x2f')](_0x1cb7bc,'name');_0x764a57['query']=_[_0xf881('0x35')](_0x32e454[_0xf881('0x36')]);_0x764a57[_0xf881('0x37')]=_[_0xf881('0x38')](_0x764a57[_0xf881('0x34')],_0x764a57[_0xf881('0x36')]);_0x110ce8[_0xf881('0x39')]=_[_0xf881('0x38')](_0x764a57[_0xf881('0x34')],qs[_0xf881('0x3a')](_0x32e454['query']['fields']));_0x110ce8[_0xf881('0x39')]=_0x110ce8[_0xf881('0x39')]['length']?_0x110ce8[_0xf881('0x39')]:_0x764a57['model'];if(!_0x32e454[_0xf881('0x36')][_0xf881('0x3b')](_0xf881('0x3c'))){_0x110ce8[_0xf881('0x28')]=qs[_0xf881('0x28')](_0x32e454[_0xf881('0x36')][_0xf881('0x28')]);_0x110ce8[_0xf881('0x27')]=qs['offset'](_0x32e454[_0xf881('0x36')][_0xf881('0x27')]);}_0x110ce8[_0xf881('0x3d')]=qs[_0xf881('0x3e')](_0x32e454[_0xf881('0x36')]['sort']);_0x110ce8[_0xf881('0x3f')]=qs[_0xf881('0x37')](_['pick'](_0x32e454['query'],_0x764a57[_0xf881('0x37')]),_0x1cb7bc);if(_0x32e454['query'][_0xf881('0x40')]){_0x110ce8[_0xf881('0x3f')]=_[_0xf881('0x41')](_0x110ce8[_0xf881('0x3f')],{'$or':_[_0xf881('0x2f')](_0x1cb7bc,function(_0x1f0efd){if(_0x1f0efd['type']!==_0xf881('0x42')){var _0x41b160={};_0x41b160[_0x1f0efd[_0xf881('0x2d')]]={'$like':'%'+_0x32e454[_0xf881('0x36')][_0xf881('0x40')]+'%'};return _0x41b160;}})});}_0x110ce8=_[_0xf881('0x41')]({},_0x110ce8,_0x32e454['options']);var _0x4b884c={'where':_0x110ce8[_0xf881('0x3f')]};return db['SugarcrmConfiguration'][_0xf881('0x26')](_0x4b884c)[_0xf881('0x2c')](function(_0x1fb452){_0x492a9f[_0xf881('0x26')]=_0x1fb452;if(_0x32e454[_0xf881('0x36')][_0xf881('0x43')]){_0x110ce8[_0xf881('0x44')]=[{'all':!![]}];}return db[_0xf881('0x45')]['findAll'](_0x110ce8);})['then'](function(_0x21c111){_0x492a9f['rows']=_0x21c111;return _0x492a9f;})[_0xf881('0x2c')](respondWithFilteredResult(_0x3cff73,_0x110ce8))[_0xf881('0x21')](handleError(_0x3cff73,null));};exports[_0xf881('0x46')]=function(_0x4a0cfc,_0x1dc4c7){var _0x4b3dfa={'raw':![],'where':{'id':_0x4a0cfc[_0xf881('0x47')]['id']}},_0x1da685={};_0x1da685[_0xf881('0x34')]=_[_0xf881('0x35')](db['SugarcrmConfiguration']['rawAttributes']);_0x1da685[_0xf881('0x36')]=_[_0xf881('0x35')](_0x4a0cfc[_0xf881('0x36')]);_0x1da685[_0xf881('0x37')]=_[_0xf881('0x38')](_0x1da685['model'],_0x1da685[_0xf881('0x36')]);_0x4b3dfa[_0xf881('0x39')]=_[_0xf881('0x38')](_0x1da685[_0xf881('0x34')],qs['fields'](_0x4a0cfc[_0xf881('0x36')][_0xf881('0x3a')]));_0x4b3dfa[_0xf881('0x39')]=_0x4b3dfa[_0xf881('0x39')][_0xf881('0x48')]?_0x4b3dfa[_0xf881('0x39')]:_0x1da685['model'];if(_0x4a0cfc['query'][_0xf881('0x43')]){_0x4b3dfa[_0xf881('0x44')]=[{'all':!![]}];}_0x4b3dfa=_[_0xf881('0x41')]({},_0x4b3dfa,_0x4a0cfc[_0xf881('0x49')]);return db[_0xf881('0x45')][_0xf881('0x4a')](_0x4b3dfa)[_0xf881('0x2c')](handleEntityNotFound(_0x1dc4c7,null))['then'](respondWithResult(_0x1dc4c7,null))[_0xf881('0x21')](handleError(_0x1dc4c7,null));};exports[_0xf881('0x4b')]=function(_0x24b1e1,_0x55e12d){return db['SugarcrmConfiguration'][_0xf881('0x4b')](_0x24b1e1['body'],{})[_0xf881('0x2c')](respondWithResult(_0x55e12d,0xc9))['catch'](handleError(_0x55e12d,null));};exports[_0xf881('0x2b')]=function(_0x2339e2,_0x3e9229){if(_0x2339e2['body']['id']){delete _0x2339e2[_0xf881('0x4c')]['id'];}return db[_0xf881('0x45')][_0xf881('0x4a')]({'where':{'id':_0x2339e2['params']['id']}})[_0xf881('0x2c')](handleEntityNotFound(_0x3e9229,null))['then'](saveUpdates(_0x2339e2['body'],null))[_0xf881('0x2c')](respondWithResult(_0x3e9229,null))['catch'](handleError(_0x3e9229,null));};exports[_0xf881('0x4d')]=function(_0x1ae880,_0x104a64){return db[_0xf881('0x45')]['find']({'where':{'id':_0x1ae880[_0xf881('0x47')]['id']}})[_0xf881('0x2c')](handleEntityNotFound(_0x104a64,null))['then'](removeEntity(_0x104a64,null))[_0xf881('0x21')](handleError(_0x104a64,null));};exports[_0xf881('0x4e')]=function(_0x5b7cb1,_0xcd838a,_0x1c001a){var _0x370c92={};var _0x4fb335={};var _0x539e1d;var _0x3a1ead;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x5b7cb1[_0xf881('0x47')]['id']}})[_0xf881('0x2c')](handleEntityNotFound(_0xcd838a,null))[_0xf881('0x2c')](function(_0x43f4cb){if(_0x43f4cb){_0x539e1d=_0x43f4cb;_0x4fb335[_0xf881('0x34')]=_[_0xf881('0x35')](db[_0xf881('0x4f')][_0xf881('0x30')]);_0x4fb335[_0xf881('0x36')]=_[_0xf881('0x35')](_0x5b7cb1[_0xf881('0x36')]);_0x4fb335[_0xf881('0x37')]=_[_0xf881('0x38')](_0x4fb335[_0xf881('0x34')],_0x4fb335[_0xf881('0x36')]);_0x370c92[_0xf881('0x39')]=_[_0xf881('0x38')](_0x4fb335['model'],qs['fields'](_0x5b7cb1[_0xf881('0x36')][_0xf881('0x3a')]));_0x370c92[_0xf881('0x39')]=_0x370c92[_0xf881('0x39')]['length']?_0x370c92[_0xf881('0x39')]:_0x4fb335['model'];_0x370c92[_0xf881('0x3d')]=qs[_0xf881('0x3e')](_0x5b7cb1['query'][_0xf881('0x3e')]);_0x370c92[_0xf881('0x3f')]=qs[_0xf881('0x37')](_[_0xf881('0x50')](_0x5b7cb1[_0xf881('0x36')],_0x4fb335[_0xf881('0x37')]));if(_0x5b7cb1['query'][_0xf881('0x40')]){_0x370c92[_0xf881('0x3f')]=_[_0xf881('0x41')](_0x370c92[_0xf881('0x3f')],{'$or':_[_0xf881('0x2f')](_0x370c92[_0xf881('0x39')],function(_0x1261a3){var _0xce1f14={};_0xce1f14[_0x1261a3]={'$like':'%'+_0x5b7cb1[_0xf881('0x36')]['filter']+'%'};return _0xce1f14;})});}_0x370c92=_[_0xf881('0x41')]({},_0x370c92,_0x5b7cb1['options']);return _0x539e1d['getFields'](_0x370c92);}})[_0xf881('0x2c')](function(_0x2c7e0){if(_0x2c7e0){_0x3a1ead=_0x2c7e0[_0xf881('0x48')];if(!_0x5b7cb1[_0xf881('0x36')]['hasOwnProperty'](_0xf881('0x3c'))){_0x370c92[_0xf881('0x28')]=qs['limit'](_0x5b7cb1['query'][_0xf881('0x28')]);_0x370c92[_0xf881('0x27')]=qs[_0xf881('0x27')](_0x5b7cb1[_0xf881('0x36')][_0xf881('0x27')]);}return _0x539e1d[_0xf881('0x4e')](_0x370c92);}})[_0xf881('0x2c')](function(_0x268a5e){if(_0x268a5e){return _0x268a5e?{'count':_0x3a1ead,'rows':_0x268a5e}:null;}})['then'](respondWithResult(_0xcd838a,null))['catch'](handleError(_0xcd838a,null));};exports[_0xf881('0x51')]=function(_0x4b487a,_0x320409,_0x5636a7){var _0x47e3d6={};var _0x354d36={};var _0x193aa3;var _0xbe38da;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x4b487a['params']['id']}})[_0xf881('0x2c')](handleEntityNotFound(_0x320409,null))[_0xf881('0x2c')](function(_0x586ad2){if(_0x586ad2){_0x193aa3=_0x586ad2;_0x354d36[_0xf881('0x34')]=_['keys'](db['SugarcrmField'][_0xf881('0x30')]);_0x354d36[_0xf881('0x36')]=_[_0xf881('0x35')](_0x4b487a[_0xf881('0x36')]);_0x354d36[_0xf881('0x37')]=_[_0xf881('0x38')](_0x354d36['model'],_0x354d36[_0xf881('0x36')]);_0x47e3d6[_0xf881('0x39')]=_[_0xf881('0x38')](_0x354d36[_0xf881('0x34')],qs[_0xf881('0x3a')](_0x4b487a[_0xf881('0x36')]['fields']));_0x47e3d6['attributes']=_0x47e3d6[_0xf881('0x39')]['length']?_0x47e3d6['attributes']:_0x354d36[_0xf881('0x34')];_0x47e3d6['order']=qs[_0xf881('0x3e')](_0x4b487a[_0xf881('0x36')]['sort']);_0x47e3d6[_0xf881('0x3f')]=qs[_0xf881('0x37')](_[_0xf881('0x50')](_0x4b487a[_0xf881('0x36')],_0x354d36[_0xf881('0x37')]));if(_0x4b487a[_0xf881('0x36')][_0xf881('0x40')]){_0x47e3d6['where']=_[_0xf881('0x41')](_0x47e3d6['where'],{'$or':_[_0xf881('0x2f')](_0x47e3d6[_0xf881('0x39')],function(_0x26c6f5){var _0x32d564={};_0x32d564[_0x26c6f5]={'$like':'%'+_0x4b487a['query'][_0xf881('0x40')]+'%'};return _0x32d564;})});}_0x47e3d6=_[_0xf881('0x41')]({},_0x47e3d6,_0x4b487a['options']);return _0x193aa3[_0xf881('0x51')](_0x47e3d6);}})['then'](function(_0x46b2a7){if(_0x46b2a7){_0xbe38da=_0x46b2a7[_0xf881('0x48')];if(!_0x4b487a['query'][_0xf881('0x3b')]('nolimit')){_0x47e3d6[_0xf881('0x28')]=qs[_0xf881('0x28')](_0x4b487a[_0xf881('0x36')][_0xf881('0x28')]);_0x47e3d6[_0xf881('0x27')]=qs['offset'](_0x4b487a['query'][_0xf881('0x27')]);}return _0x193aa3[_0xf881('0x51')](_0x47e3d6);}})[_0xf881('0x2c')](function(_0x293fcb){if(_0x293fcb){return _0x293fcb?{'count':_0xbe38da,'rows':_0x293fcb}:null;}})[_0xf881('0x2c')](respondWithResult(_0x320409,null))[_0xf881('0x21')](handleError(_0x320409,null));};exports[_0xf881('0x52')]=function(_0x3c5172,_0x25f42e,_0x4ed43c){var _0x48390a={};var _0x1c459c={};var _0x24fcd8;var _0x5417c3;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x3c5172[_0xf881('0x47')]['id']}})['then'](handleEntityNotFound(_0x25f42e,null))[_0xf881('0x2c')](function(_0x51ff99){if(_0x51ff99){_0x24fcd8=_0x51ff99;_0x1c459c[_0xf881('0x34')]=_['keys'](db[_0xf881('0x4f')][_0xf881('0x30')]);_0x1c459c[_0xf881('0x36')]=_[_0xf881('0x35')](_0x3c5172[_0xf881('0x36')]);_0x1c459c['filters']=_[_0xf881('0x38')](_0x1c459c[_0xf881('0x34')],_0x1c459c[_0xf881('0x36')]);_0x48390a[_0xf881('0x39')]=_['intersection'](_0x1c459c[_0xf881('0x34')],qs[_0xf881('0x3a')](_0x3c5172['query'][_0xf881('0x3a')]));_0x48390a[_0xf881('0x39')]=_0x48390a[_0xf881('0x39')][_0xf881('0x48')]?_0x48390a[_0xf881('0x39')]:_0x1c459c['model'];_0x48390a[_0xf881('0x3d')]=qs['sort'](_0x3c5172[_0xf881('0x36')]['sort']);_0x48390a['where']=qs[_0xf881('0x37')](_[_0xf881('0x50')](_0x3c5172[_0xf881('0x36')],_0x1c459c['filters']));if(_0x3c5172[_0xf881('0x36')][_0xf881('0x40')]){_0x48390a[_0xf881('0x3f')]=_[_0xf881('0x41')](_0x48390a['where'],{'$or':_[_0xf881('0x2f')](_0x48390a[_0xf881('0x39')],function(_0x285c7f){var _0x62a969={};_0x62a969[_0x285c7f]={'$like':'%'+_0x3c5172['query'][_0xf881('0x40')]+'%'};return _0x62a969;})});}_0x48390a=_[_0xf881('0x41')]({},_0x48390a,_0x3c5172[_0xf881('0x49')]);return _0x24fcd8[_0xf881('0x52')](_0x48390a);}})[_0xf881('0x2c')](function(_0x302502){if(_0x302502){_0x5417c3=_0x302502[_0xf881('0x48')];if(!_0x3c5172[_0xf881('0x36')][_0xf881('0x3b')]('nolimit')){_0x48390a['limit']=qs[_0xf881('0x28')](_0x3c5172[_0xf881('0x36')][_0xf881('0x28')]);_0x48390a[_0xf881('0x27')]=qs['offset'](_0x3c5172[_0xf881('0x36')]['offset']);}return _0x24fcd8['getDescriptions'](_0x48390a);}})[_0xf881('0x2c')](function(_0x291dda){if(_0x291dda){return _0x291dda?{'count':_0x5417c3,'rows':_0x291dda}:null;}})['then'](respondWithResult(_0x25f42e,null))[_0xf881('0x21')](handleError(_0x25f42e,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 42a6c62..6a77266 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 _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 +var _0xadde=['util','../../config/logger','api','moment','bluebird','path','rimraf','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash'];(function(_0x32f05c,_0x273aef){var _0x4307ed=function(_0x1be4da){while(--_0x1be4da){_0x32f05c['push'](_0x32f05c['shift']());}};_0x4307ed(++_0x273aef);}(_0xadde,0x15b));var _0xeadd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xadde[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xeadd('0x0'));var util=require(_0xeadd('0x1'));var logger=require(_0xeadd('0x2'))(_0xeadd('0x3'));var moment=require(_0xeadd('0x4'));var BPromise=require(_0xeadd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeadd('0x6'));var rimraf=require(_0xeadd('0x7'));var config=require('../../config/environment');var attributes=require(_0xeadd('0x8'));module['exports']=function(_0x51165e,_0x168efd){return _0x51165e[_0xeadd('0x9')](_0xeadd('0xa'),attributes,{'tableName':_0xeadd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 8caa06d..11fb36d 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 _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 +var _0x5f6c=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3f3026,_0x35d62a){var _0x4e87bf=function(_0x174109){while(--_0x174109){_0x3f3026['push'](_0x3f3026['shift']());}};_0x4e87bf(++_0x35d62a);}(_0x5f6c,0x12e));var _0xc5f6=function(_0x4ff15a,_0x1fd975){_0x4ff15a=_0x4ff15a-0x0;var _0x135ca3=_0x5f6c[_0x4ff15a];return _0x135ca3;};'use strict';var _=require(_0xc5f6('0x0'));var util=require(_0xc5f6('0x1'));var moment=require(_0xc5f6('0x2'));var BPromise=require(_0xc5f6('0x3'));var rs=require(_0xc5f6('0x4'));var fs=require('fs');var Redis=require(_0xc5f6('0x5'));var db=require(_0xc5f6('0x6'))['db'];var utils=require(_0xc5f6('0x7'));var logger=require(_0xc5f6('0x8'))(_0xc5f6('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc5f6('0xa')][_0xc5f6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x328573,_0x5cac01,_0x5916ce){return new BPromise(function(_0x282160,_0x33f600){return client[_0xc5f6('0xc')](_0x328573,_0x5916ce)[_0xc5f6('0xd')](function(_0x213c4c){logger[_0xc5f6('0xe')](_0xc5f6('0xf'),_0x5cac01,_0xc5f6('0x10'));logger[_0xc5f6('0x11')](_0xc5f6('0x12'),_0x5cac01,_0xc5f6('0x10'),JSON[_0xc5f6('0x13')](_0x213c4c));if(_0x213c4c['error']){if(_0x213c4c[_0xc5f6('0x14')][_0xc5f6('0x15')]===0x1f4){logger['error'](_0xc5f6('0xf'),_0x5cac01,_0x213c4c[_0xc5f6('0x14')][_0xc5f6('0x16')]);return _0x33f600(_0x213c4c['error'][_0xc5f6('0x16')]);}logger[_0xc5f6('0x14')](_0xc5f6('0xf'),_0x5cac01,_0x213c4c[_0xc5f6('0x14')][_0xc5f6('0x16')]);return _0x282160(_0x213c4c[_0xc5f6('0x14')][_0xc5f6('0x16')]);}else{logger['info'](_0xc5f6('0xf'),_0x5cac01,_0xc5f6('0x10'));_0x282160(_0x213c4c[_0xc5f6('0x17')]['message']);}})[_0xc5f6('0x18')](function(_0x5d170e){logger[_0xc5f6('0x14')](_0xc5f6('0xf'),_0x5cac01,_0x5d170e);_0x33f600(_0x5d170e);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index b2f5ff8..e01ba10 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 _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 +var _0xc46a=['destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x33092d,_0x54304e){var _0x4ff011=function(_0x1aabe5){while(--_0x1aabe5){_0x33092d['push'](_0x33092d['shift']());}};_0x4ff011(++_0x54304e);}(_0xc46a,0x1b2));var _0xac46=function(_0x1109db,_0x5c6dc7){_0x1109db=_0x1109db-0x0;var _0x27d529=_0xc46a[_0x1109db];return _0x27d529;};'use strict';var multer=require(_0xac46('0x0'));var util=require(_0xac46('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xac46('0x2')]();var auth=require(_0xac46('0x3'));var interaction=require(_0xac46('0x4'));var config=require('../../config/environment');var controller=require(_0xac46('0x5'));router[_0xac46('0x6')]('/',auth[_0xac46('0x7')](),controller[_0xac46('0x8')]);router[_0xac46('0x6')](_0xac46('0x9'),auth[_0xac46('0x7')](),controller[_0xac46('0xa')]);router[_0xac46('0xb')]('/',auth[_0xac46('0x7')](),controller[_0xac46('0xc')]);router[_0xac46('0xd')](_0xac46('0x9'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xac46('0xe')]);module[_0xac46('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 124bac3..e50b3dc 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 _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 +var _0x668b=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x55f60e,_0x3e5581){var _0x2a5965=function(_0x3acd59){while(--_0x3acd59){_0x55f60e['push'](_0x55f60e['shift']());}};_0x2a5965(++_0x3e5581);}(_0x668b,0x8d));var _0xb668=function(_0x2f3d29,_0x150e7b){_0x2f3d29=_0x2f3d29-0x0;var _0x53d69d=_0x668b[_0x2f3d29];return _0x53d69d;};'use strict';var Sequelize=require(_0xb668('0x0'));module[_0xb668('0x1')]={'type':{'type':Sequelize[_0xb668('0x2')](_0xb668('0x3'),_0xb668('0x4'),_0xb668('0x5'),_0xb668('0x6')),'defaultValue':_0xb668('0x3')},'content':{'type':Sequelize[_0xb668('0x7')]},'key':{'type':Sequelize[_0xb668('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xb668('0x3'),_0xb668('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xb668('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xb668('0x7')]},'customField':{'type':Sequelize[_0xb668('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb668('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index b3760db..26c7704 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 _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 +var _0xa10e=['../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','save','update','destroy','then','error','stack','name','index','map','SugarcrmField','rawAttributes','fieldName','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','type','merge','options','count','includeAll','include','findAll','rows','params','catch','create','body','find','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service'];(function(_0x5a1a5b,_0x1c8fb9){var _0x36eccd=function(_0x55f735){while(--_0x55f735){_0x5a1a5b['push'](_0x5a1a5b['shift']());}};_0x36eccd(++_0x1c8fb9);}(_0xa10e,0x7b));var _0xea10=function(_0x32eb6e,_0x384dc7){_0x32eb6e=_0x32eb6e-0x0;var _0x1fef62=_0xa10e[_0x32eb6e];return _0x1fef62;};'use strict';var pdf=require(_0xea10('0x0'));var emlformat=require(_0xea10('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xea10('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xea10('0x3'));var moment=require(_0xea10('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xea10('0x5'));var util=require(_0xea10('0x6'));var path=require(_0xea10('0x7'));var sox=require(_0xea10('0x8'));var csv=require(_0xea10('0x9'));var ejs=require(_0xea10('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xea10('0xb'));var crypto=require(_0xea10('0xc'));var jsforce=require(_0xea10('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xea10('0x9'));var querystring=require(_0xea10('0xe'));var Papa=require('papaparse');var Redis=require(_0xea10('0xf'));var authService=require(_0xea10('0x10'));var qs=require(_0xea10('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xea10('0x12'))(_0xea10('0x13'));var utils=require(_0xea10('0x14'));var config=require(_0xea10('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31ac46,_0x276365){_0x276365=_0x276365||0xcc;return function(_0x26c791){if(_0x26c791){return _0x31ac46[_0xea10('0x16')](_0x276365);}return _0x31ac46[_0xea10('0x17')](_0x276365)[_0xea10('0x18')]();};}function respondWithResult(_0xa5e1f7,_0x505b01){_0x505b01=_0x505b01||0xc8;return function(_0x96d2c2){if(_0x96d2c2){return _0xa5e1f7[_0xea10('0x17')](_0x505b01)['json'](_0x96d2c2);}};}function respondWithFilteredResult(_0x125d90,_0x576ce6){return function(_0x50c428){if(_0x50c428){var _0x1fa6ee=_0x50c428['count'],_0x53b23c=_0x576ce6[_0xea10('0x19')],_0x34d9ce=_0x576ce6[_0xea10('0x19')]+_0x576ce6[_0xea10('0x1a')],_0x445516;if(_0x34d9ce>=_0x1fa6ee){_0x34d9ce=_0x1fa6ee;_0x445516=0xc8;}else{_0x445516=0xce;}_0x125d90['status'](_0x445516);return _0x125d90[_0xea10('0x1b')](_0xea10('0x1c'),_0x53b23c+'-'+_0x34d9ce+'/'+_0x1fa6ee)[_0xea10('0x1d')](_0x50c428);}return null;};}function patchUpdates(_0x1262ab){return function(_0x473f52){try{jsonpatch[_0xea10('0x1e')](_0x473f52,_0x1262ab,!![]);}catch(_0x3a7cd2){return BPromise['reject'](_0x3a7cd2);}return _0x473f52[_0xea10('0x1f')]();};}function saveUpdates(_0x1d4e52,_0x53ce7c){return function(_0x365409){if(_0x365409){return _0x365409[_0xea10('0x20')](_0x1d4e52)['then'](function(_0x2a2516){return _0x2a2516;});}return null;};}function removeEntity(_0x4ad99f,_0xb13384){return function(_0x35baa7){if(_0x35baa7){return _0x35baa7[_0xea10('0x21')]()[_0xea10('0x22')](function(){_0x4ad99f[_0xea10('0x17')](0xcc)[_0xea10('0x18')]();});}};}function handleEntityNotFound(_0x52d9ba,_0x2b5efc){return function(_0x383c9f){if(!_0x383c9f){_0x52d9ba['sendStatus'](0x194);}return _0x383c9f;};}function handleError(_0x2d1ccc,_0x355d01){_0x355d01=_0x355d01||0x1f4;return function(_0x1f974f){logger[_0xea10('0x23')](_0x1f974f[_0xea10('0x24')]);if(_0x1f974f[_0xea10('0x25')]){delete _0x1f974f['name'];}_0x2d1ccc['status'](_0x355d01)['send'](_0x1f974f);};}exports[_0xea10('0x26')]=function(_0x660ec3,_0x54465c){var _0x355dbb={},_0x141fa6={},_0x566cef={'count':0x0,'rows':[]};var _0x5a0fc0=_[_0xea10('0x27')](db[_0xea10('0x28')][_0xea10('0x29')],function(_0x4fb9d8){return{'name':_0x4fb9d8[_0xea10('0x2a')],'type':_0x4fb9d8['type']['key']};});_0x141fa6['model']=_['map'](_0x5a0fc0,_0xea10('0x25'));_0x141fa6[_0xea10('0x2b')]=_[_0xea10('0x2c')](_0x660ec3[_0xea10('0x2b')]);_0x141fa6[_0xea10('0x2d')]=_['intersection'](_0x141fa6[_0xea10('0x2e')],_0x141fa6[_0xea10('0x2b')]);_0x355dbb[_0xea10('0x2f')]=_[_0xea10('0x30')](_0x141fa6[_0xea10('0x2e')],qs[_0xea10('0x31')](_0x660ec3['query'][_0xea10('0x31')]));_0x355dbb['attributes']=_0x355dbb['attributes'][_0xea10('0x32')]?_0x355dbb[_0xea10('0x2f')]:_0x141fa6[_0xea10('0x2e')];if(!_0x660ec3[_0xea10('0x2b')]['hasOwnProperty'](_0xea10('0x33'))){_0x355dbb['limit']=qs[_0xea10('0x1a')](_0x660ec3[_0xea10('0x2b')][_0xea10('0x1a')]);_0x355dbb[_0xea10('0x19')]=qs[_0xea10('0x19')](_0x660ec3['query'][_0xea10('0x19')]);}_0x355dbb[_0xea10('0x34')]=qs[_0xea10('0x35')](_0x660ec3[_0xea10('0x2b')][_0xea10('0x35')]);_0x355dbb[_0xea10('0x36')]=qs['filters'](_[_0xea10('0x37')](_0x660ec3[_0xea10('0x2b')],_0x141fa6[_0xea10('0x2d')]),_0x5a0fc0);if(_0x660ec3[_0xea10('0x2b')][_0xea10('0x38')]){_0x355dbb[_0xea10('0x36')]=_['merge'](_0x355dbb[_0xea10('0x36')],{'$or':_[_0xea10('0x27')](_0x5a0fc0,function(_0x4c2754){if(_0x4c2754[_0xea10('0x39')]!=='VIRTUAL'){var _0x3438f5={};_0x3438f5[_0x4c2754[_0xea10('0x25')]]={'$like':'%'+_0x660ec3[_0xea10('0x2b')]['filter']+'%'};return _0x3438f5;}})});}_0x355dbb=_[_0xea10('0x3a')]({},_0x355dbb,_0x660ec3[_0xea10('0x3b')]);var _0x5eb98d={'where':_0x355dbb[_0xea10('0x36')]};return db['SugarcrmField'][_0xea10('0x3c')](_0x5eb98d)['then'](function(_0x4720d4){_0x566cef[_0xea10('0x3c')]=_0x4720d4;if(_0x660ec3[_0xea10('0x2b')][_0xea10('0x3d')]){_0x355dbb[_0xea10('0x3e')]=[{'all':!![]}];}return db['SugarcrmField'][_0xea10('0x3f')](_0x355dbb);})[_0xea10('0x22')](function(_0x363a93){_0x566cef[_0xea10('0x40')]=_0x363a93;return _0x566cef;})[_0xea10('0x22')](respondWithFilteredResult(_0x54465c,_0x355dbb))['catch'](handleError(_0x54465c,null));};exports['show']=function(_0x3012ef,_0x156805){var _0x2c8e06={'raw':!![],'where':{'id':_0x3012ef[_0xea10('0x41')]['id']}},_0x219d6e={};_0x219d6e[_0xea10('0x2e')]=_[_0xea10('0x2c')](db[_0xea10('0x28')][_0xea10('0x29')]);_0x219d6e[_0xea10('0x2b')]=_[_0xea10('0x2c')](_0x3012ef[_0xea10('0x2b')]);_0x219d6e[_0xea10('0x2d')]=_['intersection'](_0x219d6e['model'],_0x219d6e[_0xea10('0x2b')]);_0x2c8e06[_0xea10('0x2f')]=_[_0xea10('0x30')](_0x219d6e[_0xea10('0x2e')],qs[_0xea10('0x31')](_0x3012ef[_0xea10('0x2b')]['fields']));_0x2c8e06['attributes']=_0x2c8e06['attributes'][_0xea10('0x32')]?_0x2c8e06['attributes']:_0x219d6e[_0xea10('0x2e')];if(_0x3012ef[_0xea10('0x2b')][_0xea10('0x3d')]){_0x2c8e06[_0xea10('0x3e')]=[{'all':!![]}];}_0x2c8e06=_[_0xea10('0x3a')]({},_0x2c8e06,_0x3012ef[_0xea10('0x3b')]);return db[_0xea10('0x28')]['find'](_0x2c8e06)[_0xea10('0x22')](handleEntityNotFound(_0x156805,null))['then'](respondWithResult(_0x156805,null))[_0xea10('0x42')](handleError(_0x156805,null));};exports[_0xea10('0x43')]=function(_0x1187e4,_0x72c926){return db['SugarcrmField'][_0xea10('0x43')](_0x1187e4[_0xea10('0x44')],{})['then'](respondWithResult(_0x72c926,0xc9))[_0xea10('0x42')](handleError(_0x72c926,null));};exports[_0xea10('0x20')]=function(_0x195273,_0x3c930d){if(_0x195273[_0xea10('0x44')]['id']){delete _0x195273[_0xea10('0x44')]['id'];}return db[_0xea10('0x28')]['find']({'where':{'id':_0x195273['params']['id']}})[_0xea10('0x22')](handleEntityNotFound(_0x3c930d,null))['then'](saveUpdates(_0x195273['body'],null))[_0xea10('0x22')](respondWithResult(_0x3c930d,null))[_0xea10('0x42')](handleError(_0x3c930d,null));};exports[_0xea10('0x21')]=function(_0x238203,_0x131ae7){return db[_0xea10('0x28')][_0xea10('0x45')]({'where':{'id':_0x238203['params']['id']}})['then'](handleEntityNotFound(_0x131ae7,null))['then'](removeEntity(_0x131ae7,null))[_0xea10('0x42')](handleError(_0x131ae7,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 5edb097..007755f 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 _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 +var _0xe403=['../../config/environment','define','SugarcrmField','sugarcrm_unique_index','idField','api','moment','bluebird','request-promise','rimraf'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xe403,0xff));var _0x3e40=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe403[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3e40('0x0'));var moment=require(_0x3e40('0x1'));var BPromise=require(_0x3e40('0x2'));var rp=require(_0x3e40('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e40('0x4'));var config=require(_0x3e40('0x5'));var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x49bfb8,_0x47c837){return _0x49bfb8[_0x3e40('0x6')](_0x3e40('0x7'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x3e40('0x8'),'fields':[_0x3e40('0x9'),'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 a2737d5..11ef36b 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 _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 +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x538a9f,_0x436b09){var _0x310d21=function(_0x56ba6d){while(--_0x56ba6d){_0x538a9f['push'](_0x538a9f['shift']());}};_0x310d21(++_0x436b09);}(_0xdb28,0x106));var _0x8db2=function(_0x5a6f98,_0x367587){_0x5a6f98=_0x5a6f98-0x0;var _0x3ccf76=_0xdb28[_0x5a6f98];return _0x3ccf76;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 2baa223..34feb9b 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 _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 +var _0x9a5d=['delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x9a5d,0x1f0));var _0xd9a5=function(_0x56db0a,_0x142c9a){_0x56db0a=_0x56db0a-0x0;var _0x1702a1=_0x9a5d[_0x56db0a];return _0x1702a1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd9a5('0x0'));var timeout=require(_0xd9a5('0x1'));var express=require(_0xd9a5('0x2'));var router=express[_0xd9a5('0x3')]();var auth=require(_0xd9a5('0x4'));var interaction=require(_0xd9a5('0x5'));var config=require('../../config/environment');var controller=require('./intVtigerAccount.controller');router[_0xd9a5('0x6')]('/',auth[_0xd9a5('0x7')](),controller['index']);router[_0xd9a5('0x6')](_0xd9a5('0x8'),auth[_0xd9a5('0x7')](),controller['show']);router[_0xd9a5('0x6')](_0xd9a5('0x9'),auth[_0xd9a5('0x7')](),controller[_0xd9a5('0xa')]);router[_0xd9a5('0x6')](_0xd9a5('0xb'),auth[_0xd9a5('0x7')](),controller[_0xd9a5('0xc')]);router[_0xd9a5('0xd')]('/',auth[_0xd9a5('0x7')](),controller['create']);router[_0xd9a5('0xd')](_0xd9a5('0x9'),auth[_0xd9a5('0x7')](),controller[_0xd9a5('0xe')]);router[_0xd9a5('0xf')]('/:id',auth[_0xd9a5('0x7')](),controller[_0xd9a5('0x10')]);router[_0xd9a5('0x11')](_0xd9a5('0x8'),auth[_0xd9a5('0x7')](),controller[_0xd9a5('0x12')]);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 10e1d67..fd05561 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 _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 +var _0x0a89=['exports','STRING','HelpDesk','sequelize'];(function(_0x49fb86,_0xe7dcd9){var _0x535b41=function(_0x574546){while(--_0x574546){_0x49fb86['push'](_0x49fb86['shift']());}};_0x535b41(++_0xe7dcd9);}(_0x0a89,0xdb));var _0x90a8=function(_0x591e49,_0x355a7c){_0x591e49=_0x591e49-0x0;var _0x3c105d=_0x0a89[_0x591e49];return _0x3c105d;};'use strict';var Sequelize=require(_0x90a8('0x0'));module[_0x90a8('0x1')]={'name':{'type':Sequelize[_0x90a8('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x90a8('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x90a8('0x3')},'remoteUri':{'type':Sequelize[_0x90a8('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING']},'accessKey':{'type':Sequelize[_0x90a8('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 b448c94..e8c8b01 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 _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 +var _0x9025=['send','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','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~!@#$%^&-_=+[{]}.','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','set','Content-Range','apply','reject','save','destroy','end','stack','name','index','VtigerAccount','rawAttributes','key','map','query','filters','model','intersection','fields','attributes','length','nolimit','limit','offset','sort','filter','where','type','VIRTUAL','merge','options','then','includeAll','rows','show','params','keys','include','create','body','update','find','findOne','order','pick','hasOwnProperty','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','VtigerConfiguration','VtigerField','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','token','describe','sessionName','autogenerated','owner','remove','editable','false','label','startsWith','picklist','picklistValues','log','statusCode','getFields,\x20%s,\x20%s,\x20%s'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x9025,0x17c));var _0x5902=function(_0x551032,_0x17f7cd){_0x551032=_0x551032-0x0;var _0x4a8c99=_0x9025[_0x551032];return _0x4a8c99;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5902('0x0'));var jsonpatch=require(_0x5902('0x1'));var rp=require(_0x5902('0x2'));var moment=require('moment');var BPromise=require(_0x5902('0x3'));var Mustache=require(_0x5902('0x4'));var util=require(_0x5902('0x5'));var path=require(_0x5902('0x6'));var sox=require(_0x5902('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5902('0x8'));var jsforce=require(_0x5902('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x5902('0xa'));var querystring=require(_0x5902('0xb'));var Papa=require(_0x5902('0xc'));var Redis=require(_0x5902('0xd'));var authService=require(_0x5902('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x5902('0xf'));var hardwareService=require(_0x5902('0x10'));var logger=require(_0x5902('0x11'))(_0x5902('0x12'));var utils=require(_0x5902('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x5902('0x14'));var client=jayson['client'][_0x5902('0x15')]({'port':0x232a});function checkPasswordPattern(_0x399a74,_0x4836c8,_0x2c692a){if(_0x2c692a){var _0x5b4fcd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5b4fcd[_0x5902('0x16')](_0x4836c8)){return _0x399a74;}else{throw new db[(_0x5902('0x17'))][(_0x5902('0x18'))](_0x5902('0x19'));}}else{return _0x399a74;}}function respondWithRpcPromise(_0x78ccf4,_0x5e867d,_0x58cfb9,_0x1a3aee){return new BPromise(function(_0x1ec7c1,_0x2173f4){var _0x39151c=_0x1a3aee||client;return _0x39151c['request'](_0x78ccf4,_0x58cfb9)['then'](function(_0x5b02b0){logger[_0x5902('0x1a')](_0x5902('0x1b'),_0x5e867d,_0x5902('0x1c'));logger['debug'](_0x5902('0x1d'),_0x5e867d,_0x5902('0x1c'),JSON[_0x5902('0x1e')](_0x5b02b0));if(_0x5b02b0[_0x5902('0x1f')]){if(_0x5b02b0[_0x5902('0x1f')][_0x5902('0x20')]===0x1f4){logger[_0x5902('0x1f')](_0x5902('0x1b'),_0x5e867d,_0x5b02b0['error'][_0x5902('0x21')]);return _0x2173f4(_0x5b02b0[_0x5902('0x1f')][_0x5902('0x21')]);}logger[_0x5902('0x1f')](_0x5902('0x1b'),_0x5e867d,_0x5b02b0[_0x5902('0x1f')][_0x5902('0x21')]);return _0x1ec7c1(_0x5b02b0[_0x5902('0x1f')][_0x5902('0x21')]);}else{logger[_0x5902('0x1a')]('VtigerAccount,\x20%s,\x20%s',_0x5e867d,_0x5902('0x1c'));_0x1ec7c1(_0x5b02b0[_0x5902('0x22')]['message']);}})[_0x5902('0x23')](function(_0x11175d){logger[_0x5902('0x1f')](_0x5902('0x1b'),_0x5e867d,_0x11175d);_0x2173f4(_0x11175d);});});}function respondWithStatusCode(_0x5b403d,_0x347fab){_0x347fab=_0x347fab||0xcc;return function(_0x5d9caf){if(_0x5d9caf){return _0x5b403d[_0x5902('0x24')](_0x347fab);}return _0x5b403d[_0x5902('0x25')](_0x347fab)['end']();};}function respondWithResult(_0x13e0c3,_0x541069){_0x541069=_0x541069||0xc8;return function(_0x51ef56){if(_0x51ef56){return _0x13e0c3[_0x5902('0x25')](_0x541069)[_0x5902('0x26')](_0x51ef56);}};}function respondWithFilteredResult(_0x312cd5,_0x468871){return function(_0x26c9f8){if(_0x26c9f8){var _0xff4cbd=_0x26c9f8[_0x5902('0x27')],_0x497370=_0x468871['offset'],_0x137987=_0x468871['offset']+_0x468871['limit'],_0x1f7915;if(_0x137987>=_0xff4cbd){_0x137987=_0xff4cbd;_0x1f7915=0xc8;}else{_0x1f7915=0xce;}_0x312cd5[_0x5902('0x25')](_0x1f7915);return _0x312cd5[_0x5902('0x28')](_0x5902('0x29'),_0x497370+'-'+_0x137987+'/'+_0xff4cbd)['json'](_0x26c9f8);}return null;};}function patchUpdates(_0x346d1b){return function(_0x46782a){try{jsonpatch[_0x5902('0x2a')](_0x46782a,_0x346d1b,!![]);}catch(_0x48f3eb){return BPromise[_0x5902('0x2b')](_0x48f3eb);}return _0x46782a[_0x5902('0x2c')]();};}function saveUpdates(_0x420b64,_0x581d60){return function(_0x15d5d7){if(_0x15d5d7){return _0x15d5d7['update'](_0x420b64)['then'](function(_0x5c5872){return _0x5c5872;});}return null;};}function removeEntity(_0x511cad,_0x5921ad){return function(_0x533493){if(_0x533493){return _0x533493[_0x5902('0x2d')]()['then'](function(){_0x511cad[_0x5902('0x25')](0xcc)[_0x5902('0x2e')]();});}};}function handleEntityNotFound(_0x246d76,_0x31b5f5){return function(_0x363ecd){if(!_0x363ecd){_0x246d76[_0x5902('0x24')](0x194);}return _0x363ecd;};}function handleError(_0x2f91e1,_0x3d78fd){_0x3d78fd=_0x3d78fd||0x1f4;return function(_0x423adf){logger['error'](_0x423adf[_0x5902('0x2f')]);if(_0x423adf[_0x5902('0x30')]){delete _0x423adf[_0x5902('0x30')];}_0x2f91e1['status'](_0x3d78fd)['send'](_0x423adf);};}exports[_0x5902('0x31')]=function(_0x1f1d99,_0x5568e9){var _0x3a9dd0={},_0x26c612={},_0x6febf2={'count':0x0,'rows':[]};var _0x2ef48f=_['map'](db[_0x5902('0x32')][_0x5902('0x33')],function(_0x297212){return{'name':_0x297212['fieldName'],'type':_0x297212['type'][_0x5902('0x34')]};});_0x26c612['model']=_[_0x5902('0x35')](_0x2ef48f,_0x5902('0x30'));_0x26c612[_0x5902('0x36')]=_['keys'](_0x1f1d99[_0x5902('0x36')]);_0x26c612[_0x5902('0x37')]=_['intersection'](_0x26c612[_0x5902('0x38')],_0x26c612['query']);_0x3a9dd0['attributes']=_[_0x5902('0x39')](_0x26c612[_0x5902('0x38')],qs[_0x5902('0x3a')](_0x1f1d99[_0x5902('0x36')][_0x5902('0x3a')]));_0x3a9dd0[_0x5902('0x3b')]=_0x3a9dd0[_0x5902('0x3b')][_0x5902('0x3c')]?_0x3a9dd0[_0x5902('0x3b')]:_0x26c612[_0x5902('0x38')];if(!_0x1f1d99[_0x5902('0x36')]['hasOwnProperty'](_0x5902('0x3d'))){_0x3a9dd0[_0x5902('0x3e')]=qs[_0x5902('0x3e')](_0x1f1d99[_0x5902('0x36')][_0x5902('0x3e')]);_0x3a9dd0['offset']=qs[_0x5902('0x3f')](_0x1f1d99[_0x5902('0x36')][_0x5902('0x3f')]);}_0x3a9dd0['order']=qs[_0x5902('0x40')](_0x1f1d99[_0x5902('0x36')][_0x5902('0x40')]);_0x3a9dd0['where']=qs['filters'](_['pick'](_0x1f1d99[_0x5902('0x36')],_0x26c612['filters']),_0x2ef48f);if(_0x1f1d99[_0x5902('0x36')][_0x5902('0x41')]){_0x3a9dd0[_0x5902('0x42')]=_['merge'](_0x3a9dd0[_0x5902('0x42')],{'$or':_[_0x5902('0x35')](_0x2ef48f,function(_0x3cc414){if(_0x3cc414[_0x5902('0x43')]!==_0x5902('0x44')){var _0xc3f59e={};_0xc3f59e[_0x3cc414[_0x5902('0x30')]]={'$like':'%'+_0x1f1d99[_0x5902('0x36')][_0x5902('0x41')]+'%'};return _0xc3f59e;}})});}_0x3a9dd0=_[_0x5902('0x45')]({},_0x3a9dd0,_0x1f1d99[_0x5902('0x46')]);var _0x1de2ba={'where':_0x3a9dd0['where']};return db['VtigerAccount']['count'](_0x1de2ba)[_0x5902('0x47')](function(_0xeb6cd3){_0x6febf2['count']=_0xeb6cd3;if(_0x1f1d99[_0x5902('0x36')][_0x5902('0x48')]){_0x3a9dd0['include']=[{'all':!![]}];}return db[_0x5902('0x32')]['findAll'](_0x3a9dd0);})[_0x5902('0x47')](function(_0x1159b0){_0x6febf2[_0x5902('0x49')]=_0x1159b0;return _0x6febf2;})[_0x5902('0x47')](respondWithFilteredResult(_0x5568e9,_0x3a9dd0))[_0x5902('0x23')](handleError(_0x5568e9,null));};exports[_0x5902('0x4a')]=function(_0x96d719,_0x155009){var _0x2b98d9={'raw':![],'where':{'id':_0x96d719[_0x5902('0x4b')]['id']}},_0x196095={};_0x196095[_0x5902('0x38')]=_[_0x5902('0x4c')](db[_0x5902('0x32')][_0x5902('0x33')]);_0x196095[_0x5902('0x36')]=_[_0x5902('0x4c')](_0x96d719['query']);_0x196095[_0x5902('0x37')]=_['intersection'](_0x196095[_0x5902('0x38')],_0x196095[_0x5902('0x36')]);_0x2b98d9[_0x5902('0x3b')]=_['intersection'](_0x196095['model'],qs['fields'](_0x96d719['query']['fields']));_0x2b98d9['attributes']=_0x2b98d9['attributes'][_0x5902('0x3c')]?_0x2b98d9[_0x5902('0x3b')]:_0x196095[_0x5902('0x38')];if(_0x96d719[_0x5902('0x36')][_0x5902('0x48')]){_0x2b98d9[_0x5902('0x4d')]=[{'all':!![]}];}_0x2b98d9=_[_0x5902('0x45')]({},_0x2b98d9,_0x96d719[_0x5902('0x46')]);return db['VtigerAccount']['find'](_0x2b98d9)[_0x5902('0x47')](handleEntityNotFound(_0x155009,null))[_0x5902('0x47')](respondWithResult(_0x155009,null))['catch'](handleError(_0x155009,null));};exports['create']=function(_0x23cde7,_0x3c2570){return db[_0x5902('0x32')][_0x5902('0x4e')](_0x23cde7[_0x5902('0x4f')],{})[_0x5902('0x47')](respondWithResult(_0x3c2570,0xc9))['catch'](handleError(_0x3c2570,null));};exports[_0x5902('0x50')]=function(_0x3963b4,_0x4013a3){if(_0x3963b4[_0x5902('0x4f')]['id']){delete _0x3963b4[_0x5902('0x4f')]['id'];}return db[_0x5902('0x32')][_0x5902('0x51')]({'where':{'id':_0x3963b4[_0x5902('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4013a3,null))[_0x5902('0x47')](saveUpdates(_0x3963b4['body'],null))[_0x5902('0x47')](respondWithResult(_0x4013a3,null))['catch'](handleError(_0x4013a3,null));};exports[_0x5902('0x2d')]=function(_0x38ca04,_0xada237){return db[_0x5902('0x32')][_0x5902('0x51')]({'where':{'id':_0x38ca04['params']['id']}})[_0x5902('0x47')](handleEntityNotFound(_0xada237,null))[_0x5902('0x47')](removeEntity(_0xada237,null))[_0x5902('0x23')](handleError(_0xada237,null));};exports['getConfigurations']=function(_0xa6e182,_0x483f66,_0x9af726){var _0x56455e={};var _0x4f529b={};var _0x173a78;var _0x23f3e1;return db['VtigerAccount'][_0x5902('0x52')]({'where':{'id':_0xa6e182[_0x5902('0x4b')]['id']}})[_0x5902('0x47')](handleEntityNotFound(_0x483f66,null))[_0x5902('0x47')](function(_0x51fcb1){if(_0x51fcb1){_0x173a78=_0x51fcb1;_0x4f529b[_0x5902('0x38')]=_[_0x5902('0x4c')](db['VtigerConfiguration'][_0x5902('0x33')]);_0x4f529b[_0x5902('0x36')]=_[_0x5902('0x4c')](_0xa6e182[_0x5902('0x36')]);_0x4f529b['filters']=_['intersection'](_0x4f529b['model'],_0x4f529b[_0x5902('0x36')]);_0x56455e[_0x5902('0x3b')]=_[_0x5902('0x39')](_0x4f529b[_0x5902('0x38')],qs[_0x5902('0x3a')](_0xa6e182[_0x5902('0x36')][_0x5902('0x3a')]));_0x56455e[_0x5902('0x3b')]=_0x56455e['attributes'][_0x5902('0x3c')]?_0x56455e[_0x5902('0x3b')]:_0x4f529b['model'];_0x56455e[_0x5902('0x53')]=qs[_0x5902('0x40')](_0xa6e182['query']['sort']);_0x56455e[_0x5902('0x42')]=qs[_0x5902('0x37')](_[_0x5902('0x54')](_0xa6e182['query'],_0x4f529b[_0x5902('0x37')]));if(_0xa6e182[_0x5902('0x36')][_0x5902('0x41')]){_0x56455e['where']=_['merge'](_0x56455e['where'],{'$or':_[_0x5902('0x35')](_0x56455e[_0x5902('0x3b')],function(_0x509026){var _0x179a16={};_0x179a16[_0x509026]={'$like':'%'+_0xa6e182['query'][_0x5902('0x41')]+'%'};return _0x179a16;})});}_0x56455e=_[_0x5902('0x45')]({},_0x56455e,_0xa6e182['options']);return _0x173a78['getConfigurations'](_0x56455e);}})[_0x5902('0x47')](function(_0x191a74){if(_0x191a74){_0x23f3e1=_0x191a74[_0x5902('0x3c')];if(!_0xa6e182['query'][_0x5902('0x55')](_0x5902('0x3d'))){_0x56455e[_0x5902('0x3e')]=qs[_0x5902('0x3e')](_0xa6e182['query']['limit']);_0x56455e[_0x5902('0x3f')]=qs[_0x5902('0x3f')](_0xa6e182['query'][_0x5902('0x3f')]);}return _0x173a78[_0x5902('0x56')](_0x56455e);}})[_0x5902('0x47')](function(_0x5c147f){if(_0x5c147f){return _0x5c147f?{'count':_0x23f3e1,'rows':_0x5c147f}:null;}})[_0x5902('0x47')](respondWithResult(_0x483f66,null))[_0x5902('0x23')](handleError(_0x483f66,null));};exports[_0x5902('0x57')]=function(_0x591771,_0x38b666,_0x261d50){if(_0x591771[_0x5902('0x4f')]['id']){delete _0x591771['body']['id'];}return db[_0x5902('0x32')][_0x5902('0x52')]({'where':{'id':_0x591771[_0x5902('0x4b')]['id']}})[_0x5902('0x47')](handleEntityNotFound(_0x38b666,null))[_0x5902('0x47')](function(_0x28c1f3){if(_0x28c1f3){_0x591771['body'][_0x5902('0x58')]=_0x28c1f3['id'];_0x591771[_0x5902('0x4f')]['Subjects']=integrations[_0x5902('0x59')](_0x591771[_0x5902('0x4f')][_0x5902('0x5a')],_0x591771['body'][_0x5902('0x43')]);_0x591771[_0x5902('0x4f')][_0x5902('0x5b')]=integrations['getDescriptions'](_0x591771[_0x5902('0x4f')][_0x5902('0x5a')],_0x591771[_0x5902('0x4f')][_0x5902('0x43')]);return db[_0x5902('0x5c')][_0x5902('0x4e')](_0x591771[_0x5902('0x4f')],{'include':[{'model':db[_0x5902('0x5d')],'as':'Subjects'},{'model':db[_0x5902('0x5d')],'as':_0x5902('0x5b')}]});}return null;})[_0x5902('0x47')](respondWithResult(_0x38b666,null))['catch'](handleError(_0x38b666,null));};var md5=require('md5');exports[_0x5902('0x5e')]=function(_0x815ee1,_0x38053a,_0x13fa5c){var _0x2c0dad=null;var _0x1f83b2=null;var _0x28c944=null;var _0x26e383=null;var _0xb8a079='';return db['VtigerAccount'][_0x5902('0x52')]({'where':{'id':_0x815ee1[_0x5902('0x4b')]['id']},'attributes':['id','name',_0x5902('0x5f'),_0x5902('0x60'),_0x5902('0x61'),_0x5902('0x62'),_0x5902('0x63'),_0x5902('0x64')]})[_0x5902('0x47')](handleEntityNotFound(_0x38053a,null))[_0x5902('0x47')](function(_0x55a9cc){if(_0x55a9cc){_0x2c0dad=_0x55a9cc[_0x5902('0x5f')];_0x1f83b2=_0x55a9cc['accessKey'];_0x28c944=_0x55a9cc[_0x5902('0x61')];_0xb8a079=_0x55a9cc['remoteUri'];var _0x2308b3=_0xb8a079['slice'](-0x1);if(_0x2308b3==='/'){_0xb8a079=_0xb8a079['substring'](0x0,_0xb8a079[_0x5902('0x65')](_0x2308b3));}_0x26e383=util[_0x5902('0x66')](_0x5902('0x67'),_0xb8a079);var _0x525f2e={'method':_0x5902('0x68'),'uri':_0x26e383,'qs':{'operation':_0x5902('0x69'),'username':_0x55a9cc['username']},'json':!![]};return rp(_0x525f2e);}})[_0x5902('0x47')](function(_0x3c70d9){if(_0x3c70d9[_0x5902('0x6a')]){var _0x5bc1a4={'method':_0x5902('0x6b'),'uri':_0x26e383,'form':{'operation':_0x5902('0x6c'),'username':_0x2c0dad,'accessKey':md5(_0x3c70d9[_0x5902('0x22')][_0x5902('0x6d')]+_0x1f83b2)},'json':!![]};return rp(_0x5bc1a4);}})['then'](function(_0x283eda){if(_0x283eda[_0x5902('0x6a')]){var _0x4c3b21={'method':'GET','uri':_0x26e383,'qs':{'operation':_0x5902('0x6e'),'username':_0x2c0dad,'sessionName':_0x283eda['result'][_0x5902('0x6f')],'elementType':_0x28c944},'json':!![]};return rp(_0x4c3b21);}})['then'](function(_0x3a641f){if(_0x3a641f['success']){var _0x3966f6=[_0x5902('0x70'),'reference',_0x5902('0x71')];_[_0x5902('0x72')](_0x3a641f[_0x5902('0x22')][_0x5902('0x3a')],function(_0x1f7eb4){return _0x3966f6['includes'](_0x1f7eb4['type'][_0x5902('0x30')]);});_['remove'](_0x3a641f[_0x5902('0x22')]['fields'],function(_0x41dfdf){return _0x41dfdf[_0x5902('0x73')]===_0x5902('0x74');});return{'count':_0x3a641f[_0x5902('0x22')]['fields']['length'],'rows':_[_0x5902('0x35')](_0x3a641f[_0x5902('0x22')][_0x5902('0x3a')],function(_0x25cf26){return{'id':_0x25cf26['name'],'name':_0x25cf26[_0x5902('0x75')],'custom':_[_0x5902('0x76')](_0x25cf26[_0x5902('0x30')],'cf_')?!![]:![],'options':_0x25cf26['type'][_0x5902('0x30')]===_0x5902('0x77')&&_0x25cf26[_0x5902('0x43')][_0x5902('0x78')][_0x5902('0x3c')]>0x0?_[_0x5902('0x35')](_0x25cf26[_0x5902('0x43')][_0x5902('0x78')],function(_0x1e9cda){return{'name':_0x1e9cda[_0x5902('0x75')],'value':_0x1e9cda['value']};}):[]};})};}})[_0x5902('0x47')](respondWithResult(_0x38053a,null))[_0x5902('0x23')](function(_0xe39c6c){console[_0x5902('0x79')]('vTiger\x20error:\x20'+_0xe39c6c);var _0x3dce81=_0x815ee1[_0x5902('0x36')][_0x5902('0x16')]?0x1f4:_0xe39c6c[_0x5902('0x7a')]||0x1f4;logger[_0x5902('0x1f')](_0x5902('0x7b'),'getFields',_0x3dce81,JSON['stringify'](_0xe39c6c));delete _0xe39c6c[_0x5902('0x30')];if(_0x3dce81===0x191){_0x3dce81=0x190;}_0x38053a[_0x5902('0x25')](_0x3dce81)[_0x5902('0x7c')](_0x815ee1[_0x5902('0x36')][_0x5902('0x16')]?{'message':_0x5902('0x7d'),'statusCode':_0xe39c6c[_0x5902('0x7a')]}:_0xe39c6c);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index a9b93b1..9ce36a2 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 _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 +var _0x8778=['moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','int_vtiger_accounts','../../config/logger'];(function(_0x2cb5b3,_0x591ac7){var _0xfa822e=function(_0x493658){while(--_0x493658){_0x2cb5b3['push'](_0x2cb5b3['shift']());}};_0xfa822e(++_0x591ac7);}(_0x8778,0x1a1));var _0x8877=function(_0x26f29f,_0x399888){_0x26f29f=_0x26f29f-0x0;var _0x3e64de=_0x8778[_0x26f29f];return _0x3e64de;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8877('0x0'))('api');var moment=require(_0x8877('0x1'));var BPromise=require(_0x8877('0x2'));var rp=require(_0x8877('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8877('0x4'));var config=require(_0x8877('0x5'));var attributes=require(_0x8877('0x6'));var integrations=require(_0x8877('0x7'));module[_0x8877('0x8')]=function(_0x502f60,_0x3d8e4b){return _0x502f60[_0x8877('0x9')]('VtigerAccount',attributes,{'tableName':_0x8877('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index e2d7f1a..8a81190 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 _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 +var _0x21c5=['request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetVtigerAccount','VtigerAccount','options','raw','attributes','limit','map','model','include','ShowVtigerAccount','find','where','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s'];(function(_0x435501,_0x44dbd0){var _0x4b6bcf=function(_0x1b0844){while(--_0x1b0844){_0x435501['push'](_0x435501['shift']());}};_0x4b6bcf(++_0x44dbd0);}(_0x21c5,0x172));var _0x521c=function(_0x2c0630,_0x18a3f7){_0x2c0630=_0x2c0630-0x0;var _0x4ca516=_0x21c5[_0x2c0630];return _0x4ca516;};'use strict';var _=require(_0x521c('0x0'));var util=require('util');var moment=require(_0x521c('0x1'));var BPromise=require(_0x521c('0x2'));var rs=require(_0x521c('0x3'));var fs=require('fs');var Redis=require(_0x521c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x521c('0x5'));var logger=require(_0x521c('0x6'))(_0x521c('0x7'));var config=require(_0x521c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x521c('0x9')][_0x521c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xcf55a2,_0x58957c,_0x124446){return new BPromise(function(_0x13b9ff,_0x178b86){return client[_0x521c('0xb')](_0xcf55a2,_0x124446)[_0x521c('0xc')](function(_0x41b7e8){logger[_0x521c('0xd')](_0x521c('0xe'),_0x58957c,_0x521c('0xf'));logger[_0x521c('0x10')](_0x521c('0x11'),_0x58957c,_0x521c('0xf'),JSON[_0x521c('0x12')](_0x41b7e8));if(_0x41b7e8[_0x521c('0x13')]){if(_0x41b7e8['error'][_0x521c('0x14')]===0x1f4){logger[_0x521c('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x58957c,_0x41b7e8[_0x521c('0x13')][_0x521c('0x15')]);return _0x178b86(_0x41b7e8[_0x521c('0x13')][_0x521c('0x15')]);}logger[_0x521c('0x13')](_0x521c('0xe'),_0x58957c,_0x41b7e8['error'][_0x521c('0x15')]);return _0x13b9ff(_0x41b7e8[_0x521c('0x13')][_0x521c('0x15')]);}else{logger[_0x521c('0xd')](_0x521c('0xe'),_0x58957c,_0x521c('0xf'));_0x13b9ff(_0x41b7e8['result'][_0x521c('0x15')]);}})['catch'](function(_0x82eee0){logger['error'](_0x521c('0xe'),_0x58957c,_0x82eee0);_0x178b86(_0x82eee0);});});}exports[_0x521c('0x16')]=function(_0x35bbf5){var _0x2e790b=this;return new Promise(function(_0x40e24f,_0x5a6453){return db[_0x521c('0x17')]['findAll']({'raw':_0x35bbf5['options']?_0x35bbf5[_0x521c('0x18')][_0x521c('0x19')]===undefined?!![]:![]:!![],'where':_0x35bbf5['options']?_0x35bbf5[_0x521c('0x18')]['where']||null:null,'attributes':_0x35bbf5[_0x521c('0x18')]?_0x35bbf5[_0x521c('0x18')][_0x521c('0x1a')]||null:null,'limit':_0x35bbf5[_0x521c('0x18')]?_0x35bbf5[_0x521c('0x18')][_0x521c('0x1b')]||null:null,'include':_0x35bbf5[_0x521c('0x18')]?_0x35bbf5[_0x521c('0x18')]['include']?_[_0x521c('0x1c')](_0x35bbf5[_0x521c('0x18')]['include'],function(_0x5ab282){return{'model':db[_0x5ab282[_0x521c('0x1d')]],'as':_0x5ab282['as'],'attributes':_0x5ab282['attributes'],'include':_0x5ab282[_0x521c('0x1e')]?_['map'](_0x5ab282[_0x521c('0x1e')],function(_0x45d6dd){return{'model':db[_0x45d6dd[_0x521c('0x1d')]],'as':_0x45d6dd['as'],'attributes':_0x45d6dd[_0x521c('0x1a')],'include':_0x45d6dd[_0x521c('0x1e')]?_[_0x521c('0x1c')](_0x45d6dd[_0x521c('0x1e')],function(_0x11d4e5){return{'model':db[_0x11d4e5[_0x521c('0x1d')]],'as':_0x11d4e5['as'],'attributes':_0x11d4e5[_0x521c('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1bf08c){logger['info'](_0x521c('0x16'),_0x35bbf5);logger[_0x521c('0x10')](_0x521c('0x16'),_0x35bbf5,JSON[_0x521c('0x12')](_0x1bf08c));_0x40e24f(_0x1bf08c);})['catch'](function(_0x5eb7fe){logger[_0x521c('0x13')]('GetVtigerAccount',_0x5eb7fe[_0x521c('0x15')],_0x35bbf5);_0x5a6453(_0x2e790b['error'](0x1f4,_0x5eb7fe[_0x521c('0x15')]));});});};exports[_0x521c('0x1f')]=function(_0x36f1ef){var _0x3c19f4=this;return new Promise(function(_0x3bb411,_0x22b7e2){return db[_0x521c('0x17')][_0x521c('0x20')]({'raw':_0x36f1ef[_0x521c('0x18')]?_0x36f1ef[_0x521c('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x36f1ef[_0x521c('0x18')]?_0x36f1ef[_0x521c('0x18')][_0x521c('0x21')]||null:null,'attributes':_0x36f1ef[_0x521c('0x18')]?_0x36f1ef[_0x521c('0x18')]['attributes']||null:null,'include':_0x36f1ef[_0x521c('0x18')]?_0x36f1ef['options']['include']?_[_0x521c('0x1c')](_0x36f1ef[_0x521c('0x18')]['include'],function(_0x291154){return{'model':db[_0x291154[_0x521c('0x1d')]],'as':_0x291154['as'],'attributes':_0x291154[_0x521c('0x1a')],'include':_0x291154[_0x521c('0x1e')]?_[_0x521c('0x1c')](_0x291154[_0x521c('0x1e')],function(_0x347666){return{'model':db[_0x347666[_0x521c('0x1d')]],'as':_0x347666['as'],'attributes':_0x347666[_0x521c('0x1a')],'include':_0x347666[_0x521c('0x1e')]?_['map'](_0x347666[_0x521c('0x1e')],function(_0x306775){return{'model':db[_0x306775['model']],'as':_0x306775['as'],'attributes':_0x306775[_0x521c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x521c('0xc')](function(_0x35c594){logger[_0x521c('0xd')](_0x521c('0x1f'),_0x36f1ef);logger[_0x521c('0x10')](_0x521c('0x1f'),_0x36f1ef,JSON[_0x521c('0x12')](_0x35c594));_0x3bb411(_0x35c594);})[_0x521c('0x22')](function(_0x37d6dd){logger[_0x521c('0x13')](_0x521c('0x1f'),_0x37d6dd[_0x521c('0x15')],_0x36f1ef);_0x22b7e2(_0x3c19f4['error'](0x1f4,_0x37d6dd['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 3fdfac9..ea34b39 100644 --- a/server/api/intVtigerConfiguration/index.js +++ b/server/api/intVtigerConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_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 +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(_0x526fa1,_0x972edc){var _0x3a4983=function(_0x4756eb){while(--_0x4756eb){_0x526fa1['push'](_0x526fa1['shift']());}};_0x3a4983(++_0x972edc);}(_0xb10b,0x12a));var _0xbb10=function(_0x16df8f,_0x3dbe15){_0x16df8f=_0x16df8f-0x0;var _0x56ffee=_0xb10b[_0x16df8f];return _0x56ffee;};'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 1200071..1594b95 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 _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 +var _0x1982=['exports','STRING','sequelize'];(function(_0x1ced6b,_0x50f476){var _0xeb19e3=function(_0x14c470){while(--_0x14c470){_0x1ced6b['push'](_0x1ced6b['shift']());}};_0xeb19e3(++_0x50f476);}(_0x1982,0x77));var _0x2198=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1982[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2198('0x0'));module[_0x2198('0x1')]={'name':{'type':Sequelize[_0x2198('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index d3588d3..90b1ada 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 _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 +var _0xb5b1=['query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','options','count','includeAll','include','rows','catch','params','find','create','body','getFields','findOne','VtigerField','nolimit','getSubjects','getDescriptions','html-pdf','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','model'];(function(_0x24f722,_0x28379b){var _0x43acf5=function(_0x6986d3){while(--_0x6986d3){_0x24f722['push'](_0x24f722['shift']());}};_0x43acf5(++_0x28379b);}(_0xb5b1,0xcb));var _0x1b5b=function(_0x1f90e0,_0x187800){_0x1f90e0=_0x1f90e0-0x0;var _0x3e2013=_0xb5b1[_0x1f90e0];return _0x3e2013;};'use strict';var pdf=require(_0x1b5b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1b5b('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1b5b('0x2'));var Mustache=require(_0x1b5b('0x3'));var util=require('util');var path=require('path');var sox=require(_0x1b5b('0x4'));var csv=require(_0x1b5b('0x5'));var ejs=require(_0x1b5b('0x6'));var fs=require('fs');var _=require(_0x1b5b('0x7'));var squel=require('squel');var crypto=require(_0x1b5b('0x8'));var jsforce=require(_0x1b5b('0x9'));var deskjs=require(_0x1b5b('0xa'));var toCsv=require(_0x1b5b('0x5'));var querystring=require(_0x1b5b('0xb'));var Papa=require(_0x1b5b('0xc'));var Redis=require(_0x1b5b('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x1b5b('0xe'));var as=require(_0x1b5b('0xf'));var hardwareService=require(_0x1b5b('0x10'));var logger=require(_0x1b5b('0x11'))('api');var utils=require(_0x1b5b('0x12'));var config=require(_0x1b5b('0x13'));var db=require(_0x1b5b('0x14'))['db'];var jayson=require(_0x1b5b('0x15'));var client=jayson[_0x1b5b('0x16')][_0x1b5b('0x17')]({'port':0x232a});function checkPasswordPattern(_0x592053,_0x1de84c,_0x484e83){if(_0x484e83){var _0x5e26dc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5e26dc[_0x1b5b('0x18')](_0x1de84c)){return _0x592053;}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 _0x592053;}}function respondWithRpcPromise(_0x1cbd35,_0x4ee7a1,_0x4ebb64,_0x246ba0){return new BPromise(function(_0x5e98c4,_0x12dcc9){var _0x3a421a=_0x246ba0||client;return _0x3a421a[_0x1b5b('0x19')](_0x1cbd35,_0x4ebb64)['then'](function(_0x3743f8){logger[_0x1b5b('0x1a')](_0x1b5b('0x1b'),_0x4ee7a1,_0x1b5b('0x1c'));logger['debug'](_0x1b5b('0x1d'),_0x4ee7a1,_0x1b5b('0x1c'),JSON[_0x1b5b('0x1e')](_0x3743f8));if(_0x3743f8['error']){if(_0x3743f8['error'][_0x1b5b('0x1f')]===0x1f4){logger[_0x1b5b('0x20')](_0x1b5b('0x1b'),_0x4ee7a1,_0x3743f8['error'][_0x1b5b('0x21')]);return _0x12dcc9(_0x3743f8[_0x1b5b('0x20')]['message']);}logger[_0x1b5b('0x20')](_0x1b5b('0x1b'),_0x4ee7a1,_0x3743f8[_0x1b5b('0x20')][_0x1b5b('0x21')]);return _0x5e98c4(_0x3743f8[_0x1b5b('0x20')]['message']);}else{logger[_0x1b5b('0x1a')](_0x1b5b('0x1b'),_0x4ee7a1,'request\x20sent');_0x5e98c4(_0x3743f8['result'][_0x1b5b('0x21')]);}})['catch'](function(_0x5df74e){logger['error'](_0x1b5b('0x1b'),_0x4ee7a1,_0x5df74e);_0x12dcc9(_0x5df74e);});});}function respondWithStatusCode(_0x19999a,_0x336511){_0x336511=_0x336511||0xcc;return function(_0x46dacd){if(_0x46dacd){return _0x19999a['sendStatus'](_0x336511);}return _0x19999a[_0x1b5b('0x22')](_0x336511)[_0x1b5b('0x23')]();};}function respondWithResult(_0x103db9,_0x3aa9e4){_0x3aa9e4=_0x3aa9e4||0xc8;return function(_0x24688e){if(_0x24688e){return _0x103db9[_0x1b5b('0x22')](_0x3aa9e4)[_0x1b5b('0x24')](_0x24688e);}};}function respondWithFilteredResult(_0x1b0822,_0x25dd40){return function(_0x5ec28f){if(_0x5ec28f){var _0x353d0d=_0x5ec28f['count'],_0x3db10f=_0x25dd40[_0x1b5b('0x25')],_0x11ce93=_0x25dd40[_0x1b5b('0x25')]+_0x25dd40['limit'],_0x1b70d6;if(_0x11ce93>=_0x353d0d){_0x11ce93=_0x353d0d;_0x1b70d6=0xc8;}else{_0x1b70d6=0xce;}_0x1b0822[_0x1b5b('0x22')](_0x1b70d6);return _0x1b0822[_0x1b5b('0x26')](_0x1b5b('0x27'),_0x3db10f+'-'+_0x11ce93+'/'+_0x353d0d)[_0x1b5b('0x24')](_0x5ec28f);}return null;};}function patchUpdates(_0x3cbbd6){return function(_0x8ba71e){try{jsonpatch[_0x1b5b('0x28')](_0x8ba71e,_0x3cbbd6,!![]);}catch(_0x29e44f){return BPromise[_0x1b5b('0x29')](_0x29e44f);}return _0x8ba71e[_0x1b5b('0x2a')]();};}function saveUpdates(_0x3b9759,_0x21111e){return function(_0x2ef8d7){if(_0x2ef8d7){return _0x2ef8d7[_0x1b5b('0x2b')](_0x3b9759)[_0x1b5b('0x2c')](function(_0x349edf){return _0x349edf;});}return null;};}function removeEntity(_0x2cafe0,_0x2a4bd8){return function(_0x52ff6d){if(_0x52ff6d){return _0x52ff6d['destroy']()[_0x1b5b('0x2c')](function(){_0x2cafe0['status'](0xcc)[_0x1b5b('0x23')]();});}};}function handleEntityNotFound(_0xe7cff9,_0x589d7a){return function(_0x2b28ba){if(!_0x2b28ba){_0xe7cff9[_0x1b5b('0x2d')](0x194);}return _0x2b28ba;};}function handleError(_0x17af1e,_0x1affa5){_0x1affa5=_0x1affa5||0x1f4;return function(_0x49cab4){logger['error'](_0x49cab4[_0x1b5b('0x2e')]);if(_0x49cab4[_0x1b5b('0x2f')]){delete _0x49cab4[_0x1b5b('0x2f')];}_0x17af1e['status'](_0x1affa5)[_0x1b5b('0x30')](_0x49cab4);};}exports[_0x1b5b('0x31')]=function(_0x5827de,_0x164472){var _0x30f232={},_0x5ee94a={},_0x82e596={'count':0x0,'rows':[]};var _0x114f86=_[_0x1b5b('0x32')](db[_0x1b5b('0x33')][_0x1b5b('0x34')],function(_0x246af9){return{'name':_0x246af9[_0x1b5b('0x35')],'type':_0x246af9['type']['key']};});_0x5ee94a[_0x1b5b('0x36')]=_[_0x1b5b('0x32')](_0x114f86,_0x1b5b('0x2f'));_0x5ee94a[_0x1b5b('0x37')]=_[_0x1b5b('0x38')](_0x5827de[_0x1b5b('0x37')]);_0x5ee94a['filters']=_[_0x1b5b('0x39')](_0x5ee94a[_0x1b5b('0x36')],_0x5ee94a[_0x1b5b('0x37')]);_0x30f232[_0x1b5b('0x3a')]=_[_0x1b5b('0x39')](_0x5ee94a[_0x1b5b('0x36')],qs[_0x1b5b('0x3b')](_0x5827de[_0x1b5b('0x37')][_0x1b5b('0x3b')]));_0x30f232[_0x1b5b('0x3a')]=_0x30f232['attributes'][_0x1b5b('0x3c')]?_0x30f232[_0x1b5b('0x3a')]:_0x5ee94a['model'];if(!_0x5827de[_0x1b5b('0x37')][_0x1b5b('0x3d')]('nolimit')){_0x30f232['limit']=qs['limit'](_0x5827de[_0x1b5b('0x37')][_0x1b5b('0x3e')]);_0x30f232['offset']=qs[_0x1b5b('0x25')](_0x5827de['query']['offset']);}_0x30f232[_0x1b5b('0x3f')]=qs[_0x1b5b('0x40')](_0x5827de[_0x1b5b('0x37')][_0x1b5b('0x40')]);_0x30f232[_0x1b5b('0x41')]=qs[_0x1b5b('0x42')](_[_0x1b5b('0x43')](_0x5827de[_0x1b5b('0x37')],_0x5ee94a[_0x1b5b('0x42')]),_0x114f86);if(_0x5827de['query'][_0x1b5b('0x44')]){_0x30f232[_0x1b5b('0x41')]=_[_0x1b5b('0x45')](_0x30f232[_0x1b5b('0x41')],{'$or':_[_0x1b5b('0x32')](_0x114f86,function(_0x309166){if(_0x309166['type']!=='VIRTUAL'){var _0x2d7734={};_0x2d7734[_0x309166[_0x1b5b('0x2f')]]={'$like':'%'+_0x5827de['query'][_0x1b5b('0x44')]+'%'};return _0x2d7734;}})});}_0x30f232=_[_0x1b5b('0x45')]({},_0x30f232,_0x5827de[_0x1b5b('0x46')]);var _0x1735c0={'where':_0x30f232[_0x1b5b('0x41')]};return db['VtigerConfiguration'][_0x1b5b('0x47')](_0x1735c0)['then'](function(_0x3a24eb){_0x82e596[_0x1b5b('0x47')]=_0x3a24eb;if(_0x5827de[_0x1b5b('0x37')][_0x1b5b('0x48')]){_0x30f232[_0x1b5b('0x49')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x30f232);})[_0x1b5b('0x2c')](function(_0xd74e4f){_0x82e596[_0x1b5b('0x4a')]=_0xd74e4f;return _0x82e596;})[_0x1b5b('0x2c')](respondWithFilteredResult(_0x164472,_0x30f232))[_0x1b5b('0x4b')](handleError(_0x164472,null));};exports['show']=function(_0x26445b,_0x334ce0){var _0x40e677={'raw':![],'where':{'id':_0x26445b[_0x1b5b('0x4c')]['id']}},_0x33d2e8={};_0x33d2e8[_0x1b5b('0x36')]=_[_0x1b5b('0x38')](db[_0x1b5b('0x33')][_0x1b5b('0x34')]);_0x33d2e8[_0x1b5b('0x37')]=_[_0x1b5b('0x38')](_0x26445b[_0x1b5b('0x37')]);_0x33d2e8[_0x1b5b('0x42')]=_[_0x1b5b('0x39')](_0x33d2e8[_0x1b5b('0x36')],_0x33d2e8[_0x1b5b('0x37')]);_0x40e677['attributes']=_[_0x1b5b('0x39')](_0x33d2e8[_0x1b5b('0x36')],qs[_0x1b5b('0x3b')](_0x26445b['query'][_0x1b5b('0x3b')]));_0x40e677['attributes']=_0x40e677[_0x1b5b('0x3a')][_0x1b5b('0x3c')]?_0x40e677['attributes']:_0x33d2e8[_0x1b5b('0x36')];if(_0x26445b[_0x1b5b('0x37')][_0x1b5b('0x48')]){_0x40e677[_0x1b5b('0x49')]=[{'all':!![]}];}_0x40e677=_[_0x1b5b('0x45')]({},_0x40e677,_0x26445b[_0x1b5b('0x46')]);return db['VtigerConfiguration'][_0x1b5b('0x4d')](_0x40e677)[_0x1b5b('0x2c')](handleEntityNotFound(_0x334ce0,null))[_0x1b5b('0x2c')](respondWithResult(_0x334ce0,null))['catch'](handleError(_0x334ce0,null));};exports[_0x1b5b('0x4e')]=function(_0x525281,_0x2e7262){return db[_0x1b5b('0x33')]['create'](_0x525281[_0x1b5b('0x4f')],{})[_0x1b5b('0x2c')](respondWithResult(_0x2e7262,0xc9))[_0x1b5b('0x4b')](handleError(_0x2e7262,null));};exports[_0x1b5b('0x2b')]=function(_0x24cc91,_0x259bdc){if(_0x24cc91[_0x1b5b('0x4f')]['id']){delete _0x24cc91['body']['id'];}return db[_0x1b5b('0x33')][_0x1b5b('0x4d')]({'where':{'id':_0x24cc91[_0x1b5b('0x4c')]['id']}})[_0x1b5b('0x2c')](handleEntityNotFound(_0x259bdc,null))[_0x1b5b('0x2c')](saveUpdates(_0x24cc91[_0x1b5b('0x4f')],null))['then'](respondWithResult(_0x259bdc,null))[_0x1b5b('0x4b')](handleError(_0x259bdc,null));};exports['destroy']=function(_0xee4d19,_0x4a7965){return db[_0x1b5b('0x33')][_0x1b5b('0x4d')]({'where':{'id':_0xee4d19[_0x1b5b('0x4c')]['id']}})[_0x1b5b('0x2c')](handleEntityNotFound(_0x4a7965,null))[_0x1b5b('0x2c')](removeEntity(_0x4a7965,null))[_0x1b5b('0x4b')](handleError(_0x4a7965,null));};exports[_0x1b5b('0x50')]=function(_0x4e7414,_0x543099,_0x1e2cad){var _0x59a4c4={};var _0x2b27f1={};var _0x432160;var _0x4f322c;return db['VtigerConfiguration'][_0x1b5b('0x51')]({'where':{'id':_0x4e7414[_0x1b5b('0x4c')]['id']}})[_0x1b5b('0x2c')](handleEntityNotFound(_0x543099,null))[_0x1b5b('0x2c')](function(_0x22023f){if(_0x22023f){_0x432160=_0x22023f;_0x2b27f1['model']=_[_0x1b5b('0x38')](db[_0x1b5b('0x52')][_0x1b5b('0x34')]);_0x2b27f1[_0x1b5b('0x37')]=_[_0x1b5b('0x38')](_0x4e7414[_0x1b5b('0x37')]);_0x2b27f1[_0x1b5b('0x42')]=_[_0x1b5b('0x39')](_0x2b27f1[_0x1b5b('0x36')],_0x2b27f1['query']);_0x59a4c4[_0x1b5b('0x3a')]=_[_0x1b5b('0x39')](_0x2b27f1[_0x1b5b('0x36')],qs['fields'](_0x4e7414[_0x1b5b('0x37')][_0x1b5b('0x3b')]));_0x59a4c4[_0x1b5b('0x3a')]=_0x59a4c4[_0x1b5b('0x3a')]['length']?_0x59a4c4[_0x1b5b('0x3a')]:_0x2b27f1[_0x1b5b('0x36')];_0x59a4c4[_0x1b5b('0x3f')]=qs['sort'](_0x4e7414[_0x1b5b('0x37')][_0x1b5b('0x40')]);_0x59a4c4['where']=qs['filters'](_[_0x1b5b('0x43')](_0x4e7414[_0x1b5b('0x37')],_0x2b27f1[_0x1b5b('0x42')]));if(_0x4e7414['query'][_0x1b5b('0x44')]){_0x59a4c4['where']=_[_0x1b5b('0x45')](_0x59a4c4[_0x1b5b('0x41')],{'$or':_[_0x1b5b('0x32')](_0x59a4c4['attributes'],function(_0x4a6709){var _0x13e167={};_0x13e167[_0x4a6709]={'$like':'%'+_0x4e7414[_0x1b5b('0x37')][_0x1b5b('0x44')]+'%'};return _0x13e167;})});}_0x59a4c4=_[_0x1b5b('0x45')]({},_0x59a4c4,_0x4e7414[_0x1b5b('0x46')]);return _0x432160[_0x1b5b('0x50')](_0x59a4c4);}})[_0x1b5b('0x2c')](function(_0x334fa2){if(_0x334fa2){_0x4f322c=_0x334fa2[_0x1b5b('0x3c')];if(!_0x4e7414[_0x1b5b('0x37')][_0x1b5b('0x3d')](_0x1b5b('0x53'))){_0x59a4c4[_0x1b5b('0x3e')]=qs[_0x1b5b('0x3e')](_0x4e7414['query'][_0x1b5b('0x3e')]);_0x59a4c4['offset']=qs['offset'](_0x4e7414['query']['offset']);}return _0x432160[_0x1b5b('0x50')](_0x59a4c4);}})['then'](function(_0x1e232f){if(_0x1e232f){return _0x1e232f?{'count':_0x4f322c,'rows':_0x1e232f}:null;}})[_0x1b5b('0x2c')](respondWithResult(_0x543099,null))['catch'](handleError(_0x543099,null));};exports[_0x1b5b('0x54')]=function(_0x398d8a,_0x25b36c,_0x1bb43e){var _0x3d7979={};var _0x14bd39={};var _0x193b05;var _0x42ab50;return db[_0x1b5b('0x33')][_0x1b5b('0x51')]({'where':{'id':_0x398d8a[_0x1b5b('0x4c')]['id']}})[_0x1b5b('0x2c')](handleEntityNotFound(_0x25b36c,null))[_0x1b5b('0x2c')](function(_0x4b2272){if(_0x4b2272){_0x193b05=_0x4b2272;_0x14bd39[_0x1b5b('0x36')]=_[_0x1b5b('0x38')](db[_0x1b5b('0x52')][_0x1b5b('0x34')]);_0x14bd39[_0x1b5b('0x37')]=_[_0x1b5b('0x38')](_0x398d8a[_0x1b5b('0x37')]);_0x14bd39[_0x1b5b('0x42')]=_[_0x1b5b('0x39')](_0x14bd39['model'],_0x14bd39[_0x1b5b('0x37')]);_0x3d7979[_0x1b5b('0x3a')]=_['intersection'](_0x14bd39[_0x1b5b('0x36')],qs[_0x1b5b('0x3b')](_0x398d8a[_0x1b5b('0x37')][_0x1b5b('0x3b')]));_0x3d7979['attributes']=_0x3d7979['attributes']['length']?_0x3d7979['attributes']:_0x14bd39[_0x1b5b('0x36')];_0x3d7979[_0x1b5b('0x3f')]=qs[_0x1b5b('0x40')](_0x398d8a[_0x1b5b('0x37')][_0x1b5b('0x40')]);_0x3d7979[_0x1b5b('0x41')]=qs[_0x1b5b('0x42')](_[_0x1b5b('0x43')](_0x398d8a[_0x1b5b('0x37')],_0x14bd39[_0x1b5b('0x42')]));if(_0x398d8a[_0x1b5b('0x37')][_0x1b5b('0x44')]){_0x3d7979[_0x1b5b('0x41')]=_['merge'](_0x3d7979[_0x1b5b('0x41')],{'$or':_[_0x1b5b('0x32')](_0x3d7979[_0x1b5b('0x3a')],function(_0x22af8c){var _0x3ce7cc={};_0x3ce7cc[_0x22af8c]={'$like':'%'+_0x398d8a[_0x1b5b('0x37')]['filter']+'%'};return _0x3ce7cc;})});}_0x3d7979=_[_0x1b5b('0x45')]({},_0x3d7979,_0x398d8a['options']);return _0x193b05[_0x1b5b('0x54')](_0x3d7979);}})[_0x1b5b('0x2c')](function(_0x46ea45){if(_0x46ea45){_0x42ab50=_0x46ea45[_0x1b5b('0x3c')];if(!_0x398d8a[_0x1b5b('0x37')][_0x1b5b('0x3d')](_0x1b5b('0x53'))){_0x3d7979[_0x1b5b('0x3e')]=qs[_0x1b5b('0x3e')](_0x398d8a[_0x1b5b('0x37')][_0x1b5b('0x3e')]);_0x3d7979['offset']=qs[_0x1b5b('0x25')](_0x398d8a[_0x1b5b('0x37')]['offset']);}return _0x193b05[_0x1b5b('0x54')](_0x3d7979);}})[_0x1b5b('0x2c')](function(_0x30fe7b){if(_0x30fe7b){return _0x30fe7b?{'count':_0x42ab50,'rows':_0x30fe7b}:null;}})['then'](respondWithResult(_0x25b36c,null))[_0x1b5b('0x4b')](handleError(_0x25b36c,null));};exports['getDescriptions']=function(_0x3c7a71,_0x33d44c,_0x44dad9){var _0xf584cc={};var _0x47a90f={};var _0x16a20d;var _0x2e64fb;return db[_0x1b5b('0x33')][_0x1b5b('0x51')]({'where':{'id':_0x3c7a71[_0x1b5b('0x4c')]['id']}})[_0x1b5b('0x2c')](handleEntityNotFound(_0x33d44c,null))[_0x1b5b('0x2c')](function(_0xb29267){if(_0xb29267){_0x16a20d=_0xb29267;_0x47a90f[_0x1b5b('0x36')]=_[_0x1b5b('0x38')](db['VtigerField'][_0x1b5b('0x34')]);_0x47a90f[_0x1b5b('0x37')]=_[_0x1b5b('0x38')](_0x3c7a71[_0x1b5b('0x37')]);_0x47a90f[_0x1b5b('0x42')]=_[_0x1b5b('0x39')](_0x47a90f[_0x1b5b('0x36')],_0x47a90f['query']);_0xf584cc['attributes']=_[_0x1b5b('0x39')](_0x47a90f['model'],qs[_0x1b5b('0x3b')](_0x3c7a71[_0x1b5b('0x37')][_0x1b5b('0x3b')]));_0xf584cc[_0x1b5b('0x3a')]=_0xf584cc['attributes'][_0x1b5b('0x3c')]?_0xf584cc[_0x1b5b('0x3a')]:_0x47a90f['model'];_0xf584cc[_0x1b5b('0x3f')]=qs[_0x1b5b('0x40')](_0x3c7a71[_0x1b5b('0x37')][_0x1b5b('0x40')]);_0xf584cc['where']=qs['filters'](_[_0x1b5b('0x43')](_0x3c7a71[_0x1b5b('0x37')],_0x47a90f['filters']));if(_0x3c7a71[_0x1b5b('0x37')]['filter']){_0xf584cc['where']=_[_0x1b5b('0x45')](_0xf584cc[_0x1b5b('0x41')],{'$or':_[_0x1b5b('0x32')](_0xf584cc[_0x1b5b('0x3a')],function(_0x3c8b42){var _0x47c7a4={};_0x47c7a4[_0x3c8b42]={'$like':'%'+_0x3c7a71[_0x1b5b('0x37')][_0x1b5b('0x44')]+'%'};return _0x47c7a4;})});}_0xf584cc=_['merge']({},_0xf584cc,_0x3c7a71[_0x1b5b('0x46')]);return _0x16a20d[_0x1b5b('0x55')](_0xf584cc);}})['then'](function(_0x39e82c){if(_0x39e82c){_0x2e64fb=_0x39e82c['length'];if(!_0x3c7a71['query'][_0x1b5b('0x3d')](_0x1b5b('0x53'))){_0xf584cc[_0x1b5b('0x3e')]=qs['limit'](_0x3c7a71[_0x1b5b('0x37')][_0x1b5b('0x3e')]);_0xf584cc[_0x1b5b('0x25')]=qs[_0x1b5b('0x25')](_0x3c7a71['query'][_0x1b5b('0x25')]);}return _0x16a20d[_0x1b5b('0x55')](_0xf584cc);}})['then'](function(_0x1cc6a7){if(_0x1cc6a7){return _0x1cc6a7?{'count':_0x2e64fb,'rows':_0x1cc6a7}:null;}})[_0x1b5b('0x2c')](respondWithResult(_0x33d44c,null))[_0x1b5b('0x4b')](handleError(_0x33d44c,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 57a1cc8..d95fd2d 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 _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 +var _0x3117=['path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','VtigerConfiguration','int_vtiger_configurations','util','api','moment','bluebird'];(function(_0x50d285,_0x8f2995){var _0x3cdc18=function(_0x3e7bb0){while(--_0x3e7bb0){_0x50d285['push'](_0x50d285['shift']());}};_0x3cdc18(++_0x8f2995);}(_0x3117,0x132));var _0x7311=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0x3117[_0x15ea09];return _0x3e9c78;};'use strict';var _=require('lodash');var util=require(_0x7311('0x0'));var logger=require('../../config/logger')(_0x7311('0x1'));var moment=require(_0x7311('0x2'));var BPromise=require(_0x7311('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7311('0x4'));var rimraf=require(_0x7311('0x5'));var config=require(_0x7311('0x6'));var attributes=require(_0x7311('0x7'));module['exports']=function(_0xc58e0f,_0x1210e6){return _0xc58e0f['define'](_0x7311('0x8'),attributes,{'tableName':_0x7311('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 8255e3e..c2d9712 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 _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 +var _0x7673=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x2034e2,_0x147430){var _0x3e7c6d=function(_0x789f76){while(--_0x789f76){_0x2034e2['push'](_0x2034e2['shift']());}};_0x3e7c6d(++_0x147430);}(_0x7673,0x13f));var _0x3767=function(_0x2162e0,_0xd18181){_0x2162e0=_0x2162e0-0x0;var _0x162d05=_0x7673[_0x2162e0];return _0x162d05;};'use strict';var _=require(_0x3767('0x0'));var util=require(_0x3767('0x1'));var moment=require('moment');var BPromise=require(_0x3767('0x2'));var rs=require(_0x3767('0x3'));var fs=require('fs');var Redis=require(_0x3767('0x4'));var db=require(_0x3767('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3767('0x6'))(_0x3767('0x7'));var config=require(_0x3767('0x8'));var jayson=require(_0x3767('0x9'));var client=jayson[_0x3767('0xa')][_0x3767('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a574d,_0x1af44d,_0x2a69aa){return new BPromise(function(_0x225105,_0x1255af){return client[_0x3767('0xc')](_0x2a574d,_0x2a69aa)['then'](function(_0x5613db){logger[_0x3767('0xd')](_0x3767('0xe'),_0x1af44d,_0x3767('0xf'));logger['debug'](_0x3767('0x10'),_0x1af44d,_0x3767('0xf'),JSON[_0x3767('0x11')](_0x5613db));if(_0x5613db['error']){if(_0x5613db[_0x3767('0x12')][_0x3767('0x13')]===0x1f4){logger[_0x3767('0x12')](_0x3767('0xe'),_0x1af44d,_0x5613db[_0x3767('0x12')][_0x3767('0x14')]);return _0x1255af(_0x5613db[_0x3767('0x12')][_0x3767('0x14')]);}logger[_0x3767('0x12')](_0x3767('0xe'),_0x1af44d,_0x5613db[_0x3767('0x12')][_0x3767('0x14')]);return _0x225105(_0x5613db[_0x3767('0x12')][_0x3767('0x14')]);}else{logger[_0x3767('0xd')](_0x3767('0xe'),_0x1af44d,_0x3767('0xf'));_0x225105(_0x5613db[_0x3767('0x15')][_0x3767('0x14')]);}})[_0x3767('0x16')](function(_0x557f39){logger[_0x3767('0x12')](_0x3767('0xe'),_0x1af44d,_0x557f39);_0x1255af(_0x557f39);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index ea05ff0..5b90de8 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 _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 +var _0x3270=['isAuthenticated','index','/:id','post','create','put','delete','destroy','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get'];(function(_0x292037,_0x3fbd07){var _0x4e3bff=function(_0x43e77e){while(--_0x43e77e){_0x292037['push'](_0x292037['shift']());}};_0x4e3bff(++_0x3fbd07);}(_0x3270,0x188));var _0x0327=function(_0x5519a9,_0x1c5147){_0x5519a9=_0x5519a9-0x0;var _0x32f2cc=_0x3270[_0x5519a9];return _0x32f2cc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0327('0x0'));var timeout=require(_0x0327('0x1'));var express=require(_0x0327('0x2'));var router=express[_0x0327('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0327('0x4'));var config=require(_0x0327('0x5'));var controller=require(_0x0327('0x6'));router[_0x0327('0x7')]('/',auth[_0x0327('0x8')](),controller[_0x0327('0x9')]);router[_0x0327('0x7')](_0x0327('0xa'),auth[_0x0327('0x8')](),controller['show']);router[_0x0327('0xb')]('/',auth[_0x0327('0x8')](),controller[_0x0327('0xc')]);router[_0x0327('0xd')](_0x0327('0xa'),auth[_0x0327('0x8')](),controller['update']);router[_0x0327('0xe')](_0x0327('0xa'),auth[_0x0327('0x8')](),controller[_0x0327('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 4624ee4..917d508 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 _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 +var _0x872a=['sequelize','exports','ENUM','string','STRING','variable','customVariable','BOOLEAN'];(function(_0x3dae18,_0x90036c){var _0x294ba1=function(_0x4b555b){while(--_0x4b555b){_0x3dae18['push'](_0x3dae18['shift']());}};_0x294ba1(++_0x90036c);}(_0x872a,0x100));var _0xa872=function(_0x3feded,_0x3307f0){_0x3feded=_0x3feded-0x0;var _0x472635=_0x872a[_0x3feded];return _0x472635;};'use strict';var Sequelize=require(_0xa872('0x0'));module[_0xa872('0x1')]={'type':{'type':Sequelize[_0xa872('0x2')](_0xa872('0x3'),'variable','customVariable','keyValue'),'defaultValue':_0xa872('0x3')},'content':{'type':Sequelize[_0xa872('0x4')]},'key':{'type':Sequelize[_0xa872('0x4')]},'keyType':{'type':Sequelize[_0xa872('0x2')](_0xa872('0x3'),_0xa872('0x5'),_0xa872('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa872('0x4')]},'nameField':{'type':Sequelize[_0xa872('0x4')]},'customField':{'type':Sequelize[_0xa872('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa872('0x4')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 9a2f1ff..517b7b1 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 _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 +var _0x3e9e=['desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','limit','set','save','update','then','destroy','end','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','offset','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','zip-dir','request-promise','bluebird','util','path','lodash','jsforce'];(function(_0x56a943,_0xf3808e){var _0x274632=function(_0x244a4c){while(--_0x244a4c){_0x56a943['push'](_0x56a943['shift']());}};_0x274632(++_0xf3808e);}(_0x3e9e,0x13d));var _0xe3e9=function(_0x25e242,_0x340537){_0x25e242=_0x25e242-0x0;var _0x356cff=_0x3e9e[_0x25e242];return _0x356cff;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe3e9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe3e9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe3e9('0x2'));var moment=require('moment');var BPromise=require(_0xe3e9('0x3'));var Mustache=require('mustache');var util=require(_0xe3e9('0x4'));var path=require(_0xe3e9('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe3e9('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe3e9('0x7'));var deskjs=require(_0xe3e9('0x8'));var toCsv=require(_0xe3e9('0x9'));var querystring=require(_0xe3e9('0xa'));var Papa=require(_0xe3e9('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe3e9('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3e9('0xd'));var logger=require('../../config/logger')(_0xe3e9('0xe'));var utils=require('../../config/utils');var config=require(_0xe3e9('0xf'));var db=require(_0xe3e9('0x10'))['db'];function respondWithStatusCode(_0x1f4af1,_0x2f0a87){_0x2f0a87=_0x2f0a87||0xcc;return function(_0x49becd){if(_0x49becd){return _0x1f4af1[_0xe3e9('0x11')](_0x2f0a87);}return _0x1f4af1[_0xe3e9('0x12')](_0x2f0a87)['end']();};}function respondWithResult(_0x480753,_0x151642){_0x151642=_0x151642||0xc8;return function(_0x17f3ad){if(_0x17f3ad){return _0x480753['status'](_0x151642)[_0xe3e9('0x13')](_0x17f3ad);}};}function respondWithFilteredResult(_0x21bc5c,_0x4d6f6c){return function(_0x268baa){if(_0x268baa){var _0x174cd5=_0x268baa[_0xe3e9('0x14')],_0x725e78=_0x4d6f6c['offset'],_0x474ff5=_0x4d6f6c['offset']+_0x4d6f6c[_0xe3e9('0x15')],_0x47b876;if(_0x474ff5>=_0x174cd5){_0x474ff5=_0x174cd5;_0x47b876=0xc8;}else{_0x47b876=0xce;}_0x21bc5c[_0xe3e9('0x12')](_0x47b876);return _0x21bc5c[_0xe3e9('0x16')]('Content-Range',_0x725e78+'-'+_0x474ff5+'/'+_0x174cd5)[_0xe3e9('0x13')](_0x268baa);}return null;};}function patchUpdates(_0x3436c6){return function(_0xd41842){try{jsonpatch['apply'](_0xd41842,_0x3436c6,!![]);}catch(_0xb72cfe){return BPromise['reject'](_0xb72cfe);}return _0xd41842[_0xe3e9('0x17')]();};}function saveUpdates(_0x488df4,_0x27c37e){return function(_0x340619){if(_0x340619){return _0x340619[_0xe3e9('0x18')](_0x488df4)[_0xe3e9('0x19')](function(_0x40de91){return _0x40de91;});}return null;};}function removeEntity(_0x1e0ba5,_0x1ee0b1){return function(_0x57543e){if(_0x57543e){return _0x57543e[_0xe3e9('0x1a')]()[_0xe3e9('0x19')](function(){_0x1e0ba5[_0xe3e9('0x12')](0xcc)[_0xe3e9('0x1b')]();});}};}function handleEntityNotFound(_0x456986,_0x12013c){return function(_0x5be66a){if(!_0x5be66a){_0x456986[_0xe3e9('0x11')](0x194);}return _0x5be66a;};}function handleError(_0x6c95fe,_0x190d19){_0x190d19=_0x190d19||0x1f4;return function(_0x514c52){logger[_0xe3e9('0x1c')](_0x514c52[_0xe3e9('0x1d')]);if(_0x514c52[_0xe3e9('0x1e')]){delete _0x514c52[_0xe3e9('0x1e')];}_0x6c95fe[_0xe3e9('0x12')](_0x190d19)[_0xe3e9('0x1f')](_0x514c52);};}exports[_0xe3e9('0x20')]=function(_0x4b2f80,_0xbb266){var _0x113369={},_0x281589={},_0x54fe24={'count':0x0,'rows':[]};var _0x599fdd=_[_0xe3e9('0x21')](db[_0xe3e9('0x22')][_0xe3e9('0x23')],function(_0x54741b){return{'name':_0x54741b[_0xe3e9('0x24')],'type':_0x54741b[_0xe3e9('0x25')]['key']};});_0x281589[_0xe3e9('0x26')]=_[_0xe3e9('0x21')](_0x599fdd,_0xe3e9('0x1e'));_0x281589[_0xe3e9('0x27')]=_[_0xe3e9('0x28')](_0x4b2f80[_0xe3e9('0x27')]);_0x281589[_0xe3e9('0x29')]=_[_0xe3e9('0x2a')](_0x281589['model'],_0x281589[_0xe3e9('0x27')]);_0x113369['attributes']=_['intersection'](_0x281589[_0xe3e9('0x26')],qs[_0xe3e9('0x2b')](_0x4b2f80['query'][_0xe3e9('0x2b')]));_0x113369[_0xe3e9('0x2c')]=_0x113369[_0xe3e9('0x2c')][_0xe3e9('0x2d')]?_0x113369[_0xe3e9('0x2c')]:_0x281589[_0xe3e9('0x26')];if(!_0x4b2f80[_0xe3e9('0x27')][_0xe3e9('0x2e')]('nolimit')){_0x113369[_0xe3e9('0x15')]=qs[_0xe3e9('0x15')](_0x4b2f80[_0xe3e9('0x27')][_0xe3e9('0x15')]);_0x113369[_0xe3e9('0x2f')]=qs[_0xe3e9('0x2f')](_0x4b2f80[_0xe3e9('0x27')][_0xe3e9('0x2f')]);}_0x113369['order']=qs[_0xe3e9('0x30')](_0x4b2f80[_0xe3e9('0x27')]['sort']);_0x113369[_0xe3e9('0x31')]=qs[_0xe3e9('0x29')](_[_0xe3e9('0x32')](_0x4b2f80['query'],_0x281589['filters']),_0x599fdd);if(_0x4b2f80[_0xe3e9('0x27')][_0xe3e9('0x33')]){_0x113369['where']=_[_0xe3e9('0x34')](_0x113369[_0xe3e9('0x31')],{'$or':_[_0xe3e9('0x21')](_0x599fdd,function(_0x27aca9){if(_0x27aca9[_0xe3e9('0x25')]!==_0xe3e9('0x35')){var _0x5f2150={};_0x5f2150[_0x27aca9[_0xe3e9('0x1e')]]={'$like':'%'+_0x4b2f80[_0xe3e9('0x27')][_0xe3e9('0x33')]+'%'};return _0x5f2150;}})});}_0x113369=_['merge']({},_0x113369,_0x4b2f80[_0xe3e9('0x36')]);var _0x2f1d60={'where':_0x113369[_0xe3e9('0x31')]};return db[_0xe3e9('0x22')][_0xe3e9('0x14')](_0x2f1d60)['then'](function(_0x2458c7){_0x54fe24[_0xe3e9('0x14')]=_0x2458c7;if(_0x4b2f80[_0xe3e9('0x27')][_0xe3e9('0x37')]){_0x113369[_0xe3e9('0x38')]=[{'all':!![]}];}return db[_0xe3e9('0x22')][_0xe3e9('0x39')](_0x113369);})['then'](function(_0x59b112){_0x54fe24[_0xe3e9('0x3a')]=_0x59b112;return _0x54fe24;})[_0xe3e9('0x19')](respondWithFilteredResult(_0xbb266,_0x113369))[_0xe3e9('0x3b')](handleError(_0xbb266,null));};exports[_0xe3e9('0x3c')]=function(_0x281701,_0x3e5830){var _0x2114a7={'raw':!![],'where':{'id':_0x281701[_0xe3e9('0x3d')]['id']}},_0x485207={};_0x485207[_0xe3e9('0x26')]=_[_0xe3e9('0x28')](db[_0xe3e9('0x22')][_0xe3e9('0x23')]);_0x485207[_0xe3e9('0x27')]=_[_0xe3e9('0x28')](_0x281701['query']);_0x485207[_0xe3e9('0x29')]=_[_0xe3e9('0x2a')](_0x485207['model'],_0x485207[_0xe3e9('0x27')]);_0x2114a7[_0xe3e9('0x2c')]=_['intersection'](_0x485207['model'],qs[_0xe3e9('0x2b')](_0x281701[_0xe3e9('0x27')]['fields']));_0x2114a7[_0xe3e9('0x2c')]=_0x2114a7[_0xe3e9('0x2c')]['length']?_0x2114a7['attributes']:_0x485207[_0xe3e9('0x26')];if(_0x281701[_0xe3e9('0x27')][_0xe3e9('0x37')]){_0x2114a7['include']=[{'all':!![]}];}_0x2114a7=_[_0xe3e9('0x34')]({},_0x2114a7,_0x281701[_0xe3e9('0x36')]);return db['VtigerField'][_0xe3e9('0x3e')](_0x2114a7)[_0xe3e9('0x19')](handleEntityNotFound(_0x3e5830,null))[_0xe3e9('0x19')](respondWithResult(_0x3e5830,null))['catch'](handleError(_0x3e5830,null));};exports[_0xe3e9('0x3f')]=function(_0x2917ef,_0x3e0208){return db[_0xe3e9('0x22')][_0xe3e9('0x3f')](_0x2917ef[_0xe3e9('0x40')],{})[_0xe3e9('0x19')](respondWithResult(_0x3e0208,0xc9))[_0xe3e9('0x3b')](handleError(_0x3e0208,null));};exports[_0xe3e9('0x18')]=function(_0x2d11e2,_0xd9cca2){if(_0x2d11e2[_0xe3e9('0x40')]['id']){delete _0x2d11e2[_0xe3e9('0x40')]['id'];}return db[_0xe3e9('0x22')][_0xe3e9('0x3e')]({'where':{'id':_0x2d11e2[_0xe3e9('0x3d')]['id']}})['then'](handleEntityNotFound(_0xd9cca2,null))[_0xe3e9('0x19')](saveUpdates(_0x2d11e2['body'],null))[_0xe3e9('0x19')](respondWithResult(_0xd9cca2,null))[_0xe3e9('0x3b')](handleError(_0xd9cca2,null));};exports[_0xe3e9('0x1a')]=function(_0x3dbf0a,_0x542ae2){return db[_0xe3e9('0x22')]['find']({'where':{'id':_0x3dbf0a[_0xe3e9('0x3d')]['id']}})[_0xe3e9('0x19')](handleEntityNotFound(_0x542ae2,null))[_0xe3e9('0x19')](removeEntity(_0x542ae2,null))[_0xe3e9('0x3b')](handleError(_0x542ae2,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 02ce50e..33450e2 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 _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 +var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x344ffb,_0x2ec6ce){var _0x51e806=function(_0x4328e7){while(--_0x4328e7){_0x344ffb['push'](_0x344ffb['shift']());}};_0x51e806(++_0x2ec6ce);}(_0x7a54,0x106));var _0x47a5=function(_0x470239,_0xb3b15b){_0x470239=_0x470239-0x0;var _0x57c987=_0x7a54[_0x470239];return _0x57c987;};'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 diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 67adc59..d8266b0 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 _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 +var _0xcac2=['VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/environment','jayson/promise','client','http','request','info','debug'];(function(_0x5ea743,_0x43c1d9){var _0xb77687=function(_0x488de4){while(--_0x488de4){_0x5ea743['push'](_0x5ea743['shift']());}};_0xb77687(++_0x43c1d9);}(_0xcac2,0x1e8));var _0x2cac=function(_0x6de7af,_0x20cfe7){_0x6de7af=_0x6de7af-0x0;var _0x13e2f6=_0xcac2[_0x6de7af];return _0x13e2f6;};'use strict';var _=require(_0x2cac('0x0'));var util=require(_0x2cac('0x1'));var moment=require(_0x2cac('0x2'));var BPromise=require('bluebird');var rs=require(_0x2cac('0x3'));var fs=require('fs');var Redis=require(_0x2cac('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2cac('0x5'));var jayson=require(_0x2cac('0x6'));var client=jayson[_0x2cac('0x7')][_0x2cac('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f996c,_0x703f11,_0x1920cf){return new BPromise(function(_0x56b4f9,_0x5df249){return client[_0x2cac('0x9')](_0x2f996c,_0x1920cf)['then'](function(_0x361260){logger[_0x2cac('0xa')]('VtigerField,\x20%s,\x20%s',_0x703f11,'request\x20sent');logger[_0x2cac('0xb')](_0x2cac('0xc'),_0x703f11,'request\x20sent',JSON[_0x2cac('0xd')](_0x361260));if(_0x361260['error']){if(_0x361260[_0x2cac('0xe')][_0x2cac('0xf')]===0x1f4){logger[_0x2cac('0xe')](_0x2cac('0x10'),_0x703f11,_0x361260[_0x2cac('0xe')]['message']);return _0x5df249(_0x361260[_0x2cac('0xe')][_0x2cac('0x11')]);}logger['error'](_0x2cac('0x10'),_0x703f11,_0x361260[_0x2cac('0xe')][_0x2cac('0x11')]);return _0x56b4f9(_0x361260['error'][_0x2cac('0x11')]);}else{logger[_0x2cac('0xa')](_0x2cac('0x10'),_0x703f11,'request\x20sent');_0x56b4f9(_0x361260[_0x2cac('0x12')][_0x2cac('0x11')]);}})[_0x2cac('0x13')](function(_0x4d4646){logger['error'](_0x2cac('0x10'),_0x703f11,_0x4d4646);_0x5df249(_0x4d4646);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 61d0104..84eccae 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 _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 +var _0xfbd5=['show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x64fb9b,_0x3b9d41){var _0x29c090=function(_0x4b2f4f){while(--_0x4b2f4f){_0x64fb9b['push'](_0x64fb9b['shift']());}};_0x29c090(++_0x3b9d41);}(_0xfbd5,0xcc));var _0x5fbd=function(_0x28da3a,_0x195b57){_0x28da3a=_0x28da3a-0x0;var _0x1c70b3=_0xfbd5[_0x28da3a];return _0x1c70b3;};'use strict';var multer=require('multer');var util=require(_0x5fbd('0x0'));var path=require(_0x5fbd('0x1'));var timeout=require(_0x5fbd('0x2'));var express=require(_0x5fbd('0x3'));var router=express[_0x5fbd('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x5fbd('0x5'));var config=require(_0x5fbd('0x6'));var controller=require(_0x5fbd('0x7'));router[_0x5fbd('0x8')]('/',auth[_0x5fbd('0x9')](),controller[_0x5fbd('0xa')]);router[_0x5fbd('0x8')](_0x5fbd('0xb'),auth[_0x5fbd('0x9')](),controller[_0x5fbd('0xc')]);router[_0x5fbd('0x8')](_0x5fbd('0xd'),auth[_0x5fbd('0x9')](),controller[_0x5fbd('0xe')]);router[_0x5fbd('0x8')](_0x5fbd('0xf'),auth[_0x5fbd('0x9')](),controller[_0x5fbd('0x10')]);router[_0x5fbd('0x11')]('/',auth[_0x5fbd('0x9')](),controller[_0x5fbd('0x12')]);router[_0x5fbd('0x11')](_0x5fbd('0xd'),auth['isAuthenticated'](),controller[_0x5fbd('0x13')]);router[_0x5fbd('0x14')](_0x5fbd('0xb'),auth[_0x5fbd('0x9')](),controller[_0x5fbd('0x15')]);router[_0x5fbd('0x16')]('/:id',auth[_0x5fbd('0x9')](),controller[_0x5fbd('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 61b8fa5..791873b 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 _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 +var _0xb70d=['password','token','integrationTab','newTab','sequelize','STRING','username','remoteUri','ENUM'];(function(_0x1e58ad,_0x52ea33){var _0x37f189=function(_0x166943){while(--_0x166943){_0x1e58ad['push'](_0x1e58ad['shift']());}};_0x37f189(++_0x52ea33);}(_0xb70d,0x1c6));var _0xdb70=function(_0x17fdcf,_0xe2acee){_0x17fdcf=_0x17fdcf-0x0;var _0x938038=_0xb70d[_0x17fdcf];return _0x938038;};'use strict';var Sequelize=require(_0xdb70('0x0'));module['exports']={'name':{'type':Sequelize[_0xdb70('0x1')]},'description':{'type':Sequelize[_0xdb70('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xdb70('0x2')},'password':{'type':Sequelize[_0xdb70('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xdb70('0x3')},'authType':{'type':Sequelize[_0xdb70('0x4')](_0xdb70('0x5'),_0xdb70('0x6')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0xdb70('0x1')]},'type':{'type':Sequelize[_0xdb70('0x4')](_0xdb70('0x7'),_0xdb70('0x8')),'defaultValue':_0xdb70('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 088f79f..0e4b2e0 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 _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 +var _0xd12c=['ticket_fields','title','position','system_field_options','custom_field_options','test','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../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~!@#$%^&-_=+[{]}.','then','info','request\x20sent','debug','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','catch','status','end','json','offset','limit','set','Content-Range','apply','reject','save','destroy','sendStatus','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','create','body','find','findOne','getConfigurations','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','getFields','username','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','password','%s:%s','toString','base64','token','headers','Basic\x20%s','%s/token:%s','Unknown\x20authentication\x20type','subject','group','assignee','remove','includes'];(function(_0x2c3fd3,_0x5f30dd){var _0x2c1b00=function(_0x2354d7){while(--_0x2354d7){_0x2c3fd3['push'](_0x2c3fd3['shift']());}};_0x2c1b00(++_0x5f30dd);}(_0xd12c,0x113));var _0xcd12=function(_0x3b9aef,_0x3ebe27){_0x3b9aef=_0x3b9aef-0x0;var _0x56c2ce=_0xd12c[_0x3b9aef];return _0x56c2ce;};'use strict';var pdf=require(_0xcd12('0x0'));var emlformat=require(_0xcd12('0x1'));var rimraf=require(_0xcd12('0x2'));var zipdir=require(_0xcd12('0x3'));var jsonpatch=require(_0xcd12('0x4'));var rp=require(_0xcd12('0x5'));var moment=require(_0xcd12('0x6'));var BPromise=require(_0xcd12('0x7'));var Mustache=require(_0xcd12('0x8'));var util=require(_0xcd12('0x9'));var path=require(_0xcd12('0xa'));var sox=require(_0xcd12('0xb'));var csv=require('to-csv');var ejs=require(_0xcd12('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcd12('0xd'));var crypto=require(_0xcd12('0xe'));var jsforce=require(_0xcd12('0xf'));var deskjs=require(_0xcd12('0x10'));var toCsv=require(_0xcd12('0x11'));var querystring=require(_0xcd12('0x12'));var Papa=require(_0xcd12('0x13'));var Redis=require(_0xcd12('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xcd12('0x15'));var as=require(_0xcd12('0x16'));var hardwareService=require(_0xcd12('0x17'));var logger=require(_0xcd12('0x18'))(_0xcd12('0x19'));var utils=require(_0xcd12('0x1a'));var config=require(_0xcd12('0x1b'));var db=require('../../mysqldb')['db'];var integrations=require(_0xcd12('0x1c'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcd12('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x4c614b,_0x4f56ac,_0xacdf12){if(_0xacdf12){var _0x1ce32c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1ce32c['test'](_0x4f56ac)){return _0x4c614b;}else{throw new db[(_0xcd12('0x1e'))][(_0xcd12('0x1f'))](_0xcd12('0x20'));}}else{return _0x4c614b;}}function respondWithRpcPromise(_0xe106ed,_0x46fc16,_0x3e2695,_0x323298){return new BPromise(function(_0x31a0ff,_0x47318f){var _0x3d60fb=_0x323298||client;return _0x3d60fb['request'](_0xe106ed,_0x3e2695)[_0xcd12('0x21')](function(_0x2c663d){logger[_0xcd12('0x22')]('ZendeskAccount,\x20%s,\x20%s',_0x46fc16,_0xcd12('0x23'));logger[_0xcd12('0x24')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x46fc16,_0xcd12('0x23'),JSON[_0xcd12('0x25')](_0x2c663d));if(_0x2c663d[_0xcd12('0x26')]){if(_0x2c663d[_0xcd12('0x26')][_0xcd12('0x27')]===0x1f4){logger['error'](_0xcd12('0x28'),_0x46fc16,_0x2c663d[_0xcd12('0x26')][_0xcd12('0x29')]);return _0x47318f(_0x2c663d[_0xcd12('0x26')][_0xcd12('0x29')]);}logger[_0xcd12('0x26')](_0xcd12('0x28'),_0x46fc16,_0x2c663d[_0xcd12('0x26')][_0xcd12('0x29')]);return _0x31a0ff(_0x2c663d[_0xcd12('0x26')][_0xcd12('0x29')]);}else{logger[_0xcd12('0x22')](_0xcd12('0x28'),_0x46fc16,'request\x20sent');_0x31a0ff(_0x2c663d[_0xcd12('0x2a')]['message']);}})[_0xcd12('0x2b')](function(_0x31ddab){logger[_0xcd12('0x26')](_0xcd12('0x28'),_0x46fc16,_0x31ddab);_0x47318f(_0x31ddab);});});}function respondWithStatusCode(_0x4b9bb8,_0x529710){_0x529710=_0x529710||0xcc;return function(_0x13dc03){if(_0x13dc03){return _0x4b9bb8['sendStatus'](_0x529710);}return _0x4b9bb8[_0xcd12('0x2c')](_0x529710)[_0xcd12('0x2d')]();};}function respondWithResult(_0x14918e,_0x281d57){_0x281d57=_0x281d57||0xc8;return function(_0x2e4cc4){if(_0x2e4cc4){return _0x14918e[_0xcd12('0x2c')](_0x281d57)[_0xcd12('0x2e')](_0x2e4cc4);}};}function respondWithFilteredResult(_0x4e3de3,_0x380e6b){return function(_0x467a86){if(_0x467a86){var _0x56e645=_0x467a86['count'],_0x320eea=_0x380e6b[_0xcd12('0x2f')],_0x1ee59c=_0x380e6b[_0xcd12('0x2f')]+_0x380e6b[_0xcd12('0x30')],_0x203939;if(_0x1ee59c>=_0x56e645){_0x1ee59c=_0x56e645;_0x203939=0xc8;}else{_0x203939=0xce;}_0x4e3de3[_0xcd12('0x2c')](_0x203939);return _0x4e3de3[_0xcd12('0x31')](_0xcd12('0x32'),_0x320eea+'-'+_0x1ee59c+'/'+_0x56e645)[_0xcd12('0x2e')](_0x467a86);}return null;};}function patchUpdates(_0x36ec40){return function(_0x32c8da){try{jsonpatch[_0xcd12('0x33')](_0x32c8da,_0x36ec40,!![]);}catch(_0x3f14ec){return BPromise[_0xcd12('0x34')](_0x3f14ec);}return _0x32c8da[_0xcd12('0x35')]();};}function saveUpdates(_0x48fe76,_0x35249b){return function(_0x55dca7){if(_0x55dca7){return _0x55dca7['update'](_0x48fe76)['then'](function(_0x24759f){return _0x24759f;});}return null;};}function removeEntity(_0x44a96c,_0x5e8957){return function(_0x2750db){if(_0x2750db){return _0x2750db[_0xcd12('0x36')]()[_0xcd12('0x21')](function(){_0x44a96c[_0xcd12('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d94b0,_0x5af17f){return function(_0x2169ca){if(!_0x2169ca){_0x4d94b0[_0xcd12('0x37')](0x194);}return _0x2169ca;};}function handleError(_0x45d1a7,_0x1ae10c){_0x1ae10c=_0x1ae10c||0x1f4;return function(_0x42e0ce){logger[_0xcd12('0x26')](_0x42e0ce[_0xcd12('0x38')]);if(_0x42e0ce[_0xcd12('0x39')]){delete _0x42e0ce[_0xcd12('0x39')];}_0x45d1a7[_0xcd12('0x2c')](_0x1ae10c)[_0xcd12('0x3a')](_0x42e0ce);};}exports[_0xcd12('0x3b')]=function(_0x36f450,_0x5b4737){var _0xefd324={},_0x4f7a7a={},_0x461d0f={'count':0x0,'rows':[]};var _0x1919a6=_[_0xcd12('0x3c')](db[_0xcd12('0x3d')][_0xcd12('0x3e')],function(_0x113b66){return{'name':_0x113b66[_0xcd12('0x3f')],'type':_0x113b66[_0xcd12('0x40')][_0xcd12('0x41')]};});_0x4f7a7a[_0xcd12('0x42')]=_[_0xcd12('0x3c')](_0x1919a6,_0xcd12('0x39'));_0x4f7a7a[_0xcd12('0x43')]=_[_0xcd12('0x44')](_0x36f450['query']);_0x4f7a7a[_0xcd12('0x45')]=_[_0xcd12('0x46')](_0x4f7a7a[_0xcd12('0x42')],_0x4f7a7a['query']);_0xefd324[_0xcd12('0x47')]=_[_0xcd12('0x46')](_0x4f7a7a[_0xcd12('0x42')],qs[_0xcd12('0x48')](_0x36f450[_0xcd12('0x43')][_0xcd12('0x48')]));_0xefd324[_0xcd12('0x47')]=_0xefd324[_0xcd12('0x47')][_0xcd12('0x49')]?_0xefd324[_0xcd12('0x47')]:_0x4f7a7a[_0xcd12('0x42')];if(!_0x36f450[_0xcd12('0x43')][_0xcd12('0x4a')](_0xcd12('0x4b'))){_0xefd324['limit']=qs['limit'](_0x36f450[_0xcd12('0x43')]['limit']);_0xefd324[_0xcd12('0x2f')]=qs[_0xcd12('0x2f')](_0x36f450[_0xcd12('0x43')][_0xcd12('0x2f')]);}_0xefd324[_0xcd12('0x4c')]=qs[_0xcd12('0x4d')](_0x36f450[_0xcd12('0x43')]['sort']);_0xefd324[_0xcd12('0x4e')]=qs['filters'](_[_0xcd12('0x4f')](_0x36f450[_0xcd12('0x43')],_0x4f7a7a[_0xcd12('0x45')]),_0x1919a6);if(_0x36f450[_0xcd12('0x43')][_0xcd12('0x50')]){_0xefd324['where']=_[_0xcd12('0x51')](_0xefd324['where'],{'$or':_['map'](_0x1919a6,function(_0x56d6f7){if(_0x56d6f7[_0xcd12('0x40')]!==_0xcd12('0x52')){var _0xd50fba={};_0xd50fba[_0x56d6f7[_0xcd12('0x39')]]={'$like':'%'+_0x36f450[_0xcd12('0x43')][_0xcd12('0x50')]+'%'};return _0xd50fba;}})});}_0xefd324=_['merge']({},_0xefd324,_0x36f450[_0xcd12('0x53')]);var _0x299b53={'where':_0xefd324['where']};return db[_0xcd12('0x3d')][_0xcd12('0x54')](_0x299b53)[_0xcd12('0x21')](function(_0x3c9df8){_0x461d0f[_0xcd12('0x54')]=_0x3c9df8;if(_0x36f450[_0xcd12('0x43')][_0xcd12('0x55')]){_0xefd324[_0xcd12('0x56')]=[{'all':!![]}];}return db['ZendeskAccount'][_0xcd12('0x57')](_0xefd324);})['then'](function(_0x2319a7){_0x461d0f[_0xcd12('0x58')]=_0x2319a7;return _0x461d0f;})['then'](respondWithFilteredResult(_0x5b4737,_0xefd324))[_0xcd12('0x2b')](handleError(_0x5b4737,null));};exports[_0xcd12('0x59')]=function(_0x59804d,_0x3cded5){var _0x2d6c14={'raw':![],'where':{'id':_0x59804d[_0xcd12('0x5a')]['id']}},_0x13dc94={};_0x13dc94[_0xcd12('0x42')]=_[_0xcd12('0x44')](db[_0xcd12('0x3d')][_0xcd12('0x3e')]);_0x13dc94['query']=_[_0xcd12('0x44')](_0x59804d[_0xcd12('0x43')]);_0x13dc94[_0xcd12('0x45')]=_[_0xcd12('0x46')](_0x13dc94[_0xcd12('0x42')],_0x13dc94['query']);_0x2d6c14[_0xcd12('0x47')]=_[_0xcd12('0x46')](_0x13dc94[_0xcd12('0x42')],qs[_0xcd12('0x48')](_0x59804d[_0xcd12('0x43')][_0xcd12('0x48')]));_0x2d6c14[_0xcd12('0x47')]=_0x2d6c14[_0xcd12('0x47')]['length']?_0x2d6c14[_0xcd12('0x47')]:_0x13dc94[_0xcd12('0x42')];if(_0x59804d[_0xcd12('0x43')][_0xcd12('0x55')]){_0x2d6c14[_0xcd12('0x56')]=[{'all':!![]}];}_0x2d6c14=_[_0xcd12('0x51')]({},_0x2d6c14,_0x59804d[_0xcd12('0x53')]);return db[_0xcd12('0x3d')]['find'](_0x2d6c14)[_0xcd12('0x21')](handleEntityNotFound(_0x3cded5,null))[_0xcd12('0x21')](respondWithResult(_0x3cded5,null))[_0xcd12('0x2b')](handleError(_0x3cded5,null));};exports[_0xcd12('0x5b')]=function(_0x57f2a9,_0x176e2a){return db[_0xcd12('0x3d')][_0xcd12('0x5b')](_0x57f2a9[_0xcd12('0x5c')],{})[_0xcd12('0x21')](respondWithResult(_0x176e2a,0xc9))['catch'](handleError(_0x176e2a,null));};exports['update']=function(_0xca08f4,_0x37b1e0){if(_0xca08f4[_0xcd12('0x5c')]['id']){delete _0xca08f4[_0xcd12('0x5c')]['id'];}return db['ZendeskAccount'][_0xcd12('0x5d')]({'where':{'id':_0xca08f4['params']['id']}})['then'](handleEntityNotFound(_0x37b1e0,null))[_0xcd12('0x21')](saveUpdates(_0xca08f4[_0xcd12('0x5c')],null))[_0xcd12('0x21')](respondWithResult(_0x37b1e0,null))[_0xcd12('0x2b')](handleError(_0x37b1e0,null));};exports['destroy']=function(_0x4861e1,_0x1af03b){return db[_0xcd12('0x3d')]['find']({'where':{'id':_0x4861e1['params']['id']}})[_0xcd12('0x21')](handleEntityNotFound(_0x1af03b,null))['then'](removeEntity(_0x1af03b,null))[_0xcd12('0x2b')](handleError(_0x1af03b,null));};exports['getConfigurations']=function(_0x31ff93,_0x478e75,_0xee5099){var _0x5391aa={};var _0x203a44={};var _0x2df62e;var _0x1fc6d6;return db[_0xcd12('0x3d')][_0xcd12('0x5e')]({'where':{'id':_0x31ff93['params']['id']}})['then'](handleEntityNotFound(_0x478e75,null))[_0xcd12('0x21')](function(_0x2a6bc6){if(_0x2a6bc6){_0x2df62e=_0x2a6bc6;_0x203a44[_0xcd12('0x42')]=_[_0xcd12('0x44')](db['ZendeskConfiguration']['rawAttributes']);_0x203a44[_0xcd12('0x43')]=_['keys'](_0x31ff93[_0xcd12('0x43')]);_0x203a44['filters']=_[_0xcd12('0x46')](_0x203a44[_0xcd12('0x42')],_0x203a44[_0xcd12('0x43')]);_0x5391aa['attributes']=_[_0xcd12('0x46')](_0x203a44[_0xcd12('0x42')],qs[_0xcd12('0x48')](_0x31ff93[_0xcd12('0x43')][_0xcd12('0x48')]));_0x5391aa[_0xcd12('0x47')]=_0x5391aa[_0xcd12('0x47')][_0xcd12('0x49')]?_0x5391aa[_0xcd12('0x47')]:_0x203a44[_0xcd12('0x42')];_0x5391aa['order']=qs['sort'](_0x31ff93[_0xcd12('0x43')][_0xcd12('0x4d')]);_0x5391aa[_0xcd12('0x4e')]=qs[_0xcd12('0x45')](_[_0xcd12('0x4f')](_0x31ff93[_0xcd12('0x43')],_0x203a44['filters']));if(_0x31ff93[_0xcd12('0x43')][_0xcd12('0x50')]){_0x5391aa['where']=_[_0xcd12('0x51')](_0x5391aa[_0xcd12('0x4e')],{'$or':_[_0xcd12('0x3c')](_0x5391aa[_0xcd12('0x47')],function(_0x3a7835){var _0x3658c2={};_0x3658c2[_0x3a7835]={'$like':'%'+_0x31ff93[_0xcd12('0x43')]['filter']+'%'};return _0x3658c2;})});}_0x5391aa=_[_0xcd12('0x51')]({},_0x5391aa,_0x31ff93[_0xcd12('0x53')]);return _0x2df62e[_0xcd12('0x5f')](_0x5391aa);}})[_0xcd12('0x21')](function(_0x374b44){if(_0x374b44){_0x1fc6d6=_0x374b44['length'];if(!_0x31ff93[_0xcd12('0x43')][_0xcd12('0x4a')](_0xcd12('0x4b'))){_0x5391aa[_0xcd12('0x30')]=qs['limit'](_0x31ff93[_0xcd12('0x43')][_0xcd12('0x30')]);_0x5391aa['offset']=qs[_0xcd12('0x2f')](_0x31ff93['query'][_0xcd12('0x2f')]);}return _0x2df62e[_0xcd12('0x5f')](_0x5391aa);}})[_0xcd12('0x21')](function(_0x362e77){if(_0x362e77){return _0x362e77?{'count':_0x1fc6d6,'rows':_0x362e77}:null;}})[_0xcd12('0x21')](respondWithResult(_0x478e75,null))[_0xcd12('0x2b')](handleError(_0x478e75,null));};exports['addConfiguration']=function(_0x315b7b,_0x3c2a3a,_0x584936){if(_0x315b7b[_0xcd12('0x5c')]['id']){delete _0x315b7b[_0xcd12('0x5c')]['id'];}return db['ZendeskAccount'][_0xcd12('0x5e')]({'where':{'id':_0x315b7b['params']['id']}})['then'](handleEntityNotFound(_0x3c2a3a,null))['then'](function(_0x4f3540){if(_0x4f3540){_0x315b7b[_0xcd12('0x5c')]['AccountId']=_0x4f3540['id'];_0x315b7b[_0xcd12('0x5c')][_0xcd12('0x60')]=integrations[_0xcd12('0x61')](_0x315b7b[_0xcd12('0x5c')][_0xcd12('0x62')],_0x315b7b['body'][_0xcd12('0x40')]);_0x315b7b[_0xcd12('0x5c')][_0xcd12('0x63')]=integrations[_0xcd12('0x64')](_0x315b7b['body'][_0xcd12('0x62')],_0x315b7b['body'][_0xcd12('0x40')]);return db[_0xcd12('0x65')][_0xcd12('0x5b')](_0x315b7b[_0xcd12('0x5c')],{'include':[{'model':db['ZendeskField'],'as':_0xcd12('0x60')},{'model':db[_0xcd12('0x66')],'as':'Descriptions'}]});}return null;})[_0xcd12('0x21')](respondWithResult(_0x3c2a3a,null))[_0xcd12('0x2b')](handleError(_0x3c2a3a,null));};exports[_0xcd12('0x67')]=function(_0x11bbcb,_0x22507e,_0x5d972a){var _0x1040cc='';return db[_0xcd12('0x3d')]['findOne']({'where':{'id':_0x11bbcb[_0xcd12('0x5a')]['id']},'attributes':['id',_0xcd12('0x68'),'password','token',_0xcd12('0x69'),'remoteUri']})['then'](handleEntityNotFound(_0x22507e,null))[_0xcd12('0x21')](function(_0x5317e0){if(_0x5317e0){_0x1040cc=_0x5317e0[_0xcd12('0x6a')];var _0x12daad=_0x1040cc[_0xcd12('0x6b')](-0x1);if(_0x12daad==='/'){_0x1040cc=_0x1040cc[_0xcd12('0x6c')](0x0,_0x1040cc[_0xcd12('0x6d')](_0x12daad));}var _0x4f17c5={'method':_0xcd12('0x6e'),'uri':util[_0xcd12('0x6f')](_0xcd12('0x70'),_0x1040cc,'ticket_fields'),'json':!![]};switch(_0x5317e0[_0xcd12('0x69')]){case _0xcd12('0x71'):_0x4f17c5['headers']={'Authorization':util[_0xcd12('0x6f')]('Basic\x20%s',new Buffer(util[_0xcd12('0x6f')](_0xcd12('0x72'),_0x5317e0[_0xcd12('0x68')],_0x5317e0[_0xcd12('0x71')]))[_0xcd12('0x73')](_0xcd12('0x74')))};break;case _0xcd12('0x75'):_0x4f17c5[_0xcd12('0x76')]={'Authorization':util[_0xcd12('0x6f')](_0xcd12('0x77'),new Buffer(util[_0xcd12('0x6f')](_0xcd12('0x78'),_0x5317e0[_0xcd12('0x68')],_0x5317e0[_0xcd12('0x75')]))['toString'](_0xcd12('0x74')))};break;default:throw new db[(_0xcd12('0x1e'))][(_0xcd12('0x1f'))](_0xcd12('0x79'));}return rp(_0x4f17c5);}})[_0xcd12('0x21')](function(_0xb574de){if(_0xb574de){var _0x9b0cef=[_0xcd12('0x7a'),'description',_0xcd12('0x7b'),_0xcd12('0x7c')];_[_0xcd12('0x7d')](_0xb574de['ticket_fields'],function(_0x36b097){return _0x9b0cef[_0xcd12('0x7e')](_0x36b097[_0xcd12('0x40')]);});return{'count':_0xb574de[_0xcd12('0x7f')][_0xcd12('0x49')],'rows':_[_0xcd12('0x3c')](_0xb574de[_0xcd12('0x7f')],function(_0x43a61){return{'id':_0x43a61['id'],'name':_0x43a61['position']>0x7?_0x43a61[_0xcd12('0x80')]:_0x43a61['type'],'custom':_0x43a61[_0xcd12('0x81')]>0x7?!![]:![],'options':_0x43a61[_0xcd12('0x82')]?_0x43a61[_0xcd12('0x82')]:_0x43a61[_0xcd12('0x83')]?_0x43a61[_0xcd12('0x83')]:[]};})};}})[_0xcd12('0x21')](respondWithResult(_0x22507e,null))[_0xcd12('0x2b')](function(_0x2e11ac){var _0x22631e=_0x11bbcb['query'][_0xcd12('0x84')]?0x1f4:_0x2e11ac['statusCode']||0x1f4;logger[_0xcd12('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0xcd12('0x67'),_0x22631e,JSON[_0xcd12('0x25')](_0x2e11ac));delete _0x2e11ac[_0xcd12('0x39')];if(_0x22631e===0x191){_0x22631e=0x190;}_0x22507e['status'](_0x22631e)[_0xcd12('0x3a')](_0x11bbcb[_0xcd12('0x43')][_0xcd12('0x84')]?{'message':'Wrong\x20credentials','statusCode':_0x2e11ac[_0xcd12('0x85')]}:_0x2e11ac);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index fdd6d92..0c217c7 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 _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 +var _0x85aa=['request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x459395,_0x39372d){var _0x123a21=function(_0x3bf63e){while(--_0x3bf63e){_0x459395['push'](_0x459395['shift']());}};_0x123a21(++_0x39372d);}(_0x85aa,0xdb));var _0xa85a=function(_0x115a49,_0x57069c){_0x115a49=_0x115a49-0x0;var _0x32aaea=_0x85aa[_0x115a49];return _0x32aaea;};'use strict';var _=require(_0xa85a('0x0'));var util=require(_0xa85a('0x1'));var logger=require(_0xa85a('0x2'))(_0xa85a('0x3'));var moment=require(_0xa85a('0x4'));var BPromise=require('bluebird');var rp=require(_0xa85a('0x5'));var fs=require('fs');var path=require(_0xa85a('0x6'));var rimraf=require(_0xa85a('0x7'));var config=require(_0xa85a('0x8'));var attributes=require(_0xa85a('0x9'));var integrations=require(_0xa85a('0xa'));module[_0xa85a('0xb')]=function(_0x5486e8,_0x3de01d){return _0x5486e8['define'](_0xa85a('0xc'),attributes,{'tableName':_0xa85a('0xd'),'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 48f5aad..37df2d8 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 _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 +var _0x0713=['findAll','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount'];(function(_0x562ef9,_0x2d4efe){var _0x25b03d=function(_0x4af0b4){while(--_0x4af0b4){_0x562ef9['push'](_0x562ef9['shift']());}};_0x25b03d(++_0x2d4efe);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});}exports[_0x3071('0x18')]=function(_0x17dbda){var _0x1068d9=this;return new Promise(function(_0x108a83,_0x3acf0e){return db[_0x3071('0x19')][_0x3071('0x1a')]({'raw':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')]['where']||null:null,'attributes':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1d')]||null:null,'limit':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1e')]||null:null,'include':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x17dbda['options']['include'],function(_0x2ce48a){return{'model':db[_0x2ce48a[_0x3071('0x21')]],'as':_0x2ce48a['as'],'attributes':_0x2ce48a[_0x3071('0x1d')],'include':_0x2ce48a[_0x3071('0x1f')]?_[_0x3071('0x20')](_0x2ce48a[_0x3071('0x1f')],function(_0x7a4cb4){return{'model':db[_0x7a4cb4[_0x3071('0x21')]],'as':_0x7a4cb4['as'],'attributes':_0x7a4cb4[_0x3071('0x1d')],'include':_0x7a4cb4['include']?_[_0x3071('0x20')](_0x7a4cb4[_0x3071('0x1f')],function(_0x177138){return{'model':db[_0x177138['model']],'as':_0x177138['as'],'attributes':_0x177138[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x163604){logger[_0x3071('0xd')](_0x3071('0x18'),_0x17dbda);logger[_0x3071('0x10')](_0x3071('0x18'),_0x17dbda,JSON[_0x3071('0x12')](_0x163604));_0x108a83(_0x163604);})[_0x3071('0x17')](function(_0x292205){logger[_0x3071('0x13')]('GetZendeskAccount',_0x292205['message'],_0x17dbda);_0x3acf0e(_0x1068d9[_0x3071('0x13')](0x1f4,_0x292205[_0x3071('0x15')]));});});};exports[_0x3071('0x22')]=function(_0x40be95){var _0x3f6d90=this;return new Promise(function(_0x29538c,_0x32b6b1){return db[_0x3071('0x19')]['find']({'raw':_0x40be95['options']?_0x40be95['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x40be95[_0x3071('0x1b')]?_0x40be95['options'][_0x3071('0x23')]||null:null,'attributes':_0x40be95[_0x3071('0x1b')]?_0x40be95[_0x3071('0x1b')][_0x3071('0x1d')]||null:null,'include':_0x40be95['options']?_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')],function(_0x2068ce){return{'model':db[_0x2068ce[_0x3071('0x21')]],'as':_0x2068ce['as'],'attributes':_0x2068ce[_0x3071('0x1d')],'include':_0x2068ce['include']?_[_0x3071('0x20')](_0x2068ce['include'],function(_0x4fb1ec){return{'model':db[_0x4fb1ec[_0x3071('0x21')]],'as':_0x4fb1ec['as'],'attributes':_0x4fb1ec[_0x3071('0x1d')],'include':_0x4fb1ec['include']?_[_0x3071('0x20')](_0x4fb1ec[_0x3071('0x1f')],function(_0x265d76){return{'model':db[_0x265d76[_0x3071('0x21')]],'as':_0x265d76['as'],'attributes':_0x265d76[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x5610ab){logger[_0x3071('0xd')](_0x3071('0x22'),_0x40be95);logger['debug'](_0x3071('0x22'),_0x40be95,JSON['stringify'](_0x5610ab));_0x29538c(_0x5610ab);})[_0x3071('0x17')](function(_0x43133a){logger['error']('ShowZendeskAccount',_0x43133a[_0x3071('0x15')],_0x40be95);_0x32b6b1(_0x3f6d90[_0x3071('0x13')](0x1f4,_0x43133a[_0x3071('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index a785815..7df2e51 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 _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 +var _0x79c7=['../../components/interaction/service','../../config/environment','get','index','isAuthenticated','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','create','post','/:id/tags','setTags','/:id','delete','destroy','util','path','express','../../components/auth/service'];(function(_0x301f7c,_0x462f8b){var _0xc05c41=function(_0x20e539){while(--_0x20e539){_0x301f7c['push'](_0x301f7c['shift']());}};_0xc05c41(++_0x462f8b);}(_0x79c7,0x96));var _0x779c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x79c7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x779c('0x0'));var path=require(_0x779c('0x1'));var timeout=require('connect-timeout');var express=require(_0x779c('0x2'));var router=express['Router']();var auth=require(_0x779c('0x3'));var interaction=require(_0x779c('0x4'));var config=require(_0x779c('0x5'));var controller=require('./intZendeskConfiguration.controller');router[_0x779c('0x6')]('/',auth['isAuthenticated'](),controller[_0x779c('0x7')]);router[_0x779c('0x6')]('/:id',auth[_0x779c('0x8')](),controller['show']);router[_0x779c('0x6')](_0x779c('0x9'),auth[_0x779c('0x8')](),controller['getFields']);router[_0x779c('0x6')](_0x779c('0xa'),auth[_0x779c('0x8')](),controller[_0x779c('0xb')]);router['get'](_0x779c('0xc'),auth[_0x779c('0x8')](),controller[_0x779c('0xd')]);router[_0x779c('0x6')]('/:id/tags',auth['isAuthenticated'](),controller[_0x779c('0xe')]);router['post']('/',auth[_0x779c('0x8')](),controller[_0x779c('0xf')]);router[_0x779c('0x10')](_0x779c('0x11'),auth[_0x779c('0x8')](),controller[_0x779c('0x12')]);router['put'](_0x779c('0x13'),auth[_0x779c('0x8')](),controller['update']);router[_0x779c('0x14')]('/:id',auth[_0x779c('0x8')](),controller[_0x779c('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 84894d0..3075131 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 _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 +var _0xfc11=['exports','STRING'];(function(_0x2d344f,_0x25fa84){var _0x2e796b=function(_0x10466a){while(--_0x10466a){_0x2d344f['push'](_0x2d344f['shift']());}};_0x2e796b(++_0x25fa84);}(_0xfc11,0xc2));var _0x1fc1=function(_0x160457,_0x56169d){_0x160457=_0x160457-0x0;var _0x1522a3=_0xfc11[_0x160457];return _0x1522a3;};'use strict';var Sequelize=require('sequelize');module[_0x1fc1('0x0')]={'name':{'type':Sequelize[_0x1fc1('0x1')]},'description':{'type':Sequelize[_0x1fc1('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index ad66d09..b439412 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 _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 +var _0xe2c6=['http','test','Sequelize','ValidationError','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','set','reject','save','update','end','stack','name','map','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','ZendeskConfiguration','includeAll','include','findAll','rows','show','rawAttributes','find','create','body','params','destroy','getFields','findOne','ZendeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client'];(function(_0x4d06f2,_0x2d3e51){var _0x1e5262=function(_0x59611c){while(--_0x59611c){_0x4d06f2['push'](_0x4d06f2['shift']());}};_0x1e5262(++_0x2d3e51);}(_0xe2c6,0x1c8));var _0x6e2c=function(_0x8e4d38,_0xcda9cc){_0x8e4d38=_0x8e4d38-0x0;var _0x264499=_0xe2c6[_0x8e4d38];return _0x264499;};'use strict';var pdf=require(_0x6e2c('0x0'));var emlformat=require(_0x6e2c('0x1'));var rimraf=require(_0x6e2c('0x2'));var zipdir=require(_0x6e2c('0x3'));var jsonpatch=require(_0x6e2c('0x4'));var rp=require(_0x6e2c('0x5'));var moment=require(_0x6e2c('0x6'));var BPromise=require(_0x6e2c('0x7'));var Mustache=require(_0x6e2c('0x8'));var util=require(_0x6e2c('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0x6e2c('0xa'));var ejs=require(_0x6e2c('0xb'));var fs=require('fs');var _=require(_0x6e2c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6e2c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6e2c('0xa'));var querystring=require(_0x6e2c('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6e2c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6e2c('0x10'));var hardwareService=require(_0x6e2c('0x11'));var logger=require(_0x6e2c('0x12'))(_0x6e2c('0x13'));var utils=require(_0x6e2c('0x14'));var config=require('../../config/environment');var db=require(_0x6e2c('0x15'))['db'];var jayson=require(_0x6e2c('0x16'));var client=jayson[_0x6e2c('0x17')][_0x6e2c('0x18')]({'port':0x232a});function checkPasswordPattern(_0x19aded,_0x99e5b2,_0x33e7a6){if(_0x33e7a6){var _0x5116b0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5116b0[_0x6e2c('0x19')](_0x99e5b2)){return _0x19aded;}else{throw new db[(_0x6e2c('0x1a'))][(_0x6e2c('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 _0x19aded;}}function respondWithRpcPromise(_0x474a85,_0x316020,_0x2849af,_0x119544){return new BPromise(function(_0x503d2c,_0x58ac24){var _0x251ebc=_0x119544||client;return _0x251ebc[_0x6e2c('0x1c')](_0x474a85,_0x2849af)[_0x6e2c('0x1d')](function(_0xf67219){logger[_0x6e2c('0x1e')](_0x6e2c('0x1f'),_0x316020,_0x6e2c('0x20'));logger[_0x6e2c('0x21')](_0x6e2c('0x22'),_0x316020,'request\x20sent',JSON[_0x6e2c('0x23')](_0xf67219));if(_0xf67219[_0x6e2c('0x24')]){if(_0xf67219[_0x6e2c('0x24')][_0x6e2c('0x25')]===0x1f4){logger[_0x6e2c('0x24')](_0x6e2c('0x1f'),_0x316020,_0xf67219['error'][_0x6e2c('0x26')]);return _0x58ac24(_0xf67219[_0x6e2c('0x24')][_0x6e2c('0x26')]);}logger[_0x6e2c('0x24')](_0x6e2c('0x1f'),_0x316020,_0xf67219[_0x6e2c('0x24')][_0x6e2c('0x26')]);return _0x503d2c(_0xf67219[_0x6e2c('0x24')][_0x6e2c('0x26')]);}else{logger['info'](_0x6e2c('0x1f'),_0x316020,_0x6e2c('0x20'));_0x503d2c(_0xf67219[_0x6e2c('0x27')][_0x6e2c('0x26')]);}})[_0x6e2c('0x28')](function(_0x122b93){logger[_0x6e2c('0x24')](_0x6e2c('0x1f'),_0x316020,_0x122b93);_0x58ac24(_0x122b93);});});}function respondWithStatusCode(_0x2781b0,_0x5b5132){_0x5b5132=_0x5b5132||0xcc;return function(_0x569df3){if(_0x569df3){return _0x2781b0[_0x6e2c('0x29')](_0x5b5132);}return _0x2781b0[_0x6e2c('0x2a')](_0x5b5132)['end']();};}function respondWithResult(_0x50b647,_0x2b9252){_0x2b9252=_0x2b9252||0xc8;return function(_0x30253d){if(_0x30253d){return _0x50b647[_0x6e2c('0x2a')](_0x2b9252)[_0x6e2c('0x2b')](_0x30253d);}};}function respondWithFilteredResult(_0x5793d3,_0x5cee52){return function(_0x5fc525){if(_0x5fc525){var _0x8d2501=_0x5fc525[_0x6e2c('0x2c')],_0x34623a=_0x5cee52[_0x6e2c('0x2d')],_0x2b09db=_0x5cee52[_0x6e2c('0x2d')]+_0x5cee52['limit'],_0x4262b9;if(_0x2b09db>=_0x8d2501){_0x2b09db=_0x8d2501;_0x4262b9=0xc8;}else{_0x4262b9=0xce;}_0x5793d3[_0x6e2c('0x2a')](_0x4262b9);return _0x5793d3[_0x6e2c('0x2e')]('Content-Range',_0x34623a+'-'+_0x2b09db+'/'+_0x8d2501)[_0x6e2c('0x2b')](_0x5fc525);}return null;};}function patchUpdates(_0xf5fbca){return function(_0x19db14){try{jsonpatch['apply'](_0x19db14,_0xf5fbca,!![]);}catch(_0x393ce8){return BPromise[_0x6e2c('0x2f')](_0x393ce8);}return _0x19db14[_0x6e2c('0x30')]();};}function saveUpdates(_0x368231,_0x48e60b){return function(_0x4a9952){if(_0x4a9952){return _0x4a9952[_0x6e2c('0x31')](_0x368231)[_0x6e2c('0x1d')](function(_0x2871d1){return _0x2871d1;});}return null;};}function removeEntity(_0xcda5f5,_0x4513b3){return function(_0x2f1e5a){if(_0x2f1e5a){return _0x2f1e5a['destroy']()[_0x6e2c('0x1d')](function(){_0xcda5f5['status'](0xcc)[_0x6e2c('0x32')]();});}};}function handleEntityNotFound(_0x10fdbf,_0x12a1c3){return function(_0x3e62c9){if(!_0x3e62c9){_0x10fdbf[_0x6e2c('0x29')](0x194);}return _0x3e62c9;};}function handleError(_0x191078,_0x426abc){_0x426abc=_0x426abc||0x1f4;return function(_0x36c3b7){logger[_0x6e2c('0x24')](_0x36c3b7[_0x6e2c('0x33')]);if(_0x36c3b7[_0x6e2c('0x34')]){delete _0x36c3b7[_0x6e2c('0x34')];}_0x191078[_0x6e2c('0x2a')](_0x426abc)['send'](_0x36c3b7);};}exports['index']=function(_0x4a1b48,_0x276786){var _0x4d7a28={},_0x4d0471={},_0xfb2e23={'count':0x0,'rows':[]};var _0x281b51=_[_0x6e2c('0x35')](db['ZendeskConfiguration']['rawAttributes'],function(_0x2662a4){return{'name':_0x2662a4[_0x6e2c('0x36')],'type':_0x2662a4[_0x6e2c('0x37')][_0x6e2c('0x38')]};});_0x4d0471[_0x6e2c('0x39')]=_[_0x6e2c('0x35')](_0x281b51,_0x6e2c('0x34'));_0x4d0471['query']=_[_0x6e2c('0x3a')](_0x4a1b48[_0x6e2c('0x3b')]);_0x4d0471[_0x6e2c('0x3c')]=_[_0x6e2c('0x3d')](_0x4d0471[_0x6e2c('0x39')],_0x4d0471[_0x6e2c('0x3b')]);_0x4d7a28['attributes']=_['intersection'](_0x4d0471[_0x6e2c('0x39')],qs[_0x6e2c('0x3e')](_0x4a1b48[_0x6e2c('0x3b')][_0x6e2c('0x3e')]));_0x4d7a28[_0x6e2c('0x3f')]=_0x4d7a28[_0x6e2c('0x3f')][_0x6e2c('0x40')]?_0x4d7a28['attributes']:_0x4d0471[_0x6e2c('0x39')];if(!_0x4a1b48[_0x6e2c('0x3b')]['hasOwnProperty'](_0x6e2c('0x41'))){_0x4d7a28[_0x6e2c('0x42')]=qs[_0x6e2c('0x42')](_0x4a1b48['query'][_0x6e2c('0x42')]);_0x4d7a28[_0x6e2c('0x2d')]=qs[_0x6e2c('0x2d')](_0x4a1b48[_0x6e2c('0x3b')][_0x6e2c('0x2d')]);}_0x4d7a28[_0x6e2c('0x43')]=qs[_0x6e2c('0x44')](_0x4a1b48[_0x6e2c('0x3b')][_0x6e2c('0x44')]);_0x4d7a28[_0x6e2c('0x45')]=qs[_0x6e2c('0x3c')](_[_0x6e2c('0x46')](_0x4a1b48[_0x6e2c('0x3b')],_0x4d0471[_0x6e2c('0x3c')]),_0x281b51);if(_0x4a1b48[_0x6e2c('0x3b')][_0x6e2c('0x47')]){_0x4d7a28[_0x6e2c('0x45')]=_[_0x6e2c('0x48')](_0x4d7a28[_0x6e2c('0x45')],{'$or':_['map'](_0x281b51,function(_0x5660de){if(_0x5660de[_0x6e2c('0x37')]!==_0x6e2c('0x49')){var _0x20363c={};_0x20363c[_0x5660de['name']]={'$like':'%'+_0x4a1b48['query'][_0x6e2c('0x47')]+'%'};return _0x20363c;}})});}_0x4d7a28=_[_0x6e2c('0x48')]({},_0x4d7a28,_0x4a1b48[_0x6e2c('0x4a')]);var _0x51ac42={'where':_0x4d7a28[_0x6e2c('0x45')]};return db[_0x6e2c('0x4b')][_0x6e2c('0x2c')](_0x51ac42)[_0x6e2c('0x1d')](function(_0x17a6c8){_0xfb2e23[_0x6e2c('0x2c')]=_0x17a6c8;if(_0x4a1b48[_0x6e2c('0x3b')][_0x6e2c('0x4c')]){_0x4d7a28[_0x6e2c('0x4d')]=[{'all':!![]}];}return db[_0x6e2c('0x4b')][_0x6e2c('0x4e')](_0x4d7a28);})[_0x6e2c('0x1d')](function(_0x45f553){_0xfb2e23[_0x6e2c('0x4f')]=_0x45f553;return _0xfb2e23;})[_0x6e2c('0x1d')](respondWithFilteredResult(_0x276786,_0x4d7a28))[_0x6e2c('0x28')](handleError(_0x276786,null));};exports[_0x6e2c('0x50')]=function(_0x159d59,_0x37dab0){var _0x293934={'raw':![],'where':{'id':_0x159d59['params']['id']}},_0x2e1888={};_0x2e1888[_0x6e2c('0x39')]=_[_0x6e2c('0x3a')](db[_0x6e2c('0x4b')][_0x6e2c('0x51')]);_0x2e1888[_0x6e2c('0x3b')]=_[_0x6e2c('0x3a')](_0x159d59[_0x6e2c('0x3b')]);_0x2e1888[_0x6e2c('0x3c')]=_[_0x6e2c('0x3d')](_0x2e1888[_0x6e2c('0x39')],_0x2e1888[_0x6e2c('0x3b')]);_0x293934[_0x6e2c('0x3f')]=_[_0x6e2c('0x3d')](_0x2e1888[_0x6e2c('0x39')],qs['fields'](_0x159d59[_0x6e2c('0x3b')][_0x6e2c('0x3e')]));_0x293934[_0x6e2c('0x3f')]=_0x293934[_0x6e2c('0x3f')][_0x6e2c('0x40')]?_0x293934['attributes']:_0x2e1888[_0x6e2c('0x39')];if(_0x159d59['query'][_0x6e2c('0x4c')]){_0x293934[_0x6e2c('0x4d')]=[{'all':!![]}];}_0x293934=_[_0x6e2c('0x48')]({},_0x293934,_0x159d59[_0x6e2c('0x4a')]);return db[_0x6e2c('0x4b')][_0x6e2c('0x52')](_0x293934)[_0x6e2c('0x1d')](handleEntityNotFound(_0x37dab0,null))[_0x6e2c('0x1d')](respondWithResult(_0x37dab0,null))[_0x6e2c('0x28')](handleError(_0x37dab0,null));};exports[_0x6e2c('0x53')]=function(_0x1a5bf3,_0x5b1808){return db[_0x6e2c('0x4b')][_0x6e2c('0x53')](_0x1a5bf3[_0x6e2c('0x54')],{})[_0x6e2c('0x1d')](respondWithResult(_0x5b1808,0xc9))[_0x6e2c('0x28')](handleError(_0x5b1808,null));};exports['update']=function(_0x248db2,_0x11ae6d){if(_0x248db2[_0x6e2c('0x54')]['id']){delete _0x248db2[_0x6e2c('0x54')]['id'];}return db[_0x6e2c('0x4b')][_0x6e2c('0x52')]({'where':{'id':_0x248db2[_0x6e2c('0x55')]['id']}})[_0x6e2c('0x1d')](handleEntityNotFound(_0x11ae6d,null))['then'](saveUpdates(_0x248db2[_0x6e2c('0x54')],null))[_0x6e2c('0x1d')](respondWithResult(_0x11ae6d,null))[_0x6e2c('0x28')](handleError(_0x11ae6d,null));};exports[_0x6e2c('0x56')]=function(_0x1836a6,_0x3bb0e2){return db[_0x6e2c('0x4b')][_0x6e2c('0x52')]({'where':{'id':_0x1836a6[_0x6e2c('0x55')]['id']}})[_0x6e2c('0x1d')](handleEntityNotFound(_0x3bb0e2,null))[_0x6e2c('0x1d')](removeEntity(_0x3bb0e2,null))[_0x6e2c('0x28')](handleError(_0x3bb0e2,null));};exports[_0x6e2c('0x57')]=function(_0x626c29,_0x50e90a,_0x2c0c3b){var _0x1bcaef={};var _0x2e06a7={};var _0xe9f1db;var _0x59b52d;return db[_0x6e2c('0x4b')][_0x6e2c('0x58')]({'where':{'id':_0x626c29[_0x6e2c('0x55')]['id']}})[_0x6e2c('0x1d')](handleEntityNotFound(_0x50e90a,null))[_0x6e2c('0x1d')](function(_0x440453){if(_0x440453){_0xe9f1db=_0x440453;_0x2e06a7['model']=_['keys'](db[_0x6e2c('0x59')][_0x6e2c('0x51')]);_0x2e06a7['query']=_[_0x6e2c('0x3a')](_0x626c29['query']);_0x2e06a7[_0x6e2c('0x3c')]=_[_0x6e2c('0x3d')](_0x2e06a7['model'],_0x2e06a7[_0x6e2c('0x3b')]);_0x1bcaef[_0x6e2c('0x3f')]=_[_0x6e2c('0x3d')](_0x2e06a7[_0x6e2c('0x39')],qs[_0x6e2c('0x3e')](_0x626c29[_0x6e2c('0x3b')][_0x6e2c('0x3e')]));_0x1bcaef[_0x6e2c('0x3f')]=_0x1bcaef[_0x6e2c('0x3f')][_0x6e2c('0x40')]?_0x1bcaef[_0x6e2c('0x3f')]:_0x2e06a7[_0x6e2c('0x39')];_0x1bcaef['order']=qs[_0x6e2c('0x44')](_0x626c29[_0x6e2c('0x3b')][_0x6e2c('0x44')]);_0x1bcaef['where']=qs[_0x6e2c('0x3c')](_[_0x6e2c('0x46')](_0x626c29[_0x6e2c('0x3b')],_0x2e06a7[_0x6e2c('0x3c')]));if(_0x626c29[_0x6e2c('0x3b')]['filter']){_0x1bcaef[_0x6e2c('0x45')]=_[_0x6e2c('0x48')](_0x1bcaef[_0x6e2c('0x45')],{'$or':_[_0x6e2c('0x35')](_0x1bcaef[_0x6e2c('0x3f')],function(_0x3e4719){var _0x2b3995={};_0x2b3995[_0x3e4719]={'$like':'%'+_0x626c29['query']['filter']+'%'};return _0x2b3995;})});}_0x1bcaef=_[_0x6e2c('0x48')]({},_0x1bcaef,_0x626c29[_0x6e2c('0x4a')]);return _0xe9f1db[_0x6e2c('0x57')](_0x1bcaef);}})['then'](function(_0x7e65a7){if(_0x7e65a7){_0x59b52d=_0x7e65a7['length'];if(!_0x626c29['query'][_0x6e2c('0x5a')](_0x6e2c('0x41'))){_0x1bcaef[_0x6e2c('0x42')]=qs['limit'](_0x626c29[_0x6e2c('0x3b')][_0x6e2c('0x42')]);_0x1bcaef[_0x6e2c('0x2d')]=qs[_0x6e2c('0x2d')](_0x626c29['query'][_0x6e2c('0x2d')]);}return _0xe9f1db[_0x6e2c('0x57')](_0x1bcaef);}})[_0x6e2c('0x1d')](function(_0xbd3439){if(_0xbd3439){return _0xbd3439?{'count':_0x59b52d,'rows':_0xbd3439}:null;}})[_0x6e2c('0x1d')](respondWithResult(_0x50e90a,null))[_0x6e2c('0x28')](handleError(_0x50e90a,null));};exports[_0x6e2c('0x5b')]=function(_0x1fcbc9,_0x44994b,_0x54b3d2){var _0x131408={};var _0x301f14={};var _0x53d7f5;var _0x44403b;return db['ZendeskConfiguration'][_0x6e2c('0x58')]({'where':{'id':_0x1fcbc9['params']['id']}})[_0x6e2c('0x1d')](handleEntityNotFound(_0x44994b,null))['then'](function(_0x2a5aff){if(_0x2a5aff){_0x53d7f5=_0x2a5aff;_0x301f14['model']=_[_0x6e2c('0x3a')](db[_0x6e2c('0x59')][_0x6e2c('0x51')]);_0x301f14['query']=_['keys'](_0x1fcbc9[_0x6e2c('0x3b')]);_0x301f14[_0x6e2c('0x3c')]=_[_0x6e2c('0x3d')](_0x301f14[_0x6e2c('0x39')],_0x301f14[_0x6e2c('0x3b')]);_0x131408[_0x6e2c('0x3f')]=_[_0x6e2c('0x3d')](_0x301f14['model'],qs['fields'](_0x1fcbc9['query'][_0x6e2c('0x3e')]));_0x131408[_0x6e2c('0x3f')]=_0x131408[_0x6e2c('0x3f')][_0x6e2c('0x40')]?_0x131408[_0x6e2c('0x3f')]:_0x301f14[_0x6e2c('0x39')];_0x131408['order']=qs['sort'](_0x1fcbc9[_0x6e2c('0x3b')][_0x6e2c('0x44')]);_0x131408[_0x6e2c('0x45')]=qs[_0x6e2c('0x3c')](_[_0x6e2c('0x46')](_0x1fcbc9[_0x6e2c('0x3b')],_0x301f14[_0x6e2c('0x3c')]));if(_0x1fcbc9[_0x6e2c('0x3b')][_0x6e2c('0x47')]){_0x131408[_0x6e2c('0x45')]=_[_0x6e2c('0x48')](_0x131408['where'],{'$or':_[_0x6e2c('0x35')](_0x131408['attributes'],function(_0x1670c9){var _0x1ea2ff={};_0x1ea2ff[_0x1670c9]={'$like':'%'+_0x1fcbc9['query'][_0x6e2c('0x47')]+'%'};return _0x1ea2ff;})});}_0x131408=_[_0x6e2c('0x48')]({},_0x131408,_0x1fcbc9['options']);return _0x53d7f5[_0x6e2c('0x5b')](_0x131408);}})[_0x6e2c('0x1d')](function(_0x196360){if(_0x196360){_0x44403b=_0x196360[_0x6e2c('0x40')];if(!_0x1fcbc9[_0x6e2c('0x3b')][_0x6e2c('0x5a')](_0x6e2c('0x41'))){_0x131408['limit']=qs[_0x6e2c('0x42')](_0x1fcbc9[_0x6e2c('0x3b')][_0x6e2c('0x42')]);_0x131408[_0x6e2c('0x2d')]=qs[_0x6e2c('0x2d')](_0x1fcbc9[_0x6e2c('0x3b')][_0x6e2c('0x2d')]);}return _0x53d7f5[_0x6e2c('0x5b')](_0x131408);}})[_0x6e2c('0x1d')](function(_0x5daeb1){if(_0x5daeb1){return _0x5daeb1?{'count':_0x44403b,'rows':_0x5daeb1}:null;}})['then'](respondWithResult(_0x44994b,null))[_0x6e2c('0x28')](handleError(_0x44994b,null));};exports[_0x6e2c('0x5c')]=function(_0x3b6158,_0x45a949,_0x5dc752){var _0x160762={};var _0x3c3592={};var _0x47912c;var _0x220175;return db['ZendeskConfiguration'][_0x6e2c('0x58')]({'where':{'id':_0x3b6158['params']['id']}})['then'](handleEntityNotFound(_0x45a949,null))[_0x6e2c('0x1d')](function(_0x502c94){if(_0x502c94){_0x47912c=_0x502c94;_0x3c3592['model']=_[_0x6e2c('0x3a')](db[_0x6e2c('0x59')][_0x6e2c('0x51')]);_0x3c3592[_0x6e2c('0x3b')]=_[_0x6e2c('0x3a')](_0x3b6158[_0x6e2c('0x3b')]);_0x3c3592[_0x6e2c('0x3c')]=_[_0x6e2c('0x3d')](_0x3c3592[_0x6e2c('0x39')],_0x3c3592[_0x6e2c('0x3b')]);_0x160762[_0x6e2c('0x3f')]=_[_0x6e2c('0x3d')](_0x3c3592[_0x6e2c('0x39')],qs[_0x6e2c('0x3e')](_0x3b6158[_0x6e2c('0x3b')][_0x6e2c('0x3e')]));_0x160762[_0x6e2c('0x3f')]=_0x160762[_0x6e2c('0x3f')][_0x6e2c('0x40')]?_0x160762[_0x6e2c('0x3f')]:_0x3c3592[_0x6e2c('0x39')];_0x160762['order']=qs['sort'](_0x3b6158[_0x6e2c('0x3b')][_0x6e2c('0x44')]);_0x160762['where']=qs[_0x6e2c('0x3c')](_[_0x6e2c('0x46')](_0x3b6158[_0x6e2c('0x3b')],_0x3c3592[_0x6e2c('0x3c')]));if(_0x3b6158['query']['filter']){_0x160762[_0x6e2c('0x45')]=_[_0x6e2c('0x48')](_0x160762[_0x6e2c('0x45')],{'$or':_['map'](_0x160762[_0x6e2c('0x3f')],function(_0x405df3){var _0x1c1b14={};_0x1c1b14[_0x405df3]={'$like':'%'+_0x3b6158[_0x6e2c('0x3b')][_0x6e2c('0x47')]+'%'};return _0x1c1b14;})});}_0x160762=_[_0x6e2c('0x48')]({},_0x160762,_0x3b6158[_0x6e2c('0x4a')]);return _0x47912c[_0x6e2c('0x5c')](_0x160762);}})[_0x6e2c('0x1d')](function(_0x108e1c){if(_0x108e1c){_0x220175=_0x108e1c['length'];if(!_0x3b6158[_0x6e2c('0x3b')]['hasOwnProperty'](_0x6e2c('0x41'))){_0x160762[_0x6e2c('0x42')]=qs[_0x6e2c('0x42')](_0x3b6158[_0x6e2c('0x3b')]['limit']);_0x160762[_0x6e2c('0x2d')]=qs['offset'](_0x3b6158[_0x6e2c('0x3b')][_0x6e2c('0x2d')]);}return _0x47912c['getDescriptions'](_0x160762);}})[_0x6e2c('0x1d')](function(_0x43a1b0){if(_0x43a1b0){return _0x43a1b0?{'count':_0x220175,'rows':_0x43a1b0}:null;}})[_0x6e2c('0x1d')](respondWithResult(_0x45a949,null))[_0x6e2c('0x28')](handleError(_0x45a949,null));};exports[_0x6e2c('0x5d')]=function(_0x2d937f,_0x54ce71,_0x2f5e0f){var _0x120e2c={};var _0x564153={};var _0x5c7872;var _0x8887b5;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x2d937f[_0x6e2c('0x55')]['id']}})[_0x6e2c('0x1d')](handleEntityNotFound(_0x54ce71,null))['then'](function(_0x43594e){if(_0x43594e){_0x5c7872=_0x43594e;_0x564153[_0x6e2c('0x39')]=_[_0x6e2c('0x3a')](db[_0x6e2c('0x5e')]['rawAttributes']);_0x564153[_0x6e2c('0x3b')]=_[_0x6e2c('0x3a')](_0x2d937f['query']);_0x564153[_0x6e2c('0x3c')]=_['intersection'](_0x564153[_0x6e2c('0x39')],_0x564153[_0x6e2c('0x3b')]);_0x120e2c[_0x6e2c('0x3f')]=_[_0x6e2c('0x3d')](_0x564153[_0x6e2c('0x39')],qs[_0x6e2c('0x3e')](_0x2d937f[_0x6e2c('0x3b')][_0x6e2c('0x3e')]));_0x120e2c[_0x6e2c('0x3f')]=_0x120e2c['attributes'][_0x6e2c('0x40')]?_0x120e2c[_0x6e2c('0x3f')]:_0x564153[_0x6e2c('0x39')];_0x120e2c[_0x6e2c('0x43')]=qs[_0x6e2c('0x44')](_0x2d937f['query'][_0x6e2c('0x44')]);_0x120e2c[_0x6e2c('0x45')]=qs[_0x6e2c('0x3c')](_[_0x6e2c('0x46')](_0x2d937f[_0x6e2c('0x3b')],_0x564153[_0x6e2c('0x3c')]));if(_0x2d937f[_0x6e2c('0x3b')][_0x6e2c('0x47')]){_0x120e2c[_0x6e2c('0x45')]=_[_0x6e2c('0x48')](_0x120e2c['where'],{'$or':_[_0x6e2c('0x35')](_0x120e2c[_0x6e2c('0x3f')],function(_0x7cf4bd){var _0x2e1b7c={};_0x2e1b7c[_0x7cf4bd]={'$like':'%'+_0x2d937f[_0x6e2c('0x3b')]['filter']+'%'};return _0x2e1b7c;})});}_0x120e2c=_[_0x6e2c('0x48')]({},_0x120e2c,_0x2d937f['options']);return _0x5c7872[_0x6e2c('0x5d')](_0x120e2c);}})['then'](function(_0xcfc4ef){if(_0xcfc4ef){_0x8887b5=_0xcfc4ef[_0x6e2c('0x40')];if(!_0x2d937f[_0x6e2c('0x3b')][_0x6e2c('0x5a')](_0x6e2c('0x41'))){_0x120e2c[_0x6e2c('0x42')]=qs[_0x6e2c('0x42')](_0x2d937f[_0x6e2c('0x3b')][_0x6e2c('0x42')]);_0x120e2c['offset']=qs[_0x6e2c('0x2d')](_0x2d937f[_0x6e2c('0x3b')][_0x6e2c('0x2d')]);}return _0x5c7872[_0x6e2c('0x5d')](_0x120e2c);}})[_0x6e2c('0x1d')](function(_0x1c8fa7){if(_0x1c8fa7){return _0x1c8fa7?{'count':_0x8887b5,'rows':_0x1c8fa7}:null;}})[_0x6e2c('0x1d')](respondWithResult(_0x54ce71,null))[_0x6e2c('0x28')](handleError(_0x54ce71,null));};exports[_0x6e2c('0x5f')]=function(_0x249217,_0x25af33,_0xccbf4e){if(_0x249217[_0x6e2c('0x54')]['id']){delete _0x249217['body']['id'];}return db[_0x6e2c('0x4b')][_0x6e2c('0x58')]({'where':{'id':_0x249217[_0x6e2c('0x55')]['id']}})[_0x6e2c('0x1d')](handleEntityNotFound(_0x25af33,null))[_0x6e2c('0x1d')](function(_0xaf4159){if(_0xaf4159){return _0xaf4159['setTags'](_0x249217[_0x6e2c('0x54')]['ids']||[]);}return null;})[_0x6e2c('0x1d')](respondWithResult(_0x25af33,null))[_0x6e2c('0x28')](handleError(_0x25af33,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 5a0c90d..25af3c4 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 _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 +var _0x878c=['lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations'];(function(_0x4ab100,_0x5aa08c){var _0xf17f9=function(_0x278ba0){while(--_0x278ba0){_0x4ab100['push'](_0x4ab100['shift']());}};_0xf17f9(++_0x5aa08c);}(_0x878c,0x1a4));var _0xc878=function(_0x1c7ddb,_0x134bb6){_0x1c7ddb=_0x1c7ddb-0x0;var _0xcee80f=_0x878c[_0x1c7ddb];return _0xcee80f;};'use strict';var _=require(_0xc878('0x0'));var util=require(_0xc878('0x1'));var logger=require(_0xc878('0x2'))('api');var moment=require(_0xc878('0x3'));var BPromise=require(_0xc878('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc878('0x5'));var rimraf=require('rimraf');var config=require(_0xc878('0x6'));var attributes=require(_0xc878('0x7'));module[_0xc878('0x8')]=function(_0x53c78d,_0x22237c){return _0x53c78d[_0xc878('0x9')](_0xc878('0xa'),attributes,{'tableName':_0xc878('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 758db7d..abbf237 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 _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 +var _0xc15b=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','bluebird'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xc15b,0x130));var _0xbc15=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xc15b[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0xbc15('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbc15('0x1'));var rs=require(_0xbc15('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc15('0x3'))['db'];var utils=require(_0xbc15('0x4'));var logger=require('../../config/logger')(_0xbc15('0x5'));var config=require(_0xbc15('0x6'));var jayson=require(_0xbc15('0x7'));var client=jayson['client'][_0xbc15('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x46900d,_0x439b92,_0x939efc){return new BPromise(function(_0x202a57,_0x2961dd){return client['request'](_0x46900d,_0x939efc)['then'](function(_0x419188){logger['info'](_0xbc15('0x9'),_0x439b92,_0xbc15('0xa'));logger[_0xbc15('0xb')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x439b92,_0xbc15('0xa'),JSON[_0xbc15('0xc')](_0x419188));if(_0x419188[_0xbc15('0xd')]){if(_0x419188[_0xbc15('0xd')][_0xbc15('0xe')]===0x1f4){logger[_0xbc15('0xd')](_0xbc15('0x9'),_0x439b92,_0x419188['error'][_0xbc15('0xf')]);return _0x2961dd(_0x419188[_0xbc15('0xd')][_0xbc15('0xf')]);}logger['error'](_0xbc15('0x9'),_0x439b92,_0x419188['error'][_0xbc15('0xf')]);return _0x202a57(_0x419188[_0xbc15('0xd')][_0xbc15('0xf')]);}else{logger['info'](_0xbc15('0x9'),_0x439b92,_0xbc15('0xa'));_0x202a57(_0x419188['result'][_0xbc15('0xf')]);}})[_0xbc15('0x10')](function(_0x168bd7){logger[_0xbc15('0xd')](_0xbc15('0x9'),_0x439b92,_0x168bd7);_0x2961dd(_0x168bd7);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index b6269a0..09a8e2a 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 _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 +var _0x15be=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','index','post','isAuthenticated','create','put','/:id','update','delete','destroy'];(function(_0x1dd997,_0x578bf5){var _0x440e4b=function(_0x55f83d){while(--_0x55f83d){_0x1dd997['push'](_0x1dd997['shift']());}};_0x440e4b(++_0x578bf5);}(_0x15be,0x65));var _0xe15b=function(_0x3ff76e,_0x2fca0c){_0x3ff76e=_0x3ff76e-0x0;var _0x187d77=_0x15be[_0x3ff76e];return _0x187d77;};'use strict';var multer=require(_0xe15b('0x0'));var util=require(_0xe15b('0x1'));var path=require('path');var timeout=require(_0xe15b('0x2'));var express=require(_0xe15b('0x3'));var router=express[_0xe15b('0x4')]();var auth=require(_0xe15b('0x5'));var interaction=require(_0xe15b('0x6'));var config=require(_0xe15b('0x7'));var controller=require(_0xe15b('0x8'));router[_0xe15b('0x9')]('/',auth['isAuthenticated'](),controller[_0xe15b('0xa')]);router[_0xe15b('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xe15b('0xb')]('/',auth[_0xe15b('0xc')](),controller[_0xe15b('0xd')]);router[_0xe15b('0xe')](_0xe15b('0xf'),auth[_0xe15b('0xc')](),controller[_0xe15b('0x10')]);router[_0xe15b('0x11')]('/:id',auth[_0xe15b('0xc')](),controller[_0xe15b('0x12')]);module[_0xe15b('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index abf87b8..c8e77d7 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 _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 +var _0x4f82=['STRING','ENUM','variable','BOOLEAN','sequelize','exports','string','customVariable'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x4f82,0xbc));var _0x24f8=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x4f82[_0x363ef8];return _0x148822;};'use strict';var Sequelize=require(_0x24f8('0x0'));module[_0x24f8('0x1')]={'type':{'type':Sequelize['ENUM'](_0x24f8('0x2'),'variable',_0x24f8('0x3'),'keyValue'),'defaultValue':_0x24f8('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x24f8('0x4')]},'keyType':{'type':Sequelize[_0x24f8('0x5')](_0x24f8('0x2'),_0x24f8('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x24f8('0x4')]},'idField':{'type':Sequelize[_0x24f8('0x4')]},'nameField':{'type':Sequelize[_0x24f8('0x4')]},'customField':{'type':Sequelize[_0x24f8('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x24f8('0x4')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index d2d1965..0cbc891 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 _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 +var _0x2477=['name','query','filters','intersection','model','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','ZendeskField','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','error','send','index','map','rawAttributes','type'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x2477,0x138));var _0x7247=function(_0x954b3a,_0x10a7c1){_0x954b3a=_0x954b3a-0x0;var _0x3a313e=_0x2477[_0x954b3a];return _0x3a313e;};'use strict';var pdf=require(_0x7247('0x0'));var emlformat=require(_0x7247('0x1'));var rimraf=require(_0x7247('0x2'));var zipdir=require(_0x7247('0x3'));var jsonpatch=require(_0x7247('0x4'));var rp=require(_0x7247('0x5'));var moment=require('moment');var BPromise=require(_0x7247('0x6'));var Mustache=require(_0x7247('0x7'));var util=require('util');var path=require(_0x7247('0x8'));var sox=require(_0x7247('0x9'));var csv=require(_0x7247('0xa'));var ejs=require(_0x7247('0xb'));var fs=require('fs');var _=require(_0x7247('0xc'));var squel=require(_0x7247('0xd'));var crypto=require(_0x7247('0xe'));var jsforce=require(_0x7247('0xf'));var deskjs=require(_0x7247('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7247('0x11'));var Papa=require(_0x7247('0x12'));var Redis=require(_0x7247('0x13'));var authService=require(_0x7247('0x14'));var qs=require(_0x7247('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7247('0x16'))('api');var utils=require(_0x7247('0x17'));var config=require('../../config/environment');var db=require(_0x7247('0x18'))['db'];function respondWithStatusCode(_0x10d15b,_0x2db839){_0x2db839=_0x2db839||0xcc;return function(_0x47b907){if(_0x47b907){return _0x10d15b[_0x7247('0x19')](_0x2db839);}return _0x10d15b[_0x7247('0x1a')](_0x2db839)[_0x7247('0x1b')]();};}function respondWithResult(_0x583c5d,_0x255eea){_0x255eea=_0x255eea||0xc8;return function(_0x4ebc0b){if(_0x4ebc0b){return _0x583c5d[_0x7247('0x1a')](_0x255eea)[_0x7247('0x1c')](_0x4ebc0b);}};}function respondWithFilteredResult(_0x3e2f36,_0x3e7215){return function(_0x456715){if(_0x456715){var _0x44d689=_0x456715[_0x7247('0x1d')],_0x386781=_0x3e7215['offset'],_0x25c3de=_0x3e7215[_0x7247('0x1e')]+_0x3e7215[_0x7247('0x1f')],_0x3d966b;if(_0x25c3de>=_0x44d689){_0x25c3de=_0x44d689;_0x3d966b=0xc8;}else{_0x3d966b=0xce;}_0x3e2f36[_0x7247('0x1a')](_0x3d966b);return _0x3e2f36['set'](_0x7247('0x20'),_0x386781+'-'+_0x25c3de+'/'+_0x44d689)[_0x7247('0x1c')](_0x456715);}return null;};}function patchUpdates(_0x2eec1f){return function(_0x35a96a){try{jsonpatch[_0x7247('0x21')](_0x35a96a,_0x2eec1f,!![]);}catch(_0x143ad9){return BPromise['reject'](_0x143ad9);}return _0x35a96a[_0x7247('0x22')]();};}function saveUpdates(_0x195cea,_0x52d38a){return function(_0x5ace00){if(_0x5ace00){return _0x5ace00[_0x7247('0x23')](_0x195cea)['then'](function(_0x976bb5){return _0x976bb5;});}return null;};}function removeEntity(_0x317ef8,_0x56ab66){return function(_0x2f226b){if(_0x2f226b){return _0x2f226b['destroy']()[_0x7247('0x24')](function(){_0x317ef8[_0x7247('0x1a')](0xcc)[_0x7247('0x1b')]();});}};}function handleEntityNotFound(_0x18c0f6,_0x498d00){return function(_0x296d27){if(!_0x296d27){_0x18c0f6[_0x7247('0x19')](0x194);}return _0x296d27;};}function handleError(_0x549392,_0x53a8ff){_0x53a8ff=_0x53a8ff||0x1f4;return function(_0x179328){logger[_0x7247('0x25')](_0x179328['stack']);if(_0x179328['name']){delete _0x179328['name'];}_0x549392[_0x7247('0x1a')](_0x53a8ff)[_0x7247('0x26')](_0x179328);};}exports[_0x7247('0x27')]=function(_0x56632c,_0x48d822){var _0x365845={},_0x16ced6={},_0x13928b={'count':0x0,'rows':[]};var _0x3f7c79=_[_0x7247('0x28')](db['ZendeskField'][_0x7247('0x29')],function(_0xff9377){return{'name':_0xff9377['fieldName'],'type':_0xff9377[_0x7247('0x2a')]['key']};});_0x16ced6['model']=_[_0x7247('0x28')](_0x3f7c79,_0x7247('0x2b'));_0x16ced6[_0x7247('0x2c')]=_['keys'](_0x56632c[_0x7247('0x2c')]);_0x16ced6[_0x7247('0x2d')]=_[_0x7247('0x2e')](_0x16ced6[_0x7247('0x2f')],_0x16ced6['query']);_0x365845[_0x7247('0x30')]=_[_0x7247('0x2e')](_0x16ced6[_0x7247('0x2f')],qs[_0x7247('0x31')](_0x56632c[_0x7247('0x2c')][_0x7247('0x31')]));_0x365845[_0x7247('0x30')]=_0x365845['attributes'][_0x7247('0x32')]?_0x365845[_0x7247('0x30')]:_0x16ced6[_0x7247('0x2f')];if(!_0x56632c[_0x7247('0x2c')]['hasOwnProperty']('nolimit')){_0x365845[_0x7247('0x1f')]=qs[_0x7247('0x1f')](_0x56632c[_0x7247('0x2c')][_0x7247('0x1f')]);_0x365845[_0x7247('0x1e')]=qs['offset'](_0x56632c[_0x7247('0x2c')][_0x7247('0x1e')]);}_0x365845[_0x7247('0x33')]=qs[_0x7247('0x34')](_0x56632c[_0x7247('0x2c')][_0x7247('0x34')]);_0x365845[_0x7247('0x35')]=qs[_0x7247('0x2d')](_['pick'](_0x56632c[_0x7247('0x2c')],_0x16ced6[_0x7247('0x2d')]),_0x3f7c79);if(_0x56632c[_0x7247('0x2c')][_0x7247('0x36')]){_0x365845[_0x7247('0x35')]=_[_0x7247('0x37')](_0x365845[_0x7247('0x35')],{'$or':_[_0x7247('0x28')](_0x3f7c79,function(_0x53c154){if(_0x53c154['type']!==_0x7247('0x38')){var _0x9e6595={};_0x9e6595[_0x53c154[_0x7247('0x2b')]]={'$like':'%'+_0x56632c['query'][_0x7247('0x36')]+'%'};return _0x9e6595;}})});}_0x365845=_[_0x7247('0x37')]({},_0x365845,_0x56632c[_0x7247('0x39')]);var _0x16ee39={'where':_0x365845[_0x7247('0x35')]};return db['ZendeskField'][_0x7247('0x1d')](_0x16ee39)['then'](function(_0x4eef8e){_0x13928b[_0x7247('0x1d')]=_0x4eef8e;if(_0x56632c['query'][_0x7247('0x3a')]){_0x365845[_0x7247('0x3b')]=[{'all':!![]}];}return db['ZendeskField'][_0x7247('0x3c')](_0x365845);})[_0x7247('0x24')](function(_0x4ba96b){_0x13928b[_0x7247('0x3d')]=_0x4ba96b;return _0x13928b;})[_0x7247('0x24')](respondWithFilteredResult(_0x48d822,_0x365845))[_0x7247('0x3e')](handleError(_0x48d822,null));};exports[_0x7247('0x3f')]=function(_0x3e25e9,_0x3a4914){var _0x5abf6b={'raw':!![],'where':{'id':_0x3e25e9[_0x7247('0x40')]['id']}},_0x1185a8={};_0x1185a8[_0x7247('0x2f')]=_[_0x7247('0x41')](db['ZendeskField'][_0x7247('0x29')]);_0x1185a8[_0x7247('0x2c')]=_[_0x7247('0x41')](_0x3e25e9[_0x7247('0x2c')]);_0x1185a8[_0x7247('0x2d')]=_['intersection'](_0x1185a8[_0x7247('0x2f')],_0x1185a8['query']);_0x5abf6b[_0x7247('0x30')]=_[_0x7247('0x2e')](_0x1185a8[_0x7247('0x2f')],qs[_0x7247('0x31')](_0x3e25e9[_0x7247('0x2c')][_0x7247('0x31')]));_0x5abf6b[_0x7247('0x30')]=_0x5abf6b[_0x7247('0x30')][_0x7247('0x32')]?_0x5abf6b['attributes']:_0x1185a8[_0x7247('0x2f')];if(_0x3e25e9[_0x7247('0x2c')]['includeAll']){_0x5abf6b[_0x7247('0x3b')]=[{'all':!![]}];}_0x5abf6b=_[_0x7247('0x37')]({},_0x5abf6b,_0x3e25e9['options']);return db[_0x7247('0x42')][_0x7247('0x43')](_0x5abf6b)['then'](handleEntityNotFound(_0x3a4914,null))[_0x7247('0x24')](respondWithResult(_0x3a4914,null))['catch'](handleError(_0x3a4914,null));};exports['create']=function(_0x7bc76d,_0xaba8e7){return db[_0x7247('0x42')][_0x7247('0x44')](_0x7bc76d[_0x7247('0x45')],{})[_0x7247('0x24')](respondWithResult(_0xaba8e7,0xc9))[_0x7247('0x3e')](handleError(_0xaba8e7,null));};exports[_0x7247('0x23')]=function(_0x5308b6,_0x5cd617){if(_0x5308b6[_0x7247('0x45')]['id']){delete _0x5308b6['body']['id'];}return db[_0x7247('0x42')][_0x7247('0x43')]({'where':{'id':_0x5308b6['params']['id']}})[_0x7247('0x24')](handleEntityNotFound(_0x5cd617,null))[_0x7247('0x24')](saveUpdates(_0x5308b6[_0x7247('0x45')],null))[_0x7247('0x24')](respondWithResult(_0x5cd617,null))['catch'](handleError(_0x5cd617,null));};exports[_0x7247('0x46')]=function(_0x696b59,_0x30628c){return db[_0x7247('0x42')][_0x7247('0x43')]({'where':{'id':_0x696b59[_0x7247('0x40')]['id']}})[_0x7247('0x24')](handleEntityNotFound(_0x30628c,null))[_0x7247('0x24')](removeEntity(_0x30628c,null))[_0x7247('0x3e')](handleError(_0x30628c,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index a7f96c1..39440ef 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 _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 +var _0xa249=['zendesk_unique_index','idField','FieldId','lodash','util','api','moment','request-promise','rimraf','define','ZendeskField','int_zendesk_fields'];(function(_0x33dbcc,_0x3070c1){var _0x5b0a8b=function(_0x15f845){while(--_0x15f845){_0x33dbcc['push'](_0x33dbcc['shift']());}};_0x5b0a8b(++_0x3070c1);}(_0xa249,0x183));var _0x9a24=function(_0x5a773e,_0x239ea8){_0x5a773e=_0x5a773e-0x0;var _0x5290b8=_0xa249[_0x5a773e];return _0x5290b8;};'use strict';var _=require(_0x9a24('0x0'));var util=require(_0x9a24('0x1'));var logger=require('../../config/logger')(_0x9a24('0x2'));var moment=require(_0x9a24('0x3'));var BPromise=require('bluebird');var rp=require(_0x9a24('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9a24('0x5'));var config=require('../../config/environment');var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x1b0728,_0x167980){return _0x1b0728[_0x9a24('0x6')](_0x9a24('0x7'),attributes,{'tableName':_0x9a24('0x8'),'paranoid':![],'indexes':[{'name':_0x9a24('0x9'),'fields':[_0x9a24('0xa'),_0x9a24('0xb')],'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 edf4646..0878a5e 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 _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 +var _0xe59d=['ioredis','../../mysqldb','jayson/promise','client','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x439420,_0x54dfb2){var _0x1085e9=function(_0x1889fd){while(--_0x1889fd){_0x439420['push'](_0x439420['shift']());}};_0x1085e9(++_0x54dfb2);}(_0xe59d,0x145));var _0xde59=function(_0x3e35e9,_0x343705){_0x3e35e9=_0x3e35e9-0x0;var _0x5a9829=_0xe59d[_0x3e35e9];return _0x5a9829;};'use strict';var _=require(_0xde59('0x0'));var util=require(_0xde59('0x1'));var moment=require(_0xde59('0x2'));var BPromise=require(_0xde59('0x3'));var rs=require(_0xde59('0x4'));var fs=require('fs');var Redis=require(_0xde59('0x5'));var db=require(_0xde59('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xde59('0x7'));var client=jayson[_0xde59('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x916a7d,_0x5d6fdf,_0x503550){return new BPromise(function(_0xc27605,_0x4dbd3c){return client[_0xde59('0x9')](_0x916a7d,_0x503550)[_0xde59('0xa')](function(_0x25a6a9){logger[_0xde59('0xb')](_0xde59('0xc'),_0x5d6fdf,_0xde59('0xd'));logger[_0xde59('0xe')](_0xde59('0xf'),_0x5d6fdf,_0xde59('0xd'),JSON[_0xde59('0x10')](_0x25a6a9));if(_0x25a6a9[_0xde59('0x11')]){if(_0x25a6a9[_0xde59('0x11')][_0xde59('0x12')]===0x1f4){logger[_0xde59('0x11')]('ZendeskField,\x20%s,\x20%s',_0x5d6fdf,_0x25a6a9['error'][_0xde59('0x13')]);return _0x4dbd3c(_0x25a6a9['error'][_0xde59('0x13')]);}logger[_0xde59('0x11')](_0xde59('0xc'),_0x5d6fdf,_0x25a6a9[_0xde59('0x11')]['message']);return _0xc27605(_0x25a6a9[_0xde59('0x11')]['message']);}else{logger[_0xde59('0xb')](_0xde59('0xc'),_0x5d6fdf,_0xde59('0xd'));_0xc27605(_0x25a6a9[_0xde59('0x14')][_0xde59('0x13')]);}})[_0xde59('0x15')](function(_0x104515){logger[_0xde59('0x11')](_0xde59('0xc'),_0x5d6fdf,_0x104515);_0x4dbd3c(_0x104515);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index d33856c..2c83879 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 _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 +var _0x8903=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x15566c,_0x210665){var _0x6f4ca0=function(_0x27c75d){while(--_0x27c75d){_0x15566c['push'](_0x15566c['shift']());}};_0x6f4ca0(++_0x210665);}(_0x8903,0x188));var _0x3890=function(_0x2a8255,_0x2ab6cb){_0x2a8255=_0x2a8255-0x0;var _0x20d7a5=_0x8903[_0x2a8255];return _0x20d7a5;};'use strict';var multer=require(_0x3890('0x0'));var util=require(_0x3890('0x1'));var path=require(_0x3890('0x2'));var timeout=require('connect-timeout');var express=require(_0x3890('0x3'));var router=express['Router']();var auth=require(_0x3890('0x4'));var interaction=require(_0x3890('0x5'));var config=require(_0x3890('0x6'));var controller=require('./intZohoAccount.controller');router[_0x3890('0x7')]('/',auth[_0x3890('0x8')](),controller[_0x3890('0x9')]);router['get'](_0x3890('0xa'),auth[_0x3890('0x8')](),controller[_0x3890('0xb')]);router[_0x3890('0x7')](_0x3890('0xc'),auth[_0x3890('0x8')](),controller['getConfigurations']);router['get'](_0x3890('0xd'),auth[_0x3890('0x8')](),controller['getFields']);router[_0x3890('0xe')]('/',auth[_0x3890('0x8')](),controller[_0x3890('0xf')]);router[_0x3890('0xe')](_0x3890('0xc'),auth[_0x3890('0x8')](),controller[_0x3890('0x10')]);router[_0x3890('0x11')]('/:id',auth[_0x3890('0x8')](),controller[_0x3890('0x12')]);router[_0x3890('0x13')](_0x3890('0xa'),auth[_0x3890('0x8')](),controller[_0x3890('0x14')]);module[_0x3890('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 576d853..3bce1cb 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 _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 +var _0xfe38=['STRING','sequelize'];(function(_0x5e5c4c,_0x21abba){var _0x176148=function(_0x59522a){while(--_0x59522a){_0x5e5c4c['push'](_0x5e5c4c['shift']());}};_0x176148(++_0x21abba);}(_0xfe38,0x1b7));var _0x8fe3=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xfe38[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x8fe3('0x0'));module['exports']={'name':{'type':Sequelize[_0x8fe3('0x1')]},'description':{'type':Sequelize[_0x8fe3('0x1')]},'host':{'type':Sequelize[_0x8fe3('0x1')]},'zone':{'type':Sequelize[_0x8fe3('0x1')]},'clientId':{'type':Sequelize[_0x8fe3('0x1')]},'clientSecret':{'type':Sequelize[_0x8fe3('0x1')]},'serverUrl':{'type':Sequelize[_0x8fe3('0x1')]},'code':{'type':Sequelize[_0x8fe3('0x1')]},'refreshToken':{'type':Sequelize[_0x8fe3('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 3939bbe..05983a0 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 _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 +var _0x6292=['Subject','Call_Duration','Call_Result','Call_Type','remove','includes','api_name','push','display_label','custom_field','data_type','picklist','pick_list_values','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','statusCode','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../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','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','update','stack','name','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','order','sort','where','pick','VIRTUAL','filter','includeAll','findAll','rows','show','params','keys','length','merge','options','find','create','body','destroy','getConfigurations','findOne','ZohoConfiguration','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','getFields','host','serverUrl','zoho.eu','com','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','response'];(function(_0x1e7716,_0x48e426){var _0xd61a23=function(_0x28667b){while(--_0x28667b){_0x1e7716['push'](_0x1e7716['shift']());}};_0xd61a23(++_0x48e426);}(_0x6292,0x11e));var _0x2629=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x6292[_0x36dfbd];return _0x4ecad9;};'use strict';var pdf=require(_0x2629('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2629('0x1'));var rp=require(_0x2629('0x2'));var moment=require(_0x2629('0x3'));var BPromise=require(_0x2629('0x4'));var Mustache=require(_0x2629('0x5'));var util=require(_0x2629('0x6'));var path=require(_0x2629('0x7'));var sox=require(_0x2629('0x8'));var csv=require(_0x2629('0x9'));var ejs=require(_0x2629('0xa'));var fs=require('fs');var _=require(_0x2629('0xb'));var squel=require(_0x2629('0xc'));var crypto=require('crypto');var jsforce=require(_0x2629('0xd'));var deskjs=require(_0x2629('0xe'));var toCsv=require(_0x2629('0x9'));var querystring=require(_0x2629('0xf'));var Papa=require(_0x2629('0x10'));var Redis=require(_0x2629('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2629('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2629('0x13'))('api');var utils=require(_0x2629('0x14'));var config=require(_0x2629('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x2629('0x16'));var jayson=require(_0x2629('0x17'));var client=jayson[_0x2629('0x18')][_0x2629('0x19')]({'port':0x232a});function checkPasswordPattern(_0x12e370,_0x31e8e1,_0x5ae25b){if(_0x5ae25b){var _0x1018d8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1018d8[_0x2629('0x1a')](_0x31e8e1)){return _0x12e370;}else{throw new db[(_0x2629('0x1b'))][(_0x2629('0x1c'))](_0x2629('0x1d'));}}else{return _0x12e370;}}function respondWithRpcPromise(_0xeb01c9,_0x54eca9,_0x5396c7,_0x108408){return new BPromise(function(_0x130352,_0x4fe3cc){var _0x29695f=_0x108408||client;return _0x29695f[_0x2629('0x1e')](_0xeb01c9,_0x5396c7)[_0x2629('0x1f')](function(_0x5ef8bf){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x54eca9,_0x2629('0x20'));logger[_0x2629('0x21')](_0x2629('0x22'),_0x54eca9,_0x2629('0x20'),JSON['stringify'](_0x5ef8bf));if(_0x5ef8bf[_0x2629('0x23')]){if(_0x5ef8bf[_0x2629('0x23')][_0x2629('0x24')]===0x1f4){logger[_0x2629('0x23')](_0x2629('0x25'),_0x54eca9,_0x5ef8bf['error'][_0x2629('0x26')]);return _0x4fe3cc(_0x5ef8bf[_0x2629('0x23')][_0x2629('0x26')]);}logger[_0x2629('0x23')](_0x2629('0x25'),_0x54eca9,_0x5ef8bf[_0x2629('0x23')]['message']);return _0x130352(_0x5ef8bf[_0x2629('0x23')][_0x2629('0x26')]);}else{logger['info'](_0x2629('0x25'),_0x54eca9,_0x2629('0x20'));_0x130352(_0x5ef8bf[_0x2629('0x27')][_0x2629('0x26')]);}})[_0x2629('0x28')](function(_0xb4995f){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x54eca9,_0xb4995f);_0x4fe3cc(_0xb4995f);});});}function respondWithStatusCode(_0xea9175,_0x1b6584){_0x1b6584=_0x1b6584||0xcc;return function(_0x131200){if(_0x131200){return _0xea9175[_0x2629('0x29')](_0x1b6584);}return _0xea9175[_0x2629('0x2a')](_0x1b6584)[_0x2629('0x2b')]();};}function respondWithResult(_0x4a136d,_0x5cdf56){_0x5cdf56=_0x5cdf56||0xc8;return function(_0x139250){if(_0x139250){return _0x4a136d['status'](_0x5cdf56)[_0x2629('0x2c')](_0x139250);}};}function respondWithFilteredResult(_0x447954,_0x85f229){return function(_0x573f92){if(_0x573f92){var _0xf38cfc=_0x573f92[_0x2629('0x2d')],_0x533ec4=_0x85f229[_0x2629('0x2e')],_0x31db33=_0x85f229[_0x2629('0x2e')]+_0x85f229[_0x2629('0x2f')],_0x28f9b3;if(_0x31db33>=_0xf38cfc){_0x31db33=_0xf38cfc;_0x28f9b3=0xc8;}else{_0x28f9b3=0xce;}_0x447954[_0x2629('0x2a')](_0x28f9b3);return _0x447954[_0x2629('0x30')]('Content-Range',_0x533ec4+'-'+_0x31db33+'/'+_0xf38cfc)[_0x2629('0x2c')](_0x573f92);}return null;};}function patchUpdates(_0x6f63ba){return function(_0x52bb17){try{jsonpatch[_0x2629('0x31')](_0x52bb17,_0x6f63ba,!![]);}catch(_0x15b397){return BPromise['reject'](_0x15b397);}return _0x52bb17['save']();};}function saveUpdates(_0x2bd50f,_0x313b29){return function(_0x497d76){if(_0x497d76){return _0x497d76[_0x2629('0x32')](_0x2bd50f)['then'](function(_0x117091){return _0x117091;});}return null;};}function removeEntity(_0xf5e4d,_0x863d3c){return function(_0x3ddc37){if(_0x3ddc37){return _0x3ddc37['destroy']()[_0x2629('0x1f')](function(){_0xf5e4d[_0x2629('0x2a')](0xcc)[_0x2629('0x2b')]();});}};}function handleEntityNotFound(_0x3be9aa,_0xeeb456){return function(_0x53ef25){if(!_0x53ef25){_0x3be9aa[_0x2629('0x29')](0x194);}return _0x53ef25;};}function handleError(_0x189b44,_0x5528d6){_0x5528d6=_0x5528d6||0x1f4;return function(_0x439b9f){logger[_0x2629('0x23')](_0x439b9f[_0x2629('0x33')]);if(_0x439b9f['name']){delete _0x439b9f[_0x2629('0x34')];}_0x189b44[_0x2629('0x2a')](_0x5528d6)['send'](_0x439b9f);};}exports['index']=function(_0x28e3bd,_0x198a71){var _0x523b79={},_0x758252={},_0xac8b78={'count':0x0,'rows':[]};var _0x425377=_[_0x2629('0x35')](db[_0x2629('0x36')][_0x2629('0x37')],function(_0x5cb0ac){return{'name':_0x5cb0ac[_0x2629('0x38')],'type':_0x5cb0ac[_0x2629('0x39')][_0x2629('0x3a')]};});_0x758252[_0x2629('0x3b')]=_[_0x2629('0x35')](_0x425377,_0x2629('0x34'));_0x758252[_0x2629('0x3c')]=_['keys'](_0x28e3bd[_0x2629('0x3c')]);_0x758252[_0x2629('0x3d')]=_['intersection'](_0x758252[_0x2629('0x3b')],_0x758252[_0x2629('0x3c')]);_0x523b79['attributes']=_[_0x2629('0x3e')](_0x758252[_0x2629('0x3b')],qs[_0x2629('0x3f')](_0x28e3bd[_0x2629('0x3c')]['fields']));_0x523b79[_0x2629('0x40')]=_0x523b79[_0x2629('0x40')]['length']?_0x523b79[_0x2629('0x40')]:_0x758252[_0x2629('0x3b')];if(!_0x28e3bd[_0x2629('0x3c')]['hasOwnProperty']('nolimit')){_0x523b79['limit']=qs[_0x2629('0x2f')](_0x28e3bd['query'][_0x2629('0x2f')]);_0x523b79[_0x2629('0x2e')]=qs[_0x2629('0x2e')](_0x28e3bd['query'][_0x2629('0x2e')]);}_0x523b79[_0x2629('0x41')]=qs['sort'](_0x28e3bd['query'][_0x2629('0x42')]);_0x523b79[_0x2629('0x43')]=qs[_0x2629('0x3d')](_[_0x2629('0x44')](_0x28e3bd[_0x2629('0x3c')],_0x758252[_0x2629('0x3d')]),_0x425377);if(_0x28e3bd[_0x2629('0x3c')]['filter']){_0x523b79[_0x2629('0x43')]=_['merge'](_0x523b79[_0x2629('0x43')],{'$or':_['map'](_0x425377,function(_0x29e05c){if(_0x29e05c[_0x2629('0x39')]!==_0x2629('0x45')){var _0x1246e9={};_0x1246e9[_0x29e05c['name']]={'$like':'%'+_0x28e3bd['query'][_0x2629('0x46')]+'%'};return _0x1246e9;}})});}_0x523b79=_['merge']({},_0x523b79,_0x28e3bd['options']);var _0x2fe428={'where':_0x523b79[_0x2629('0x43')]};return db['ZohoAccount'][_0x2629('0x2d')](_0x2fe428)['then'](function(_0x231ee2){_0xac8b78[_0x2629('0x2d')]=_0x231ee2;if(_0x28e3bd[_0x2629('0x3c')][_0x2629('0x47')]){_0x523b79['include']=[{'all':!![]}];}return db[_0x2629('0x36')][_0x2629('0x48')](_0x523b79);})[_0x2629('0x1f')](function(_0x3d166c){_0xac8b78[_0x2629('0x49')]=_0x3d166c;return _0xac8b78;})[_0x2629('0x1f')](respondWithFilteredResult(_0x198a71,_0x523b79))[_0x2629('0x28')](handleError(_0x198a71,null));};exports[_0x2629('0x4a')]=function(_0x1cec43,_0x250d31){var _0x46ec6d={'raw':![],'where':{'id':_0x1cec43[_0x2629('0x4b')]['id']}},_0x58fb22={};_0x58fb22[_0x2629('0x3b')]=_['keys'](db[_0x2629('0x36')][_0x2629('0x37')]);_0x58fb22['query']=_[_0x2629('0x4c')](_0x1cec43['query']);_0x58fb22[_0x2629('0x3d')]=_[_0x2629('0x3e')](_0x58fb22['model'],_0x58fb22[_0x2629('0x3c')]);_0x46ec6d[_0x2629('0x40')]=_[_0x2629('0x3e')](_0x58fb22[_0x2629('0x3b')],qs[_0x2629('0x3f')](_0x1cec43['query']['fields']));_0x46ec6d['attributes']=_0x46ec6d[_0x2629('0x40')][_0x2629('0x4d')]?_0x46ec6d[_0x2629('0x40')]:_0x58fb22[_0x2629('0x3b')];if(_0x1cec43[_0x2629('0x3c')][_0x2629('0x47')]){_0x46ec6d['include']=[{'all':!![]}];}_0x46ec6d=_[_0x2629('0x4e')]({},_0x46ec6d,_0x1cec43[_0x2629('0x4f')]);return db[_0x2629('0x36')][_0x2629('0x50')](_0x46ec6d)[_0x2629('0x1f')](handleEntityNotFound(_0x250d31,null))[_0x2629('0x1f')](respondWithResult(_0x250d31,null))[_0x2629('0x28')](handleError(_0x250d31,null));};exports[_0x2629('0x51')]=function(_0x38e190,_0x1cc075){return db[_0x2629('0x36')][_0x2629('0x51')](_0x38e190[_0x2629('0x52')],{})[_0x2629('0x1f')](respondWithResult(_0x1cc075,0xc9))[_0x2629('0x28')](handleError(_0x1cc075,null));};exports[_0x2629('0x32')]=function(_0x555dcf,_0x2f3783){if(_0x555dcf[_0x2629('0x52')]['id']){delete _0x555dcf[_0x2629('0x52')]['id'];}return db[_0x2629('0x36')][_0x2629('0x50')]({'where':{'id':_0x555dcf['params']['id']}})[_0x2629('0x1f')](handleEntityNotFound(_0x2f3783,null))[_0x2629('0x1f')](saveUpdates(_0x555dcf[_0x2629('0x52')],null))['then'](respondWithResult(_0x2f3783,null))[_0x2629('0x28')](handleError(_0x2f3783,null));};exports[_0x2629('0x53')]=function(_0x85c18b,_0x1f28f8){return db['ZohoAccount'][_0x2629('0x50')]({'where':{'id':_0x85c18b[_0x2629('0x4b')]['id']}})[_0x2629('0x1f')](handleEntityNotFound(_0x1f28f8,null))[_0x2629('0x1f')](removeEntity(_0x1f28f8,null))[_0x2629('0x28')](handleError(_0x1f28f8,null));};exports[_0x2629('0x54')]=function(_0x5b47d2,_0x556147,_0x11c67d){var _0x20c646={};var _0x3d29f6={};var _0x31c324;var _0x591caf;return db[_0x2629('0x36')][_0x2629('0x55')]({'where':{'id':_0x5b47d2[_0x2629('0x4b')]['id']}})[_0x2629('0x1f')](handleEntityNotFound(_0x556147,null))[_0x2629('0x1f')](function(_0x4ddf8a){if(_0x4ddf8a){_0x31c324=_0x4ddf8a;_0x3d29f6[_0x2629('0x3b')]=_['keys'](db[_0x2629('0x56')][_0x2629('0x37')]);_0x3d29f6[_0x2629('0x3c')]=_[_0x2629('0x4c')](_0x5b47d2[_0x2629('0x3c')]);_0x3d29f6[_0x2629('0x3d')]=_['intersection'](_0x3d29f6[_0x2629('0x3b')],_0x3d29f6[_0x2629('0x3c')]);_0x20c646[_0x2629('0x40')]=_[_0x2629('0x3e')](_0x3d29f6['model'],qs[_0x2629('0x3f')](_0x5b47d2[_0x2629('0x3c')][_0x2629('0x3f')]));_0x20c646[_0x2629('0x40')]=_0x20c646[_0x2629('0x40')][_0x2629('0x4d')]?_0x20c646[_0x2629('0x40')]:_0x3d29f6[_0x2629('0x3b')];_0x20c646[_0x2629('0x41')]=qs['sort'](_0x5b47d2[_0x2629('0x3c')][_0x2629('0x42')]);_0x20c646[_0x2629('0x43')]=qs[_0x2629('0x3d')](_['pick'](_0x5b47d2[_0x2629('0x3c')],_0x3d29f6[_0x2629('0x3d')]));if(_0x5b47d2[_0x2629('0x3c')][_0x2629('0x46')]){_0x20c646[_0x2629('0x43')]=_[_0x2629('0x4e')](_0x20c646[_0x2629('0x43')],{'$or':_['map'](_0x20c646['attributes'],function(_0x5300e7){var _0x12ccd5={};_0x12ccd5[_0x5300e7]={'$like':'%'+_0x5b47d2[_0x2629('0x3c')]['filter']+'%'};return _0x12ccd5;})});}_0x20c646=_[_0x2629('0x4e')]({},_0x20c646,_0x5b47d2[_0x2629('0x4f')]);return _0x31c324[_0x2629('0x54')](_0x20c646);}})['then'](function(_0x267ac1){if(_0x267ac1){_0x591caf=_0x267ac1[_0x2629('0x4d')];if(!_0x5b47d2[_0x2629('0x3c')][_0x2629('0x57')](_0x2629('0x58'))){_0x20c646[_0x2629('0x2f')]=qs[_0x2629('0x2f')](_0x5b47d2[_0x2629('0x3c')][_0x2629('0x2f')]);_0x20c646[_0x2629('0x2e')]=qs[_0x2629('0x2e')](_0x5b47d2['query'][_0x2629('0x2e')]);}return _0x31c324[_0x2629('0x54')](_0x20c646);}})[_0x2629('0x1f')](function(_0x1b83c1){if(_0x1b83c1){return _0x1b83c1?{'count':_0x591caf,'rows':_0x1b83c1}:null;}})[_0x2629('0x1f')](respondWithResult(_0x556147,null))[_0x2629('0x28')](handleError(_0x556147,null));};exports[_0x2629('0x59')]=function(_0x286c45,_0x3af446,_0x5913b6){if(_0x286c45[_0x2629('0x52')]['id']){delete _0x286c45[_0x2629('0x52')]['id'];}return db[_0x2629('0x36')][_0x2629('0x55')]({'where':{'id':_0x286c45[_0x2629('0x4b')]['id']}})[_0x2629('0x1f')](handleEntityNotFound(_0x3af446,null))[_0x2629('0x1f')](function(_0x46daa6){if(_0x46daa6){_0x286c45[_0x2629('0x52')][_0x2629('0x5a')]=_0x46daa6['id'];_0x286c45[_0x2629('0x52')][_0x2629('0x5b')]=integrations[_0x2629('0x5c')](_0x286c45[_0x2629('0x52')]['channel'],_0x286c45[_0x2629('0x52')]['type']);_0x286c45[_0x2629('0x52')][_0x2629('0x5d')]=integrations['getDescriptions'](_0x286c45[_0x2629('0x52')][_0x2629('0x5e')],_0x286c45[_0x2629('0x52')][_0x2629('0x39')]);return db[_0x2629('0x56')][_0x2629('0x51')](_0x286c45[_0x2629('0x52')],{'include':[{'model':db[_0x2629('0x5f')],'as':_0x2629('0x5b')},{'model':db[_0x2629('0x5f')],'as':_0x2629('0x5d')}]});}return null;})[_0x2629('0x1f')](respondWithResult(_0x3af446,null))[_0x2629('0x28')](handleError(_0x3af446,null));};function getAccessToken(_0x478a57){return new Promise(function(_0x28d389,_0x39f037){var _0x4f8da6;switch(_0x478a57[_0x2629('0x60')]){case'US':_0x4f8da6=_0x2629('0x61');break;case'AU':_0x4f8da6='https://accounts.zoho.com.au';break;case'EU':_0x4f8da6=_0x2629('0x62');break;case'IN':_0x4f8da6='https://accounts.zoho.in';break;case'CN':_0x4f8da6=_0x2629('0x63');break;default:_0x4f8da6=_0x2629('0x62');break;}var _0x4d7c79={'method':'POST','uri':_0x4f8da6+_0x2629('0x64'),'qs':{'refresh_token':_0x478a57[_0x2629('0x65')],'client_id':_0x478a57[_0x2629('0x66')],'client_secret':_0x478a57['clientSecret'],'grant_type':_0x2629('0x67')},'json':!![]};return rp(_0x4d7c79)['then'](function(_0x1a4530){if(_0x1a4530[_0x2629('0x68')]){_0x28d389(_0x1a4530[_0x2629('0x68')]);}else{_0x39f037('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x2629('0x28')](function(_0x45da16){_0x39f037(_0x45da16);});});}exports[_0x2629('0x69')]=function(_0x395b70,_0x30f37c,_0x2e11db){var _0x2cb545,_0x8c54f6,_0x25deee,_0x4f7dff,_0x29350e;return db['ZohoAccount']['findOne']({'where':{'id':_0x395b70[_0x2629('0x4b')]['id']},'attributes':['id',_0x2629('0x6a'),_0x2629('0x60'),_0x2629('0x66'),'clientSecret',_0x2629('0x6b'),'code',_0x2629('0x65')]})[_0x2629('0x1f')](handleEntityNotFound(_0x30f37c,null))[_0x2629('0x1f')](function(_0x19698e){_0x29350e=_0x19698e;_0x2cb545=_0x29350e[_0x2629('0x6a')];_0x8c54f6=_0x2cb545===_0x2629('0x6c')?'eu':_0x2629('0x6d');_0x25deee=_0x29350e['serverUrl'];var _0x3ca8c2=_0x25deee['slice'](-0x1);if(_0x3ca8c2==='/'||_0x3ca8c2==='\x5c'||_0x3ca8c2===':'){_0x25deee=_0x25deee[_0x2629('0x6e')](0x0,_0x25deee[_0x2629('0x6f')](_0x3ca8c2));}if(!_0x29350e[_0x2629('0x65')]){throw new Error(_0x2629('0x70'));}return getAccessToken(_0x29350e);})[_0x2629('0x1f')](function(_0x5871fe){if(_0x5871fe){return rp({'method':'GET','uri':util[_0x2629('0x71')](_0x2629('0x72'),_0x8c54f6),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5871fe},'json':!![]});}})['then'](function(_0x5b4794){if(_0x5b4794){if(_0x5b4794['response']&&_0x5b4794['response'][_0x2629('0x23')]){throw new Error(_0x5b4794[_0x2629('0x73')][_0x2629('0x23')][_0x2629('0x26')]);}var _0x323ef0=[];var _0xcc5371=[];var _0x45d3d8=['Owner',_0x2629('0x74'),'Description','WhoId',_0x2629('0x75'),_0x2629('0x76'),'Call_Start_Time',_0x2629('0x77')];_0xcc5371=_[_0x2629('0x78')](_0x5b4794[_0x2629('0x3f')],function(_0x255d34){return _0x45d3d8[_0x2629('0x79')](_0x255d34[_0x2629('0x7a')]);});for(var _0x1fbe71=0x0;_0x1fbe71<_0xcc5371[_0x2629('0x4d')];_0x1fbe71++){if(_0xcc5371[_0x1fbe71]['system_mandatory']===![]){_0x323ef0[_0x2629('0x7b')]({'id':_0xcc5371[_0x1fbe71]['id'],'name':_0xcc5371[_0x1fbe71][_0x2629('0x7c')],'custom':_0xcc5371[_0x1fbe71][_0x2629('0x7d')],'options':_0xcc5371[_0x1fbe71][_0x2629('0x7e')]===_0x2629('0x7f')&&_0xcc5371[_0x1fbe71][_0x2629('0x80')][_0x2629('0x4d')]>-0x1?_[_0x2629('0x35')](_0xcc5371[_0x1fbe71][_0x2629('0x80')],function(_0x42210a){return{'name':_0x42210a,'value':_0x42210a};}):[]});}}return{'count':_0x323ef0[_0x2629('0x4d')],'rows':_0x323ef0};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x30f37c,null))[_0x2629('0x28')](function(_0x4e610c){var _0x2e8f8a=_0x395b70[_0x2629('0x3c')][_0x2629('0x1a')]?0x1f4:_0x4e610c['statusCode']||0x1f4;logger['error'](_0x2629('0x81'),'getFields',_0x2e8f8a,JSON[_0x2629('0x82')](_0x4e610c));delete _0x4e610c[_0x2629('0x34')];if(_0x2e8f8a===0x191){_0x2e8f8a=0x190;}_0x30f37c[_0x2629('0x2a')](_0x2e8f8a)[_0x2629('0x83')](_0x395b70['query'][_0x2629('0x1a')]?{'message':_0x2629('0x84'),'statusCode':_0x4e610c[_0x2629('0x85')]}:_0x4e610c);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 920c8ba..8191892 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 _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 +var _0x87f9=['code','host','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','POST','/oauth/v2/token','authorization_code','clientId','application/x-www-form-urlencoded','then','refresh_token','refreshToken','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','slice','https://accounts.zoho.com.cn','parse','info','lodash','../../config/logger','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl','clientSecret'];(function(_0x114984,_0x5c9593){var _0x44822b=function(_0x10af37){while(--_0x10af37){_0x114984['push'](_0x114984['shift']());}};_0x44822b(++_0x5c9593);}(_0x87f9,0x162));var _0x987f=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x87f9[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0x987f('0x0'));var util=require('util');var logger=require(_0x987f('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x987f('0x2'));var fs=require('fs');var path=require(_0x987f('0x3'));var rimraf=require(_0x987f('0x4'));var config=require(_0x987f('0x5'));var attributes=require(_0x987f('0x6'));var integrations=require(_0x987f('0x7'));module['exports']=function(_0x538541,_0x31ffc7){return _0x538541[_0x987f('0x8')](_0x987f('0x9'),attributes,{'tableName':_0x987f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x17d6aa,_0x2a0be7,_0xc1055d){if(_0x17d6aa['changed'](_0x987f('0xb'))||_0x17d6aa[_0x987f('0xc')](_0x987f('0xd'))||_0x17d6aa[_0x987f('0xc')]('clientId')||_0x17d6aa[_0x987f('0xc')](_0x987f('0xe'))||_0x17d6aa['changed'](_0x987f('0xf'))||_0x17d6aa[_0x987f('0xc')](_0x987f('0x10'))){var _0x2c9c5a,_0x5da82c;_0x2c9c5a=_0x17d6aa[_0x987f('0xd')];var _0x2a5272=_0x2c9c5a['slice'](-0x1);if(_0x2a5272==='/'||_0x2a5272==='\x5c'||_0x2a5272===':'){_0x2c9c5a=_0x2c9c5a[_0x987f('0x11')](0x0,_0x2c9c5a[_0x987f('0x12')](_0x2a5272));}switch(_0x17d6aa[_0x987f('0xb')]){case'US':_0x5da82c=_0x987f('0x13');break;case'AU':_0x5da82c=_0x987f('0x14');break;case'IN':_0x5da82c=_0x987f('0x15');break;case'CN':_0x5da82c='https://accounts.zoho.com.cn';break;default:_0x5da82c='https://accounts.zoho.eu';break;}var _0x442227={'method':_0x987f('0x16'),'uri':_0x5da82c+_0x987f('0x17'),'form':{'grant_type':_0x987f('0x18'),'client_id':_0x17d6aa[_0x987f('0x19')],'client_secret':_0x17d6aa[_0x987f('0xe')],'redirect_uri':_0x17d6aa[_0x987f('0xd')],'code':_0x17d6aa[_0x987f('0xf')]},'headers':{'Content-Type':_0x987f('0x1a')}};return rp(_0x442227)[_0x987f('0x1b')](function(_0x16bc43){var _0x40cff2=JSON['parse'](_0x16bc43);if(_0x40cff2[_0x987f('0x1c')]){_0x17d6aa[_0x987f('0x1d')]=_0x40cff2[_0x987f('0x1c')];logger['info'](util[_0x987f('0x1e')](_0x987f('0x1f'),_0x17d6aa[_0x987f('0x20')],_0x17d6aa['id']));}else{logger[_0x987f('0x21')](util[_0x987f('0x1e')](_0x987f('0x22'),_0x17d6aa['name'],_0x17d6aa['id']),util[_0x987f('0x23')](_0x40cff2,{'showHidden':![],'depth':null}));}return _0xc1055d(null,_0x2a0be7);})[_0x987f('0x24')](function(_0x1cf4c7){logger[_0x987f('0x21')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x17d6aa[_0x987f('0x20')],_0x17d6aa['id']),util[_0x987f('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0xc1055d(_0x1cf4c7);});}else{return _0xc1055d(null,_0x2a0be7);}},'beforeUpdate':function(_0x56123f,_0x426e71,_0x4a1e43){if(_0x56123f['changed']('zone')||_0x56123f[_0x987f('0xc')](_0x987f('0xd'))||_0x56123f[_0x987f('0xc')](_0x987f('0x19'))||_0x56123f['changed'](_0x987f('0xe'))||_0x56123f[_0x987f('0xc')](_0x987f('0xf'))||_0x56123f[_0x987f('0xc')](_0x987f('0x10'))){var _0xde0a2d,_0x25bda5;_0xde0a2d=_0x56123f[_0x987f('0xd')];var _0x2437a4=_0xde0a2d[_0x987f('0x25')](-0x1);if(_0x2437a4==='/'||_0x2437a4==='\x5c'||_0x2437a4===':'){_0xde0a2d=_0xde0a2d[_0x987f('0x11')](0x0,_0xde0a2d[_0x987f('0x12')](_0x2437a4));}switch(_0x56123f[_0x987f('0xb')]){case'US':_0x25bda5=_0x987f('0x13');break;case'AU':_0x25bda5=_0x987f('0x14');break;case'IN':_0x25bda5=_0x987f('0x15');break;case'CN':_0x25bda5=_0x987f('0x26');break;default:_0x25bda5='https://accounts.zoho.eu';break;}var _0x2074c4={'method':_0x987f('0x16'),'uri':_0x25bda5+_0x987f('0x17'),'form':{'grant_type':'authorization_code','client_id':_0x56123f['clientId'],'client_secret':_0x56123f[_0x987f('0xe')],'redirect_uri':_0x56123f[_0x987f('0xd')],'code':_0x56123f['code']},'headers':{'Content-Type':_0x987f('0x1a')}};return rp(_0x2074c4)[_0x987f('0x1b')](function(_0x10b38c){var _0x36d0b7=JSON[_0x987f('0x27')](_0x10b38c);if(_0x36d0b7['refresh_token']){_0x56123f['refreshToken']=_0x36d0b7[_0x987f('0x1c')];logger[_0x987f('0x28')](util[_0x987f('0x1e')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x56123f[_0x987f('0x20')],_0x56123f['id']));}else{logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x56123f[_0x987f('0x20')],_0x56123f['id']),util['inspect'](_0x36d0b7,{'showHidden':![],'depth':null}));}return _0x4a1e43(null,_0x426e71);})[_0x987f('0x24')](function(_0x2a9d82){logger[_0x987f('0x21')](util[_0x987f('0x1e')](_0x987f('0x22'),_0x56123f[_0x987f('0x20')],_0x56123f['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x4a1e43(_0x2a9d82);});}else{return _0x4a1e43(null,_0x426e71);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 5b0a706..5b78f52 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 _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 +var _0xf934=['jayson/promise','client','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','map','include','model','attributes','then','ShowZohoAccount','find','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xf934,0x7d));var _0x4f93=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0xf934[_0x20ef64];return _0x3707d8;};'use strict';var _=require(_0x4f93('0x0'));var util=require(_0x4f93('0x1'));var moment=require(_0x4f93('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f93('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f93('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f93('0x5'))(_0x4f93('0x6'));var config=require('../../config/environment');var jayson=require(_0x4f93('0x7'));var client=jayson[_0x4f93('0x8')][_0x4f93('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x453196,_0x357791,_0x3c0062){return new BPromise(function(_0x1af1c0,_0x5be9cb){return client[_0x4f93('0xa')](_0x453196,_0x3c0062)['then'](function(_0x42fc2e){logger[_0x4f93('0xb')](_0x4f93('0xc'),_0x357791,_0x4f93('0xd'));logger[_0x4f93('0xe')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x357791,_0x4f93('0xd'),JSON[_0x4f93('0xf')](_0x42fc2e));if(_0x42fc2e[_0x4f93('0x10')]){if(_0x42fc2e[_0x4f93('0x10')][_0x4f93('0x11')]===0x1f4){logger[_0x4f93('0x10')](_0x4f93('0xc'),_0x357791,_0x42fc2e['error'][_0x4f93('0x12')]);return _0x5be9cb(_0x42fc2e[_0x4f93('0x10')]['message']);}logger[_0x4f93('0x10')](_0x4f93('0xc'),_0x357791,_0x42fc2e[_0x4f93('0x10')][_0x4f93('0x12')]);return _0x1af1c0(_0x42fc2e[_0x4f93('0x10')]['message']);}else{logger['info']('ZohoAccount,\x20%s,\x20%s',_0x357791,_0x4f93('0xd'));_0x1af1c0(_0x42fc2e['result'][_0x4f93('0x12')]);}})[_0x4f93('0x13')](function(_0x4741fd){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x357791,_0x4741fd);_0x5be9cb(_0x4741fd);});});}exports[_0x4f93('0x14')]=function(_0x3c3285){var _0x4c983a=this;return new Promise(function(_0x474d0e,_0x48c43d){return db[_0x4f93('0x15')][_0x4f93('0x16')]({'raw':_0x3c3285[_0x4f93('0x17')]?_0x3c3285[_0x4f93('0x17')][_0x4f93('0x18')]===undefined?!![]:![]:!![],'where':_0x3c3285[_0x4f93('0x17')]?_0x3c3285[_0x4f93('0x17')][_0x4f93('0x19')]||null:null,'attributes':_0x3c3285[_0x4f93('0x17')]?_0x3c3285[_0x4f93('0x17')]['attributes']||null:null,'limit':_0x3c3285[_0x4f93('0x17')]?_0x3c3285[_0x4f93('0x17')]['limit']||null:null,'include':_0x3c3285[_0x4f93('0x17')]?_0x3c3285[_0x4f93('0x17')]['include']?_[_0x4f93('0x1a')](_0x3c3285['options'][_0x4f93('0x1b')],function(_0x1432d3){return{'model':db[_0x1432d3[_0x4f93('0x1c')]],'as':_0x1432d3['as'],'attributes':_0x1432d3[_0x4f93('0x1d')],'include':_0x1432d3[_0x4f93('0x1b')]?_['map'](_0x1432d3['include'],function(_0x5f416b){return{'model':db[_0x5f416b[_0x4f93('0x1c')]],'as':_0x5f416b['as'],'attributes':_0x5f416b[_0x4f93('0x1d')],'include':_0x5f416b[_0x4f93('0x1b')]?_['map'](_0x5f416b['include'],function(_0x2229e7){return{'model':db[_0x2229e7[_0x4f93('0x1c')]],'as':_0x2229e7['as'],'attributes':_0x2229e7['attributes']};}):[]};}):[]};}):[]:[]})[_0x4f93('0x1e')](function(_0x54c7ea){logger[_0x4f93('0xb')]('GetZohoAccount',_0x3c3285);logger[_0x4f93('0xe')](_0x4f93('0x14'),_0x3c3285,JSON[_0x4f93('0xf')](_0x54c7ea));_0x474d0e(_0x54c7ea);})['catch'](function(_0x20ce02){logger[_0x4f93('0x10')]('GetZohoAccount',_0x20ce02[_0x4f93('0x12')],_0x3c3285);_0x48c43d(_0x4c983a[_0x4f93('0x10')](0x1f4,_0x20ce02[_0x4f93('0x12')]));});});};exports[_0x4f93('0x1f')]=function(_0x49abae){var _0x19d06b=this;return new Promise(function(_0x78ad73,_0x3581c3){return db[_0x4f93('0x15')][_0x4f93('0x20')]({'raw':_0x49abae[_0x4f93('0x17')]?_0x49abae[_0x4f93('0x17')][_0x4f93('0x18')]===undefined?!![]:![]:!![],'where':_0x49abae[_0x4f93('0x17')]?_0x49abae['options'][_0x4f93('0x19')]||null:null,'attributes':_0x49abae[_0x4f93('0x17')]?_0x49abae['options']['attributes']||null:null,'include':_0x49abae['options']?_0x49abae[_0x4f93('0x17')]['include']?_['map'](_0x49abae[_0x4f93('0x17')][_0x4f93('0x1b')],function(_0xc9954f){return{'model':db[_0xc9954f[_0x4f93('0x1c')]],'as':_0xc9954f['as'],'attributes':_0xc9954f[_0x4f93('0x1d')],'include':_0xc9954f[_0x4f93('0x1b')]?_[_0x4f93('0x1a')](_0xc9954f[_0x4f93('0x1b')],function(_0x234394){return{'model':db[_0x234394[_0x4f93('0x1c')]],'as':_0x234394['as'],'attributes':_0x234394[_0x4f93('0x1d')],'include':_0x234394['include']?_[_0x4f93('0x1a')](_0x234394['include'],function(_0x167959){return{'model':db[_0x167959[_0x4f93('0x1c')]],'as':_0x167959['as'],'attributes':_0x167959[_0x4f93('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4f93('0x1e')](function(_0x26f6e5){logger[_0x4f93('0xb')](_0x4f93('0x1f'),_0x49abae);logger['debug'](_0x4f93('0x1f'),_0x49abae,JSON['stringify'](_0x26f6e5));_0x78ad73(_0x26f6e5);})['catch'](function(_0x3e8c7c){logger[_0x4f93('0x10')](_0x4f93('0x1f'),_0x3e8c7c[_0x4f93('0x12')],_0x49abae);_0x3581c3(_0x19d06b[_0x4f93('0x10')](0x1f4,_0x3e8c7c[_0x4f93('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index fa8e072..ffd2d56 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 _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 +var _0xd3a0=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','update','delete'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xd3a0,0xaa));var _0x0d3a=function(_0x285e4f,_0x531eae){_0x285e4f=_0x285e4f-0x0;var _0x3e2160=_0xd3a0[_0x285e4f];return _0x3e2160;};'use strict';var multer=require(_0x0d3a('0x0'));var util=require(_0x0d3a('0x1'));var path=require(_0x0d3a('0x2'));var timeout=require(_0x0d3a('0x3'));var express=require('express');var router=express[_0x0d3a('0x4')]();var auth=require(_0x0d3a('0x5'));var interaction=require(_0x0d3a('0x6'));var config=require(_0x0d3a('0x7'));var controller=require(_0x0d3a('0x8'));router['get']('/',auth[_0x0d3a('0x9')](),controller[_0x0d3a('0xa')]);router[_0x0d3a('0xb')](_0x0d3a('0xc'),auth[_0x0d3a('0x9')](),controller['show']);router[_0x0d3a('0xb')](_0x0d3a('0xd'),auth[_0x0d3a('0x9')](),controller[_0x0d3a('0xe')]);router[_0x0d3a('0xb')](_0x0d3a('0xf'),auth[_0x0d3a('0x9')](),controller['getSubjects']);router[_0x0d3a('0xb')](_0x0d3a('0x10'),auth['isAuthenticated'](),controller[_0x0d3a('0x11')]);router[_0x0d3a('0x12')]('/',auth[_0x0d3a('0x9')](),controller[_0x0d3a('0x13')]);router['put']('/:id',auth[_0x0d3a('0x9')](),controller[_0x0d3a('0x14')]);router[_0x0d3a('0x15')](_0x0d3a('0xc'),auth[_0x0d3a('0x9')](),controller[_0x0d3a('0x16')]);module[_0x0d3a('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index bf2cc23..4910169 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 _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 +var _0xac81=['STRING','exports','lead','contact','nothing','ENUM','contact_lead'];(function(_0x264a76,_0x3d1d8e){var _0x597faf=function(_0x410529){while(--_0x410529){_0x264a76['push'](_0x264a76['shift']());}};_0x597faf(++_0x3d1d8e);}(_0xac81,0x10b));var _0x1ac8=function(_0x5dff3f,_0x40c176){_0x5dff3f=_0x5dff3f-0x0;var _0x328d33=_0xac81[_0x5dff3f];return _0x328d33;};'use strict';var Sequelize=require('sequelize');module[_0x1ac8('0x0')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize['ENUM'](_0x1ac8('0x1'),_0x1ac8('0x2'),_0x1ac8('0x3')),'defaultValue':_0x1ac8('0x1')},'moduleSearch':{'type':Sequelize[_0x1ac8('0x4')](_0x1ac8('0x5'),_0x1ac8('0x2'),_0x1ac8('0x1')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x1ac8('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 7b40f0d..1ce18e9 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 _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 +var _0xcc4a=['../../config/environment','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~!@#$%^&-_=+[{]}.','request','then','debug','request\x20sent','stringify','code','error','ZohoConfiguration,\x20%s,\x20%s','message','info','catch','status','end','offset','limit','set','apply','update','destroy','sendStatus','name','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','count','includeAll','include','ZohoConfiguration','rows','show','params','create','body','find','getFields','findOne','ZohoField','pick','options','getSubjects','rawAttributes','getDescriptions','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x1ff8ef,_0x36aeb3){var _0x76cfd7=function(_0x5980f3){while(--_0x5980f3){_0x1ff8ef['push'](_0x1ff8ef['shift']());}};_0x76cfd7(++_0x36aeb3);}(_0xcc4a,0x1a2));var _0xacc4=function(_0xabc969,_0x3be113){_0xabc969=_0xabc969-0x0;var _0x436f3c=_0xcc4a[_0xabc969];return _0x436f3c;};'use strict';var pdf=require(_0xacc4('0x0'));var emlformat=require(_0xacc4('0x1'));var rimraf=require(_0xacc4('0x2'));var zipdir=require(_0xacc4('0x3'));var jsonpatch=require(_0xacc4('0x4'));var rp=require('request-promise');var moment=require(_0xacc4('0x5'));var BPromise=require(_0xacc4('0x6'));var Mustache=require('mustache');var util=require(_0xacc4('0x7'));var path=require('path');var sox=require(_0xacc4('0x8'));var csv=require('to-csv');var ejs=require(_0xacc4('0x9'));var fs=require('fs');var _=require(_0xacc4('0xa'));var squel=require('squel');var crypto=require(_0xacc4('0xb'));var jsforce=require(_0xacc4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xacc4('0xd'));var querystring=require(_0xacc4('0xe'));var Papa=require(_0xacc4('0xf'));var Redis=require(_0xacc4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xacc4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xacc4('0x12'));var logger=require(_0xacc4('0x13'))(_0xacc4('0x14'));var utils=require(_0xacc4('0x15'));var config=require(_0xacc4('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0xacc4('0x17'));var client=jayson['client'][_0xacc4('0x18')]({'port':0x232a});function checkPasswordPattern(_0x175421,_0x53635e,_0x16e44c){if(_0x16e44c){var _0x397478=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x397478[_0xacc4('0x19')](_0x53635e)){return _0x175421;}else{throw new db[(_0xacc4('0x1a'))]['ValidationError'](_0xacc4('0x1b'));}}else{return _0x175421;}}function respondWithRpcPromise(_0x593f9a,_0x3db256,_0x4ff3ab,_0x145f0c){return new BPromise(function(_0x12c055,_0x4ad0ab){var _0x36abd8=_0x145f0c||client;return _0x36abd8[_0xacc4('0x1c')](_0x593f9a,_0x4ff3ab)[_0xacc4('0x1d')](function(_0x2427fa){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x3db256,'request\x20sent');logger[_0xacc4('0x1e')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x3db256,_0xacc4('0x1f'),JSON[_0xacc4('0x20')](_0x2427fa));if(_0x2427fa['error']){if(_0x2427fa['error'][_0xacc4('0x21')]===0x1f4){logger[_0xacc4('0x22')](_0xacc4('0x23'),_0x3db256,_0x2427fa[_0xacc4('0x22')][_0xacc4('0x24')]);return _0x4ad0ab(_0x2427fa['error'][_0xacc4('0x24')]);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x3db256,_0x2427fa[_0xacc4('0x22')][_0xacc4('0x24')]);return _0x12c055(_0x2427fa['error'][_0xacc4('0x24')]);}else{logger[_0xacc4('0x25')](_0xacc4('0x23'),_0x3db256,_0xacc4('0x1f'));_0x12c055(_0x2427fa['result'][_0xacc4('0x24')]);}})[_0xacc4('0x26')](function(_0x476568){logger[_0xacc4('0x22')](_0xacc4('0x23'),_0x3db256,_0x476568);_0x4ad0ab(_0x476568);});});}function respondWithStatusCode(_0x1f58f1,_0x14670c){_0x14670c=_0x14670c||0xcc;return function(_0x51d18c){if(_0x51d18c){return _0x1f58f1['sendStatus'](_0x14670c);}return _0x1f58f1[_0xacc4('0x27')](_0x14670c)[_0xacc4('0x28')]();};}function respondWithResult(_0xc3871a,_0x132908){_0x132908=_0x132908||0xc8;return function(_0x3334b9){if(_0x3334b9){return _0xc3871a[_0xacc4('0x27')](_0x132908)['json'](_0x3334b9);}};}function respondWithFilteredResult(_0x257fa9,_0x38364d){return function(_0x2eb012){if(_0x2eb012){var _0x551022=_0x2eb012['count'],_0xcbb0b0=_0x38364d[_0xacc4('0x29')],_0x44dfa4=_0x38364d[_0xacc4('0x29')]+_0x38364d[_0xacc4('0x2a')],_0x136326;if(_0x44dfa4>=_0x551022){_0x44dfa4=_0x551022;_0x136326=0xc8;}else{_0x136326=0xce;}_0x257fa9[_0xacc4('0x27')](_0x136326);return _0x257fa9[_0xacc4('0x2b')]('Content-Range',_0xcbb0b0+'-'+_0x44dfa4+'/'+_0x551022)['json'](_0x2eb012);}return null;};}function patchUpdates(_0x2be3f4){return function(_0x41042f){try{jsonpatch[_0xacc4('0x2c')](_0x41042f,_0x2be3f4,!![]);}catch(_0x59dd5b){return BPromise['reject'](_0x59dd5b);}return _0x41042f['save']();};}function saveUpdates(_0x445db0,_0x2f8443){return function(_0x9f2376){if(_0x9f2376){return _0x9f2376[_0xacc4('0x2d')](_0x445db0)[_0xacc4('0x1d')](function(_0x13abb0){return _0x13abb0;});}return null;};}function removeEntity(_0x203857,_0x5d37b0){return function(_0x57c823){if(_0x57c823){return _0x57c823[_0xacc4('0x2e')]()[_0xacc4('0x1d')](function(){_0x203857['status'](0xcc)[_0xacc4('0x28')]();});}};}function handleEntityNotFound(_0x3cc133,_0x500914){return function(_0xf17a79){if(!_0xf17a79){_0x3cc133[_0xacc4('0x2f')](0x194);}return _0xf17a79;};}function handleError(_0x311670,_0x1c7b70){_0x1c7b70=_0x1c7b70||0x1f4;return function(_0x2d30d3){logger[_0xacc4('0x22')](_0x2d30d3['stack']);if(_0x2d30d3['name']){delete _0x2d30d3[_0xacc4('0x30')];}_0x311670[_0xacc4('0x27')](_0x1c7b70)['send'](_0x2d30d3);};}exports[_0xacc4('0x31')]=function(_0x3ff60c,_0x42adc9){var _0x52276f={},_0x524bf3={},_0x150eb1={'count':0x0,'rows':[]};var _0x4b1e4f=_[_0xacc4('0x32')](db['ZohoConfiguration']['rawAttributes'],function(_0x37504d){return{'name':_0x37504d[_0xacc4('0x33')],'type':_0x37504d[_0xacc4('0x34')][_0xacc4('0x35')]};});_0x524bf3[_0xacc4('0x36')]=_[_0xacc4('0x32')](_0x4b1e4f,_0xacc4('0x30'));_0x524bf3[_0xacc4('0x37')]=_[_0xacc4('0x38')](_0x3ff60c[_0xacc4('0x37')]);_0x524bf3[_0xacc4('0x39')]=_['intersection'](_0x524bf3['model'],_0x524bf3[_0xacc4('0x37')]);_0x52276f[_0xacc4('0x3a')]=_[_0xacc4('0x3b')](_0x524bf3[_0xacc4('0x36')],qs['fields'](_0x3ff60c[_0xacc4('0x37')][_0xacc4('0x3c')]));_0x52276f[_0xacc4('0x3a')]=_0x52276f[_0xacc4('0x3a')][_0xacc4('0x3d')]?_0x52276f['attributes']:_0x524bf3[_0xacc4('0x36')];if(!_0x3ff60c[_0xacc4('0x37')]['hasOwnProperty'](_0xacc4('0x3e'))){_0x52276f[_0xacc4('0x2a')]=qs[_0xacc4('0x2a')](_0x3ff60c['query']['limit']);_0x52276f[_0xacc4('0x29')]=qs['offset'](_0x3ff60c[_0xacc4('0x37')][_0xacc4('0x29')]);}_0x52276f[_0xacc4('0x3f')]=qs['sort'](_0x3ff60c[_0xacc4('0x37')][_0xacc4('0x40')]);_0x52276f[_0xacc4('0x41')]=qs['filters'](_['pick'](_0x3ff60c['query'],_0x524bf3['filters']),_0x4b1e4f);if(_0x3ff60c[_0xacc4('0x37')][_0xacc4('0x42')]){_0x52276f[_0xacc4('0x41')]=_[_0xacc4('0x43')](_0x52276f['where'],{'$or':_[_0xacc4('0x32')](_0x4b1e4f,function(_0x3483e9){if(_0x3483e9[_0xacc4('0x34')]!==_0xacc4('0x44')){var _0x3d794f={};_0x3d794f[_0x3483e9[_0xacc4('0x30')]]={'$like':'%'+_0x3ff60c['query'][_0xacc4('0x42')]+'%'};return _0x3d794f;}})});}_0x52276f=_['merge']({},_0x52276f,_0x3ff60c['options']);var _0x432579={'where':_0x52276f['where']};return db['ZohoConfiguration'][_0xacc4('0x45')](_0x432579)[_0xacc4('0x1d')](function(_0x3b4253){_0x150eb1[_0xacc4('0x45')]=_0x3b4253;if(_0x3ff60c[_0xacc4('0x37')][_0xacc4('0x46')]){_0x52276f[_0xacc4('0x47')]=[{'all':!![]}];}return db[_0xacc4('0x48')]['findAll'](_0x52276f);})['then'](function(_0x4a5bea){_0x150eb1[_0xacc4('0x49')]=_0x4a5bea;return _0x150eb1;})['then'](respondWithFilteredResult(_0x42adc9,_0x52276f))[_0xacc4('0x26')](handleError(_0x42adc9,null));};exports[_0xacc4('0x4a')]=function(_0x2ac2cc,_0x142e54){var _0x4f0616={'raw':![],'where':{'id':_0x2ac2cc[_0xacc4('0x4b')]['id']}},_0x589629={};_0x589629[_0xacc4('0x36')]=_['keys'](db[_0xacc4('0x48')]['rawAttributes']);_0x589629[_0xacc4('0x37')]=_['keys'](_0x2ac2cc[_0xacc4('0x37')]);_0x589629['filters']=_['intersection'](_0x589629[_0xacc4('0x36')],_0x589629['query']);_0x4f0616[_0xacc4('0x3a')]=_[_0xacc4('0x3b')](_0x589629[_0xacc4('0x36')],qs[_0xacc4('0x3c')](_0x2ac2cc[_0xacc4('0x37')][_0xacc4('0x3c')]));_0x4f0616[_0xacc4('0x3a')]=_0x4f0616[_0xacc4('0x3a')]['length']?_0x4f0616['attributes']:_0x589629['model'];if(_0x2ac2cc[_0xacc4('0x37')][_0xacc4('0x46')]){_0x4f0616[_0xacc4('0x47')]=[{'all':!![]}];}_0x4f0616=_['merge']({},_0x4f0616,_0x2ac2cc['options']);return db[_0xacc4('0x48')]['find'](_0x4f0616)[_0xacc4('0x1d')](handleEntityNotFound(_0x142e54,null))[_0xacc4('0x1d')](respondWithResult(_0x142e54,null))[_0xacc4('0x26')](handleError(_0x142e54,null));};exports[_0xacc4('0x4c')]=function(_0x10f7f6,_0x42d978){return db[_0xacc4('0x48')]['create'](_0x10f7f6[_0xacc4('0x4d')],{})[_0xacc4('0x1d')](respondWithResult(_0x42d978,0xc9))[_0xacc4('0x26')](handleError(_0x42d978,null));};exports[_0xacc4('0x2d')]=function(_0xe9af7d,_0x17c911){if(_0xe9af7d[_0xacc4('0x4d')]['id']){delete _0xe9af7d['body']['id'];}return db[_0xacc4('0x48')][_0xacc4('0x4e')]({'where':{'id':_0xe9af7d[_0xacc4('0x4b')]['id']}})[_0xacc4('0x1d')](handleEntityNotFound(_0x17c911,null))[_0xacc4('0x1d')](saveUpdates(_0xe9af7d['body'],null))[_0xacc4('0x1d')](respondWithResult(_0x17c911,null))[_0xacc4('0x26')](handleError(_0x17c911,null));};exports[_0xacc4('0x2e')]=function(_0x13232f,_0x42253b){return db[_0xacc4('0x48')][_0xacc4('0x4e')]({'where':{'id':_0x13232f[_0xacc4('0x4b')]['id']}})[_0xacc4('0x1d')](handleEntityNotFound(_0x42253b,null))['then'](removeEntity(_0x42253b,null))[_0xacc4('0x26')](handleError(_0x42253b,null));};exports[_0xacc4('0x4f')]=function(_0x3e57b7,_0x79c25a,_0x3b9e97){var _0x5d04e6={};var _0x252be5={};var _0x413979;var _0x189693;return db[_0xacc4('0x48')][_0xacc4('0x50')]({'where':{'id':_0x3e57b7[_0xacc4('0x4b')]['id']}})[_0xacc4('0x1d')](handleEntityNotFound(_0x79c25a,null))[_0xacc4('0x1d')](function(_0x26cdae){if(_0x26cdae){_0x413979=_0x26cdae;_0x252be5['model']=_[_0xacc4('0x38')](db[_0xacc4('0x51')]['rawAttributes']);_0x252be5[_0xacc4('0x37')]=_[_0xacc4('0x38')](_0x3e57b7['query']);_0x252be5[_0xacc4('0x39')]=_['intersection'](_0x252be5[_0xacc4('0x36')],_0x252be5[_0xacc4('0x37')]);_0x5d04e6['attributes']=_[_0xacc4('0x3b')](_0x252be5['model'],qs['fields'](_0x3e57b7[_0xacc4('0x37')]['fields']));_0x5d04e6['attributes']=_0x5d04e6[_0xacc4('0x3a')][_0xacc4('0x3d')]?_0x5d04e6[_0xacc4('0x3a')]:_0x252be5[_0xacc4('0x36')];_0x5d04e6['order']=qs[_0xacc4('0x40')](_0x3e57b7[_0xacc4('0x37')][_0xacc4('0x40')]);_0x5d04e6[_0xacc4('0x41')]=qs['filters'](_[_0xacc4('0x52')](_0x3e57b7[_0xacc4('0x37')],_0x252be5[_0xacc4('0x39')]));if(_0x3e57b7['query'][_0xacc4('0x42')]){_0x5d04e6[_0xacc4('0x41')]=_[_0xacc4('0x43')](_0x5d04e6[_0xacc4('0x41')],{'$or':_[_0xacc4('0x32')](_0x5d04e6['attributes'],function(_0x462b6f){var _0x5c7bcf={};_0x5c7bcf[_0x462b6f]={'$like':'%'+_0x3e57b7[_0xacc4('0x37')]['filter']+'%'};return _0x5c7bcf;})});}_0x5d04e6=_['merge']({},_0x5d04e6,_0x3e57b7[_0xacc4('0x53')]);return _0x413979['getFields'](_0x5d04e6);}})[_0xacc4('0x1d')](function(_0x13c12d){if(_0x13c12d){_0x189693=_0x13c12d[_0xacc4('0x3d')];if(!_0x3e57b7[_0xacc4('0x37')]['hasOwnProperty'](_0xacc4('0x3e'))){_0x5d04e6[_0xacc4('0x2a')]=qs[_0xacc4('0x2a')](_0x3e57b7[_0xacc4('0x37')]['limit']);_0x5d04e6[_0xacc4('0x29')]=qs[_0xacc4('0x29')](_0x3e57b7[_0xacc4('0x37')][_0xacc4('0x29')]);}return _0x413979['getFields'](_0x5d04e6);}})[_0xacc4('0x1d')](function(_0x378963){if(_0x378963){return _0x378963?{'count':_0x189693,'rows':_0x378963}:null;}})[_0xacc4('0x1d')](respondWithResult(_0x79c25a,null))[_0xacc4('0x26')](handleError(_0x79c25a,null));};exports[_0xacc4('0x54')]=function(_0x23c16f,_0x57a0eb,_0x53cfb9){var _0x2f6c48={};var _0x19c07b={};var _0x25a683;var _0x45a27a;return db[_0xacc4('0x48')]['findOne']({'where':{'id':_0x23c16f[_0xacc4('0x4b')]['id']}})[_0xacc4('0x1d')](handleEntityNotFound(_0x57a0eb,null))[_0xacc4('0x1d')](function(_0x593ad0){if(_0x593ad0){_0x25a683=_0x593ad0;_0x19c07b[_0xacc4('0x36')]=_[_0xacc4('0x38')](db[_0xacc4('0x51')][_0xacc4('0x55')]);_0x19c07b[_0xacc4('0x37')]=_[_0xacc4('0x38')](_0x23c16f['query']);_0x19c07b['filters']=_[_0xacc4('0x3b')](_0x19c07b['model'],_0x19c07b[_0xacc4('0x37')]);_0x2f6c48[_0xacc4('0x3a')]=_['intersection'](_0x19c07b[_0xacc4('0x36')],qs[_0xacc4('0x3c')](_0x23c16f[_0xacc4('0x37')][_0xacc4('0x3c')]));_0x2f6c48['attributes']=_0x2f6c48[_0xacc4('0x3a')][_0xacc4('0x3d')]?_0x2f6c48[_0xacc4('0x3a')]:_0x19c07b[_0xacc4('0x36')];_0x2f6c48[_0xacc4('0x3f')]=qs[_0xacc4('0x40')](_0x23c16f[_0xacc4('0x37')][_0xacc4('0x40')]);_0x2f6c48[_0xacc4('0x41')]=qs[_0xacc4('0x39')](_[_0xacc4('0x52')](_0x23c16f[_0xacc4('0x37')],_0x19c07b[_0xacc4('0x39')]));if(_0x23c16f[_0xacc4('0x37')][_0xacc4('0x42')]){_0x2f6c48[_0xacc4('0x41')]=_[_0xacc4('0x43')](_0x2f6c48[_0xacc4('0x41')],{'$or':_[_0xacc4('0x32')](_0x2f6c48[_0xacc4('0x3a')],function(_0x58dc0d){var _0x419397={};_0x419397[_0x58dc0d]={'$like':'%'+_0x23c16f[_0xacc4('0x37')][_0xacc4('0x42')]+'%'};return _0x419397;})});}_0x2f6c48=_[_0xacc4('0x43')]({},_0x2f6c48,_0x23c16f[_0xacc4('0x53')]);return _0x25a683[_0xacc4('0x54')](_0x2f6c48);}})[_0xacc4('0x1d')](function(_0xae613f){if(_0xae613f){_0x45a27a=_0xae613f[_0xacc4('0x3d')];if(!_0x23c16f['query']['hasOwnProperty'](_0xacc4('0x3e'))){_0x2f6c48[_0xacc4('0x2a')]=qs[_0xacc4('0x2a')](_0x23c16f['query'][_0xacc4('0x2a')]);_0x2f6c48['offset']=qs[_0xacc4('0x29')](_0x23c16f[_0xacc4('0x37')]['offset']);}return _0x25a683[_0xacc4('0x54')](_0x2f6c48);}})['then'](function(_0x335fe5){if(_0x335fe5){return _0x335fe5?{'count':_0x45a27a,'rows':_0x335fe5}:null;}})[_0xacc4('0x1d')](respondWithResult(_0x57a0eb,null))[_0xacc4('0x26')](handleError(_0x57a0eb,null));};exports[_0xacc4('0x56')]=function(_0xd1268c,_0x530009,_0x1dbc6e){var _0x7f9b6={};var _0x3740b3={};var _0x10767e;var _0x434b2d;return db['ZohoConfiguration']['findOne']({'where':{'id':_0xd1268c[_0xacc4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x530009,null))['then'](function(_0x541f1c){if(_0x541f1c){_0x10767e=_0x541f1c;_0x3740b3[_0xacc4('0x36')]=_[_0xacc4('0x38')](db[_0xacc4('0x51')][_0xacc4('0x55')]);_0x3740b3[_0xacc4('0x37')]=_['keys'](_0xd1268c[_0xacc4('0x37')]);_0x3740b3['filters']=_[_0xacc4('0x3b')](_0x3740b3['model'],_0x3740b3[_0xacc4('0x37')]);_0x7f9b6[_0xacc4('0x3a')]=_[_0xacc4('0x3b')](_0x3740b3[_0xacc4('0x36')],qs[_0xacc4('0x3c')](_0xd1268c[_0xacc4('0x37')]['fields']));_0x7f9b6[_0xacc4('0x3a')]=_0x7f9b6[_0xacc4('0x3a')][_0xacc4('0x3d')]?_0x7f9b6[_0xacc4('0x3a')]:_0x3740b3['model'];_0x7f9b6[_0xacc4('0x3f')]=qs['sort'](_0xd1268c[_0xacc4('0x37')]['sort']);_0x7f9b6['where']=qs[_0xacc4('0x39')](_[_0xacc4('0x52')](_0xd1268c[_0xacc4('0x37')],_0x3740b3[_0xacc4('0x39')]));if(_0xd1268c['query']['filter']){_0x7f9b6[_0xacc4('0x41')]=_['merge'](_0x7f9b6[_0xacc4('0x41')],{'$or':_[_0xacc4('0x32')](_0x7f9b6[_0xacc4('0x3a')],function(_0x48b785){var _0x4af16d={};_0x4af16d[_0x48b785]={'$like':'%'+_0xd1268c['query']['filter']+'%'};return _0x4af16d;})});}_0x7f9b6=_['merge']({},_0x7f9b6,_0xd1268c['options']);return _0x10767e[_0xacc4('0x56')](_0x7f9b6);}})['then'](function(_0x2ce931){if(_0x2ce931){_0x434b2d=_0x2ce931['length'];if(!_0xd1268c[_0xacc4('0x37')][_0xacc4('0x57')](_0xacc4('0x3e'))){_0x7f9b6['limit']=qs[_0xacc4('0x2a')](_0xd1268c[_0xacc4('0x37')]['limit']);_0x7f9b6['offset']=qs[_0xacc4('0x29')](_0xd1268c[_0xacc4('0x37')][_0xacc4('0x29')]);}return _0x10767e[_0xacc4('0x56')](_0x7f9b6);}})[_0xacc4('0x1d')](function(_0x5d286c){if(_0x5d286c){return _0x5d286c?{'count':_0x434b2d,'rows':_0x5d286c}:null;}})['then'](respondWithResult(_0x530009,null))[_0xacc4('0x26')](handleError(_0x530009,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index f26da47..c83780d 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 _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 +var _0xbfc6=['bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api'];(function(_0x30f1f5,_0x3d2b0c){var _0x2427ab=function(_0x13a71b){while(--_0x13a71b){_0x30f1f5['push'](_0x30f1f5['shift']());}};_0x2427ab(++_0x3d2b0c);}(_0xbfc6,0x176));var _0x6bfc=function(_0x4636c3,_0x4ebaba){_0x4636c3=_0x4636c3-0x0;var _0x44811c=_0xbfc6[_0x4636c3];return _0x44811c;};'use strict';var _=require(_0x6bfc('0x0'));var util=require(_0x6bfc('0x1'));var logger=require(_0x6bfc('0x2'))(_0x6bfc('0x3'));var moment=require('moment');var BPromise=require(_0x6bfc('0x4'));var rp=require(_0x6bfc('0x5'));var fs=require('fs');var path=require(_0x6bfc('0x6'));var rimraf=require(_0x6bfc('0x7'));var config=require(_0x6bfc('0x8'));var attributes=require(_0x6bfc('0x9'));module[_0x6bfc('0xa')]=function(_0x5a55fd,_0x58f557){return _0x5a55fd[_0x6bfc('0xb')](_0x6bfc('0xc'),attributes,{'tableName':_0x6bfc('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index b7d156c..1ce8999 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 _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 +var _0x98e7=['moment','randomstring','../../config/logger','../../config/environment','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','util'];(function(_0x19af41,_0x598931){var _0x3ec287=function(_0x4395a7){while(--_0x4395a7){_0x19af41['push'](_0x19af41['shift']());}};_0x3ec287(++_0x598931);}(_0x98e7,0xb3));var _0x798e=function(_0x292891,_0x426567){_0x292891=_0x292891-0x0;var _0x5913aa=_0x98e7[_0x292891];return _0x5913aa;};'use strict';var _=require('lodash');var util=require(_0x798e('0x0'));var moment=require(_0x798e('0x1'));var BPromise=require('bluebird');var rs=require(_0x798e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x798e('0x3'))('rpc');var config=require(_0x798e('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0x798e('0x5')]({'port':0x232a});function respondWithRpcPromise(_0xd7da48,_0x134689,_0x3accfe){return new BPromise(function(_0x5311d8,_0xd9384e){return client[_0x798e('0x6')](_0xd7da48,_0x3accfe)[_0x798e('0x7')](function(_0x50da18){logger['info'](_0x798e('0x8'),_0x134689,_0x798e('0x9'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x134689,_0x798e('0x9'),JSON[_0x798e('0xa')](_0x50da18));if(_0x50da18[_0x798e('0xb')]){if(_0x50da18[_0x798e('0xb')]['code']===0x1f4){logger[_0x798e('0xb')](_0x798e('0x8'),_0x134689,_0x50da18['error'][_0x798e('0xc')]);return _0xd9384e(_0x50da18['error'][_0x798e('0xc')]);}logger[_0x798e('0xb')](_0x798e('0x8'),_0x134689,_0x50da18['error'][_0x798e('0xc')]);return _0x5311d8(_0x50da18['error'][_0x798e('0xc')]);}else{logger[_0x798e('0xd')](_0x798e('0x8'),_0x134689,_0x798e('0x9'));_0x5311d8(_0x50da18['result'][_0x798e('0xc')]);}})[_0x798e('0xe')](function(_0x5b231d){logger[_0x798e('0xb')](_0x798e('0x8'),_0x134689,_0x5b231d);_0xd9384e(_0x5b231d);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 8229f15..58725d3 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 _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 +var _0x4991=['get','isAuthenticated','/:id','show','post','create','put','update','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller'];(function(_0x58fc31,_0x782e52){var _0x467a82=function(_0x3fe8b9){while(--_0x3fe8b9){_0x58fc31['push'](_0x58fc31['shift']());}};_0x467a82(++_0x782e52);}(_0x4991,0xf7));var _0x1499=function(_0x2c8829,_0x3a656b){_0x2c8829=_0x2c8829-0x0;var _0x4189ee=_0x4991[_0x2c8829];return _0x4189ee;};'use strict';var multer=require(_0x1499('0x0'));var util=require('util');var path=require(_0x1499('0x1'));var timeout=require('connect-timeout');var express=require(_0x1499('0x2'));var router=express[_0x1499('0x3')]();var auth=require(_0x1499('0x4'));var interaction=require(_0x1499('0x5'));var config=require(_0x1499('0x6'));var controller=require(_0x1499('0x7'));router[_0x1499('0x8')]('/',auth[_0x1499('0x9')](),controller['index']);router[_0x1499('0x8')](_0x1499('0xa'),auth[_0x1499('0x9')](),controller[_0x1499('0xb')]);router[_0x1499('0xc')]('/',auth[_0x1499('0x9')](),controller[_0x1499('0xd')]);router[_0x1499('0xe')]('/:id',auth[_0x1499('0x9')](),controller[_0x1499('0xf')]);router['delete'](_0x1499('0xa'),auth[_0x1499('0x9')](),controller['destroy']);module[_0x1499('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index c744e72..88258c0 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 _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 +var _0x54da=['string','STRING','sequelize','ENUM','customVariable'];(function(_0x4c4986,_0x5ed332){var _0x496d43=function(_0x40dac2){while(--_0x40dac2){_0x4c4986['push'](_0x4c4986['shift']());}};_0x496d43(++_0x5ed332);}(_0x54da,0x9d));var _0xa54d=function(_0x21d246,_0x4888f1){_0x21d246=_0x21d246-0x0;var _0x8656f0=_0x54da[_0x21d246];return _0x8656f0;};'use strict';var Sequelize=require(_0xa54d('0x0'));module['exports']={'type':{'type':Sequelize[_0xa54d('0x1')]('string','variable',_0xa54d('0x2'),'keyValue'),'defaultValue':_0xa54d('0x3')},'content':{'type':Sequelize[_0xa54d('0x4')]},'key':{'type':Sequelize[_0xa54d('0x4')]},'keyType':{'type':Sequelize[_0xa54d('0x1')]('string','variable',_0xa54d('0x2'))},'keyContent':{'type':Sequelize[_0xa54d('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa54d('0x4')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index ca5f777..f770d5a 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(_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 +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(_0x50c674,_0x3e5bb4){var _0x5453b5=function(_0x5efaba){while(--_0x5efaba){_0x50c674['push'](_0x50c674['shift']());}};_0x5453b5(++_0x3e5bb4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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 b79e4b5..49dc836 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 _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 +var _0x3c96=['lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField'];(function(_0x8550b9,_0x101b46){var _0x1cacce=function(_0x24092c){while(--_0x24092c){_0x8550b9['push'](_0x8550b9['shift']());}};_0x1cacce(++_0x101b46);}(_0x3c96,0xf7));var _0x63c9=function(_0x76bf32,_0x58c9a1){_0x76bf32=_0x76bf32-0x0;var _0x46c2fd=_0x3c96[_0x76bf32];return _0x46c2fd;};'use strict';var _=require(_0x63c9('0x0'));var util=require('util');var logger=require(_0x63c9('0x1'))(_0x63c9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x63c9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x63c9('0x4'));var config=require(_0x63c9('0x5'));var attributes=require(_0x63c9('0x6'));module[_0x63c9('0x7')]=function(_0x2095af,_0x4c9778){return _0x2095af[_0x63c9('0x8')](_0x63c9('0x9'),attributes,{'tableName':_0x63c9('0xa'),'paranoid':![],'indexes':[{'name':_0x63c9('0xb'),'fields':[_0x63c9('0xc'),'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 144f7d3..1ecc616 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 _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 +var _0x5636=['code','ZohoField,\x20%s,\x20%s','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5636,0x102));var _0x6563=function(_0x5eefad,_0x472be5){_0x5eefad=_0x5eefad-0x0;var _0x4103d2=_0x5636[_0x5eefad];return _0x4103d2;};'use strict';var _=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6563('0x2'));var db=require(_0x6563('0x3'))['db'];var utils=require(_0x6563('0x4'));var logger=require('../../config/logger')(_0x6563('0x5'));var config=require(_0x6563('0x6'));var jayson=require(_0x6563('0x7'));var client=jayson[_0x6563('0x8')][_0x6563('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x193942,_0x9884a9,_0x2d57d5){return new BPromise(function(_0x2d0d5b,_0x98fcd4){return client[_0x6563('0xa')](_0x193942,_0x2d57d5)[_0x6563('0xb')](function(_0x3ccb4e){logger['info']('ZohoField,\x20%s,\x20%s',_0x9884a9,_0x6563('0xc'));logger[_0x6563('0xd')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x9884a9,'request\x20sent',JSON['stringify'](_0x3ccb4e));if(_0x3ccb4e[_0x6563('0xe')]){if(_0x3ccb4e[_0x6563('0xe')][_0x6563('0xf')]===0x1f4){logger[_0x6563('0xe')](_0x6563('0x10'),_0x9884a9,_0x3ccb4e[_0x6563('0xe')][_0x6563('0x11')]);return _0x98fcd4(_0x3ccb4e[_0x6563('0xe')][_0x6563('0x11')]);}logger['error'](_0x6563('0x10'),_0x9884a9,_0x3ccb4e['error'][_0x6563('0x11')]);return _0x2d0d5b(_0x3ccb4e[_0x6563('0xe')][_0x6563('0x11')]);}else{logger[_0x6563('0x12')]('ZohoField,\x20%s,\x20%s',_0x9884a9,_0x6563('0xc'));_0x2d0d5b(_0x3ccb4e[_0x6563('0x13')][_0x6563('0x11')]);}})[_0x6563('0x14')](function(_0x4e7282){logger[_0x6563('0xe')]('ZohoField,\x20%s,\x20%s',_0x9884a9,_0x4e7282);_0x98fcd4(_0x4e7282);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 3a1f199..69c7af5 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 _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 +var _0x9cbb=['../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x550613,_0x257643){var _0x6f7662=function(_0x56d98d){while(--_0x56d98d){_0x550613['push'](_0x550613['shift']());}};_0x6f7662(++_0x257643);}(_0x9cbb,0xf6));var _0xb9cb=function(_0x19fb2b,_0x212bd8){_0x19fb2b=_0x19fb2b-0x0;var _0x3be612=_0x9cbb[_0x19fb2b];return _0x3be612;};'use strict';var multer=require(_0xb9cb('0x0'));var util=require(_0xb9cb('0x1'));var path=require(_0xb9cb('0x2'));var timeout=require(_0xb9cb('0x3'));var express=require(_0xb9cb('0x4'));var router=express['Router']();var auth=require(_0xb9cb('0x5'));var interaction=require(_0xb9cb('0x6'));var config=require(_0xb9cb('0x7'));module[_0xb9cb('0x8')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index b491242..bc3f4a1 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 _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 +var _0x9de3=['BOOLEAN','state','sequelize','exports','unique_name_and_version','STRING','app.js','INTEGER'];(function(_0x1a710d,_0x28023f){var _0x2b2621=function(_0x5b5eb4){while(--_0x5b5eb4){_0x1a710d['push'](_0x1a710d['shift']());}};_0x2b2621(++_0x28023f);}(_0x9de3,0x7a));var _0x39de=function(_0x2bcea7,_0xb981bb){_0x2bcea7=_0x2bcea7-0x0;var _0x33fe90=_0x9de3[_0x2bcea7];return _0x33fe90;};'use strict';var Sequelize=require(_0x39de('0x0'));module[_0x39de('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x39de('0x2')},'version':{'type':Sequelize[_0x39de('0x3')],'allowNull':![],'unique':_0x39de('0x2')},'main':{'type':Sequelize[_0x39de('0x3')],'defaultValue':_0x39de('0x4')},'filename':{'type':Sequelize[_0x39de('0x3')]},'path':{'type':Sequelize[_0x39de('0x3')]},'type':{'type':Sequelize[_0x39de('0x3')]},'size':{'type':Sequelize[_0x39de('0x5')]},'active':{'type':Sequelize[_0x39de('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x39de('0x3')]},'state':{'type':Sequelize[_0x39de('0x3')],'unique':_0x39de('0x7')},'description':{'type':Sequelize[_0x39de('0x3')]},'title':{'type':Sequelize[_0x39de('0x3')]},'remoteUri':{'type':Sequelize[_0x39de('0x3')]},'link':{'type':Sequelize[_0x39de('0x3')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 8fb7527..2d85f90 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 _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 +var _0x160a=['hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','merge','Integration','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','limit','set','Content-Range','apply','save','then','destroy','sendStatus','stack','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length'];(function(_0x1369cb,_0x2aab65){var _0xe6a0ee=function(_0x39708d){while(--_0x39708d){_0x1369cb['push'](_0x1369cb['shift']());}};_0xe6a0ee(++_0x2aab65);}(_0x160a,0x1ca));var _0xa160=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x160a[_0x42bc91];return _0x3f5507;};'use strict';var pdf=require(_0xa160('0x0'));var emlformat=require(_0xa160('0x1'));var rimraf=require(_0xa160('0x2'));var zipdir=require(_0xa160('0x3'));var jsonpatch=require(_0xa160('0x4'));var rp=require(_0xa160('0x5'));var moment=require('moment');var BPromise=require(_0xa160('0x6'));var Mustache=require(_0xa160('0x7'));var util=require(_0xa160('0x8'));var path=require(_0xa160('0x9'));var sox=require(_0xa160('0xa'));var csv=require(_0xa160('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa160('0xc'));var squel=require(_0xa160('0xd'));var crypto=require('crypto');var jsforce=require(_0xa160('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa160('0xb'));var querystring=require(_0xa160('0xf'));var Papa=require(_0xa160('0x10'));var Redis=require(_0xa160('0x11'));var authService=require(_0xa160('0x12'));var qs=require(_0xa160('0x13'));var as=require(_0xa160('0x14'));var hardwareService=require(_0xa160('0x15'));var logger=require('../../config/logger')(_0xa160('0x16'));var utils=require(_0xa160('0x17'));var config=require(_0xa160('0x18'));var db=require(_0xa160('0x19'))['db'];function respondWithStatusCode(_0x218acf,_0x59ec46){_0x59ec46=_0x59ec46||0xcc;return function(_0x57fc33){if(_0x57fc33){return _0x218acf['sendStatus'](_0x59ec46);}return _0x218acf[_0xa160('0x1a')](_0x59ec46)['end']();};}function respondWithResult(_0x52a03d,_0x52c9ec){_0x52c9ec=_0x52c9ec||0xc8;return function(_0x3b4a5d){if(_0x3b4a5d){return _0x52a03d[_0xa160('0x1a')](_0x52c9ec)['json'](_0x3b4a5d);}};}function respondWithFilteredResult(_0x500984,_0x3d762a){return function(_0x11fdac){if(_0x11fdac){var _0x1672b2=_0x11fdac[_0xa160('0x1b')],_0x348073=_0x3d762a['offset'],_0x154f87=_0x3d762a[_0xa160('0x1c')]+_0x3d762a[_0xa160('0x1d')],_0x2ad662;if(_0x154f87>=_0x1672b2){_0x154f87=_0x1672b2;_0x2ad662=0xc8;}else{_0x2ad662=0xce;}_0x500984['status'](_0x2ad662);return _0x500984[_0xa160('0x1e')](_0xa160('0x1f'),_0x348073+'-'+_0x154f87+'/'+_0x1672b2)['json'](_0x11fdac);}return null;};}function patchUpdates(_0x3f4cca){return function(_0x51b7a8){try{jsonpatch[_0xa160('0x20')](_0x51b7a8,_0x3f4cca,!![]);}catch(_0x53b9bf){return BPromise['reject'](_0x53b9bf);}return _0x51b7a8[_0xa160('0x21')]();};}function saveUpdates(_0x54a48f,_0x323a7a){return function(_0x398254){if(_0x398254){return _0x398254['update'](_0x54a48f)[_0xa160('0x22')](function(_0xd87e91){return _0xd87e91;});}return null;};}function removeEntity(_0x4f8847,_0x30c634){return function(_0x1ed944){if(_0x1ed944){return _0x1ed944[_0xa160('0x23')]()[_0xa160('0x22')](function(){_0x4f8847[_0xa160('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x494640,_0x566ad4){return function(_0x4c91b0){if(!_0x4c91b0){_0x494640[_0xa160('0x24')](0x194);}return _0x4c91b0;};}function handleError(_0x46fb54,_0x568d3e){_0x568d3e=_0x568d3e||0x1f4;return function(_0xfd865f){logger['error'](_0xfd865f[_0xa160('0x25')]);if(_0xfd865f[_0xa160('0x26')]){delete _0xfd865f[_0xa160('0x26')];}_0x46fb54['status'](_0x568d3e)[_0xa160('0x27')](_0xfd865f);};}exports[_0xa160('0x28')]=function(_0x321294,_0x333954){var _0x300edf={},_0x4c7f08={},_0xe2a877={'count':0x0,'rows':[]};var _0xf36a9=_['map'](db['Integration']['rawAttributes'],function(_0x27e965){return{'name':_0x27e965[_0xa160('0x29')],'type':_0x27e965[_0xa160('0x2a')][_0xa160('0x2b')]};});_0x4c7f08[_0xa160('0x2c')]=_[_0xa160('0x2d')](_0xf36a9,_0xa160('0x26'));_0x4c7f08[_0xa160('0x2e')]=_[_0xa160('0x2f')](_0x321294['query']);_0x4c7f08[_0xa160('0x30')]=_[_0xa160('0x31')](_0x4c7f08[_0xa160('0x2c')],_0x4c7f08[_0xa160('0x2e')]);_0x300edf[_0xa160('0x32')]=_[_0xa160('0x31')](_0x4c7f08[_0xa160('0x2c')],qs[_0xa160('0x33')](_0x321294[_0xa160('0x2e')][_0xa160('0x33')]));_0x300edf[_0xa160('0x32')]=_0x300edf[_0xa160('0x32')][_0xa160('0x34')]?_0x300edf[_0xa160('0x32')]:_0x4c7f08[_0xa160('0x2c')];if(!_0x321294[_0xa160('0x2e')][_0xa160('0x35')](_0xa160('0x36'))){_0x300edf[_0xa160('0x1d')]=qs[_0xa160('0x1d')](_0x321294['query'][_0xa160('0x1d')]);_0x300edf[_0xa160('0x1c')]=qs['offset'](_0x321294['query']['offset']);}_0x300edf['order']=qs[_0xa160('0x37')](_0x321294['query'][_0xa160('0x37')]);_0x300edf['where']=qs[_0xa160('0x30')](_['pick'](_0x321294[_0xa160('0x2e')],_0x4c7f08[_0xa160('0x30')]),_0xf36a9);if(_0x321294['query'][_0xa160('0x38')]){_0x300edf['where']=_['merge'](_0x300edf[_0xa160('0x39')],{'$or':_[_0xa160('0x2d')](_0xf36a9,function(_0x18232b){if(_0x18232b[_0xa160('0x2a')]!==_0xa160('0x3a')){var _0x17d00c={};_0x17d00c[_0x18232b[_0xa160('0x26')]]={'$like':'%'+_0x321294[_0xa160('0x2e')][_0xa160('0x38')]+'%'};return _0x17d00c;}})});}_0x300edf=_[_0xa160('0x3b')]({},_0x300edf,_0x321294['options']);var _0x1d1059={'where':_0x300edf[_0xa160('0x39')]};return db[_0xa160('0x3c')][_0xa160('0x1b')](_0x1d1059)[_0xa160('0x22')](function(_0x22cfce){_0xe2a877[_0xa160('0x1b')]=_0x22cfce;if(_0x321294[_0xa160('0x2e')][_0xa160('0x3d')]){_0x300edf[_0xa160('0x3e')]=[{'all':!![]}];}return db[_0xa160('0x3c')][_0xa160('0x3f')](_0x300edf);})[_0xa160('0x22')](function(_0x3aa17b){_0xe2a877[_0xa160('0x40')]=_0x3aa17b;return _0xe2a877;})['then'](respondWithFilteredResult(_0x333954,_0x300edf))[_0xa160('0x41')](handleError(_0x333954,null));};exports[_0xa160('0x42')]=function(_0x453516,_0x15c65d){var _0xf7a763={'raw':![],'where':{'id':_0x453516[_0xa160('0x43')]['id']}},_0x4c4bbe={};_0x4c4bbe['model']=_['keys'](db[_0xa160('0x3c')][_0xa160('0x44')]);_0x4c4bbe['query']=_[_0xa160('0x2f')](_0x453516[_0xa160('0x2e')]);_0x4c4bbe[_0xa160('0x30')]=_[_0xa160('0x31')](_0x4c4bbe['model'],_0x4c4bbe[_0xa160('0x2e')]);_0xf7a763[_0xa160('0x32')]=_['intersection'](_0x4c4bbe['model'],qs[_0xa160('0x33')](_0x453516['query']['fields']));_0xf7a763[_0xa160('0x32')]=_0xf7a763['attributes'][_0xa160('0x34')]?_0xf7a763[_0xa160('0x32')]:_0x4c4bbe[_0xa160('0x2c')];if(_0x453516['query'][_0xa160('0x3d')]){_0xf7a763[_0xa160('0x3e')]=[{'all':!![]}];}_0xf7a763=_[_0xa160('0x3b')]({},_0xf7a763,_0x453516[_0xa160('0x45')]);return db[_0xa160('0x3c')][_0xa160('0x46')](_0xf7a763)[_0xa160('0x22')](handleEntityNotFound(_0x15c65d,null))[_0xa160('0x22')](respondWithResult(_0x15c65d,null))[_0xa160('0x41')](handleError(_0x15c65d,null));};exports[_0xa160('0x47')]=function(_0xaab702,_0x5aaf4d){return db[_0xa160('0x3c')][_0xa160('0x47')](_0xaab702[_0xa160('0x48')],{})[_0xa160('0x22')](respondWithResult(_0x5aaf4d,0xc9))['catch'](handleError(_0x5aaf4d,null));};exports['update']=function(_0x1f7508,_0x235f93){if(_0x1f7508[_0xa160('0x48')]['id']){delete _0x1f7508[_0xa160('0x48')]['id'];}return db[_0xa160('0x3c')][_0xa160('0x46')]({'where':{'id':_0x1f7508['params']['id']}})['then'](handleEntityNotFound(_0x235f93,null))[_0xa160('0x22')](saveUpdates(_0x1f7508[_0xa160('0x48')],null))['then'](respondWithResult(_0x235f93,null))['catch'](handleError(_0x235f93,null));};exports[_0xa160('0x23')]=function(_0x3589e1,_0x3db974){return db[_0xa160('0x3c')][_0xa160('0x46')]({'where':{'id':_0x3589e1[_0xa160('0x43')]['id']}})[_0xa160('0x22')](handleEntityNotFound(_0x3db974,null))[_0xa160('0x22')](removeEntity(_0x3db974,null))[_0xa160('0x41')](handleError(_0x3db974,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 485bc60..d0f906a 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 _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 +var _0xf181=['define','Integration','integrations','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf181,0xf3));var _0x1f18=function(_0x41d684,_0x52f976){_0x41d684=_0x41d684-0x0;var _0x83b011=_0xf181[_0x41d684];return _0x83b011;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x1f18('0x0'));var moment=require(_0x1f18('0x1'));var BPromise=require(_0x1f18('0x2'));var rp=require(_0x1f18('0x3'));var fs=require('fs');var path=require(_0x1f18('0x4'));var rimraf=require(_0x1f18('0x5'));var config=require(_0x1f18('0x6'));var attributes=require(_0x1f18('0x7'));module[_0x1f18('0x8')]=function(_0x3fb15d,_0x19721e){return _0x3fb15d[_0x1f18('0x9')](_0x1f18('0xa'),attributes,{'tableName':_0x1f18('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 35d6022..005fa04 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 _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 +var _0xbf07=['request','then','info','Integration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment'];(function(_0x5e93b4,_0x3efbea){var _0x42321c=function(_0x83e3d){while(--_0x83e3d){_0x5e93b4['push'](_0x5e93b4['shift']());}};_0x42321c(++_0x3efbea);}(_0xbf07,0x77));var _0x7bf0=function(_0x1e500e,_0x2c9d74){_0x1e500e=_0x1e500e-0x0;var _0x10dc5e=_0xbf07[_0x1e500e];return _0x10dc5e;};'use strict';var _=require(_0x7bf0('0x0'));var util=require(_0x7bf0('0x1'));var moment=require(_0x7bf0('0x2'));var BPromise=require(_0x7bf0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7bf0('0x4'));var db=require(_0x7bf0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7bf0('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x44f656,_0x50e680,_0x263964){return new BPromise(function(_0x536214,_0x415291){return client[_0x7bf0('0x7')](_0x44f656,_0x263964)[_0x7bf0('0x8')](function(_0x2565c7){logger[_0x7bf0('0x9')](_0x7bf0('0xa'),_0x50e680,'request\x20sent');logger[_0x7bf0('0xb')]('Integration,\x20%s,\x20%s,\x20%s',_0x50e680,_0x7bf0('0xc'),JSON[_0x7bf0('0xd')](_0x2565c7));if(_0x2565c7[_0x7bf0('0xe')]){if(_0x2565c7[_0x7bf0('0xe')][_0x7bf0('0xf')]===0x1f4){logger[_0x7bf0('0xe')](_0x7bf0('0xa'),_0x50e680,_0x2565c7[_0x7bf0('0xe')][_0x7bf0('0x10')]);return _0x415291(_0x2565c7[_0x7bf0('0xe')][_0x7bf0('0x10')]);}logger[_0x7bf0('0xe')](_0x7bf0('0xa'),_0x50e680,_0x2565c7[_0x7bf0('0xe')][_0x7bf0('0x10')]);return _0x536214(_0x2565c7[_0x7bf0('0xe')][_0x7bf0('0x10')]);}else{logger[_0x7bf0('0x9')](_0x7bf0('0xa'),_0x50e680,_0x7bf0('0xc'));_0x536214(_0x2565c7['result'][_0x7bf0('0x10')]);}})[_0x7bf0('0x11')](function(_0x187489){logger[_0x7bf0('0xe')](_0x7bf0('0xa'),_0x50e680,_0x187489);_0x415291(_0x187489);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index bb5400f..8d48af9 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 _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 +var _0x242f=['update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0x242f,0x129));var _0xf242=function(_0x4af23c,_0x50e294){_0x4af23c=_0x4af23c-0x0;var _0x194b63=_0x242f[_0x4af23c];return _0x194b63;};'use strict';var multer=require(_0xf242('0x0'));var util=require(_0xf242('0x1'));var path=require(_0xf242('0x2'));var timeout=require('connect-timeout');var express=require(_0xf242('0x3'));var router=express[_0xf242('0x4')]();var auth=require(_0xf242('0x5'));var interaction=require(_0xf242('0x6'));var config=require(_0xf242('0x7'));var controller=require(_0xf242('0x8'));router[_0xf242('0x9')]('/',auth[_0xf242('0xa')](),controller[_0xf242('0xb')]);router[_0xf242('0x9')](_0xf242('0xc'),auth[_0xf242('0xa')](),controller[_0xf242('0xd')]);router[_0xf242('0x9')](_0xf242('0xe'),auth[_0xf242('0xa')](),controller['show']);router[_0xf242('0xf')]('/',auth[_0xf242('0xa')](),controller[_0xf242('0x10')]);router[_0xf242('0x11')](_0xf242('0xe'),auth[_0xf242('0xa')](),controller[_0xf242('0x12')]);router[_0xf242('0x13')]('/:id',auth[_0xf242('0xa')](),controller['destroy']);module[_0xf242('0x14')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index c7d7565..f88d123 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 _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 +var _0x7172=['DATE','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','FAILED','STRING','INTEGER'];(function(_0x44c3ce,_0x47c19a){var _0x34a648=function(_0x369129){while(--_0x369129){_0x44c3ce['push'](_0x44c3ce['shift']());}};_0x34a648(++_0x47c19a);}(_0x7172,0x1ed));var _0x2717=function(_0x1e9cb8,_0x3a9b29){_0x1e9cb8=_0x1e9cb8-0x0;var _0x380780=_0x7172[_0x1e9cb8];return _0x380780;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize[_0x2717('0x0')]},'eventChannel':{'type':Sequelize[_0x2717('0x0')]},'exitStatus':{'type':Sequelize[_0x2717('0x0')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x2717('0x1')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2717('0x0')]},'calleridnum':{'type':Sequelize[_0x2717('0x0')]},'calleridname':{'type':Sequelize[_0x2717('0x0')]},'queue':{'type':Sequelize[_0x2717('0x0')]},'interface':{'type':Sequelize[_0x2717('0x0')]},'membername':{'type':Sequelize[_0x2717('0x0')]},'agentcalledAt':{'type':Sequelize[_0x2717('0x2')]},'agentconnectAt':{'type':Sequelize[_0x2717('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x2717('0x2')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x2717('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2717('0x1')]},'reason':{'type':Sequelize[_0x2717('0x0')]},'agentringnoanswer':{'type':Sequelize[_0x2717('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x2717('0x2')]},'agentdump':{'type':Sequelize[_0x2717('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x2717('0x2')]},'lastevent':{'type':Sequelize[_0x2717('0x0')]},'channel':{'type':Sequelize[_0x2717('0x0')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x2717('0x0')]},'connectedlinename':{'type':Sequelize[_0x2717('0x0')]},'language':{'type':Sequelize[_0x2717('0x0')]},'accountcode':{'type':Sequelize[_0x2717('0x0')]},'context':{'type':Sequelize[_0x2717('0x0')]},'exten':{'type':Sequelize[_0x2717('0x0')]},'priority':{'type':Sequelize[_0x2717('0x0')]},'destchannel':{'type':Sequelize[_0x2717('0x0')]},'destchannelstate':{'type':Sequelize[_0x2717('0x1')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x2717('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0x2717('0x0')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x2717('0x0')]},'destcontext':{'type':Sequelize[_0x2717('0x0')]},'destexten':{'type':Sequelize[_0x2717('0x0')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x2717('0x0')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x2717('0x0')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x2717('0x0')]},'to':{'type':Sequelize[_0x2717('0x0')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x2717('0x4')]},'text':{'type':Sequelize[_0x2717('0x4')]},'status':{'type':Sequelize[_0x2717('0x5')]('SENT',_0x2717('0x6'),_0x2717('0x7'),_0x2717('0x8'))},'url':{'type':Sequelize[_0x2717('0x0')]},'app':{'type':Sequelize[_0x2717('0x0')]},'appdata':{'type':Sequelize[_0x2717('0x0')]},'projectId':{'type':Sequelize[_0x2717('0x1')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 7ef2105..9da9d4e 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 _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 +var _0xd510=['../../config/logger','api','../../config/utils','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','then','end','error','stack','name','send','index','map','IntegrationReport','rawAttributes','type','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','fields','find','create','body','update','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware'];(function(_0x484af5,_0x2b07ad){var _0xa895df=function(_0x5e9846){while(--_0x5e9846){_0x484af5['push'](_0x484af5['shift']());}};_0xa895df(++_0x2b07ad);}(_0xd510,0x1cc));var _0x0d51=function(_0x42fb66,_0x2f7f7e){_0x42fb66=_0x42fb66-0x0;var _0x197e2a=_0xd510[_0x42fb66];return _0x197e2a;};'use strict';var pdf=require(_0x0d51('0x0'));var emlformat=require(_0x0d51('0x1'));var rimraf=require(_0x0d51('0x2'));var zipdir=require(_0x0d51('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0d51('0x4'));var moment=require(_0x0d51('0x5'));var BPromise=require(_0x0d51('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0d51('0x7'));var sox=require(_0x0d51('0x8'));var csv=require(_0x0d51('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0d51('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0d51('0x9'));var querystring=require(_0x0d51('0xb'));var Papa=require(_0x0d51('0xc'));var Redis=require(_0x0d51('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x0d51('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d51('0xf'));var logger=require(_0x0d51('0x10'))(_0x0d51('0x11'));var utils=require(_0x0d51('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5203ba,_0x439d30){_0x439d30=_0x439d30||0xcc;return function(_0xe05336){if(_0xe05336){return _0x5203ba[_0x0d51('0x13')](_0x439d30);}return _0x5203ba['status'](_0x439d30)['end']();};}function respondWithResult(_0x4d2911,_0x4599d2){_0x4599d2=_0x4599d2||0xc8;return function(_0x447274){if(_0x447274){return _0x4d2911[_0x0d51('0x14')](_0x4599d2)['json'](_0x447274);}};}function respondWithFilteredResult(_0x4e2c29,_0x43c464){return function(_0xf38740){if(_0xf38740){var _0x5b5e5d=_0xf38740[_0x0d51('0x15')],_0x1c0d66=_0x43c464[_0x0d51('0x16')],_0x2174fd=_0x43c464[_0x0d51('0x16')]+_0x43c464[_0x0d51('0x17')],_0x2ba02c;if(_0x2174fd>=_0x5b5e5d){_0x2174fd=_0x5b5e5d;_0x2ba02c=0xc8;}else{_0x2ba02c=0xce;}_0x4e2c29[_0x0d51('0x14')](_0x2ba02c);return _0x4e2c29[_0x0d51('0x18')](_0x0d51('0x19'),_0x1c0d66+'-'+_0x2174fd+'/'+_0x5b5e5d)[_0x0d51('0x1a')](_0xf38740);}return null;};}function patchUpdates(_0x959b02){return function(_0x4c0b17){try{jsonpatch['apply'](_0x4c0b17,_0x959b02,!![]);}catch(_0x1cd8fc){return BPromise[_0x0d51('0x1b')](_0x1cd8fc);}return _0x4c0b17[_0x0d51('0x1c')]();};}function saveUpdates(_0x4ed6ff,_0xcbbd9a){return function(_0x17add9){if(_0x17add9){return _0x17add9['update'](_0x4ed6ff)[_0x0d51('0x1d')](function(_0x3709c7){return _0x3709c7;});}return null;};}function removeEntity(_0x4f7640,_0x38edf7){return function(_0x5d7181){if(_0x5d7181){return _0x5d7181['destroy']()['then'](function(){_0x4f7640['status'](0xcc)[_0x0d51('0x1e')]();});}};}function handleEntityNotFound(_0x59b996,_0x1ef3e4){return function(_0x77af2a){if(!_0x77af2a){_0x59b996[_0x0d51('0x13')](0x194);}return _0x77af2a;};}function handleError(_0x16222f,_0x19d790){_0x19d790=_0x19d790||0x1f4;return function(_0x586973){logger[_0x0d51('0x1f')](_0x586973[_0x0d51('0x20')]);if(_0x586973['name']){delete _0x586973[_0x0d51('0x21')];}_0x16222f[_0x0d51('0x14')](_0x19d790)[_0x0d51('0x22')](_0x586973);};}exports[_0x0d51('0x23')]=function(_0x58b851,_0x557bbb){var _0x58e21f={},_0x4b3046={},_0xee8ae5={'count':0x0,'rows':[]};var _0x19be36=_[_0x0d51('0x24')](db[_0x0d51('0x25')][_0x0d51('0x26')],function(_0x4a0ce5){return{'name':_0x4a0ce5['fieldName'],'type':_0x4a0ce5[_0x0d51('0x27')]['key']};});_0x4b3046[_0x0d51('0x28')]=_[_0x0d51('0x24')](_0x19be36,_0x0d51('0x21'));_0x4b3046[_0x0d51('0x29')]=_['keys'](_0x58b851[_0x0d51('0x29')]);_0x4b3046[_0x0d51('0x2a')]=_[_0x0d51('0x2b')](_0x4b3046[_0x0d51('0x28')],_0x4b3046[_0x0d51('0x29')]);_0x58e21f['attributes']=_[_0x0d51('0x2b')](_0x4b3046[_0x0d51('0x28')],qs['fields'](_0x58b851[_0x0d51('0x29')]['fields']));_0x58e21f[_0x0d51('0x2c')]=_0x58e21f['attributes'][_0x0d51('0x2d')]?_0x58e21f[_0x0d51('0x2c')]:_0x4b3046['model'];if(!_0x58b851['query'][_0x0d51('0x2e')](_0x0d51('0x2f'))){_0x58e21f[_0x0d51('0x17')]=qs[_0x0d51('0x17')](_0x58b851[_0x0d51('0x29')][_0x0d51('0x17')]);_0x58e21f[_0x0d51('0x16')]=qs[_0x0d51('0x16')](_0x58b851[_0x0d51('0x29')][_0x0d51('0x16')]);}_0x58e21f[_0x0d51('0x30')]=qs[_0x0d51('0x31')](_0x58b851[_0x0d51('0x29')][_0x0d51('0x31')]);_0x58e21f[_0x0d51('0x32')]=qs['filters'](_['pick'](_0x58b851[_0x0d51('0x29')],_0x4b3046[_0x0d51('0x2a')]),_0x19be36);if(_0x58b851[_0x0d51('0x29')]['filter']){_0x58e21f[_0x0d51('0x32')]=_[_0x0d51('0x33')](_0x58e21f['where'],{'$or':_[_0x0d51('0x24')](_0x19be36,function(_0x54f19e){if(_0x54f19e[_0x0d51('0x27')]!==_0x0d51('0x34')){var _0xe38f66={};_0xe38f66[_0x54f19e['name']]={'$like':'%'+_0x58b851[_0x0d51('0x29')]['filter']+'%'};return _0xe38f66;}})});}_0x58e21f=_[_0x0d51('0x33')]({},_0x58e21f,_0x58b851[_0x0d51('0x35')]);var _0x2dd37b={'where':_0x58e21f[_0x0d51('0x32')]};return db['IntegrationReport']['count'](_0x2dd37b)['then'](function(_0x32dfbd){_0xee8ae5['count']=_0x32dfbd;if(_0x58b851[_0x0d51('0x29')][_0x0d51('0x36')]){_0x58e21f[_0x0d51('0x37')]=[{'all':!![]}];}return db[_0x0d51('0x25')][_0x0d51('0x38')](_0x58e21f);})[_0x0d51('0x1d')](function(_0x3cfc4d){_0xee8ae5['rows']=_0x3cfc4d;return _0xee8ae5;})[_0x0d51('0x1d')](respondWithFilteredResult(_0x557bbb,_0x58e21f))[_0x0d51('0x39')](handleError(_0x557bbb,null));};exports[_0x0d51('0x3a')]=function(_0x1b8cc5,_0x51188e){var _0x5a6be3={'raw':![],'where':{'id':_0x1b8cc5[_0x0d51('0x3b')]['id']}},_0x514ab0={};_0x514ab0[_0x0d51('0x28')]=_['keys'](db[_0x0d51('0x25')][_0x0d51('0x26')]);_0x514ab0[_0x0d51('0x29')]=_[_0x0d51('0x3c')](_0x1b8cc5['query']);_0x514ab0[_0x0d51('0x2a')]=_['intersection'](_0x514ab0[_0x0d51('0x28')],_0x514ab0[_0x0d51('0x29')]);_0x5a6be3[_0x0d51('0x2c')]=_[_0x0d51('0x2b')](_0x514ab0['model'],qs['fields'](_0x1b8cc5[_0x0d51('0x29')][_0x0d51('0x3d')]));_0x5a6be3['attributes']=_0x5a6be3[_0x0d51('0x2c')][_0x0d51('0x2d')]?_0x5a6be3[_0x0d51('0x2c')]:_0x514ab0[_0x0d51('0x28')];if(_0x1b8cc5[_0x0d51('0x29')][_0x0d51('0x36')]){_0x5a6be3[_0x0d51('0x37')]=[{'all':!![]}];}_0x5a6be3=_[_0x0d51('0x33')]({},_0x5a6be3,_0x1b8cc5['options']);return db['IntegrationReport'][_0x0d51('0x3e')](_0x5a6be3)[_0x0d51('0x1d')](handleEntityNotFound(_0x51188e,null))['then'](respondWithResult(_0x51188e,null))[_0x0d51('0x39')](handleError(_0x51188e,null));};exports[_0x0d51('0x3f')]=function(_0x3b7734,_0x4c12d8){return db[_0x0d51('0x25')]['create'](_0x3b7734[_0x0d51('0x40')],{})['then'](respondWithResult(_0x4c12d8,0xc9))[_0x0d51('0x39')](handleError(_0x4c12d8,null));};exports[_0x0d51('0x41')]=function(_0x3b7ef7,_0x3d6efc){if(_0x3b7ef7[_0x0d51('0x40')]['id']){delete _0x3b7ef7['body']['id'];}return db[_0x0d51('0x25')][_0x0d51('0x3e')]({'where':{'id':_0x3b7ef7['params']['id']}})[_0x0d51('0x1d')](handleEntityNotFound(_0x3d6efc,null))[_0x0d51('0x1d')](saveUpdates(_0x3b7ef7['body'],null))[_0x0d51('0x1d')](respondWithResult(_0x3d6efc,null))[_0x0d51('0x39')](handleError(_0x3d6efc,null));};exports[_0x0d51('0x42')]=function(_0xda57d3,_0x1db57b){return db['IntegrationReport'][_0x0d51('0x3e')]({'where':{'id':_0xda57d3[_0x0d51('0x3b')]['id']}})[_0x0d51('0x1d')](handleEntityNotFound(_0x1db57b,null))[_0x0d51('0x1d')](removeEntity(_0x1db57b,null))[_0x0d51('0x39')](handleError(_0x1db57b,null));};exports[_0x0d51('0x43')]=function(_0x5d636a,_0x1e2ae8){return db[_0x0d51('0x25')][_0x0d51('0x43')]()['then'](respondWithResult(_0x1e2ae8,null))['catch'](handleError(_0x1e2ae8,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index f72d162..33878de 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 _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 +var _0xa0ee=['exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./integrationReport.attributes'];(function(_0x3ad46a,_0x420179){var _0x1f6cfc=function(_0x539f2b){while(--_0x539f2b){_0x3ad46a['push'](_0x3ad46a['shift']());}};_0x1f6cfc(++_0x420179);}(_0xa0ee,0xc8));var _0xea0e=function(_0xdf13c9,_0x5da43f){_0xdf13c9=_0xdf13c9-0x0;var _0x302aaa=_0xa0ee[_0xdf13c9];return _0x302aaa;};'use strict';var _=require(_0xea0e('0x0'));var util=require(_0xea0e('0x1'));var logger=require(_0xea0e('0x2'))(_0xea0e('0x3'));var moment=require(_0xea0e('0x4'));var BPromise=require(_0xea0e('0x5'));var rp=require(_0xea0e('0x6'));var fs=require('fs');var path=require(_0xea0e('0x7'));var rimraf=require('rimraf');var config=require(_0xea0e('0x8'));var attributes=require(_0xea0e('0x9'));module[_0xea0e('0xa')]=function(_0x388e68,_0x3ff8d8){return _0x388e68[_0xea0e('0xb')](_0xea0e('0xc'),attributes,{'tableName':_0xea0e('0xd'),'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 014829f..7498d4f 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 _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 +var _0x0b0e=['IntegrationReport,\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','IntegrationReport,\x20%s,\x20%s','debug'];(function(_0x3a8db5,_0x31cff7){var _0x2c03cd=function(_0x47dba0){while(--_0x47dba0){_0x3a8db5['push'](_0x3a8db5['shift']());}};_0x2c03cd(++_0x31cff7);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0x0b0e[_0x2d89ce];return _0x3fad10;};'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')]('IntegrationReport,\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/interval/index.js b/server/api/interval/index.js index 7162a47..18ce680 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 _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 +var _0x3e74=['isAuthenticated','index','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','./interval.controller','get'];(function(_0x9ce42d,_0x153723){var _0xcb720e=function(_0x4f931d){while(--_0x4f931d){_0x9ce42d['push'](_0x9ce42d['shift']());}};_0xcb720e(++_0x153723);}(_0x3e74,0x175));var _0x43e7=function(_0x59e200,_0x4ced0d){_0x59e200=_0x59e200-0x0;var _0x5157fe=_0x3e74[_0x59e200];return _0x5157fe;};'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('0x6')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller['getIntervals']);router[_0x43e7('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x43e7('0xb')](_0x43e7('0xa'),auth['isAuthenticated'](),controller[_0x43e7('0xc')]);router['post'](_0x43e7('0xd'),auth[_0x43e7('0x7')](),controller['addIntervals']);router[_0x43e7('0xe')](_0x43e7('0xf'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x10')]);router['delete']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x11')]);module[_0x43e7('0x12')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index bc61d98..071748f 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 _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 +var _0x0f18=['STRING','sequelize'];(function(_0x4cccb2,_0x165947){var _0x1f73f3=function(_0x409801){while(--_0x409801){_0x4cccb2['push'](_0x4cccb2['shift']());}};_0x1f73f3(++_0x165947);}(_0x0f18,0x163));var _0x80f1=function(_0x51ab83,_0x2721b9){_0x51ab83=_0x51ab83-0x0;var _0x14b6de=_0x0f18[_0x51ab83];return _0x14b6de;};'use strict';var Sequelize=require(_0x80f1('0x0'));module['exports']={'name':{'type':Sequelize[_0x80f1('0x1')]},'description':{'type':Sequelize[_0x80f1('0x1')]},'interval':{'type':Sequelize[_0x80f1('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index ddbb5c8..28cddc4 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 _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 +var _0xd368=['../../components/extensions/rewrite','sendStatus','end','json','offset','limit','set','update','then','destroy','get','Intervals','status','error','stack','name','index','Interval','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','findOne','order','pick','getIntervals','sequelize','transaction','IntervalId','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb'];(function(_0xd2efdb,_0x2eca6e){var _0x5f17b1=function(_0x1de09a){while(--_0x1de09a){_0xd2efdb['push'](_0xd2efdb['shift']());}};_0x5f17b1(++_0x2eca6e);}(_0xd368,0xea));var _0x8d36=function(_0xa441b7,_0x2c3536){_0xa441b7=_0xa441b7-0x0;var _0x3cd1f9=_0xd368[_0xa441b7];return _0x3cd1f9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8d36('0x0'));var rimraf=require(_0x8d36('0x1'));var zipdir=require(_0x8d36('0x2'));var jsonpatch=require(_0x8d36('0x3'));var rp=require(_0x8d36('0x4'));var moment=require(_0x8d36('0x5'));var BPromise=require(_0x8d36('0x6'));var Mustache=require(_0x8d36('0x7'));var util=require(_0x8d36('0x8'));var path=require(_0x8d36('0x9'));var sox=require(_0x8d36('0xa'));var csv=require(_0x8d36('0xb'));var ejs=require(_0x8d36('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8d36('0xd'));var crypto=require('crypto');var jsforce=require(_0x8d36('0xe'));var deskjs=require(_0x8d36('0xf'));var toCsv=require(_0x8d36('0xb'));var querystring=require(_0x8d36('0x10'));var Papa=require(_0x8d36('0x11'));var Redis=require(_0x8d36('0x12'));var authService=require(_0x8d36('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8d36('0x14'));var logger=require(_0x8d36('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x8d36('0x16'));var db=require(_0x8d36('0x17'))['db'];var extensions=require(_0x8d36('0x18'));function respondWithStatusCode(_0x4a8e5e,_0x449730){_0x449730=_0x449730||0xcc;return function(_0xa00b68){if(_0xa00b68){return _0x4a8e5e[_0x8d36('0x19')](_0x449730);}return _0x4a8e5e['status'](_0x449730)[_0x8d36('0x1a')]();};}function respondWithResult(_0x40545a,_0x39ab1a){_0x39ab1a=_0x39ab1a||0xc8;return function(_0xf82828){if(_0xf82828){return _0x40545a['status'](_0x39ab1a)[_0x8d36('0x1b')](_0xf82828);}};}function respondWithFilteredResult(_0x421a0d,_0x47d5fa){return function(_0x36ae4e){if(_0x36ae4e){var _0x3cf1b8=_0x36ae4e['count'],_0x4975d0=_0x47d5fa[_0x8d36('0x1c')],_0x1b224e=_0x47d5fa[_0x8d36('0x1c')]+_0x47d5fa[_0x8d36('0x1d')],_0x5235a1;if(_0x1b224e>=_0x3cf1b8){_0x1b224e=_0x3cf1b8;_0x5235a1=0xc8;}else{_0x5235a1=0xce;}_0x421a0d['status'](_0x5235a1);return _0x421a0d[_0x8d36('0x1e')]('Content-Range',_0x4975d0+'-'+_0x1b224e+'/'+_0x3cf1b8)[_0x8d36('0x1b')](_0x36ae4e);}return null;};}function patchUpdates(_0x5e7eb1){return function(_0x380b8c){try{jsonpatch['apply'](_0x380b8c,_0x5e7eb1,!![]);}catch(_0x513a8a){return BPromise['reject'](_0x513a8a);}return _0x380b8c['save']();};}function saveUpdates(_0x14f581,_0x699caa){return function(_0x50d4ae){if(_0x50d4ae){return _0x50d4ae[_0x8d36('0x1f')](_0x14f581)[_0x8d36('0x20')](function(_0xbee763){return _0xbee763;});}return null;};}function removeEntity(_0x5c3e70,_0x5c30d7){return function(_0x147390){if(_0x147390){return _0x147390[_0x8d36('0x21')]()[_0x8d36('0x20')](function(){var _0x115453=_0x147390[_0x8d36('0x22')]({'plain':!![]});var _0x3a7722=_0x8d36('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x3a7722,'resourceId':_0x115453['id']}})[_0x8d36('0x20')](function(){return _0x147390;});})[_0x8d36('0x20')](function(){_0x5c3e70[_0x8d36('0x24')](0xcc)[_0x8d36('0x1a')]();});}};}function handleEntityNotFound(_0xe1724e,_0x11570b){return function(_0x5a095f){if(!_0x5a095f){_0xe1724e[_0x8d36('0x19')](0x194);}return _0x5a095f;};}function handleError(_0x30d76e,_0x1deb66){_0x1deb66=_0x1deb66||0x1f4;return function(_0x18c1cc){logger[_0x8d36('0x25')](_0x18c1cc[_0x8d36('0x26')]);if(_0x18c1cc[_0x8d36('0x27')]){delete _0x18c1cc[_0x8d36('0x27')];}_0x30d76e[_0x8d36('0x24')](_0x1deb66)['send'](_0x18c1cc);};}exports[_0x8d36('0x28')]=function(_0x56db65,_0x38bd0b){var _0x421652={},_0x158ee4={},_0x2abab9={'count':0x0,'rows':[]};var _0x442325=_['map'](db[_0x8d36('0x29')][_0x8d36('0x2a')],function(_0x279c65){return{'name':_0x279c65[_0x8d36('0x2b')],'type':_0x279c65[_0x8d36('0x2c')]['key']};});_0x158ee4[_0x8d36('0x2d')]=_[_0x8d36('0x2e')](_0x442325,_0x8d36('0x27'));_0x158ee4[_0x8d36('0x2f')]=_[_0x8d36('0x30')](_0x56db65[_0x8d36('0x2f')]);_0x158ee4[_0x8d36('0x31')]=_['intersection'](_0x158ee4[_0x8d36('0x2d')],_0x158ee4[_0x8d36('0x2f')]);_0x421652[_0x8d36('0x32')]=_[_0x8d36('0x33')](_0x158ee4['model'],qs['fields'](_0x56db65[_0x8d36('0x2f')][_0x8d36('0x34')]));_0x421652['attributes']=_0x421652[_0x8d36('0x32')]['length']?_0x421652[_0x8d36('0x32')]:_0x158ee4[_0x8d36('0x2d')];if(!_0x56db65[_0x8d36('0x2f')][_0x8d36('0x35')](_0x8d36('0x36'))){_0x421652[_0x8d36('0x1d')]=qs['limit'](_0x56db65[_0x8d36('0x2f')]['limit']);_0x421652[_0x8d36('0x1c')]=qs[_0x8d36('0x1c')](_0x56db65['query'][_0x8d36('0x1c')]);}_0x421652['order']=qs['sort'](_0x56db65[_0x8d36('0x2f')][_0x8d36('0x37')]);_0x421652['where']=qs['filters'](_['pick'](_0x56db65[_0x8d36('0x2f')],_0x158ee4[_0x8d36('0x31')]),_0x442325);if(_0x56db65[_0x8d36('0x2f')][_0x8d36('0x38')]){_0x421652[_0x8d36('0x39')]=_['merge'](_0x421652[_0x8d36('0x39')],{'$or':_[_0x8d36('0x2e')](_0x442325,function(_0xc86ced){if(_0xc86ced[_0x8d36('0x2c')]!==_0x8d36('0x3a')){var _0x274ff0={};_0x274ff0[_0xc86ced[_0x8d36('0x27')]]={'$like':'%'+_0x56db65[_0x8d36('0x2f')][_0x8d36('0x38')]+'%'};return _0x274ff0;}})});}_0x421652=_[_0x8d36('0x3b')]({},_0x421652,_0x56db65[_0x8d36('0x3c')]);var _0x29989b={'where':_0x421652[_0x8d36('0x39')]};return db[_0x8d36('0x29')]['count'](_0x29989b)[_0x8d36('0x20')](function(_0x4cd51a){_0x2abab9['count']=_0x4cd51a;if(_0x56db65['query'][_0x8d36('0x3d')]){_0x421652[_0x8d36('0x3e')]=[{'all':!![]}];}return db[_0x8d36('0x29')][_0x8d36('0x3f')](_0x421652);})[_0x8d36('0x20')](function(_0x2cf573){_0x2abab9[_0x8d36('0x40')]=_0x2cf573;return _0x2abab9;})['then'](respondWithFilteredResult(_0x38bd0b,_0x421652))[_0x8d36('0x41')](handleError(_0x38bd0b,null));};exports[_0x8d36('0x42')]=function(_0x4f4d0e,_0x5714b2){var _0x193bbd={'raw':!![],'where':{'id':_0x4f4d0e[_0x8d36('0x43')]['id']}},_0x4903f6={};_0x4903f6['model']=_['keys'](db['Interval'][_0x8d36('0x2a')]);_0x4903f6[_0x8d36('0x2f')]=_[_0x8d36('0x30')](_0x4f4d0e['query']);_0x4903f6['filters']=_[_0x8d36('0x33')](_0x4903f6['model'],_0x4903f6[_0x8d36('0x2f')]);_0x193bbd['attributes']=_[_0x8d36('0x33')](_0x4903f6[_0x8d36('0x2d')],qs[_0x8d36('0x34')](_0x4f4d0e[_0x8d36('0x2f')][_0x8d36('0x34')]));_0x193bbd[_0x8d36('0x32')]=_0x193bbd['attributes'][_0x8d36('0x44')]?_0x193bbd[_0x8d36('0x32')]:_0x4903f6[_0x8d36('0x2d')];if(_0x4f4d0e[_0x8d36('0x2f')][_0x8d36('0x3d')]){_0x193bbd['include']=[{'all':!![]}];}_0x193bbd=_['merge']({},_0x193bbd,_0x4f4d0e[_0x8d36('0x3c')]);return db[_0x8d36('0x29')][_0x8d36('0x45')](_0x193bbd)['then'](handleEntityNotFound(_0x5714b2,null))[_0x8d36('0x20')](respondWithResult(_0x5714b2,null))[_0x8d36('0x41')](handleError(_0x5714b2,null));};exports['create']=function(_0x55e231,_0xf6cb53){return db[_0x8d36('0x29')][_0x8d36('0x46')](_0x55e231['body'],{})['then'](function(_0x594ab1){var _0x104606=_0x55e231[_0x8d36('0x47')]['get']({'plain':!![]});if(!_0x104606)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x104606[_0x8d36('0x48')]==='user'){var _0x3f8376=_0x594ab1[_0x8d36('0x22')]({'plain':!![]});var _0x2b911f='Intervals';return db['UserProfileSection'][_0x8d36('0x45')]({'where':{'name':_0x2b911f,'userProfileId':_0x104606[_0x8d36('0x49')]},'raw':!![]})[_0x8d36('0x20')](function(_0x13134d){if(_0x13134d&&_0x13134d[_0x8d36('0x4a')]===0x0){return db[_0x8d36('0x4b')]['create']({'name':_0x3f8376['name'],'resourceId':_0x3f8376['id'],'type':_0x13134d[_0x8d36('0x27')],'sectionId':_0x13134d['id']},{})[_0x8d36('0x20')](function(){return _0x594ab1;});}else{return _0x594ab1;}})[_0x8d36('0x41')](function(_0x40d1d1){logger[_0x8d36('0x25')](_0x8d36('0x4c'),_0x40d1d1);throw _0x40d1d1;});}return _0x594ab1;})[_0x8d36('0x20')](respondWithResult(_0xf6cb53,0xc9))['catch'](handleError(_0xf6cb53,null));};exports[_0x8d36('0x1f')]=function(_0xfcf0a0,_0x18881c){if(_0xfcf0a0[_0x8d36('0x4d')]['id']){delete _0xfcf0a0[_0x8d36('0x4d')]['id'];}return db[_0x8d36('0x29')][_0x8d36('0x45')]({'where':{'id':_0xfcf0a0['params']['id']}})[_0x8d36('0x20')](handleEntityNotFound(_0x18881c,null))[_0x8d36('0x20')](saveUpdates(_0xfcf0a0[_0x8d36('0x4d')],null))['then'](respondWithResult(_0x18881c,null))[_0x8d36('0x41')](handleError(_0x18881c,null));};exports[_0x8d36('0x21')]=function(_0x4f475f,_0x438a95){return db['Interval'][_0x8d36('0x45')]({'where':{'id':_0x4f475f['params']['id']}})[_0x8d36('0x20')](handleEntityNotFound(_0x438a95,null))['then'](removeEntity(_0x438a95,null))[_0x8d36('0x41')](handleError(_0x438a95,null));};exports['addInterval']=function(_0x1e689d,_0x5264bd,_0x3ee17a){if(_0x1e689d[_0x8d36('0x4d')]['id']){delete _0x1e689d[_0x8d36('0x4d')]['id'];}return db[_0x8d36('0x29')][_0x8d36('0x45')]({'where':{'id':_0x1e689d[_0x8d36('0x43')]['id']}})[_0x8d36('0x20')](handleEntityNotFound(_0x5264bd,null))['then'](function(_0x45b4c9){if(_0x45b4c9){_0x1e689d['body']['IntervalId']=_0x45b4c9['id'];return db[_0x8d36('0x29')][_0x8d36('0x46')](_0x1e689d[_0x8d36('0x4d')]);}})[_0x8d36('0x20')](respondWithResult(_0x5264bd,null))[_0x8d36('0x41')](handleError(_0x5264bd,null));};exports['getIntervals']=function(_0xff45e,_0x37b206,_0x29c36a){var _0x18728b={};var _0x12d517={};var _0x1c1e70;var _0x47f96b;return db[_0x8d36('0x29')][_0x8d36('0x4e')]({'where':{'id':_0xff45e['params']['id']}})[_0x8d36('0x20')](handleEntityNotFound(_0x37b206,null))[_0x8d36('0x20')](function(_0x2661e){if(_0x2661e){_0x1c1e70=_0x2661e;_0x12d517[_0x8d36('0x2d')]=_['keys'](db[_0x8d36('0x29')][_0x8d36('0x2a')]);_0x12d517[_0x8d36('0x2f')]=_[_0x8d36('0x30')](_0xff45e[_0x8d36('0x2f')]);_0x12d517['filters']=_[_0x8d36('0x33')](_0x12d517[_0x8d36('0x2d')],_0x12d517[_0x8d36('0x2f')]);_0x18728b[_0x8d36('0x32')]=_[_0x8d36('0x33')](_0x12d517[_0x8d36('0x2d')],qs[_0x8d36('0x34')](_0xff45e[_0x8d36('0x2f')]['fields']));_0x18728b[_0x8d36('0x32')]=_0x18728b[_0x8d36('0x32')][_0x8d36('0x44')]?_0x18728b['attributes']:_0x12d517[_0x8d36('0x2d')];_0x18728b[_0x8d36('0x4f')]=qs['sort'](_0xff45e['query']['sort']);_0x18728b['where']=qs[_0x8d36('0x31')](_[_0x8d36('0x50')](_0xff45e['query'],_0x12d517[_0x8d36('0x31')]));if(_0xff45e[_0x8d36('0x2f')][_0x8d36('0x38')]){_0x18728b['where']=_[_0x8d36('0x3b')](_0x18728b[_0x8d36('0x39')],{'$or':_[_0x8d36('0x2e')](_0x18728b[_0x8d36('0x32')],function(_0x4863ab){var _0x11355b={};_0x11355b[_0x4863ab]={'$like':'%'+_0xff45e['query'][_0x8d36('0x38')]+'%'};return _0x11355b;})});}_0x18728b=_[_0x8d36('0x3b')]({},_0x18728b,_0xff45e[_0x8d36('0x3c')]);return _0x1c1e70[_0x8d36('0x51')](_0x18728b);}})[_0x8d36('0x20')](function(_0x14a7a2){if(_0x14a7a2){_0x47f96b=_0x14a7a2[_0x8d36('0x44')];if(!_0xff45e['query'][_0x8d36('0x35')](_0x8d36('0x36'))){_0x18728b[_0x8d36('0x1d')]=qs[_0x8d36('0x1d')](_0xff45e[_0x8d36('0x2f')][_0x8d36('0x1d')]);_0x18728b['offset']=qs[_0x8d36('0x1c')](_0xff45e[_0x8d36('0x2f')][_0x8d36('0x1c')]);}return _0x1c1e70[_0x8d36('0x51')](_0x18728b);}})[_0x8d36('0x20')](function(_0x4ac561){if(_0x4ac561){return _0x4ac561?{'count':_0x47f96b,'rows':_0x4ac561}:null;}})['then'](respondWithResult(_0x37b206,null))['catch'](handleError(_0x37b206,null));};exports['addIntervals']=function(_0x46dccd,_0x75cab8,_0x2fa332){return db[_0x8d36('0x29')][_0x8d36('0x4e')]({'where':{'id':_0x46dccd['params']['id']}})['then'](handleEntityNotFound(_0x75cab8,null))[_0x8d36('0x20')](function(_0x5ba8b3){if(_0x5ba8b3){return db[_0x8d36('0x52')][_0x8d36('0x53')](function(_0x23efac){return db['Interval'][_0x8d36('0x21')]({'where':{'IntervalId':_0x46dccd['params']['id']},'transaction':_0x23efac})[_0x8d36('0x20')](function(_0x1173c8){var _0x548b1e=_[_0x8d36('0x2e')](_0x46dccd['body'],function(_0x374732){delete _0x374732['id'];_0x374732[_0x8d36('0x54')]=_0x46dccd[_0x8d36('0x43')]['id'];return _0x374732;});return db[_0x8d36('0x29')][_0x8d36('0x55')](_0x548b1e,{'transaction':_0x23efac});});})[_0x8d36('0x20')](function(){return db['Interval'][_0x8d36('0x3f')]({'where':{'IntervalId':_0x46dccd['params']['id']}});});}})[_0x8d36('0x20')](respondWithResult(_0x75cab8,null))['catch'](handleError(_0x75cab8,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index cf273a5..2780002 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 _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 +var _0xefdd=['bluebird','request-promise','path','../../components/extensions/rewrite','exports','Interval','rewrite','lodash','util','api','moment'];(function(_0x815ac1,_0x29c8a4){var _0x4bf89a=function(_0x123c8c){while(--_0x123c8c){_0x815ac1['push'](_0x815ac1['shift']());}};_0x4bf89a(++_0x29c8a4);}(_0xefdd,0x75));var _0xdefd=function(_0x53735b,_0x2b9c21){_0x53735b=_0x53735b-0x0;var _0x558cc8=_0xefdd[_0x53735b];return _0x558cc8;};'use strict';var _=require(_0xdefd('0x0'));var util=require(_0xdefd('0x1'));var logger=require('../../config/logger')(_0xdefd('0x2'));var moment=require(_0xdefd('0x3'));var BPromise=require(_0xdefd('0x4'));var rp=require(_0xdefd('0x5'));var fs=require('fs');var path=require(_0xdefd('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./interval.attributes');var extensions=require(_0xdefd('0x7'));module[_0xdefd('0x8')]=function(_0x34eb0a,_0x525fc9){return _0x34eb0a['define'](_0xdefd('0x9'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x83c14e,_0x64bf77){extensions['rewrite'](_0x34eb0a,_0x83c14e);},'afterBulkCreate':function(_0x452a78,_0x3873b6,_0x4f644c){_0x4f644c();extensions[_0xdefd('0xa')](_0x34eb0a,_0x452a78[0x0]);},'afterUpdate':function(_0x124d0e,_0x46f07b){extensions[_0xdefd('0xa')](_0x34eb0a,_0x124d0e);},'afterDestroy':function(_0x249947,_0xa1dd4c){extensions['rewrite'](_0x34eb0a,_0x249947);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 97a91f6..3bc5f7c 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 _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 +var _0xbe41=['http','request','then','Interval,\x20%s,\x20%s','request\x20sent','Interval,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','Interval','findAll','options','where','attributes','limit','map','include','model','GetInterval','debug','stringify','ShowInterval','find','raw','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3ceabc,_0x37bbe4){var _0x4ad61f=function(_0x27946f){while(--_0x27946f){_0x3ceabc['push'](_0x3ceabc['shift']());}};_0x4ad61f(++_0x37bbe4);}(_0xbe41,0x1e1));var _0x1be4=function(_0x37bc3c,_0x30ec6e){_0x37bc3c=_0x37bc3c-0x0;var _0x2cecb3=_0xbe41[_0x37bc3c];return _0x2cecb3;};'use strict';var _=require(_0x1be4('0x0'));var util=require(_0x1be4('0x1'));var moment=require(_0x1be4('0x2'));var BPromise=require(_0x1be4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1be4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1be4('0x5'));var logger=require(_0x1be4('0x6'))(_0x1be4('0x7'));var config=require(_0x1be4('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1be4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3dfe3a,_0x2944ac,_0x343874){return new BPromise(function(_0x13c650,_0x1dbc60){return client[_0x1be4('0xa')](_0x3dfe3a,_0x343874)[_0x1be4('0xb')](function(_0x2cf6cc){logger['info'](_0x1be4('0xc'),_0x2944ac,_0x1be4('0xd'));logger['debug'](_0x1be4('0xe'),_0x2944ac,_0x1be4('0xd'),JSON['stringify'](_0x2cf6cc));if(_0x2cf6cc[_0x1be4('0xf')]){if(_0x2cf6cc['error'][_0x1be4('0x10')]===0x1f4){logger[_0x1be4('0xf')](_0x1be4('0xc'),_0x2944ac,_0x2cf6cc[_0x1be4('0xf')]['message']);return _0x1dbc60(_0x2cf6cc[_0x1be4('0xf')][_0x1be4('0x11')]);}logger[_0x1be4('0xf')](_0x1be4('0xc'),_0x2944ac,_0x2cf6cc[_0x1be4('0xf')][_0x1be4('0x11')]);return _0x13c650(_0x2cf6cc[_0x1be4('0xf')][_0x1be4('0x11')]);}else{logger[_0x1be4('0x12')](_0x1be4('0xc'),_0x2944ac,_0x1be4('0xd'));_0x13c650(_0x2cf6cc['result'][_0x1be4('0x11')]);}})[_0x1be4('0x13')](function(_0xf8782d){logger[_0x1be4('0xf')](_0x1be4('0xc'),_0x2944ac,_0xf8782d);_0x1dbc60(_0xf8782d);});});}exports['GetInterval']=function(_0x460c6a){var _0x1e82c9=this;return new Promise(function(_0x610b3f,_0x178800){return db[_0x1be4('0x14')][_0x1be4('0x15')]({'raw':_0x460c6a[_0x1be4('0x16')]?_0x460c6a['options']['raw']===undefined?!![]:![]:!![],'where':_0x460c6a[_0x1be4('0x16')]?_0x460c6a[_0x1be4('0x16')][_0x1be4('0x17')]||null:null,'attributes':_0x460c6a[_0x1be4('0x16')]?_0x460c6a[_0x1be4('0x16')][_0x1be4('0x18')]||null:null,'limit':_0x460c6a[_0x1be4('0x16')]?_0x460c6a[_0x1be4('0x16')][_0x1be4('0x19')]||null:null,'include':_0x460c6a[_0x1be4('0x16')]?_0x460c6a[_0x1be4('0x16')]['include']?_[_0x1be4('0x1a')](_0x460c6a[_0x1be4('0x16')][_0x1be4('0x1b')],function(_0x14da2f){return{'model':db[_0x14da2f['model']],'as':_0x14da2f['as'],'attributes':_0x14da2f['attributes'],'include':_0x14da2f[_0x1be4('0x1b')]?_[_0x1be4('0x1a')](_0x14da2f[_0x1be4('0x1b')],function(_0x1c2805){return{'model':db[_0x1c2805[_0x1be4('0x1c')]],'as':_0x1c2805['as'],'attributes':_0x1c2805['attributes'],'include':_0x1c2805['include']?_['map'](_0x1c2805[_0x1be4('0x1b')],function(_0x519b9c){return{'model':db[_0x519b9c[_0x1be4('0x1c')]],'as':_0x519b9c['as'],'attributes':_0x519b9c[_0x1be4('0x18')]};}):[]};}):[]};}):[]:[]})[_0x1be4('0xb')](function(_0x5db956){logger[_0x1be4('0x12')](_0x1be4('0x1d'),_0x460c6a);logger[_0x1be4('0x1e')](_0x1be4('0x1d'),_0x460c6a,JSON[_0x1be4('0x1f')](_0x5db956));_0x610b3f(_0x5db956);})[_0x1be4('0x13')](function(_0x13a118){logger[_0x1be4('0xf')](_0x1be4('0x1d'),_0x13a118[_0x1be4('0x11')],_0x460c6a);_0x178800(_0x1e82c9[_0x1be4('0xf')](0x1f4,_0x13a118[_0x1be4('0x11')]));});});};exports[_0x1be4('0x20')]=function(_0x182a2d){var _0x4f5b68=this;return new Promise(function(_0x42ca3d,_0x409d65){return db['Interval'][_0x1be4('0x21')]({'raw':_0x182a2d[_0x1be4('0x16')]?_0x182a2d[_0x1be4('0x16')][_0x1be4('0x22')]===undefined?!![]:![]:!![],'where':_0x182a2d[_0x1be4('0x16')]?_0x182a2d[_0x1be4('0x16')]['where']||null:null,'attributes':_0x182a2d['options']?_0x182a2d['options'][_0x1be4('0x18')]||null:null,'include':_0x182a2d[_0x1be4('0x16')]?_0x182a2d[_0x1be4('0x16')][_0x1be4('0x1b')]?_[_0x1be4('0x1a')](_0x182a2d[_0x1be4('0x16')][_0x1be4('0x1b')],function(_0x15a3ce){return{'model':db[_0x15a3ce[_0x1be4('0x1c')]],'as':_0x15a3ce['as'],'attributes':_0x15a3ce[_0x1be4('0x18')],'include':_0x15a3ce['include']?_[_0x1be4('0x1a')](_0x15a3ce['include'],function(_0x351515){return{'model':db[_0x351515['model']],'as':_0x351515['as'],'attributes':_0x351515['attributes'],'include':_0x351515[_0x1be4('0x1b')]?_[_0x1be4('0x1a')](_0x351515['include'],function(_0x4a464b){return{'model':db[_0x4a464b[_0x1be4('0x1c')]],'as':_0x4a464b['as'],'attributes':_0x4a464b[_0x1be4('0x18')]};}):[]};}):[]};}):[]:[]})[_0x1be4('0xb')](function(_0xff31eb){logger[_0x1be4('0x12')](_0x1be4('0x20'),_0x182a2d);logger[_0x1be4('0x1e')](_0x1be4('0x20'),_0x182a2d,JSON[_0x1be4('0x1f')](_0xff31eb));_0x42ca3d(_0xff31eb);})[_0x1be4('0x13')](function(_0x231f56){logger[_0x1be4('0xf')](_0x1be4('0x20'),_0x231f56[_0x1be4('0x11')],_0x182a2d);_0x409d65(_0x4f5b68[_0x1be4('0xf')](0x1f4,_0x231f56[_0x1be4('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 3869189..cf0a960 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 _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 +var _0xa525=['Router','../../components/auth/service','./jira.controller','post','isAuthenticated','send','exports','express'];(function(_0x36baf8,_0x315c4f){var _0x45b3cc=function(_0x4e3c08){while(--_0x4e3c08){_0x36baf8['push'](_0x36baf8['shift']());}};_0x45b3cc(++_0x315c4f);}(_0xa525,0x10f));var _0x5a52=function(_0x3dfb34,_0x3e8b10){_0x3dfb34=_0x3dfb34-0x0;var _0x4ceeb5=_0xa525[_0x3dfb34];return _0x4ceeb5;};'use strict';var express=require(_0x5a52('0x0'));var router=express[_0x5a52('0x1')]();var auth=require(_0x5a52('0x2'));var controller=require(_0x5a52('0x3'));router[_0x5a52('0x4')]('/',auth[_0x5a52('0x5')](),controller[_0x5a52('0x6')]);module[_0x5a52('0x7')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 7d92630..7c99d60 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 _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 +var _0xaf85=['request','setEncoding','utf8','end','status','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','x-forwarded-for','connection','socket','remoteAddress','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','oldToken','customfield_11502','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','application/json','Basic\x20','toString','base64'];(function(_0x290cda,_0x265739){var _0x32229b=function(_0x2e01ab){while(--_0x2e01ab){_0x290cda['push'](_0x290cda['shift']());}};_0x32229b(++_0x265739);}(_0xaf85,0x8f));var _0x5af8=function(_0x4a2ba2,_0x5901b9){_0x4a2ba2=_0x4a2ba2-0x0;var _0x1d09fd=_0xaf85[_0x4a2ba2];return _0x1d09fd;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require(_0x5af8('0x0'))(_0x5af8('0x1'));var USERNAME=_0x5af8('0x2');var PASSWORD=_0x5af8('0x3');function openIssue(_0x1aac3c,_0x2eafc4){var _0x2ca634={'fields':{'project':{'key':_0x1aac3c[_0x5af8('0x4')]||_0x5af8('0x5')},'summary':(_0x1aac3c[_0x5af8('0x6')]||_0x5af8('0x7'))+_0x5af8('0x8')+_0x1aac3c['ip'],'description':_0x1aac3c[_0x5af8('0x9')]||JSON[_0x5af8('0xa')](_0x1aac3c),'issuetype':{'name':_0x1aac3c[_0x5af8('0xb')]||_0x5af8('0xc')}}};_0x2ca634[_0x5af8('0xd')]['customfield_11500']=_0x1aac3c['email'];_0x2ca634[_0x5af8('0xd')]['customfield_11501']=_0x1aac3c[_0x5af8('0xe')];_0x2ca634['fields'][_0x5af8('0xf')]=_0x1aac3c['newToken'];_0x2ca634[_0x5af8('0xd')]['customfield_11503']=_0x1aac3c[_0x5af8('0x10')];_0x2ca634[_0x5af8('0xd')][_0x5af8('0x11')]=_0x1aac3c[_0x5af8('0x12')];_0x2ca634['fields'][_0x5af8('0x13')]=_0x1aac3c['ip'];var _0x39e7cf={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x5af8('0x14'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x5af8('0x15'),'Authorization':_0x5af8('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0x5af8('0x17')](_0x5af8('0x18'))}};var _0x516605=JSON['stringify'](_0x2ca634);var _0x30f3ef=https[_0x5af8('0x19')](_0x39e7cf,function(_0x25f074){_0x25f074[_0x5af8('0x1a')](_0x5af8('0x1b'));var _0x1a46dc='';_0x25f074['on']('data',function(_0x5995d6){_0x1a46dc+=_0x5995d6;});_0x25f074['on'](_0x5af8('0x1c'),function(){if(_0x2eafc4){return _0x2eafc4[_0x5af8('0x1d')](_0x25f074['statusCode'])[_0x5af8('0x1e')](JSON['parse'](_0x1a46dc));}});});_0x30f3ef['on'](_0x5af8('0x1f'),function(_0x403f61){if(_0x2eafc4){return _0x2eafc4['status'](0x1f4)['json']({'errors':[{'message':_0x5af8('0x20'),'type':_0x5af8('0x21')}]});}});_0x30f3ef[_0x5af8('0x22')](_0x516605);_0x30f3ef[_0x5af8('0x1c')]();}exports[_0x5af8('0x23')]=openIssue;exports[_0x5af8('0x24')]=function(_0x3f50f3,_0x1aaa53){_0x3f50f3[_0x5af8('0x25')]['ip']=_0x3f50f3['headers'][_0x5af8('0x26')]||_0x3f50f3[_0x5af8('0x27')]['remoteAddress']||_0x3f50f3[_0x5af8('0x28')][_0x5af8('0x29')]||_0x3f50f3[_0x5af8('0x27')][_0x5af8('0x28')][_0x5af8('0x29')];return openIssue(_0x3f50f3[_0x5af8('0x25')],_0x1aaa53);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index ff97675..9b8fb8d 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 _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 +var _0x0890=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','destroy','exports','multer','util','express','Router'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0x0890,0x74));var _0x0089=function(_0x43464b,_0x3e1c7f){_0x43464b=_0x43464b-0x0;var _0x26dc35=_0x0890[_0x43464b];return _0x26dc35;};'use strict';var multer=require(_0x0089('0x0'));var util=require(_0x0089('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0089('0x2'));var router=express[_0x0089('0x3')]();var auth=require(_0x0089('0x4'));var interaction=require(_0x0089('0x5'));var config=require(_0x0089('0x6'));var controller=require(_0x0089('0x7'));router[_0x0089('0x8')]('/',auth[_0x0089('0x9')](),controller[_0x0089('0xa')]);router[_0x0089('0x8')](_0x0089('0xb'),auth[_0x0089('0x9')](),controller[_0x0089('0xc')]);router[_0x0089('0x8')](_0x0089('0xd'),auth[_0x0089('0x9')](),controller[_0x0089('0xe')]);router['post']('/',auth[_0x0089('0x9')](),controller[_0x0089('0xf')]);router[_0x0089('0x10')](_0x0089('0xd'),auth[_0x0089('0x9')](),controller[_0x0089('0x11')]);router['delete'](_0x0089('0xd'),auth[_0x0089('0x9')](),controller[_0x0089('0x12')]);module[_0x0089('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 84819a0..c5e4fa1 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 _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 +var _0x12a7=['long','STRING','sequelize','TEXT'];(function(_0x51727d,_0x306252){var _0x54c249=function(_0x2aad2d){while(--_0x2aad2d){_0x51727d['push'](_0x51727d['shift']());}};_0x54c249(++_0x306252);}(_0x12a7,0x112));var _0x712a=function(_0x648409,_0x4312be){_0x648409=_0x648409-0x0;var _0x37d2c8=_0x12a7[_0x648409];return _0x37d2c8;};'use strict';var Sequelize=require(_0x712a('0x0'));module['exports']={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0x712a('0x1')](_0x712a('0x2'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x712a('0x3')]},'queue':{'type':Sequelize[_0x712a('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x712a('0x3')]},'calleridnum':{'type':Sequelize[_0x712a('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 d8203ab..84bc5b5 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 _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 +var _0xa77a=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','save','then','destroy','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','JscriptyAnswerReport','includeAll','include','rows','catch','show','find','create','body','params','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x4b26b5,_0x4f71fd){var _0x4dec71=function(_0x184329){while(--_0x184329){_0x4b26b5['push'](_0x4b26b5['shift']());}};_0x4dec71(++_0x4f71fd);}(_0xa77a,0x10f));var _0xaa77=function(_0x450bf9,_0x1895de){_0x450bf9=_0x450bf9-0x0;var _0x268350=_0xa77a[_0x450bf9];return _0x268350;};'use strict';var pdf=require(_0xaa77('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaa77('0x1'));var jsonpatch=require(_0xaa77('0x2'));var rp=require(_0xaa77('0x3'));var moment=require(_0xaa77('0x4'));var BPromise=require(_0xaa77('0x5'));var Mustache=require(_0xaa77('0x6'));var util=require('util');var path=require(_0xaa77('0x7'));var sox=require(_0xaa77('0x8'));var csv=require(_0xaa77('0x9'));var ejs=require(_0xaa77('0xa'));var fs=require('fs');var _=require(_0xaa77('0xb'));var squel=require('squel');var crypto=require(_0xaa77('0xc'));var jsforce=require(_0xaa77('0xd'));var deskjs=require(_0xaa77('0xe'));var toCsv=require('to-csv');var querystring=require(_0xaa77('0xf'));var Papa=require(_0xaa77('0x10'));var Redis=require(_0xaa77('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xaa77('0x12'));var as=require(_0xaa77('0x13'));var hardwareService=require(_0xaa77('0x14'));var logger=require('../../config/logger')(_0xaa77('0x15'));var utils=require(_0xaa77('0x16'));var config=require(_0xaa77('0x17'));var db=require(_0xaa77('0x18'))['db'];function respondWithStatusCode(_0x1feaf2,_0x2c95b3){_0x2c95b3=_0x2c95b3||0xcc;return function(_0x55d24d){if(_0x55d24d){return _0x1feaf2[_0xaa77('0x19')](_0x2c95b3);}return _0x1feaf2[_0xaa77('0x1a')](_0x2c95b3)[_0xaa77('0x1b')]();};}function respondWithResult(_0x181d7d,_0x8f8b85){_0x8f8b85=_0x8f8b85||0xc8;return function(_0x5b472f){if(_0x5b472f){return _0x181d7d[_0xaa77('0x1a')](_0x8f8b85)[_0xaa77('0x1c')](_0x5b472f);}};}function respondWithFilteredResult(_0x145d07,_0x2aa60a){return function(_0x2b8c5a){if(_0x2b8c5a){var _0x391de7=_0x2b8c5a[_0xaa77('0x1d')],_0x2f05d2=_0x2aa60a[_0xaa77('0x1e')],_0x1f4fe=_0x2aa60a[_0xaa77('0x1e')]+_0x2aa60a[_0xaa77('0x1f')],_0x22b6bb;if(_0x1f4fe>=_0x391de7){_0x1f4fe=_0x391de7;_0x22b6bb=0xc8;}else{_0x22b6bb=0xce;}_0x145d07[_0xaa77('0x1a')](_0x22b6bb);return _0x145d07['set'](_0xaa77('0x20'),_0x2f05d2+'-'+_0x1f4fe+'/'+_0x391de7)[_0xaa77('0x1c')](_0x2b8c5a);}return null;};}function patchUpdates(_0x3fe714){return function(_0x59de32){try{jsonpatch['apply'](_0x59de32,_0x3fe714,!![]);}catch(_0x35f8c7){return BPromise['reject'](_0x35f8c7);}return _0x59de32[_0xaa77('0x21')]();};}function saveUpdates(_0x1b1920,_0x4e3e7a){return function(_0xb622a3){if(_0xb622a3){return _0xb622a3['update'](_0x1b1920)[_0xaa77('0x22')](function(_0x503f84){return _0x503f84;});}return null;};}function removeEntity(_0x473cfd,_0x4a695b){return function(_0x4d268d){if(_0x4d268d){return _0x4d268d[_0xaa77('0x23')]()[_0xaa77('0x22')](function(){_0x473cfd[_0xaa77('0x1a')](0xcc)[_0xaa77('0x1b')]();});}};}function handleEntityNotFound(_0x55a364,_0xb0871f){return function(_0x425d41){if(!_0x425d41){_0x55a364['sendStatus'](0x194);}return _0x425d41;};}function handleError(_0x230a18,_0x2a1e97){_0x2a1e97=_0x2a1e97||0x1f4;return function(_0x29aa13){logger[_0xaa77('0x24')](_0x29aa13['stack']);if(_0x29aa13[_0xaa77('0x25')]){delete _0x29aa13['name'];}_0x230a18[_0xaa77('0x1a')](_0x2a1e97)[_0xaa77('0x26')](_0x29aa13);};}exports[_0xaa77('0x27')]=function(_0x5c383b,_0x271076){var _0x31b890={},_0x37aff1={},_0x84a22d={'count':0x0,'rows':[]};var _0x3e051e=_[_0xaa77('0x28')](db['JscriptyAnswerReport'][_0xaa77('0x29')],function(_0x59d438){return{'name':_0x59d438['fieldName'],'type':_0x59d438[_0xaa77('0x2a')][_0xaa77('0x2b')]};});_0x37aff1[_0xaa77('0x2c')]=_['map'](_0x3e051e,_0xaa77('0x25'));_0x37aff1[_0xaa77('0x2d')]=_[_0xaa77('0x2e')](_0x5c383b[_0xaa77('0x2d')]);_0x37aff1[_0xaa77('0x2f')]=_[_0xaa77('0x30')](_0x37aff1['model'],_0x37aff1[_0xaa77('0x2d')]);_0x31b890[_0xaa77('0x31')]=_[_0xaa77('0x30')](_0x37aff1[_0xaa77('0x2c')],qs[_0xaa77('0x32')](_0x5c383b[_0xaa77('0x2d')][_0xaa77('0x32')]));_0x31b890['attributes']=_0x31b890[_0xaa77('0x31')][_0xaa77('0x33')]?_0x31b890['attributes']:_0x37aff1[_0xaa77('0x2c')];if(!_0x5c383b['query'][_0xaa77('0x34')](_0xaa77('0x35'))){_0x31b890[_0xaa77('0x1f')]=qs[_0xaa77('0x1f')](_0x5c383b['query'][_0xaa77('0x1f')]);_0x31b890['offset']=qs[_0xaa77('0x1e')](_0x5c383b[_0xaa77('0x2d')][_0xaa77('0x1e')]);}_0x31b890['order']=qs['sort'](_0x5c383b['query'][_0xaa77('0x36')]);_0x31b890[_0xaa77('0x37')]=qs['filters'](_[_0xaa77('0x38')](_0x5c383b[_0xaa77('0x2d')],_0x37aff1['filters']),_0x3e051e);if(_0x5c383b[_0xaa77('0x2d')][_0xaa77('0x39')]){_0x31b890[_0xaa77('0x37')]=_['merge'](_0x31b890[_0xaa77('0x37')],{'$or':_['map'](_0x3e051e,function(_0x5562fc){if(_0x5562fc[_0xaa77('0x2a')]!==_0xaa77('0x3a')){var _0x2a9591={};_0x2a9591[_0x5562fc[_0xaa77('0x25')]]={'$like':'%'+_0x5c383b['query'][_0xaa77('0x39')]+'%'};return _0x2a9591;}})});}_0x31b890=_[_0xaa77('0x3b')]({},_0x31b890,_0x5c383b[_0xaa77('0x3c')]);var _0x23f190={'where':_0x31b890[_0xaa77('0x37')]};return db[_0xaa77('0x3d')]['count'](_0x23f190)[_0xaa77('0x22')](function(_0x152b3e){_0x84a22d[_0xaa77('0x1d')]=_0x152b3e;if(_0x5c383b[_0xaa77('0x2d')][_0xaa77('0x3e')]){_0x31b890[_0xaa77('0x3f')]=[{'all':!![]}];}return db[_0xaa77('0x3d')]['findAll'](_0x31b890);})[_0xaa77('0x22')](function(_0x5a9449){_0x84a22d[_0xaa77('0x40')]=_0x5a9449;return _0x84a22d;})[_0xaa77('0x22')](respondWithFilteredResult(_0x271076,_0x31b890))[_0xaa77('0x41')](handleError(_0x271076,null));};exports[_0xaa77('0x42')]=function(_0x3d8acb,_0x2b5528){var _0x4c53fc={'raw':!![],'where':{'id':_0x3d8acb['params']['id']}},_0x59ee43={};_0x59ee43[_0xaa77('0x2c')]=_[_0xaa77('0x2e')](db['JscriptyAnswerReport']['rawAttributes']);_0x59ee43['query']=_[_0xaa77('0x2e')](_0x3d8acb[_0xaa77('0x2d')]);_0x59ee43[_0xaa77('0x2f')]=_[_0xaa77('0x30')](_0x59ee43['model'],_0x59ee43[_0xaa77('0x2d')]);_0x4c53fc[_0xaa77('0x31')]=_[_0xaa77('0x30')](_0x59ee43[_0xaa77('0x2c')],qs[_0xaa77('0x32')](_0x3d8acb[_0xaa77('0x2d')]['fields']));_0x4c53fc['attributes']=_0x4c53fc[_0xaa77('0x31')][_0xaa77('0x33')]?_0x4c53fc[_0xaa77('0x31')]:_0x59ee43[_0xaa77('0x2c')];if(_0x3d8acb[_0xaa77('0x2d')][_0xaa77('0x3e')]){_0x4c53fc[_0xaa77('0x3f')]=[{'all':!![]}];}_0x4c53fc=_[_0xaa77('0x3b')]({},_0x4c53fc,_0x3d8acb[_0xaa77('0x3c')]);return db[_0xaa77('0x3d')][_0xaa77('0x43')](_0x4c53fc)[_0xaa77('0x22')](handleEntityNotFound(_0x2b5528,null))[_0xaa77('0x22')](respondWithResult(_0x2b5528,null))[_0xaa77('0x41')](handleError(_0x2b5528,null));};exports[_0xaa77('0x44')]=function(_0x499e3f,_0x5cd849){return db[_0xaa77('0x3d')]['create'](_0x499e3f[_0xaa77('0x45')],{})[_0xaa77('0x22')](respondWithResult(_0x5cd849,0xc9))['catch'](handleError(_0x5cd849,null));};exports['update']=function(_0x576c38,_0x2d664e){if(_0x576c38['body']['id']){delete _0x576c38[_0xaa77('0x45')]['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x576c38[_0xaa77('0x46')]['id']}})[_0xaa77('0x22')](handleEntityNotFound(_0x2d664e,null))[_0xaa77('0x22')](saveUpdates(_0x576c38[_0xaa77('0x45')],null))[_0xaa77('0x22')](respondWithResult(_0x2d664e,null))[_0xaa77('0x41')](handleError(_0x2d664e,null));};exports[_0xaa77('0x23')]=function(_0x39763c,_0x1acb0a){return db[_0xaa77('0x3d')][_0xaa77('0x43')]({'where':{'id':_0x39763c[_0xaa77('0x46')]['id']}})['then'](handleEntityNotFound(_0x1acb0a,null))[_0xaa77('0x22')](removeEntity(_0x1acb0a,null))[_0xaa77('0x41')](handleError(_0x1acb0a,null));};exports[_0xaa77('0x47')]=function(_0x478fd1,_0x17caab){return db['JscriptyAnswerReport'][_0xaa77('0x47')]()['then'](respondWithResult(_0x17caab,null))['catch'](handleError(_0x17caab,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 511cd1d..2e725a4 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 _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 +var _0x0318=['JscriptyAnswerReport','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x4d3a2b,_0x32a224){var _0xdd32c8=function(_0x18f96f){while(--_0x18f96f){_0x4d3a2b['push'](_0x4d3a2b['shift']());}};_0xdd32c8(++_0x32a224);}(_0x0318,0x15f));var _0x8031=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0318[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x8031('0x0'));var logger=require(_0x8031('0x1'))('api');var moment=require(_0x8031('0x2'));var BPromise=require(_0x8031('0x3'));var rp=require(_0x8031('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8031('0x5'));var config=require(_0x8031('0x6'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x8031('0x7')]=function(_0x28e2b2,_0x3f59d1){return _0x28e2b2[_0x8031('0x8')](_0x8031('0x9'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index e98cda8..f7bffb2 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 _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 +var _0x1b07=['../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x28467d,_0x2ac2bf){var _0x22cbbd=function(_0x3288ec){while(--_0x3288ec){_0x28467d['push'](_0x28467d['shift']());}};_0x22cbbd(++_0x2ac2bf);}(_0x1b07,0x17f));var _0x71b0=function(_0x40015a,_0x415db5){_0x40015a=_0x40015a-0x0;var _0x42f8a4=_0x1b07[_0x40015a];return _0x42f8a4;};'use strict';var _=require(_0x71b0('0x0'));var util=require(_0x71b0('0x1'));var moment=require(_0x71b0('0x2'));var BPromise=require(_0x71b0('0x3'));var rs=require(_0x71b0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x71b0('0x5'));var logger=require(_0x71b0('0x6'))(_0x71b0('0x7'));var config=require(_0x71b0('0x8'));var jayson=require(_0x71b0('0x9'));var client=jayson[_0x71b0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2551ae,_0x5216d4,_0x3de993){return new BPromise(function(_0x3f1adb,_0x44b004){return client['request'](_0x2551ae,_0x3de993)[_0x71b0('0xb')](function(_0x2f89ac){logger[_0x71b0('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5216d4,_0x71b0('0xd'));logger[_0x71b0('0xe')](_0x71b0('0xf'),_0x5216d4,_0x71b0('0xd'),JSON[_0x71b0('0x10')](_0x2f89ac));if(_0x2f89ac[_0x71b0('0x11')]){if(_0x2f89ac['error'][_0x71b0('0x12')]===0x1f4){logger[_0x71b0('0x11')](_0x71b0('0x13'),_0x5216d4,_0x2f89ac[_0x71b0('0x11')][_0x71b0('0x14')]);return _0x44b004(_0x2f89ac['error']['message']);}logger[_0x71b0('0x11')](_0x71b0('0x13'),_0x5216d4,_0x2f89ac[_0x71b0('0x11')][_0x71b0('0x14')]);return _0x3f1adb(_0x2f89ac[_0x71b0('0x11')][_0x71b0('0x14')]);}else{logger[_0x71b0('0xc')](_0x71b0('0x13'),_0x5216d4,_0x71b0('0xd'));_0x3f1adb(_0x2f89ac[_0x71b0('0x15')]['message']);}})[_0x71b0('0x16')](function(_0x118fe1){logger[_0x71b0('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5216d4,_0x118fe1);_0x44b004(_0x118fe1);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index fa577cb..16ce61e 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 _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 +var _0xfaad=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','getSessions','getAnswers','/:id/summary','30s','getSummary','post','create','clone','put','destroy','exports','util','connect-timeout','express','../../components/auth/service'];(function(_0x1674ae,_0x10ac2d){var _0x5c7c69=function(_0x2783c7){while(--_0x2783c7){_0x1674ae['push'](_0x1674ae['shift']());}};_0x5c7c69(++_0x10ac2d);}(_0xfaad,0x1a0));var _0xdfaa=function(_0x1dc818,_0x40934e){_0x1dc818=_0x1dc818-0x0;var _0x4389bf=_0xfaad[_0x1dc818];return _0x4389bf;};'use strict';var multer=require('multer');var util=require(_0xdfaa('0x0'));var path=require('path');var timeout=require(_0xdfaa('0x1'));var express=require(_0xdfaa('0x2'));var router=express['Router']();var auth=require(_0xdfaa('0x3'));var interaction=require(_0xdfaa('0x4'));var config=require(_0xdfaa('0x5'));var controller=require('./jscriptyProject.controller');router[_0xdfaa('0x6')]('/',auth[_0xdfaa('0x7')](),controller['index']);router[_0xdfaa('0x6')](_0xdfaa('0x8'),auth[_0xdfaa('0x7')](),controller[_0xdfaa('0x9')]);router[_0xdfaa('0x6')]('/:id/sessions',auth[_0xdfaa('0x7')](),controller[_0xdfaa('0xa')]);router['get']('/:id/answers',auth[_0xdfaa('0x7')](),controller[_0xdfaa('0xb')]);router[_0xdfaa('0x6')](_0xdfaa('0xc'),auth[_0xdfaa('0x7')](),timeout(_0xdfaa('0xd')),controller[_0xdfaa('0xe')]);router[_0xdfaa('0xf')]('/',auth[_0xdfaa('0x7')](),controller[_0xdfaa('0x10')]);router[_0xdfaa('0xf')]('/:id/clone',auth[_0xdfaa('0x7')](),controller[_0xdfaa('0x11')]);router[_0xdfaa('0x12')](_0xdfaa('0x8'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xdfaa('0x8'),auth['isAuthenticated'](),controller[_0xdfaa('0x13')]);module[_0xdfaa('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 6480de8..4d70d04 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 _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 +var _0x51ef=['exports','STRING','name','TEXT','setDataValue','formData','stringify','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash'];(function(_0x588427,_0x416033){var _0x282027=function(_0x5b2a7e){while(--_0x5b2a7e){_0x588427['push'](_0x588427['shift']());}};_0x282027(++_0x416033);}(_0x51ef,0x1cc));var _0xf51e=function(_0xc54915,_0x216d2a){_0xc54915=_0xc54915-0x0;var _0x698434=_0x51ef[_0xc54915];return _0x698434;};'use strict';var Sequelize=require(_0xf51e('0x0'));var _=require(_0xf51e('0x1'));var util=require('util');module[_0xf51e('0x2')]={'name':{'type':Sequelize[_0xf51e('0x3')],'unique':_0xf51e('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xf51e('0x5')]('long'),'set':function(_0xa522be){if(_['isObjectLike'](_0xa522be)){this[_0xf51e('0x6')](_0xf51e('0x7'),JSON[_0xf51e('0x8')](_0xa522be));}else if(_[_0xf51e('0x9')](_0xa522be)){this[_0xf51e('0x6')]('formData',_0xa522be);}else{this['setDataValue'](_0xf51e('0x7'),util['format'](_0xf51e('0xa'),this[_0xf51e('0xb')](_0xf51e('0x4'))||'',this[_0xf51e('0xb')](_0xf51e('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xf51e('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xf51e('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 94d423f..e77c951 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 _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 +var _0x540f=['offset','sort','pick','filter','where','merge','VIRTUAL','options','JscriptyProject','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getSessions','findOne','JscriptySessionReport','getAnswers','JscriptyAnswerReport','order','ProjectId','number','fromCharCode','toString','indexOf','getSummary','startTime','starttime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','json','reject','update','then','destroy','Projects','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit'];(function(_0x29118b,_0x1bb64f){var _0x321aad=function(_0x6bcc87){while(--_0x6bcc87){_0x29118b['push'](_0x29118b['shift']());}};_0x321aad(++_0x1bb64f);}(_0x540f,0x12e));var _0xf540=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x540f[_0xac151d];return _0x111dba;};'use strict';var pdf=require(_0xf540('0x0'));var emlformat=require(_0xf540('0x1'));var rimraf=require(_0xf540('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf540('0x3'));var rp=require('request-promise');var moment=require(_0xf540('0x4'));var BPromise=require(_0xf540('0x5'));var Mustache=require(_0xf540('0x6'));var util=require(_0xf540('0x7'));var path=require(_0xf540('0x8'));var sox=require(_0xf540('0x9'));var csv=require(_0xf540('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf540('0xb'));var crypto=require(_0xf540('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf540('0xd'));var toCsv=require(_0xf540('0xa'));var querystring=require(_0xf540('0xe'));var Papa=require(_0xf540('0xf'));var Redis=require('ioredis');var authService=require(_0xf540('0x10'));var qs=require(_0xf540('0x11'));var as=require(_0xf540('0x12'));var hardwareService=require(_0xf540('0x13'));var logger=require(_0xf540('0x14'))('api');var utils=require(_0xf540('0x15'));var config=require('../../config/environment');var db=require(_0xf540('0x16'))['db'];function respondWithStatusCode(_0x20db3f,_0x131250){_0x131250=_0x131250||0xcc;return function(_0xeb105c){if(_0xeb105c){return _0x20db3f[_0xf540('0x17')](_0x131250);}return _0x20db3f[_0xf540('0x18')](_0x131250)[_0xf540('0x19')]();};}function respondWithResult(_0x3a464d,_0x26df62){_0x26df62=_0x26df62||0xc8;return function(_0x456d56){if(_0x456d56){return _0x3a464d[_0xf540('0x18')](_0x26df62)['json'](_0x456d56);}};}function respondWithFilteredResult(_0xab3fcd,_0x11293f){return function(_0xd3b924){if(_0xd3b924){var _0x5a5f3a=_0xd3b924[_0xf540('0x1a')],_0x36d210=_0x11293f['offset'],_0x304839=_0x11293f['offset']+_0x11293f[_0xf540('0x1b')],_0x191e35;if(_0x304839>=_0x5a5f3a){_0x304839=_0x5a5f3a;_0x191e35=0xc8;}else{_0x191e35=0xce;}_0xab3fcd[_0xf540('0x18')](_0x191e35);return _0xab3fcd[_0xf540('0x1c')](_0xf540('0x1d'),_0x36d210+'-'+_0x304839+'/'+_0x5a5f3a)[_0xf540('0x1e')](_0xd3b924);}return null;};}function patchUpdates(_0x24ebc7){return function(_0x31c69b){try{jsonpatch['apply'](_0x31c69b,_0x24ebc7,!![]);}catch(_0x4c149e){return BPromise[_0xf540('0x1f')](_0x4c149e);}return _0x31c69b['save']();};}function saveUpdates(_0x3992b8,_0x5eaddd){return function(_0x4c5538){if(_0x4c5538){return _0x4c5538[_0xf540('0x20')](_0x3992b8)[_0xf540('0x21')](function(_0x128b0b){return _0x128b0b;});}return null;};}function removeEntity(_0x6dec21,_0xb113d6){return function(_0x29b65c){if(_0x29b65c){return _0x29b65c[_0xf540('0x22')]()['then'](function(){var _0x517df4=_0x29b65c['get']({'plain':!![]});var _0x3ca26a=_0xf540('0x23');return db['UserProfileResource'][_0xf540('0x22')]({'where':{'type':_0x3ca26a,'resourceId':_0x517df4['id']}})[_0xf540('0x21')](function(){return _0x29b65c;});})['then'](function(){_0x6dec21['status'](0xcc)[_0xf540('0x19')]();});}};}function handleEntityNotFound(_0x365017,_0x16978d){return function(_0x4c62f5){if(!_0x4c62f5){_0x365017[_0xf540('0x17')](0x194);}return _0x4c62f5;};}function handleError(_0x223f38,_0xe7c5f1){_0xe7c5f1=_0xe7c5f1||0x1f4;return function(_0x5f1205){logger[_0xf540('0x24')](_0x5f1205[_0xf540('0x25')]);if(_0x5f1205[_0xf540('0x26')]){delete _0x5f1205[_0xf540('0x26')];}_0x223f38[_0xf540('0x18')](_0xe7c5f1)[_0xf540('0x27')](_0x5f1205);};}exports[_0xf540('0x28')]=function(_0x16749a,_0x27fe13){var _0x236c79={},_0x402d67={},_0x2de632={'count':0x0,'rows':[]};var _0x39b9c=_[_0xf540('0x29')](db['JscriptyProject'][_0xf540('0x2a')],function(_0x11fd08){return{'name':_0x11fd08[_0xf540('0x2b')],'type':_0x11fd08[_0xf540('0x2c')][_0xf540('0x2d')]};});_0x402d67['model']=_[_0xf540('0x29')](_0x39b9c,'name');_0x402d67['query']=_[_0xf540('0x2e')](_0x16749a[_0xf540('0x2f')]);_0x402d67[_0xf540('0x30')]=_[_0xf540('0x31')](_0x402d67[_0xf540('0x32')],_0x402d67[_0xf540('0x2f')]);_0x236c79['attributes']=_[_0xf540('0x31')](_0x402d67[_0xf540('0x32')],qs[_0xf540('0x33')](_0x16749a['query'][_0xf540('0x33')]));_0x236c79[_0xf540('0x34')]=_0x236c79[_0xf540('0x34')]['length']?_0x236c79[_0xf540('0x34')]:_0x402d67[_0xf540('0x32')];if(!_0x16749a[_0xf540('0x2f')][_0xf540('0x35')](_0xf540('0x36'))){_0x236c79[_0xf540('0x1b')]=qs[_0xf540('0x1b')](_0x16749a[_0xf540('0x2f')][_0xf540('0x1b')]);_0x236c79['offset']=qs[_0xf540('0x37')](_0x16749a[_0xf540('0x2f')]['offset']);}_0x236c79['order']=qs[_0xf540('0x38')](_0x16749a[_0xf540('0x2f')][_0xf540('0x38')]);_0x236c79['where']=qs[_0xf540('0x30')](_[_0xf540('0x39')](_0x16749a['query'],_0x402d67[_0xf540('0x30')]),_0x39b9c);if(_0x16749a[_0xf540('0x2f')][_0xf540('0x3a')]){_0x236c79[_0xf540('0x3b')]=_[_0xf540('0x3c')](_0x236c79['where'],{'$or':_[_0xf540('0x29')](_0x39b9c,function(_0x220af2){if(_0x220af2[_0xf540('0x2c')]!==_0xf540('0x3d')){var _0x412dfa={};_0x412dfa[_0x220af2[_0xf540('0x26')]]={'$like':'%'+_0x16749a[_0xf540('0x2f')][_0xf540('0x3a')]+'%'};return _0x412dfa;}})});}_0x236c79=_['merge']({},_0x236c79,_0x16749a[_0xf540('0x3e')]);var _0x4638ee={'where':_0x236c79[_0xf540('0x3b')]};return db[_0xf540('0x3f')]['count'](_0x4638ee)['then'](function(_0x2b3c77){_0x2de632[_0xf540('0x1a')]=_0x2b3c77;if(_0x16749a['query'][_0xf540('0x40')]){_0x236c79['include']=[{'all':!![]}];}return db[_0xf540('0x3f')][_0xf540('0x41')](_0x236c79);})[_0xf540('0x21')](function(_0x19b09f){_0x2de632[_0xf540('0x42')]=_0x19b09f;return _0x2de632;})[_0xf540('0x21')](respondWithFilteredResult(_0x27fe13,_0x236c79))[_0xf540('0x43')](handleError(_0x27fe13,null));};exports[_0xf540('0x44')]=function(_0x213ee8,_0x3e4093){var _0x19c9d5={'raw':![],'where':{'id':_0x213ee8[_0xf540('0x45')]['id']}},_0x2f0336={};_0x2f0336[_0xf540('0x32')]=_[_0xf540('0x2e')](db[_0xf540('0x3f')][_0xf540('0x2a')]);_0x2f0336['query']=_[_0xf540('0x2e')](_0x213ee8[_0xf540('0x2f')]);_0x2f0336[_0xf540('0x30')]=_[_0xf540('0x31')](_0x2f0336['model'],_0x2f0336['query']);_0x19c9d5[_0xf540('0x34')]=_[_0xf540('0x31')](_0x2f0336[_0xf540('0x32')],qs[_0xf540('0x33')](_0x213ee8[_0xf540('0x2f')]['fields']));_0x19c9d5[_0xf540('0x34')]=_0x19c9d5[_0xf540('0x34')][_0xf540('0x46')]?_0x19c9d5[_0xf540('0x34')]:_0x2f0336[_0xf540('0x32')];if(_0x213ee8['query'][_0xf540('0x40')]){_0x19c9d5[_0xf540('0x47')]=[{'all':!![]}];}_0x19c9d5=_[_0xf540('0x3c')]({},_0x19c9d5,_0x213ee8[_0xf540('0x3e')]);return db[_0xf540('0x3f')][_0xf540('0x48')](_0x19c9d5)[_0xf540('0x21')](handleEntityNotFound(_0x3e4093,null))[_0xf540('0x21')](respondWithResult(_0x3e4093,null))[_0xf540('0x43')](handleError(_0x3e4093,null));};exports[_0xf540('0x49')]=function(_0x4ba25c,_0x241a39){return db[_0xf540('0x3f')][_0xf540('0x49')](_0x4ba25c[_0xf540('0x4a')],{})[_0xf540('0x21')](function(_0x2e3203){var _0x55cc52=_0x4ba25c[_0xf540('0x4b')][_0xf540('0x4c')]({'plain':!![]});if(!_0x55cc52)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x55cc52[_0xf540('0x4d')]==='user'){var _0x292b78=_0x2e3203[_0xf540('0x4c')]({'plain':!![]});var _0x113d92=_0xf540('0x23');return db[_0xf540('0x4e')][_0xf540('0x48')]({'where':{'name':_0x113d92,'userProfileId':_0x55cc52[_0xf540('0x4f')]},'raw':!![]})[_0xf540('0x21')](function(_0x25bd1c){if(_0x25bd1c&&_0x25bd1c[_0xf540('0x50')]===0x0){return db[_0xf540('0x51')][_0xf540('0x49')]({'name':_0x292b78[_0xf540('0x26')],'resourceId':_0x292b78['id'],'type':_0x25bd1c[_0xf540('0x26')],'sectionId':_0x25bd1c['id']},{})[_0xf540('0x21')](function(){return _0x2e3203;});}else{return _0x2e3203;}})[_0xf540('0x43')](function(_0xa310e5){logger['error'](_0xf540('0x52'),_0xa310e5);throw _0xa310e5;});}return _0x2e3203;})[_0xf540('0x21')](respondWithResult(_0x241a39,0xc9))[_0xf540('0x43')](handleError(_0x241a39,null));};exports[_0xf540('0x53')]=function(_0x9d85f0,_0x50fa7b){var _0x145090={'where':{'id':_0x9d85f0[_0xf540('0x45')]['id']}},_0x17700b={};_0x17700b[_0xf540('0x32')]=_['keys'](db[_0xf540('0x3f')][_0xf540('0x2a')]);_0x145090[_0xf540('0x34')]=_[_0xf540('0x31')](_0x17700b[_0xf540('0x32')],qs[_0xf540('0x33')](_0x9d85f0[_0xf540('0x2f')][_0xf540('0x33')]));_0x145090[_0xf540('0x34')]=_0x145090[_0xf540('0x34')][_0xf540('0x46')]?_0x145090[_0xf540('0x34')]:_0x17700b[_0xf540('0x32')];if(_0x9d85f0[_0xf540('0x2f')][_0xf540('0x40')]){_0x145090[_0xf540('0x47')]=[{'all':!![]}];}_0x145090=_[_0xf540('0x3c')]({},_0x145090,_0x9d85f0[_0xf540('0x3e')]);return db['JscriptyProject'][_0xf540('0x48')](_0x145090)[_0xf540('0x21')](handleEntityNotFound(_0x50fa7b,null))[_0xf540('0x21')](function(_0x3be478){if(_0x3be478){var _0x4988f0=_0x3be478['get']({'plain':!![]});_0x4988f0=qs[_0xf540('0x54')](_0x4988f0,['id',_0xf540('0x55'),_0xf540('0x56')]);_0x9d85f0[_0xf540('0x4a')]=_['omit'](_0x9d85f0[_0xf540('0x4a')],['id','createdAt','updatedAt']);return db[_0xf540('0x3f')][_0xf540('0x49')](_[_0xf540('0x3c')](_0x4988f0,_0x9d85f0[_0xf540('0x4a')]),{'include':_0x9d85f0['query'][_0xf540('0x40')]?[{'all':!![]}]:undefined})[_0xf540('0x21')](function(_0x364082){var _0x5e68eb=_0x9d85f0[_0xf540('0x4b')][_0xf540('0x4c')]({'plain':!![]});if(!_0x5e68eb)throw new Error(_0xf540('0x57'));if(_0x5e68eb[_0xf540('0x4d')]==='user'){var _0x1196f0=_0x364082['get']({'plain':!![]});var _0x5f4cae=_0xf540('0x23');return db[_0xf540('0x4e')][_0xf540('0x48')]({'where':{'name':_0x5f4cae,'userProfileId':_0x5e68eb['userProfileId']},'raw':!![]})[_0xf540('0x21')](function(_0x462cda){if(_0x462cda&&_0x462cda[_0xf540('0x50')]===0x0){return db[_0xf540('0x51')][_0xf540('0x49')]({'name':_0x1196f0[_0xf540('0x26')],'resourceId':_0x1196f0['id'],'type':_0x462cda[_0xf540('0x26')],'sectionId':_0x462cda['id']},{})[_0xf540('0x21')](function(){return _0x364082;});}else{return _0x364082;}})[_0xf540('0x43')](function(_0x4b318b){logger['error'](_0xf540('0x52'),_0x4b318b);throw _0x4b318b;});}return _0x364082;});}})[_0xf540('0x21')](respondWithResult(_0x50fa7b,0xc9))[_0xf540('0x43')](handleError(_0x50fa7b,null));};exports[_0xf540('0x20')]=function(_0x4681f6,_0x211bf3){if(_0x4681f6[_0xf540('0x4a')]['id']){delete _0x4681f6[_0xf540('0x4a')]['id'];}return db[_0xf540('0x3f')][_0xf540('0x48')]({'where':{'id':_0x4681f6[_0xf540('0x45')]['id']}})[_0xf540('0x21')](handleEntityNotFound(_0x211bf3,null))[_0xf540('0x21')](saveUpdates(_0x4681f6[_0xf540('0x4a')],null))[_0xf540('0x21')](respondWithResult(_0x211bf3,null))[_0xf540('0x43')](handleError(_0x211bf3,null));};exports[_0xf540('0x22')]=function(_0x1a101e,_0x2739c3){return db['JscriptyProject'][_0xf540('0x48')]({'where':{'id':_0x1a101e['params']['id']}})[_0xf540('0x21')](handleEntityNotFound(_0x2739c3,null))['then'](removeEntity(_0x2739c3,null))[_0xf540('0x43')](handleError(_0x2739c3,null));};exports[_0xf540('0x58')]=function(_0x438c9f,_0x4afa16,_0x217c54){var _0x2857a9={'raw':!![],'where':{}};var _0x117be4={};var _0x176de5={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xf540('0x59')]({'where':{'id':_0x438c9f['params']['id']}})[_0xf540('0x21')](handleEntityNotFound(_0x4afa16,null))[_0xf540('0x21')](function(_0x14c667){if(_0x14c667){_0x117be4[_0xf540('0x32')]=_[_0xf540('0x2e')](db[_0xf540('0x5a')][_0xf540('0x2a')]);_0x117be4[_0xf540('0x2f')]=_[_0xf540('0x2e')](_0x438c9f[_0xf540('0x2f')]);_0x117be4[_0xf540('0x30')]=_[_0xf540('0x31')](_0x117be4[_0xf540('0x32')],_0x117be4[_0xf540('0x2f')]);_0x2857a9['attributes']=_[_0xf540('0x31')](_0x117be4['model'],qs['fields'](_0x438c9f[_0xf540('0x2f')][_0xf540('0x33')]));_0x2857a9[_0xf540('0x34')]=_0x2857a9['attributes']['length']?_0x2857a9[_0xf540('0x34')]:_0x117be4['model'];if(!_0x438c9f[_0xf540('0x2f')][_0xf540('0x35')](_0xf540('0x36'))){_0x2857a9[_0xf540('0x1b')]=qs[_0xf540('0x1b')](_0x438c9f['query'][_0xf540('0x1b')]);_0x2857a9[_0xf540('0x37')]=qs[_0xf540('0x37')](_0x438c9f['query'][_0xf540('0x37')]);}_0x2857a9['order']=qs[_0xf540('0x38')](_0x438c9f[_0xf540('0x2f')][_0xf540('0x38')]);_0x2857a9['where']=qs[_0xf540('0x30')](_[_0xf540('0x39')](_0x438c9f['query'],_0x117be4['filters']));_0x2857a9['where']['ProjectId']=_0x14c667['id'];if(_0x438c9f['query'][_0xf540('0x3a')]){_0x2857a9[_0xf540('0x3b')]=_['merge'](_0x2857a9[_0xf540('0x3b')],{'$or':_[_0xf540('0x29')](_0x2857a9[_0xf540('0x34')],function(_0x3ec019){var _0x45e6b8={};_0x45e6b8[_0x3ec019]={'$like':'%'+_0x438c9f['query']['filter']+'%'};return _0x45e6b8;})});}_0x2857a9=_[_0xf540('0x3c')]({},_0x2857a9,_0x438c9f[_0xf540('0x3e')]);return db['JscriptySessionReport']['count']({'where':_0x2857a9[_0xf540('0x3b')]})[_0xf540('0x21')](function(_0x3d1af6){_0x176de5['count']=_0x3d1af6;if(_0x438c9f[_0xf540('0x2f')]['includeAll']){_0x2857a9[_0xf540('0x47')]=[{'all':!![]}];}return db[_0xf540('0x5a')][_0xf540('0x41')](_0x2857a9);})[_0xf540('0x21')](function(_0x3c974b){_0x176de5[_0xf540('0x42')]=_0x3c974b;return _0x176de5;});}})[_0xf540('0x21')](respondWithFilteredResult(_0x4afa16,_0x2857a9))['catch'](handleError(_0x4afa16,null));};exports[_0xf540('0x5b')]=function(_0x3cf2da,_0x5aa6d4,_0x39e990){var _0x9fc7f5={'raw':!![],'where':{}};var _0x163fd2={};var _0x318507={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xf540('0x59')]({'where':{'id':_0x3cf2da[_0xf540('0x45')]['id']}})['then'](handleEntityNotFound(_0x5aa6d4,null))[_0xf540('0x21')](function(_0x4f468c){if(_0x4f468c){_0x163fd2[_0xf540('0x32')]=_[_0xf540('0x2e')](db[_0xf540('0x5c')][_0xf540('0x2a')]);_0x163fd2[_0xf540('0x2f')]=_[_0xf540('0x2e')](_0x3cf2da[_0xf540('0x2f')]);_0x163fd2[_0xf540('0x30')]=_[_0xf540('0x31')](_0x163fd2[_0xf540('0x32')],_0x163fd2[_0xf540('0x2f')]);_0x9fc7f5['attributes']=_[_0xf540('0x31')](_0x163fd2[_0xf540('0x32')],qs[_0xf540('0x33')](_0x3cf2da[_0xf540('0x2f')][_0xf540('0x33')]));_0x9fc7f5[_0xf540('0x34')]=_0x9fc7f5[_0xf540('0x34')]['length']?_0x9fc7f5['attributes']:_0x163fd2['model'];if(!_0x3cf2da['query'][_0xf540('0x35')](_0xf540('0x36'))){_0x9fc7f5[_0xf540('0x1b')]=qs[_0xf540('0x1b')](_0x3cf2da[_0xf540('0x2f')][_0xf540('0x1b')]);_0x9fc7f5[_0xf540('0x37')]=qs[_0xf540('0x37')](_0x3cf2da[_0xf540('0x2f')][_0xf540('0x37')]);}_0x9fc7f5[_0xf540('0x5d')]=qs[_0xf540('0x38')](_0x3cf2da[_0xf540('0x2f')][_0xf540('0x38')]);_0x9fc7f5[_0xf540('0x3b')]=qs['filters'](_[_0xf540('0x39')](_0x3cf2da[_0xf540('0x2f')],_0x163fd2[_0xf540('0x30')]));_0x9fc7f5['where'][_0xf540('0x5e')]=_0x4f468c['id'];if(_0x3cf2da[_0xf540('0x2f')][_0xf540('0x3a')]){_0x9fc7f5[_0xf540('0x3b')]=_[_0xf540('0x3c')](_0x9fc7f5['where'],{'$or':_[_0xf540('0x29')](_0x9fc7f5['attributes'],function(_0x9591b1){var _0xe6062a={};_0xe6062a[_0x9591b1]={'$like':'%'+_0x3cf2da['query'][_0xf540('0x3a')]+'%'};return _0xe6062a;})});}_0x9fc7f5=_['merge']({},_0x9fc7f5,_0x3cf2da[_0xf540('0x3e')]);return db[_0xf540('0x5c')][_0xf540('0x1a')]({'where':_0x9fc7f5[_0xf540('0x3b')]})[_0xf540('0x21')](function(_0x3cbcca){_0x318507[_0xf540('0x1a')]=_0x3cbcca;if(_0x3cf2da['query']['includeAll']){_0x9fc7f5[_0xf540('0x47')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xf540('0x41')](_0x9fc7f5);})[_0xf540('0x21')](function(_0x377c81){_0x318507[_0xf540('0x42')]=_0x377c81;return _0x318507;});}})[_0xf540('0x21')](respondWithFilteredResult(_0x5aa6d4,_0x9fc7f5))[_0xf540('0x43')](handleError(_0x5aa6d4,null));};function char(_0x337e04){return _0xf540('0x5f')===typeof _0x337e04?String[_0xf540('0x60')]['apply'](null,arguments):_0x337e04;}function needsEncapsulation(_0x58964f){return!!_0x58964f&&(_0x58964f[_0xf540('0x61')]()['indexOf'](char(0xd))>=0x0||_0x58964f[_0xf540('0x61')]()['indexOf'](char(0xa))>=0x0||_0x58964f[_0xf540('0x61')]()[_0xf540('0x62')](char(0x2c))>=0x0||_0x58964f[_0xf540('0x61')]()[_0xf540('0x62')](char(0x22))>=0x0);}function encapsulate(_0x4be9ae){var _0x30b564=char(0x22),_0x2ca349='\x5c'+char(0x22),_0x330949=_0x4be9ae['toString']()['replace'](new RegExp(_0x30b564,'g'),_0x2ca349);return _0x30b564+_0x330949+_0x30b564;}exports[_0xf540('0x63')]=function(_0x290f5a,_0x466d12,_0x5bff18){var _0x334760,_0x4ee359;var _0x148ed7={'where':{'ProjectId':_0x290f5a[_0xf540('0x45')]['id']}};if(_0x290f5a[_0xf540('0x2f')][_0xf540('0x64')]){_0x148ed7[_0xf540('0x3b')][_0xf540('0x65')]=JSON['parse'](_0x290f5a[_0xf540('0x2f')][_0xf540('0x64')]);}return db[_0xf540('0x5a')][_0xf540('0x41')](_0x148ed7)[_0xf540('0x21')](handleEntityNotFound(_0x466d12,null))[_0xf540('0x21')](function(_0x52cf11){if(_0x52cf11){_0x334760=_0x52cf11;return db[_0xf540('0x66')][_0xf540('0x41')]({'where':{'SessionId':{'$in':_[_0xf540('0x29')](_0x334760,'id')},'ProjectId':_0x290f5a[_0xf540('0x45')]['id']},'order':_0xf540('0x67')});}})[_0xf540('0x21')](handleEntityNotFound(_0x466d12,null))['then'](function(_0x1f2dcf){if(_0x1f2dcf){_0x4ee359=_0x1f2dcf;var _0x1e1fed={};for(var _0xf6c043=0x0,_0x17beae=_0x4ee359[_0xf540('0x46')];_0xf6c043<_0x17beae;_0xf6c043++){if(!_0x1e1fed[_0xf540('0x35')](_0x4ee359[_0xf6c043][_0xf540('0x68')])){_0x1e1fed[_0x4ee359[_0xf6c043]['questionId']]=needsEncapsulation(_0x4ee359[_0xf6c043][_0xf540('0x69')])?encapsulate(_0x4ee359[_0xf6c043][_0xf540('0x69')]):_0x4ee359[_0xf6c043][_0xf540('0x69')];}}var _0x13d6d6=[],_0xb57259={};for(var _0x1c289d=0x0,_0x5b7b5b=_0x334760[_0xf540('0x46')];_0x1c289d<_0x5b7b5b;_0x1c289d++){_0xb57259={'ProjectId':_0x290f5a[_0xf540('0x45')]['id'],'SessionId':_0x334760[_0x1c289d]['id'],'StartTime':moment(_0x334760[_0x1c289d][_0xf540('0x65')])[_0xf540('0x6a')](_0xf540('0x6b'))};for(var _0x3d9a09=0x0,_0x2287fb=_0x4ee359[_0xf540('0x46')];_0x3d9a09<_0x2287fb;_0x3d9a09++){if(_0x4ee359[_0x3d9a09][_0xf540('0x6c')]==_0x334760[_0x1c289d]['id']&&_0x1e1fed[_0xf540('0x35')](_0x4ee359[_0x3d9a09][_0xf540('0x68')])){_0xb57259[_0x1e1fed[_0x4ee359[_0x3d9a09][_0xf540('0x68')]]]=_0x4ee359[_0x3d9a09][_0xf540('0x6d')];}}for(var _0x4e4a03 in _0x1e1fed){if(!_0xb57259['hasOwnProperty'](_0x1e1fed[_0x4e4a03])){_0xb57259[_0x1e1fed[_0x4e4a03]]=null;}}_0x13d6d6[_0xf540('0x6e')](_0xb57259);}return _0x13d6d6;}})[_0xf540('0x21')](function(_0x13d5d1){if(!_[_0xf540('0x6f')](_0x13d5d1)){var _0x190e62=toCsv(_0x13d5d1);var _0x6d745a=Date['now']();fs[_0xf540('0x70')](util[_0xf540('0x6a')](_0xf540('0x71'),_0x290f5a[_0xf540('0x45')]['id'],_0x6d745a),_0x190e62);_0x466d12[_0xf540('0x72')](_0xf540('0x73'),'attachment;\x20filename='+util[_0xf540('0x6a')](_0xf540('0x74'),_0x290f5a[_0xf540('0x45')]['id'],_0x6d745a));_0x466d12[_0xf540('0x72')](_0xf540('0x75'),'text/csv');return _0x466d12[_0xf540('0x76')](util[_0xf540('0x6a')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x290f5a[_0xf540('0x45')]['id'],_0x6d745a));}else{return _0x466d12[_0xf540('0x17')](0xcc);}})['catch'](handleError(_0x466d12,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 0d8c24f..403b9e6 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 _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 +var _0x574f=['bluebird','request-promise','path','./jscriptyProject.attributes','exports','define','jscripty_projects','lodash','util','api'];(function(_0x1ccf8c,_0x2ac930){var _0x102db4=function(_0xd489eb){while(--_0xd489eb){_0x1ccf8c['push'](_0x1ccf8c['shift']());}};_0x102db4(++_0x2ac930);}(_0x574f,0x93));var _0xf574=function(_0x4ea209,_0x5acf24){_0x4ea209=_0x4ea209-0x0;var _0x438d12=_0x574f[_0x4ea209];return _0x438d12;};'use strict';var _=require(_0xf574('0x0'));var util=require(_0xf574('0x1'));var logger=require('../../config/logger')(_0xf574('0x2'));var moment=require('moment');var BPromise=require(_0xf574('0x3'));var rp=require(_0xf574('0x4'));var fs=require('fs');var path=require(_0xf574('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf574('0x6'));module[_0xf574('0x7')]=function(_0x26caf4,_0x2f05a8){return _0x26caf4[_0xf574('0x8')]('JscriptyProject',attributes,{'tableName':_0xf574('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index a4b8e68..76d2c20 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 _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 +var _0xe846=['request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyProject,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','request','info'];(function(_0x3261a8,_0x407ce9){var _0x3e39bd=function(_0x24bb35){while(--_0x24bb35){_0x3261a8['push'](_0x3261a8['shift']());}};_0x3e39bd(++_0x407ce9);}(_0xe846,0x198));var _0x6e84=function(_0x351ed8,_0xae88ed){_0x351ed8=_0x351ed8-0x0;var _0x3cf99a=_0xe846[_0x351ed8];return _0x3cf99a;};'use strict';var _=require(_0x6e84('0x0'));var util=require(_0x6e84('0x1'));var moment=require(_0x6e84('0x2'));var BPromise=require(_0x6e84('0x3'));var rs=require(_0x6e84('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6e84('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6e84('0x6'));var config=require(_0x6e84('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6e84('0x8')][_0x6e84('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xceed96,_0x14b9bb,_0x24b064){return new BPromise(function(_0x40fe3d,_0x54dab6){return client[_0x6e84('0xa')](_0xceed96,_0x24b064)['then'](function(_0x2a1abc){logger[_0x6e84('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x14b9bb,_0x6e84('0xc'));logger[_0x6e84('0xd')](_0x6e84('0xe'),_0x14b9bb,'request\x20sent',JSON[_0x6e84('0xf')](_0x2a1abc));if(_0x2a1abc[_0x6e84('0x10')]){if(_0x2a1abc['error'][_0x6e84('0x11')]===0x1f4){logger['error'](_0x6e84('0x12'),_0x14b9bb,_0x2a1abc['error']['message']);return _0x54dab6(_0x2a1abc[_0x6e84('0x10')][_0x6e84('0x13')]);}logger[_0x6e84('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x14b9bb,_0x2a1abc[_0x6e84('0x10')][_0x6e84('0x13')]);return _0x40fe3d(_0x2a1abc[_0x6e84('0x10')][_0x6e84('0x13')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x14b9bb,_0x6e84('0xc'));_0x40fe3d(_0x2a1abc['result']['message']);}})[_0x6e84('0x14')](function(_0x3f6aec){logger[_0x6e84('0x10')](_0x6e84('0x12'),_0x14b9bb,_0x3f6aec);_0x54dab6(_0x3f6aec);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 78a78c9..2918a44 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 _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 +var _0x9dbd=['isAuthenticated','index','/describe','describe','get','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller'];(function(_0x8a7e38,_0x473a5d){var _0x228609=function(_0x5dcb5c){while(--_0x5dcb5c){_0x8a7e38['push'](_0x8a7e38['shift']());}};_0x228609(++_0x473a5d);}(_0x9dbd,0x121));var _0xd9db=function(_0x1c9d2f,_0x35fb85){_0x1c9d2f=_0x1c9d2f-0x0;var _0x16bc21=_0x9dbd[_0x1c9d2f];return _0x16bc21;};'use strict';var multer=require(_0xd9db('0x0'));var util=require(_0xd9db('0x1'));var path=require(_0xd9db('0x2'));var timeout=require(_0xd9db('0x3'));var express=require(_0xd9db('0x4'));var router=express[_0xd9db('0x5')]();var auth=require(_0xd9db('0x6'));var interaction=require(_0xd9db('0x7'));var config=require(_0xd9db('0x8'));var controller=require(_0xd9db('0x9'));router['get']('/',auth[_0xd9db('0xa')](),controller[_0xd9db('0xb')]);router['get'](_0xd9db('0xc'),auth[_0xd9db('0xa')](),controller[_0xd9db('0xd')]);router[_0xd9db('0xe')](_0xd9db('0xf'),auth[_0xd9db('0xa')](),controller[_0xd9db('0x10')]);router['post']('/',auth[_0xd9db('0xa')](),controller[_0xd9db('0x11')]);router[_0xd9db('0x12')](_0xd9db('0xf'),auth[_0xd9db('0xa')](),controller[_0xd9db('0x13')]);router[_0xd9db('0x14')](_0xd9db('0xf'),auth['isAuthenticated'](),controller[_0xd9db('0x15')]);module[_0xd9db('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 2b83fff..788efc2 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 _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 +var _0xbbf3=['long','sequelize','STRING','TEXT'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xbbf3,0xa1));var _0x3bbf=function(_0x36bf9e,_0x12f518){_0x36bf9e=_0x36bf9e-0x0;var _0x19795f=_0xbbf3[_0x36bf9e];return _0x19795f;};'use strict';var Sequelize=require(_0x3bbf('0x0'));module['exports']={'question':{'type':Sequelize[_0x3bbf('0x1')]},'answer':{'type':Sequelize[_0x3bbf('0x2')](_0x3bbf('0x3'))},'membername':{'type':Sequelize[_0x3bbf('0x1')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x3bbf('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3bbf('0x1')]},'calleridnum':{'type':Sequelize[_0x3bbf('0x1')]},'questionId':{'type':Sequelize[_0x3bbf('0x1')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index dc249db..356629f 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 _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 +var _0x1068=['save','destroy','then','error','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','name','JscriptyQuestionReport','include','findAll','rows','catch','show','params','includeAll','options','create','body','update','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x1068,0x10a));var _0x8106=function(_0x50c53f,_0x6b5572){_0x50c53f=_0x50c53f-0x0;var _0x10218b=_0x1068[_0x50c53f];return _0x10218b;};'use strict';var pdf=require(_0x8106('0x0'));var emlformat=require(_0x8106('0x1'));var rimraf=require(_0x8106('0x2'));var zipdir=require(_0x8106('0x3'));var jsonpatch=require(_0x8106('0x4'));var rp=require(_0x8106('0x5'));var moment=require('moment');var BPromise=require(_0x8106('0x6'));var Mustache=require(_0x8106('0x7'));var util=require(_0x8106('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x8106('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8106('0xa'));var squel=require('squel');var crypto=require(_0x8106('0xb'));var jsforce=require(_0x8106('0xc'));var deskjs=require(_0x8106('0xd'));var toCsv=require(_0x8106('0x9'));var querystring=require(_0x8106('0xe'));var Papa=require(_0x8106('0xf'));var Redis=require(_0x8106('0x10'));var authService=require(_0x8106('0x11'));var qs=require(_0x8106('0x12'));var as=require(_0x8106('0x13'));var hardwareService=require(_0x8106('0x14'));var logger=require('../../config/logger')(_0x8106('0x15'));var utils=require(_0x8106('0x16'));var config=require(_0x8106('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd90c26,_0x17fb04){_0x17fb04=_0x17fb04||0xcc;return function(_0x589a72){if(_0x589a72){return _0xd90c26[_0x8106('0x18')](_0x17fb04);}return _0xd90c26[_0x8106('0x19')](_0x17fb04)[_0x8106('0x1a')]();};}function respondWithResult(_0x15b756,_0x105441){_0x105441=_0x105441||0xc8;return function(_0x341382){if(_0x341382){return _0x15b756[_0x8106('0x19')](_0x105441)[_0x8106('0x1b')](_0x341382);}};}function respondWithFilteredResult(_0x13d380,_0x20a0ed){return function(_0x27127f){if(_0x27127f){var _0x5c89bd=_0x27127f[_0x8106('0x1c')],_0xe40d2a=_0x20a0ed['offset'],_0x4d415b=_0x20a0ed[_0x8106('0x1d')]+_0x20a0ed[_0x8106('0x1e')],_0xe5a4c2;if(_0x4d415b>=_0x5c89bd){_0x4d415b=_0x5c89bd;_0xe5a4c2=0xc8;}else{_0xe5a4c2=0xce;}_0x13d380[_0x8106('0x19')](_0xe5a4c2);return _0x13d380['set'](_0x8106('0x1f'),_0xe40d2a+'-'+_0x4d415b+'/'+_0x5c89bd)[_0x8106('0x1b')](_0x27127f);}return null;};}function patchUpdates(_0x1dd489){return function(_0x571dad){try{jsonpatch[_0x8106('0x20')](_0x571dad,_0x1dd489,!![]);}catch(_0x212071){return BPromise[_0x8106('0x21')](_0x212071);}return _0x571dad[_0x8106('0x22')]();};}function saveUpdates(_0x198283,_0xb5542c){return function(_0x1933bd){if(_0x1933bd){return _0x1933bd['update'](_0x198283)['then'](function(_0x940a1b){return _0x940a1b;});}return null;};}function removeEntity(_0xbbbdde,_0x1b634a){return function(_0x2ff6a2){if(_0x2ff6a2){return _0x2ff6a2[_0x8106('0x23')]()[_0x8106('0x24')](function(){_0xbbbdde[_0x8106('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x504047,_0x4362f6){return function(_0x2298d4){if(!_0x2298d4){_0x504047[_0x8106('0x18')](0x194);}return _0x2298d4;};}function handleError(_0x38bafe,_0x2efe7b){_0x2efe7b=_0x2efe7b||0x1f4;return function(_0x3bb6bb){logger[_0x8106('0x25')](_0x3bb6bb['stack']);if(_0x3bb6bb['name']){delete _0x3bb6bb['name'];}_0x38bafe[_0x8106('0x19')](_0x2efe7b)[_0x8106('0x26')](_0x3bb6bb);};}exports[_0x8106('0x27')]=function(_0x318c31,_0x553631){var _0x1ab4d5={},_0x5e0365={},_0xe48108={'count':0x0,'rows':[]};var _0x5ad81d=_[_0x8106('0x28')](db['JscriptyQuestionReport'][_0x8106('0x29')],function(_0x3085ec){return{'name':_0x3085ec[_0x8106('0x2a')],'type':_0x3085ec[_0x8106('0x2b')][_0x8106('0x2c')]};});_0x5e0365['model']=_[_0x8106('0x28')](_0x5ad81d,'name');_0x5e0365[_0x8106('0x2d')]=_[_0x8106('0x2e')](_0x318c31[_0x8106('0x2d')]);_0x5e0365['filters']=_[_0x8106('0x2f')](_0x5e0365[_0x8106('0x30')],_0x5e0365['query']);_0x1ab4d5[_0x8106('0x31')]=_['intersection'](_0x5e0365[_0x8106('0x30')],qs[_0x8106('0x32')](_0x318c31[_0x8106('0x2d')][_0x8106('0x32')]));_0x1ab4d5['attributes']=_0x1ab4d5[_0x8106('0x31')]['length']?_0x1ab4d5[_0x8106('0x31')]:_0x5e0365[_0x8106('0x30')];if(!_0x318c31['query'][_0x8106('0x33')]('nolimit')){_0x1ab4d5[_0x8106('0x1e')]=qs[_0x8106('0x1e')](_0x318c31[_0x8106('0x2d')][_0x8106('0x1e')]);_0x1ab4d5['offset']=qs[_0x8106('0x1d')](_0x318c31[_0x8106('0x2d')][_0x8106('0x1d')]);}_0x1ab4d5[_0x8106('0x34')]=qs[_0x8106('0x35')](_0x318c31[_0x8106('0x2d')][_0x8106('0x35')]);_0x1ab4d5[_0x8106('0x36')]=qs[_0x8106('0x37')](_[_0x8106('0x38')](_0x318c31[_0x8106('0x2d')],_0x5e0365['filters']),_0x5ad81d);if(_0x318c31[_0x8106('0x2d')][_0x8106('0x39')]){_0x1ab4d5[_0x8106('0x36')]=_[_0x8106('0x3a')](_0x1ab4d5[_0x8106('0x36')],{'$or':_[_0x8106('0x28')](_0x5ad81d,function(_0x1e3270){if(_0x1e3270[_0x8106('0x2b')]!==_0x8106('0x3b')){var _0x1bd4d6={};_0x1bd4d6[_0x1e3270[_0x8106('0x3c')]]={'$like':'%'+_0x318c31[_0x8106('0x2d')][_0x8106('0x39')]+'%'};return _0x1bd4d6;}})});}_0x1ab4d5=_[_0x8106('0x3a')]({},_0x1ab4d5,_0x318c31['options']);var _0x4a96b6={'where':_0x1ab4d5[_0x8106('0x36')]};return db[_0x8106('0x3d')][_0x8106('0x1c')](_0x4a96b6)[_0x8106('0x24')](function(_0xfeeff8){_0xe48108['count']=_0xfeeff8;if(_0x318c31[_0x8106('0x2d')]['includeAll']){_0x1ab4d5[_0x8106('0x3e')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x8106('0x3f')](_0x1ab4d5);})[_0x8106('0x24')](function(_0x10d186){_0xe48108[_0x8106('0x40')]=_0x10d186;return _0xe48108;})[_0x8106('0x24')](respondWithFilteredResult(_0x553631,_0x1ab4d5))[_0x8106('0x41')](handleError(_0x553631,null));};exports[_0x8106('0x42')]=function(_0x14f3f8,_0x410718){var _0x2f155b={'raw':!![],'where':{'id':_0x14f3f8[_0x8106('0x43')]['id']}},_0x3ed7b8={};_0x3ed7b8[_0x8106('0x30')]=_['keys'](db[_0x8106('0x3d')][_0x8106('0x29')]);_0x3ed7b8[_0x8106('0x2d')]=_['keys'](_0x14f3f8['query']);_0x3ed7b8[_0x8106('0x37')]=_[_0x8106('0x2f')](_0x3ed7b8[_0x8106('0x30')],_0x3ed7b8['query']);_0x2f155b['attributes']=_[_0x8106('0x2f')](_0x3ed7b8[_0x8106('0x30')],qs[_0x8106('0x32')](_0x14f3f8[_0x8106('0x2d')][_0x8106('0x32')]));_0x2f155b['attributes']=_0x2f155b['attributes']['length']?_0x2f155b[_0x8106('0x31')]:_0x3ed7b8['model'];if(_0x14f3f8[_0x8106('0x2d')][_0x8106('0x44')]){_0x2f155b[_0x8106('0x3e')]=[{'all':!![]}];}_0x2f155b=_[_0x8106('0x3a')]({},_0x2f155b,_0x14f3f8[_0x8106('0x45')]);return db[_0x8106('0x3d')]['find'](_0x2f155b)[_0x8106('0x24')](handleEntityNotFound(_0x410718,null))['then'](respondWithResult(_0x410718,null))[_0x8106('0x41')](handleError(_0x410718,null));};exports[_0x8106('0x46')]=function(_0xd0fee6,_0xd721d2){return db[_0x8106('0x3d')][_0x8106('0x46')](_0xd0fee6[_0x8106('0x47')],{})[_0x8106('0x24')](respondWithResult(_0xd721d2,0xc9))[_0x8106('0x41')](handleError(_0xd721d2,null));};exports[_0x8106('0x48')]=function(_0x5f243f,_0x1f116f){if(_0x5f243f['body']['id']){delete _0x5f243f[_0x8106('0x47')]['id'];}return db[_0x8106('0x3d')][_0x8106('0x49')]({'where':{'id':_0x5f243f[_0x8106('0x43')]['id']}})['then'](handleEntityNotFound(_0x1f116f,null))[_0x8106('0x24')](saveUpdates(_0x5f243f[_0x8106('0x47')],null))[_0x8106('0x24')](respondWithResult(_0x1f116f,null))[_0x8106('0x41')](handleError(_0x1f116f,null));};exports[_0x8106('0x23')]=function(_0x1ce27d,_0x3a8b72){return db[_0x8106('0x3d')][_0x8106('0x49')]({'where':{'id':_0x1ce27d[_0x8106('0x43')]['id']}})[_0x8106('0x24')](handleEntityNotFound(_0x3a8b72,null))[_0x8106('0x24')](removeEntity(_0x3a8b72,null))[_0x8106('0x41')](handleError(_0x3a8b72,null));};exports[_0x8106('0x4a')]=function(_0x1a7ae5,_0xe4e1c7){return db[_0x8106('0x3d')]['describe']()[_0x8106('0x24')](respondWithResult(_0xe4e1c7,null))['catch'](handleError(_0xe4e1c7,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index c87a34e..4173503 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 _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 +var _0x4a04=['path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x4a04,0x17f));var _0x44a0=function(_0x401676,_0x3f1436){_0x401676=_0x401676-0x0;var _0x4f13fe=_0x4a04[_0x401676];return _0x4f13fe;};'use strict';var _=require(_0x44a0('0x0'));var util=require(_0x44a0('0x1'));var logger=require(_0x44a0('0x2'))(_0x44a0('0x3'));var moment=require(_0x44a0('0x4'));var BPromise=require(_0x44a0('0x5'));var rp=require(_0x44a0('0x6'));var fs=require('fs');var path=require(_0x44a0('0x7'));var rimraf=require(_0x44a0('0x8'));var config=require(_0x44a0('0x9'));var attributes=require(_0x44a0('0xa'));module[_0x44a0('0xb')]=function(_0x98adf,_0x5906db){return _0x98adf[_0x44a0('0xc')](_0x44a0('0xd'),attributes,{'tableName':_0x44a0('0xe'),'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 3fc913e..cbc41fb 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 _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 +var _0x9d98=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x187d30,_0x3b0146){var _0x2abffe=function(_0x141c5f){while(--_0x141c5f){_0x187d30['push'](_0x187d30['shift']());}};_0x2abffe(++_0x3b0146);}(_0x9d98,0xb1));var _0x89d9=function(_0x478d69,_0x4bf921){_0x478d69=_0x478d69-0x0;var _0x3e95bc=_0x9d98[_0x478d69];return _0x3e95bc;};'use strict';var _=require(_0x89d9('0x0'));var util=require(_0x89d9('0x1'));var moment=require(_0x89d9('0x2'));var BPromise=require(_0x89d9('0x3'));var rs=require(_0x89d9('0x4'));var fs=require('fs');var Redis=require(_0x89d9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x89d9('0x6'));var logger=require(_0x89d9('0x7'))(_0x89d9('0x8'));var config=require(_0x89d9('0x9'));var jayson=require(_0x89d9('0xa'));var client=jayson[_0x89d9('0xb')][_0x89d9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ff9e4,_0x131833,_0x2902f0){return new BPromise(function(_0x1e1778,_0x4db90c){return client[_0x89d9('0xd')](_0x4ff9e4,_0x2902f0)['then'](function(_0x36799b){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x131833,_0x89d9('0xe'));logger[_0x89d9('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x131833,_0x89d9('0xe'),JSON[_0x89d9('0x10')](_0x36799b));if(_0x36799b[_0x89d9('0x11')]){if(_0x36799b[_0x89d9('0x11')][_0x89d9('0x12')]===0x1f4){logger[_0x89d9('0x11')](_0x89d9('0x13'),_0x131833,_0x36799b['error']['message']);return _0x4db90c(_0x36799b[_0x89d9('0x11')][_0x89d9('0x14')]);}logger['error'](_0x89d9('0x13'),_0x131833,_0x36799b[_0x89d9('0x11')]['message']);return _0x1e1778(_0x36799b['error']['message']);}else{logger[_0x89d9('0x15')](_0x89d9('0x13'),_0x131833,'request\x20sent');_0x1e1778(_0x36799b['result'][_0x89d9('0x14')]);}})[_0x89d9('0x16')](function(_0x29f440){logger[_0x89d9('0x11')](_0x89d9('0x13'),_0x131833,_0x29f440);_0x4db90c(_0x29f440);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 58ec286..ea8d429 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 _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 +var _0x3937=['isAuthenticated','index','/describe','describe','show','/:id/questions','getQuestions','/:id','update','destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service','./jscriptySessionReport.controller','get'];(function(_0x117ffa,_0xac9c1f){var _0x21c64d=function(_0x5b4c38){while(--_0x5b4c38){_0x117ffa['push'](_0x117ffa['shift']());}};_0x21c64d(++_0xac9c1f);}(_0x3937,0xbf));var _0x7393=function(_0x407aa0,_0x5ea282){_0x407aa0=_0x407aa0-0x0;var _0x117c8d=_0x3937[_0x407aa0];return _0x117c8d;};'use strict';var multer=require(_0x7393('0x0'));var util=require('util');var path=require(_0x7393('0x1'));var timeout=require(_0x7393('0x2'));var express=require('express');var router=express[_0x7393('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x7393('0x4'));var config=require('../../config/environment');var controller=require(_0x7393('0x5'));router[_0x7393('0x6')]('/',auth[_0x7393('0x7')](),controller[_0x7393('0x8')]);router[_0x7393('0x6')](_0x7393('0x9'),auth[_0x7393('0x7')](),controller[_0x7393('0xa')]);router[_0x7393('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x7393('0xb')]);router[_0x7393('0x6')](_0x7393('0xc'),auth['isAuthenticated'](),controller[_0x7393('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x7393('0xe'),auth[_0x7393('0x7')](),controller[_0x7393('0xf')]);router['delete'](_0x7393('0xe'),auth[_0x7393('0x7')](),controller[_0x7393('0x10')]);module[_0x7393('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 53d3f7e..3e81bfd 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 _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 +var _0xf4a3=['setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE'];(function(_0x533ea0,_0x87114b){var _0xe1adfa=function(_0x5463aa){while(--_0x5463aa){_0x533ea0['push'](_0x533ea0['shift']());}};_0xe1adfa(++_0x87114b);}(_0xf4a3,0x18c));var _0x3f4a=function(_0x4518cb,_0x59ebdf){_0x4518cb=_0x4518cb-0x0;var _0x153e5c=_0xf4a3[_0x4518cb];return _0x153e5c;};'use strict';var moment=require(_0x3f4a('0x0'));var Sequelize=require(_0x3f4a('0x1'));module[_0x3f4a('0x2')]={'starttime':{'type':Sequelize[_0x3f4a('0x3')],'set':function(_0xadfed0){this['setDataValue']('starttime',_0xadfed0);this[_0x3f4a('0x4')](_0x3f4a('0x5'),moment()[_0x3f4a('0x6')](_0x3f4a('0x7')));}},'endtime':{'type':Sequelize[_0x3f4a('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x3f4a('0x8')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x3f4a('0x8')]},'calleridname':{'type':Sequelize[_0x3f4a('0x8')]},'calleridnum':{'type':Sequelize[_0x3f4a('0x8')]},'completed':{'type':Sequelize[_0x3f4a('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index ce19e39..18f3987 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 _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 +var _0x0c24=['stack','send','index','map','JscriptySessionReport','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','describe','getQuestions','findOne','hasOwnProperty','SessionId','JscriptyQuestionReport','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','error'];(function(_0x27777a,_0x10f141){var _0x54a565=function(_0x3e619c){while(--_0x3e619c){_0x27777a['push'](_0x27777a['shift']());}};_0x54a565(++_0x10f141);}(_0x0c24,0xc2));var _0x40c2=function(_0x586837,_0x4f9ed1){_0x586837=_0x586837-0x0;var _0xea18c3=_0x0c24[_0x586837];return _0xea18c3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x40c2('0x0'));var rimraf=require(_0x40c2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x40c2('0x2'));var rp=require(_0x40c2('0x3'));var moment=require('moment');var BPromise=require(_0x40c2('0x4'));var Mustache=require(_0x40c2('0x5'));var util=require(_0x40c2('0x6'));var path=require('path');var sox=require(_0x40c2('0x7'));var csv=require(_0x40c2('0x8'));var ejs=require(_0x40c2('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x40c2('0xa'));var crypto=require(_0x40c2('0xb'));var jsforce=require(_0x40c2('0xc'));var deskjs=require(_0x40c2('0xd'));var toCsv=require(_0x40c2('0x8'));var querystring=require(_0x40c2('0xe'));var Papa=require(_0x40c2('0xf'));var Redis=require('ioredis');var authService=require(_0x40c2('0x10'));var qs=require(_0x40c2('0x11'));var as=require(_0x40c2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x40c2('0x13'))(_0x40c2('0x14'));var utils=require(_0x40c2('0x15'));var config=require('../../config/environment');var db=require(_0x40c2('0x16'))['db'];function respondWithStatusCode(_0x26e195,_0x30b3bc){_0x30b3bc=_0x30b3bc||0xcc;return function(_0x1caacb){if(_0x1caacb){return _0x26e195[_0x40c2('0x17')](_0x30b3bc);}return _0x26e195[_0x40c2('0x18')](_0x30b3bc)['end']();};}function respondWithResult(_0x142bb3,_0x5679d2){_0x5679d2=_0x5679d2||0xc8;return function(_0x456184){if(_0x456184){return _0x142bb3[_0x40c2('0x18')](_0x5679d2)['json'](_0x456184);}};}function respondWithFilteredResult(_0x4ac640,_0x1e24c2){return function(_0x33d8b1){if(_0x33d8b1){var _0x10a7a8=_0x33d8b1[_0x40c2('0x19')],_0xed9f44=_0x1e24c2['offset'],_0x27ace2=_0x1e24c2[_0x40c2('0x1a')]+_0x1e24c2[_0x40c2('0x1b')],_0x1ecdb4;if(_0x27ace2>=_0x10a7a8){_0x27ace2=_0x10a7a8;_0x1ecdb4=0xc8;}else{_0x1ecdb4=0xce;}_0x4ac640[_0x40c2('0x18')](_0x1ecdb4);return _0x4ac640[_0x40c2('0x1c')](_0x40c2('0x1d'),_0xed9f44+'-'+_0x27ace2+'/'+_0x10a7a8)[_0x40c2('0x1e')](_0x33d8b1);}return null;};}function patchUpdates(_0x35015e){return function(_0x54c4cf){try{jsonpatch[_0x40c2('0x1f')](_0x54c4cf,_0x35015e,!![]);}catch(_0x4608d1){return BPromise[_0x40c2('0x20')](_0x4608d1);}return _0x54c4cf['save']();};}function saveUpdates(_0x5b9880,_0x440cb5){return function(_0x9e5d70){if(_0x9e5d70){return _0x9e5d70[_0x40c2('0x21')](_0x5b9880)[_0x40c2('0x22')](function(_0x3cbc44){return _0x3cbc44;});}return null;};}function removeEntity(_0x2c0004,_0x5b9f78){return function(_0x4f46b5){if(_0x4f46b5){return _0x4f46b5[_0x40c2('0x23')]()[_0x40c2('0x22')](function(){_0x2c0004[_0x40c2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x69e44d,_0x59dfa3){return function(_0xb31d28){if(!_0xb31d28){_0x69e44d['sendStatus'](0x194);}return _0xb31d28;};}function handleError(_0xb542fa,_0x3f53b7){_0x3f53b7=_0x3f53b7||0x1f4;return function(_0x2cfc9f){logger[_0x40c2('0x24')](_0x2cfc9f[_0x40c2('0x25')]);if(_0x2cfc9f['name']){delete _0x2cfc9f['name'];}_0xb542fa[_0x40c2('0x18')](_0x3f53b7)[_0x40c2('0x26')](_0x2cfc9f);};}exports[_0x40c2('0x27')]=function(_0x227287,_0x349c75){var _0x50a0d7={},_0x468e82={},_0x570a49={'count':0x0,'rows':[]};var _0x3fcc82=_[_0x40c2('0x28')](db[_0x40c2('0x29')]['rawAttributes'],function(_0x57da88){return{'name':_0x57da88[_0x40c2('0x2a')],'type':_0x57da88[_0x40c2('0x2b')][_0x40c2('0x2c')]};});_0x468e82[_0x40c2('0x2d')]=_['map'](_0x3fcc82,_0x40c2('0x2e'));_0x468e82[_0x40c2('0x2f')]=_[_0x40c2('0x30')](_0x227287[_0x40c2('0x2f')]);_0x468e82[_0x40c2('0x31')]=_[_0x40c2('0x32')](_0x468e82[_0x40c2('0x2d')],_0x468e82['query']);_0x50a0d7[_0x40c2('0x33')]=_[_0x40c2('0x32')](_0x468e82[_0x40c2('0x2d')],qs[_0x40c2('0x34')](_0x227287['query'][_0x40c2('0x34')]));_0x50a0d7[_0x40c2('0x33')]=_0x50a0d7[_0x40c2('0x33')][_0x40c2('0x35')]?_0x50a0d7['attributes']:_0x468e82[_0x40c2('0x2d')];if(!_0x227287[_0x40c2('0x2f')]['hasOwnProperty'](_0x40c2('0x36'))){_0x50a0d7[_0x40c2('0x1b')]=qs[_0x40c2('0x1b')](_0x227287[_0x40c2('0x2f')][_0x40c2('0x1b')]);_0x50a0d7[_0x40c2('0x1a')]=qs[_0x40c2('0x1a')](_0x227287[_0x40c2('0x2f')][_0x40c2('0x1a')]);}_0x50a0d7[_0x40c2('0x37')]=qs[_0x40c2('0x38')](_0x227287[_0x40c2('0x2f')]['sort']);_0x50a0d7[_0x40c2('0x39')]=qs[_0x40c2('0x31')](_[_0x40c2('0x3a')](_0x227287[_0x40c2('0x2f')],_0x468e82['filters']),_0x3fcc82);if(_0x227287[_0x40c2('0x2f')][_0x40c2('0x3b')]){_0x50a0d7[_0x40c2('0x39')]=_[_0x40c2('0x3c')](_0x50a0d7[_0x40c2('0x39')],{'$or':_['map'](_0x3fcc82,function(_0x595b48){if(_0x595b48[_0x40c2('0x2b')]!=='VIRTUAL'){var _0x55ef15={};_0x55ef15[_0x595b48[_0x40c2('0x2e')]]={'$like':'%'+_0x227287[_0x40c2('0x2f')][_0x40c2('0x3b')]+'%'};return _0x55ef15;}})});}_0x50a0d7=_['merge']({},_0x50a0d7,_0x227287[_0x40c2('0x3d')]);var _0x52a28d={'where':_0x50a0d7[_0x40c2('0x39')]};return db['JscriptySessionReport'][_0x40c2('0x19')](_0x52a28d)[_0x40c2('0x22')](function(_0x3e92a0){_0x570a49[_0x40c2('0x19')]=_0x3e92a0;if(_0x227287['query']['includeAll']){_0x50a0d7['include']=[{'all':!![]}];}return db[_0x40c2('0x29')][_0x40c2('0x3e')](_0x50a0d7);})['then'](function(_0x552a1e){_0x570a49[_0x40c2('0x3f')]=_0x552a1e;return _0x570a49;})[_0x40c2('0x22')](respondWithFilteredResult(_0x349c75,_0x50a0d7))[_0x40c2('0x40')](handleError(_0x349c75,null));};exports['show']=function(_0x549754,_0x2880ca){var _0x24e7b1={'raw':!![],'where':{'id':_0x549754[_0x40c2('0x41')]['id']}},_0x176494={};_0x176494[_0x40c2('0x2d')]=_[_0x40c2('0x30')](db[_0x40c2('0x29')][_0x40c2('0x42')]);_0x176494[_0x40c2('0x2f')]=_[_0x40c2('0x30')](_0x549754[_0x40c2('0x2f')]);_0x176494['filters']=_[_0x40c2('0x32')](_0x176494[_0x40c2('0x2d')],_0x176494[_0x40c2('0x2f')]);_0x24e7b1[_0x40c2('0x33')]=_[_0x40c2('0x32')](_0x176494[_0x40c2('0x2d')],qs[_0x40c2('0x34')](_0x549754['query'][_0x40c2('0x34')]));_0x24e7b1[_0x40c2('0x33')]=_0x24e7b1['attributes'][_0x40c2('0x35')]?_0x24e7b1[_0x40c2('0x33')]:_0x176494[_0x40c2('0x2d')];if(_0x549754['query'][_0x40c2('0x43')]){_0x24e7b1['include']=[{'all':!![]}];}_0x24e7b1=_[_0x40c2('0x3c')]({},_0x24e7b1,_0x549754[_0x40c2('0x3d')]);return db[_0x40c2('0x29')][_0x40c2('0x44')](_0x24e7b1)[_0x40c2('0x22')](handleEntityNotFound(_0x2880ca,null))[_0x40c2('0x22')](respondWithResult(_0x2880ca,null))[_0x40c2('0x40')](handleError(_0x2880ca,null));};exports[_0x40c2('0x45')]=function(_0x233b77,_0x25574b){return db[_0x40c2('0x29')][_0x40c2('0x45')](_0x233b77[_0x40c2('0x46')],{})['then'](respondWithResult(_0x25574b,0xc9))[_0x40c2('0x40')](handleError(_0x25574b,null));};exports['update']=function(_0x49dc9e,_0x247f02){if(_0x49dc9e[_0x40c2('0x46')]['id']){delete _0x49dc9e[_0x40c2('0x46')]['id'];}return db[_0x40c2('0x29')][_0x40c2('0x44')]({'where':{'id':_0x49dc9e[_0x40c2('0x41')]['id']}})[_0x40c2('0x22')](handleEntityNotFound(_0x247f02,null))['then'](saveUpdates(_0x49dc9e[_0x40c2('0x46')],null))['then'](respondWithResult(_0x247f02,null))[_0x40c2('0x40')](handleError(_0x247f02,null));};exports[_0x40c2('0x23')]=function(_0xdeed5b,_0x4e4116){return db[_0x40c2('0x29')][_0x40c2('0x44')]({'where':{'id':_0xdeed5b[_0x40c2('0x41')]['id']}})[_0x40c2('0x22')](handleEntityNotFound(_0x4e4116,null))[_0x40c2('0x22')](removeEntity(_0x4e4116,null))[_0x40c2('0x40')](handleError(_0x4e4116,null));};exports[_0x40c2('0x47')]=function(_0x24b772,_0xffc1c8){return db[_0x40c2('0x29')][_0x40c2('0x47')]()[_0x40c2('0x22')](respondWithResult(_0xffc1c8,null))[_0x40c2('0x40')](handleError(_0xffc1c8,null));};exports[_0x40c2('0x48')]=function(_0x457583,_0x44d44e,_0x30c6b3){var _0x4c0441={'raw':!![],'where':{}};var _0x5d3f08={};var _0x3396ea={'count':0x0,'rows':[]};return db[_0x40c2('0x29')][_0x40c2('0x49')]({'where':{'id':_0x457583[_0x40c2('0x41')]['id']}})[_0x40c2('0x22')](handleEntityNotFound(_0x44d44e,null))[_0x40c2('0x22')](function(_0x578c30){if(_0x578c30){_0x5d3f08[_0x40c2('0x2d')]=_[_0x40c2('0x30')](db['JscriptyQuestionReport'][_0x40c2('0x42')]);_0x5d3f08[_0x40c2('0x2f')]=_[_0x40c2('0x30')](_0x457583[_0x40c2('0x2f')]);_0x5d3f08[_0x40c2('0x31')]=_[_0x40c2('0x32')](_0x5d3f08[_0x40c2('0x2d')],_0x5d3f08[_0x40c2('0x2f')]);_0x4c0441['attributes']=_[_0x40c2('0x32')](_0x5d3f08[_0x40c2('0x2d')],qs['fields'](_0x457583[_0x40c2('0x2f')][_0x40c2('0x34')]));_0x4c0441[_0x40c2('0x33')]=_0x4c0441[_0x40c2('0x33')][_0x40c2('0x35')]?_0x4c0441[_0x40c2('0x33')]:_0x5d3f08[_0x40c2('0x2d')];if(!_0x457583[_0x40c2('0x2f')][_0x40c2('0x4a')](_0x40c2('0x36'))){_0x4c0441['limit']=qs[_0x40c2('0x1b')](_0x457583[_0x40c2('0x2f')]['limit']);_0x4c0441[_0x40c2('0x1a')]=qs[_0x40c2('0x1a')](_0x457583[_0x40c2('0x2f')][_0x40c2('0x1a')]);}_0x4c0441[_0x40c2('0x37')]=qs['sort'](_0x457583['query'][_0x40c2('0x38')]);_0x4c0441[_0x40c2('0x39')]=qs[_0x40c2('0x31')](_['pick'](_0x457583[_0x40c2('0x2f')],_0x5d3f08[_0x40c2('0x31')]));_0x4c0441[_0x40c2('0x39')][_0x40c2('0x4b')]=_0x578c30['id'];if(_0x457583['query'][_0x40c2('0x3b')]){_0x4c0441['where']=_[_0x40c2('0x3c')](_0x4c0441['where'],{'$or':_[_0x40c2('0x28')](_0x4c0441['attributes'],function(_0x24ced6){var _0x3dbab8={};_0x3dbab8[_0x24ced6]={'$like':'%'+_0x457583[_0x40c2('0x2f')][_0x40c2('0x3b')]+'%'};return _0x3dbab8;})});}_0x4c0441=_[_0x40c2('0x3c')]({},_0x4c0441,_0x457583[_0x40c2('0x3d')]);return db[_0x40c2('0x4c')][_0x40c2('0x19')]({'where':_0x4c0441[_0x40c2('0x39')]})[_0x40c2('0x22')](function(_0x519795){_0x3396ea['count']=_0x519795;if(_0x457583[_0x40c2('0x2f')][_0x40c2('0x43')]){_0x4c0441['include']=[{'all':!![]}];}return db[_0x40c2('0x4c')][_0x40c2('0x3e')](_0x4c0441);})['then'](function(_0x49a627){_0x3396ea[_0x40c2('0x3f')]=_0x49a627;return _0x3396ea;});}})[_0x40c2('0x22')](respondWithFilteredResult(_0x44d44e,_0x4c0441))[_0x40c2('0x40')](handleError(_0x44d44e,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index a4a1ee0..3d4173a 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 _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 +var _0xf3d4=['../../config/environment','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x3e67ea,_0x1c8613){var _0x302ad0=function(_0x2d09d1){while(--_0x2d09d1){_0x3e67ea['push'](_0x3e67ea['shift']());}};_0x302ad0(++_0x1c8613);}(_0xf3d4,0x125));var _0x4f3d=function(_0x1da168,_0x331710){_0x1da168=_0x1da168-0x0;var _0x2eaf6f=_0xf3d4[_0x1da168];return _0x2eaf6f;};'use strict';var _=require(_0x4f3d('0x0'));var util=require(_0x4f3d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4f3d('0x2'));var BPromise=require(_0x4f3d('0x3'));var rp=require(_0x4f3d('0x4'));var fs=require('fs');var path=require(_0x4f3d('0x5'));var rimraf=require(_0x4f3d('0x6'));var config=require(_0x4f3d('0x7'));var attributes=require('./jscriptySessionReport.attributes');module[_0x4f3d('0x8')]=function(_0x17d521,_0x58009c){return _0x17d521[_0x4f3d('0x9')](_0x4f3d('0xa'),attributes,{'tableName':_0x4f3d('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 4ff8d85..57f7483 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 _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 +var _0xd8fb=['catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','message','JscriptySessionReport,\x20%s,\x20%s','result'];(function(_0x105892,_0x3f07f3){var _0x4ad83e=function(_0x269e17){while(--_0x269e17){_0x105892['push'](_0x105892['shift']());}};_0x4ad83e(++_0x3f07f3);}(_0xd8fb,0x79));var _0xbd8f=function(_0x6f9c56,_0x1ce9dc){_0x6f9c56=_0x6f9c56-0x0;var _0x3bc932=_0xd8fb[_0x6f9c56];return _0x3bc932;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var moment=require('moment');var BPromise=require(_0xbd8f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd8f('0x3'))['db'];var utils=require(_0xbd8f('0x4'));var logger=require(_0xbd8f('0x5'))(_0xbd8f('0x6'));var config=require(_0xbd8f('0x7'));var jayson=require(_0xbd8f('0x8'));var client=jayson[_0xbd8f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x541cc6,_0x35a18f,_0x1435da){return new BPromise(function(_0x1da2ab,_0x34e83f){return client[_0xbd8f('0xa')](_0x541cc6,_0x1435da)[_0xbd8f('0xb')](function(_0x2cc18f){logger[_0xbd8f('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x35a18f,_0xbd8f('0xd'));logger['debug'](_0xbd8f('0xe'),_0x35a18f,_0xbd8f('0xd'),JSON['stringify'](_0x2cc18f));if(_0x2cc18f[_0xbd8f('0xf')]){if(_0x2cc18f[_0xbd8f('0xf')]['code']===0x1f4){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x35a18f,_0x2cc18f[_0xbd8f('0xf')][_0xbd8f('0x10')]);return _0x34e83f(_0x2cc18f[_0xbd8f('0xf')][_0xbd8f('0x10')]);}logger[_0xbd8f('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x35a18f,_0x2cc18f[_0xbd8f('0xf')][_0xbd8f('0x10')]);return _0x1da2ab(_0x2cc18f[_0xbd8f('0xf')]['message']);}else{logger['info'](_0xbd8f('0x11'),_0x35a18f,'request\x20sent');_0x1da2ab(_0x2cc18f[_0xbd8f('0x12')][_0xbd8f('0x10')]);}})[_0xbd8f('0x13')](function(_0x4ece3d){logger[_0xbd8f('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x35a18f,_0x4ece3d);_0x34e83f(_0x4ece3d);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index bdab5ee..b295a94 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 _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 +var _0xc63d=['Router','../../components/auth/service','../../components/interaction/service','index','put','/:id','isAuthenticated','exports','util','path','connect-timeout'];(function(_0x1ba09e,_0x5f53af){var _0x1edb9c=function(_0x9b02cf){while(--_0x9b02cf){_0x1ba09e['push'](_0x1ba09e['shift']());}};_0x1edb9c(++_0x5f53af);}(_0xc63d,0x189));var _0xdc63=function(_0x23161e,_0x332f01){_0x23161e=_0x23161e-0x0;var _0x16b4ff=_0xc63d[_0x23161e];return _0x16b4ff;};'use strict';var multer=require('multer');var util=require(_0xdc63('0x0'));var path=require(_0xdc63('0x1'));var timeout=require(_0xdc63('0x2'));var express=require('express');var router=express[_0xdc63('0x3')]();var auth=require(_0xdc63('0x4'));var interaction=require(_0xdc63('0x5'));var config=require('../../config/environment');var controller=require('./license.controller');router['get']('/',controller[_0xdc63('0x6')]);router[_0xdc63('0x7')](_0xdc63('0x8'),auth[_0xdc63('0x9')](),controller['update']);module[_0xdc63('0xa')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 0b509b2..361864e 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 _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 +var _0x687b=['TEXT','STRING','sequelize','exports'];(function(_0x34f537,_0x2b4b63){var _0x45b8f5=function(_0x56b752){while(--_0x56b752){_0x34f537['push'](_0x34f537['shift']());}};_0x45b8f5(++_0x2b4b63);}(_0x687b,0x14a));var _0xb687=function(_0x3b56c0,_0xe100d8){_0x3b56c0=_0x3b56c0-0x0;var _0x377efe=_0x687b[_0x3b56c0];return _0x377efe;};'use strict';var Sequelize=require(_0xb687('0x0'));module[_0xb687('0x1')]={'license':{'type':Sequelize[_0xb687('0x2')]},'data1':{'type':Sequelize[_0xb687('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index aa94735..e2cc9fe 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 _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 +var _0x7705=['bluebird','mustache','util','sox','to-csv','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','apply','save','update','then','destroy','stack','name','send','index','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','merge','options','body','params','demo','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x3fa7d3,_0x37f83c){var _0x4c51bd=function(_0x59e85b){while(--_0x59e85b){_0x3fa7d3['push'](_0x3fa7d3['shift']());}};_0x4c51bd(++_0x37f83c);}(_0x7705,0x93));var _0x5770=function(_0x552914,_0x55a169){_0x552914=_0x552914-0x0;var _0x56dc4c=_0x7705[_0x552914];return _0x56dc4c;};'use strict';var pdf=require(_0x5770('0x0'));var emlformat=require(_0x5770('0x1'));var rimraf=require(_0x5770('0x2'));var zipdir=require(_0x5770('0x3'));var jsonpatch=require(_0x5770('0x4'));var rp=require('request-promise');var moment=require(_0x5770('0x5'));var BPromise=require(_0x5770('0x6'));var Mustache=require(_0x5770('0x7'));var util=require(_0x5770('0x8'));var path=require('path');var sox=require(_0x5770('0x9'));var csv=require(_0x5770('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x5770('0xb'));var crypto=require(_0x5770('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5770('0xd'));var Papa=require('papaparse');var Redis=require(_0x5770('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5770('0xf'));var as=require(_0x5770('0x10'));var hardwareService=require(_0x5770('0x11'));var logger=require(_0x5770('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x5770('0x13'));var db=require(_0x5770('0x14'))['db'];function respondWithStatusCode(_0x2e2652,_0x59a6c0){_0x59a6c0=_0x59a6c0||0xcc;return function(_0x2a4c30){if(_0x2a4c30){return _0x2e2652[_0x5770('0x15')](_0x59a6c0);}return _0x2e2652['status'](_0x59a6c0)[_0x5770('0x16')]();};}function respondWithResult(_0x408566,_0x36ffec){_0x36ffec=_0x36ffec||0xc8;return function(_0x1c6473){if(_0x1c6473){return _0x408566[_0x5770('0x17')](_0x36ffec)[_0x5770('0x18')](_0x1c6473);}};}function respondWithFilteredResult(_0x46a4d4,_0x2c7307){return function(_0x11860e){if(_0x11860e){var _0x54ae77=_0x11860e[_0x5770('0x19')],_0x30f86b=_0x2c7307[_0x5770('0x1a')],_0x205cb0=_0x2c7307[_0x5770('0x1a')]+_0x2c7307['limit'],_0xcc4176;if(_0x205cb0>=_0x54ae77){_0x205cb0=_0x54ae77;_0xcc4176=0xc8;}else{_0xcc4176=0xce;}_0x46a4d4[_0x5770('0x17')](_0xcc4176);return _0x46a4d4['set']('Content-Range',_0x30f86b+'-'+_0x205cb0+'/'+_0x54ae77)['json'](_0x11860e);}return null;};}function patchUpdates(_0x206ff9){return function(_0x234d8a){try{jsonpatch[_0x5770('0x1b')](_0x234d8a,_0x206ff9,!![]);}catch(_0x1fd06d){return BPromise['reject'](_0x1fd06d);}return _0x234d8a[_0x5770('0x1c')]();};}function saveUpdates(_0x5bafd7,_0x2d3979){return function(_0x2ed9ea){if(_0x2ed9ea){return _0x2ed9ea[_0x5770('0x1d')](_0x5bafd7)[_0x5770('0x1e')](function(_0x2cda44){return _0x2cda44;});}return null;};}function removeEntity(_0x18dc4e,_0x4030a5){return function(_0x341e72){if(_0x341e72){return _0x341e72[_0x5770('0x1f')]()[_0x5770('0x1e')](function(){_0x18dc4e['status'](0xcc)[_0x5770('0x16')]();});}};}function handleEntityNotFound(_0x560dc2,_0x1cba64){return function(_0x51974c){if(!_0x51974c){_0x560dc2[_0x5770('0x15')](0x194);}return _0x51974c;};}function handleError(_0x480f77,_0x5c5fa2){_0x5c5fa2=_0x5c5fa2||0x1f4;return function(_0x1f6f25){logger['error'](_0x1f6f25[_0x5770('0x20')]);if(_0x1f6f25[_0x5770('0x21')]){delete _0x1f6f25['name'];}_0x480f77[_0x5770('0x17')](_0x5c5fa2)[_0x5770('0x22')](_0x1f6f25);};}var utilLicense=require('../../config/license/util');exports[_0x5770('0x23')]=function(_0x5ac200,_0x588fd4){var _0x341826={'raw':!![],'where':{'id':0x1}},_0x50d958={};_0x50d958[_0x5770('0x24')]=_[_0x5770('0x25')](db['License'][_0x5770('0x26')]);_0x50d958[_0x5770('0x27')]=_[_0x5770('0x25')](_0x5ac200[_0x5770('0x27')]);_0x50d958[_0x5770('0x28')]=_[_0x5770('0x29')](_0x50d958[_0x5770('0x24')],_0x50d958[_0x5770('0x27')]);_0x341826['attributes']=_['intersection'](_0x50d958['model'],qs[_0x5770('0x2a')](_0x5ac200[_0x5770('0x27')]['fields']));_0x341826['attributes']=_0x341826[_0x5770('0x2b')][_0x5770('0x2c')]?_0x341826[_0x5770('0x2b')]:_0x50d958['model'];_0x341826=_[_0x5770('0x2d')]({},_0x341826,_0x5ac200[_0x5770('0x2e')]);return utilLicense['getLicense'](_0x341826)['then'](respondWithResult(_0x588fd4,null))['catch'](handleError(_0x588fd4,null));};exports[_0x5770('0x1d')]=function(_0x39bb18,_0x2401b8){if(_0x39bb18[_0x5770('0x2f')]['id']){delete _0x39bb18[_0x5770('0x2f')]['id'];}return db['License']['find']({'where':{'id':_0x39bb18[_0x5770('0x30')]['id']}})['then'](handleEntityNotFound(_0x2401b8,null))[_0x5770('0x1e')](function(_0xdb20ad){var _0x2b55f3=_0xdb20ad['get']({'plain':!![]});return utilLicense['checkLicense'](_0x2b55f3,_0x39bb18[_0x5770('0x2f')]['key']);})[_0x5770('0x1e')](function(_0x4f9b9e){if(!_0x4f9b9e[_0x5770('0x31')]){return saveUpdates(_0x39bb18['body'],null);}return _0x4f9b9e;})[_0x5770('0x1e')](respondWithResult(_0x2401b8,null))[_0x5770('0x32')](handleError(_0x2401b8,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 5f8674d..d021d95 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 _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 +var _0x3d9f=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','exports','define'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x3d9f,0xd2));var _0xf3d9=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x3d9f[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xf3d9('0x0'));var util=require(_0xf3d9('0x1'));var logger=require(_0xf3d9('0x2'))(_0xf3d9('0x3'));var moment=require(_0xf3d9('0x4'));var BPromise=require(_0xf3d9('0x5'));var rp=require(_0xf3d9('0x6'));var fs=require('fs');var path=require(_0xf3d9('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./license.attributes');module[_0xf3d9('0x8')]=function(_0x5c3fe6,_0x6d83d7){return _0x5c3fe6[_0xf3d9('0x9')]('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 9c8e93b..04dff5f 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 _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 +var _0xe027=['code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','License,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x52402c,_0x553d4d){var _0x57f23d=function(_0x18fe25){while(--_0x18fe25){_0x52402c['push'](_0x52402c['shift']());}};_0x57f23d(++_0x553d4d);}(_0xe027,0x106));var _0x7e02=function(_0x3395fd,_0x1a722e){_0x3395fd=_0x3395fd-0x0;var _0x1cc64f=_0xe027[_0x3395fd];return _0x1cc64f;};'use strict';var _=require(_0x7e02('0x0'));var util=require(_0x7e02('0x1'));var moment=require(_0x7e02('0x2'));var BPromise=require(_0x7e02('0x3'));var rs=require(_0x7e02('0x4'));var fs=require('fs');var Redis=require(_0x7e02('0x5'));var db=require(_0x7e02('0x6'))['db'];var utils=require(_0x7e02('0x7'));var logger=require(_0x7e02('0x8'))(_0x7e02('0x9'));var config=require(_0x7e02('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7e02('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ebeca,_0x10ffc5,_0x53b91c){return new BPromise(function(_0x557349,_0x1533d0){return client['request'](_0x4ebeca,_0x53b91c)[_0x7e02('0xc')](function(_0x135555){logger[_0x7e02('0xd')](_0x7e02('0xe'),_0x10ffc5,_0x7e02('0xf'));logger[_0x7e02('0x10')]('License,\x20%s,\x20%s,\x20%s',_0x10ffc5,_0x7e02('0xf'),JSON['stringify'](_0x135555));if(_0x135555[_0x7e02('0x11')]){if(_0x135555[_0x7e02('0x11')][_0x7e02('0x12')]===0x1f4){logger[_0x7e02('0x11')](_0x7e02('0xe'),_0x10ffc5,_0x135555[_0x7e02('0x11')][_0x7e02('0x13')]);return _0x1533d0(_0x135555['error'][_0x7e02('0x13')]);}logger['error'](_0x7e02('0xe'),_0x10ffc5,_0x135555[_0x7e02('0x11')][_0x7e02('0x13')]);return _0x557349(_0x135555[_0x7e02('0x11')][_0x7e02('0x13')]);}else{logger[_0x7e02('0xd')]('License,\x20%s,\x20%s',_0x10ffc5,'request\x20sent');_0x557349(_0x135555['result'][_0x7e02('0x13')]);}})['catch'](function(_0xc9e71c){logger[_0x7e02('0x11')](_0x7e02('0xe'),_0x10ffc5,_0xc9e71c);_0x1533d0(_0xc9e71c);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 7607126..62e38e9 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 _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 +var _0x6f68=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','/:id','isAuthenticated','/:id/dispositions','/:id/canned_answers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','/:id/users','getAgents','post','addDisposition','create','addImap','addInteraction','send','addAgents','put','delete','removeDispositions','removeAnswers','removeImap','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f68,0xa0));var _0x86f6=function(_0x5b87b4,_0x130678){_0x5b87b4=_0x5b87b4-0x0;var _0x331b8c=_0x6f68[_0x5b87b4];return _0x331b8c;};'use strict';var multer=require(_0x86f6('0x0'));var util=require('util');var path=require(_0x86f6('0x1'));var timeout=require(_0x86f6('0x2'));var express=require(_0x86f6('0x3'));var router=express[_0x86f6('0x4')]();var auth=require(_0x86f6('0x5'));var interaction=require(_0x86f6('0x6'));var config=require(_0x86f6('0x7'));var controller=require(_0x86f6('0x8'));router[_0x86f6('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x86f6('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x86f6('0x9')](_0x86f6('0xa'),auth[_0x86f6('0xb')](),controller['show']);router[_0x86f6('0x9')](_0x86f6('0xc'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x86f6('0x9')](_0x86f6('0xd'),auth[_0x86f6('0xb')](),controller['getAnswers']);router[_0x86f6('0x9')](_0x86f6('0xe'),auth['isAuthenticated'](),controller['getImap']);router['get'](_0x86f6('0xf'),auth[_0x86f6('0xb')](),controller[_0x86f6('0x10')]);router['get'](_0x86f6('0x11'),auth['isAuthenticated'](),controller[_0x86f6('0x12')]);router[_0x86f6('0x9')](_0x86f6('0x13'),auth[_0x86f6('0xb')](),controller[_0x86f6('0x14')]);router[_0x86f6('0x9')](_0x86f6('0x15'),auth[_0x86f6('0xb')](),controller[_0x86f6('0x16')]);router['get'](_0x86f6('0x17'),auth[_0x86f6('0xb')](),controller['verifySmtp']);router['get'](_0x86f6('0x18'),auth[_0x86f6('0xb')](),controller[_0x86f6('0x19')]);router[_0x86f6('0x1a')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x86f6('0x1b')]);router['post'](_0x86f6('0xd'),auth[_0x86f6('0xb')](),controller['addAnswer']);router[_0x86f6('0x1a')]('/',auth[_0x86f6('0xb')](),controller[_0x86f6('0x1c')]);router[_0x86f6('0x1a')]('/:id/in_servers',auth[_0x86f6('0xb')](),controller[_0x86f6('0x1d')]);router[_0x86f6('0x1a')](_0x86f6('0xf'),auth[_0x86f6('0xb')](),controller['addSmtp']);router[_0x86f6('0x1a')](_0x86f6('0x11'),auth[_0x86f6('0xb')](),controller[_0x86f6('0x1e')]);router['post'](_0x86f6('0x13'),auth[_0x86f6('0xb')](),controller['addApplications']);router[_0x86f6('0x1a')]('/:id/send',auth['isAuthenticated'](),controller[_0x86f6('0x1f')]);router[_0x86f6('0x1a')]('/:id/users',auth[_0x86f6('0xb')](),controller[_0x86f6('0x20')]);router[_0x86f6('0x21')](_0x86f6('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x86f6('0x22')](_0x86f6('0xc'),auth[_0x86f6('0xb')](),controller[_0x86f6('0x23')]);router[_0x86f6('0x22')](_0x86f6('0xd'),auth['isAuthenticated'](),controller[_0x86f6('0x24')]);router[_0x86f6('0x22')](_0x86f6('0xe'),auth[_0x86f6('0xb')](),controller[_0x86f6('0x25')]);router[_0x86f6('0x22')](_0x86f6('0xf'),auth[_0x86f6('0xb')](),controller['removeSmtp']);router[_0x86f6('0x22')](_0x86f6('0xa'),auth['isAuthenticated'](),controller[_0x86f6('0x26')]);router['delete'](_0x86f6('0x18'),auth[_0x86f6('0xb')](),controller['removeAgents']);module[_0x86f6('0x27')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 685f8b8..8a3291a 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 _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 +var _0xfbb6=['UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT'];(function(_0x470bfb,_0x389787){var _0x2f5d97=function(_0x3431b4){while(--_0x3431b4){_0x470bfb['push'](_0x470bfb['shift']());}};_0x2f5d97(++_0x389787);}(_0xfbb6,0xb1));var _0x6fbb=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0xfbb6[_0x1b4b23];return _0x2a325b;};'use strict';var Sequelize=require(_0x6fbb('0x0'));module[_0x6fbb('0x1')]={'description':{'type':Sequelize[_0x6fbb('0x2')]},'name':{'type':Sequelize[_0x6fbb('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x6fbb('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x6fbb('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x6fbb('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x6fbb('0x4')]},'markAsUnread':{'type':Sequelize[_0x6fbb('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x6fbb('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x6fbb('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6fbb('0x6');}},'notificationSound':{'type':Sequelize[_0x6fbb('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6fbb('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6fbb('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6fbb('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6fbb('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6fbb('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x6fbb('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x6fbb('0x3')],'defaultValue':![],'comment':_0x6fbb('0x9'),'set':function(_0x16e73b){if(!_0x16e73b)this[_0x6fbb('0xa')](_0x6fbb('0xb'),null);this[_0x6fbb('0xa')](_0x6fbb('0xc'),_0x16e73b);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 02cead6..a84cd29 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 _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 +var _0x8a5c=['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','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','json','reject','save','update','destroy','get','MailAccounts','UserProfileResource','name','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','MailAccount','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','include','body','find','params','describe','addDisposition','Disposition','create','getDispositions','findOne','rawAttributes','hasOwnProperty','order','removeDispositions','ids','addAnswer','MailAccountId','CannedAnswer','removeAnswers','email','ListId','isNil','active','cservice','user','cuser','password','pass','cpassword','authentication','host','port','service','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','MailApplication','bulkCreate','priority','getApplications','MailMessage','$gte','split','send','CmList','List','Contacts','updatedAt','from','format','%s\x20<%s>','attachments','join','server/files/attachments','basename','secure','auth','SendMail','List\x20not\x20found','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','messageId','Interaction','Messages','verifySmtp','VerifySmtp','removeAgents','isArray','emit','userMailAccount:remove','getAgents','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a5c,0x158));var _0xc8a5=function(_0x34cd06,_0x1c063b){_0x34cd06=_0x34cd06-0x0;var _0x32232b=_0x8a5c[_0x34cd06];return _0x32232b;};'use strict';var pdf=require(_0xc8a5('0x0'));var emlformat=require(_0xc8a5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc8a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc8a5('0x3'));var moment=require(_0xc8a5('0x4'));var BPromise=require(_0xc8a5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc8a5('0x6'));var sox=require('sox');var csv=require(_0xc8a5('0x7'));var ejs=require(_0xc8a5('0x8'));var fs=require('fs');var _=require(_0xc8a5('0x9'));var squel=require('squel');var crypto=require(_0xc8a5('0xa'));var jsforce=require(_0xc8a5('0xb'));var deskjs=require(_0xc8a5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc8a5('0xd'));var Papa=require(_0xc8a5('0xe'));var Redis=require('ioredis');var authService=require(_0xc8a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc8a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc8a5('0x11'))('api');var utils=require(_0xc8a5('0x12'));var config=require(_0xc8a5('0x13'));var db=require('../../mysqldb')['db'];config[_0xc8a5('0x14')]=_[_0xc8a5('0x15')](config[_0xc8a5('0x14')],{'host':_0xc8a5('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc8a5('0x14')]));require('./mailAccount.socket')[_0xc8a5('0x17')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc8a5('0x18')][_0xc8a5('0x19')]({'port':0x232b});function checkPasswordPattern(_0x27083b,_0x4bce95,_0x1f6465){if(_0x1f6465){var _0x32c0e0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x32c0e0[_0xc8a5('0x1a')](_0x4bce95)){return _0x27083b;}else{throw new db[(_0xc8a5('0x1b'))][(_0xc8a5('0x1c'))](_0xc8a5('0x1d'));}}else{return _0x27083b;}}function respondWithRpcPromise(_0x12b053,_0x1d7183,_0x463327,_0x287ac3){return new BPromise(function(_0x16af60,_0x29b073){var _0x58157c=_0x287ac3||client;return _0x58157c[_0xc8a5('0x1e')](_0x12b053,_0x463327)[_0xc8a5('0x1f')](function(_0x3b40e7){logger['info'](_0xc8a5('0x20'),_0x1d7183,_0xc8a5('0x21'));logger[_0xc8a5('0x22')](_0xc8a5('0x23'),_0x1d7183,_0xc8a5('0x21'),JSON['stringify'](_0x3b40e7));if(_0x3b40e7[_0xc8a5('0x24')]){if(_0x3b40e7[_0xc8a5('0x24')][_0xc8a5('0x25')]===0x1f4){logger[_0xc8a5('0x24')]('MailAccount,\x20%s,\x20%s',_0x1d7183,_0x3b40e7[_0xc8a5('0x24')][_0xc8a5('0x26')]);return _0x29b073(_0x3b40e7[_0xc8a5('0x24')][_0xc8a5('0x26')]);}logger['error'](_0xc8a5('0x20'),_0x1d7183,_0x3b40e7[_0xc8a5('0x24')]['message']);return _0x16af60(_0x3b40e7[_0xc8a5('0x24')][_0xc8a5('0x26')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x1d7183,_0xc8a5('0x21'));_0x16af60(_0x3b40e7[_0xc8a5('0x27')][_0xc8a5('0x26')]);}})[_0xc8a5('0x28')](function(_0x3504f1){logger[_0xc8a5('0x24')](_0xc8a5('0x20'),_0x1d7183,_0x3504f1);_0x29b073(_0x3504f1);});});}function respondWithStatusCode(_0x114a00,_0x3e3238){_0x3e3238=_0x3e3238||0xcc;return function(_0x15bd35){if(_0x15bd35){return _0x114a00[_0xc8a5('0x29')](_0x3e3238);}return _0x114a00[_0xc8a5('0x2a')](_0x3e3238)[_0xc8a5('0x2b')]();};}function respondWithResult(_0x27f2a4,_0x5c45ba){_0x5c45ba=_0x5c45ba||0xc8;return function(_0xf0b3d6){if(_0xf0b3d6){return _0x27f2a4[_0xc8a5('0x2a')](_0x5c45ba)['json'](_0xf0b3d6);}};}function respondWithFilteredResult(_0x269163,_0x4f12f6){return function(_0x462cfb){if(_0x462cfb){var _0x5451c1=_0x462cfb[_0xc8a5('0x2c')],_0x335cae=_0x4f12f6[_0xc8a5('0x2d')],_0x49da82=_0x4f12f6[_0xc8a5('0x2d')]+_0x4f12f6[_0xc8a5('0x2e')],_0x2b6681;if(_0x49da82>=_0x5451c1){_0x49da82=_0x5451c1;_0x2b6681=0xc8;}else{_0x2b6681=0xce;}_0x269163[_0xc8a5('0x2a')](_0x2b6681);return _0x269163[_0xc8a5('0x2f')]('Content-Range',_0x335cae+'-'+_0x49da82+'/'+_0x5451c1)[_0xc8a5('0x30')](_0x462cfb);}return null;};}function patchUpdates(_0xef421e){return function(_0x5473cd){try{jsonpatch['apply'](_0x5473cd,_0xef421e,!![]);}catch(_0x12045a){return BPromise[_0xc8a5('0x31')](_0x12045a);}return _0x5473cd[_0xc8a5('0x32')]();};}function saveUpdates(_0x44cd3c,_0x23781f){return function(_0x3c35cf){if(_0x3c35cf){return _0x3c35cf[_0xc8a5('0x33')](_0x44cd3c)['then'](function(_0x3230e0){return _0x3230e0;});}return null;};}function removeEntity(_0xae5880,_0x998ac1){return function(_0x412f44){if(_0x412f44){return _0x412f44[_0xc8a5('0x34')]()[_0xc8a5('0x1f')](function(){var _0x27b276=_0x412f44[_0xc8a5('0x35')]({'plain':!![]});var _0x34b1b5=_0xc8a5('0x36');return db[_0xc8a5('0x37')][_0xc8a5('0x34')]({'where':{'type':_0x34b1b5,'resourceId':_0x27b276['id']}})[_0xc8a5('0x1f')](function(){return _0x412f44;});})[_0xc8a5('0x1f')](function(){_0xae5880[_0xc8a5('0x2a')](0xcc)[_0xc8a5('0x2b')]();});}};}function handleEntityNotFound(_0x143689,_0x18a614){return function(_0x543129){if(!_0x543129){_0x143689[_0xc8a5('0x29')](0x194);}return _0x543129;};}function handleError(_0x39129c,_0x1be7e4){_0x1be7e4=_0x1be7e4||0x1f4;return function(_0x50a385){logger[_0xc8a5('0x24')](_0x50a385['stack']);if(_0x50a385[_0xc8a5('0x38')]){delete _0x50a385[_0xc8a5('0x38')];}_0x39129c['status'](_0x1be7e4)['send'](_0x50a385);};}exports[_0xc8a5('0x39')]=function(_0x1e5e29,_0x3c837e){var _0x22c8cd={'include':[{'model':db[_0xc8a5('0x3a')],'as':_0xc8a5('0x3b')},{'model':db[_0xc8a5('0x3c')],'as':_0xc8a5('0x3d')},{'model':db[_0xc8a5('0x3e')],'as':_0xc8a5('0x3f')}]},_0x528c16={},_0x3e1817={'count':0x0,'rows':[]};var _0x2429fc=_['map'](db[_0xc8a5('0x40')]['rawAttributes'],function(_0x5dfbc8){return{'name':_0x5dfbc8['fieldName'],'type':_0x5dfbc8[_0xc8a5('0x41')][_0xc8a5('0x42')]};});_0x528c16[_0xc8a5('0x43')]=_[_0xc8a5('0x44')](_0x2429fc,_0xc8a5('0x38'));_0x528c16[_0xc8a5('0x45')]=_[_0xc8a5('0x46')](_0x1e5e29[_0xc8a5('0x45')]);_0x528c16[_0xc8a5('0x47')]=_[_0xc8a5('0x48')](_0x528c16[_0xc8a5('0x43')],_0x528c16[_0xc8a5('0x45')]);_0x22c8cd[_0xc8a5('0x49')]=_[_0xc8a5('0x48')](_0x528c16[_0xc8a5('0x43')],qs[_0xc8a5('0x4a')](_0x1e5e29[_0xc8a5('0x45')]['fields']));_0x22c8cd[_0xc8a5('0x49')]=_0x22c8cd['attributes'][_0xc8a5('0x4b')]?_0x22c8cd['attributes']:_0x528c16[_0xc8a5('0x43')];if(!_0x1e5e29[_0xc8a5('0x45')]['hasOwnProperty'](_0xc8a5('0x4c'))){_0x22c8cd[_0xc8a5('0x2e')]=qs[_0xc8a5('0x2e')](_0x1e5e29[_0xc8a5('0x45')][_0xc8a5('0x2e')]);_0x22c8cd['offset']=qs[_0xc8a5('0x2d')](_0x1e5e29['query'][_0xc8a5('0x2d')]);}_0x22c8cd['order']=qs[_0xc8a5('0x4d')](_0x1e5e29[_0xc8a5('0x45')][_0xc8a5('0x4d')]);_0x22c8cd[_0xc8a5('0x4e')]=qs[_0xc8a5('0x47')](_[_0xc8a5('0x4f')](_0x1e5e29['query'],_0x528c16['filters']),_0x2429fc);if(_0x1e5e29[_0xc8a5('0x45')][_0xc8a5('0x50')]){_0x22c8cd[_0xc8a5('0x4e')]=_[_0xc8a5('0x51')](_0x22c8cd['where'],{'$or':_[_0xc8a5('0x44')](_0x2429fc,function(_0x4d05a3){if(_0x4d05a3[_0xc8a5('0x41')]!==_0xc8a5('0x52')){var _0x2de943={};_0x2de943[_0x4d05a3[_0xc8a5('0x38')]]={'$like':'%'+_0x1e5e29[_0xc8a5('0x45')]['filter']+'%'};return _0x2de943;}})});}_0x22c8cd=_[_0xc8a5('0x51')]({},_0x22c8cd,_0x1e5e29[_0xc8a5('0x53')]);var _0x2a904b={'where':_0x22c8cd[_0xc8a5('0x4e')]};return db[_0xc8a5('0x40')][_0xc8a5('0x2c')](_0x2a904b)[_0xc8a5('0x1f')](function(_0x3107df){_0x3e1817['count']=_0x3107df;if(_0x1e5e29[_0xc8a5('0x45')][_0xc8a5('0x54')]){_0x22c8cd['include']=[{'all':!![]}];}return db[_0xc8a5('0x40')][_0xc8a5('0x55')](_0x22c8cd);})[_0xc8a5('0x1f')](function(_0x46e91c){_0x3e1817[_0xc8a5('0x56')]=_0x46e91c;return _0x3e1817;})['then'](respondWithFilteredResult(_0x3c837e,_0x22c8cd))[_0xc8a5('0x28')](handleError(_0x3c837e,null));};exports[_0xc8a5('0x57')]=function(_0x1c94a5,_0x493fcd){var _0x23e81a={'raw':![],'where':{'id':_0x1c94a5['params']['id']},'include':[{'model':db[_0xc8a5('0x3a')],'as':_0xc8a5('0x3b')},{'model':db[_0xc8a5('0x3c')],'as':'Smtp'},{'model':db[_0xc8a5('0x3e')],'as':'mandatoryDispositionPause'}]},_0x3561bf={};_0x3561bf[_0xc8a5('0x43')]=_[_0xc8a5('0x46')](db[_0xc8a5('0x40')]['rawAttributes']);_0x3561bf[_0xc8a5('0x45')]=_[_0xc8a5('0x46')](_0x1c94a5['query']);_0x3561bf[_0xc8a5('0x47')]=_[_0xc8a5('0x48')](_0x3561bf[_0xc8a5('0x43')],_0x3561bf[_0xc8a5('0x45')]);_0x23e81a[_0xc8a5('0x49')]=_[_0xc8a5('0x48')](_0x3561bf[_0xc8a5('0x43')],qs[_0xc8a5('0x4a')](_0x1c94a5['query'][_0xc8a5('0x4a')]));_0x23e81a[_0xc8a5('0x49')]=_0x23e81a[_0xc8a5('0x49')][_0xc8a5('0x4b')]?_0x23e81a[_0xc8a5('0x49')]:_0x3561bf[_0xc8a5('0x43')];if(_0x1c94a5['query'][_0xc8a5('0x54')]){_0x23e81a[_0xc8a5('0x58')]=[{'all':!![]}];}_0x23e81a=_['merge']({},_0x23e81a,_0x1c94a5[_0xc8a5('0x53')]);return db['MailAccount']['find'](_0x23e81a)[_0xc8a5('0x1f')](handleEntityNotFound(_0x493fcd,null))[_0xc8a5('0x1f')](respondWithResult(_0x493fcd,null))['catch'](handleError(_0x493fcd,null));};exports[_0xc8a5('0x33')]=function(_0x1a74bf,_0x39ae41){if(_0x1a74bf[_0xc8a5('0x59')]['id']){delete _0x1a74bf[_0xc8a5('0x59')]['id'];}return db[_0xc8a5('0x40')][_0xc8a5('0x5a')]({'where':{'id':_0x1a74bf[_0xc8a5('0x5b')]['id']},'include':[{'model':db[_0xc8a5('0x3a')],'as':_0xc8a5('0x3b')},{'model':db[_0xc8a5('0x3c')],'as':_0xc8a5('0x3d')},{'model':db[_0xc8a5('0x3e')],'as':_0xc8a5('0x3f')}]})['then'](handleEntityNotFound(_0x39ae41,null))[_0xc8a5('0x1f')](saveUpdates(_0x1a74bf[_0xc8a5('0x59')],null))[_0xc8a5('0x1f')](function(_0x16fbdb){if(_0x16fbdb&&_0x1a74bf[_0xc8a5('0x59')][_0xc8a5('0x3b')]){return db['MailServerIn'][_0xc8a5('0x33')](_0x1a74bf[_0xc8a5('0x59')][_0xc8a5('0x3b')],{'where':{'MailAccountId':_0x16fbdb['id']}})[_0xc8a5('0x1f')](function(){return _0x16fbdb;});}return _0x16fbdb;})[_0xc8a5('0x1f')](function(_0x543378){if(_0x543378&&_0x1a74bf[_0xc8a5('0x59')][_0xc8a5('0x3d')]){return db[_0xc8a5('0x3c')][_0xc8a5('0x33')](_0x1a74bf[_0xc8a5('0x59')]['Smtp'],{'where':{'MailAccountId':_0x543378['id']}})[_0xc8a5('0x1f')](function(){return _0x543378;});}return _0x543378;})[_0xc8a5('0x1f')](respondWithResult(_0x39ae41,null))[_0xc8a5('0x28')](handleError(_0x39ae41,null));};exports[_0xc8a5('0x5c')]=function(_0x2b5262,_0x438776){return db[_0xc8a5('0x40')][_0xc8a5('0x5c')]()[_0xc8a5('0x1f')](respondWithResult(_0x438776,null))[_0xc8a5('0x28')](handleError(_0x438776,null));};exports[_0xc8a5('0x5d')]=function(_0xf99b85,_0x18fbe5,_0x438149){if(_0xf99b85[_0xc8a5('0x59')]['id']){delete _0xf99b85[_0xc8a5('0x59')]['id'];}return db['MailAccount'][_0xc8a5('0x5a')]({'where':{'id':_0xf99b85[_0xc8a5('0x5b')]['id']}})[_0xc8a5('0x1f')](handleEntityNotFound(_0x18fbe5,null))['then'](function(_0x23d442){if(_0x23d442){_0xf99b85[_0xc8a5('0x59')]['MailAccountId']=_0x23d442['id'];return db[_0xc8a5('0x5e')][_0xc8a5('0x5f')](_0xf99b85[_0xc8a5('0x59')]);}})['then'](respondWithResult(_0x18fbe5,null))[_0xc8a5('0x28')](handleError(_0x18fbe5,null));};exports[_0xc8a5('0x60')]=function(_0x19e62a,_0x462703,_0x5615e5){var _0x5d549a={'raw':![],'where':{}};var _0x2f9d96={};var _0x3c197d={'count':0x0,'rows':[]};return db['MailAccount'][_0xc8a5('0x61')]({'where':{'id':_0x19e62a[_0xc8a5('0x5b')]['id']}})[_0xc8a5('0x1f')](handleEntityNotFound(_0x462703,null))[_0xc8a5('0x1f')](function(_0x113d5d){if(_0x113d5d){_0x2f9d96[_0xc8a5('0x43')]=_['keys'](db[_0xc8a5('0x5e')][_0xc8a5('0x62')]);_0x2f9d96[_0xc8a5('0x45')]=_[_0xc8a5('0x46')](_0x19e62a[_0xc8a5('0x45')]);_0x2f9d96[_0xc8a5('0x47')]=_[_0xc8a5('0x48')](_0x2f9d96[_0xc8a5('0x43')],_0x2f9d96[_0xc8a5('0x45')]);_0x5d549a['attributes']=_[_0xc8a5('0x48')](_0x2f9d96[_0xc8a5('0x43')],qs[_0xc8a5('0x4a')](_0x19e62a[_0xc8a5('0x45')][_0xc8a5('0x4a')]));_0x5d549a[_0xc8a5('0x49')]=_0x5d549a[_0xc8a5('0x49')][_0xc8a5('0x4b')]?_0x5d549a[_0xc8a5('0x49')]:_0x2f9d96[_0xc8a5('0x43')];if(!_0x19e62a['query'][_0xc8a5('0x63')]('nolimit')){_0x5d549a[_0xc8a5('0x2e')]=qs[_0xc8a5('0x2e')](_0x19e62a['query'][_0xc8a5('0x2e')]);_0x5d549a['offset']=qs[_0xc8a5('0x2d')](_0x19e62a['query']['offset']);}_0x5d549a[_0xc8a5('0x64')]=qs['sort'](_0x19e62a[_0xc8a5('0x45')]['sort']);_0x5d549a[_0xc8a5('0x4e')]=qs[_0xc8a5('0x47')](_['pick'](_0x19e62a[_0xc8a5('0x45')],_0x2f9d96[_0xc8a5('0x47')]));_0x5d549a[_0xc8a5('0x4e')]['MailAccountId']=_0x113d5d['id'];if(_0x19e62a[_0xc8a5('0x45')][_0xc8a5('0x50')]){_0x5d549a[_0xc8a5('0x4e')]=_[_0xc8a5('0x51')](_0x5d549a[_0xc8a5('0x4e')],{'$or':_[_0xc8a5('0x44')](_0x5d549a['attributes'],function(_0x22725e){var _0x18fde5={};_0x18fde5[_0x22725e]={'$like':'%'+_0x19e62a[_0xc8a5('0x45')]['filter']+'%'};return _0x18fde5;})});}_0x5d549a=_[_0xc8a5('0x51')]({},_0x5d549a,_0x19e62a['options']);return db[_0xc8a5('0x5e')][_0xc8a5('0x2c')]({'where':_0x5d549a[_0xc8a5('0x4e')]})['then'](function(_0x3bda4a){_0x3c197d[_0xc8a5('0x2c')]=_0x3bda4a;if(_0x19e62a[_0xc8a5('0x45')][_0xc8a5('0x54')]){_0x5d549a[_0xc8a5('0x58')]=[{'all':!![]}];}return db[_0xc8a5('0x5e')][_0xc8a5('0x55')](_0x5d549a);})['then'](function(_0xbbb1c){_0x3c197d[_0xc8a5('0x56')]=_0xbbb1c;return _0x3c197d;});}})[_0xc8a5('0x1f')](respondWithFilteredResult(_0x462703,_0x5d549a))['catch'](handleError(_0x462703,null));};exports[_0xc8a5('0x65')]=function(_0x3bf262,_0x781819,_0x14c27f){return db[_0xc8a5('0x40')][_0xc8a5('0x5a')]({'where':{'id':_0x3bf262[_0xc8a5('0x5b')]['id']}})[_0xc8a5('0x1f')](handleEntityNotFound(_0x781819,null))[_0xc8a5('0x1f')](function(_0x507cff){if(_0x507cff){return _0x507cff['removeDispositions'](_0x3bf262[_0xc8a5('0x45')][_0xc8a5('0x66')]);}})[_0xc8a5('0x1f')](respondWithStatusCode(_0x781819,null))[_0xc8a5('0x28')](handleError(_0x781819,null));};exports[_0xc8a5('0x67')]=function(_0x35a00d,_0x587df8,_0x1cc64e){if(_0x35a00d[_0xc8a5('0x59')]['id']){delete _0x35a00d[_0xc8a5('0x59')]['id'];}return db[_0xc8a5('0x40')][_0xc8a5('0x5a')]({'where':{'id':_0x35a00d[_0xc8a5('0x5b')]['id']}})[_0xc8a5('0x1f')](handleEntityNotFound(_0x587df8,null))['then'](function(_0x2f2f63){if(_0x2f2f63){_0x35a00d[_0xc8a5('0x59')][_0xc8a5('0x68')]=_0x2f2f63['id'];return db[_0xc8a5('0x69')]['create'](_0x35a00d[_0xc8a5('0x59')]);}})['then'](respondWithResult(_0x587df8,null))[_0xc8a5('0x28')](handleError(_0x587df8,null));};exports['getAnswers']=function(_0x57a20f,_0x1e2d1e,_0x2ab3c3){var _0x3a4562={'raw':![],'where':{}};var _0x48ca5e={};var _0x6927d8={'count':0x0,'rows':[]};return db[_0xc8a5('0x40')][_0xc8a5('0x61')]({'where':{'id':_0x57a20f[_0xc8a5('0x5b')]['id']}})[_0xc8a5('0x1f')](handleEntityNotFound(_0x1e2d1e,null))['then'](function(_0x3e5eec){if(_0x3e5eec){_0x48ca5e[_0xc8a5('0x43')]=_[_0xc8a5('0x46')](db[_0xc8a5('0x69')]['rawAttributes']);_0x48ca5e[_0xc8a5('0x45')]=_['keys'](_0x57a20f[_0xc8a5('0x45')]);_0x48ca5e[_0xc8a5('0x47')]=_[_0xc8a5('0x48')](_0x48ca5e[_0xc8a5('0x43')],_0x48ca5e[_0xc8a5('0x45')]);_0x3a4562['attributes']=_[_0xc8a5('0x48')](_0x48ca5e[_0xc8a5('0x43')],qs[_0xc8a5('0x4a')](_0x57a20f['query'][_0xc8a5('0x4a')]));_0x3a4562[_0xc8a5('0x49')]=_0x3a4562[_0xc8a5('0x49')][_0xc8a5('0x4b')]?_0x3a4562[_0xc8a5('0x49')]:_0x48ca5e[_0xc8a5('0x43')];if(!_0x57a20f['query']['hasOwnProperty'](_0xc8a5('0x4c'))){_0x3a4562[_0xc8a5('0x2e')]=qs['limit'](_0x57a20f['query'][_0xc8a5('0x2e')]);_0x3a4562[_0xc8a5('0x2d')]=qs[_0xc8a5('0x2d')](_0x57a20f['query'][_0xc8a5('0x2d')]);}_0x3a4562[_0xc8a5('0x64')]=qs[_0xc8a5('0x4d')](_0x57a20f[_0xc8a5('0x45')][_0xc8a5('0x4d')]);_0x3a4562['where']=qs['filters'](_['pick'](_0x57a20f[_0xc8a5('0x45')],_0x48ca5e['filters']));_0x3a4562[_0xc8a5('0x4e')][_0xc8a5('0x68')]=_0x3e5eec['id'];if(_0x57a20f[_0xc8a5('0x45')][_0xc8a5('0x50')]){_0x3a4562[_0xc8a5('0x4e')]=_[_0xc8a5('0x51')](_0x3a4562[_0xc8a5('0x4e')],{'$or':_[_0xc8a5('0x44')](_0x3a4562[_0xc8a5('0x49')],function(_0x138fbc){var _0x5edabf={};_0x5edabf[_0x138fbc]={'$like':'%'+_0x57a20f[_0xc8a5('0x45')][_0xc8a5('0x50')]+'%'};return _0x5edabf;})});}_0x3a4562=_[_0xc8a5('0x51')]({},_0x3a4562,_0x57a20f[_0xc8a5('0x53')]);return db[_0xc8a5('0x69')][_0xc8a5('0x2c')]({'where':_0x3a4562['where']})[_0xc8a5('0x1f')](function(_0x18f819){_0x6927d8[_0xc8a5('0x2c')]=_0x18f819;if(_0x57a20f[_0xc8a5('0x45')]['includeAll']){_0x3a4562[_0xc8a5('0x58')]=[{'all':!![]}];}return db[_0xc8a5('0x69')]['findAll'](_0x3a4562);})[_0xc8a5('0x1f')](function(_0x135b2c){_0x6927d8['rows']=_0x135b2c;return _0x6927d8;});}})[_0xc8a5('0x1f')](respondWithFilteredResult(_0x1e2d1e,_0x3a4562))[_0xc8a5('0x28')](handleError(_0x1e2d1e,null));};exports[_0xc8a5('0x6a')]=function(_0x21e7bb,_0xe907dc,_0xe48ebb){return db[_0xc8a5('0x40')]['find']({'where':{'id':_0x21e7bb[_0xc8a5('0x5b')]['id']}})['then'](handleEntityNotFound(_0xe907dc,null))[_0xc8a5('0x1f')](function(_0x1e1c01){if(_0x1e1c01){return _0x1e1c01['removeAnswers'](_0x21e7bb['query'][_0xc8a5('0x66')]);}})[_0xc8a5('0x1f')](respondWithStatusCode(_0xe907dc,null))[_0xc8a5('0x28')](handleError(_0xe907dc,null));};exports['create']=function(_0x3adf49,_0x435b64){var _0x55a872={'name':_0x3adf49[_0xc8a5('0x59')][_0xc8a5('0x38')],'key':_0x3adf49[_0xc8a5('0x59')]['key'],'email':_0x3adf49[_0xc8a5('0x59')][_0xc8a5('0x6b')],'ListId':_0x3adf49['body'][_0xc8a5('0x6c')],'active':!_[_0xc8a5('0x6d')](_0x3adf49[_0xc8a5('0x59')][_0xc8a5('0x6e')])?_0x3adf49[_0xc8a5('0x59')][_0xc8a5('0x6e')]:!![],'description':_0x3adf49[_0xc8a5('0x59')]['description']||null,'Imap':{},'Smtp':{}};if(_[_0xc8a5('0x6d')](_0x3adf49['body'][_0xc8a5('0x6f')])){if(_0x3adf49['body']['cauthentication']){_0x55a872[_0xc8a5('0x3b')][_0xc8a5('0x70')]=_0x55a872[_0xc8a5('0x3d')][_0xc8a5('0x70')]=_0x3adf49[_0xc8a5('0x59')][_0xc8a5('0x71')];_0x55a872[_0xc8a5('0x3b')][_0xc8a5('0x72')]=_0x55a872[_0xc8a5('0x3d')][_0xc8a5('0x73')]=_0x3adf49[_0xc8a5('0x59')][_0xc8a5('0x74')];}else{_0x55a872[_0xc8a5('0x3b')][_0xc8a5('0x75')]=_0x55a872[_0xc8a5('0x3d')][_0xc8a5('0x75')]=![];}_0x55a872['Imap']['host']=_0x3adf49['body'][_0xc8a5('0x3b')][_0xc8a5('0x76')];_0x55a872[_0xc8a5('0x3b')][_0xc8a5('0x77')]=_0x3adf49[_0xc8a5('0x59')][_0xc8a5('0x3b')][_0xc8a5('0x77')];_0x55a872[_0xc8a5('0x3d')][_0xc8a5('0x76')]=_0x3adf49[_0xc8a5('0x59')]['Smtp'][_0xc8a5('0x76')];_0x55a872[_0xc8a5('0x3d')][_0xc8a5('0x77')]=_0x3adf49[_0xc8a5('0x59')]['Smtp'][_0xc8a5('0x77')];}else{_0x55a872[_0xc8a5('0x3b')][_0xc8a5('0x78')]=_0x55a872[_0xc8a5('0x3d')][_0xc8a5('0x78')]=_0x3adf49[_0xc8a5('0x59')]['cservice'];_0x55a872[_0xc8a5('0x3b')][_0xc8a5('0x70')]=_0x55a872[_0xc8a5('0x3d')][_0xc8a5('0x70')]=_0x3adf49[_0xc8a5('0x59')]['cuser'];_0x55a872[_0xc8a5('0x3b')][_0xc8a5('0x72')]=_0x55a872['Smtp'][_0xc8a5('0x73')]=_0x3adf49[_0xc8a5('0x59')][_0xc8a5('0x74')];}return db[_0xc8a5('0x40')][_0xc8a5('0x5f')](_0x55a872,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xc8a5('0x3a')],'as':_0xc8a5('0x3b')}]})[_0xc8a5('0x1f')](function(_0x460324){var _0x20e6d4=_0x3adf49['user'][_0xc8a5('0x35')]({'plain':!![]});if(!_0x20e6d4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x20e6d4[_0xc8a5('0x79')]===_0xc8a5('0x70')){var _0x1a0999=_0x460324['get']({'plain':!![]});return db[_0xc8a5('0x7a')]['find']({'where':{'name':_0xc8a5('0x36'),'userProfileId':_0x20e6d4[_0xc8a5('0x7b')]},'raw':!![]})['then'](function(_0x5d6989){if(_0x5d6989&&_0x5d6989['autoAssociation']===0x0){return db['UserProfileResource'][_0xc8a5('0x5f')]({'name':_0x1a0999['name'],'resourceId':_0x1a0999['id'],'type':_0x5d6989[_0xc8a5('0x38')],'sectionId':_0x5d6989['id']},{})[_0xc8a5('0x1f')](function(){return _0x460324;});}else{return _0x460324;}})['catch'](function(_0x49fe2f){logger['error'](_0xc8a5('0x7c'),_0x49fe2f);throw _0x49fe2f;});}return _0x460324;})[_0xc8a5('0x1f')](respondWithResult(_0x435b64,0xc9))['catch'](handleError(_0x435b64,null));};exports[_0xc8a5('0x7d')]=function(_0xabdf86,_0x5dfea5,_0x4a5b4d){return db[_0xc8a5('0x40')][_0xc8a5('0x61')]({'where':{'id':_0xabdf86[_0xc8a5('0x5b')]['id']}})[_0xc8a5('0x1f')](handleEntityNotFound(_0x5dfea5,null))[_0xc8a5('0x1f')](function(_0x365e74){if(_0x365e74){return _0x365e74[_0xc8a5('0x7d')]();}return null;})[_0xc8a5('0x1f')](respondWithResult(_0x5dfea5,null))[_0xc8a5('0x28')](handleError(_0x5dfea5,null));};exports['addImap']=function(_0x3f0fc6,_0x851db1,_0x4539bc){if(_0x3f0fc6[_0xc8a5('0x59')]['id']){delete _0x3f0fc6[_0xc8a5('0x59')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x3f0fc6['params']['id']}})[_0xc8a5('0x1f')](handleEntityNotFound(_0x851db1,null))['then'](function(_0x3d4466){if(_0x3d4466){_0x3f0fc6['body'][_0xc8a5('0x68')]=_0x3d4466['id'];return db['MailServerIn'][_0xc8a5('0x5f')](_0x3f0fc6[_0xc8a5('0x59')]);}})['then'](respondWithResult(_0x851db1,null))[_0xc8a5('0x28')](handleError(_0x851db1,null));};exports[_0xc8a5('0x7e')]=function(_0x3a4b11,_0x56b273,_0x3d4e7a){return db[_0xc8a5('0x40')][_0xc8a5('0x61')]({'where':{'id':_0x3a4b11['params']['id']}})[_0xc8a5('0x1f')](handleEntityNotFound(_0x56b273,null))[_0xc8a5('0x1f')](function(_0x45e342){if(_0x45e342){return _0x45e342[_0xc8a5('0x7f')](null);}return null;})['then'](respondWithStatusCode(_0x56b273,null))[_0xc8a5('0x28')](handleError(_0x56b273,null));};exports[_0xc8a5('0x80')]=function(_0x535c0c,_0x41c103,_0x6c3380){return db[_0xc8a5('0x40')]['findOne']({'where':{'id':_0x535c0c[_0xc8a5('0x5b')]['id']}})['then'](handleEntityNotFound(_0x41c103,null))[_0xc8a5('0x1f')](function(_0x489334){if(_0x489334){return _0x489334['getSmtp']();}return null;})['then'](respondWithResult(_0x41c103,null))[_0xc8a5('0x28')](handleError(_0x41c103,null));};exports[_0xc8a5('0x81')]=function(_0xc1fe06,_0x43a683,_0x34293d){if(_0xc1fe06['body']['id']){delete _0xc1fe06[_0xc8a5('0x59')]['id'];}return db[_0xc8a5('0x40')][_0xc8a5('0x5a')]({'where':{'id':_0xc1fe06['params']['id']}})[_0xc8a5('0x1f')](handleEntityNotFound(_0x43a683,null))['then'](function(_0x21f6b1){if(_0x21f6b1){_0xc1fe06['body']['MailAccountId']=_0x21f6b1['id'];return db[_0xc8a5('0x3c')][_0xc8a5('0x5f')](_0xc1fe06[_0xc8a5('0x59')]);}})['then'](respondWithResult(_0x43a683,null))[_0xc8a5('0x28')](handleError(_0x43a683,null));};exports[_0xc8a5('0x82')]=function(_0x454409,_0x4bf7e5,_0x2c7834){return db[_0xc8a5('0x40')][_0xc8a5('0x61')]({'where':{'id':_0x454409[_0xc8a5('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4bf7e5,null))[_0xc8a5('0x1f')](function(_0x5508a1){if(_0x5508a1){return _0x5508a1['setSmtp'](null);}return null;})[_0xc8a5('0x1f')](respondWithStatusCode(_0x4bf7e5,null))[_0xc8a5('0x28')](handleError(_0x4bf7e5,null));};exports['addInteraction']=function(_0x1098a5,_0xd61738,_0x27289e){return db['MailInteraction']['find']({'where':{'id':_0x1098a5[_0xc8a5('0x5b')]['id']}})['then'](handleEntityNotFound(_0xd61738,null))[_0xc8a5('0x1f')](function(_0x5483bd){if(_0x5483bd){return _0x5483bd[_0xc8a5('0x83')](_0x1098a5[_0xc8a5('0x59')][_0xc8a5('0x66')],_[_0xc8a5('0x84')](_0x1098a5[_0xc8a5('0x59')],[_0xc8a5('0x66'),'id'])||{});}})['then'](respondWithResult(_0xd61738,null))[_0xc8a5('0x28')](handleError(_0xd61738,null));};exports[_0xc8a5('0x85')]=function(_0x3b0d6f,_0x3fcdf9,_0x1eb464){var _0x4d2aa0={'raw':![],'where':{}};var _0x3104a4={};var _0x13c2b7={'count':0x0,'rows':[]};return db['MailAccount'][_0xc8a5('0x61')]({'where':{'id':_0x3b0d6f['params']['id']}})[_0xc8a5('0x1f')](handleEntityNotFound(_0x3fcdf9,null))[_0xc8a5('0x1f')](function(_0x16848e){if(_0x16848e){_0x3104a4[_0xc8a5('0x43')]=_['keys'](db[_0xc8a5('0x86')][_0xc8a5('0x62')]);_0x3104a4[_0xc8a5('0x45')]=_[_0xc8a5('0x46')](_0x3b0d6f[_0xc8a5('0x45')]);_0x3104a4[_0xc8a5('0x47')]=_[_0xc8a5('0x48')](_0x3104a4[_0xc8a5('0x43')],_0x3104a4['query']);_0x4d2aa0[_0xc8a5('0x49')]=_[_0xc8a5('0x48')](_0x3104a4['model'],qs[_0xc8a5('0x4a')](_0x3b0d6f[_0xc8a5('0x45')][_0xc8a5('0x4a')]));_0x4d2aa0['attributes']=_0x4d2aa0[_0xc8a5('0x49')][_0xc8a5('0x4b')]?_0x4d2aa0[_0xc8a5('0x49')]:_0x3104a4[_0xc8a5('0x43')];if(!_0x3b0d6f[_0xc8a5('0x45')][_0xc8a5('0x63')](_0xc8a5('0x4c'))){_0x4d2aa0['limit']=qs[_0xc8a5('0x2e')](_0x3b0d6f['query']['limit']);_0x4d2aa0[_0xc8a5('0x2d')]=qs['offset'](_0x3b0d6f[_0xc8a5('0x45')][_0xc8a5('0x2d')]);}_0x4d2aa0[_0xc8a5('0x64')]=qs[_0xc8a5('0x4d')](_0x3b0d6f[_0xc8a5('0x45')][_0xc8a5('0x4d')]);_0x4d2aa0[_0xc8a5('0x4e')]=qs['filters'](_['pick'](_0x3b0d6f[_0xc8a5('0x45')],_0x3104a4[_0xc8a5('0x47')]));_0x4d2aa0[_0xc8a5('0x4e')]['MailAccountId']=_0x16848e['id'];if(_0x3b0d6f[_0xc8a5('0x45')][_0xc8a5('0x50')]){_0x4d2aa0['where']=_[_0xc8a5('0x51')](_0x4d2aa0[_0xc8a5('0x4e')],{'$or':_[_0xc8a5('0x44')](_0x4d2aa0[_0xc8a5('0x49')],function(_0x547ab5){var _0x4e57e8={};_0x4e57e8[_0x547ab5]={'$like':'%'+_0x3b0d6f[_0xc8a5('0x45')]['filter']+'%'};return _0x4e57e8;})});}_0x4d2aa0=_[_0xc8a5('0x51')]({},_0x4d2aa0,_0x3b0d6f[_0xc8a5('0x53')]);return db[_0xc8a5('0x86')]['count']({'where':_0x4d2aa0['where']})[_0xc8a5('0x1f')](function(_0x1fd460){_0x13c2b7[_0xc8a5('0x2c')]=_0x1fd460;if(_0x3b0d6f[_0xc8a5('0x45')]['includeAll']){_0x4d2aa0['include']=[{'model':db[_0xc8a5('0x87')],'as':_0xc8a5('0x88'),'required':![]},{'model':db[_0xc8a5('0x89')],'as':_0xc8a5('0x8a'),'attributes':[_0xc8a5('0x38'),_0xc8a5('0x8b'),_0xc8a5('0x8c')],'required':![]},{'model':db[_0xc8a5('0x8d')],'as':_0xc8a5('0x8e'),'attributes':['id',_0xc8a5('0x38'),_0xc8a5('0x8f')],'where':_0x3b0d6f[_0xc8a5('0x45')]['tag']?{'id':_0x3b0d6f[_0xc8a5('0x45')][_0xc8a5('0x90')]}:undefined,'required':_0x3b0d6f[_0xc8a5('0x45')]['tag']?!![]:![]}];}return db[_0xc8a5('0x86')]['findAll'](_0x4d2aa0);})[_0xc8a5('0x1f')](function(_0x3950bd){_0x13c2b7[_0xc8a5('0x56')]=_0x3950bd;return _0x13c2b7;});}})['then'](respondWithFilteredResult(_0x3fcdf9,_0x4d2aa0))[_0xc8a5('0x28')](handleError(_0x3fcdf9,null));};exports['addApplications']=function(_0x145556,_0x3690d3,_0x523ce2){return db[_0xc8a5('0x40')][_0xc8a5('0x61')]({'where':{'id':_0x145556[_0xc8a5('0x5b')]['id']}})[_0xc8a5('0x1f')](handleEntityNotFound(_0x3690d3,null))['then'](function(_0x5d1941){if(_0x5d1941){return db[_0xc8a5('0x91')][_0xc8a5('0x92')](function(_0x43de24){return db['MailApplication'][_0xc8a5('0x34')]({'where':{'MailAccountId':_0x145556[_0xc8a5('0x5b')]['id']},'transaction':_0x43de24})['then'](function(_0x12ef96){var _0x409e75=_[_0xc8a5('0x44')](_0x145556[_0xc8a5('0x59')],function(_0x3a21a6){_0x3a21a6[_0xc8a5('0x68')]=_0x145556['params']['id'];return _0x3a21a6;});return db[_0xc8a5('0x93')][_0xc8a5('0x94')](_0x409e75,{'transaction':_0x43de24});});})['then'](function(){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0x145556[_0xc8a5('0x5b')]['id']},'order':_0xc8a5('0x95')});});}})[_0xc8a5('0x1f')](respondWithResult(_0x3690d3,null))[_0xc8a5('0x28')](handleError(_0x3690d3,null));};exports[_0xc8a5('0x96')]=function(_0x2459c1,_0x11b943,_0x4b0ee8){var _0x58c6e3={};var _0x480c7c={};var _0x150302;var _0x1ca340;return db[_0xc8a5('0x40')]['findOne']({'where':{'id':_0x2459c1[_0xc8a5('0x5b')]['id']}})['then'](handleEntityNotFound(_0x11b943,null))[_0xc8a5('0x1f')](function(_0x529e2c){if(_0x529e2c){_0x150302=_0x529e2c;_0x480c7c['model']=_['keys'](db[_0xc8a5('0x93')]['rawAttributes']);_0x480c7c['query']=_[_0xc8a5('0x46')](_0x2459c1[_0xc8a5('0x45')]);_0x480c7c[_0xc8a5('0x47')]=_[_0xc8a5('0x48')](_0x480c7c[_0xc8a5('0x43')],_0x480c7c['query']);_0x58c6e3[_0xc8a5('0x49')]=_[_0xc8a5('0x48')](_0x480c7c[_0xc8a5('0x43')],qs['fields'](_0x2459c1['query']['fields']));_0x58c6e3[_0xc8a5('0x49')]=_0x58c6e3[_0xc8a5('0x49')][_0xc8a5('0x4b')]?_0x58c6e3['attributes']:_0x480c7c['model'];_0x58c6e3[_0xc8a5('0x64')]=qs[_0xc8a5('0x4d')](_0x2459c1[_0xc8a5('0x45')][_0xc8a5('0x4d')]);_0x58c6e3[_0xc8a5('0x4e')]=qs[_0xc8a5('0x47')](_[_0xc8a5('0x4f')](_0x2459c1[_0xc8a5('0x45')],_0x480c7c['filters']));if(_0x2459c1[_0xc8a5('0x45')][_0xc8a5('0x50')]){_0x58c6e3[_0xc8a5('0x4e')]=_[_0xc8a5('0x51')](_0x58c6e3[_0xc8a5('0x4e')],{'$or':_['map'](_0x58c6e3[_0xc8a5('0x49')],function(_0x58815a){var _0x33ea69={};_0x33ea69[_0x58815a]={'$like':'%'+_0x2459c1['query'][_0xc8a5('0x50')]+'%'};return _0x33ea69;})});}_0x58c6e3=_[_0xc8a5('0x51')]({},_0x58c6e3,_0x2459c1[_0xc8a5('0x53')]);return _0x150302[_0xc8a5('0x96')](_0x58c6e3);}})[_0xc8a5('0x1f')](function(_0x459316){if(_0x459316){_0x1ca340=_0x459316[_0xc8a5('0x4b')];if(!_0x2459c1[_0xc8a5('0x45')]['hasOwnProperty']('nolimit')){_0x58c6e3[_0xc8a5('0x2e')]=qs[_0xc8a5('0x2e')](_0x2459c1[_0xc8a5('0x45')][_0xc8a5('0x2e')]);_0x58c6e3['offset']=qs[_0xc8a5('0x2d')](_0x2459c1[_0xc8a5('0x45')][_0xc8a5('0x2d')]);}return _0x150302['getApplications'](_0x58c6e3);}})[_0xc8a5('0x1f')](function(_0x2fb52b){if(_0x2fb52b){return _0x2fb52b?{'count':_0x1ca340,'rows':_0x2fb52b}:null;}})[_0xc8a5('0x1f')](respondWithResult(_0x11b943,null))[_0xc8a5('0x28')](handleError(_0x11b943,null));};exports['getMessages']=function(_0x527e00,_0x9153d,_0x20ca80){var _0x24e62e={'raw':!![],'where':{}};var _0x5ee425={};var _0x1dbf6b={'count':0x0,'rows':[]};return db[_0xc8a5('0x40')]['findOne']({'where':{'id':_0x527e00[_0xc8a5('0x5b')]['id']}})[_0xc8a5('0x1f')](handleEntityNotFound(_0x9153d,null))[_0xc8a5('0x1f')](function(_0x2f3e13){if(_0x2f3e13){_0x5ee425[_0xc8a5('0x43')]=_[_0xc8a5('0x46')](db[_0xc8a5('0x97')][_0xc8a5('0x62')]);_0x5ee425[_0xc8a5('0x45')]=_[_0xc8a5('0x46')](_0x527e00[_0xc8a5('0x45')]);_0x5ee425[_0xc8a5('0x47')]=_['intersection'](_0x5ee425[_0xc8a5('0x43')],_0x5ee425[_0xc8a5('0x45')]);_0x24e62e[_0xc8a5('0x49')]=_['intersection'](_0x5ee425[_0xc8a5('0x43')],qs[_0xc8a5('0x4a')](_0x527e00[_0xc8a5('0x45')][_0xc8a5('0x4a')]));_0x24e62e['attributes']=_0x24e62e[_0xc8a5('0x49')][_0xc8a5('0x4b')]?_0x24e62e[_0xc8a5('0x49')]:_0x5ee425['model'];if(!_0x527e00['query'][_0xc8a5('0x63')](_0xc8a5('0x4c'))){_0x24e62e[_0xc8a5('0x2e')]=qs['limit'](_0x527e00['query'][_0xc8a5('0x2e')]);_0x24e62e[_0xc8a5('0x2d')]=qs['offset'](_0x527e00['query']['offset']);}_0x24e62e[_0xc8a5('0x64')]=qs[_0xc8a5('0x4d')](_0x527e00['query']['sort']);_0x24e62e[_0xc8a5('0x4e')]=qs[_0xc8a5('0x47')](_['pick'](_0x527e00['query'],_0x5ee425['filters']));_0x24e62e[_0xc8a5('0x4e')]['MailAccountId']=_0x2f3e13['id'];if(_0x527e00[_0xc8a5('0x45')][_0xc8a5('0x50')]){_0x24e62e[_0xc8a5('0x4e')]=_[_0xc8a5('0x51')](_0x24e62e[_0xc8a5('0x4e')],{'$or':_[_0xc8a5('0x44')](_0x24e62e[_0xc8a5('0x49')],function(_0x461afa){var _0x3e8be1={};_0x3e8be1[_0x461afa]={'$like':'%'+_0x527e00[_0xc8a5('0x45')][_0xc8a5('0x50')]+'%'};return _0x3e8be1;})});}if(_0x527e00[_0xc8a5('0x45')][_0xc8a5('0x98')]){var _0x519177=_0x527e00[_0xc8a5('0x45')][_0xc8a5('0x98')][_0xc8a5('0x99')](',');var _0x4cc5fe={};_0x4cc5fe[_0x519177[0x0]]={'$gte':moment(_0x519177[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x24e62e['where']=_[_0xc8a5('0x51')](_0x24e62e[_0xc8a5('0x4e')],_0x4cc5fe);}_0x24e62e=_[_0xc8a5('0x51')]({},_0x24e62e,_0x527e00['options']);return db[_0xc8a5('0x97')]['count']({'where':_0x24e62e[_0xc8a5('0x4e')]})['then'](function(_0xf9a9f8){_0x1dbf6b['count']=_0xf9a9f8;if(_0x527e00[_0xc8a5('0x45')][_0xc8a5('0x54')]){_0x24e62e[_0xc8a5('0x58')]=[{'all':!![]}];}return db[_0xc8a5('0x97')][_0xc8a5('0x55')](_0x24e62e);})[_0xc8a5('0x1f')](function(_0x49b236){_0x1dbf6b['rows']=_0x49b236;return _0x1dbf6b;});}})['then'](respondWithFilteredResult(_0x9153d,_0x24e62e))[_0xc8a5('0x28')](handleError(_0x9153d,null));};exports[_0xc8a5('0x9a')]=function(_0x169dcf,_0x2555e4,_0x3e7a76){var _0x53ab23,_0x7af89d={},_0x4fc20e;if(_0x169dcf['body']['to']){_0x4fc20e=_0x169dcf['body']['to'][_0xc8a5('0x99')](',')[0x0];}return db[_0xc8a5('0x40')][_0xc8a5('0x5a')]({'where':{'id':_0x169dcf[_0xc8a5('0x5b')]['id']},'include':[{'model':db[_0xc8a5('0x9b')],'as':_0xc8a5('0x9c'),'include':[{'model':db[_0xc8a5('0x87')],'as':_0xc8a5('0x9d'),'where':{'email':_0x4fc20e},'limit':0x1,'order':[[_0xc8a5('0x9e'),'DESC']]}]},{'model':db[_0xc8a5('0x3c')],'as':_0xc8a5('0x3d'),'raw':!![]}]})[_0xc8a5('0x1f')](handleEntityNotFound(_0x2555e4,null))[_0xc8a5('0x1f')](function(_0x4dd125){if(_0x4dd125){_0x53ab23=_0x4dd125;if(_0x4dd125[_0xc8a5('0x3d')]){if(_[_0xc8a5('0x6d')](_0x169dcf[_0xc8a5('0x59')][_0xc8a5('0x9f')])){_0x169dcf[_0xc8a5('0x59')][_0xc8a5('0x9f')]=util[_0xc8a5('0xa0')](_0xc8a5('0xa1'),_0x4dd125[_0xc8a5('0x38')],_0x4dd125[_0xc8a5('0x6b')]||_0x4dd125[_0xc8a5('0x3d')]['user']);}if(_0x169dcf[_0xc8a5('0x59')][_0xc8a5('0xa2')]&&_0x169dcf[_0xc8a5('0x59')][_0xc8a5('0xa2')][_0xc8a5('0x4b')]){for(var _0x2d8f1d=0x0;_0x2d8f1d<_0x169dcf[_0xc8a5('0x59')][_0xc8a5('0xa2')][_0xc8a5('0x4b')];_0x2d8f1d+=0x1){_0x169dcf['body'][_0xc8a5('0xa2')][_0x2d8f1d]={'filename':_0x169dcf[_0xc8a5('0x59')]['attachments'][_0x2d8f1d]['name'],'path':path[_0xc8a5('0xa3')](config['root'],_0xc8a5('0xa4'),_0x169dcf[_0xc8a5('0x59')]['attachments'][_0x2d8f1d][_0xc8a5('0xa5')])};}}var _0x5f18f2={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x4dd125[_0xc8a5('0x3d')][_0xc8a5('0x78')])){if(_0x4dd125['Smtp']['authentication']){_0x5f18f2['auth']={'user':_0x4dd125[_0xc8a5('0x3d')][_0xc8a5('0x70')],'pass':_0x4dd125['Smtp'][_0xc8a5('0x73')]};}_0x5f18f2['host']=_0x4dd125[_0xc8a5('0x3d')][_0xc8a5('0x76')];_0x5f18f2[_0xc8a5('0x77')]=_0x4dd125[_0xc8a5('0x3d')][_0xc8a5('0x77')];_0x5f18f2[_0xc8a5('0xa6')]=_0x4dd125[_0xc8a5('0x3d')]['secure'];}else{_0x5f18f2[_0xc8a5('0x78')]=_0x4dd125[_0xc8a5('0x3d')][_0xc8a5('0x78')];_0x5f18f2[_0xc8a5('0xa7')]={'user':_0x4dd125[_0xc8a5('0x3d')][_0xc8a5('0x70')],'pass':_0x4dd125[_0xc8a5('0x3d')][_0xc8a5('0x73')]};}return respondWithRpcPromise(_0xc8a5('0xa8'),'sendMail',{'account':_0x5f18f2,'message':_0x169dcf[_0xc8a5('0x59')]});}else{throw new Error(_0xc8a5('0xa9'));}}})['then'](function(_0x48a5ff){if(_0x48a5ff){_0x7af89d=_0x48a5ff;if(_0x53ab23['List']){if(_0x53ab23['List']['Contacts'][_0xc8a5('0x4b')]){return _0x53ab23[_0xc8a5('0x9c')][_0xc8a5('0x9d')][0x0];}else{return db[_0xc8a5('0x87')][_0xc8a5('0x5f')](_[_0xc8a5('0x15')](_0x169dcf['body'],{'firstName':_0x169dcf[_0xc8a5('0x59')]['to'],'email':_0x169dcf[_0xc8a5('0x59')]['to'],'phone':_0x169dcf[_0xc8a5('0x59')]['to'],'ListId':_0x53ab23[_0xc8a5('0x6c')]}));}}else{throw new Error(_0xc8a5('0xa9'));}}})[_0xc8a5('0x1f')](function(_0x24f6d8){if(_0x24f6d8){var _0x1f5de3={'UserId':_0x169dcf['user']['id'],'ContactId':_0x24f6d8['id'],'MailAccountId':_0x53ab23['id'],'inReplyTo':_0x7af89d['messageId'],'to':_0x169dcf['body'][_0xc8a5('0x9f')],'cc':_0x169dcf[_0xc8a5('0x59')]['cc'],'subject':_0x169dcf[_0xc8a5('0x59')][_0xc8a5('0xaa')],'attach':_0x169dcf[_0xc8a5('0x59')][_0xc8a5('0xab')],'firstMsgDirection':_0xc8a5('0xac'),'lastMsgAt':moment()[_0xc8a5('0xa0')](_0xc8a5('0xad')),'lastMsgDirection':_0xc8a5('0xac'),'lastMsgBody':_0x169dcf[_0xc8a5('0x59')][_0xc8a5('0x59')],'Messages':[_[_0xc8a5('0x51')](_0x169dcf[_0xc8a5('0x59')],{'messageId':_0x7af89d[_0xc8a5('0xae')],'sentAt':moment()[_0xc8a5('0xa0')](_0xc8a5('0xad')),'read':!![],'MailAccountId':_0x53ab23['id'],'UserId':_0x169dcf[_0xc8a5('0x70')]['id'],'ContactId':_0x24f6d8['id']})]};if(_0x169dcf[_0xc8a5('0x59')][_0xc8a5('0xaf')]){_0x1f5de3=_[_0xc8a5('0x51')](_0x1f5de3,_0x169dcf[_0xc8a5('0x59')][_0xc8a5('0xaf')]);}return db[_0xc8a5('0x86')][_0xc8a5('0x5f')](_0x1f5de3,{'include':[{'model':db[_0xc8a5('0x97')],'as':_0xc8a5('0xb0')}]});}})['then'](respondWithResult(_0x2555e4,null))[_0xc8a5('0x28')](handleError(_0x2555e4,null));};exports[_0xc8a5('0xb1')]=function(_0x538788,_0x43c6a6,_0x38a82c){return db[_0xc8a5('0x40')][_0xc8a5('0x5a')]({'where':{'id':_0x538788[_0xc8a5('0x5b')]['id']},'include':[{'model':db[_0xc8a5('0x3c')],'as':_0xc8a5('0x3d'),'raw':!![]}]})['then'](handleEntityNotFound(_0x43c6a6,null))[_0xc8a5('0x1f')](function(_0x3b4296){if(_0x3b4296&&_0x3b4296[_0xc8a5('0x3d')]){var _0x1ab4f4={'id':_0x3b4296['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3b4296[_0xc8a5('0x3d')][_0xc8a5('0x78')]){_0x1ab4f4[_0xc8a5('0x78')]=_0x3b4296[_0xc8a5('0x3d')][_0xc8a5('0x78')];}else{_0x1ab4f4['host']=_0x3b4296[_0xc8a5('0x3d')][_0xc8a5('0x76')];_0x1ab4f4[_0xc8a5('0x77')]=_0x3b4296[_0xc8a5('0x3d')][_0xc8a5('0x77')];_0x1ab4f4[_0xc8a5('0xa6')]=_0x3b4296['Smtp'][_0xc8a5('0xa6')];}if(_0x3b4296[_0xc8a5('0x3d')][_0xc8a5('0x75')]){_0x1ab4f4[_0xc8a5('0xa7')]={'user':_0x3b4296[_0xc8a5('0x3d')]['user'],'pass':_0x3b4296[_0xc8a5('0x3d')][_0xc8a5('0x73')]};}return respondWithRpcPromise(_0xc8a5('0xb2'),_0xc8a5('0xb1'),{'account':_0x1ab4f4});}})['then'](respondWithResult(_0x43c6a6,null))['catch'](handleError(_0x43c6a6,null));};exports[_0xc8a5('0x34')]=function(_0xa35393,_0x240ccb){return db[_0xc8a5('0x40')]['find']({'where':{'id':_0xa35393[_0xc8a5('0x5b')]['id']}})[_0xc8a5('0x1f')](handleEntityNotFound(_0x240ccb,null))[_0xc8a5('0x1f')](function(_0x5aa9a4){if(_0x5aa9a4&&_0x5aa9a4[_0xc8a5('0x78')]){throw new db[(_0xc8a5('0x1b'))][(_0xc8a5('0x1c'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x5aa9a4;})[_0xc8a5('0x1f')](removeEntity(_0x240ccb,null))[_0xc8a5('0x28')](handleError(_0x240ccb,null));};exports['addAgents']=function(_0x5ec4ca,_0x13e08e,_0x3d0a9b){return db[_0xc8a5('0x40')][_0xc8a5('0x5a')]({'where':{'id':_0x5ec4ca[_0xc8a5('0x5b')]['id']}})[_0xc8a5('0x1f')](handleEntityNotFound(_0x13e08e,null))['then'](function(_0x1fa89c){if(_0x1fa89c){return _0x1fa89c['addAgents'](_0x5ec4ca[_0xc8a5('0x59')]['ids'],_[_0xc8a5('0x84')](_0x5ec4ca['body'],[_0xc8a5('0x66'),'id'])||{})['spread'](function(_0x345781){for(var _0x48b452=0x0;_0x48b452<_0x5ec4ca[_0xc8a5('0x59')][_0xc8a5('0x66')][_0xc8a5('0x4b')];_0x48b452+=0x1){socket['emit']('userMailAccount:save',{'UserId':_0x5ec4ca[_0xc8a5('0x59')][_0xc8a5('0x66')][_0x48b452],'MailAccountId':_0x5ec4ca[_0xc8a5('0x5b')]['id']});}return _0x345781;});}})['then'](respondWithResult(_0x13e08e,null))[_0xc8a5('0x28')](handleError(_0x13e08e,null));};exports[_0xc8a5('0xb3')]=function(_0x47389d,_0xecdcf6,_0x530f72){return db[_0xc8a5('0x40')]['find']({'where':{'id':_0x47389d[_0xc8a5('0x5b')]['id']}})[_0xc8a5('0x1f')](handleEntityNotFound(_0xecdcf6,null))['then'](function(_0x258b38){if(_0x258b38){return _0x258b38[_0xc8a5('0xb3')](_0x47389d[_0xc8a5('0x45')][_0xc8a5('0x66')])['then'](function(){if(_[_0xc8a5('0xb4')](_0x47389d[_0xc8a5('0x45')][_0xc8a5('0x66')])){for(var _0x3e418a=0x0;_0x3e418a<_0x47389d[_0xc8a5('0x45')][_0xc8a5('0x66')]['length'];_0x3e418a+=0x1){socket[_0xc8a5('0xb5')](_0xc8a5('0xb6'),{'UserId':Number(_0x47389d['query'][_0xc8a5('0x66')][_0x3e418a]),'MailAccountId':Number(_0x47389d[_0xc8a5('0x5b')]['id'])});}}else{socket['emit'](_0xc8a5('0xb6'),{'UserId':Number(_0x47389d[_0xc8a5('0x45')][_0xc8a5('0x66')]),'MailAccountId':Number(_0x47389d['params']['id'])});}});}})[_0xc8a5('0x1f')](respondWithStatusCode(_0xecdcf6,null))['catch'](handleError(_0xecdcf6,null));};exports['getAgents']=function(_0x2f7c48,_0xe93c19,_0x55fc63){var _0x4699a2={};var _0x1636da={};var _0x4422f9;var _0x5f44c3;return db['MailAccount'][_0xc8a5('0x61')]({'where':{'id':_0x2f7c48[_0xc8a5('0x5b')]['id']}})[_0xc8a5('0x1f')](handleEntityNotFound(_0xe93c19,null))[_0xc8a5('0x1f')](function(_0x20fcea){if(_0x20fcea){_0x4422f9=_0x20fcea;_0x1636da[_0xc8a5('0x43')]=_[_0xc8a5('0x46')](db[_0xc8a5('0x89')]['rawAttributes']);_0x1636da[_0xc8a5('0x45')]=_[_0xc8a5('0x46')](_0x2f7c48[_0xc8a5('0x45')]);_0x1636da['filters']=_[_0xc8a5('0x48')](_0x1636da[_0xc8a5('0x43')],_0x1636da[_0xc8a5('0x45')]);_0x4699a2[_0xc8a5('0x49')]=_[_0xc8a5('0x48')](_0x1636da['model'],qs[_0xc8a5('0x4a')](_0x2f7c48[_0xc8a5('0x45')][_0xc8a5('0x4a')]));_0x4699a2[_0xc8a5('0x49')]=_0x4699a2[_0xc8a5('0x49')]['length']?_0x4699a2[_0xc8a5('0x49')]:_0x1636da[_0xc8a5('0x43')];_0x4699a2[_0xc8a5('0x64')]=qs[_0xc8a5('0x4d')](_0x2f7c48[_0xc8a5('0x45')][_0xc8a5('0x4d')]);_0x4699a2[_0xc8a5('0x4e')]=qs[_0xc8a5('0x47')](_['pick'](_0x2f7c48[_0xc8a5('0x45')],_0x1636da[_0xc8a5('0x47')]));if(_0x2f7c48[_0xc8a5('0x45')][_0xc8a5('0x50')]){_0x4699a2[_0xc8a5('0x4e')]=_['merge'](_0x4699a2[_0xc8a5('0x4e')],{'$or':_[_0xc8a5('0x44')](_0x4699a2[_0xc8a5('0x49')],function(_0x1aa635){var _0x1552e9={};_0x1552e9[_0x1aa635]={'$like':'%'+_0x2f7c48[_0xc8a5('0x45')][_0xc8a5('0x50')]+'%'};return _0x1552e9;})});}_0x4699a2=_['merge']({},_0x4699a2,_0x2f7c48[_0xc8a5('0x53')]);return _0x4422f9['getAgents'](_0x4699a2);}})[_0xc8a5('0x1f')](function(_0x1ea3a7){if(_0x1ea3a7){_0x5f44c3=_0x1ea3a7[_0xc8a5('0x4b')];if(!_0x2f7c48['query'][_0xc8a5('0x63')]('nolimit')){_0x4699a2['limit']=qs[_0xc8a5('0x2e')](_0x2f7c48[_0xc8a5('0x45')][_0xc8a5('0x2e')]);_0x4699a2[_0xc8a5('0x2d')]=qs['offset'](_0x2f7c48[_0xc8a5('0x45')]['offset']);}return _0x4422f9[_0xc8a5('0xb7')](_0x4699a2);}})[_0xc8a5('0x1f')](function(_0x10029e){if(_0x10029e){return _0x10029e?{'count':_0x5f44c3,'rows':_0x10029e}:null;}})[_0xc8a5('0x1f')](respondWithResult(_0xe93c19,null))[_0xc8a5('0x28')](handleError(_0xe93c19,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index c043107..e1aa4ee 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 _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 +var _0x73bf=['update','remove','emit','hasOwnProperty','../../mysqldb','MailAccount','setMaxListeners'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x73bf,0x107));var _0xf73b=function(_0x354861,_0x450659){_0x354861=_0x354861-0x0;var _0x7fa747=_0x73bf[_0x354861];return _0x7fa747;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0xf73b('0x0'))['db'][_0xf73b('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xf73b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf73b('0x3'),'afterDestroy':_0xf73b('0x4')};function emitEvent(_0x4294c2){return function(_0x46501f,_0x341d58,_0x556980){MailAccountEvents['emit'](_0x4294c2+':'+_0x46501f['id'],_0x46501f);MailAccountEvents[_0xf73b('0x5')](_0x4294c2,_0x46501f);_0x556980(null);};}for(var e in events){if(events[_0xf73b('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 7eda4cc..897fd14 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 _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 +var _0xe0db=['moment','bluebird','request-promise','path','../../config/environment','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','lodash','../../config/logger','api'];(function(_0x2e3d68,_0x34266b){var _0x43db1d=function(_0x375ebe){while(--_0x375ebe){_0x2e3d68['push'](_0x2e3d68['shift']());}};_0x43db1d(++_0x34266b);}(_0xe0db,0x65));var _0xbe0d=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xe0db[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0xbe0d('0x0'));var util=require('util');var logger=require(_0xbe0d('0x1'))(_0xbe0d('0x2'));var moment=require(_0xbe0d('0x3'));var BPromise=require(_0xbe0d('0x4'));var rp=require(_0xbe0d('0x5'));var fs=require('fs');var path=require(_0xbe0d('0x6'));var rimraf=require('rimraf');var config=require(_0xbe0d('0x7'));var attributes=require(_0xbe0d('0x8'));module[_0xbe0d('0x9')]=function(_0xcab340,_0x59b458){return _0xcab340[_0xbe0d('0xa')](_0xbe0d('0xb'),attributes,{'tableName':_0xbe0d('0xc'),'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 ccfb3c5..d003fce 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 _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 +var _0x1ddc=['spread','update','originTo','Attachment','Attachments','UserId','User','interaction','agent','name','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','include','map','model','ShowMailAccount','find','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','DESC','MailApplication','MailServerOut','Smtp','get','Applications','list','applications','priority','asc','autoclose','push','length','close','*,*,*,*','Contacts','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1ddc,0x6e));var _0xc1dd=function(_0x12d117,_0x2b180a){_0x12d117=_0x12d117-0x0;var _0x1046bf=_0x1ddc[_0x12d117];return _0x1046bf;};'use strict';var _=require('lodash');var util=require(_0xc1dd('0x0'));var moment=require(_0xc1dd('0x1'));var BPromise=require(_0xc1dd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc1dd('0x3'));var db=require(_0xc1dd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc1dd('0x5'))(_0xc1dd('0x6'));var config=require('../../config/environment');var jayson=require(_0xc1dd('0x7'));var client=jayson[_0xc1dd('0x8')]['http']({'port':0x232c});config[_0xc1dd('0x9')]=_[_0xc1dd('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc1dd('0xb'))(new Redis(config[_0xc1dd('0x9')]));require(_0xc1dd('0xc'))[_0xc1dd('0xd')](socket);function respondWithRpcPromise(_0x495e17,_0x38b62e,_0x1b4b3f){return new BPromise(function(_0xa720ed,_0xccdb4e){return client['request'](_0x495e17,_0x1b4b3f)[_0xc1dd('0xe')](function(_0x1d28a7){logger[_0xc1dd('0xf')](_0xc1dd('0x10'),_0x38b62e,_0xc1dd('0x11'));logger[_0xc1dd('0x12')](_0xc1dd('0x13'),_0x38b62e,_0xc1dd('0x11'),JSON[_0xc1dd('0x14')](_0x1d28a7));if(_0x1d28a7[_0xc1dd('0x15')]){if(_0x1d28a7[_0xc1dd('0x15')]['code']===0x1f4){logger[_0xc1dd('0x15')](_0xc1dd('0x10'),_0x38b62e,_0x1d28a7[_0xc1dd('0x15')][_0xc1dd('0x16')]);return _0xccdb4e(_0x1d28a7[_0xc1dd('0x15')]['message']);}logger[_0xc1dd('0x15')](_0xc1dd('0x10'),_0x38b62e,_0x1d28a7[_0xc1dd('0x15')][_0xc1dd('0x16')]);return _0xa720ed(_0x1d28a7['error']['message']);}else{logger[_0xc1dd('0xf')]('MailAccount,\x20%s,\x20%s',_0x38b62e,_0xc1dd('0x11'));_0xa720ed(_0x1d28a7['result'][_0xc1dd('0x16')]);}})[_0xc1dd('0x17')](function(_0x288abd){logger[_0xc1dd('0x15')](_0xc1dd('0x10'),_0x38b62e,_0x288abd);_0xccdb4e(_0x288abd);});});}exports[_0xc1dd('0x18')]=function(_0x568a6b){var _0x459da6=this;return new Promise(function(_0x1ab21b,_0x5e99a6){return db[_0xc1dd('0x19')][_0xc1dd('0x1a')]({'raw':_0x568a6b[_0xc1dd('0x1b')]?_0x568a6b[_0xc1dd('0x1b')][_0xc1dd('0x1c')]===undefined?!![]:![]:!![],'where':_0x568a6b[_0xc1dd('0x1b')]?_0x568a6b[_0xc1dd('0x1b')][_0xc1dd('0x1d')]||null:null,'attributes':_0x568a6b['options']?_0x568a6b[_0xc1dd('0x1b')][_0xc1dd('0x1e')]||null:null,'limit':_0x568a6b[_0xc1dd('0x1b')]?_0x568a6b[_0xc1dd('0x1b')]['limit']||null:null,'include':_0x568a6b[_0xc1dd('0x1b')]?_0x568a6b[_0xc1dd('0x1b')][_0xc1dd('0x1f')]?_[_0xc1dd('0x20')](_0x568a6b[_0xc1dd('0x1b')][_0xc1dd('0x1f')],function(_0x3c3a32){return{'model':db[_0x3c3a32[_0xc1dd('0x21')]],'as':_0x3c3a32['as'],'attributes':_0x3c3a32[_0xc1dd('0x1e')],'include':_0x3c3a32[_0xc1dd('0x1f')]?_[_0xc1dd('0x20')](_0x3c3a32[_0xc1dd('0x1f')],function(_0x1d3b04){return{'model':db[_0x1d3b04[_0xc1dd('0x21')]],'as':_0x1d3b04['as'],'attributes':_0x1d3b04['attributes'],'include':_0x1d3b04['include']?_[_0xc1dd('0x20')](_0x1d3b04[_0xc1dd('0x1f')],function(_0x25a651){return{'model':db[_0x25a651[_0xc1dd('0x21')]],'as':_0x25a651['as'],'attributes':_0x25a651[_0xc1dd('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc1dd('0xe')](function(_0x16ee31){logger['info'](_0xc1dd('0x18'),_0x568a6b);logger[_0xc1dd('0x12')](_0xc1dd('0x18'),_0x568a6b,JSON[_0xc1dd('0x14')](_0x16ee31));_0x1ab21b(_0x16ee31);})['catch'](function(_0x14b1d4){logger[_0xc1dd('0x15')](_0xc1dd('0x18'),_0x14b1d4['message'],_0x568a6b);_0x5e99a6(_0x459da6[_0xc1dd('0x15')](0x1f4,_0x14b1d4['message']));});});};exports[_0xc1dd('0x22')]=function(_0x2b7eb0){var _0x3fe749=this;return new Promise(function(_0x5a60dd,_0x7541a2){return db[_0xc1dd('0x19')][_0xc1dd('0x23')]({'raw':_0x2b7eb0[_0xc1dd('0x1b')]?_0x2b7eb0['options'][_0xc1dd('0x1c')]===undefined?!![]:![]:!![],'where':_0x2b7eb0[_0xc1dd('0x1b')]?_0x2b7eb0[_0xc1dd('0x1b')]['where']||null:null,'attributes':_0x2b7eb0['options']?_0x2b7eb0[_0xc1dd('0x1b')][_0xc1dd('0x1e')]||null:null,'include':_0x2b7eb0[_0xc1dd('0x1b')]?_0x2b7eb0[_0xc1dd('0x1b')][_0xc1dd('0x1f')]?_['map'](_0x2b7eb0[_0xc1dd('0x1b')][_0xc1dd('0x1f')],function(_0x544b71){return{'model':db[_0x544b71[_0xc1dd('0x21')]],'as':_0x544b71['as'],'attributes':_0x544b71[_0xc1dd('0x1e')],'include':_0x544b71[_0xc1dd('0x1f')]?_['map'](_0x544b71[_0xc1dd('0x1f')],function(_0x537f1b){return{'model':db[_0x537f1b[_0xc1dd('0x21')]],'as':_0x537f1b['as'],'attributes':_0x537f1b[_0xc1dd('0x1e')],'include':_0x537f1b['include']?_[_0xc1dd('0x20')](_0x537f1b[_0xc1dd('0x1f')],function(_0x28723c){return{'model':db[_0x28723c[_0xc1dd('0x21')]],'as':_0x28723c['as'],'attributes':_0x28723c[_0xc1dd('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc1dd('0xe')](function(_0x257b69){logger[_0xc1dd('0xf')](_0xc1dd('0x22'),_0x2b7eb0);logger[_0xc1dd('0x12')](_0xc1dd('0x22'),_0x2b7eb0,JSON[_0xc1dd('0x14')](_0x257b69));_0x5a60dd(_0x257b69);})['catch'](function(_0x3f7a0f){logger['error'](_0xc1dd('0x22'),_0x3f7a0f[_0xc1dd('0x16')],_0x2b7eb0);_0x7541a2(_0x3fe749[_0xc1dd('0x15')](0x1f4,_0x3f7a0f[_0xc1dd('0x16')]));});});};exports[_0xc1dd('0x24')]=function(_0x45919b){var _0x17743b=this;return new Promise(function(_0x583688,_0x12c56d){var _0x5b5d76={'body':_0x45919b[_0xc1dd('0x25')],'channel':_0xc1dd('0x26')};var _0x6b416d=_[_0xc1dd('0x27')](_[_0xc1dd('0x28')](db[_0xc1dd('0x29')][_0xc1dd('0x2a')]),['createdAt',_0xc1dd('0x2b'),_0xc1dd('0x2c'),_0xc1dd('0x2d')]);var _0x5207f2=![];if(_0x45919b[_0xc1dd('0x25')]['id']){delete _0x45919b[_0xc1dd('0x25')]['id'];}if(_[_0xc1dd('0x2e')](_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x2f')])){return _0x12c56d(_0x17743b[_0xc1dd('0x15')](0x1f4,_0xc1dd('0x30')));}if(_[_0xc1dd('0x2e')](_0x45919b[_0xc1dd('0x25')]['body'])||_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x25')]===''){return _0x12c56d(_0x17743b[_0xc1dd('0x15')](0x1f4,_0xc1dd('0x31')));}if(_[_0xc1dd('0x2e')](_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x32')])){return _0x12c56d(_0x17743b[_0xc1dd('0x15')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x6b416d));}if(!_['includes'](_0x6b416d,_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x32')])){return _0x12c56d(_0x17743b[_0xc1dd('0x15')](0x1f4,_0xc1dd('0x33')+_0x6b416d));}var _0x1c95f3={};_0x1c95f3[_0x45919b[_0xc1dd('0x25')]['mapKey']]=_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x2f')];return db[_0xc1dd('0x19')][_0xc1dd('0x23')]({'where':{'id':_0x45919b[_0xc1dd('0x34')]['id']},'include':[{'model':db['CmList'],'as':_0xc1dd('0x35'),'include':[{'model':db[_0xc1dd('0x29')],'as':'Contacts','where':_0x1c95f3,'limit':0x1,'order':[[_0xc1dd('0x2b'),_0xc1dd('0x36')]]}]},{'model':db[_0xc1dd('0x37')],'as':'Applications'},{'model':db[_0xc1dd('0x38')],'as':_0xc1dd('0x39')}]})['then'](function(_0x32c086){if(_0x32c086&&_0x32c086[_0xc1dd('0x35')]){var _0x4188ae=_0x32c086[_0xc1dd('0x3a')]({'plain':!![]});_0x5b5d76['account']=_['omit'](_0x4188ae,[_0xc1dd('0x3b'),'List']);_0x5b5d76['applications']=_0x4188ae['Applications'];_0x5b5d76[_0xc1dd('0x3c')]=_0x4188ae[_0xc1dd('0x35')];_0x5b5d76[_0xc1dd('0x3d')]=_['orderBy'](_0x5b5d76[_0xc1dd('0x3d')],[_0xc1dd('0x3e')],[_0xc1dd('0x3f')]);if(_0x5b5d76[_0xc1dd('0x34')]&&_0x5b5d76[_0xc1dd('0x34')][_0xc1dd('0x40')]){_0x5b5d76[_0xc1dd('0x3d')][_0xc1dd('0x41')]({'id':0x0,'priority':_0x5b5d76[_0xc1dd('0x3d')][_0xc1dd('0x42')]+0x1,'app':_0xc1dd('0x43'),'appdata':'autoclose','interval':_0xc1dd('0x44')});}if(_0x5b5d76[_0xc1dd('0x34')]['Applications']){delete _0x5b5d76[_0xc1dd('0x34')][_0xc1dd('0x3b')];}if(_0x5b5d76[_0xc1dd('0x34')]['List']){delete _0x5b5d76[_0xc1dd('0x34')]['List'];}if(_0x4188ae[_0xc1dd('0x35')][_0xc1dd('0x45')][_0xc1dd('0x42')]){return _0x4188ae[_0xc1dd('0x35')][_0xc1dd('0x45')][0x0];}var _0x5980c8=_['defaults'](_0x45919b[_0xc1dd('0x25')],{'firstName':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x2f')],'ListId':_0x4188ae[_0xc1dd('0x2d')]});_0x5980c8[_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x32')]]=_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x2f')];return db[_0xc1dd('0x29')][_0xc1dd('0x46')](_0x5980c8);}else{throw new Error(_0xc1dd('0x47'));}})[_0xc1dd('0xe')](function(_0x1618c9){_0x5b5d76[_0xc1dd('0x48')]=_0x1618c9;if(_0x1618c9){if(!_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')][_0xc1dd('0x49')]){_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')][_0xc1dd('0x49')]=rs[_0xc1dd('0x4a')]()+'\x20'+_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')][_0xc1dd('0x2f')];}var _0x523e99={'ContactId':_0x1618c9['id'],'MailAccountId':_0x45919b[_0xc1dd('0x34')]['id'],'inReplyTo':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')][_0xc1dd('0x49')],'to':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')][_0xc1dd('0x2f')],'cc':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')]['cc'],'subject':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')][_0xc1dd('0x4b')],'attach':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')][_0xc1dd('0x4c')],'lastMsgAt':moment()[_0xc1dd('0x4d')](_0xc1dd('0x4e')),'lastMsgDirection':'in','lastMsgBody':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x25')]};return db[_0xc1dd('0x4f')][_0xc1dd('0x23')]({'where':{'closed':![],'MailAccountId':_0x45919b[_0xc1dd('0x34')]['id']},'include':[{'model':db[_0xc1dd('0x50')],'as':_0xc1dd('0x51'),'attributes':[_0xc1dd('0x49')],'where':{'messageId':_0x45919b['body'][_0xc1dd('0x16')][_0xc1dd('0x52')]}}]})[_0xc1dd('0xe')](function(_0x57891e){if(_0x57891e){return[_0x57891e,![]];}return db[_0xc1dd('0x4f')][_0xc1dd('0x46')](_0x523e99)[_0xc1dd('0xe')](function(_0x51ef0b){return[_0x51ef0b,!![]];});});}else{throw new Error(_0xc1dd('0x53'));}})[_0xc1dd('0x54')](function(_0x71e293,_0x2f306d){if(_0x71e293){_0x5207f2=_0x2f306d;if(!_0x2f306d){return _0x71e293[_0xc1dd('0x55')]({'inReplyTo':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')][_0xc1dd('0x49')],'to':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')]['from'],'cc':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')]['cc'],'subject':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')][_0xc1dd('0x4b')],'attach':_0x71e293[_0xc1dd('0x4c')]?_0x71e293[_0xc1dd('0x4c')]:_0x45919b['body'][_0xc1dd('0x16')][_0xc1dd('0x4c')],'substatus':null,'substatusAt':moment()[_0xc1dd('0x4d')](_0xc1dd('0x4e')),'lastMsgAt':moment()[_0xc1dd('0x4d')](_0xc1dd('0x4e')),'lastMsgDirection':'in','lastMsgBody':_0x45919b['body'][_0xc1dd('0x25')]});}else{return _0x71e293;}}})[_0xc1dd('0xe')](function(_0x36f969){_0x5b5d76['interaction']=_0x36f969[_0xc1dd('0x3a')]({'plain':!![]});_0x5b5d76['interaction']['created']=_0x5207f2;return db['MailMessage'][_0xc1dd('0x46')]({'body':_0x45919b['body'][_0xc1dd('0x25')],'MailAccountId':_0x45919b[_0xc1dd('0x34')]['id'],'MailInteractionId':_0x36f969['id'],'direction':'in','ContactId':_0x5b5d76[_0xc1dd('0x48')]['id'],'messageId':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')][_0xc1dd('0x49')],'from':_0x45919b[_0xc1dd('0x25')]['message'][_0xc1dd('0x2f')],'to':_0x45919b[_0xc1dd('0x25')]['message']['to'],'cc':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')]['cc'],'subject':_0x45919b[_0xc1dd('0x25')]['message']['subject'],'attach':_0x45919b[_0xc1dd('0x25')]['message'][_0xc1dd('0x4c')],'Attachments':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')]['attachments'],'originTo':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')][_0xc1dd('0x56')],'originCc':_0x45919b[_0xc1dd('0x25')]['message']['originCc'],'bcc':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')]['bcc']},{'include':[{'model':db[_0xc1dd('0x57')],'as':_0xc1dd('0x58')}]});})[_0xc1dd('0xe')](function(_0x181311){_0x5b5d76['message']=_0x181311;if(_0x5b5d76['interaction'][_0xc1dd('0x59')]){return db[_0xc1dd('0x5a')][_0xc1dd('0x23')]({'attributes':['id','name'],'where':{'id':_0x5b5d76[_0xc1dd('0x5b')]['UserId']}})[_0xc1dd('0xe')](function(_0x3cea20){if(_0x3cea20){_0x5b5d76['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xc1dd('0x5c'),'appdata':_0x3cea20[_0xc1dd('0x5d')]+','+(_0x5b5d76[_0xc1dd('0x34')][_0xc1dd('0x5e')]||0xa),'interval':_0xc1dd('0x44')});}return respondWithRpcPromise(_0xc1dd('0x5f'),_0xc1dd('0x60'),_0x5b5d76);});}return respondWithRpcPromise('Start',_0xc1dd('0x60'),_0x5b5d76);})[_0xc1dd('0xe')](function(_0x4ffb8c){_0x583688(_0x4ffb8c);})[_0xc1dd('0x17')](function(_0x558bd9){_0x12c56d(_0x17743b[_0xc1dd('0x15')](0x1f4,_0x558bd9[_0xc1dd('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index e8b0973..de5a4d5 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 _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 +var _0x46e1=['remove','update','emit','register','length','./mailAccount.events','save'];(function(_0x53fa83,_0x5a08a9){var _0x12f39e=function(_0x1b37a7){while(--_0x1b37a7){_0x53fa83['push'](_0x53fa83['shift']());}};_0x12f39e(++_0x5a08a9);}(_0x46e1,0x155));var _0x146e=function(_0x5f7dcb,_0x1dec53){_0x5f7dcb=_0x5f7dcb-0x0;var _0x10e913=_0x46e1[_0x5f7dcb];return _0x10e913;};'use strict';var MailAccountEvents=require(_0x146e('0x0'));var events=[_0x146e('0x1'),_0x146e('0x2'),_0x146e('0x3')];function createListener(_0x155784,_0x1ff284){return function(_0x3708b1){_0x1ff284[_0x146e('0x4')](_0x155784,_0x3708b1);};}function removeListener(_0x18dab9,_0x3bbaec){return function(){MailAccountEvents['removeListener'](_0x18dab9,_0x3bbaec);};}exports[_0x146e('0x5')]=function(_0x1f1f15){for(var _0x3de564=0x0,_0x228fe7=events[_0x146e('0x6')];_0x3de564<_0x228fe7;_0x3de564++){var _0x35e40e=events[_0x3de564];var _0x1c1398=createListener('mailAccount:'+_0x35e40e,_0x1f1f15);MailAccountEvents['on'](_0x35e40e,_0x1c1398);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 648afc7..2c9dd59 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 _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 +var _0xd404=['update','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put'];(function(_0x4dbb73,_0x318daf){var _0x16c20b=function(_0x45706f){while(--_0x45706f){_0x4dbb73['push'](_0x4dbb73['shift']());}};_0x16c20b(++_0x318daf);}(_0xd404,0x15b));var _0x4d40=function(_0x447939,_0x5e65df){_0x447939=_0x447939-0x0;var _0x25a124=_0xd404[_0x447939];return _0x25a124;};'use strict';var multer=require(_0x4d40('0x0'));var util=require(_0x4d40('0x1'));var path=require('path');var timeout=require(_0x4d40('0x2'));var express=require(_0x4d40('0x3'));var router=express['Router']();var auth=require(_0x4d40('0x4'));var interaction=require(_0x4d40('0x5'));var config=require(_0x4d40('0x6'));var controller=require(_0x4d40('0x7'));router[_0x4d40('0x8')](_0x4d40('0x9'),auth[_0x4d40('0xa')](),controller[_0x4d40('0xb')]);router[_0x4d40('0xc')]('/:id',auth[_0x4d40('0xa')](),controller[_0x4d40('0xd')]);router['delete'](_0x4d40('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x4d40('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index e9a3881..6e0b5fc 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 _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 +var _0x8f28=['exports','INTEGER','STRING','sequelize'];(function(_0x4cd258,_0x117909){var _0x18a20f=function(_0x218f8f){while(--_0x218f8f){_0x4cd258['push'](_0x4cd258['shift']());}};_0x18a20f(++_0x117909);}(_0x8f28,0xcb));var _0x88f2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8f28[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x88f2('0x0'));module[_0x88f2('0x1')]={'priority':{'type':Sequelize[_0x88f2('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x88f2('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x88f2('0x3')]},'interval':{'type':Sequelize[_0x88f2('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 79e0998..23b2d40 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 _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 +var _0xace5=['find','params','eml-format','rimraf','moment','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','stack','name','send','show','model','keys','query','filters','intersection','attributes','fields','includeAll','merge','catch','body','MailApplication'];(function(_0x2b9e8a,_0x7b21d4){var _0x520e67=function(_0x22bce8){while(--_0x22bce8){_0x2b9e8a['push'](_0x2b9e8a['shift']());}};_0x520e67(++_0x7b21d4);}(_0xace5,0x1df));var _0x5ace=function(_0x1bbbdf,_0x235087){_0x1bbbdf=_0x1bbbdf-0x0;var _0x3edb6e=_0xace5[_0x1bbbdf];return _0x3edb6e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5ace('0x0'));var rimraf=require(_0x5ace('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5ace('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5ace('0x3'));var util=require('util');var path=require(_0x5ace('0x4'));var sox=require(_0x5ace('0x5'));var csv=require(_0x5ace('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5ace('0x7'));var squel=require(_0x5ace('0x8'));var crypto=require(_0x5ace('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x5ace('0xa'));var toCsv=require(_0x5ace('0x6'));var querystring=require(_0x5ace('0xb'));var Papa=require(_0x5ace('0xc'));var Redis=require(_0x5ace('0xd'));var authService=require(_0x5ace('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x5ace('0xf'));var hardwareService=require(_0x5ace('0x10'));var logger=require(_0x5ace('0x11'))(_0x5ace('0x12'));var utils=require(_0x5ace('0x13'));var config=require(_0x5ace('0x14'));var db=require(_0x5ace('0x15'))['db'];function respondWithStatusCode(_0xac1d27,_0x54cf58){_0x54cf58=_0x54cf58||0xcc;return function(_0x5a0789){if(_0x5a0789){return _0xac1d27[_0x5ace('0x16')](_0x54cf58);}return _0xac1d27[_0x5ace('0x17')](_0x54cf58)[_0x5ace('0x18')]();};}function respondWithResult(_0x5cd628,_0x238068){_0x238068=_0x238068||0xc8;return function(_0x2a4322){if(_0x2a4322){return _0x5cd628[_0x5ace('0x17')](_0x238068)[_0x5ace('0x19')](_0x2a4322);}};}function respondWithFilteredResult(_0x3baf06,_0x1d624a){return function(_0x330ebc){if(_0x330ebc){var _0x5c9761=_0x330ebc[_0x5ace('0x1a')],_0x7adcf3=_0x1d624a[_0x5ace('0x1b')],_0x224ed7=_0x1d624a[_0x5ace('0x1b')]+_0x1d624a['limit'],_0x3200f5;if(_0x224ed7>=_0x5c9761){_0x224ed7=_0x5c9761;_0x3200f5=0xc8;}else{_0x3200f5=0xce;}_0x3baf06[_0x5ace('0x17')](_0x3200f5);return _0x3baf06[_0x5ace('0x1c')](_0x5ace('0x1d'),_0x7adcf3+'-'+_0x224ed7+'/'+_0x5c9761)[_0x5ace('0x19')](_0x330ebc);}return null;};}function patchUpdates(_0x30a017){return function(_0x3137ba){try{jsonpatch[_0x5ace('0x1e')](_0x3137ba,_0x30a017,!![]);}catch(_0x2a3e84){return BPromise['reject'](_0x2a3e84);}return _0x3137ba[_0x5ace('0x1f')]();};}function saveUpdates(_0x57ff89,_0x452846){return function(_0x548c51){if(_0x548c51){return _0x548c51[_0x5ace('0x20')](_0x57ff89)[_0x5ace('0x21')](function(_0x38bec8){return _0x38bec8;});}return null;};}function removeEntity(_0x258fb3,_0x66740e){return function(_0x351796){if(_0x351796){return _0x351796[_0x5ace('0x22')]()[_0x5ace('0x21')](function(){_0x258fb3[_0x5ace('0x17')](0xcc)[_0x5ace('0x18')]();});}};}function handleEntityNotFound(_0x2cf881,_0x1db9dd){return function(_0x11ee77){if(!_0x11ee77){_0x2cf881[_0x5ace('0x16')](0x194);}return _0x11ee77;};}function handleError(_0x41d9e5,_0x5d72b5){_0x5d72b5=_0x5d72b5||0x1f4;return function(_0x42a0bd){logger['error'](_0x42a0bd[_0x5ace('0x23')]);if(_0x42a0bd['name']){delete _0x42a0bd[_0x5ace('0x24')];}_0x41d9e5[_0x5ace('0x17')](_0x5d72b5)[_0x5ace('0x25')](_0x42a0bd);};}exports[_0x5ace('0x26')]=function(_0x19fad9,_0x271cee){var _0x319d2d={'raw':!![],'where':{'id':_0x19fad9['params']['id']}},_0x22eecf={};_0x22eecf[_0x5ace('0x27')]=_[_0x5ace('0x28')](db['MailApplication']['rawAttributes']);_0x22eecf[_0x5ace('0x29')]=_[_0x5ace('0x28')](_0x19fad9[_0x5ace('0x29')]);_0x22eecf[_0x5ace('0x2a')]=_[_0x5ace('0x2b')](_0x22eecf[_0x5ace('0x27')],_0x22eecf[_0x5ace('0x29')]);_0x319d2d[_0x5ace('0x2c')]=_[_0x5ace('0x2b')](_0x22eecf[_0x5ace('0x27')],qs[_0x5ace('0x2d')](_0x19fad9[_0x5ace('0x29')]['fields']));_0x319d2d[_0x5ace('0x2c')]=_0x319d2d[_0x5ace('0x2c')]['length']?_0x319d2d[_0x5ace('0x2c')]:_0x22eecf['model'];if(_0x19fad9[_0x5ace('0x29')][_0x5ace('0x2e')]){_0x319d2d['include']=[{'all':!![]}];}_0x319d2d=_[_0x5ace('0x2f')]({},_0x319d2d,_0x19fad9['options']);return db['MailApplication']['find'](_0x319d2d)[_0x5ace('0x21')](handleEntityNotFound(_0x271cee,null))[_0x5ace('0x21')](respondWithResult(_0x271cee,null))[_0x5ace('0x30')](handleError(_0x271cee,null));};exports[_0x5ace('0x20')]=function(_0xf7a517,_0x9e904a){if(_0xf7a517['body']['id']){delete _0xf7a517[_0x5ace('0x31')]['id'];}return db[_0x5ace('0x32')][_0x5ace('0x33')]({'where':{'id':_0xf7a517[_0x5ace('0x34')]['id']}})[_0x5ace('0x21')](handleEntityNotFound(_0x9e904a,null))[_0x5ace('0x21')](saveUpdates(_0xf7a517[_0x5ace('0x31')],null))['then'](respondWithResult(_0x9e904a,null))[_0x5ace('0x30')](handleError(_0x9e904a,null));};exports[_0x5ace('0x22')]=function(_0x205496,_0x41aef8){return db[_0x5ace('0x32')]['find']({'where':{'id':_0x205496['params']['id']}})[_0x5ace('0x21')](handleEntityNotFound(_0x41aef8,null))[_0x5ace('0x21')](removeEntity(_0x41aef8,null))[_0x5ace('0x30')](handleError(_0x41aef8,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index ddc14e3..bf91934 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 _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 +var _0x896e=['path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xef4402,_0x317685){var _0x1516cb=function(_0x2a8fb8){while(--_0x2a8fb8){_0xef4402['push'](_0xef4402['shift']());}};_0x1516cb(++_0x317685);}(_0x896e,0x1e9));var _0xe896=function(_0x14e1d8,_0x1e90a5){_0x14e1d8=_0x14e1d8-0x0;var _0x44f3dc=_0x896e[_0x14e1d8];return _0x44f3dc;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var logger=require(_0xe896('0x2'))(_0xe896('0x3'));var moment=require(_0xe896('0x4'));var BPromise=require(_0xe896('0x5'));var rp=require(_0xe896('0x6'));var fs=require('fs');var path=require(_0xe896('0x7'));var rimraf=require(_0xe896('0x8'));var config=require(_0xe896('0x9'));var attributes=require(_0xe896('0xa'));module[_0xe896('0xb')]=function(_0x52ac80,_0x24c430){return _0x52ac80[_0xe896('0xc')](_0xe896('0xd'),attributes,{'tableName':_0xe896('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe896('0xf'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 5be4b36..2eddade 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 _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 +var _0x9905=['attributes','limit','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','UpdateMailApplication','MailApplication','update','body','options','raw','where'];(function(_0x22d445,_0x4f1d45){var _0x457153=function(_0x2d12e3){while(--_0x2d12e3){_0x22d445['push'](_0x22d445['shift']());}};_0x457153(++_0x4f1d45);}(_0x9905,0x1f3));var _0x5990=function(_0x3bd405,_0x2da8a2){_0x3bd405=_0x3bd405-0x0;var _0x3ad0b3=_0x9905[_0x3bd405];return _0x3ad0b3;};'use strict';var _=require(_0x5990('0x0'));var util=require(_0x5990('0x1'));var moment=require(_0x5990('0x2'));var BPromise=require('bluebird');var rs=require(_0x5990('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5990('0x4'))['db'];var utils=require(_0x5990('0x5'));var logger=require(_0x5990('0x6'))(_0x5990('0x7'));var config=require(_0x5990('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5990('0x9')][_0x5990('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xce07b7,_0x10aec9,_0x12c6cc){return new BPromise(function(_0x703038,_0x100d4a){return client['request'](_0xce07b7,_0x12c6cc)[_0x5990('0xb')](function(_0x123cb7){logger['info'](_0x5990('0xc'),_0x10aec9,_0x5990('0xd'));logger[_0x5990('0xe')](_0x5990('0xf'),_0x10aec9,'request\x20sent',JSON[_0x5990('0x10')](_0x123cb7));if(_0x123cb7[_0x5990('0x11')]){if(_0x123cb7[_0x5990('0x11')][_0x5990('0x12')]===0x1f4){logger['error'](_0x5990('0xc'),_0x10aec9,_0x123cb7[_0x5990('0x11')][_0x5990('0x13')]);return _0x100d4a(_0x123cb7[_0x5990('0x11')][_0x5990('0x13')]);}logger['error'](_0x5990('0xc'),_0x10aec9,_0x123cb7[_0x5990('0x11')][_0x5990('0x13')]);return _0x703038(_0x123cb7[_0x5990('0x11')][_0x5990('0x13')]);}else{logger[_0x5990('0x14')]('MailApplication,\x20%s,\x20%s',_0x10aec9,_0x5990('0xd'));_0x703038(_0x123cb7['result']['message']);}})['catch'](function(_0x1ac72d){logger[_0x5990('0x11')](_0x5990('0xc'),_0x10aec9,_0x1ac72d);_0x100d4a(_0x1ac72d);});});}exports[_0x5990('0x15')]=function(_0x324d2c){var _0x2ef859=this;return new Promise(function(_0x24d0c3,_0x51a092){return db[_0x5990('0x16')][_0x5990('0x17')](_0x324d2c[_0x5990('0x18')],{'raw':_0x324d2c[_0x5990('0x19')]?_0x324d2c[_0x5990('0x19')][_0x5990('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x324d2c[_0x5990('0x19')]?_0x324d2c[_0x5990('0x19')][_0x5990('0x1b')]||null:null,'attributes':_0x324d2c[_0x5990('0x19')]?_0x324d2c[_0x5990('0x19')][_0x5990('0x1c')]||null:null,'limit':_0x324d2c['options']?_0x324d2c['options'][_0x5990('0x1d')]||null:null})[_0x5990('0xb')](function(_0x5b1284){logger['info'](_0x5990('0x15'),_0x324d2c);logger[_0x5990('0xe')](_0x5990('0x15'),_0x324d2c,JSON[_0x5990('0x10')](_0x5b1284));_0x24d0c3(_0x5b1284);})[_0x5990('0x1e')](function(_0x1ef072){logger['error'](_0x5990('0x15'),_0x1ef072[_0x5990('0x13')],_0x324d2c);_0x51a092(_0x2ef859['error'](0x1f4,_0x1ef072[_0x5990('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 2be296d..f94264d 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 _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 +var _0x7e5b=['delete','mailinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','mailinteraction:addtags','addTags','put','/:id','mail','mailinteraction:update','update'];(function(_0x381f21,_0x5dea54){var _0x45f14b=function(_0x5b220a){while(--_0x5b220a){_0x381f21['push'](_0x381f21['shift']());}};_0x45f14b(++_0x5dea54);}(_0x7e5b,0x1bf));var _0xb7e5=function(_0x3550e0,_0xb5bade){_0x3550e0=_0x3550e0-0x0;var _0x1b9a7a=_0x7e5b[_0x3550e0];return _0x1b9a7a;};'use strict';var multer=require(_0xb7e5('0x0'));var util=require('util');var path=require(_0xb7e5('0x1'));var timeout=require(_0xb7e5('0x2'));var express=require(_0xb7e5('0x3'));var router=express[_0xb7e5('0x4')]();var auth=require(_0xb7e5('0x5'));var interaction=require(_0xb7e5('0x6'));var config=require('../../config/environment');var controller=require(_0xb7e5('0x7'));router[_0xb7e5('0x8')]('/',auth[_0xb7e5('0x9')](),controller[_0xb7e5('0xa')]);router[_0xb7e5('0x8')](_0xb7e5('0xb'),auth[_0xb7e5('0x9')](),controller[_0xb7e5('0xc')]);router[_0xb7e5('0x8')]('/:id',auth[_0xb7e5('0x9')](),controller[_0xb7e5('0xd')]);router[_0xb7e5('0x8')](_0xb7e5('0xe'),auth[_0xb7e5('0x9')](),controller[_0xb7e5('0xf')]);router[_0xb7e5('0x8')](_0xb7e5('0x10'),auth[_0xb7e5('0x9')](),controller[_0xb7e5('0x11')]);router[_0xb7e5('0x12')]('/',auth[_0xb7e5('0x9')](),controller['create']);router[_0xb7e5('0x12')](_0xb7e5('0xe'),auth[_0xb7e5('0x9')](),controller[_0xb7e5('0x13')]);router[_0xb7e5('0x12')](_0xb7e5('0x14'),auth['isAuthenticated'](),interaction[_0xb7e5('0x15')]('mail',_0xb7e5('0x16')),controller[_0xb7e5('0x17')]);router[_0xb7e5('0x18')](_0xb7e5('0x19'),auth['isAuthenticated'](),interaction[_0xb7e5('0x15')](_0xb7e5('0x1a'),_0xb7e5('0x1b')),controller[_0xb7e5('0x1c')]);router[_0xb7e5('0x1d')](_0xb7e5('0x19'),auth[_0xb7e5('0x9')](),interaction[_0xb7e5('0x15')]('mail',_0xb7e5('0x1e')),controller[_0xb7e5('0x1f')]);router['delete'](_0xb7e5('0x14'),auth[_0xb7e5('0x9')](),controller[_0xb7e5('0x20')]);module[_0xb7e5('0x21')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 21541c7..56be92a 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 _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 +var _0x6080=['TEXT','long','BOOLEAN','out','sequelize','iconv','DATE','STRING'];(function(_0x35f7f5,_0x4e2ee1){var _0x5567a4=function(_0x3e5df0){while(--_0x3e5df0){_0x35f7f5['push'](_0x35f7f5['shift']());}};_0x5567a4(++_0x4e2ee1);}(_0x6080,0xb4));var _0x0608=function(_0x47453a,_0xa7caaa){_0x47453a=_0x47453a-0x0;var _0x285944=_0x6080[_0x47453a];return _0x285944;};'use strict';var Sequelize=require(_0x0608('0x0'));var iconv=require(_0x0608('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0608('0x2')]},'disposition':{'type':Sequelize[_0x0608('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x0608('0x3')](0x1fe)},'to':{'type':Sequelize[_0x0608('0x3')]},'cc':{'type':Sequelize[_0x0608('0x4')](_0x0608('0x5'))},'subject':{'type':Sequelize[_0x0608('0x4')]()},'attach':{'type':Sequelize[_0x0608('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x0608('0x2')]},'substatus':{'type':Sequelize[_0x0608('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0608('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x0608('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x0608('0x4')](_0x0608('0x5'))},'lastMsgText':{'type':Sequelize['TEXT'](_0x0608('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index feb0ab2..373783e 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(_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 +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(_0x517b93,_0x52a90b){var _0x419579=function(_0x35c5eb){while(--_0x35c5eb){_0x517b93['push'](_0x517b93['shift']());}};_0x419579(++_0x52a90b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var 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 a15ef78..f4e0223 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 _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 +var _0x8728=['then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','MailInteraction','../../mysqldb','setMaxListeners','save','update','getUsers'];(function(_0x45be3b,_0x1fea36){var _0x23af3a=function(_0x48c1f4){while(--_0x48c1f4){_0x45be3b['push'](_0x45be3b['shift']());}};_0x23af3a(++_0x1fea36);}(_0x8728,0x77));var _0x8872=function(_0x271607,_0x1cdaf2){_0x271607=_0x271607-0x0;var _0x2e87c1=_0x8728[_0x271607];return _0x2e87c1;};'use strict';var EventEmitter=require(_0x8872('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x8872('0x1')];var MailMessage=require(_0x8872('0x2'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x8872('0x3')](0x0);var events={'afterCreate':_0x8872('0x4'),'afterUpdate':_0x8872('0x5'),'afterDestroy':'remove'};function emitEvent(_0x15ad55){return function(_0x13239a,_0x5106ed,_0x5b5222){_0x13239a[_0x8872('0x6')]({'attributes':['id'],'raw':!![]})[_0x8872('0x7')](function(_0x52dcf0){_0x13239a[_0x8872('0x8')]('Users',_0x52dcf0[_0x8872('0x9')](function(_0x366725){return{'id':_0x366725['id']};}));return MailMessage[_0x8872('0xa')]({'where':{'MailInteractionId':_0x13239a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x43663e){_0x13239a[_0x8872('0x8')](_0x8872('0xb'),_0x43663e[_0x8872('0xc')]);MailInteractionEvents[_0x8872('0xd')](_0x15ad55+':'+_0x13239a['id'],_0x13239a);MailInteractionEvents['emit'](_0x15ad55,_0x13239a);_0x5b5222(null);})[_0x8872('0xe')](_0x5b5222(null));};}for(var e in events){if(events[_0x8872('0xf')](e)){var event=events[e];MailInteraction[_0x8872('0x10')](e,emitEvent(event));}}module[_0x8872('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index e75cc61..a78b80e 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 _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 +var _0xefd7=['moment','request-promise','path','rimraf','../../config/environment','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','substatus','changed','get','MailMessage','catch','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x48ca57,_0x47e175){var _0x5826cf=function(_0x42f28f){while(--_0x42f28f){_0x48ca57['push'](_0x48ca57['shift']());}};_0x5826cf(++_0x47e175);}(_0xefd7,0x99));var _0x7efd=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xefd7[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7efd('0x0'));var util=require('util');var logger=require(_0x7efd('0x1'))(_0x7efd('0x2'));var moment=require(_0x7efd('0x3'));var BPromise=require('bluebird');var rp=require(_0x7efd('0x4'));var fs=require('fs');var path=require(_0x7efd('0x5'));var rimraf=require(_0x7efd('0x6'));var config=require(_0x7efd('0x7'));var attributes=require('./mailInteraction.attributes');module[_0x7efd('0x8')]=function(_0x308794,_0x3be366){return _0x308794[_0x7efd('0x9')](_0x7efd('0xa'),attributes,{'tableName':_0x7efd('0xb'),'paranoid':![],'indexes':[{'name':_0x7efd('0xc'),'fields':[_0x7efd('0xd'),'to'],'type':_0x7efd('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x49bb0a,_0x43b9f0,_0x297368){if(_0x49bb0a['substatus']){_0x49bb0a[_0x7efd('0xf')]=moment()[_0x7efd('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x49bb0a[_0x7efd('0x11')]){_0x49bb0a[_0x7efd('0x12')]=moment()['format'](_0x7efd('0x13'));}_0x297368(null,_0x43b9f0);},'beforeUpdate':function(_0x24732,_0x138544,_0x57269e){if(_0x24732['changed'](_0x7efd('0x14'))){_0x24732[_0x7efd('0xf')]=_0x24732[_0x7efd('0x14')]?moment()['format'](_0x7efd('0x13')):null;}if(_0x24732[_0x7efd('0x15')](_0x7efd('0x11'))){_0x24732['closedAt']=moment()[_0x7efd('0x10')](_0x7efd('0x13'));_0x24732['substatus']=null;_0x24732[_0x7efd('0xf')]=null;}_0x57269e(null,_0x24732);},'afterUpdate':function(_0x5affe3,_0x34d13f,_0x112555){var _0x1e6344=_0x308794['models'];var _0x2a91e1=_0x5affe3[_0x7efd('0x16')]({'plain':!![]});if(_0x2a91e1[_0x7efd('0x11')]){return _0x1e6344[_0x7efd('0x17')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x2a91e1['id']}})['then'](function(){_0x112555();})[_0x7efd('0x18')](function(_0x59ecda){_0x112555(_0x59ecda);});}else{_0x112555();}}},'charset':'utf8mb4','collate':_0x7efd('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 7607003..c124e37 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 _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 +var _0x1ddc=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','attributes','limit','find','addTags','omit','ids','AddTags','util'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x1ddc,0x6e));var _0xc1dd=function(_0x5ac969,_0x1221ad){_0x5ac969=_0x5ac969-0x0;var _0x29c618=_0x1ddc[_0x5ac969];return _0x29c618;};'use strict';var _=require('lodash');var util=require(_0xc1dd('0x0'));var moment=require(_0xc1dd('0x1'));var BPromise=require(_0xc1dd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc1dd('0x3'));var db=require(_0xc1dd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc1dd('0x5'))(_0xc1dd('0x6'));var config=require('../../config/environment');var jayson=require(_0xc1dd('0x7'));var client=jayson[_0xc1dd('0x8')]['http']({'port':0x232a});config[_0xc1dd('0x9')]=_[_0xc1dd('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc1dd('0xb'))(new Redis(config[_0xc1dd('0x9')]));require(_0xc1dd('0xc'))[_0xc1dd('0xd')](socket);function respondWithRpcPromise(_0x495e17,_0x38b62e,_0x1b4b3f){return new BPromise(function(_0xa720ed,_0xccdb4e){return client['request'](_0x495e17,_0x1b4b3f)[_0xc1dd('0xe')](function(_0x1d28a7){logger[_0xc1dd('0xf')](_0xc1dd('0x10'),_0x38b62e,_0xc1dd('0x11'));logger[_0xc1dd('0x12')](_0xc1dd('0x13'),_0x38b62e,_0xc1dd('0x11'),JSON[_0xc1dd('0x14')](_0x1d28a7));if(_0x1d28a7[_0xc1dd('0x15')]){if(_0x1d28a7[_0xc1dd('0x15')]['code']===0x1f4){logger[_0xc1dd('0x15')](_0xc1dd('0x10'),_0x38b62e,_0x1d28a7[_0xc1dd('0x15')][_0xc1dd('0x16')]);return _0xccdb4e(_0x1d28a7[_0xc1dd('0x15')]['message']);}logger[_0xc1dd('0x15')](_0xc1dd('0x10'),_0x38b62e,_0x1d28a7[_0xc1dd('0x15')][_0xc1dd('0x16')]);return _0xa720ed(_0x1d28a7['error']['message']);}else{logger[_0xc1dd('0xf')]('MailInteraction,\x20%s,\x20%s',_0x38b62e,_0xc1dd('0x11'));_0xa720ed(_0x1d28a7['result'][_0xc1dd('0x16')]);}})[_0xc1dd('0x17')](function(_0x288abd){logger[_0xc1dd('0x15')](_0xc1dd('0x10'),_0x38b62e,_0x288abd);_0xccdb4e(_0x288abd);});});}exports[_0xc1dd('0x18')]=function(_0x568a6b){var _0x459da6=this;return new Promise(function(_0x1ab21b,_0x5e99a6){return db[_0xc1dd('0x19')][_0xc1dd('0x1a')](_0x568a6b[_0xc1dd('0x1b')],{'raw':_0x568a6b[_0xc1dd('0x1c')]?_0x568a6b[_0xc1dd('0x1c')][_0xc1dd('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x568a6b[_0xc1dd('0x1c')]?_0x568a6b[_0xc1dd('0x1c')]['where']||null:null,'attributes':_0x568a6b[_0xc1dd('0x1c')]?_0x568a6b[_0xc1dd('0x1c')][_0xc1dd('0x1e')]||null:null,'limit':_0x568a6b[_0xc1dd('0x1c')]?_0x568a6b['options'][_0xc1dd('0x1f')]||null:null})[_0xc1dd('0xe')](function(_0x30b4b8){logger[_0xc1dd('0xf')](_0xc1dd('0x18'),_0x568a6b);logger[_0xc1dd('0x12')](_0xc1dd('0x18'),_0x568a6b,JSON[_0xc1dd('0x14')](_0x30b4b8));_0x1ab21b(_0x30b4b8);})[_0xc1dd('0x17')](function(_0x41d319){logger[_0xc1dd('0x15')](_0xc1dd('0x18'),_0x41d319[_0xc1dd('0x16')],_0x568a6b);_0x5e99a6(_0x459da6[_0xc1dd('0x15')](0x1f4,_0x41d319['message']));});});};exports['AddTagsToMailInteraction']=function(_0x388f35){return new Promise(function(_0x19d818,_0x25a651){return db[_0xc1dd('0x19')][_0xc1dd('0x20')]({'where':_0x388f35[_0xc1dd('0x1c')]?_0x388f35[_0xc1dd('0x1c')]['where']||null:null})[_0xc1dd('0xe')](function(_0x18077f){if(_0x18077f){return _0x18077f[_0xc1dd('0x21')](_0x388f35[_0xc1dd('0x1b')]['ids'],_[_0xc1dd('0x22')](_0x388f35[_0xc1dd('0x1b')],[_0xc1dd('0x23'),'id'])||{});}})['spread'](function(_0xa24253){logger['info'](_0xc1dd('0x24'),_0x388f35);logger[_0xc1dd('0x12')](_0xc1dd('0x24'),_0x388f35,JSON['stringify'](_0xa24253));_0x19d818(_0xa24253);})[_0xc1dd('0x17')](function(_0x3236ad){logger[_0xc1dd('0x15')](_0xc1dd('0x24'),_0x3236ad['message'],_0x388f35);_0x25a651(_this[_0xc1dd('0x15')](0x1f4,_0x3236ad[_0xc1dd('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index b7ea2da..26962cd 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 _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 +var _0x20e6=['remove','removeListener','register','length','mailInteraction:'];(function(_0x42f237,_0x3e872c){var _0x2ee60b=function(_0x26c37e){while(--_0x26c37e){_0x42f237['push'](_0x42f237['shift']());}};_0x2ee60b(++_0x3e872c);}(_0x20e6,0xc8));var _0x620e=function(_0x5356c5,_0x36ccda){_0x5356c5=_0x5356c5-0x0;var _0x1691f6=_0x20e6[_0x5356c5];return _0x1691f6;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save',_0x620e('0x0'),'update'];function createListener(_0x4e258d,_0x547db1){return function(_0x364832){_0x547db1['emit'](_0x4e258d,_0x364832);};}function removeListener(_0x468a05,_0x137f43){return function(){MailInteractionEvents[_0x620e('0x1')](_0x468a05,_0x137f43);};}exports[_0x620e('0x2')]=function(_0x1f1297){for(var _0x3bd0cb=0x0,_0xc16042=events[_0x620e('0x3')];_0x3bd0cb<_0xc16042;_0x3bd0cb++){var _0x52e341=events[_0x3bd0cb];var _0x1a23fc=createListener(_0x620e('0x4')+_0x52e341,_0x1f1297);MailInteractionEvents['on'](_0x52e341,_0x1a23fc);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index e316b6a..85aa8db 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 _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 +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(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x00bb,0x1d8));var _0xb00b=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x00bb[_0x55f8b4];return _0x2475f9;};'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 diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index f2a1ede..bcd94d1 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 _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 +var _0x5454=['long','DATE','INTEGER','TEXT','BOOLEAN','ENUM','out','STRING'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x5454,0x15b));var _0x4545=function(_0x425ee1,_0xe4fef9){_0x425ee1=_0x425ee1-0x0;var _0x196421=_0x5454[_0x425ee1];return _0x196421;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module['exports']={'body':{'type':Sequelize[_0x4545('0x0')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium')},'read':{'type':Sequelize[_0x4545('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4545('0x2')]('in',_0x4545('0x3')),'defaultValue':_0x4545('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x4545('0x4')]},'to':{'type':Sequelize[_0x4545('0x0')](_0x4545('0x5'))},'cc':{'type':Sequelize[_0x4545('0x0')](_0x4545('0x5'))},'bcc':{'type':Sequelize[_0x4545('0x0')](_0x4545('0x5'))},'subject':{'type':Sequelize[_0x4545('0x0')]},'sentAt':{'type':Sequelize[_0x4545('0x6')]},'attach':{'type':Sequelize[_0x4545('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x4545('0x1')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x4545('0x6')]},'originTo':{'type':Sequelize[_0x4545('0x0')]('long')},'originCc':{'type':Sequelize[_0x4545('0x0')](_0x4545('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index fa973d5..43329ee 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 _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 +var _0xcb81=['path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailMessage.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','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','offset','limit','set','Content-Range','reject','save','update','destroy','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','MailMessage','count','includeAll','include','findAll','rows','show','params','rawAttributes','find','body','describe','create','direction','out','secret','split','MailAccount','MailAccountId','CmList','List','CmContact','updatedAt','DESC','Smtp','isNil','host','port','secure','authentication','auth','pass','service','user','attachments','length','join','root','Contacts','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','read','readAt','UserId','Contact','get','MailInteraction','MailInteractionId','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','rejectmessage','download','unix','server','files','message-%s.eml','from','bcc','createdAt','Attachment','Attachments','subject','headers','Bcc','basename','push','build','writeFileSync','log','unlinkSync','html-pdf','eml-format','zip-dir','bluebird','mustache','util'];(function(_0x3d0e70,_0x2ba218){var _0x31cad6=function(_0x229df3){while(--_0x229df3){_0x3d0e70['push'](_0x3d0e70['shift']());}};_0x31cad6(++_0x2ba218);}(_0xcb81,0x154));var _0x1cb8=function(_0x1c6089,_0x3816e2){_0x1c6089=_0x1c6089-0x0;var _0x4d97c1=_0xcb81[_0x1c6089];return _0x4d97c1;};'use strict';var pdf=require(_0x1cb8('0x0'));var emlformat=require(_0x1cb8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1cb8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1cb8('0x3'));var Mustache=require(_0x1cb8('0x4'));var util=require(_0x1cb8('0x5'));var path=require(_0x1cb8('0x6'));var sox=require(_0x1cb8('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb8('0x8'));var fs=require('fs');var _=require(_0x1cb8('0x9'));var squel=require('squel');var crypto=require(_0x1cb8('0xa'));var jsforce=require(_0x1cb8('0xb'));var deskjs=require(_0x1cb8('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1cb8('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1cb8('0xe'));var qs=require(_0x1cb8('0xf'));var as=require(_0x1cb8('0x10'));var hardwareService=require(_0x1cb8('0x11'));var logger=require(_0x1cb8('0x12'))(_0x1cb8('0x13'));var utils=require(_0x1cb8('0x14'));var config=require(_0x1cb8('0x15'));var db=require('../../mysqldb')['db'];config[_0x1cb8('0x16')]=_[_0x1cb8('0x17')](config[_0x1cb8('0x16')],{'host':_0x1cb8('0x18'),'port':0x18eb});var socket=require(_0x1cb8('0x19'))(new Redis(config['redis']));require(_0x1cb8('0x1a'))[_0x1cb8('0x1b')](socket);var jayson=require(_0x1cb8('0x1c'));var client=jayson[_0x1cb8('0x1d')][_0x1cb8('0x1e')]({'port':0x232c});var client9003=jayson[_0x1cb8('0x1d')][_0x1cb8('0x1e')]({'port':0x232b});var client9002=jayson[_0x1cb8('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x17a95d,_0x4b4917,_0xf6b347){if(_0xf6b347){var _0x28b8ff=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x28b8ff[_0x1cb8('0x1f')](_0x4b4917)){return _0x17a95d;}else{throw new db[(_0x1cb8('0x20'))][(_0x1cb8('0x21'))](_0x1cb8('0x22'));}}else{return _0x17a95d;}}function respondWithRpcPromise(_0x3bfbcf,_0x9f0adb,_0x2631db,_0x1f9fd7){return new BPromise(function(_0x11d9f4,_0x3cda27){var _0x5c403c=_0x1f9fd7||client;return _0x5c403c[_0x1cb8('0x23')](_0x3bfbcf,_0x2631db)[_0x1cb8('0x24')](function(_0x170f34){logger[_0x1cb8('0x25')]('MailMessage,\x20%s,\x20%s',_0x9f0adb,_0x1cb8('0x26'));logger['debug'](_0x1cb8('0x27'),_0x9f0adb,_0x1cb8('0x26'),JSON[_0x1cb8('0x28')](_0x170f34));if(_0x170f34[_0x1cb8('0x29')]){if(_0x170f34['error']['code']===0x1f4){logger[_0x1cb8('0x29')](_0x1cb8('0x2a'),_0x9f0adb,_0x170f34[_0x1cb8('0x29')][_0x1cb8('0x2b')]);return _0x3cda27(_0x170f34[_0x1cb8('0x29')][_0x1cb8('0x2b')]);}logger[_0x1cb8('0x29')]('MailMessage,\x20%s,\x20%s',_0x9f0adb,_0x170f34[_0x1cb8('0x29')][_0x1cb8('0x2b')]);return _0x11d9f4(_0x170f34[_0x1cb8('0x29')][_0x1cb8('0x2b')]);}else{logger[_0x1cb8('0x25')](_0x1cb8('0x2a'),_0x9f0adb,'request\x20sent');_0x11d9f4(_0x170f34[_0x1cb8('0x2c')][_0x1cb8('0x2b')]);}})[_0x1cb8('0x2d')](function(_0x3c1905){logger[_0x1cb8('0x29')]('MailMessage,\x20%s,\x20%s',_0x9f0adb,_0x3c1905);_0x3cda27(_0x3c1905);});});}function respondWithStatusCode(_0xed576b,_0x2e3adf){_0x2e3adf=_0x2e3adf||0xcc;return function(_0x3a8b53){if(_0x3a8b53){return _0xed576b[_0x1cb8('0x2e')](_0x2e3adf);}return _0xed576b['status'](_0x2e3adf)[_0x1cb8('0x2f')]();};}function respondWithResult(_0x2ba8c8,_0x3a6a67){_0x3a6a67=_0x3a6a67||0xc8;return function(_0x5bf630){if(_0x5bf630){return _0x2ba8c8[_0x1cb8('0x30')](_0x3a6a67)[_0x1cb8('0x31')](_0x5bf630);}};}function respondWithFilteredResult(_0x17abe1,_0x5558fe){return function(_0x73be67){if(_0x73be67){var _0x3e2af4=_0x73be67['count'],_0x239c62=_0x5558fe[_0x1cb8('0x32')],_0xca35f2=_0x5558fe[_0x1cb8('0x32')]+_0x5558fe[_0x1cb8('0x33')],_0x36f63d;if(_0xca35f2>=_0x3e2af4){_0xca35f2=_0x3e2af4;_0x36f63d=0xc8;}else{_0x36f63d=0xce;}_0x17abe1[_0x1cb8('0x30')](_0x36f63d);return _0x17abe1[_0x1cb8('0x34')](_0x1cb8('0x35'),_0x239c62+'-'+_0xca35f2+'/'+_0x3e2af4)[_0x1cb8('0x31')](_0x73be67);}return null;};}function patchUpdates(_0x18cc99){return function(_0x1aaae4){try{jsonpatch['apply'](_0x1aaae4,_0x18cc99,!![]);}catch(_0x5cd6bd){return BPromise[_0x1cb8('0x36')](_0x5cd6bd);}return _0x1aaae4[_0x1cb8('0x37')]();};}function saveUpdates(_0x18a003,_0x5be4b7){return function(_0x5f04e3){if(_0x5f04e3){return _0x5f04e3[_0x1cb8('0x38')](_0x18a003)[_0x1cb8('0x24')](function(_0x9cdbed){return _0x9cdbed;});}return null;};}function removeEntity(_0xb21715,_0x198848){return function(_0x63ee4e){if(_0x63ee4e){return _0x63ee4e[_0x1cb8('0x39')]()[_0x1cb8('0x24')](function(){_0xb21715['status'](0xcc)[_0x1cb8('0x2f')]();});}};}function handleEntityNotFound(_0x1a6518,_0x1f888e){return function(_0x328b7c){if(!_0x328b7c){_0x1a6518[_0x1cb8('0x2e')](0x194);}return _0x328b7c;};}function handleError(_0x421ce7,_0xb5bc3c){_0xb5bc3c=_0xb5bc3c||0x1f4;return function(_0x2ad7f6){logger[_0x1cb8('0x29')](_0x2ad7f6['stack']);if(_0x2ad7f6[_0x1cb8('0x3a')]){delete _0x2ad7f6[_0x1cb8('0x3a')];}_0x421ce7['status'](_0xb5bc3c)[_0x1cb8('0x3b')](_0x2ad7f6);};}exports[_0x1cb8('0x3c')]=function(_0x15d6fa,_0x28a016){var _0xedbbda={},_0x5dc4c0={},_0x385b4d={'count':0x0,'rows':[]};var _0x4666bc=_[_0x1cb8('0x3d')](db['MailMessage']['rawAttributes'],function(_0x532af0){return{'name':_0x532af0[_0x1cb8('0x3e')],'type':_0x532af0[_0x1cb8('0x3f')][_0x1cb8('0x40')]};});_0x5dc4c0[_0x1cb8('0x41')]=_['map'](_0x4666bc,'name');_0x5dc4c0[_0x1cb8('0x42')]=_[_0x1cb8('0x43')](_0x15d6fa[_0x1cb8('0x42')]);_0x5dc4c0[_0x1cb8('0x44')]=_[_0x1cb8('0x45')](_0x5dc4c0[_0x1cb8('0x41')],_0x5dc4c0[_0x1cb8('0x42')]);_0xedbbda[_0x1cb8('0x46')]=_['intersection'](_0x5dc4c0[_0x1cb8('0x41')],qs[_0x1cb8('0x47')](_0x15d6fa[_0x1cb8('0x42')][_0x1cb8('0x47')]));_0xedbbda['attributes']=_0xedbbda[_0x1cb8('0x46')]['length']?_0xedbbda[_0x1cb8('0x46')]:_0x5dc4c0[_0x1cb8('0x41')];if(!_0x15d6fa['query'][_0x1cb8('0x48')](_0x1cb8('0x49'))){_0xedbbda[_0x1cb8('0x33')]=qs['limit'](_0x15d6fa['query'][_0x1cb8('0x33')]);_0xedbbda['offset']=qs[_0x1cb8('0x32')](_0x15d6fa[_0x1cb8('0x42')][_0x1cb8('0x32')]);}_0xedbbda[_0x1cb8('0x4a')]=qs[_0x1cb8('0x4b')](_0x15d6fa[_0x1cb8('0x42')][_0x1cb8('0x4b')]);_0xedbbda['where']=qs[_0x1cb8('0x44')](_[_0x1cb8('0x4c')](_0x15d6fa[_0x1cb8('0x42')],_0x5dc4c0[_0x1cb8('0x44')]),_0x4666bc);if(_0x15d6fa['query'][_0x1cb8('0x4d')]){_0xedbbda[_0x1cb8('0x4e')]=_[_0x1cb8('0x4f')](_0xedbbda[_0x1cb8('0x4e')],{'$or':_[_0x1cb8('0x3d')](_0x4666bc,function(_0x4efbe2){if(_0x4efbe2[_0x1cb8('0x3f')]!==_0x1cb8('0x50')){var _0x3ae2d2={};_0x3ae2d2[_0x4efbe2[_0x1cb8('0x3a')]]={'$like':'%'+_0x15d6fa[_0x1cb8('0x42')]['filter']+'%'};return _0x3ae2d2;}})});}_0xedbbda=_[_0x1cb8('0x4f')]({},_0xedbbda,_0x15d6fa[_0x1cb8('0x51')]);var _0x5598b1={'where':_0xedbbda[_0x1cb8('0x4e')]};return db[_0x1cb8('0x52')][_0x1cb8('0x53')](_0x5598b1)[_0x1cb8('0x24')](function(_0xe8c8c7){_0x385b4d[_0x1cb8('0x53')]=_0xe8c8c7;if(_0x15d6fa[_0x1cb8('0x42')][_0x1cb8('0x54')]){_0xedbbda[_0x1cb8('0x55')]=[{'all':!![]}];}return db[_0x1cb8('0x52')][_0x1cb8('0x56')](_0xedbbda);})[_0x1cb8('0x24')](function(_0x3c9076){_0x385b4d[_0x1cb8('0x57')]=_0x3c9076;return _0x385b4d;})['then'](respondWithFilteredResult(_0x28a016,_0xedbbda))[_0x1cb8('0x2d')](handleError(_0x28a016,null));};exports[_0x1cb8('0x58')]=function(_0x366628,_0x41a57e){var _0x21aba7={'raw':!![],'where':{'id':_0x366628[_0x1cb8('0x59')]['id']}},_0x15f0ba={};_0x15f0ba['model']=_[_0x1cb8('0x43')](db[_0x1cb8('0x52')][_0x1cb8('0x5a')]);_0x15f0ba['query']=_['keys'](_0x366628[_0x1cb8('0x42')]);_0x15f0ba[_0x1cb8('0x44')]=_[_0x1cb8('0x45')](_0x15f0ba[_0x1cb8('0x41')],_0x15f0ba[_0x1cb8('0x42')]);_0x21aba7['attributes']=_[_0x1cb8('0x45')](_0x15f0ba[_0x1cb8('0x41')],qs[_0x1cb8('0x47')](_0x366628['query']['fields']));_0x21aba7['attributes']=_0x21aba7[_0x1cb8('0x46')]['length']?_0x21aba7[_0x1cb8('0x46')]:_0x15f0ba[_0x1cb8('0x41')];if(_0x366628[_0x1cb8('0x42')][_0x1cb8('0x54')]){_0x21aba7[_0x1cb8('0x55')]=[{'all':!![]}];}_0x21aba7=_['merge']({},_0x21aba7,_0x366628[_0x1cb8('0x51')]);return db[_0x1cb8('0x52')][_0x1cb8('0x5b')](_0x21aba7)[_0x1cb8('0x24')](handleEntityNotFound(_0x41a57e,null))[_0x1cb8('0x24')](respondWithResult(_0x41a57e,null))[_0x1cb8('0x2d')](handleError(_0x41a57e,null));};exports[_0x1cb8('0x38')]=function(_0x53e09e,_0x1f0dea){if(_0x53e09e[_0x1cb8('0x5c')]['id']){delete _0x53e09e[_0x1cb8('0x5c')]['id'];}return db[_0x1cb8('0x52')][_0x1cb8('0x5b')]({'where':{'id':_0x53e09e[_0x1cb8('0x59')]['id']}})[_0x1cb8('0x24')](handleEntityNotFound(_0x1f0dea,null))['then'](saveUpdates(_0x53e09e['body'],null))['then'](respondWithResult(_0x1f0dea,null))[_0x1cb8('0x2d')](handleError(_0x1f0dea,null));};exports['destroy']=function(_0x2f3daa,_0x23cea0){return db[_0x1cb8('0x52')][_0x1cb8('0x5b')]({'where':{'id':_0x2f3daa[_0x1cb8('0x59')]['id']}})['then'](handleEntityNotFound(_0x23cea0,null))['then'](removeEntity(_0x23cea0,null))['catch'](handleError(_0x23cea0,null));};exports[_0x1cb8('0x5d')]=function(_0x3f8cba,_0x482d4f){return db[_0x1cb8('0x52')]['describe']()[_0x1cb8('0x24')](respondWithResult(_0x482d4f,null))[_0x1cb8('0x2d')](handleError(_0x482d4f,null));};exports['create']=function(_0x340e8e,_0x19f3f0){return db[_0x1cb8('0x52')][_0x1cb8('0x5e')](_0x340e8e[_0x1cb8('0x5c')])[_0x1cb8('0x24')](function(_0x416817){if(_0x416817){if(_0x416817[_0x1cb8('0x5f')]===_0x1cb8('0x60')&&!_0x416817[_0x1cb8('0x61')]){var _0x2fb1a7,_0x46c27d,_0x379169;if(_0x340e8e['body']['to']){_0x46c27d=_0x340e8e[_0x1cb8('0x5c')]['to'][_0x1cb8('0x62')](',')[0x0];}return db[_0x1cb8('0x63')]['findOne']({'where':{'id':_0x416817[_0x1cb8('0x64')]},'include':[{'model':db[_0x1cb8('0x65')],'as':_0x1cb8('0x66'),'include':[{'model':db[_0x1cb8('0x67')],'as':'Contacts','where':{'email':_0x46c27d},'limit':0x1,'order':[[_0x1cb8('0x68'),_0x1cb8('0x69')]]}]},{'model':db['MailServerOut'],'as':_0x1cb8('0x6a'),'raw':!![]}]})[_0x1cb8('0x24')](function(_0x5db6d0){_0x2fb1a7=_0x5db6d0;if(_0x2fb1a7&&_0x2fb1a7[_0x1cb8('0x6a')]){var _0x46ed52={'tls':{'rejectUnauthorized':![]}};if(_[_0x1cb8('0x6b')](_0x2fb1a7[_0x1cb8('0x6a')]['service'])){_0x46ed52['host']=_0x2fb1a7['Smtp'][_0x1cb8('0x6c')];_0x46ed52[_0x1cb8('0x6d')]=_0x2fb1a7[_0x1cb8('0x6a')][_0x1cb8('0x6d')];_0x46ed52[_0x1cb8('0x6e')]=_0x2fb1a7[_0x1cb8('0x6a')][_0x1cb8('0x6e')];if(_0x2fb1a7['Smtp'][_0x1cb8('0x6f')]){_0x46ed52[_0x1cb8('0x70')]={'user':_0x2fb1a7[_0x1cb8('0x6a')]['user'],'pass':_0x2fb1a7[_0x1cb8('0x6a')][_0x1cb8('0x71')]};}}else{_0x46ed52[_0x1cb8('0x72')]=_0x2fb1a7[_0x1cb8('0x6a')][_0x1cb8('0x72')];_0x46ed52['auth']={'user':_0x2fb1a7[_0x1cb8('0x6a')][_0x1cb8('0x73')],'pass':_0x2fb1a7[_0x1cb8('0x6a')]['pass']};_0x46ed52[_0x1cb8('0x6e')]=_0x2fb1a7[_0x1cb8('0x6a')]['secure'];}if(_0x340e8e[_0x1cb8('0x5c')]['attachments']&&_0x340e8e['body'][_0x1cb8('0x74')][_0x1cb8('0x75')]){for(var _0x1b8b40=0x0;_0x1b8b40<_0x340e8e['body']['attachments']['length'];_0x1b8b40+=0x1){_0x340e8e[_0x1cb8('0x5c')][_0x1cb8('0x74')][_0x1b8b40]={'filename':_0x340e8e[_0x1cb8('0x5c')][_0x1cb8('0x74')][_0x1b8b40][_0x1cb8('0x3a')],'path':path[_0x1cb8('0x76')](config[_0x1cb8('0x77')],'server/files/attachments',_0x340e8e['body']['attachments'][_0x1b8b40]['basename'])};}}_0x379169={'account':_0x46ed52,'message':_0x340e8e[_0x1cb8('0x5c')]};return;}})['then'](function(){if(_0x2fb1a7[_0x1cb8('0x66')]){if(_0x2fb1a7['List']['Contacts']['length']){return _0x2fb1a7[_0x1cb8('0x66')][_0x1cb8('0x78')][0x0];}else{return db[_0x1cb8('0x67')][_0x1cb8('0x5e')](_[_0x1cb8('0x17')](_0x340e8e[_0x1cb8('0x5c')],{'firstName':_0x340e8e[_0x1cb8('0x5c')]['to'],'email':_0x340e8e[_0x1cb8('0x5c')]['to'],'phone':_0x340e8e[_0x1cb8('0x5c')]['to'],'ListId':_0x2fb1a7[_0x1cb8('0x79')]}));}}else{throw new Error(_0x1cb8('0x7a'));}})[_0x1cb8('0x24')](function(){if(_0x379169){return respondWithRpcPromise(_0x1cb8('0x7b'),_0x1cb8('0x7c'),_0x379169,client9003)[_0x1cb8('0x24')](function(_0x38aa03){return _0x416817['update']({'read':!![],'messageId':_0x38aa03[_0x1cb8('0x7d')],'sentAt':moment()[_0x1cb8('0x7e')](_0x1cb8('0x7f'))});})[_0x1cb8('0x2d')](function(_0x24a298){logger[_0x1cb8('0x29')]('%s',JSON['stringify'](_0x24a298));return _0x416817;});}return _0x416817;});}return _0x416817;}})[_0x1cb8('0x24')](respondWithResult(_0x19f3f0,0xc9))[_0x1cb8('0x2d')](handleError(_0x19f3f0,null));};var interaction_log=require(_0x1cb8('0x12'))(_0x1cb8('0x80'));exports[_0x1cb8('0x81')]=function(_0x48e593,_0x7e9918,_0x34094c){var _0x5bfe0c={'channel':_0x1cb8('0x82')};if(_0x48e593['body']['id']){delete _0x48e593[_0x1cb8('0x5c')]['id'];}_0x48e593[_0x1cb8('0x5c')][_0x1cb8('0x83')]=!![];_0x48e593['body'][_0x1cb8('0x84')]=moment()[_0x1cb8('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');_0x48e593['body'][_0x1cb8('0x85')]=_0x48e593[_0x1cb8('0x5c')]['UserId']||_0x48e593[_0x1cb8('0x73')]['id'];return db[_0x1cb8('0x52')][_0x1cb8('0x5b')]({'where':{'id':_0x48e593[_0x1cb8('0x59')]['id'],'UserId':null},'include':[{'model':db[_0x1cb8('0x67')],'as':_0x1cb8('0x86')}]})[_0x1cb8('0x24')](handleEntityNotFound(_0x7e9918,null))['then'](saveUpdates(_0x48e593[_0x1cb8('0x5c')],null))['then'](function(_0x5334c1){if(_0x5334c1){_0x5bfe0c['message']=_0x5334c1[_0x1cb8('0x87')]({'plain':!![]});return db[_0x1cb8('0x88')][_0x1cb8('0x5b')]({'where':{'id':_0x5334c1[_0x1cb8('0x89')]}});}return null;})[_0x1cb8('0x24')](handleEntityNotFound(_0x7e9918,null))[_0x1cb8('0x24')](function(_0x4822cc){if(_0x4822cc){return _0x4822cc['update']({'UserId':_0x48e593[_0x1cb8('0x5c')]['UserId'],'read1stAt':_[_0x1cb8('0x6b')](_0x4822cc[_0x1cb8('0x8a')])?moment()[_0x1cb8('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x7afd8f){if(_0x7afd8f){_0x5bfe0c['interaction']=_0x7afd8f[_0x1cb8('0x87')]({'plain':!![]});interaction_log[_0x1cb8('0x25')](_0x1cb8('0x8b'),_0x48e593[_0x1cb8('0x73')]['id'],_0x48e593[_0x1cb8('0x73')][_0x1cb8('0x3a')],_0x48e593[_0x1cb8('0x73')][_0x1cb8('0x8c')],_0x5bfe0c[_0x1cb8('0x8d')]['id'],_0x48e593[_0x1cb8('0x5c')]?JSON[_0x1cb8('0x28')](_0x48e593[_0x1cb8('0x5c')]):_0x1cb8('0x8e'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x5bfe0c);}return null;})[_0x1cb8('0x24')](function(_0xf1a4cc){if(_0xf1a4cc){if(_0x48e593[_0x1cb8('0x5c')][_0x1cb8('0x8f')]){_0x5bfe0c['message'][_0x1cb8('0x90')]=util[_0x1cb8('0x7e')](_0x1cb8('0x91'),_0x48e593[_0x1cb8('0x73')][_0x1cb8('0x3a')]);_0x5bfe0c['message'][_0x1cb8('0x92')]=_0x5bfe0c[_0x1cb8('0x92')];_0x5bfe0c[_0x1cb8('0x2b')][_0x1cb8('0x93')]=_0x1cb8('0x81');return respondWithRpcPromise(_0x1cb8('0x94'),_0x1cb8('0x94'),{'event':_0x1cb8('0x95'),'message':_0x5bfe0c[_0x1cb8('0x2b')]},client9002)[_0x1cb8('0x24')](function(){return _0x5bfe0c;});}return _0x5bfe0c;}return null;})['then'](respondWithResult(_0x7e9918,null))[_0x1cb8('0x2d')](handleError(_0x7e9918,null));};var interaction_log=require(_0x1cb8('0x12'))('mail-interactions');exports['reject']=function(_0x1d03e1,_0x5bbb90,_0x55161c){var _0x3a786a={'agent':{},'channel':_0x1cb8('0x82')};if(_0x1d03e1['body']['id']){delete _0x1d03e1['body']['id'];}_0x1d03e1[_0x1cb8('0x5c')]['UserId']=_0x1d03e1[_0x1cb8('0x5c')]['UserId']||_0x1d03e1[_0x1cb8('0x73')]['id'];_0x3a786a[_0x1cb8('0x96')]['id']=_0x1d03e1['body'][_0x1cb8('0x85')];return db[_0x1cb8('0x52')][_0x1cb8('0x5b')]({'where':{'id':_0x1d03e1[_0x1cb8('0x59')]['id'],'UserId':null}})[_0x1cb8('0x24')](handleEntityNotFound(_0x5bbb90,null))[_0x1cb8('0x24')](function(_0xeea4ce){if(_0xeea4ce){_0x3a786a[_0x1cb8('0x2b')]=_0xeea4ce['get']({'plain':!![]});return db[_0x1cb8('0x88')]['find']({'where':{'id':_0xeea4ce[_0x1cb8('0x89')]}});}return null;})[_0x1cb8('0x24')](handleEntityNotFound(_0x5bbb90,null))[_0x1cb8('0x24')](function(_0x5bb08c){if(_0x5bb08c){_0x3a786a['interaction']=_0x5bb08c[_0x1cb8('0x87')]({'plain':!![]});interaction_log[_0x1cb8('0x25')](_0x1cb8('0x97'),_0x1d03e1['user']['id'],_0x1d03e1['user']['name'],_0x1d03e1['user'][_0x1cb8('0x8c')],_0x3a786a[_0x1cb8('0x8d')]['id'],_0x1d03e1[_0x1cb8('0x5c')]?JSON[_0x1cb8('0x28')](_0x1d03e1[_0x1cb8('0x5c')]):_0x1cb8('0x8e'));return respondWithRpcPromise('RejectMessage',_0x1cb8('0x98'),_0x3a786a);}return null;})[_0x1cb8('0x24')](function(_0x359a7d){if(_0x359a7d){_0x359a7d[_0x1cb8('0x2b')][_0x1cb8('0x90')]=util['format'](_0x1cb8('0x91'),_0x1d03e1[_0x1cb8('0x73')][_0x1cb8('0x3a')]);_0x359a7d[_0x1cb8('0x2b')][_0x1cb8('0x92')]=_0x3a786a[_0x1cb8('0x92')];_0x359a7d[_0x1cb8('0x2b')]['event']='reject';respondWithRpcPromise('EventManager',_0x1cb8('0x94'),{'event':_0x1cb8('0x99'),'message':_0x359a7d[_0x1cb8('0x2b')]},client9002);return _0x3a786a;}return null;})[_0x1cb8('0x24')](respondWithResult(_0x5bbb90,null))['catch'](handleError(_0x5bbb90,null));};exports[_0x1cb8('0x9a')]=function(_0x5829f3,_0xebe8da){var _0x107833=moment()[_0x1cb8('0x9b')]()['toString']();var _0x5e6b36=path[_0x1cb8('0x76')](config[_0x1cb8('0x77')],_0x1cb8('0x9c'),_0x1cb8('0x9d'),'tmp');var _0x457386=path[_0x1cb8('0x76')](config[_0x1cb8('0x77')],'server',_0x1cb8('0x9d'),_0x1cb8('0x74'));var _0x276126=util[_0x1cb8('0x7e')](_0x1cb8('0x9e'),_0x107833);return db['MailMessage']['find']({'where':{'id':_0x5829f3[_0x1cb8('0x59')]['id']},'attributes':['id','body',_0x1cb8('0x9f'),'to','cc',_0x1cb8('0xa0'),'subject',_0x1cb8('0xa1')],'include':_0x5829f3[_0x1cb8('0x42')][_0x1cb8('0x74')]?[{'model':db[_0x1cb8('0xa2')],'as':_0x1cb8('0xa3')}]:undefined})['then'](handleEntityNotFound(_0xebe8da,null))[_0x1cb8('0x24')](function(_0x1a700d){if(_0x1a700d){var _0x3c07b5=_0x1a700d;var _0xd6451e={'from':_0x3c07b5['from'],'to':_0x3c07b5['to'],'subject':_0x3c07b5[_0x1cb8('0xa4')],'html':_0x3c07b5[_0x1cb8('0x5c')],'headers':{'Date':moment(_0x3c07b5[_0x1cb8('0xa1')])[_0x1cb8('0x7e')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1a700d['cc']){_0xd6451e['headers']['Cc']=_0x1a700d['cc'];}if(_0x1a700d['bcc']){_0xd6451e[_0x1cb8('0xa5')][_0x1cb8('0xa6')]=_0x1a700d[_0x1cb8('0xa0')];}return new BPromise(function(_0x24ac20,_0x37ca01){if(_0x1a700d[_0x1cb8('0xa3')]){for(var _0x53bb05=0x0;_0x53bb05<_0x1a700d[_0x1cb8('0xa3')][_0x1cb8('0x75')];_0x53bb05++){var _0x9141ed=_0x1a700d[_0x1cb8('0xa3')][_0x53bb05];var _0x43c39c=path[_0x1cb8('0x76')](_0x457386,_0x9141ed[_0x1cb8('0xa7')]);if(fs['existsSync'](_0x43c39c)){_0xd6451e[_0x1cb8('0x74')][_0x1cb8('0xa8')]({'name':_0x9141ed[_0x1cb8('0x3a')],'contentType':_0x9141ed[_0x1cb8('0x3f')],'data':fs['readFileSync'](_0x43c39c)});}}}emlformat[_0x1cb8('0xa9')](_0xd6451e,function(_0x483c87,_0x3b4a20){if(_0x483c87)return _0x37ca01(_0x483c87);fs[_0x1cb8('0xaa')](path['join'](_0x5e6b36,_0x276126),_0x3b4a20);return _0x24ac20(_0x3b4a20);});});}})[_0x1cb8('0x24')](function(_0x2ecd2e){if(_0x2ecd2e){return _0xebe8da[_0x1cb8('0x9a')](path[_0x1cb8('0x76')](_0x5e6b36,_0x276126),_0x276126,function(_0x4b16d4){if(_0x4b16d4){console[_0x1cb8('0xab')]('err',_0x4b16d4);}else{fs[_0x1cb8('0xac')](path['join'](_0x5e6b36,_0x276126));}});}})[_0x1cb8('0x2d')](handleError(_0xebe8da,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index e181964..200ba08 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 _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 +var _0x337d=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','save'];(function(_0x2ed9ae,_0x5536f8){var _0x488c33=function(_0x1c37ee){while(--_0x1c37ee){_0x2ed9ae['push'](_0x2ed9ae['shift']());}};_0x488c33(++_0x5536f8);}(_0x337d,0xba));var _0xd337=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x337d[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require(_0xd337('0x0'));var MailMessage=require(_0xd337('0x1'))['db'][_0xd337('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd337('0x3'),'afterUpdate':_0xd337('0x4'),'afterDestroy':_0xd337('0x5')};function emitEvent(_0x43e26e){return function(_0x446c47,_0x5777bb,_0x15fd5c){MailMessageEvents['emit'](_0x43e26e+':'+_0x446c47['id'],_0x446c47);MailMessageEvents[_0xd337('0x6')](_0x43e26e,_0x446c47);_0x15fd5c(null);};}for(var e in events){if(events[_0xd337('0x7')](e)){var event=events[e];MailMessage[_0xd337('0x8')](e,emitEvent(event));}}module[_0xd337('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 75d80b2..65f4b2c 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 _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 +var _0x31a2=['rimraf','../../config/environment','exports','MailMessage','mail_messages','messageId','subject','FULLTEXT','body','plainBody','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','then','update','createdAt','catch','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','html-to-text','path'];(function(_0x5826a2,_0x1eafb9){var _0x56dc2a=function(_0x3af1fa){while(--_0x3af1fa){_0x5826a2['push'](_0x5826a2['shift']());}};_0x56dc2a(++_0x1eafb9);}(_0x31a2,0x119));var _0x231a=function(_0x78e146,_0x7a4e79){_0x78e146=_0x78e146-0x0;var _0xcfc60f=_0x31a2[_0x78e146];return _0xcfc60f;};'use strict';var _=require(_0x231a('0x0'));var util=require('util');var logger=require(_0x231a('0x1'))(_0x231a('0x2'));var moment=require(_0x231a('0x3'));var BPromise=require('bluebird');var rp=require(_0x231a('0x4'));var htmlToText=require(_0x231a('0x5'));var fs=require('fs');var path=require(_0x231a('0x6'));var rimraf=require(_0x231a('0x7'));var config=require(_0x231a('0x8'));var attributes=require('./mailMessage.attributes');module[_0x231a('0x9')]=function(_0x51439e,_0xce1e8b){return _0x51439e['define'](_0x231a('0xa'),attributes,{'tableName':_0x231a('0xb'),'paranoid':![],'indexes':[{'name':_0x231a('0xc'),'fields':['messageId']},{'name':'fti_mail_messages','fields':['plainBody',_0x231a('0xd')],'type':_0x231a('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2baa77,_0x390bc4,_0x5775d5){if(_0x2baa77[_0x231a('0xf')]){_0x2baa77[_0x231a('0x10')]=htmlToText['fromString'](_0x2baa77[_0x231a('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5775d5(null,_0x390bc4);},'afterCreate':function(_0x49b9ce,_0x24b317,_0x48e6fe){var _0x17db09=_0x51439e[_0x231a('0x11')];var _0x534fc8=_0x49b9ce[_0x231a('0x12')]({'plain':!![]});if(_0x534fc8[_0x231a('0x13')][_0x231a('0x14')]()==='in'||_0x534fc8[_0x231a('0x13')][_0x231a('0x14')]()===_0x231a('0x15')&&!_0x534fc8[_0x231a('0x16')]&&!_[_0x231a('0x17')](_0x534fc8[_0x231a('0x18')])){_0x17db09[_0x231a('0x19')][_0x231a('0x1a')]({'where':{'id':_0x534fc8['MailInteractionId']}})[_0x231a('0x1b')](function(_0x56a36d){if(_0x56a36d){_0x56a36d[_0x231a('0x1c')]({'lastMsgAt':_0x534fc8[_0x231a('0x1d')],'lastMsgDirection':_0x534fc8[_0x231a('0x13')][_0x231a('0x14')](),'lastMsgBody':_0x534fc8[_0x231a('0xf')]});}})[_0x231a('0x1e')](function(_0x3f4ec3){console['error'](_0x3f4ec3);});}_0x48e6fe();}},'charset':'utf8mb4','collate':_0x231a('0x1f')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index ea36287..b7df765 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 _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 +var _0x9b09=['../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./mailMessage.socket','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','result','CreateMailMessage','MailMessage','create','body','options','raw','stringify','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x9b09,0x1ad));var _0x99b0=function(_0x5ba46a,_0x582fe0){_0x5ba46a=_0x5ba46a-0x0;var _0x5cbf4f=_0x9b09[_0x5ba46a];return _0x5cbf4f;};'use strict';var _=require(_0x99b0('0x0'));var util=require(_0x99b0('0x1'));var moment=require('moment');var BPromise=require(_0x99b0('0x2'));var rs=require(_0x99b0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x99b0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x99b0('0x5'))('rpc');var config=require(_0x99b0('0x6'));var jayson=require(_0x99b0('0x7'));var client=jayson['client'][_0x99b0('0x8')]({'port':0x232a});config[_0x99b0('0x9')]=_['defaults'](config[_0x99b0('0x9')],{'host':_0x99b0('0xa'),'port':0x18eb});var socket=require(_0x99b0('0xb'))(new Redis(config[_0x99b0('0x9')]));require(_0x99b0('0xc'))['register'](socket);function respondWithRpcPromise(_0x16bb51,_0x3ff7df,_0x23f567){return new BPromise(function(_0x443f52,_0xff8662){return client['request'](_0x16bb51,_0x23f567)[_0x99b0('0xd')](function(_0x263d8e){logger[_0x99b0('0xe')](_0x99b0('0xf'),_0x3ff7df,_0x99b0('0x10'));logger[_0x99b0('0x11')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x3ff7df,_0x99b0('0x10'),JSON['stringify'](_0x263d8e));if(_0x263d8e[_0x99b0('0x12')]){if(_0x263d8e[_0x99b0('0x12')]['code']===0x1f4){logger['error'](_0x99b0('0xf'),_0x3ff7df,_0x263d8e[_0x99b0('0x12')][_0x99b0('0x13')]);return _0xff8662(_0x263d8e['error']['message']);}logger['error'](_0x99b0('0xf'),_0x3ff7df,_0x263d8e[_0x99b0('0x12')]['message']);return _0x443f52(_0x263d8e[_0x99b0('0x12')][_0x99b0('0x13')]);}else{logger[_0x99b0('0xe')](_0x99b0('0xf'),_0x3ff7df,_0x99b0('0x10'));_0x443f52(_0x263d8e[_0x99b0('0x14')][_0x99b0('0x13')]);}})['catch'](function(_0x1a2521){logger[_0x99b0('0x12')](_0x99b0('0xf'),_0x3ff7df,_0x1a2521);_0xff8662(_0x1a2521);});});}exports[_0x99b0('0x15')]=function(_0x1a5863){var _0x15b7fd=this;return new Promise(function(_0x3b303b,_0x1783ca){return db[_0x99b0('0x16')][_0x99b0('0x17')](_0x1a5863[_0x99b0('0x18')],{'raw':_0x1a5863[_0x99b0('0x19')]?_0x1a5863[_0x99b0('0x19')][_0x99b0('0x1a')]===undefined?!![]:![]:!![]})[_0x99b0('0xd')](function(_0x93dcb1){logger[_0x99b0('0xe')](_0x99b0('0x15'),_0x1a5863);logger[_0x99b0('0x11')](_0x99b0('0x15'),_0x1a5863,JSON[_0x99b0('0x1b')](_0x93dcb1));_0x3b303b(_0x93dcb1);})[_0x99b0('0x1c')](function(_0x3be9fc){logger[_0x99b0('0x12')]('CreateMailMessage',_0x3be9fc[_0x99b0('0x13')],_0x1a5863);_0x1783ca(_0x15b7fd['error'](0x1f4,_0x3be9fc['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 2ebf437..8680994 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 _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 +var _0xf0db=['save','update','emit','register','mailMessage:','./mailMessage.events'];(function(_0x1098e3,_0x97af9a){var _0x4a4f1d=function(_0x58d0de){while(--_0x58d0de){_0x1098e3['push'](_0x1098e3['shift']());}};_0x4a4f1d(++_0x97af9a);}(_0xf0db,0x12b));var _0xbf0d=function(_0x7074d5,_0x427953){_0x7074d5=_0x7074d5-0x0;var _0xced075=_0xf0db[_0x7074d5];return _0xced075;};'use strict';var MailMessageEvents=require(_0xbf0d('0x0'));var events=[_0xbf0d('0x1'),'remove',_0xbf0d('0x2')];function createListener(_0x1a6fea,_0x2bf55a){return function(_0x5db968){_0x2bf55a[_0xbf0d('0x3')](_0x1a6fea,_0x5db968);};}function removeListener(_0x2ccd6c,_0x56f648){return function(){MailMessageEvents['removeListener'](_0x2ccd6c,_0x56f648);};}exports[_0xbf0d('0x4')]=function(_0x1e4a49){for(var _0x28586b=0x0,_0x2dc074=events['length'];_0x28586b<_0x2dc074;_0x28586b++){var _0x1ebf0c=events[_0x28586b];var _0x2fbc2b=createListener(_0xbf0d('0x5')+_0x1ebf0c,_0x1e4a49);MailMessageEvents['on'](_0x1ebf0c,_0x2fbc2b);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 48d3a6e..9ee9088 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 _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 +var _0x9bce=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','/describe','/:id','show','/:id/members','/:id/teams','/:id/users','getAgents','post','create','addAgents','put','delete','removeTeams','removeAgents','exports','multer','util'];(function(_0x51c6bb,_0x5a6288){var _0x5229d5=function(_0x2ab708){while(--_0x2ab708){_0x51c6bb['push'](_0x51c6bb['shift']());}};_0x5229d5(++_0x5a6288);}(_0x9bce,0x184));var _0xe9bc=function(_0x5c2198,_0x1c7ec2){_0x5c2198=_0x5c2198-0x0;var _0x34b574=_0x9bce[_0x5c2198];return _0x34b574;};'use strict';var multer=require(_0xe9bc('0x0'));var util=require(_0xe9bc('0x1'));var path=require(_0xe9bc('0x2'));var timeout=require(_0xe9bc('0x3'));var express=require('express');var router=express[_0xe9bc('0x4')]();var auth=require(_0xe9bc('0x5'));var interaction=require(_0xe9bc('0x6'));var config=require(_0xe9bc('0x7'));var controller=require(_0xe9bc('0x8'));router[_0xe9bc('0x9')]('/',auth[_0xe9bc('0xa')](),controller['index']);router['get'](_0xe9bc('0xb'),auth[_0xe9bc('0xa')](),controller['describe']);router[_0xe9bc('0x9')](_0xe9bc('0xc'),auth[_0xe9bc('0xa')](),controller[_0xe9bc('0xd')]);router[_0xe9bc('0x9')](_0xe9bc('0xe'),auth[_0xe9bc('0xa')](),controller['getMembers']);router[_0xe9bc('0x9')](_0xe9bc('0xf'),auth[_0xe9bc('0xa')](),controller['getTeams']);router['get'](_0xe9bc('0x10'),auth[_0xe9bc('0xa')](),controller[_0xe9bc('0x11')]);router[_0xe9bc('0x12')]('/',auth['isAuthenticated'](),controller[_0xe9bc('0x13')]);router['post'](_0xe9bc('0xf'),auth[_0xe9bc('0xa')](),controller['addTeams']);router[_0xe9bc('0x12')](_0xe9bc('0x10'),auth['isAuthenticated'](),controller[_0xe9bc('0x14')]);router[_0xe9bc('0x15')]('/:id',auth[_0xe9bc('0xa')](),controller['update']);router[_0xe9bc('0x16')](_0xe9bc('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0xe9bc('0x16')](_0xe9bc('0xf'),auth[_0xe9bc('0xa')](),controller[_0xe9bc('0x17')]);router[_0xe9bc('0x16')](_0xe9bc('0x10'),auth[_0xe9bc('0xa')](),controller[_0xe9bc('0x18')]);module[_0xe9bc('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index d274717..e4e4b90 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 _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 +var _0x391f=['INTEGER','ENUM','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0xaf02d7,_0xc1fc89){var _0x4bfcf0=function(_0x4ad9d7){while(--_0x4ad9d7){_0xaf02d7['push'](_0xaf02d7['shift']());}};_0x4bfcf0(++_0xc1fc89);}(_0x391f,0x10c));var _0xf391=function(_0x253ec8,_0x4fd820){_0x253ec8=_0x253ec8-0x0;var _0x7150d0=_0x391f[_0x253ec8];return _0x7150d0;};'use strict';var Sequelize=require(_0xf391('0x0'));module[_0xf391('0x1')]={'name':{'type':Sequelize[_0xf391('0x2')],'unique':_0xf391('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf391('0x2')]},'timeout':{'type':Sequelize[_0xf391('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf391('0x5')]('rrmemory',_0xf391('0x6'),_0xf391('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 9e301b0..ed94f29 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 _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 +var _0x3184=['catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserMailQueue','pick','MailQueueId','merge','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','rows','format','%s/%s','getTeams','Team','User','Agents','voicePause','sequelize','transaction','findOrCreate','forEach','emit','removeTeams','ids','field','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','TeamId','includes','all','compact','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','userMailQueue:save','getAgents','html-pdf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','get','MailQueues','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','show','params','find'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x3184,0xc8));var _0x4318=function(_0x33ebf5,_0x258ec6){_0x33ebf5=_0x33ebf5-0x0;var _0x66957b=_0x3184[_0x33ebf5];return _0x66957b;};'use strict';var pdf=require(_0x4318('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4318('0x1'));var jsonpatch=require(_0x4318('0x2'));var rp=require('request-promise');var moment=require(_0x4318('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4318('0x4'));var util=require('util');var path=require(_0x4318('0x5'));var sox=require(_0x4318('0x6'));var csv=require(_0x4318('0x7'));var ejs=require(_0x4318('0x8'));var fs=require('fs');var _=require(_0x4318('0x9'));var squel=require('squel');var crypto=require(_0x4318('0xa'));var jsforce=require(_0x4318('0xb'));var deskjs=require(_0x4318('0xc'));var toCsv=require(_0x4318('0x7'));var querystring=require(_0x4318('0xd'));var Papa=require(_0x4318('0xe'));var Redis=require(_0x4318('0xf'));var authService=require(_0x4318('0x10'));var qs=require(_0x4318('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4318('0x12'))('api');var utils=require(_0x4318('0x13'));var config=require(_0x4318('0x14'));var db=require(_0x4318('0x15'))['db'];config[_0x4318('0x16')]=_[_0x4318('0x17')](config['redis'],{'host':_0x4318('0x18'),'port':0x18eb});var socket=require(_0x4318('0x19'))(new Redis(config[_0x4318('0x16')]));require(_0x4318('0x1a'))[_0x4318('0x1b')](socket);function respondWithStatusCode(_0x3509dc,_0x323ff4){_0x323ff4=_0x323ff4||0xcc;return function(_0x5aa371){if(_0x5aa371){return _0x3509dc[_0x4318('0x1c')](_0x323ff4);}return _0x3509dc[_0x4318('0x1d')](_0x323ff4)[_0x4318('0x1e')]();};}function respondWithResult(_0x4baeda,_0x1fc165){_0x1fc165=_0x1fc165||0xc8;return function(_0x4334ec){if(_0x4334ec){return _0x4baeda[_0x4318('0x1d')](_0x1fc165)[_0x4318('0x1f')](_0x4334ec);}};}function respondWithFilteredResult(_0x4f825d,_0x11fc28){return function(_0x445ed8){if(_0x445ed8){var _0x47c1ad=_0x445ed8[_0x4318('0x20')],_0x2c7c9d=_0x11fc28['offset'],_0x3eb759=_0x11fc28[_0x4318('0x21')]+_0x11fc28[_0x4318('0x22')],_0x5131e1;if(_0x3eb759>=_0x47c1ad){_0x3eb759=_0x47c1ad;_0x5131e1=0xc8;}else{_0x5131e1=0xce;}_0x4f825d[_0x4318('0x1d')](_0x5131e1);return _0x4f825d[_0x4318('0x23')](_0x4318('0x24'),_0x2c7c9d+'-'+_0x3eb759+'/'+_0x47c1ad)[_0x4318('0x1f')](_0x445ed8);}return null;};}function patchUpdates(_0xb546d1){return function(_0xfb4c4e){try{jsonpatch[_0x4318('0x25')](_0xfb4c4e,_0xb546d1,!![]);}catch(_0x26ffd3){return BPromise['reject'](_0x26ffd3);}return _0xfb4c4e[_0x4318('0x26')]();};}function saveUpdates(_0x1b02ac,_0x592477){return function(_0x54b6e7){if(_0x54b6e7){return _0x54b6e7['update'](_0x1b02ac)[_0x4318('0x27')](function(_0x3d5ea0){return _0x3d5ea0;});}return null;};}function removeEntity(_0x2bcea9,_0x2c7371){return function(_0x431133){if(_0x431133){return _0x431133[_0x4318('0x28')]()[_0x4318('0x27')](function(){var _0x384c14=_0x431133[_0x4318('0x29')]({'plain':!![]});var _0x4e2a4a=_0x4318('0x2a');return db['UserProfileResource'][_0x4318('0x28')]({'where':{'type':_0x4e2a4a,'resourceId':_0x384c14['id']}})['then'](function(){return _0x431133;});})[_0x4318('0x27')](function(){_0x2bcea9[_0x4318('0x1d')](0xcc)[_0x4318('0x1e')]();});}};}function handleEntityNotFound(_0x573d94,_0x12c01b){return function(_0x1e3a83){if(!_0x1e3a83){_0x573d94['sendStatus'](0x194);}return _0x1e3a83;};}function handleError(_0x550230,_0x585419){_0x585419=_0x585419||0x1f4;return function(_0x34533d){logger[_0x4318('0x2b')](_0x34533d[_0x4318('0x2c')]);if(_0x34533d['name']){delete _0x34533d[_0x4318('0x2d')];}_0x550230[_0x4318('0x1d')](_0x585419)[_0x4318('0x2e')](_0x34533d);};}exports[_0x4318('0x2f')]=function(_0x3a9d4a,_0x54bfef){var _0x41ea72={},_0x2e589c={},_0x3f31df={'count':0x0,'rows':[]};var _0x374076=_[_0x4318('0x30')](db[_0x4318('0x31')][_0x4318('0x32')],function(_0x303da0){return{'name':_0x303da0[_0x4318('0x33')],'type':_0x303da0[_0x4318('0x34')][_0x4318('0x35')]};});_0x2e589c[_0x4318('0x36')]=_[_0x4318('0x30')](_0x374076,_0x4318('0x2d'));_0x2e589c[_0x4318('0x37')]=_[_0x4318('0x38')](_0x3a9d4a[_0x4318('0x37')]);_0x2e589c[_0x4318('0x39')]=_[_0x4318('0x3a')](_0x2e589c[_0x4318('0x36')],_0x2e589c[_0x4318('0x37')]);_0x41ea72[_0x4318('0x3b')]=_[_0x4318('0x3a')](_0x2e589c[_0x4318('0x36')],qs['fields'](_0x3a9d4a[_0x4318('0x37')][_0x4318('0x3c')]));_0x41ea72[_0x4318('0x3b')]=_0x41ea72[_0x4318('0x3b')][_0x4318('0x3d')]?_0x41ea72[_0x4318('0x3b')]:_0x2e589c[_0x4318('0x36')];if(!_0x3a9d4a[_0x4318('0x37')][_0x4318('0x3e')](_0x4318('0x3f'))){_0x41ea72[_0x4318('0x22')]=qs['limit'](_0x3a9d4a[_0x4318('0x37')][_0x4318('0x22')]);_0x41ea72[_0x4318('0x21')]=qs[_0x4318('0x21')](_0x3a9d4a['query'][_0x4318('0x21')]);}_0x41ea72[_0x4318('0x40')]=qs[_0x4318('0x41')](_0x3a9d4a[_0x4318('0x37')][_0x4318('0x41')]);_0x41ea72[_0x4318('0x42')]=qs[_0x4318('0x39')](_['pick'](_0x3a9d4a[_0x4318('0x37')],_0x2e589c[_0x4318('0x39')]),_0x374076);if(_0x3a9d4a[_0x4318('0x37')][_0x4318('0x43')]){_0x41ea72['where']=_['merge'](_0x41ea72[_0x4318('0x42')],{'$or':_['map'](_0x374076,function(_0x2d0833){if(_0x2d0833[_0x4318('0x34')]!==_0x4318('0x44')){var _0x3c225c={};_0x3c225c[_0x2d0833[_0x4318('0x2d')]]={'$like':'%'+_0x3a9d4a['query']['filter']+'%'};return _0x3c225c;}})});}_0x41ea72=_['merge']({},_0x41ea72,_0x3a9d4a[_0x4318('0x45')]);var _0x394900={'where':_0x41ea72[_0x4318('0x42')]};return db['MailQueue']['count'](_0x394900)[_0x4318('0x27')](function(_0x2023ec){_0x3f31df[_0x4318('0x20')]=_0x2023ec;if(_0x3a9d4a[_0x4318('0x37')][_0x4318('0x46')]){_0x41ea72[_0x4318('0x47')]=[{'all':!![]}];}return db[_0x4318('0x31')][_0x4318('0x48')](_0x41ea72);})[_0x4318('0x27')](function(_0x355771){_0x3f31df['rows']=_0x355771;return _0x3f31df;})[_0x4318('0x27')](respondWithFilteredResult(_0x54bfef,_0x41ea72))['catch'](handleError(_0x54bfef,null));};exports[_0x4318('0x49')]=function(_0x5ac5c7,_0x1d3cfb){var _0x4375b9={'raw':!![],'where':{'id':_0x5ac5c7[_0x4318('0x4a')]['id']}},_0x4c2ba0={};_0x4c2ba0[_0x4318('0x36')]=_[_0x4318('0x38')](db[_0x4318('0x31')][_0x4318('0x32')]);_0x4c2ba0[_0x4318('0x37')]=_[_0x4318('0x38')](_0x5ac5c7['query']);_0x4c2ba0['filters']=_[_0x4318('0x3a')](_0x4c2ba0[_0x4318('0x36')],_0x4c2ba0[_0x4318('0x37')]);_0x4375b9[_0x4318('0x3b')]=_['intersection'](_0x4c2ba0[_0x4318('0x36')],qs[_0x4318('0x3c')](_0x5ac5c7[_0x4318('0x37')][_0x4318('0x3c')]));_0x4375b9[_0x4318('0x3b')]=_0x4375b9[_0x4318('0x3b')]['length']?_0x4375b9[_0x4318('0x3b')]:_0x4c2ba0[_0x4318('0x36')];if(_0x5ac5c7[_0x4318('0x37')][_0x4318('0x46')]){_0x4375b9[_0x4318('0x47')]=[{'all':!![]}];}_0x4375b9=_['merge']({},_0x4375b9,_0x5ac5c7[_0x4318('0x45')]);return db[_0x4318('0x31')][_0x4318('0x4b')](_0x4375b9)[_0x4318('0x27')](handleEntityNotFound(_0x1d3cfb,null))[_0x4318('0x27')](respondWithResult(_0x1d3cfb,null))[_0x4318('0x4c')](handleError(_0x1d3cfb,null));};exports[_0x4318('0x4d')]=function(_0x41fc0f,_0x5dc650){return db['MailQueue'][_0x4318('0x4d')](_0x41fc0f[_0x4318('0x4e')],{})[_0x4318('0x27')](function(_0xbf5361){var _0x48b5b0=_0x41fc0f['user']['get']({'plain':!![]});if(!_0x48b5b0)throw new Error(_0x4318('0x4f'));if(_0x48b5b0[_0x4318('0x50')]===_0x4318('0x51')){var _0x18861c=_0xbf5361[_0x4318('0x29')]({'plain':!![]});var _0x59dbf1=_0x4318('0x2a');return db['UserProfileSection'][_0x4318('0x4b')]({'where':{'name':_0x59dbf1,'userProfileId':_0x48b5b0[_0x4318('0x52')]},'raw':!![]})['then'](function(_0x46acf1){if(_0x46acf1&&_0x46acf1[_0x4318('0x53')]===0x0){return db['UserProfileResource'][_0x4318('0x4d')]({'name':_0x18861c[_0x4318('0x2d')],'resourceId':_0x18861c['id'],'type':_0x46acf1[_0x4318('0x2d')],'sectionId':_0x46acf1['id']},{})[_0x4318('0x27')](function(){return _0xbf5361;});}else{return _0xbf5361;}})[_0x4318('0x4c')](function(_0x4fbd95){logger[_0x4318('0x2b')](_0x4318('0x54'),_0x4fbd95);throw _0x4fbd95;});}return _0xbf5361;})[_0x4318('0x27')](respondWithResult(_0x5dc650,0xc9))[_0x4318('0x4c')](handleError(_0x5dc650,null));};exports[_0x4318('0x55')]=function(_0x586c05,_0x57505f){if(_0x586c05[_0x4318('0x4e')]['id']){delete _0x586c05['body']['id'];}return db[_0x4318('0x31')]['find']({'where':{'id':_0x586c05['params']['id']}})[_0x4318('0x27')](handleEntityNotFound(_0x57505f,null))[_0x4318('0x27')](saveUpdates(_0x586c05[_0x4318('0x4e')],null))[_0x4318('0x27')](respondWithResult(_0x57505f,null))[_0x4318('0x4c')](handleError(_0x57505f,null));};exports['destroy']=function(_0xd63be9,_0x7b7381){return db[_0x4318('0x31')][_0x4318('0x4b')]({'where':{'id':_0xd63be9[_0x4318('0x4a')]['id']}})[_0x4318('0x27')](handleEntityNotFound(_0x7b7381,null))[_0x4318('0x27')](removeEntity(_0x7b7381,null))['catch'](handleError(_0x7b7381,null));};exports[_0x4318('0x56')]=function(_0x2c370b,_0x10c321){return db[_0x4318('0x31')][_0x4318('0x56')]()[_0x4318('0x27')](respondWithResult(_0x10c321,null))['catch'](handleError(_0x10c321,null));};exports['getMembers']=function(_0xb0972e,_0x20baab,_0x1ab4eb){var _0x105cef={'raw':!![],'where':{}},_0x5665e2={},_0x4fbadb;return db['MailQueue'][_0x4318('0x57')]({'where':{'id':_0xb0972e['params']['id']}})[_0x4318('0x27')](handleEntityNotFound(_0x20baab,null))['then'](function(_0x46d133){if(_0x46d133){_0x4fbadb=_0x46d133['get']({'plain':!![]});_0x5665e2[_0x4318('0x36')]=_[_0x4318('0x38')](db[_0x4318('0x58')][_0x4318('0x32')]);_0x5665e2[_0x4318('0x37')]=_[_0x4318('0x38')](_0xb0972e['query']);_0x5665e2[_0x4318('0x39')]=_[_0x4318('0x3a')](_0x5665e2[_0x4318('0x36')],_0x5665e2['query']);_0x105cef['attributes']=_[_0x4318('0x3a')](_0x5665e2[_0x4318('0x36')],qs['fields'](_0xb0972e[_0x4318('0x37')][_0x4318('0x3c')]));_0x105cef[_0x4318('0x3b')]=_0x105cef[_0x4318('0x3b')]['length']?_0x105cef[_0x4318('0x3b')]:_0x5665e2[_0x4318('0x36')];if(!_0xb0972e['query'][_0x4318('0x3e')](_0x4318('0x3f'))){_0x105cef[_0x4318('0x22')]=qs[_0x4318('0x22')](_0xb0972e[_0x4318('0x37')]['limit']);_0x105cef[_0x4318('0x21')]=qs[_0x4318('0x21')](_0xb0972e[_0x4318('0x37')][_0x4318('0x21')]);}_0x105cef[_0x4318('0x40')]=qs[_0x4318('0x41')](_0xb0972e['query'][_0x4318('0x41')]);_0x105cef[_0x4318('0x42')]=qs[_0x4318('0x39')](_[_0x4318('0x59')](_0xb0972e[_0x4318('0x37')],_0x5665e2[_0x4318('0x39')]));_0x105cef['where'][_0x4318('0x5a')]=_0x46d133['id'];if(_0xb0972e['query'][_0x4318('0x43')]){_0x105cef[_0x4318('0x42')]=_[_0x4318('0x5b')](_0x105cef[_0x4318('0x42')],{'$or':_['map'](_0x105cef[_0x4318('0x3b')],function(_0x81be4b){var _0x1eca15={};_0x1eca15[_0x81be4b]={'$like':'%'+_0xb0972e[_0x4318('0x37')][_0x4318('0x43')]+'%'};return _0x1eca15;})});}_0x105cef=_[_0x4318('0x5b')]({},_0x105cef,_0xb0972e[_0x4318('0x45')]);return db['UserMailQueue'][_0x4318('0x48')](_0x105cef);}})['then'](function(_0x3ea82c){if(_0x3ea82c){return db['User'][_0x4318('0x5c')]({'where':{'id':_[_0x4318('0x30')](_0x3ea82c,_0x4318('0x5d')),'role':_0x4318('0x5e')},'attributes':['id',_0x4318('0x2d'),_0x4318('0x5f'),_0x4318('0x60'),_0x4318('0x61')]});}})[_0x4318('0x27')](function(_0x5c1cf4){if(_0x5c1cf4){return{'count':_0x5c1cf4[_0x4318('0x20')],'rows':_[_0x4318('0x30')](_0x5c1cf4[_0x4318('0x62')],function(_0x10e2d7){return{'membername':_0x10e2d7[_0x4318('0x2d')],'UserId':_0x10e2d7['id'],'queue_name':_0x4fbadb[_0x4318('0x2d')],'MailQueueId':_0x4fbadb['id'],'interface':util[_0x4318('0x63')](_0x4318('0x64'),'SIP',_0x10e2d7['name']),'penalty':0x0,'paused':_0x10e2d7[_0x4318('0x5f')],'createdAt':_0x10e2d7[_0x4318('0x61')],'updatedAt':_0x10e2d7[_0x4318('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4318('0x27')](respondWithFilteredResult(_0x20baab,_0x105cef))[_0x4318('0x4c')](handleError(_0x20baab,null));};exports[_0x4318('0x65')]=function(_0x5bf8c3,_0x376cc3,_0x25f976){var _0x237cf3={};var _0x120738={};var _0x2db404;var _0x173687;return db[_0x4318('0x31')][_0x4318('0x57')]({'where':{'id':_0x5bf8c3[_0x4318('0x4a')]['id']}})[_0x4318('0x27')](handleEntityNotFound(_0x376cc3,null))['then'](function(_0x16993b){if(_0x16993b){_0x2db404=_0x16993b;_0x120738['model']=_[_0x4318('0x38')](db[_0x4318('0x66')][_0x4318('0x32')]);_0x120738[_0x4318('0x37')]=_[_0x4318('0x38')](_0x5bf8c3[_0x4318('0x37')]);_0x120738['filters']=_[_0x4318('0x3a')](_0x120738[_0x4318('0x36')],_0x120738[_0x4318('0x37')]);_0x237cf3[_0x4318('0x3b')]=_[_0x4318('0x3a')](_0x120738[_0x4318('0x36')],qs[_0x4318('0x3c')](_0x5bf8c3[_0x4318('0x37')]['fields']));_0x237cf3[_0x4318('0x3b')]=_0x237cf3[_0x4318('0x3b')][_0x4318('0x3d')]?_0x237cf3['attributes']:_0x120738[_0x4318('0x36')];_0x237cf3[_0x4318('0x40')]=qs[_0x4318('0x41')](_0x5bf8c3[_0x4318('0x37')]['sort']);_0x237cf3['where']=qs[_0x4318('0x39')](_[_0x4318('0x59')](_0x5bf8c3[_0x4318('0x37')],_0x120738[_0x4318('0x39')]));if(_0x5bf8c3['query'][_0x4318('0x43')]){_0x237cf3['where']=_[_0x4318('0x5b')](_0x237cf3[_0x4318('0x42')],{'$or':_[_0x4318('0x30')](_0x237cf3['attributes'],function(_0x3b01c5){var _0x322b42={};_0x322b42[_0x3b01c5]={'$like':'%'+_0x5bf8c3['query'][_0x4318('0x43')]+'%'};return _0x322b42;})});}_0x237cf3=_['merge']({},_0x237cf3,_0x5bf8c3[_0x4318('0x45')]);return _0x2db404['getTeams'](_0x237cf3);}})[_0x4318('0x27')](function(_0x717b61){if(_0x717b61){_0x173687=_0x717b61[_0x4318('0x3d')];if(!_0x5bf8c3['query'][_0x4318('0x3e')](_0x4318('0x3f'))){_0x237cf3['limit']=qs[_0x4318('0x22')](_0x5bf8c3[_0x4318('0x37')][_0x4318('0x22')]);_0x237cf3[_0x4318('0x21')]=qs[_0x4318('0x21')](_0x5bf8c3[_0x4318('0x37')][_0x4318('0x21')]);}return _0x2db404['getTeams'](_0x237cf3);}})[_0x4318('0x27')](function(_0x3a0791){if(_0x3a0791){return _0x3a0791?{'count':_0x173687,'rows':_0x3a0791}:null;}})['then'](respondWithResult(_0x376cc3,null))[_0x4318('0x4c')](handleError(_0x376cc3,null));};exports['addTeams']=function(_0x58e127,_0x497d10,_0x1d1752){var _0x83b0a0=_0x58e127[_0x4318('0x4e')]['ids'];return db[_0x4318('0x66')][_0x4318('0x48')]({'where':{'id':_0x83b0a0},'attributes':['id'],'include':[{'model':db[_0x4318('0x67')],'as':_0x4318('0x68'),'attributes':['id',_0x4318('0x2d'),'online',_0x4318('0x69'),'interface'],'raw':!![]}]})[_0x4318('0x27')](function(_0x5f3671){if(_0x5f3671){var _0x5134fa=_['flatMap'](_0x5f3671,function(_0x9d2c22){var _0x301cab=_0x9d2c22[_0x4318('0x29')]({'plain':!![]});return _0x301cab[_0x4318('0x68')];});return db[_0x4318('0x31')]['find']({'where':{'id':_0x58e127[_0x4318('0x4a')]['id']}})[_0x4318('0x27')](function(_0x165353){return db[_0x4318('0x6a')][_0x4318('0x6b')](function(_0x15330e){return _0x165353['addTeams'](_0x83b0a0,{'transaction':_0x15330e})['then'](function(){return BPromise['each'](_0x5134fa,function(_0x831f96){return db[_0x4318('0x58')][_0x4318('0x6c')]({'where':{'UserId':_0x831f96['id'],'MailQueueId':_0x58e127[_0x4318('0x4a')]['id']},'transaction':_0x15330e});});})[_0x4318('0x27')](function(){_0x5134fa[_0x4318('0x6d')](function(_0x17a5e2){socket[_0x4318('0x6e')]('userMailQueue:save',{'UserId':_0x17a5e2['id'],'MailQueueId':_0x165353['id']});});});});});}})[_0x4318('0x27')](respondWithStatusCode(_0x497d10,null))['catch'](handleError(_0x497d10,null));};exports[_0x4318('0x6f')]=function(_0xda055b,_0x5821bf,_0x237e6d){return db[_0x4318('0x66')][_0x4318('0x48')]({'where':{'id':_0xda055b[_0x4318('0x37')][_0x4318('0x70')]},'attributes':['id'],'include':[{'model':db[_0x4318('0x67')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5821bf,null))['then'](function(_0x58abed){var _0x3938b8=_['map'](_0x58abed,'id');var _0x5f7457=[];var _0x192fc5=[];var _0x5d9fa0=squel['select']();_0x5d9fa0[_0x4318('0x71')]('tq.TeamId')[_0x4318('0x72')](_0x4318('0x73'),'tq')[_0x4318('0x74')](_0x4318('0x75'),'ut',_0x4318('0x76'))[_0x4318('0x42')](_0x4318('0x77'),_0xda055b[_0x4318('0x4a')]['id']);for(var _0x4fad53=0x0;_0x4fad53<_0x58abed[_0x4318('0x3d')];_0x4fad53+=0x1){let _0x30af04=_0x58abed[_0x4fad53];for(var _0x16690f=0x0;_0x16690f<_0x30af04['Agents'][_0x4318('0x3d')];_0x16690f+=0x1){let _0x2beb0e=_0x30af04[_0x4318('0x68')][_0x16690f];var _0x562870=_0x5d9fa0[_0x4318('0x78')]();_0x562870[_0x4318('0x42')](_0x4318('0x79'),_0x2beb0e['id']);_0x192fc5[_0x4318('0x7a')](db[_0x4318('0x6a')]['query'](_0x562870[_0x4318('0x7b')](),{'type':db[_0x4318('0x6a')][_0x4318('0x7c')][_0x4318('0x7d')]})[_0x4318('0x27')](function(_0x330131){if(_0x330131['length']===0x1){return _0x2beb0e['id'];}else{var _0x3148be=_['every'](_[_0x4318('0x30')](_0x330131,_0x4318('0x7e')),function(_0x1dc554){return _[_0x4318('0x7f')](_0x3938b8,_0x1dc554);});if(_0x3148be){return _0x2beb0e['id'];}}}));}}return BPromise[_0x4318('0x80')](_0x192fc5)['then'](function(_0x7e690e){_0x5f7457=_(_0x5f7457)['union'](_0x7e690e)[_0x4318('0x81')]()['value']();return db['MailQueue']['find']({'where':{'id':_0xda055b[_0x4318('0x4a')]['id']}})['then'](function(_0x4bfbf2){return db[_0x4318('0x6a')][_0x4318('0x6b')](function(_0x135696){return _0x4bfbf2[_0x4318('0x6f')](_0xda055b['query'][_0x4318('0x70')],{'transaction':_0x135696})[_0x4318('0x27')](function(){if(!_[_0x4318('0x82')](_0x5f7457)){return _0x4bfbf2[_0x4318('0x83')](_0x5f7457,{'transaction':_0x135696});}})[_0x4318('0x27')](function(){_0x5f7457[_0x4318('0x6d')](function(_0x1ff34c){socket[_0x4318('0x6e')](_0x4318('0x84'),{'UserId':_0x1ff34c,'MailQueueId':_0x4bfbf2['id']});});});});});});})[_0x4318('0x27')](respondWithStatusCode(_0x5821bf,null))[_0x4318('0x4c')](handleError(_0x5821bf,null));};exports[_0x4318('0x85')]=function(_0x4bf3b6,_0x3bd854,_0x2968ae){return db[_0x4318('0x31')][_0x4318('0x4b')]({'where':{'id':_0x4bf3b6[_0x4318('0x4a')]['id']}})[_0x4318('0x27')](handleEntityNotFound(_0x3bd854,null))[_0x4318('0x27')](function(_0x436735){if(_0x436735){return _0x436735['addAgents'](_0x4bf3b6[_0x4318('0x4e')][_0x4318('0x70')],_[_0x4318('0x86')](_0x4bf3b6['body'],[_0x4318('0x70'),'id'])||{})[_0x4318('0x87')](function(_0x42c9b7){for(var _0x359466=0x0;_0x359466<_0x4bf3b6['body'][_0x4318('0x70')]['length'];_0x359466+=0x1){socket[_0x4318('0x6e')](_0x4318('0x88'),{'UserId':_0x4bf3b6[_0x4318('0x4e')][_0x4318('0x70')][_0x359466],'MailQueueId':_0x4bf3b6['params']['id']});}return _0x42c9b7;});}})[_0x4318('0x27')](respondWithResult(_0x3bd854,null))[_0x4318('0x4c')](handleError(_0x3bd854,null));};exports[_0x4318('0x83')]=function(_0x109dfd,_0xfa6055,_0x349965){return db['MailQueue']['find']({'where':{'id':_0x109dfd[_0x4318('0x4a')]['id']}})[_0x4318('0x27')](handleEntityNotFound(_0xfa6055,null))[_0x4318('0x27')](function(_0x3526ba){if(_0x3526ba){return _0x3526ba[_0x4318('0x83')](_0x109dfd[_0x4318('0x37')][_0x4318('0x70')])[_0x4318('0x27')](function(){if(_['isArray'](_0x109dfd['query'][_0x4318('0x70')])){for(var _0x3678a4=0x0;_0x3678a4<_0x109dfd[_0x4318('0x37')]['ids']['length'];_0x3678a4+=0x1){socket['emit']('userMailQueue:remove',{'UserId':Number(_0x109dfd[_0x4318('0x37')][_0x4318('0x70')][_0x3678a4]),'MailQueueId':Number(_0x109dfd[_0x4318('0x4a')]['id'])});}}else{socket[_0x4318('0x6e')](_0x4318('0x84'),{'UserId':Number(_0x109dfd[_0x4318('0x37')]['ids']),'MailQueueId':Number(_0x109dfd['params']['id'])});}});}})[_0x4318('0x27')](respondWithStatusCode(_0xfa6055,null))['catch'](handleError(_0xfa6055,null));};exports[_0x4318('0x89')]=function(_0x4af4aa,_0x25ac94,_0x54ed47){var _0x4f54db={};var _0x161c6d={};var _0x2bdbbd;var _0x40d390;return db[_0x4318('0x31')][_0x4318('0x57')]({'where':{'id':_0x4af4aa['params']['id']}})[_0x4318('0x27')](handleEntityNotFound(_0x25ac94,null))[_0x4318('0x27')](function(_0x1d0c26){if(_0x1d0c26){_0x2bdbbd=_0x1d0c26;_0x161c6d[_0x4318('0x36')]=_[_0x4318('0x38')](db[_0x4318('0x67')][_0x4318('0x32')]);_0x161c6d['query']=_['keys'](_0x4af4aa[_0x4318('0x37')]);_0x161c6d[_0x4318('0x39')]=_[_0x4318('0x3a')](_0x161c6d[_0x4318('0x36')],_0x161c6d[_0x4318('0x37')]);_0x4f54db[_0x4318('0x3b')]=_['intersection'](_0x161c6d['model'],qs[_0x4318('0x3c')](_0x4af4aa[_0x4318('0x37')]['fields']));_0x4f54db['attributes']=_0x4f54db[_0x4318('0x3b')][_0x4318('0x3d')]?_0x4f54db['attributes']:_0x161c6d[_0x4318('0x36')];_0x4f54db['order']=qs[_0x4318('0x41')](_0x4af4aa['query'][_0x4318('0x41')]);_0x4f54db['where']=qs[_0x4318('0x39')](_[_0x4318('0x59')](_0x4af4aa['query'],_0x161c6d[_0x4318('0x39')]));if(_0x4af4aa[_0x4318('0x37')][_0x4318('0x43')]){_0x4f54db[_0x4318('0x42')]=_['merge'](_0x4f54db[_0x4318('0x42')],{'$or':_[_0x4318('0x30')](_0x4f54db[_0x4318('0x3b')],function(_0x285f1e){var _0x5934c6={};_0x5934c6[_0x285f1e]={'$like':'%'+_0x4af4aa[_0x4318('0x37')]['filter']+'%'};return _0x5934c6;})});}_0x4f54db=_['merge']({},_0x4f54db,_0x4af4aa['options']);return _0x2bdbbd['getAgents'](_0x4f54db);}})[_0x4318('0x27')](function(_0x14ffd8){if(_0x14ffd8){_0x40d390=_0x14ffd8['length'];if(!_0x4af4aa[_0x4318('0x37')][_0x4318('0x3e')](_0x4318('0x3f'))){_0x4f54db[_0x4318('0x22')]=qs[_0x4318('0x22')](_0x4af4aa[_0x4318('0x37')][_0x4318('0x22')]);_0x4f54db[_0x4318('0x21')]=qs[_0x4318('0x21')](_0x4af4aa[_0x4318('0x37')][_0x4318('0x21')]);}return _0x2bdbbd[_0x4318('0x89')](_0x4f54db);}})['then'](function(_0x1c6e2b){if(_0x1c6e2b){return _0x1c6e2b?{'count':_0x40d390,'rows':_0x1c6e2b}:null;}})['then'](respondWithResult(_0x25ac94,null))['catch'](handleError(_0x25ac94,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 7f0674c..f18bac8 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 _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 +var _0xf853=['MailQueue','setMaxListeners','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x58a058,_0x5965eb){var _0x347664=function(_0x2d24db){while(--_0x2d24db){_0x58a058['push'](_0x58a058['shift']());}};_0x347664(++_0x5965eb);}(_0xf853,0x154));var _0x3f85=function(_0x9b3efc,_0x577a0d){_0x9b3efc=_0x9b3efc-0x0;var _0x200f05=_0xf853[_0x9b3efc];return _0x200f05;};'use strict';var EventEmitter=require(_0x3f85('0x0'));var MailQueue=require(_0x3f85('0x1'))['db'][_0x3f85('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x3f85('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x136a3b){return function(_0x20742c,_0x2902fc,_0x16e63c){MailQueueEvents['emit'](_0x136a3b+':'+_0x20742c['id'],_0x20742c);MailQueueEvents['emit'](_0x136a3b,_0x20742c);_0x16e63c(null);};}for(var e in events){if(events[_0x3f85('0x4')](e)){var event=events[e];MailQueue[_0x3f85('0x5')](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 ce11340..4d43310 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 _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 +var _0x57af=['../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2f3ecd,_0x57976b){var _0xffdc44=function(_0xf21bc6){while(--_0xf21bc6){_0x2f3ecd['push'](_0x2f3ecd['shift']());}};_0xffdc44(++_0x57976b);}(_0x57af,0x76));var _0xf57a=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x57af[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xf57a('0x0'));var util=require(_0xf57a('0x1'));var logger=require('../../config/logger')(_0xf57a('0x2'));var moment=require(_0xf57a('0x3'));var BPromise=require(_0xf57a('0x4'));var rp=require(_0xf57a('0x5'));var fs=require('fs');var path=require(_0xf57a('0x6'));var rimraf=require(_0xf57a('0x7'));var config=require(_0xf57a('0x8'));var attributes=require(_0xf57a('0x9'));module[_0xf57a('0xa')]=function(_0x5d6388,_0xdf0098){return _0x5d6388[_0xf57a('0xb')](_0xf57a('0xc'),attributes,{'tableName':_0xf57a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index a6fd512..61a7252 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 _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 +var _0x6c24=['attributes','limit','include','map','model','debug','ShowMailQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailQueue','MailQueue','options','raw','where'];(function(_0x1093c0,_0x5b0e21){var _0x5cc0b8=function(_0x1d24b8){while(--_0x1d24b8){_0x1093c0['push'](_0x1093c0['shift']());}};_0x5cc0b8(++_0x5b0e21);}(_0x6c24,0x1cb));var _0x46c2=function(_0x248fcd,_0x2aa7cd){_0x248fcd=_0x248fcd-0x0;var _0x56a9ce=_0x6c24[_0x248fcd];return _0x56a9ce;};'use strict';var _=require(_0x46c2('0x0'));var util=require(_0x46c2('0x1'));var moment=require(_0x46c2('0x2'));var BPromise=require(_0x46c2('0x3'));var rs=require(_0x46c2('0x4'));var fs=require('fs');var Redis=require(_0x46c2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x46c2('0x6'));var logger=require(_0x46c2('0x7'))(_0x46c2('0x8'));var config=require('../../config/environment');var jayson=require(_0x46c2('0x9'));var client=jayson[_0x46c2('0xa')][_0x46c2('0xb')]({'port':0x232a});config[_0x46c2('0xc')]=_[_0x46c2('0xd')](config[_0x46c2('0xc')],{'host':_0x46c2('0xe'),'port':0x18eb});var socket=require(_0x46c2('0xf'))(new Redis(config['redis']));require(_0x46c2('0x10'))[_0x46c2('0x11')](socket);function respondWithRpcPromise(_0x5b4a49,_0x283d76,_0x3823e2){return new BPromise(function(_0x4e6ef8,_0x1bc8f8){return client['request'](_0x5b4a49,_0x3823e2)[_0x46c2('0x12')](function(_0x4d343f){logger[_0x46c2('0x13')](_0x46c2('0x14'),_0x283d76,_0x46c2('0x15'));logger['debug'](_0x46c2('0x16'),_0x283d76,'request\x20sent',JSON[_0x46c2('0x17')](_0x4d343f));if(_0x4d343f[_0x46c2('0x18')]){if(_0x4d343f['error']['code']===0x1f4){logger[_0x46c2('0x18')]('MailQueue,\x20%s,\x20%s',_0x283d76,_0x4d343f[_0x46c2('0x18')][_0x46c2('0x19')]);return _0x1bc8f8(_0x4d343f[_0x46c2('0x18')][_0x46c2('0x19')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0x283d76,_0x4d343f[_0x46c2('0x18')][_0x46c2('0x19')]);return _0x4e6ef8(_0x4d343f[_0x46c2('0x18')][_0x46c2('0x19')]);}else{logger[_0x46c2('0x13')]('MailQueue,\x20%s,\x20%s',_0x283d76,_0x46c2('0x15'));_0x4e6ef8(_0x4d343f[_0x46c2('0x1a')][_0x46c2('0x19')]);}})[_0x46c2('0x1b')](function(_0x2aa4a7){logger[_0x46c2('0x18')](_0x46c2('0x14'),_0x283d76,_0x2aa4a7);_0x1bc8f8(_0x2aa4a7);});});}exports[_0x46c2('0x1c')]=function(_0x3b57e0){var _0x145ad2=this;return new Promise(function(_0x3d9670,_0x282155){return db[_0x46c2('0x1d')]['findAll']({'raw':_0x3b57e0['options']?_0x3b57e0[_0x46c2('0x1e')][_0x46c2('0x1f')]===undefined?!![]:![]:!![],'where':_0x3b57e0[_0x46c2('0x1e')]?_0x3b57e0[_0x46c2('0x1e')][_0x46c2('0x20')]||null:null,'attributes':_0x3b57e0[_0x46c2('0x1e')]?_0x3b57e0[_0x46c2('0x1e')][_0x46c2('0x21')]||null:null,'limit':_0x3b57e0[_0x46c2('0x1e')]?_0x3b57e0[_0x46c2('0x1e')][_0x46c2('0x22')]||null:null,'include':_0x3b57e0[_0x46c2('0x1e')]?_0x3b57e0[_0x46c2('0x1e')][_0x46c2('0x23')]?_[_0x46c2('0x24')](_0x3b57e0[_0x46c2('0x1e')][_0x46c2('0x23')],function(_0x5667d1){return{'model':db[_0x5667d1[_0x46c2('0x25')]],'as':_0x5667d1['as'],'attributes':_0x5667d1[_0x46c2('0x21')],'include':_0x5667d1[_0x46c2('0x23')]?_[_0x46c2('0x24')](_0x5667d1['include'],function(_0x1f421b){return{'model':db[_0x1f421b[_0x46c2('0x25')]],'as':_0x1f421b['as'],'attributes':_0x1f421b[_0x46c2('0x21')],'include':_0x1f421b[_0x46c2('0x23')]?_[_0x46c2('0x24')](_0x1f421b[_0x46c2('0x23')],function(_0x53e242){return{'model':db[_0x53e242['model']],'as':_0x53e242['as'],'attributes':_0x53e242[_0x46c2('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16b407){logger[_0x46c2('0x13')]('GetMailQueue',_0x3b57e0);logger[_0x46c2('0x26')](_0x46c2('0x1c'),_0x3b57e0,JSON[_0x46c2('0x17')](_0x16b407));_0x3d9670(_0x16b407);})[_0x46c2('0x1b')](function(_0x6e7f){logger['error'](_0x46c2('0x1c'),_0x6e7f[_0x46c2('0x19')],_0x3b57e0);_0x282155(_0x145ad2[_0x46c2('0x18')](0x1f4,_0x6e7f[_0x46c2('0x19')]));});});};exports[_0x46c2('0x27')]=function(_0x5a817b){var _0x35b3e9=this;return new Promise(function(_0x497018,_0x3efc2e){return db['MailQueue'][_0x46c2('0x28')]({'raw':_0x5a817b[_0x46c2('0x1e')]?_0x5a817b[_0x46c2('0x1e')][_0x46c2('0x1f')]===undefined?!![]:![]:!![],'where':_0x5a817b[_0x46c2('0x1e')]?_0x5a817b['options']['where']||null:null,'attributes':_0x5a817b[_0x46c2('0x1e')]?_0x5a817b[_0x46c2('0x1e')][_0x46c2('0x21')]||null:null,'include':_0x5a817b['options']?_0x5a817b['options'][_0x46c2('0x23')]?_[_0x46c2('0x24')](_0x5a817b[_0x46c2('0x1e')]['include'],function(_0x1a5eb8){return{'model':db[_0x1a5eb8[_0x46c2('0x25')]],'as':_0x1a5eb8['as'],'attributes':_0x1a5eb8['attributes'],'include':_0x1a5eb8[_0x46c2('0x23')]?_[_0x46c2('0x24')](_0x1a5eb8[_0x46c2('0x23')],function(_0x18aba4){return{'model':db[_0x18aba4[_0x46c2('0x25')]],'as':_0x18aba4['as'],'attributes':_0x18aba4[_0x46c2('0x21')],'include':_0x18aba4[_0x46c2('0x23')]?_['map'](_0x18aba4[_0x46c2('0x23')],function(_0x59468b){return{'model':db[_0x59468b['model']],'as':_0x59468b['as'],'attributes':_0x59468b[_0x46c2('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b465f){logger[_0x46c2('0x13')](_0x46c2('0x27'),_0x5a817b);logger['debug'](_0x46c2('0x27'),_0x5a817b,JSON[_0x46c2('0x17')](_0x4b465f));_0x497018(_0x4b465f);})[_0x46c2('0x1b')](function(_0x4e11bb){logger[_0x46c2('0x18')]('ShowMailQueue',_0x4e11bb['message'],_0x5a817b);_0x3efc2e(_0x35b3e9['error'](0x1f4,_0x4e11bb[_0x46c2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 214e5cd..e6e16e7 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 _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 +var _0xc3fe=['emit','length','mailQueue:','./mailQueue.events','update'];(function(_0x2a7a0e,_0x217e41){var _0x3eaeaf=function(_0x125c2c){while(--_0x125c2c){_0x2a7a0e['push'](_0x2a7a0e['shift']());}};_0x3eaeaf(++_0x217e41);}(_0xc3fe,0x116));var _0xec3f=function(_0x3f0042,_0x28f8af){_0x3f0042=_0x3f0042-0x0;var _0x52554c=_0xc3fe[_0x3f0042];return _0x52554c;};'use strict';var MailQueueEvents=require(_0xec3f('0x0'));var events=['save','remove',_0xec3f('0x1')];function createListener(_0x507df8,_0xaaccee){return function(_0x228867){_0xaaccee[_0xec3f('0x2')](_0x507df8,_0x228867);};}function removeListener(_0x39dcce,_0x1b9f23){return function(){MailQueueEvents['removeListener'](_0x39dcce,_0x1b9f23);};}exports['register']=function(_0x378c6f){for(var _0x47ee64=0x0,_0x1ae7e8=events[_0xec3f('0x3')];_0x47ee64<_0x1ae7e8;_0x47ee64++){var _0xb78b2e=events[_0x47ee64];var _0x588130=createListener(_0xec3f('0x4')+_0xb78b2e,_0x378c6f);MailQueueEvents['on'](_0xb78b2e,_0x588130);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index c9a982d..1f17b2f 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 _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 +var _0x68b9=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x564c46,_0xd7012){var _0x5a2ec7=function(_0x4191c5){while(--_0x4191c5){_0x564c46['push'](_0x564c46['shift']());}};_0x5a2ec7(++_0xd7012);}(_0x68b9,0x142));var _0x968b=function(_0x1876b2,_0x5d0225){_0x1876b2=_0x1876b2-0x0;var _0x9fb1e0=_0x68b9[_0x1876b2];return _0x9fb1e0;};'use strict';var multer=require(_0x968b('0x0'));var util=require(_0x968b('0x1'));var path=require(_0x968b('0x2'));var timeout=require(_0x968b('0x3'));var express=require(_0x968b('0x4'));var router=express[_0x968b('0x5')]();var auth=require(_0x968b('0x6'));var interaction=require(_0x968b('0x7'));var config=require(_0x968b('0x8'));var controller=require(_0x968b('0x9'));router[_0x968b('0xa')]('/',auth[_0x968b('0xb')](),controller[_0x968b('0xc')]);router['get'](_0x968b('0xd'),auth[_0x968b('0xb')](),controller[_0x968b('0xe')]);router[_0x968b('0xa')](_0x968b('0xf'),auth['isAuthenticated'](),controller[_0x968b('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x968b('0x11')]);router[_0x968b('0x12')](_0x968b('0xf'),auth[_0x968b('0xb')](),controller[_0x968b('0x13')]);router[_0x968b('0x14')](_0x968b('0xf'),auth[_0x968b('0xb')](),controller[_0x968b('0x15')]);module[_0x968b('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index c709ba3..71136d5 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 _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 +var _0xd45a=['sequelize','STRING','DATE','moment'];(function(_0x13b85f,_0x3ea073){var _0x5ed0c7=function(_0x2aaeb1){while(--_0x2aaeb1){_0x13b85f['push'](_0x13b85f['shift']());}};_0x5ed0c7(++_0x3ea073);}(_0xd45a,0x7f));var _0xad45=function(_0x43eb6c,_0x4991be){_0x43eb6c=_0x43eb6c-0x0;var _0x3d4113=_0xd45a[_0x43eb6c];return _0x3d4113;};'use strict';var moment=require(_0xad45('0x0'));var Sequelize=require(_0xad45('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xad45('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xad45('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xad45('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xad45('0x3')]},'reason':{'type':Sequelize[_0xad45('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 9840254..6729257 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 _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 +var _0x749a=['key','keys','intersection','query','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','count','includeAll','include','findAll','rows','catch','show','params','MailQueueReport','rawAttributes','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','fieldName','type'];(function(_0x3422d3,_0x42d94d){var _0x42be94=function(_0x57ec9c){while(--_0x57ec9c){_0x3422d3['push'](_0x3422d3['shift']());}};_0x42be94(++_0x42d94d);}(_0x749a,0xbe));var _0xa749=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x749a[_0x59ee6f];return _0x4c0979;};'use strict';var pdf=require(_0xa749('0x0'));var emlformat=require(_0xa749('0x1'));var rimraf=require(_0xa749('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa749('0x3'));var rp=require('request-promise');var moment=require(_0xa749('0x4'));var BPromise=require(_0xa749('0x5'));var Mustache=require(_0xa749('0x6'));var util=require(_0xa749('0x7'));var path=require('path');var sox=require(_0xa749('0x8'));var csv=require(_0xa749('0x9'));var ejs=require(_0xa749('0xa'));var fs=require('fs');var _=require(_0xa749('0xb'));var squel=require(_0xa749('0xc'));var crypto=require(_0xa749('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa749('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa749('0xf'));var Papa=require(_0xa749('0x10'));var Redis=require(_0xa749('0x11'));var authService=require(_0xa749('0x12'));var qs=require(_0xa749('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa749('0x14'));var logger=require(_0xa749('0x15'))(_0xa749('0x16'));var utils=require(_0xa749('0x17'));var config=require(_0xa749('0x18'));var db=require(_0xa749('0x19'))['db'];function respondWithStatusCode(_0x400db4,_0x45e3d9){_0x45e3d9=_0x45e3d9||0xcc;return function(_0x1a1379){if(_0x1a1379){return _0x400db4[_0xa749('0x1a')](_0x45e3d9);}return _0x400db4[_0xa749('0x1b')](_0x45e3d9)[_0xa749('0x1c')]();};}function respondWithResult(_0x3f9e30,_0x5eae34){_0x5eae34=_0x5eae34||0xc8;return function(_0x450f6d){if(_0x450f6d){return _0x3f9e30[_0xa749('0x1b')](_0x5eae34)[_0xa749('0x1d')](_0x450f6d);}};}function respondWithFilteredResult(_0x2cacaa,_0x2e46e7){return function(_0x3bcf79){if(_0x3bcf79){var _0x4fc2ff=_0x3bcf79['count'],_0xaf116c=_0x2e46e7[_0xa749('0x1e')],_0x274152=_0x2e46e7[_0xa749('0x1e')]+_0x2e46e7[_0xa749('0x1f')],_0x4935f3;if(_0x274152>=_0x4fc2ff){_0x274152=_0x4fc2ff;_0x4935f3=0xc8;}else{_0x4935f3=0xce;}_0x2cacaa[_0xa749('0x1b')](_0x4935f3);return _0x2cacaa[_0xa749('0x20')](_0xa749('0x21'),_0xaf116c+'-'+_0x274152+'/'+_0x4fc2ff)[_0xa749('0x1d')](_0x3bcf79);}return null;};}function patchUpdates(_0x367957){return function(_0x501893){try{jsonpatch[_0xa749('0x22')](_0x501893,_0x367957,!![]);}catch(_0x399d88){return BPromise[_0xa749('0x23')](_0x399d88);}return _0x501893[_0xa749('0x24')]();};}function saveUpdates(_0x474c60,_0x572237){return function(_0x2ee317){if(_0x2ee317){return _0x2ee317[_0xa749('0x25')](_0x474c60)[_0xa749('0x26')](function(_0x4b9244){return _0x4b9244;});}return null;};}function removeEntity(_0x1d2a8c,_0x444522){return function(_0x250ce1){if(_0x250ce1){return _0x250ce1[_0xa749('0x27')]()[_0xa749('0x26')](function(){_0x1d2a8c[_0xa749('0x1b')](0xcc)[_0xa749('0x1c')]();});}};}function handleEntityNotFound(_0x35b7dc,_0xc3e2e4){return function(_0x2b349a){if(!_0x2b349a){_0x35b7dc['sendStatus'](0x194);}return _0x2b349a;};}function handleError(_0x3d556f,_0x1c21f4){_0x1c21f4=_0x1c21f4||0x1f4;return function(_0x46c014){logger[_0xa749('0x28')](_0x46c014['stack']);if(_0x46c014[_0xa749('0x29')]){delete _0x46c014['name'];}_0x3d556f[_0xa749('0x1b')](_0x1c21f4)[_0xa749('0x2a')](_0x46c014);};}exports[_0xa749('0x2b')]=function(_0x1f5d67,_0x41c122){var _0xec7ad0={},_0x380192={},_0x355399={'count':0x0,'rows':[]};var _0x5e94f4=_[_0xa749('0x2c')](db['MailQueueReport']['rawAttributes'],function(_0x2f592d){return{'name':_0x2f592d[_0xa749('0x2d')],'type':_0x2f592d[_0xa749('0x2e')][_0xa749('0x2f')]};});_0x380192['model']=_[_0xa749('0x2c')](_0x5e94f4,_0xa749('0x29'));_0x380192['query']=_[_0xa749('0x30')](_0x1f5d67['query']);_0x380192['filters']=_[_0xa749('0x31')](_0x380192['model'],_0x380192[_0xa749('0x32')]);_0xec7ad0[_0xa749('0x33')]=_['intersection'](_0x380192[_0xa749('0x34')],qs[_0xa749('0x35')](_0x1f5d67[_0xa749('0x32')][_0xa749('0x35')]));_0xec7ad0[_0xa749('0x33')]=_0xec7ad0['attributes'][_0xa749('0x36')]?_0xec7ad0[_0xa749('0x33')]:_0x380192[_0xa749('0x34')];if(!_0x1f5d67[_0xa749('0x32')][_0xa749('0x37')](_0xa749('0x38'))){_0xec7ad0[_0xa749('0x1f')]=qs[_0xa749('0x1f')](_0x1f5d67['query'][_0xa749('0x1f')]);_0xec7ad0[_0xa749('0x1e')]=qs[_0xa749('0x1e')](_0x1f5d67[_0xa749('0x32')]['offset']);}_0xec7ad0[_0xa749('0x39')]=qs[_0xa749('0x3a')](_0x1f5d67[_0xa749('0x32')][_0xa749('0x3a')]);_0xec7ad0['where']=qs[_0xa749('0x3b')](_[_0xa749('0x3c')](_0x1f5d67[_0xa749('0x32')],_0x380192['filters']),_0x5e94f4);if(_0x1f5d67[_0xa749('0x32')][_0xa749('0x3d')]){_0xec7ad0[_0xa749('0x3e')]=_[_0xa749('0x3f')](_0xec7ad0['where'],{'$or':_['map'](_0x5e94f4,function(_0x3f5a09){if(_0x3f5a09['type']!=='VIRTUAL'){var _0x14e8fc={};_0x14e8fc[_0x3f5a09[_0xa749('0x29')]]={'$like':'%'+_0x1f5d67['query'][_0xa749('0x3d')]+'%'};return _0x14e8fc;}})});}_0xec7ad0=_[_0xa749('0x3f')]({},_0xec7ad0,_0x1f5d67[_0xa749('0x40')]);var _0x54a66b={'where':_0xec7ad0[_0xa749('0x3e')]};return db['MailQueueReport'][_0xa749('0x41')](_0x54a66b)[_0xa749('0x26')](function(_0x10ea69){_0x355399[_0xa749('0x41')]=_0x10ea69;if(_0x1f5d67[_0xa749('0x32')][_0xa749('0x42')]){_0xec7ad0[_0xa749('0x43')]=[{'all':!![]}];}return db['MailQueueReport'][_0xa749('0x44')](_0xec7ad0);})[_0xa749('0x26')](function(_0x364ae1){_0x355399[_0xa749('0x45')]=_0x364ae1;return _0x355399;})[_0xa749('0x26')](respondWithFilteredResult(_0x41c122,_0xec7ad0))[_0xa749('0x46')](handleError(_0x41c122,null));};exports[_0xa749('0x47')]=function(_0x2be992,_0x3dfb34){var _0x548e66={'raw':!![],'where':{'id':_0x2be992[_0xa749('0x48')]['id']}},_0x202cf1={};_0x202cf1[_0xa749('0x34')]=_[_0xa749('0x30')](db[_0xa749('0x49')][_0xa749('0x4a')]);_0x202cf1[_0xa749('0x32')]=_[_0xa749('0x30')](_0x2be992[_0xa749('0x32')]);_0x202cf1['filters']=_[_0xa749('0x31')](_0x202cf1['model'],_0x202cf1[_0xa749('0x32')]);_0x548e66[_0xa749('0x33')]=_[_0xa749('0x31')](_0x202cf1[_0xa749('0x34')],qs[_0xa749('0x35')](_0x2be992[_0xa749('0x32')]['fields']));_0x548e66[_0xa749('0x33')]=_0x548e66[_0xa749('0x33')][_0xa749('0x36')]?_0x548e66[_0xa749('0x33')]:_0x202cf1[_0xa749('0x34')];if(_0x2be992[_0xa749('0x32')]['includeAll']){_0x548e66[_0xa749('0x43')]=[{'all':!![]}];}_0x548e66=_[_0xa749('0x3f')]({},_0x548e66,_0x2be992['options']);return db[_0xa749('0x49')][_0xa749('0x4b')](_0x548e66)[_0xa749('0x26')](handleEntityNotFound(_0x3dfb34,null))[_0xa749('0x26')](respondWithResult(_0x3dfb34,null))[_0xa749('0x46')](handleError(_0x3dfb34,null));};exports[_0xa749('0x4c')]=function(_0x562410,_0x2180cd){return db['MailQueueReport'][_0xa749('0x4c')](_0x562410[_0xa749('0x4d')],{})[_0xa749('0x26')](respondWithResult(_0x2180cd,0xc9))['catch'](handleError(_0x2180cd,null));};exports[_0xa749('0x25')]=function(_0x2afb3c,_0x490861){if(_0x2afb3c[_0xa749('0x4d')]['id']){delete _0x2afb3c[_0xa749('0x4d')]['id'];}return db[_0xa749('0x49')][_0xa749('0x4b')]({'where':{'id':_0x2afb3c[_0xa749('0x48')]['id']}})[_0xa749('0x26')](handleEntityNotFound(_0x490861,null))[_0xa749('0x26')](saveUpdates(_0x2afb3c[_0xa749('0x4d')],null))[_0xa749('0x26')](respondWithResult(_0x490861,null))[_0xa749('0x46')](handleError(_0x490861,null));};exports['destroy']=function(_0xb3617e,_0x53dae9){return db[_0xa749('0x49')][_0xa749('0x4b')]({'where':{'id':_0xb3617e[_0xa749('0x48')]['id']}})[_0xa749('0x26')](handleEntityNotFound(_0x53dae9,null))[_0xa749('0x26')](removeEntity(_0x53dae9,null))[_0xa749('0x46')](handleError(_0x53dae9,null));};exports[_0xa749('0x4e')]=function(_0x464d09,_0x4f0baf){return db[_0xa749('0x49')][_0xa749('0x4e')]()['then'](respondWithResult(_0x4f0baf,null))[_0xa749('0x46')](handleError(_0x4f0baf,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 4049a7a..70b43ca 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 _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 +var _0xcc20=['exports','MailQueueReport','report_mail_queue','uniqueid','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xcc20,0x108));var _0x0cc2=function(_0x2deb38,_0xe86ff8){_0x2deb38=_0x2deb38-0x0;var _0x560599=_0xcc20[_0x2deb38];return _0x560599;};'use strict';var _=require(_0x0cc2('0x0'));var util=require(_0x0cc2('0x1'));var logger=require('../../config/logger')(_0x0cc2('0x2'));var moment=require(_0x0cc2('0x3'));var BPromise=require(_0x0cc2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0cc2('0x5'));var rimraf=require(_0x0cc2('0x6'));var config=require(_0x0cc2('0x7'));var attributes=require(_0x0cc2('0x8'));module[_0x0cc2('0x9')]=function(_0x5bdc26,_0x142802){return _0x5bdc26['define'](_0x0cc2('0xa'),attributes,{'tableName':_0x0cc2('0xb'),'paranoid':![],'indexes':[{'name':_0x0cc2('0xc'),'fields':[_0x0cc2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 84d29a2..6c64c62 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 _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 +var _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x87a98a,_0x4a2144){var _0x45b7cd=function(_0x3f779a){while(--_0x3f779a){_0x87a98a['push'](_0x87a98a['shift']());}};_0x45b7cd(++_0x4a2144);}(_0xadb5,0xad));var _0x5adb=function(_0x22015e,_0x4513a4){_0x22015e=_0x22015e-0x0;var _0x393ee4=_0xadb5[_0x22015e];return _0x393ee4;};'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']('MailQueueReport,\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);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index dccb7bf..6f1694a 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 _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 +var _0xed98=['util','../../components/auth/service','../../config/environment','exports'];(function(_0x3c8d6c,_0x51ae3a){var _0x146521=function(_0x4cd1ed){while(--_0x4cd1ed){_0x3c8d6c['push'](_0x3c8d6c['shift']());}};_0x146521(++_0x51ae3a);}(_0xed98,0xb4));var _0x8ed9=function(_0x268c14,_0x2ed2a3){_0x268c14=_0x268c14-0x0;var _0x498731=_0xed98[_0x268c14];return _0x498731;};'use strict';var multer=require('multer');var util=require(_0x8ed9('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x8ed9('0x1'));var interaction=require('../../components/interaction/service');var config=require(_0x8ed9('0x2'));module[_0x8ed9('0x3')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 6437e15..51a360b 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 _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 +var _0xf1ba=['username','INTEGER','INBOX','sequelize','exports','BOOLEAN','STRING'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0xf1ba,0x1ed));var _0xaf1b=function(_0x2cb92,_0x32adc8){_0x2cb92=_0x2cb92-0x0;var _0x37b20f=_0xf1ba[_0x2cb92];return _0x37b20f;};'use strict';var Sequelize=require(_0xaf1b('0x0'));module[_0xaf1b('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xaf1b('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xaf1b('0x3')],'unique':_0xaf1b('0x4')},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xaf1b('0x5')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xaf1b('0x6')},'connTimeout':{'type':Sequelize[_0xaf1b('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xaf1b('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0xaf1b('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 7ef66bd..c0a6cca 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 _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 +var _0xae60=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','MailServerIn','mail_servers_in','lodash'];(function(_0x3929e1,_0x53fa82){var _0x80cc2f=function(_0x564d79){while(--_0x564d79){_0x3929e1['push'](_0x3929e1['shift']());}};_0x80cc2f(++_0x53fa82);}(_0xae60,0x1c7));var _0x0ae6=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0xae60[_0x11c573];return _0x6b72de;};'use strict';var _=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var logger=require(_0x0ae6('0x2'))('api');var moment=require(_0x0ae6('0x3'));var BPromise=require(_0x0ae6('0x4'));var rp=require(_0x0ae6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0ae6('0x6'));var config=require(_0x0ae6('0x7'));var attributes=require('./mailServerIn.attributes');module[_0x0ae6('0x8')]=function(_0x25ac7c,_0x30e000){return _0x25ac7c[_0x0ae6('0x9')](_0x0ae6('0xa'),attributes,{'tableName':_0x0ae6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 1754be7..2f24d49 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 _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 +var _0xe32e=['limit','include','map','model','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetMailServerIn','findAll','raw','options','where','attributes'];(function(_0x2ed4f4,_0x56f24f){var _0x58f9a0=function(_0x2519c9){while(--_0x2519c9){_0x2ed4f4['push'](_0x2ed4f4['shift']());}};_0x58f9a0(++_0x56f24f);}(_0xe32e,0x84));var _0xee32=function(_0x21f716,_0x869f33){_0x21f716=_0x21f716-0x0;var _0x416577=_0xe32e[_0x21f716];return _0x416577;};'use strict';var _=require(_0xee32('0x0'));var util=require('util');var moment=require(_0xee32('0x1'));var BPromise=require(_0xee32('0x2'));var rs=require(_0xee32('0x3'));var fs=require('fs');var Redis=require(_0xee32('0x4'));var db=require(_0xee32('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xee32('0x6'));var config=require(_0xee32('0x7'));var jayson=require(_0xee32('0x8'));var client=jayson[_0xee32('0x9')][_0xee32('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x594bb3,_0x516eb1,_0x5da266){return new BPromise(function(_0x50786f,_0x5d0804){return client[_0xee32('0xb')](_0x594bb3,_0x5da266)[_0xee32('0xc')](function(_0x2cfa02){logger[_0xee32('0xd')](_0xee32('0xe'),_0x516eb1,_0xee32('0xf'));logger[_0xee32('0x10')](_0xee32('0x11'),_0x516eb1,_0xee32('0xf'),JSON[_0xee32('0x12')](_0x2cfa02));if(_0x2cfa02[_0xee32('0x13')]){if(_0x2cfa02[_0xee32('0x13')]['code']===0x1f4){logger[_0xee32('0x13')](_0xee32('0xe'),_0x516eb1,_0x2cfa02['error'][_0xee32('0x14')]);return _0x5d0804(_0x2cfa02[_0xee32('0x13')][_0xee32('0x14')]);}logger[_0xee32('0x13')](_0xee32('0xe'),_0x516eb1,_0x2cfa02[_0xee32('0x13')][_0xee32('0x14')]);return _0x50786f(_0x2cfa02[_0xee32('0x13')][_0xee32('0x14')]);}else{logger[_0xee32('0xd')](_0xee32('0xe'),_0x516eb1,'request\x20sent');_0x50786f(_0x2cfa02['result'][_0xee32('0x14')]);}})[_0xee32('0x15')](function(_0x4e0376){logger['error'](_0xee32('0xe'),_0x516eb1,_0x4e0376);_0x5d0804(_0x4e0376);});});}exports[_0xee32('0x16')]=function(_0x1ca480){var _0x52a0e6=this;return new Promise(function(_0x132030,_0x3d13aa){return db['MailServerIn'][_0xee32('0x17')]({'raw':_0x1ca480['options']?_0x1ca480['options'][_0xee32('0x18')]===undefined?!![]:![]:!![],'where':_0x1ca480[_0xee32('0x19')]?_0x1ca480['options'][_0xee32('0x1a')]||null:null,'attributes':_0x1ca480[_0xee32('0x19')]?_0x1ca480[_0xee32('0x19')][_0xee32('0x1b')]||null:null,'limit':_0x1ca480[_0xee32('0x19')]?_0x1ca480[_0xee32('0x19')][_0xee32('0x1c')]||null:null,'include':_0x1ca480['options']?_0x1ca480['options'][_0xee32('0x1d')]?_[_0xee32('0x1e')](_0x1ca480[_0xee32('0x19')]['include'],function(_0x5e4512){return{'model':db[_0x5e4512[_0xee32('0x1f')]],'as':_0x5e4512['as'],'attributes':_0x5e4512[_0xee32('0x1b')],'include':_0x5e4512[_0xee32('0x1d')]?_[_0xee32('0x1e')](_0x5e4512[_0xee32('0x1d')],function(_0xaa4977){return{'model':db[_0xaa4977[_0xee32('0x1f')]],'as':_0xaa4977['as'],'attributes':_0xaa4977['attributes'],'include':_0xaa4977[_0xee32('0x1d')]?_[_0xee32('0x1e')](_0xaa4977['include'],function(_0x2e753b){return{'model':db[_0x2e753b[_0xee32('0x1f')]],'as':_0x2e753b['as'],'attributes':_0x2e753b[_0xee32('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xee32('0xc')](function(_0x19661a){logger['info'](_0xee32('0x16'),_0x1ca480);logger[_0xee32('0x10')](_0xee32('0x16'),_0x1ca480,JSON[_0xee32('0x12')](_0x19661a));_0x132030(_0x19661a);})[_0xee32('0x15')](function(_0x68bc4){logger['error'](_0xee32('0x16'),_0x68bc4[_0xee32('0x14')],_0x1ca480);_0x3d13aa(_0x52a0e6[_0xee32('0x13')](0x1f4,_0x68bc4[_0xee32('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 35e4879..c92fe48 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 _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 +var _0x4fe9=['create','/:id','update','delete','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','show','post'];(function(_0x109001,_0x4d19c7){var _0x4f3e91=function(_0x199b8e){while(--_0x199b8e){_0x109001['push'](_0x109001['shift']());}};_0x4f3e91(++_0x4d19c7);}(_0x4fe9,0x1e4));var _0x94fe=function(_0x194650,_0x234632){_0x194650=_0x194650-0x0;var _0x1aa406=_0x4fe9[_0x194650];return _0x1aa406;};'use strict';var multer=require(_0x94fe('0x0'));var util=require(_0x94fe('0x1'));var path=require(_0x94fe('0x2'));var timeout=require(_0x94fe('0x3'));var express=require('express');var router=express[_0x94fe('0x4')]();var auth=require(_0x94fe('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x94fe('0x6'));var controller=require('./mailServerOut.controller');router[_0x94fe('0x7')]('/',auth[_0x94fe('0x8')](),controller['index']);router[_0x94fe('0x7')]('/:id',auth[_0x94fe('0x8')](),controller[_0x94fe('0x9')]);router[_0x94fe('0xa')]('/',auth[_0x94fe('0x8')](),controller[_0x94fe('0xb')]);router['put'](_0x94fe('0xc'),auth['isAuthenticated'](),controller[_0x94fe('0xd')]);router[_0x94fe('0xe')](_0x94fe('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 5b731df..6e10c0d 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 _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 +var _0xcf71=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x32333f,_0x39d253){var _0x2bf86d=function(_0x3438ba){while(--_0x3438ba){_0x32333f['push'](_0x32333f['shift']());}};_0x2bf86d(++_0x39d253);}(_0xcf71,0xba));var _0x1cf7=function(_0x49fb87,_0x5d65bb){_0x49fb87=_0x49fb87-0x0;var _0x17db71=_0xcf71[_0x49fb87];return _0x17db71;};'use strict';var Sequelize=require(_0x1cf7('0x0'));module[_0x1cf7('0x1')]={'description':{'type':Sequelize[_0x1cf7('0x2')]},'host':{'type':Sequelize[_0x1cf7('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x1cf7('0x2')]},'port':{'type':Sequelize[_0x1cf7('0x3')]},'secure':{'type':Sequelize[_0x1cf7('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x1cf7('0x2')]},'authentication':{'type':Sequelize[_0x1cf7('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 5069f25..d9edba7 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 _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 +var _0x887b=['then','destroy','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filters','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','lodash','squel','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','save','update'];(function(_0x6b5efb,_0x5391cc){var _0x22962a=function(_0x49474e){while(--_0x49474e){_0x6b5efb['push'](_0x6b5efb['shift']());}};_0x22962a(++_0x5391cc);}(_0x887b,0x185));var _0xb887=function(_0x152628,_0x51c835){_0x152628=_0x152628-0x0;var _0x51ebb4=_0x887b[_0x152628];return _0x51ebb4;};'use strict';var pdf=require(_0xb887('0x0'));var emlformat=require(_0xb887('0x1'));var rimraf=require(_0xb887('0x2'));var zipdir=require(_0xb887('0x3'));var jsonpatch=require(_0xb887('0x4'));var rp=require(_0xb887('0x5'));var moment=require(_0xb887('0x6'));var BPromise=require(_0xb887('0x7'));var Mustache=require(_0xb887('0x8'));var util=require('util');var path=require(_0xb887('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb887('0xa'));var squel=require(_0xb887('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb887('0xc'));var toCsv=require(_0xb887('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb887('0xe'));var qs=require(_0xb887('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb887('0x10'));var logger=require('../../config/logger')(_0xb887('0x11'));var utils=require(_0xb887('0x12'));var config=require(_0xb887('0x13'));var db=require(_0xb887('0x14'))['db'];function respondWithStatusCode(_0x4a028f,_0x582f11){_0x582f11=_0x582f11||0xcc;return function(_0x2380d2){if(_0x2380d2){return _0x4a028f[_0xb887('0x15')](_0x582f11);}return _0x4a028f[_0xb887('0x16')](_0x582f11)[_0xb887('0x17')]();};}function respondWithResult(_0x1579b7,_0x5899bb){_0x5899bb=_0x5899bb||0xc8;return function(_0x387367){if(_0x387367){return _0x1579b7[_0xb887('0x16')](_0x5899bb)[_0xb887('0x18')](_0x387367);}};}function respondWithFilteredResult(_0x34174a,_0x7bac36){return function(_0x1b193c){if(_0x1b193c){var _0x2008e4=_0x1b193c[_0xb887('0x19')],_0x2b0f05=_0x7bac36[_0xb887('0x1a')],_0x36f47b=_0x7bac36['offset']+_0x7bac36['limit'],_0xcb6e66;if(_0x36f47b>=_0x2008e4){_0x36f47b=_0x2008e4;_0xcb6e66=0xc8;}else{_0xcb6e66=0xce;}_0x34174a[_0xb887('0x16')](_0xcb6e66);return _0x34174a[_0xb887('0x1b')]('Content-Range',_0x2b0f05+'-'+_0x36f47b+'/'+_0x2008e4)[_0xb887('0x18')](_0x1b193c);}return null;};}function patchUpdates(_0xde13de){return function(_0x334636){try{jsonpatch[_0xb887('0x1c')](_0x334636,_0xde13de,!![]);}catch(_0x25e5bc){return BPromise['reject'](_0x25e5bc);}return _0x334636[_0xb887('0x1d')]();};}function saveUpdates(_0x4c82e0,_0x5a9e68){return function(_0x68ef0a){if(_0x68ef0a){return _0x68ef0a[_0xb887('0x1e')](_0x4c82e0)[_0xb887('0x1f')](function(_0x5f3791){return _0x5f3791;});}return null;};}function removeEntity(_0x5e7e60,_0x101f64){return function(_0x4af881){if(_0x4af881){return _0x4af881[_0xb887('0x20')]()[_0xb887('0x1f')](function(){_0x5e7e60[_0xb887('0x16')](0xcc)[_0xb887('0x17')]();});}};}function handleEntityNotFound(_0x49a401,_0x17dd2f){return function(_0x4653c7){if(!_0x4653c7){_0x49a401[_0xb887('0x15')](0x194);}return _0x4653c7;};}function handleError(_0x4d290c,_0x297225){_0x297225=_0x297225||0x1f4;return function(_0x4b2a1f){logger[_0xb887('0x21')](_0x4b2a1f[_0xb887('0x22')]);if(_0x4b2a1f[_0xb887('0x23')]){delete _0x4b2a1f['name'];}_0x4d290c['status'](_0x297225)[_0xb887('0x24')](_0x4b2a1f);};}exports[_0xb887('0x25')]=function(_0x468b3f,_0x33113c){var _0x1300cf={},_0x233e78={},_0x4d1c2d={'count':0x0,'rows':[]};var _0xa5aab2=_[_0xb887('0x26')](db[_0xb887('0x27')][_0xb887('0x28')],function(_0x52585e){return{'name':_0x52585e[_0xb887('0x29')],'type':_0x52585e['type'][_0xb887('0x2a')]};});_0x233e78[_0xb887('0x2b')]=_[_0xb887('0x26')](_0xa5aab2,_0xb887('0x23'));_0x233e78['query']=_[_0xb887('0x2c')](_0x468b3f[_0xb887('0x2d')]);_0x233e78['filters']=_[_0xb887('0x2e')](_0x233e78[_0xb887('0x2b')],_0x233e78[_0xb887('0x2d')]);_0x1300cf['attributes']=_[_0xb887('0x2e')](_0x233e78['model'],qs[_0xb887('0x2f')](_0x468b3f['query'][_0xb887('0x2f')]));_0x1300cf[_0xb887('0x30')]=_0x1300cf[_0xb887('0x30')][_0xb887('0x31')]?_0x1300cf['attributes']:_0x233e78[_0xb887('0x2b')];if(!_0x468b3f[_0xb887('0x2d')][_0xb887('0x32')](_0xb887('0x33'))){_0x1300cf['limit']=qs[_0xb887('0x34')](_0x468b3f[_0xb887('0x2d')][_0xb887('0x34')]);_0x1300cf[_0xb887('0x1a')]=qs[_0xb887('0x1a')](_0x468b3f[_0xb887('0x2d')][_0xb887('0x1a')]);}_0x1300cf['order']=qs[_0xb887('0x35')](_0x468b3f[_0xb887('0x2d')]['sort']);_0x1300cf[_0xb887('0x36')]=qs[_0xb887('0x37')](_['pick'](_0x468b3f[_0xb887('0x2d')],_0x233e78[_0xb887('0x37')]),_0xa5aab2);if(_0x468b3f[_0xb887('0x2d')]['filter']){_0x1300cf['where']=_['merge'](_0x1300cf['where'],{'$or':_[_0xb887('0x26')](_0xa5aab2,function(_0x234afe){if(_0x234afe['type']!==_0xb887('0x38')){var _0x97c275={};_0x97c275[_0x234afe[_0xb887('0x23')]]={'$like':'%'+_0x468b3f['query'][_0xb887('0x39')]+'%'};return _0x97c275;}})});}_0x1300cf=_[_0xb887('0x3a')]({},_0x1300cf,_0x468b3f[_0xb887('0x3b')]);var _0x1e942f={'where':_0x1300cf[_0xb887('0x36')]};return db[_0xb887('0x27')][_0xb887('0x19')](_0x1e942f)[_0xb887('0x1f')](function(_0x293362){_0x4d1c2d[_0xb887('0x19')]=_0x293362;if(_0x468b3f[_0xb887('0x2d')][_0xb887('0x3c')]){_0x1300cf['include']=[{'all':!![]}];}return db['MailServerOut'][_0xb887('0x3d')](_0x1300cf);})[_0xb887('0x1f')](function(_0x1e93d1){_0x4d1c2d[_0xb887('0x3e')]=_0x1e93d1;return _0x4d1c2d;})[_0xb887('0x1f')](respondWithFilteredResult(_0x33113c,_0x1300cf))[_0xb887('0x3f')](handleError(_0x33113c,null));};exports[_0xb887('0x40')]=function(_0x4c9cf2,_0x4acfe7){var _0x3d2014={'raw':!![],'where':{'id':_0x4c9cf2[_0xb887('0x41')]['id']}},_0x15c20b={};_0x15c20b[_0xb887('0x2b')]=_['keys'](db['MailServerOut'][_0xb887('0x28')]);_0x15c20b[_0xb887('0x2d')]=_[_0xb887('0x2c')](_0x4c9cf2[_0xb887('0x2d')]);_0x15c20b[_0xb887('0x37')]=_[_0xb887('0x2e')](_0x15c20b[_0xb887('0x2b')],_0x15c20b[_0xb887('0x2d')]);_0x3d2014['attributes']=_[_0xb887('0x2e')](_0x15c20b['model'],qs[_0xb887('0x2f')](_0x4c9cf2[_0xb887('0x2d')]['fields']));_0x3d2014['attributes']=_0x3d2014[_0xb887('0x30')][_0xb887('0x31')]?_0x3d2014[_0xb887('0x30')]:_0x15c20b[_0xb887('0x2b')];if(_0x4c9cf2[_0xb887('0x2d')][_0xb887('0x3c')]){_0x3d2014[_0xb887('0x42')]=[{'all':!![]}];}_0x3d2014=_[_0xb887('0x3a')]({},_0x3d2014,_0x4c9cf2[_0xb887('0x3b')]);return db[_0xb887('0x27')][_0xb887('0x43')](_0x3d2014)['then'](handleEntityNotFound(_0x4acfe7,null))[_0xb887('0x1f')](respondWithResult(_0x4acfe7,null))['catch'](handleError(_0x4acfe7,null));};exports['create']=function(_0x459865,_0x9c4384){return db[_0xb887('0x27')][_0xb887('0x44')](_0x459865[_0xb887('0x45')],{})[_0xb887('0x1f')](respondWithResult(_0x9c4384,0xc9))['catch'](handleError(_0x9c4384,null));};exports['update']=function(_0x5a1457,_0x270db2){if(_0x5a1457[_0xb887('0x45')]['id']){delete _0x5a1457[_0xb887('0x45')]['id'];}return db[_0xb887('0x27')]['find']({'where':{'id':_0x5a1457['params']['id']}})[_0xb887('0x1f')](handleEntityNotFound(_0x270db2,null))[_0xb887('0x1f')](saveUpdates(_0x5a1457[_0xb887('0x45')],null))[_0xb887('0x1f')](respondWithResult(_0x270db2,null))[_0xb887('0x3f')](handleError(_0x270db2,null));};exports['destroy']=function(_0x4310f2,_0x3d1af4){return db[_0xb887('0x27')][_0xb887('0x43')]({'where':{'id':_0x4310f2[_0xb887('0x41')]['id']}})[_0xb887('0x1f')](handleEntityNotFound(_0x3d1af4,null))[_0xb887('0x1f')](removeEntity(_0x3d1af4,null))['catch'](handleError(_0x3d1af4,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 82f71ba..f974052 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 _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 +var _0xf494=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','lodash','util'];(function(_0x458ff6,_0x2561cf){var _0x3bb9a8=function(_0x4970f3){while(--_0x4970f3){_0x458ff6['push'](_0x458ff6['shift']());}};_0x3bb9a8(++_0x2561cf);}(_0xf494,0x1c6));var _0x4f49=function(_0x561e40,_0x4fca89){_0x561e40=_0x561e40-0x0;var _0x3c8865=_0xf494[_0x561e40];return _0x3c8865;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('MailServerOut',attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 8d2ef8f..74d0b60 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 _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 +var _0x3321=['MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x160a3b,_0x52b3af){var _0x49a7a5=function(_0x1f774){while(--_0x1f774){_0x160a3b['push'](_0x160a3b['shift']());}};_0x49a7a5(++_0x52b3af);}(_0x3321,0x100));var _0x1332=function(_0x5acebe,_0x1f2c20){_0x5acebe=_0x5acebe-0x0;var _0x4a5136=_0x3321[_0x5acebe];return _0x4a5136;};'use strict';var _=require(_0x1332('0x0'));var util=require('util');var moment=require(_0x1332('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1332('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x1332('0x3'))(_0x1332('0x4'));var config=require(_0x1332('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x1332('0x6')][_0x1332('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x498adb,_0x28c3a2,_0x4b409e){return new BPromise(function(_0x48d623,_0x4e382b){return client[_0x1332('0x8')](_0x498adb,_0x4b409e)[_0x1332('0x9')](function(_0x4cedc2){logger[_0x1332('0xa')](_0x1332('0xb'),_0x28c3a2,_0x1332('0xc'));logger[_0x1332('0xd')](_0x1332('0xe'),_0x28c3a2,_0x1332('0xc'),JSON[_0x1332('0xf')](_0x4cedc2));if(_0x4cedc2[_0x1332('0x10')]){if(_0x4cedc2[_0x1332('0x10')]['code']===0x1f4){logger[_0x1332('0x10')](_0x1332('0xb'),_0x28c3a2,_0x4cedc2[_0x1332('0x10')][_0x1332('0x11')]);return _0x4e382b(_0x4cedc2[_0x1332('0x10')][_0x1332('0x11')]);}logger[_0x1332('0x10')](_0x1332('0xb'),_0x28c3a2,_0x4cedc2[_0x1332('0x10')][_0x1332('0x11')]);return _0x48d623(_0x4cedc2['error'][_0x1332('0x11')]);}else{logger['info'](_0x1332('0xb'),_0x28c3a2,_0x1332('0xc'));_0x48d623(_0x4cedc2['result'][_0x1332('0x11')]);}})['catch'](function(_0x1f4b27){logger[_0x1332('0x10')](_0x1332('0xb'),_0x28c3a2,_0x1f4b27);_0x4e382b(_0x1f4b27);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index deb6fa4..2dceaf7 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 _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 +var _0x5b0d=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','/:id','create','put'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x5b0d,0xee));var _0xd5b0=function(_0x13583c,_0x498c30){_0x13583c=_0x13583c-0x0;var _0x1df527=_0x5b0d[_0x13583c];return _0x1df527;};'use strict';var multer=require(_0xd5b0('0x0'));var util=require(_0xd5b0('0x1'));var path=require(_0xd5b0('0x2'));var timeout=require(_0xd5b0('0x3'));var express=require(_0xd5b0('0x4'));var router=express[_0xd5b0('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xd5b0('0x6'));var config=require(_0xd5b0('0x7'));var controller=require('./mailSubstatus.controller');router[_0xd5b0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd5b0('0x8')](_0xd5b0('0x9'),auth[_0xd5b0('0xa')](),controller['describe']);router[_0xd5b0('0x8')](_0xd5b0('0xb'),auth[_0xd5b0('0xa')](),controller['show']);router['post']('/',auth[_0xd5b0('0xa')](),controller[_0xd5b0('0xc')]);router[_0xd5b0('0xd')](_0xd5b0('0xb'),auth[_0xd5b0('0xa')](),controller[_0xd5b0('0xe')]);router[_0xd5b0('0xf')](_0xd5b0('0xb'),auth[_0xd5b0('0xa')](),controller[_0xd5b0('0x10')]);module[_0xd5b0('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 d92b7b3..026a485 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 _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 +var _0x5232=['name','sequelize','exports','STRING'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x5232,0x1c9));var _0x2523=function(_0x313df3,_0x4fca45){_0x313df3=_0x313df3-0x0;var _0x241d59=_0x5232[_0x313df3];return _0x241d59;};'use strict';var Sequelize=require(_0x2523('0x0'));module[_0x2523('0x1')]={'name':{'type':Sequelize[_0x2523('0x2')],'unique':_0x2523('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2523('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 7448021..eeadc6a 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 _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 +var _0xa23c=['findAll','rows','show','model','include','find','catch','create','body','destroy','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','reject','save','then','error','stack','name','send','index','MailSubstatus','rawAttributes','key','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa23c,0x13c));var _0xca23=function(_0x52c684,_0x5bf3a4){_0x52c684=_0x52c684-0x0;var _0x254acd=_0xa23c[_0x52c684];return _0x254acd;};'use strict';var pdf=require(_0xca23('0x0'));var emlformat=require(_0xca23('0x1'));var rimraf=require(_0xca23('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xca23('0x3'));var rp=require(_0xca23('0x4'));var moment=require(_0xca23('0x5'));var BPromise=require(_0xca23('0x6'));var Mustache=require(_0xca23('0x7'));var util=require(_0xca23('0x8'));var path=require(_0xca23('0x9'));var sox=require(_0xca23('0xa'));var csv=require(_0xca23('0xb'));var ejs=require(_0xca23('0xc'));var fs=require('fs');var _=require(_0xca23('0xd'));var squel=require(_0xca23('0xe'));var crypto=require(_0xca23('0xf'));var jsforce=require(_0xca23('0x10'));var deskjs=require(_0xca23('0x11'));var toCsv=require(_0xca23('0xb'));var querystring=require(_0xca23('0x12'));var Papa=require(_0xca23('0x13'));var Redis=require(_0xca23('0x14'));var authService=require(_0xca23('0x15'));var qs=require(_0xca23('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xca23('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0xca23('0x18'));var config=require(_0xca23('0x19'));var db=require(_0xca23('0x1a'))['db'];function respondWithStatusCode(_0x117b43,_0x262d9e){_0x262d9e=_0x262d9e||0xcc;return function(_0x4da307){if(_0x4da307){return _0x117b43[_0xca23('0x1b')](_0x262d9e);}return _0x117b43[_0xca23('0x1c')](_0x262d9e)[_0xca23('0x1d')]();};}function respondWithResult(_0x427316,_0x4968b2){_0x4968b2=_0x4968b2||0xc8;return function(_0xcbf7ed){if(_0xcbf7ed){return _0x427316['status'](_0x4968b2)[_0xca23('0x1e')](_0xcbf7ed);}};}function respondWithFilteredResult(_0x16294d,_0x403680){return function(_0x5957c3){if(_0x5957c3){var _0x5ef66c=_0x5957c3['count'],_0x13dbcb=_0x403680['offset'],_0x1dee6d=_0x403680[_0xca23('0x1f')]+_0x403680['limit'],_0x35ff42;if(_0x1dee6d>=_0x5ef66c){_0x1dee6d=_0x5ef66c;_0x35ff42=0xc8;}else{_0x35ff42=0xce;}_0x16294d[_0xca23('0x1c')](_0x35ff42);return _0x16294d[_0xca23('0x20')](_0xca23('0x21'),_0x13dbcb+'-'+_0x1dee6d+'/'+_0x5ef66c)[_0xca23('0x1e')](_0x5957c3);}return null;};}function patchUpdates(_0x3770d0){return function(_0x345efa){try{jsonpatch['apply'](_0x345efa,_0x3770d0,!![]);}catch(_0x13b794){return BPromise[_0xca23('0x22')](_0x13b794);}return _0x345efa[_0xca23('0x23')]();};}function saveUpdates(_0x39bbef,_0x375d7c){return function(_0x99eff8){if(_0x99eff8){return _0x99eff8['update'](_0x39bbef)[_0xca23('0x24')](function(_0x1ad8a3){return _0x1ad8a3;});}return null;};}function removeEntity(_0x3c7182,_0x5dbe33){return function(_0x32f50d){if(_0x32f50d){return _0x32f50d['destroy']()[_0xca23('0x24')](function(){_0x3c7182['status'](0xcc)[_0xca23('0x1d')]();});}};}function handleEntityNotFound(_0x14ec1f,_0x29e9b7){return function(_0x32a720){if(!_0x32a720){_0x14ec1f[_0xca23('0x1b')](0x194);}return _0x32a720;};}function handleError(_0x436af4,_0x3b931d){_0x3b931d=_0x3b931d||0x1f4;return function(_0xbac4be){logger[_0xca23('0x25')](_0xbac4be[_0xca23('0x26')]);if(_0xbac4be[_0xca23('0x27')]){delete _0xbac4be['name'];}_0x436af4[_0xca23('0x1c')](_0x3b931d)[_0xca23('0x28')](_0xbac4be);};}exports[_0xca23('0x29')]=function(_0x1f02d0,_0x479a47){var _0x5647ce={},_0x433e02={},_0x4682d2={'count':0x0,'rows':[]};var _0x1eba77=_['map'](db[_0xca23('0x2a')][_0xca23('0x2b')],function(_0x2e24e5){return{'name':_0x2e24e5['fieldName'],'type':_0x2e24e5['type'][_0xca23('0x2c')]};});_0x433e02['model']=_[_0xca23('0x2d')](_0x1eba77,_0xca23('0x27'));_0x433e02[_0xca23('0x2e')]=_[_0xca23('0x2f')](_0x1f02d0[_0xca23('0x2e')]);_0x433e02[_0xca23('0x30')]=_[_0xca23('0x31')](_0x433e02['model'],_0x433e02[_0xca23('0x2e')]);_0x5647ce[_0xca23('0x32')]=_[_0xca23('0x31')](_0x433e02['model'],qs[_0xca23('0x33')](_0x1f02d0[_0xca23('0x2e')][_0xca23('0x33')]));_0x5647ce['attributes']=_0x5647ce['attributes']['length']?_0x5647ce[_0xca23('0x32')]:_0x433e02['model'];if(!_0x1f02d0[_0xca23('0x2e')][_0xca23('0x34')]('nolimit')){_0x5647ce[_0xca23('0x35')]=qs['limit'](_0x1f02d0[_0xca23('0x2e')][_0xca23('0x35')]);_0x5647ce['offset']=qs[_0xca23('0x1f')](_0x1f02d0[_0xca23('0x2e')][_0xca23('0x1f')]);}_0x5647ce[_0xca23('0x36')]=qs['sort'](_0x1f02d0['query'][_0xca23('0x37')]);_0x5647ce[_0xca23('0x38')]=qs['filters'](_[_0xca23('0x39')](_0x1f02d0['query'],_0x433e02[_0xca23('0x30')]),_0x1eba77);if(_0x1f02d0[_0xca23('0x2e')][_0xca23('0x3a')]){_0x5647ce[_0xca23('0x38')]=_[_0xca23('0x3b')](_0x5647ce['where'],{'$or':_[_0xca23('0x2d')](_0x1eba77,function(_0x3c16be){if(_0x3c16be['type']!==_0xca23('0x3c')){var _0x2e1723={};_0x2e1723[_0x3c16be[_0xca23('0x27')]]={'$like':'%'+_0x1f02d0[_0xca23('0x2e')]['filter']+'%'};return _0x2e1723;}})});}_0x5647ce=_[_0xca23('0x3b')]({},_0x5647ce,_0x1f02d0[_0xca23('0x3d')]);var _0x2bdf04={'where':_0x5647ce['where']};return db[_0xca23('0x2a')][_0xca23('0x3e')](_0x2bdf04)['then'](function(_0x324975){_0x4682d2[_0xca23('0x3e')]=_0x324975;if(_0x1f02d0['query'][_0xca23('0x3f')]){_0x5647ce['include']=[{'all':!![]}];}return db[_0xca23('0x2a')][_0xca23('0x40')](_0x5647ce);})['then'](function(_0x5cff6e){_0x4682d2[_0xca23('0x41')]=_0x5cff6e;return _0x4682d2;})[_0xca23('0x24')](respondWithFilteredResult(_0x479a47,_0x5647ce))['catch'](handleError(_0x479a47,null));};exports[_0xca23('0x42')]=function(_0x26a1d3,_0x12db9d){var _0x125989={'raw':!![],'where':{'id':_0x26a1d3['params']['id']}},_0x1d71fb={};_0x1d71fb['model']=_[_0xca23('0x2f')](db['MailSubstatus'][_0xca23('0x2b')]);_0x1d71fb[_0xca23('0x2e')]=_[_0xca23('0x2f')](_0x26a1d3[_0xca23('0x2e')]);_0x1d71fb[_0xca23('0x30')]=_[_0xca23('0x31')](_0x1d71fb['model'],_0x1d71fb[_0xca23('0x2e')]);_0x125989[_0xca23('0x32')]=_[_0xca23('0x31')](_0x1d71fb[_0xca23('0x43')],qs['fields'](_0x26a1d3[_0xca23('0x2e')][_0xca23('0x33')]));_0x125989[_0xca23('0x32')]=_0x125989[_0xca23('0x32')]['length']?_0x125989['attributes']:_0x1d71fb[_0xca23('0x43')];if(_0x26a1d3[_0xca23('0x2e')][_0xca23('0x3f')]){_0x125989[_0xca23('0x44')]=[{'all':!![]}];}_0x125989=_[_0xca23('0x3b')]({},_0x125989,_0x26a1d3[_0xca23('0x3d')]);return db[_0xca23('0x2a')][_0xca23('0x45')](_0x125989)['then'](handleEntityNotFound(_0x12db9d,null))[_0xca23('0x24')](respondWithResult(_0x12db9d,null))[_0xca23('0x46')](handleError(_0x12db9d,null));};exports[_0xca23('0x47')]=function(_0x4c6439,_0x57e18b){return db[_0xca23('0x2a')]['create'](_0x4c6439[_0xca23('0x48')],{})[_0xca23('0x24')](respondWithResult(_0x57e18b,0xc9))[_0xca23('0x46')](handleError(_0x57e18b,null));};exports['update']=function(_0x143c43,_0x5f3f27){if(_0x143c43[_0xca23('0x48')]['id']){delete _0x143c43[_0xca23('0x48')]['id'];}return db[_0xca23('0x2a')][_0xca23('0x45')]({'where':{'id':_0x143c43['params']['id']}})['then'](handleEntityNotFound(_0x5f3f27,null))[_0xca23('0x24')](saveUpdates(_0x143c43[_0xca23('0x48')],null))[_0xca23('0x24')](respondWithResult(_0x5f3f27,null))[_0xca23('0x46')](handleError(_0x5f3f27,null));};exports[_0xca23('0x49')]=function(_0x22653a,_0x3a53af){return db[_0xca23('0x2a')]['find']({'where':{'id':_0x22653a[_0xca23('0x4a')]['id']}})[_0xca23('0x24')](handleEntityNotFound(_0x3a53af,null))[_0xca23('0x24')](removeEntity(_0x3a53af,null))['catch'](handleError(_0x3a53af,null));};exports[_0xca23('0x4b')]=function(_0x3a66ac,_0x1bf3c6){return db[_0xca23('0x2a')][_0xca23('0x4b')]()[_0xca23('0x24')](respondWithResult(_0x1bf3c6,null))[_0xca23('0x46')](handleError(_0x1bf3c6,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 29041be..1a9b04e 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 _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 +var _0xcefd=['moment','bluebird','request-promise','rimraf','../../config/environment','./mailSubstatus.attributes','define','MailSubstatus','lodash','util','../../config/logger'];(function(_0x2167f3,_0x43e9d2){var _0x47360b=function(_0x3e043e){while(--_0x3e043e){_0x2167f3['push'](_0x2167f3['shift']());}};_0x47360b(++_0x43e9d2);}(_0xcefd,0x126));var _0xdcef=function(_0x380501,_0x3babe6){_0x380501=_0x380501-0x0;var _0x1950d1=_0xcefd[_0x380501];return _0x1950d1;};'use strict';var _=require(_0xdcef('0x0'));var util=require(_0xdcef('0x1'));var logger=require(_0xdcef('0x2'))('api');var moment=require(_0xdcef('0x3'));var BPromise=require(_0xdcef('0x4'));var rp=require(_0xdcef('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdcef('0x6'));var config=require(_0xdcef('0x7'));var attributes=require(_0xdcef('0x8'));module['exports']=function(_0x2043a4,_0xcaa40a){return _0x2043a4[_0xdcef('0x9')](_0xdcef('0xa'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 84e4a8a..05a0525 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 _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 +var _0xd2ea=['../../config/environment','jayson/promise','client','request','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x27e242,_0x48b753){var _0x5a07d4=function(_0x162df5){while(--_0x162df5){_0x27e242['push'](_0x27e242['shift']());}};_0x5a07d4(++_0x48b753);}(_0xd2ea,0x15f));var _0xad2e=function(_0x4424b0,_0x4e5641){_0x4424b0=_0x4424b0-0x0;var _0x49340=_0xd2ea[_0x4424b0];return _0x49340;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var moment=require(_0xad2e('0x2'));var BPromise=require(_0xad2e('0x3'));var rs=require(_0xad2e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad2e('0x5'))['db'];var utils=require(_0xad2e('0x6'));var logger=require(_0xad2e('0x7'))(_0xad2e('0x8'));var config=require(_0xad2e('0x9'));var jayson=require(_0xad2e('0xa'));var client=jayson[_0xad2e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b5170,_0x3e3d1f,_0x2ff7b2){return new BPromise(function(_0x5710ac,_0x1e0e9e){return client[_0xad2e('0xc')](_0x3b5170,_0x2ff7b2)['then'](function(_0x1eed2f){logger['info'](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));logger[_0xad2e('0xf')](_0xad2e('0x10'),_0x3e3d1f,'request\x20sent',JSON[_0xad2e('0x11')](_0x1eed2f));if(_0x1eed2f['error']){if(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x13')]===0x1f4){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0x1eed2f['error'][_0xad2e('0x14')]);return _0x1e0e9e(_0x1eed2f['error'][_0xad2e('0x14')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x3e3d1f,_0x1eed2f['error']['message']);return _0x5710ac(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x14')]);}else{logger[_0xad2e('0x15')](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));_0x5710ac(_0x1eed2f[_0xad2e('0x16')][_0xad2e('0x14')]);}})[_0xad2e('0x17')](function(_0xd40b31){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0xd40b31);_0x1e0e9e(_0xd40b31);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index df7965c..348032c 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 _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 +var _0xf91b=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x3ca891,_0x134385){var _0x3c4979=function(_0x4a99d3){while(--_0x4a99d3){_0x3ca891['push'](_0x3ca891['shift']());}};_0x3c4979(++_0x134385);}(_0xf91b,0x1e3));var _0xbf91=function(_0x4889f9,_0x28a8b9){_0x4889f9=_0x4889f9-0x0;var _0x1be12d=_0xf91b[_0x4889f9];return _0x1be12d;};'use strict';var multer=require('multer');var util=require(_0xbf91('0x0'));var path=require(_0xbf91('0x1'));var timeout=require(_0xbf91('0x2'));var express=require(_0xbf91('0x3'));var router=express[_0xbf91('0x4')]();var auth=require(_0xbf91('0x5'));var interaction=require(_0xbf91('0x6'));var config=require('../../config/environment');var controller=require(_0xbf91('0x7'));router[_0xbf91('0x8')]('/',auth['isAuthenticated'](),controller[_0xbf91('0x9')]);router[_0xbf91('0x8')](_0xbf91('0xa'),auth[_0xbf91('0xb')](),controller['describe']);router[_0xbf91('0x8')](_0xbf91('0xc'),auth['isAuthenticated'](),controller[_0xbf91('0xd')]);router[_0xbf91('0xe')]('/',auth[_0xbf91('0xb')](),controller[_0xbf91('0xf')]);router[_0xbf91('0x10')](_0xbf91('0xc'),auth[_0xbf91('0xb')](),controller[_0xbf91('0x11')]);router[_0xbf91('0x12')](_0xbf91('0xc'),auth['isAuthenticated'](),controller[_0xbf91('0x13')]);module[_0xbf91('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 26c22b7..0960416 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 _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 +var _0xf5df=['moment','sequelize','exports','ENUM','agent','queue','DATE'];(function(_0x47ced5,_0x2e038a){var _0x1d6d37=function(_0x53c612){while(--_0x53c612){_0x47ced5['push'](_0x47ced5['shift']());}};_0x1d6d37(++_0x2e038a);}(_0xf5df,0x126));var _0xff5d=function(_0x1fb6d6,_0x1f3fe3){_0x1fb6d6=_0x1fb6d6-0x0;var _0x2730d8=_0xf5df[_0x1fb6d6];return _0x2730d8;};'use strict';var moment=require(_0xff5d('0x0'));var Sequelize=require(_0xff5d('0x1'));module[_0xff5d('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xff5d('0x3')]('account',_0xff5d('0x4'),'queue'),'allowNull':![],'defaultValue':_0xff5d('0x5')},'transferredAt':{'type':Sequelize[_0xff5d('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 3aaed10..b2ce846 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 _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 +var _0xb5e1=['rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','count','include','findAll','rows','catch','length','includeAll','options','create','body','params','find','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','update','then','end','error','name','send','index','map','MailTransferReport'];(function(_0x4ec216,_0xa8ac4d){var _0x24d4d5=function(_0x166eb7){while(--_0x166eb7){_0x4ec216['push'](_0x4ec216['shift']());}};_0x24d4d5(++_0xa8ac4d);}(_0xb5e1,0x1e2));var _0x1b5e=function(_0x3b050f,_0x163d0){_0x3b050f=_0x3b050f-0x0;var _0x10637d=_0xb5e1[_0x3b050f];return _0x10637d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1b5e('0x0'));var rimraf=require(_0x1b5e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1b5e('0x2'));var moment=require(_0x1b5e('0x3'));var BPromise=require(_0x1b5e('0x4'));var Mustache=require(_0x1b5e('0x5'));var util=require(_0x1b5e('0x6'));var path=require(_0x1b5e('0x7'));var sox=require(_0x1b5e('0x8'));var csv=require(_0x1b5e('0x9'));var ejs=require(_0x1b5e('0xa'));var fs=require('fs');var _=require(_0x1b5e('0xb'));var squel=require('squel');var crypto=require(_0x1b5e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1b5e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1b5e('0xe'));var Papa=require(_0x1b5e('0xf'));var Redis=require('ioredis');var authService=require(_0x1b5e('0x10'));var qs=require(_0x1b5e('0x11'));var as=require(_0x1b5e('0x12'));var hardwareService=require(_0x1b5e('0x13'));var logger=require(_0x1b5e('0x14'))(_0x1b5e('0x15'));var utils=require(_0x1b5e('0x16'));var config=require(_0x1b5e('0x17'));var db=require(_0x1b5e('0x18'))['db'];function respondWithStatusCode(_0x53d4ae,_0x57d7b8){_0x57d7b8=_0x57d7b8||0xcc;return function(_0x42e496){if(_0x42e496){return _0x53d4ae[_0x1b5e('0x19')](_0x57d7b8);}return _0x53d4ae[_0x1b5e('0x1a')](_0x57d7b8)['end']();};}function respondWithResult(_0x4d10d5,_0x57cb34){_0x57cb34=_0x57cb34||0xc8;return function(_0x431455){if(_0x431455){return _0x4d10d5[_0x1b5e('0x1a')](_0x57cb34)[_0x1b5e('0x1b')](_0x431455);}};}function respondWithFilteredResult(_0x597423,_0x23353a){return function(_0x2e4b64){if(_0x2e4b64){var _0x24d5dd=_0x2e4b64['count'],_0x2ab1c6=_0x23353a[_0x1b5e('0x1c')],_0x2c558d=_0x23353a['offset']+_0x23353a[_0x1b5e('0x1d')],_0x42d32d;if(_0x2c558d>=_0x24d5dd){_0x2c558d=_0x24d5dd;_0x42d32d=0xc8;}else{_0x42d32d=0xce;}_0x597423[_0x1b5e('0x1a')](_0x42d32d);return _0x597423[_0x1b5e('0x1e')](_0x1b5e('0x1f'),_0x2ab1c6+'-'+_0x2c558d+'/'+_0x24d5dd)[_0x1b5e('0x1b')](_0x2e4b64);}return null;};}function patchUpdates(_0x53dc21){return function(_0x4a539b){try{jsonpatch[_0x1b5e('0x20')](_0x4a539b,_0x53dc21,!![]);}catch(_0xf50c3e){return BPromise[_0x1b5e('0x21')](_0xf50c3e);}return _0x4a539b['save']();};}function saveUpdates(_0x5a24ec,_0xe9e4fc){return function(_0x48f95b){if(_0x48f95b){return _0x48f95b[_0x1b5e('0x22')](_0x5a24ec)[_0x1b5e('0x23')](function(_0x504c21){return _0x504c21;});}return null;};}function removeEntity(_0x57a69c,_0x271fd5){return function(_0x1b20e8){if(_0x1b20e8){return _0x1b20e8['destroy']()[_0x1b5e('0x23')](function(){_0x57a69c[_0x1b5e('0x1a')](0xcc)[_0x1b5e('0x24')]();});}};}function handleEntityNotFound(_0x56c844,_0x1b58ce){return function(_0x2d3217){if(!_0x2d3217){_0x56c844[_0x1b5e('0x19')](0x194);}return _0x2d3217;};}function handleError(_0xdc36e8,_0x135db8){_0x135db8=_0x135db8||0x1f4;return function(_0x17d776){logger[_0x1b5e('0x25')](_0x17d776['stack']);if(_0x17d776['name']){delete _0x17d776[_0x1b5e('0x26')];}_0xdc36e8[_0x1b5e('0x1a')](_0x135db8)[_0x1b5e('0x27')](_0x17d776);};}exports[_0x1b5e('0x28')]=function(_0x518c36,_0x43d85a){var _0x5e921e={},_0x1d5bcf={},_0x40a04f={'count':0x0,'rows':[]};var _0x42e0ff=_[_0x1b5e('0x29')](db[_0x1b5e('0x2a')][_0x1b5e('0x2b')],function(_0x4b32ab){return{'name':_0x4b32ab[_0x1b5e('0x2c')],'type':_0x4b32ab['type'][_0x1b5e('0x2d')]};});_0x1d5bcf['model']=_[_0x1b5e('0x29')](_0x42e0ff,_0x1b5e('0x26'));_0x1d5bcf['query']=_[_0x1b5e('0x2e')](_0x518c36[_0x1b5e('0x2f')]);_0x1d5bcf[_0x1b5e('0x30')]=_[_0x1b5e('0x31')](_0x1d5bcf[_0x1b5e('0x32')],_0x1d5bcf[_0x1b5e('0x2f')]);_0x5e921e[_0x1b5e('0x33')]=_[_0x1b5e('0x31')](_0x1d5bcf[_0x1b5e('0x32')],qs[_0x1b5e('0x34')](_0x518c36[_0x1b5e('0x2f')][_0x1b5e('0x34')]));_0x5e921e[_0x1b5e('0x33')]=_0x5e921e['attributes']['length']?_0x5e921e[_0x1b5e('0x33')]:_0x1d5bcf[_0x1b5e('0x32')];if(!_0x518c36[_0x1b5e('0x2f')][_0x1b5e('0x35')]('nolimit')){_0x5e921e['limit']=qs[_0x1b5e('0x1d')](_0x518c36['query'][_0x1b5e('0x1d')]);_0x5e921e[_0x1b5e('0x1c')]=qs['offset'](_0x518c36[_0x1b5e('0x2f')][_0x1b5e('0x1c')]);}_0x5e921e[_0x1b5e('0x36')]=qs[_0x1b5e('0x37')](_0x518c36[_0x1b5e('0x2f')][_0x1b5e('0x37')]);_0x5e921e['where']=qs[_0x1b5e('0x30')](_[_0x1b5e('0x38')](_0x518c36[_0x1b5e('0x2f')],_0x1d5bcf[_0x1b5e('0x30')]),_0x42e0ff);if(_0x518c36[_0x1b5e('0x2f')][_0x1b5e('0x39')]){_0x5e921e[_0x1b5e('0x3a')]=_[_0x1b5e('0x3b')](_0x5e921e[_0x1b5e('0x3a')],{'$or':_[_0x1b5e('0x29')](_0x42e0ff,function(_0x285f4d){if(_0x285f4d[_0x1b5e('0x3c')]!==_0x1b5e('0x3d')){var _0x2cd2f8={};_0x2cd2f8[_0x285f4d[_0x1b5e('0x26')]]={'$like':'%'+_0x518c36[_0x1b5e('0x2f')][_0x1b5e('0x39')]+'%'};return _0x2cd2f8;}})});}_0x5e921e=_['merge']({},_0x5e921e,_0x518c36['options']);var _0x9e18dc={'where':_0x5e921e[_0x1b5e('0x3a')]};return db[_0x1b5e('0x2a')][_0x1b5e('0x3e')](_0x9e18dc)[_0x1b5e('0x23')](function(_0x17d02){_0x40a04f[_0x1b5e('0x3e')]=_0x17d02;if(_0x518c36['query']['includeAll']){_0x5e921e[_0x1b5e('0x3f')]=[{'all':!![]}];}return db['MailTransferReport'][_0x1b5e('0x40')](_0x5e921e);})[_0x1b5e('0x23')](function(_0x29256e){_0x40a04f[_0x1b5e('0x41')]=_0x29256e;return _0x40a04f;})[_0x1b5e('0x23')](respondWithFilteredResult(_0x43d85a,_0x5e921e))[_0x1b5e('0x42')](handleError(_0x43d85a,null));};exports['show']=function(_0x18a54c,_0x1305d9){var _0x292e00={'raw':!![],'where':{'id':_0x18a54c['params']['id']}},_0x3347a6={};_0x3347a6[_0x1b5e('0x32')]=_[_0x1b5e('0x2e')](db['MailTransferReport']['rawAttributes']);_0x3347a6[_0x1b5e('0x2f')]=_[_0x1b5e('0x2e')](_0x18a54c[_0x1b5e('0x2f')]);_0x3347a6['filters']=_['intersection'](_0x3347a6[_0x1b5e('0x32')],_0x3347a6['query']);_0x292e00[_0x1b5e('0x33')]=_[_0x1b5e('0x31')](_0x3347a6[_0x1b5e('0x32')],qs[_0x1b5e('0x34')](_0x18a54c[_0x1b5e('0x2f')]['fields']));_0x292e00[_0x1b5e('0x33')]=_0x292e00[_0x1b5e('0x33')][_0x1b5e('0x43')]?_0x292e00[_0x1b5e('0x33')]:_0x3347a6[_0x1b5e('0x32')];if(_0x18a54c['query'][_0x1b5e('0x44')]){_0x292e00[_0x1b5e('0x3f')]=[{'all':!![]}];}_0x292e00=_[_0x1b5e('0x3b')]({},_0x292e00,_0x18a54c[_0x1b5e('0x45')]);return db[_0x1b5e('0x2a')]['find'](_0x292e00)[_0x1b5e('0x23')](handleEntityNotFound(_0x1305d9,null))['then'](respondWithResult(_0x1305d9,null))[_0x1b5e('0x42')](handleError(_0x1305d9,null));};exports[_0x1b5e('0x46')]=function(_0x37b4f4,_0x38d6fc){return db['MailTransferReport'][_0x1b5e('0x46')](_0x37b4f4[_0x1b5e('0x47')],{})[_0x1b5e('0x23')](respondWithResult(_0x38d6fc,0xc9))[_0x1b5e('0x42')](handleError(_0x38d6fc,null));};exports[_0x1b5e('0x22')]=function(_0x34a6f7,_0x4b1380){if(_0x34a6f7[_0x1b5e('0x47')]['id']){delete _0x34a6f7['body']['id'];}return db[_0x1b5e('0x2a')]['find']({'where':{'id':_0x34a6f7[_0x1b5e('0x48')]['id']}})[_0x1b5e('0x23')](handleEntityNotFound(_0x4b1380,null))[_0x1b5e('0x23')](saveUpdates(_0x34a6f7[_0x1b5e('0x47')],null))[_0x1b5e('0x23')](respondWithResult(_0x4b1380,null))[_0x1b5e('0x42')](handleError(_0x4b1380,null));};exports['destroy']=function(_0x253f17,_0x2d5d54){return db[_0x1b5e('0x2a')][_0x1b5e('0x49')]({'where':{'id':_0x253f17[_0x1b5e('0x48')]['id']}})[_0x1b5e('0x23')](handleEntityNotFound(_0x2d5d54,null))[_0x1b5e('0x23')](removeEntity(_0x2d5d54,null))['catch'](handleError(_0x2d5d54,null));};exports[_0x1b5e('0x4a')]=function(_0x594f36,_0x1e7253){return db[_0x1b5e('0x2a')][_0x1b5e('0x4a')]()[_0x1b5e('0x23')](respondWithResult(_0x1e7253,null))[_0x1b5e('0x42')](handleError(_0x1e7253,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 6f7c250..3359d89 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 _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 +var _0x9ab8=['./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xe44d26,_0x106176){var _0x20cd35=function(_0x43c795){while(--_0x43c795){_0xe44d26['push'](_0xe44d26['shift']());}};_0x20cd35(++_0x106176);}(_0x9ab8,0x10d));var _0x89ab=function(_0xc47f48,_0x57254a){_0xc47f48=_0xc47f48-0x0;var _0x5e4f71=_0x9ab8[_0xc47f48];return _0x5e4f71;};'use strict';var _=require(_0x89ab('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x89ab('0x1'));var BPromise=require(_0x89ab('0x2'));var rp=require(_0x89ab('0x3'));var fs=require('fs');var path=require(_0x89ab('0x4'));var rimraf=require(_0x89ab('0x5'));var config=require(_0x89ab('0x6'));var attributes=require(_0x89ab('0x7'));module[_0x89ab('0x8')]=function(_0x2c35a3,_0x4f7d46){return _0x2c35a3['define'](_0x89ab('0x9'),attributes,{'tableName':_0x89ab('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x89ab('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 80f1598..67dacf5 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 _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 +var _0x5897=['info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x3c9639,_0x4643dc){var _0x2a1aaf=function(_0xe7e7e4){while(--_0xe7e7e4){_0x3c9639['push'](_0x3c9639['shift']());}};_0x2a1aaf(++_0x4643dc);}(_0x5897,0x66));var _0x7589=function(_0x47a40b,_0x443ecf){_0x47a40b=_0x47a40b-0x0;var _0x19610c=_0x5897[_0x47a40b];return _0x19610c;};'use strict';var _=require(_0x7589('0x0'));var util=require(_0x7589('0x1'));var moment=require(_0x7589('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7589('0x3'));var db=require(_0x7589('0x4'))['db'];var utils=require(_0x7589('0x5'));var logger=require(_0x7589('0x6'))(_0x7589('0x7'));var config=require(_0x7589('0x8'));var jayson=require(_0x7589('0x9'));var client=jayson['client'][_0x7589('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e777d,_0x1f005f,_0x420754){return new BPromise(function(_0x9c4683,_0x4ce3e){return client[_0x7589('0xb')](_0x2e777d,_0x420754)[_0x7589('0xc')](function(_0x489f8e){logger[_0x7589('0xd')](_0x7589('0xe'),_0x1f005f,_0x7589('0xf'));logger[_0x7589('0x10')](_0x7589('0x11'),_0x1f005f,_0x7589('0xf'),JSON[_0x7589('0x12')](_0x489f8e));if(_0x489f8e[_0x7589('0x13')]){if(_0x489f8e[_0x7589('0x13')][_0x7589('0x14')]===0x1f4){logger[_0x7589('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x1f005f,_0x489f8e[_0x7589('0x13')]['message']);return _0x4ce3e(_0x489f8e[_0x7589('0x13')][_0x7589('0x15')]);}logger[_0x7589('0x13')](_0x7589('0xe'),_0x1f005f,_0x489f8e[_0x7589('0x13')][_0x7589('0x15')]);return _0x9c4683(_0x489f8e[_0x7589('0x13')][_0x7589('0x15')]);}else{logger['info'](_0x7589('0xe'),_0x1f005f,_0x7589('0xf'));_0x9c4683(_0x489f8e['result']['message']);}})[_0x7589('0x16')](function(_0x1f23c6){logger[_0x7589('0x13')](_0x7589('0xe'),_0x1f005f,_0x1f23c6);_0x4ce3e(_0x1f23c6);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index c2cde2c..9eb4678 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 _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 +var _0x4d60=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','update','destroy','exports'];(function(_0x119705,_0xba9427){var _0x2affc2=function(_0x16f7e2){while(--_0x16f7e2){_0x119705['push'](_0x119705['shift']());}};_0x2affc2(++_0xba9427);}(_0x4d60,0x1e3));var _0x04d6=function(_0x3a2725,_0x450b72){_0x3a2725=_0x3a2725-0x0;var _0x3121fb=_0x4d60[_0x3a2725];return _0x3121fb;};'use strict';var multer=require(_0x04d6('0x0'));var util=require(_0x04d6('0x1'));var path=require(_0x04d6('0x2'));var timeout=require(_0x04d6('0x3'));var express=require(_0x04d6('0x4'));var router=express[_0x04d6('0x5')]();var auth=require(_0x04d6('0x6'));var interaction=require(_0x04d6('0x7'));var config=require(_0x04d6('0x8'));var controller=require(_0x04d6('0x9'));router[_0x04d6('0xa')]('/',auth[_0x04d6('0xb')](),controller[_0x04d6('0xc')]);router[_0x04d6('0xa')](_0x04d6('0xd'),auth[_0x04d6('0xb')](),controller['describe']);router[_0x04d6('0xa')](_0x04d6('0xe'),auth[_0x04d6('0xb')](),controller[_0x04d6('0xf')]);router[_0x04d6('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x04d6('0x11')]('/:id',auth[_0x04d6('0xb')](),controller[_0x04d6('0x12')]);router['delete'](_0x04d6('0xe'),auth[_0x04d6('0xb')](),controller[_0x04d6('0x13')]);module[_0x04d6('0x14')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 40d98ce..beecb0a 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 _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 +var _0x92a1=['STRING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports'];(function(_0x419a34,_0x524629){var _0x35f54c=function(_0x2c4df9){while(--_0x2c4df9){_0x419a34['push'](_0x419a34['shift']());}};_0x35f54c(++_0x524629);}(_0x92a1,0x1ec));var _0x192a=function(_0x3e165e,_0x83305d){_0x3e165e=_0x3e165e-0x0;var _0x466814=_0x92a1[_0x3e165e];return _0x466814;};'use strict';var Sequelize=require(_0x192a('0x0'));var moment=require(_0x192a('0x1'));module[_0x192a('0x2')]={'channel':{'type':Sequelize[_0x192a('0x3')]},'membername':{'type':Sequelize[_0x192a('0x3')]},'interface':{'type':Sequelize[_0x192a('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x192a('0x4')]},'enterAt':{'type':Sequelize[_0x192a('0x5')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x2173f8){var _0x5bd7dd=moment(_0x2173f8);var _0x560052=moment(this[_0x192a('0x6')](_0x192a('0x7')));var _0x45567a=_0x5bd7dd[_0x192a('0x8')](_0x560052,_0x192a('0x9'));this[_0x192a('0xa')]('exitAt',_0x2173f8);this[_0x192a('0xa')](_0x192a('0xb'),_0x45567a||null);}},'data1':{'type':Sequelize[_0x192a('0x3')],'comment':_0x192a('0xc')},'data2':{'type':Sequelize[_0x192a('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x192a('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x192a('0x3')],'comment':_0x192a('0xd')},'data5':{'type':Sequelize[_0x192a('0x3')],'comment':_0x192a('0xe')},'role':{'type':Sequelize[_0x192a('0x3')]},'internal':{'type':Sequelize[_0x192a('0x4')]},'uniqueid':{'type':Sequelize[_0x192a('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 1b19589..e0be562 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 _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 +var _0x1397=['keys','create','body','find','params','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','map','MemberReport','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','findAll','rows','catch','show'];(function(_0x149083,_0x4047b6){var _0x4dc74e=function(_0x1211f9){while(--_0x1211f9){_0x149083['push'](_0x149083['shift']());}};_0x4dc74e(++_0x4047b6);}(_0x1397,0xdb));var _0x7139=function(_0xa23369,_0x1b7895){_0xa23369=_0xa23369-0x0;var _0x48b0e2=_0x1397[_0xa23369];return _0x48b0e2;};'use strict';var pdf=require(_0x7139('0x0'));var emlformat=require(_0x7139('0x1'));var rimraf=require(_0x7139('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7139('0x3'));var moment=require(_0x7139('0x4'));var BPromise=require(_0x7139('0x5'));var Mustache=require(_0x7139('0x6'));var util=require('util');var path=require('path');var sox=require(_0x7139('0x7'));var csv=require(_0x7139('0x8'));var ejs=require(_0x7139('0x9'));var fs=require('fs');var _=require(_0x7139('0xa'));var squel=require(_0x7139('0xb'));var crypto=require(_0x7139('0xc'));var jsforce=require(_0x7139('0xd'));var deskjs=require(_0x7139('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7139('0xf'));var authService=require(_0x7139('0x10'));var qs=require(_0x7139('0x11'));var as=require(_0x7139('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7139('0x13'))(_0x7139('0x14'));var utils=require(_0x7139('0x15'));var config=require('../../config/environment');var db=require(_0x7139('0x16'))['db'];function respondWithStatusCode(_0x3a2854,_0x434245){_0x434245=_0x434245||0xcc;return function(_0x5723fc){if(_0x5723fc){return _0x3a2854['sendStatus'](_0x434245);}return _0x3a2854[_0x7139('0x17')](_0x434245)[_0x7139('0x18')]();};}function respondWithResult(_0x37fc71,_0x80a014){_0x80a014=_0x80a014||0xc8;return function(_0x468f9b){if(_0x468f9b){return _0x37fc71['status'](_0x80a014)[_0x7139('0x19')](_0x468f9b);}};}function respondWithFilteredResult(_0x52542,_0x34ddc0){return function(_0x244ed8){if(_0x244ed8){var _0x55559d=_0x244ed8[_0x7139('0x1a')],_0x54f567=_0x34ddc0['offset'],_0xd93efe=_0x34ddc0[_0x7139('0x1b')]+_0x34ddc0[_0x7139('0x1c')],_0x3d023d;if(_0xd93efe>=_0x55559d){_0xd93efe=_0x55559d;_0x3d023d=0xc8;}else{_0x3d023d=0xce;}_0x52542['status'](_0x3d023d);return _0x52542['set'](_0x7139('0x1d'),_0x54f567+'-'+_0xd93efe+'/'+_0x55559d)[_0x7139('0x19')](_0x244ed8);}return null;};}function patchUpdates(_0xd1c735){return function(_0x4e1a60){try{jsonpatch[_0x7139('0x1e')](_0x4e1a60,_0xd1c735,!![]);}catch(_0xdefbdf){return BPromise[_0x7139('0x1f')](_0xdefbdf);}return _0x4e1a60['save']();};}function saveUpdates(_0x54a177,_0x258cb5){return function(_0x99ffd3){if(_0x99ffd3){return _0x99ffd3[_0x7139('0x20')](_0x54a177)[_0x7139('0x21')](function(_0x371e12){return _0x371e12;});}return null;};}function removeEntity(_0x513d9f,_0x3a461e){return function(_0x5224fc){if(_0x5224fc){return _0x5224fc[_0x7139('0x22')]()[_0x7139('0x21')](function(){_0x513d9f[_0x7139('0x17')](0xcc)[_0x7139('0x18')]();});}};}function handleEntityNotFound(_0x512f36,_0x5104c6){return function(_0x37b330){if(!_0x37b330){_0x512f36[_0x7139('0x23')](0x194);}return _0x37b330;};}function handleError(_0x11cb5d,_0x366d6d){_0x366d6d=_0x366d6d||0x1f4;return function(_0x8bd243){logger[_0x7139('0x24')](_0x8bd243[_0x7139('0x25')]);if(_0x8bd243[_0x7139('0x26')]){delete _0x8bd243[_0x7139('0x26')];}_0x11cb5d[_0x7139('0x17')](_0x366d6d)['send'](_0x8bd243);};}exports['index']=function(_0x1107d8,_0x3f7307){var _0x5610d2={},_0x5d4980={},_0x53bfbc={'count':0x0,'rows':[]};var _0x556b25=_[_0x7139('0x27')](db[_0x7139('0x28')][_0x7139('0x29')],function(_0x22b252){return{'name':_0x22b252[_0x7139('0x2a')],'type':_0x22b252['type'][_0x7139('0x2b')]};});_0x5d4980[_0x7139('0x2c')]=_[_0x7139('0x27')](_0x556b25,'name');_0x5d4980[_0x7139('0x2d')]=_['keys'](_0x1107d8['query']);_0x5d4980['filters']=_[_0x7139('0x2e')](_0x5d4980[_0x7139('0x2c')],_0x5d4980['query']);_0x5610d2['attributes']=_['intersection'](_0x5d4980[_0x7139('0x2c')],qs[_0x7139('0x2f')](_0x1107d8['query'][_0x7139('0x2f')]));_0x5610d2['attributes']=_0x5610d2[_0x7139('0x30')][_0x7139('0x31')]?_0x5610d2[_0x7139('0x30')]:_0x5d4980[_0x7139('0x2c')];if(!_0x1107d8[_0x7139('0x2d')]['hasOwnProperty'](_0x7139('0x32'))){_0x5610d2['limit']=qs[_0x7139('0x1c')](_0x1107d8['query'][_0x7139('0x1c')]);_0x5610d2[_0x7139('0x1b')]=qs[_0x7139('0x1b')](_0x1107d8['query'][_0x7139('0x1b')]);}_0x5610d2[_0x7139('0x33')]=qs[_0x7139('0x34')](_0x1107d8[_0x7139('0x2d')][_0x7139('0x34')]);_0x5610d2[_0x7139('0x35')]=qs[_0x7139('0x36')](_[_0x7139('0x37')](_0x1107d8[_0x7139('0x2d')],_0x5d4980[_0x7139('0x36')]),_0x556b25);if(_0x1107d8[_0x7139('0x2d')][_0x7139('0x38')]){_0x5610d2[_0x7139('0x35')]=_[_0x7139('0x39')](_0x5610d2['where'],{'$or':_['map'](_0x556b25,function(_0x3050fa){if(_0x3050fa[_0x7139('0x3a')]!==_0x7139('0x3b')){var _0xc16941={};_0xc16941[_0x3050fa[_0x7139('0x26')]]={'$like':'%'+_0x1107d8[_0x7139('0x2d')][_0x7139('0x38')]+'%'};return _0xc16941;}})});}_0x5610d2=_['merge']({},_0x5610d2,_0x1107d8[_0x7139('0x3c')]);var _0x3d7917={'where':_0x5610d2[_0x7139('0x35')]};return db[_0x7139('0x28')]['count'](_0x3d7917)['then'](function(_0x2629aa){_0x53bfbc[_0x7139('0x1a')]=_0x2629aa;if(_0x1107d8['query']['includeAll']){_0x5610d2['include']=[{'all':!![]}];}return db[_0x7139('0x28')][_0x7139('0x3d')](_0x5610d2);})[_0x7139('0x21')](function(_0x4c30f0){_0x53bfbc[_0x7139('0x3e')]=_0x4c30f0;return _0x53bfbc;})[_0x7139('0x21')](respondWithFilteredResult(_0x3f7307,_0x5610d2))[_0x7139('0x3f')](handleError(_0x3f7307,null));};exports[_0x7139('0x40')]=function(_0x3fb8a4,_0x2097e2){var _0x446d5b={'raw':!![],'where':{'id':_0x3fb8a4['params']['id']}},_0x3c5727={};_0x3c5727['model']=_[_0x7139('0x41')](db[_0x7139('0x28')][_0x7139('0x29')]);_0x3c5727['query']=_[_0x7139('0x41')](_0x3fb8a4[_0x7139('0x2d')]);_0x3c5727[_0x7139('0x36')]=_[_0x7139('0x2e')](_0x3c5727['model'],_0x3c5727['query']);_0x446d5b['attributes']=_[_0x7139('0x2e')](_0x3c5727[_0x7139('0x2c')],qs[_0x7139('0x2f')](_0x3fb8a4[_0x7139('0x2d')][_0x7139('0x2f')]));_0x446d5b['attributes']=_0x446d5b['attributes'][_0x7139('0x31')]?_0x446d5b[_0x7139('0x30')]:_0x3c5727['model'];if(_0x3fb8a4[_0x7139('0x2d')]['includeAll']){_0x446d5b['include']=[{'all':!![]}];}_0x446d5b=_[_0x7139('0x39')]({},_0x446d5b,_0x3fb8a4['options']);return db[_0x7139('0x28')]['find'](_0x446d5b)[_0x7139('0x21')](handleEntityNotFound(_0x2097e2,null))[_0x7139('0x21')](respondWithResult(_0x2097e2,null))[_0x7139('0x3f')](handleError(_0x2097e2,null));};exports['create']=function(_0x433340,_0x57ae40){return db[_0x7139('0x28')][_0x7139('0x42')](_0x433340['body'],{})[_0x7139('0x21')](respondWithResult(_0x57ae40,0xc9))[_0x7139('0x3f')](handleError(_0x57ae40,null));};exports[_0x7139('0x20')]=function(_0x42dd8b,_0x50a218){if(_0x42dd8b[_0x7139('0x43')]['id']){delete _0x42dd8b[_0x7139('0x43')]['id'];}return db[_0x7139('0x28')][_0x7139('0x44')]({'where':{'id':_0x42dd8b[_0x7139('0x45')]['id']}})['then'](handleEntityNotFound(_0x50a218,null))[_0x7139('0x21')](saveUpdates(_0x42dd8b[_0x7139('0x43')],null))['then'](respondWithResult(_0x50a218,null))[_0x7139('0x3f')](handleError(_0x50a218,null));};exports[_0x7139('0x22')]=function(_0xf9122,_0x3d0047){return db['MemberReport'][_0x7139('0x44')]({'where':{'id':_0xf9122[_0x7139('0x45')]['id']}})[_0x7139('0x21')](handleEntityNotFound(_0x3d0047,null))[_0x7139('0x21')](removeEntity(_0x3d0047,null))[_0x7139('0x3f')](handleError(_0x3d0047,null));};exports[_0x7139('0x46')]=function(_0x54aa21,_0x10d32d){return db[_0x7139('0x28')][_0x7139('0x46')]()[_0x7139('0x21')](respondWithResult(_0x10d32d,null))[_0x7139('0x3f')](handleError(_0x10d32d,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index e48427c..1fc47bb 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 _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 +var _0xa025=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member','membername_interface','membername','interface','../../config/logger'];(function(_0x299a42,_0x3fe47e){var _0x54d658=function(_0x3434db){while(--_0x3434db){_0x299a42['push'](_0x299a42['shift']());}};_0x54d658(++_0x3fe47e);}(_0xa025,0x1db));var _0x5a02=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0xa025[_0x3b1b23];return _0x1efc85;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5a02('0x0'))(_0x5a02('0x1'));var moment=require(_0x5a02('0x2'));var BPromise=require(_0x5a02('0x3'));var rp=require(_0x5a02('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5a02('0x5'));var config=require(_0x5a02('0x6'));var attributes=require(_0x5a02('0x7'));module[_0x5a02('0x8')]=function(_0x448f4a,_0x20e82a){return _0x448f4a['define'](_0x5a02('0x9'),attributes,{'tableName':_0x5a02('0xa'),'paranoid':![],'indexes':[{'name':_0x5a02('0xb'),'fields':[_0x5a02('0xc'),_0x5a02('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 51f838c..27712e8 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 _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 +var _0x4d50=['code','error','message','info','result','catch','GetMemberReport','MemberReport','options','raw','where','limit','map','include','model','attributes','CreateMemberReport','body','UpdateMemberReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x153e97,_0x5a9b38){var _0x5e7141=function(_0x10b682){while(--_0x10b682){_0x153e97['push'](_0x153e97['shift']());}};_0x5e7141(++_0x5a9b38);}(_0x4d50,0x157));var _0x04d5=function(_0x4464e6,_0xa741e4){_0x4464e6=_0x4464e6-0x0;var _0x3e256d=_0x4d50[_0x4464e6];return _0x3e256d;};'use strict';var _=require('lodash');var util=require(_0x04d5('0x0'));var moment=require(_0x04d5('0x1'));var BPromise=require(_0x04d5('0x2'));var rs=require(_0x04d5('0x3'));var fs=require('fs');var Redis=require(_0x04d5('0x4'));var db=require(_0x04d5('0x5'))['db'];var utils=require(_0x04d5('0x6'));var logger=require(_0x04d5('0x7'))('rpc');var config=require(_0x04d5('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x04d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd671b,_0xd29b20,_0x3f4727){return new BPromise(function(_0x4d69c7,_0x9c57db){return client[_0x04d5('0xa')](_0xd671b,_0x3f4727)[_0x04d5('0xb')](function(_0x5113fd){logger['info'](_0x04d5('0xc'),_0xd29b20,_0x04d5('0xd'));logger[_0x04d5('0xe')](_0x04d5('0xf'),_0xd29b20,_0x04d5('0xd'),JSON[_0x04d5('0x10')](_0x5113fd));if(_0x5113fd['error']){if(_0x5113fd['error'][_0x04d5('0x11')]===0x1f4){logger[_0x04d5('0x12')](_0x04d5('0xc'),_0xd29b20,_0x5113fd[_0x04d5('0x12')][_0x04d5('0x13')]);return _0x9c57db(_0x5113fd[_0x04d5('0x12')][_0x04d5('0x13')]);}logger[_0x04d5('0x12')](_0x04d5('0xc'),_0xd29b20,_0x5113fd[_0x04d5('0x12')][_0x04d5('0x13')]);return _0x4d69c7(_0x5113fd[_0x04d5('0x12')][_0x04d5('0x13')]);}else{logger[_0x04d5('0x14')](_0x04d5('0xc'),_0xd29b20,_0x04d5('0xd'));_0x4d69c7(_0x5113fd[_0x04d5('0x15')]['message']);}})[_0x04d5('0x16')](function(_0x2cbfca){logger[_0x04d5('0x12')]('MemberReport,\x20%s,\x20%s',_0xd29b20,_0x2cbfca);_0x9c57db(_0x2cbfca);});});}exports[_0x04d5('0x17')]=function(_0x1a091a){var _0x3ca033=this;return new Promise(function(_0x4017b3,_0x3efc4d){return db[_0x04d5('0x18')]['findAll']({'raw':_0x1a091a[_0x04d5('0x19')]?_0x1a091a[_0x04d5('0x19')][_0x04d5('0x1a')]===undefined?!![]:![]:!![],'where':_0x1a091a[_0x04d5('0x19')]?_0x1a091a['options'][_0x04d5('0x1b')]||null:null,'attributes':_0x1a091a['options']?_0x1a091a[_0x04d5('0x19')]['attributes']||null:null,'limit':_0x1a091a[_0x04d5('0x19')]?_0x1a091a[_0x04d5('0x19')][_0x04d5('0x1c')]||null:null,'include':_0x1a091a[_0x04d5('0x19')]?_0x1a091a[_0x04d5('0x19')]['include']?_[_0x04d5('0x1d')](_0x1a091a[_0x04d5('0x19')][_0x04d5('0x1e')],function(_0x23650e){return{'model':db[_0x23650e[_0x04d5('0x1f')]],'as':_0x23650e['as'],'attributes':_0x23650e[_0x04d5('0x20')],'include':_0x23650e[_0x04d5('0x1e')]?_[_0x04d5('0x1d')](_0x23650e[_0x04d5('0x1e')],function(_0x418fc4){return{'model':db[_0x418fc4[_0x04d5('0x1f')]],'as':_0x418fc4['as'],'attributes':_0x418fc4[_0x04d5('0x20')],'include':_0x418fc4[_0x04d5('0x1e')]?_[_0x04d5('0x1d')](_0x418fc4[_0x04d5('0x1e')],function(_0x1ab424){return{'model':db[_0x1ab424[_0x04d5('0x1f')]],'as':_0x1ab424['as'],'attributes':_0x1ab424[_0x04d5('0x20')]};}):[]};}):[]};}):[]:[]})[_0x04d5('0xb')](function(_0x1dd6e2){logger[_0x04d5('0x14')]('GetMemberReport',_0x1a091a);logger[_0x04d5('0xe')]('GetMemberReport',_0x1a091a,JSON[_0x04d5('0x10')](_0x1dd6e2));_0x4017b3(_0x1dd6e2);})[_0x04d5('0x16')](function(_0xaa45bd){logger[_0x04d5('0x12')]('GetMemberReport',_0xaa45bd[_0x04d5('0x13')],_0x1a091a);_0x3efc4d(_0x3ca033[_0x04d5('0x12')](0x1f4,_0xaa45bd[_0x04d5('0x13')]));});});};exports[_0x04d5('0x21')]=function(_0x318450){var _0x3d2d7d=this;return new Promise(function(_0x5ed983,_0xa3f43f){return db[_0x04d5('0x18')]['create'](_0x318450[_0x04d5('0x22')],{'raw':_0x318450[_0x04d5('0x19')]?_0x318450['options']['raw']===undefined?!![]:![]:!![]})[_0x04d5('0xb')](function(_0x54e267){logger[_0x04d5('0x14')]('CreateMemberReport',_0x318450);logger['debug'](_0x04d5('0x21'),_0x318450,JSON['stringify'](_0x54e267));_0x5ed983(_0x54e267);})[_0x04d5('0x16')](function(_0xb6a688){logger['error'](_0x04d5('0x21'),_0xb6a688['message'],_0x318450);_0xa3f43f(_0x3d2d7d[_0x04d5('0x12')](0x1f4,_0xb6a688[_0x04d5('0x13')]));});});};exports[_0x04d5('0x23')]=function(_0xfd9c40){var _0x4a0a2e=this;return new Promise(function(_0x3d7320,_0x4375ae){return db[_0x04d5('0x18')]['update'](_0xfd9c40[_0x04d5('0x22')],{'raw':_0xfd9c40[_0x04d5('0x19')]?_0xfd9c40['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfd9c40[_0x04d5('0x19')]?_0xfd9c40[_0x04d5('0x19')][_0x04d5('0x1b')]||null:null,'attributes':_0xfd9c40[_0x04d5('0x19')]?_0xfd9c40[_0x04d5('0x19')][_0x04d5('0x20')]||null:null,'limit':_0xfd9c40['options']?_0xfd9c40[_0x04d5('0x19')][_0x04d5('0x1c')]||null:null})[_0x04d5('0xb')](function(_0x4964d0){logger[_0x04d5('0x14')]('UpdateMemberReport',_0xfd9c40);logger[_0x04d5('0xe')](_0x04d5('0x23'),_0xfd9c40,JSON[_0x04d5('0x10')](_0x4964d0));_0x3d7320(_0x4964d0);})[_0x04d5('0x16')](function(_0x2d9c19){logger[_0x04d5('0x12')]('UpdateMemberReport',_0x2d9c19['message'],_0xfd9c40);_0x4375ae(_0x4a0a2e['error'](0x1f4,_0x2d9c19['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index f207a2b..f34a735 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 _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 +var _0xc900=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','./migration.controller','get','index','exports','path'];(function(_0x43e581,_0x31880b){var _0x10a92f=function(_0x272ffd){while(--_0x272ffd){_0x43e581['push'](_0x43e581['shift']());}};_0x10a92f(++_0x31880b);}(_0xc900,0xb3));var _0x0c90=function(_0x160237,_0x1b4d85){_0x160237=_0x160237-0x0;var _0x45df6a=_0xc900[_0x160237];return _0x45df6a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0c90('0x0'));var timeout=require(_0x0c90('0x1'));var express=require(_0x0c90('0x2'));var router=express['Router']();var auth=require(_0x0c90('0x3'));var interaction=require(_0x0c90('0x4'));var config=require('../../config/environment');var controller=require(_0x0c90('0x5'));router[_0x0c90('0x6')]('/',controller[_0x0c90('0x7')]);module[_0x0c90('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 ec023a8..1b5df8c 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 _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 +var _0x214d=['version','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x214d,0x1ed));var _0xd214=function(_0x2106a9,_0x2567e8){_0x2106a9=_0x2106a9-0x0;var _0x35d365=_0x214d[_0x2106a9];return _0x35d365;};'use strict';var Sequelize=require('sequelize');module[_0xd214('0x0')]={'version':{'type':Sequelize[_0xd214('0x1')],'unique':_0xd214('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 03cc5e6..44c11df 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 _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 +var _0xcb91=['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','Migration','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs'];(function(_0x392d46,_0xac920a){var _0x14b9dd=function(_0x2aa4d2){while(--_0x2aa4d2){_0x392d46['push'](_0x392d46['shift']());}};_0x14b9dd(++_0xac920a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xb4cc12,_0x41436e){_0xb4cc12=_0xb4cc12-0x0;var _0x8593b5=_0xcb91[_0xb4cc12];return _0x8593b5;};'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));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index cc597a5..e36e309 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 _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 +var _0xafb0=['bluebird','request-promise','path','rimraf','../../config/environment','migrations','util','moment'];(function(_0x33a61e,_0x159e28){var _0xc6a2e3=function(_0x51b464){while(--_0x51b464){_0x33a61e['push'](_0x33a61e['shift']());}};_0xc6a2e3(++_0x159e28);}(_0xafb0,0x166));var _0x0afb=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0xafb0[_0x2aa0e7];return _0x1472c0;};'use strict';var _=require('lodash');var util=require(_0x0afb('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x0afb('0x1'));var BPromise=require(_0x0afb('0x2'));var rp=require(_0x0afb('0x3'));var fs=require('fs');var path=require(_0x0afb('0x4'));var rimraf=require(_0x0afb('0x5'));var config=require(_0x0afb('0x6'));var attributes=require('./migration.attributes');module['exports']=function(_0x150996,_0xedaf7b){return _0x150996['define']('Migration',attributes,{'tableName':_0x0afb('0x7'),'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 2bc0674..6f3dab7 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 _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 +var _0xcd7a=['error','message','result','catch','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s'];(function(_0x221d7b,_0x44da0c){var _0x24d492=function(_0x1a4fa){while(--_0x1a4fa){_0x221d7b['push'](_0x221d7b['shift']());}};_0x24d492(++_0x44da0c);}(_0xcd7a,0x115));var _0xacd7=function(_0x8a02d8,_0x5d4de2){_0x8a02d8=_0x8a02d8-0x0;var _0x36af1a=_0xcd7a[_0x8a02d8];return _0x36af1a;};'use strict';var _=require(_0xacd7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xacd7('0x1'));var rs=require(_0xacd7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xacd7('0x3'));var logger=require(_0xacd7('0x4'))(_0xacd7('0x5'));var config=require(_0xacd7('0x6'));var jayson=require(_0xacd7('0x7'));var client=jayson[_0xacd7('0x8')][_0xacd7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45b633,_0xa86e61,_0x46ccfe){return new BPromise(function(_0x3cf191,_0x311bc8){return client[_0xacd7('0xa')](_0x45b633,_0x46ccfe)[_0xacd7('0xb')](function(_0x567262){logger[_0xacd7('0xc')](_0xacd7('0xd'),_0xa86e61,_0xacd7('0xe'));logger[_0xacd7('0xf')](_0xacd7('0x10'),_0xa86e61,_0xacd7('0xe'),JSON['stringify'](_0x567262));if(_0x567262[_0xacd7('0x11')]){if(_0x567262[_0xacd7('0x11')]['code']===0x1f4){logger[_0xacd7('0x11')](_0xacd7('0xd'),_0xa86e61,_0x567262[_0xacd7('0x11')]['message']);return _0x311bc8(_0x567262['error'][_0xacd7('0x12')]);}logger[_0xacd7('0x11')](_0xacd7('0xd'),_0xa86e61,_0x567262['error']['message']);return _0x3cf191(_0x567262[_0xacd7('0x11')][_0xacd7('0x12')]);}else{logger[_0xacd7('0xc')](_0xacd7('0xd'),_0xa86e61,_0xacd7('0xe'));_0x3cf191(_0x567262[_0xacd7('0x13')][_0xacd7('0x12')]);}})[_0xacd7('0x14')](function(_0x37a6c7){logger[_0xacd7('0x11')](_0xacd7('0xd'),_0xa86e61,_0x37a6c7);_0x311bc8(_0x37a6c7);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index ffa25a0..d37fd76 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 _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 +var _0x8802=['./network.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x25393c,_0x409722){var _0x253ce0=function(_0x294905){while(--_0x294905){_0x25393c['push'](_0x25393c['shift']());}};_0x253ce0(++_0x409722);}(_0x8802,0x7e));var _0x2880=function(_0x13945b,_0x289c94){_0x13945b=_0x13945b-0x0;var _0x1b1643=_0x8802[_0x13945b];return _0x1b1643;};'use strict';var multer=require(_0x2880('0x0'));var util=require('util');var path=require(_0x2880('0x1'));var timeout=require('connect-timeout');var express=require(_0x2880('0x2'));var router=express[_0x2880('0x3')]();var auth=require(_0x2880('0x4'));var interaction=require(_0x2880('0x5'));var config=require(_0x2880('0x6'));var controller=require(_0x2880('0x7'));router[_0x2880('0x8')]('/',auth[_0x2880('0x9')](),controller[_0x2880('0xa')]);router[_0x2880('0x8')](_0x2880('0xb'),auth[_0x2880('0x9')](),controller[_0x2880('0xc')]);router[_0x2880('0xd')]('/',auth['isAuthenticated'](),controller[_0x2880('0xe')]);router[_0x2880('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x2880('0x10')]);router['delete'](_0x2880('0xb'),auth[_0x2880('0x9')](),controller[_0x2880('0x11')]);module[_0x2880('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 49daebb..2f6d762 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(_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 +var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x9fe83d,_0x4bec2a){var _0x14668b=function(_0x15c1ae){while(--_0x15c1ae){_0x9fe83d['push'](_0x9fe83d['shift']());}};_0x14668b(++_0x4bec2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 fe6e16e..d6795a7 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 _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 +var _0x3cef=['STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','find','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../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','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','sendStatus','status','json','count','offset','limit','set','apply','save','update','then','end','name','send','index','map','Network','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','findAll','rows','show','params','keys','include','options','catch','create','sequelize','transaction','body','toUpperCase'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x3cef,0xe2));var _0xf3ce=function(_0x12f6ce,_0x28e57f){_0x12f6ce=_0x12f6ce-0x0;var _0x107d79=_0x3cef[_0x12f6ce];return _0x107d79;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf3ce('0x0'));var rimraf=require(_0xf3ce('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf3ce('0x2'));var rp=require(_0xf3ce('0x3'));var moment=require(_0xf3ce('0x4'));var BPromise=require(_0xf3ce('0x5'));var Mustache=require(_0xf3ce('0x6'));var util=require(_0xf3ce('0x7'));var path=require(_0xf3ce('0x8'));var sox=require(_0xf3ce('0x9'));var csv=require('to-csv');var ejs=require(_0xf3ce('0xa'));var fs=require('fs');var _=require(_0xf3ce('0xb'));var squel=require('squel');var crypto=require(_0xf3ce('0xc'));var jsforce=require(_0xf3ce('0xd'));var deskjs=require(_0xf3ce('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf3ce('0xf'));var Papa=require(_0xf3ce('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf3ce('0x11'));var as=require(_0xf3ce('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf3ce('0x13'))('api');var utils=require(_0xf3ce('0x14'));var config=require(_0xf3ce('0x15'));var db=require(_0xf3ce('0x16'))['db'];var jayson=require(_0xf3ce('0x17'));var client=jayson[_0xf3ce('0x18')][_0xf3ce('0x19')]({'port':0x232a});function checkPasswordPattern(_0x1dd9e4,_0x3b442c,_0x2b90ee){if(_0x2b90ee){var _0x489d00=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x489d00[_0xf3ce('0x1a')](_0x3b442c)){return _0x1dd9e4;}else{throw new db['Sequelize'][(_0xf3ce('0x1b'))](_0xf3ce('0x1c'));}}else{return _0x1dd9e4;}}function respondWithRpcPromise(_0x5a9280,_0x11b90c,_0x5e85fa,_0x1efcf7){return new BPromise(function(_0x526ef2,_0x55f94f){var _0x2327da=_0x1efcf7||client;return _0x2327da[_0xf3ce('0x1d')](_0x5a9280,_0x5e85fa)['then'](function(_0x5da8a1){logger[_0xf3ce('0x1e')](_0xf3ce('0x1f'),_0x11b90c,_0xf3ce('0x20'));logger[_0xf3ce('0x21')]('Network,\x20%s,\x20%s,\x20%s',_0x11b90c,_0xf3ce('0x20'),JSON[_0xf3ce('0x22')](_0x5da8a1));if(_0x5da8a1[_0xf3ce('0x23')]){if(_0x5da8a1[_0xf3ce('0x23')]['code']===0x1f4){logger['error'](_0xf3ce('0x1f'),_0x11b90c,_0x5da8a1[_0xf3ce('0x23')]['message']);return _0x55f94f(_0x5da8a1[_0xf3ce('0x23')][_0xf3ce('0x24')]);}logger[_0xf3ce('0x23')](_0xf3ce('0x1f'),_0x11b90c,_0x5da8a1[_0xf3ce('0x23')][_0xf3ce('0x24')]);return _0x526ef2(_0x5da8a1[_0xf3ce('0x23')]['message']);}else{logger[_0xf3ce('0x1e')]('Network,\x20%s,\x20%s',_0x11b90c,_0xf3ce('0x20'));_0x526ef2(_0x5da8a1['result'][_0xf3ce('0x24')]);}})['catch'](function(_0x499361){logger[_0xf3ce('0x23')](_0xf3ce('0x1f'),_0x11b90c,_0x499361);_0x55f94f(_0x499361);});});}function respondWithStatusCode(_0x11f79b,_0x4a9f29){_0x4a9f29=_0x4a9f29||0xcc;return function(_0xe55e5b){if(_0xe55e5b){return _0x11f79b[_0xf3ce('0x25')](_0x4a9f29);}return _0x11f79b[_0xf3ce('0x26')](_0x4a9f29)['end']();};}function respondWithResult(_0x3e5b59,_0x438e6c){_0x438e6c=_0x438e6c||0xc8;return function(_0x7a441d){if(_0x7a441d){return _0x3e5b59['status'](_0x438e6c)[_0xf3ce('0x27')](_0x7a441d);}};}function respondWithFilteredResult(_0x139984,_0x24e08d){return function(_0x2cf474){if(_0x2cf474){var _0x738a62=_0x2cf474[_0xf3ce('0x28')],_0x2af99e=_0x24e08d[_0xf3ce('0x29')],_0x1ac6bd=_0x24e08d[_0xf3ce('0x29')]+_0x24e08d[_0xf3ce('0x2a')],_0x23a04e;if(_0x1ac6bd>=_0x738a62){_0x1ac6bd=_0x738a62;_0x23a04e=0xc8;}else{_0x23a04e=0xce;}_0x139984[_0xf3ce('0x26')](_0x23a04e);return _0x139984[_0xf3ce('0x2b')]('Content-Range',_0x2af99e+'-'+_0x1ac6bd+'/'+_0x738a62)[_0xf3ce('0x27')](_0x2cf474);}return null;};}function patchUpdates(_0x48b6d3){return function(_0x9de9b1){try{jsonpatch[_0xf3ce('0x2c')](_0x9de9b1,_0x48b6d3,!![]);}catch(_0xe0f3ff){return BPromise['reject'](_0xe0f3ff);}return _0x9de9b1[_0xf3ce('0x2d')]();};}function saveUpdates(_0x5e03c3,_0x3dc3df){return function(_0xd8744e){if(_0xd8744e){return _0xd8744e[_0xf3ce('0x2e')](_0x5e03c3)[_0xf3ce('0x2f')](function(_0x3bf712){return _0x3bf712;});}return null;};}function removeEntity(_0x187775,_0x573dc3){return function(_0x1a226e){if(_0x1a226e){return _0x1a226e['destroy']()[_0xf3ce('0x2f')](function(){_0x187775[_0xf3ce('0x26')](0xcc)[_0xf3ce('0x30')]();});}};}function handleEntityNotFound(_0x2c776f,_0x2d2407){return function(_0x1a1677){if(!_0x1a1677){_0x2c776f[_0xf3ce('0x25')](0x194);}return _0x1a1677;};}function handleError(_0x4ccb1e,_0x570363){_0x570363=_0x570363||0x1f4;return function(_0x63c58c){logger['error'](_0x63c58c['stack']);if(_0x63c58c[_0xf3ce('0x31')]){delete _0x63c58c['name'];}_0x4ccb1e[_0xf3ce('0x26')](_0x570363)[_0xf3ce('0x32')](_0x63c58c);};}exports[_0xf3ce('0x33')]=function(_0x28df0c,_0x4c2ff7){var _0x29f48a={},_0x3b2833={},_0x24a8d1={'count':0x0,'rows':[]};var _0x3681ab=_[_0xf3ce('0x34')](db[_0xf3ce('0x35')][_0xf3ce('0x36')],function(_0x56d6ac){return{'name':_0x56d6ac['fieldName'],'type':_0x56d6ac[_0xf3ce('0x37')][_0xf3ce('0x38')]};});_0x3b2833[_0xf3ce('0x39')]=_[_0xf3ce('0x34')](_0x3681ab,_0xf3ce('0x31'));_0x3b2833['query']=_['keys'](_0x28df0c[_0xf3ce('0x3a')]);_0x3b2833[_0xf3ce('0x3b')]=_[_0xf3ce('0x3c')](_0x3b2833['model'],_0x3b2833[_0xf3ce('0x3a')]);_0x29f48a[_0xf3ce('0x3d')]=_['intersection'](_0x3b2833[_0xf3ce('0x39')],qs['fields'](_0x28df0c[_0xf3ce('0x3a')][_0xf3ce('0x3e')]));_0x29f48a['attributes']=_0x29f48a[_0xf3ce('0x3d')][_0xf3ce('0x3f')]?_0x29f48a[_0xf3ce('0x3d')]:_0x3b2833[_0xf3ce('0x39')];if(!_0x28df0c[_0xf3ce('0x3a')][_0xf3ce('0x40')](_0xf3ce('0x41'))){_0x29f48a['limit']=qs['limit'](_0x28df0c['query'][_0xf3ce('0x2a')]);_0x29f48a[_0xf3ce('0x29')]=qs[_0xf3ce('0x29')](_0x28df0c[_0xf3ce('0x3a')]['offset']);}_0x29f48a['order']=qs['sort'](_0x28df0c[_0xf3ce('0x3a')]['sort']);_0x29f48a[_0xf3ce('0x42')]=qs[_0xf3ce('0x3b')](_[_0xf3ce('0x43')](_0x28df0c[_0xf3ce('0x3a')],_0x3b2833[_0xf3ce('0x3b')]),_0x3681ab);if(_0x28df0c[_0xf3ce('0x3a')][_0xf3ce('0x44')]){_0x29f48a[_0xf3ce('0x42')]=_[_0xf3ce('0x45')](_0x29f48a[_0xf3ce('0x42')],{'$or':_[_0xf3ce('0x34')](_0x3681ab,function(_0x20f792){if(_0x20f792[_0xf3ce('0x37')]!=='VIRTUAL'){var _0x5af81f={};_0x5af81f[_0x20f792[_0xf3ce('0x31')]]={'$like':'%'+_0x28df0c[_0xf3ce('0x3a')][_0xf3ce('0x44')]+'%'};return _0x5af81f;}})});}_0x29f48a=_[_0xf3ce('0x45')]({},_0x29f48a,_0x28df0c['options']);var _0x591e75={'where':_0x29f48a[_0xf3ce('0x42')]};return db[_0xf3ce('0x35')][_0xf3ce('0x28')](_0x591e75)[_0xf3ce('0x2f')](function(_0x57b10f){_0x24a8d1['count']=_0x57b10f;if(_0x28df0c[_0xf3ce('0x3a')]['includeAll']){_0x29f48a['include']=[{'all':!![]}];}return db['Network'][_0xf3ce('0x46')](_0x29f48a);})[_0xf3ce('0x2f')](function(_0x264100){_0x24a8d1[_0xf3ce('0x47')]=_0x264100;return _0x24a8d1;})[_0xf3ce('0x2f')](respondWithFilteredResult(_0x4c2ff7,_0x29f48a))['catch'](handleError(_0x4c2ff7,null));};exports[_0xf3ce('0x48')]=function(_0xfb2467,_0x17154e){var _0xa414d8={'raw':!![],'where':{'id':_0xfb2467[_0xf3ce('0x49')]['id']}},_0x5d76fd={};_0x5d76fd['model']=_[_0xf3ce('0x4a')](db[_0xf3ce('0x35')]['rawAttributes']);_0x5d76fd['query']=_[_0xf3ce('0x4a')](_0xfb2467[_0xf3ce('0x3a')]);_0x5d76fd[_0xf3ce('0x3b')]=_[_0xf3ce('0x3c')](_0x5d76fd['model'],_0x5d76fd[_0xf3ce('0x3a')]);_0xa414d8['attributes']=_[_0xf3ce('0x3c')](_0x5d76fd[_0xf3ce('0x39')],qs[_0xf3ce('0x3e')](_0xfb2467[_0xf3ce('0x3a')][_0xf3ce('0x3e')]));_0xa414d8[_0xf3ce('0x3d')]=_0xa414d8['attributes'][_0xf3ce('0x3f')]?_0xa414d8[_0xf3ce('0x3d')]:_0x5d76fd[_0xf3ce('0x39')];if(_0xfb2467[_0xf3ce('0x3a')]['includeAll']){_0xa414d8[_0xf3ce('0x4b')]=[{'all':!![]}];}_0xa414d8=_[_0xf3ce('0x45')]({},_0xa414d8,_0xfb2467[_0xf3ce('0x4c')]);return db[_0xf3ce('0x35')]['find'](_0xa414d8)[_0xf3ce('0x2f')](handleEntityNotFound(_0x17154e,null))['then'](respondWithResult(_0x17154e,null))[_0xf3ce('0x4d')](handleError(_0x17154e,null));};exports[_0xf3ce('0x4e')]=function(_0x317642,_0x33dda3,_0x3ac54d){var _0x38c7f5;return db[_0xf3ce('0x4f')][_0xf3ce('0x50')](function(_0xe62fc1){return db['Network'][_0xf3ce('0x4e')](_0x317642['body'],{'raw':!![]})[_0xf3ce('0x2f')](function(_0x24c2a5){_0x38c7f5=_0x24c2a5;return db[_0xf3ce('0x35')][_0xf3ce('0x46')]({'where':{'type':_0x317642[_0xf3ce('0x51')][_0xf3ce('0x37')]},'raw':!![]});})[_0xf3ce('0x2f')](function(_0x3eaf26){if(_0x38c7f5[_0xf3ce('0x37')][_0xf3ce('0x52')]()==_0xf3ce('0x53')){var _0x1d16bc=fs['readFileSync'](path[_0xf3ce('0x54')](config[_0xf3ce('0x55')],_0xf3ce('0x56')),_0xf3ce('0x57'));var _0x481b77=ejs[_0xf3ce('0x58')](_0x1d16bc,{'networks':_0x3eaf26||[]});fs[_0xf3ce('0x59')](_0xf3ce('0x5a'),_0x481b77);return respondWithRpcPromise(_0xf3ce('0x5b'),'create',{'module':_0xf3ce('0x5c')});}else if(_0x38c7f5['type'][_0xf3ce('0x52')]()==_0xf3ce('0x5d')){var _0x1f2794=fs['readFileSync'](path[_0xf3ce('0x54')](config[_0xf3ce('0x55')],_0xf3ce('0x5e')),_0xf3ce('0x57'));var _0x427231=ejs['render'](_0x1f2794,{'networks':_0x3eaf26||[]});fs['writeFileSync'](_0xf3ce('0x5f'),_0x427231);return respondWithRpcPromise(_0xf3ce('0x5b'),_0xf3ce('0x4e'),{'module':'res_stun_monitor.so'});}else{var _0x511675=fs['readFileSync'](path[_0xf3ce('0x54')](config[_0xf3ce('0x55')],_0xf3ce('0x60')),'utf8');var _0x919171=ejs[_0xf3ce('0x58')](_0x511675,{'networks':_0x3eaf26||[]});fs['writeFileSync'](util[_0xf3ce('0x61')](_0xf3ce('0x62'),_0x317642[_0xf3ce('0x51')][_0xf3ce('0x37')][_0xf3ce('0x63')]()),_0x919171);return respondWithRpcPromise(_0xf3ce('0x5b'),_0xf3ce('0x4e'),{'module':_0xf3ce('0x64')});}return null;})[_0xf3ce('0x2f')](function(){return _0x38c7f5;});})[_0xf3ce('0x2f')](respondWithResult(_0x33dda3,0xc9))[_0xf3ce('0x4d')](handleError(_0x33dda3,null));};exports[_0xf3ce('0x2e')]=function(_0x4a90ce,_0x14cae6,_0x106b46){var _0x4adb82;return db[_0xf3ce('0x4f')][_0xf3ce('0x50')](function(_0x865f11){return db[_0xf3ce('0x35')][_0xf3ce('0x65')]({'where':{'id':_0x4a90ce[_0xf3ce('0x49')]['id']}})[_0xf3ce('0x2f')](handleEntityNotFound(_0x14cae6,null))[_0xf3ce('0x2f')](saveUpdates(_0x4a90ce[_0xf3ce('0x51')],null))['then'](function(_0x5c8663){if(_0x5c8663){_0x4adb82=_0x5c8663;return db[_0xf3ce('0x35')][_0xf3ce('0x46')]({'where':{'type':_0x4adb82[_0xf3ce('0x37')]},'raw':!![]});}return null;})[_0xf3ce('0x2f')](function(_0x276770){if(_0x4adb82[_0xf3ce('0x37')][_0xf3ce('0x52')]()==_0xf3ce('0x53')){var _0x276388=fs['readFileSync'](path[_0xf3ce('0x54')](config['root'],_0xf3ce('0x56')),_0xf3ce('0x57'));var _0x3d0d24=ejs[_0xf3ce('0x58')](_0x276388,{'networks':_0x276770||[]});fs[_0xf3ce('0x59')]('/etc/asterisk/stun_xcally.conf',_0x3d0d24);return respondWithRpcPromise(_0xf3ce('0x5b'),'update',{'module':_0xf3ce('0x5c')});}else if(_0x4adb82[_0xf3ce('0x37')][_0xf3ce('0x52')]()==_0xf3ce('0x5d')){var _0x417e9e=fs['readFileSync'](path[_0xf3ce('0x54')](config[_0xf3ce('0x55')],_0xf3ce('0x5e')),_0xf3ce('0x57'));var _0x5239c6=ejs['render'](_0x417e9e,{'networks':_0x276770||[]});fs[_0xf3ce('0x59')](_0xf3ce('0x5f'),_0x5239c6);return respondWithRpcPromise('Reload',_0xf3ce('0x2e'),{'module':'res_stun_monitor.so'});}else{var _0x196fb0=fs['readFileSync'](path['join'](config[_0xf3ce('0x55')],_0xf3ce('0x60')),_0xf3ce('0x57'));var _0x50831d=ejs['render'](_0x196fb0,{'networks':_0x276770||[]});fs[_0xf3ce('0x59')](util[_0xf3ce('0x61')](_0xf3ce('0x62'),_0x4a90ce[_0xf3ce('0x51')][_0xf3ce('0x37')]['toLowerCase']()),_0x50831d);return respondWithRpcPromise('Reload','update',{'module':_0xf3ce('0x64')});}return null;})[_0xf3ce('0x2f')](function(_0x52d4b5){if(_0x52d4b5){return _0x4adb82;}return null;});})[_0xf3ce('0x2f')](respondWithResult(_0x14cae6,null))[_0xf3ce('0x4d')](handleError(_0x14cae6,null));};exports['destroy']=function(_0xde116a,_0x5a7479,_0x58b8c8){var _0x2f96b2;return db[_0xf3ce('0x35')][_0xf3ce('0x65')]({'where':{'id':_0xde116a[_0xf3ce('0x49')]['id']}})['then'](function(_0x326e4c){_0x2f96b2=_0x326e4c;return _0x326e4c;})[_0xf3ce('0x2f')](handleEntityNotFound(_0x5a7479,null))[_0xf3ce('0x2f')](removeEntity(_0x5a7479,null))[_0xf3ce('0x2f')](function(){if(_0x2f96b2){return db[_0xf3ce('0x35')][_0xf3ce('0x46')]({'where':{'type':_0x2f96b2[_0xf3ce('0x37')]},'raw':!![]});}})[_0xf3ce('0x2f')](function(_0x23d29f){if(_0x2f96b2[_0xf3ce('0x37')][_0xf3ce('0x52')]()=='STUN'){var _0x5bd030=fs['readFileSync'](path[_0xf3ce('0x54')](config[_0xf3ce('0x55')],_0xf3ce('0x56')),'utf8');var _0x15fb75=ejs[_0xf3ce('0x58')](_0x5bd030,{'networks':_0x23d29f||[]});fs['writeFileSync'](_0xf3ce('0x5a'),_0x15fb75);return respondWithRpcPromise(_0xf3ce('0x5b'),_0xf3ce('0x66'),{'module':'res_stun_monitor.so'});}else if(_0x2f96b2[_0xf3ce('0x37')][_0xf3ce('0x52')]()==_0xf3ce('0x5d')){var _0x38ae5e=fs['readFileSync'](path['join'](config[_0xf3ce('0x55')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x760aaa=ejs[_0xf3ce('0x58')](_0x38ae5e,{'networks':_0x23d29f||[]});fs[_0xf3ce('0x59')]('/etc/asterisk/turn_xcally.conf',_0x760aaa);return respondWithRpcPromise(_0xf3ce('0x5b'),_0xf3ce('0x66'),{'module':_0xf3ce('0x5c')});}else{var _0x32608c=fs['readFileSync'](path[_0xf3ce('0x54')](config['root'],_0xf3ce('0x60')),_0xf3ce('0x57'));var _0xac67d1=ejs[_0xf3ce('0x58')](_0x32608c,{'networks':_0x23d29f||[]});fs[_0xf3ce('0x59')](util[_0xf3ce('0x61')](_0xf3ce('0x62'),_0xde116a[_0xf3ce('0x51')]['type'][_0xf3ce('0x63')]()),_0xac67d1);return respondWithRpcPromise('Reload',_0xf3ce('0x66'),{'module':_0xf3ce('0x64')});}return null;})['catch'](handleError(_0x5a7479,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 7e9b8ee..8940268 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 _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 +var _0xcb79=['exports','define','Network','network','lodash','util','../../config/logger','api','bluebird','rimraf'];(function(_0x4ed3c3,_0x44ccc1){var _0x6215b9=function(_0x381cb3){while(--_0x381cb3){_0x4ed3c3['push'](_0x4ed3c3['shift']());}};_0x6215b9(++_0x44ccc1);}(_0xcb79,0xe0));var _0x9cb7=function(_0x4cbe23,_0x53c1aa){_0x4cbe23=_0x4cbe23-0x0;var _0x2045d=_0xcb79[_0x4cbe23];return _0x2045d;};'use strict';var _=require(_0x9cb7('0x0'));var util=require(_0x9cb7('0x1'));var logger=require(_0x9cb7('0x2'))(_0x9cb7('0x3'));var moment=require('moment');var BPromise=require(_0x9cb7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9cb7('0x5'));var config=require('../../config/environment');var attributes=require('./network.attributes');module[_0x9cb7('0x6')]=function(_0x221900,_0x39c7b6){return _0x221900[_0x9cb7('0x7')](_0x9cb7('0x8'),attributes,{'tableName':_0x9cb7('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 a4bda46..fd614f3 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 _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 +var _0x1401=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','randomstring'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1401,0x138));var _0x1140=function(_0x18a47f,_0x46c322){_0x18a47f=_0x18a47f-0x0;var _0x321c5c=_0x1401[_0x18a47f];return _0x321c5c;};'use strict';var _=require(_0x1140('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1140('0x1'));var rs=require(_0x1140('0x2'));var fs=require('fs');var Redis=require(_0x1140('0x3'));var db=require(_0x1140('0x4'))['db'];var utils=require(_0x1140('0x5'));var logger=require(_0x1140('0x6'))('rpc');var config=require(_0x1140('0x7'));var jayson=require(_0x1140('0x8'));var client=jayson['client'][_0x1140('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2750a1,_0xdf8302,_0x57780){return new BPromise(function(_0x2a8e83,_0x453fc8){return client[_0x1140('0xa')](_0x2750a1,_0x57780)['then'](function(_0x5f49ef){logger[_0x1140('0xb')](_0x1140('0xc'),_0xdf8302,_0x1140('0xd'));logger[_0x1140('0xe')](_0x1140('0xf'),_0xdf8302,'request\x20sent',JSON[_0x1140('0x10')](_0x5f49ef));if(_0x5f49ef[_0x1140('0x11')]){if(_0x5f49ef[_0x1140('0x11')][_0x1140('0x12')]===0x1f4){logger[_0x1140('0x11')]('Network,\x20%s,\x20%s',_0xdf8302,_0x5f49ef[_0x1140('0x11')]['message']);return _0x453fc8(_0x5f49ef[_0x1140('0x11')][_0x1140('0x13')]);}logger['error'](_0x1140('0xc'),_0xdf8302,_0x5f49ef[_0x1140('0x11')][_0x1140('0x13')]);return _0x2a8e83(_0x5f49ef[_0x1140('0x11')][_0x1140('0x13')]);}else{logger['info'](_0x1140('0xc'),_0xdf8302,_0x1140('0xd'));_0x2a8e83(_0x5f49ef['result']['message']);}})[_0x1140('0x14')](function(_0x12ab1e){logger[_0x1140('0x11')](_0x1140('0xc'),_0xdf8302,_0x12ab1e);_0x453fc8(_0x12ab1e);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index f1b9015..fd69c73 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 _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 +var _0x8293=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./notification.controller','post','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8293,0x18b));var _0x3829=function(_0x62fb19,_0x4cdf40){_0x62fb19=_0x62fb19-0x0;var _0x36becf=_0x8293[_0x62fb19];return _0x36becf;};'use strict';var multer=require(_0x3829('0x0'));var util=require(_0x3829('0x1'));var path=require(_0x3829('0x2'));var timeout=require(_0x3829('0x3'));var express=require(_0x3829('0x4'));var router=express[_0x3829('0x5')]();var auth=require(_0x3829('0x6'));var interaction=require(_0x3829('0x7'));var config=require(_0x3829('0x8'));var controller=require(_0x3829('0x9'));router[_0x3829('0xa')]('/',auth['isAuthenticated'](),controller['sendNotification']);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 e9e2fa8..7c70a1a 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 _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 +var _0xf57c=['TEXT','STRING','BOOLEAN','exports'];(function(_0x48aaca,_0x140945){var _0xac5ed9=function(_0x180b19){while(--_0x180b19){_0x48aaca['push'](_0x48aaca['shift']());}};_0xac5ed9(++_0x140945);}(_0xf57c,0xb7));var _0xcf57=function(_0x4e7a0d,_0xb49b8c){_0x4e7a0d=_0x4e7a0d-0x0;var _0x3ed3d1=_0xf57c[_0x4e7a0d];return _0x3ed3d1;};'use strict';var Sequelize=require('sequelize');module[_0xcf57('0x0')]={'body':{'type':Sequelize[_0xcf57('0x1')]},'senderName':{'type':Sequelize[_0xcf57('0x2')]},'recipientsId':{'type':Sequelize[_0xcf57('0x1')]},'recipientsDescription':{'type':Sequelize[_0xcf57('0x2')]},'beep':{'type':Sequelize[_0xcf57('0x3')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 042008c..a277b7f 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 _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 +var _0x522b=['sortBy','join','sequelize','transaction','Notification','create','recipient','emit','notification:send','text','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','forEach','User','ids','queue','replace','Queue','push','getAgents','map','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','name','send','sendNotification','hasOwnProperty','body','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','ValidationError','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','some','includes','model','senderName','fullname','recipientsDescription','isEmpty','beep','user','recipientsId'];(function(_0x1bba4c,_0x2d2378){var _0x4780a7=function(_0x57613d){while(--_0x57613d){_0x1bba4c['push'](_0x1bba4c['shift']());}};_0x4780a7(++_0x2d2378);}(_0x522b,0x1a0));var _0xb522=function(_0x1e4f2f,_0x35edfa){_0x1e4f2f=_0x1e4f2f-0x0;var _0xccea89=_0x522b[_0x1e4f2f];return _0xccea89;};'use strict';var pdf=require(_0xb522('0x0'));var emlformat=require(_0xb522('0x1'));var rimraf=require(_0xb522('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb522('0x3'));var rp=require(_0xb522('0x4'));var moment=require(_0xb522('0x5'));var BPromise=require(_0xb522('0x6'));var Mustache=require(_0xb522('0x7'));var util=require(_0xb522('0x8'));var path=require(_0xb522('0x9'));var sox=require(_0xb522('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb522('0xb'));var squel=require('squel');var crypto=require(_0xb522('0xc'));var jsforce=require(_0xb522('0xd'));var deskjs=require(_0xb522('0xe'));var toCsv=require(_0xb522('0xf'));var querystring=require(_0xb522('0x10'));var Papa=require('papaparse');var Redis=require(_0xb522('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb522('0x12'));var as=require(_0xb522('0x13'));var hardwareService=require(_0xb522('0x14'));var logger=require(_0xb522('0x15'))('api');var utils=require(_0xb522('0x16'));var config=require(_0xb522('0x17'));var db=require(_0xb522('0x18'))['db'];config[_0xb522('0x19')]=_[_0xb522('0x1a')](config[_0xb522('0x19')],{'host':_0xb522('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./notification.socket')[_0xb522('0x1c')](socket);function respondWithStatusCode(_0x562af4,_0x5d13e7){_0x5d13e7=_0x5d13e7||0xcc;return function(_0x505b44){if(_0x505b44){return _0x562af4[_0xb522('0x1d')](_0x5d13e7);}return _0x562af4[_0xb522('0x1e')](_0x5d13e7)[_0xb522('0x1f')]();};}function respondWithResult(_0x136c90,_0x3b864f){_0x3b864f=_0x3b864f||0xc8;return function(_0x6b3e77){if(_0x6b3e77){return _0x136c90[_0xb522('0x1e')](_0x3b864f)[_0xb522('0x20')](_0x6b3e77);}};}function respondWithFilteredResult(_0x40b8b8,_0x1b4cb2){return function(_0xae5b1){if(_0xae5b1){var _0x1f0748=_0xae5b1[_0xb522('0x21')],_0x559917=_0x1b4cb2['offset'],_0x2840e0=_0x1b4cb2[_0xb522('0x22')]+_0x1b4cb2[_0xb522('0x23')],_0x240f9a;if(_0x2840e0>=_0x1f0748){_0x2840e0=_0x1f0748;_0x240f9a=0xc8;}else{_0x240f9a=0xce;}_0x40b8b8[_0xb522('0x1e')](_0x240f9a);return _0x40b8b8[_0xb522('0x24')](_0xb522('0x25'),_0x559917+'-'+_0x2840e0+'/'+_0x1f0748)[_0xb522('0x20')](_0xae5b1);}return null;};}function patchUpdates(_0x593f8e){return function(_0x1c5613){try{jsonpatch[_0xb522('0x26')](_0x1c5613,_0x593f8e,!![]);}catch(_0x25fa15){return BPromise['reject'](_0x25fa15);}return _0x1c5613[_0xb522('0x27')]();};}function saveUpdates(_0x43aadc,_0x13e9c6){return function(_0x19bff2){if(_0x19bff2){return _0x19bff2[_0xb522('0x28')](_0x43aadc)['then'](function(_0xb812d2){return _0xb812d2;});}return null;};}function removeEntity(_0x389e69,_0x32c9d4){return function(_0x554eba){if(_0x554eba){return _0x554eba[_0xb522('0x29')]()[_0xb522('0x2a')](function(){_0x389e69[_0xb522('0x1e')](0xcc)[_0xb522('0x1f')]();});}};}function handleEntityNotFound(_0x390875,_0x1f05b0){return function(_0x3a9f54){if(!_0x3a9f54){_0x390875[_0xb522('0x1d')](0x194);}return _0x3a9f54;};}function handleError(_0x5790c5,_0x4699d8){_0x4699d8=_0x4699d8||0x1f4;return function(_0x541992){logger[_0xb522('0x2b')](_0x541992['stack']);if(_0x541992['name']){delete _0x541992[_0xb522('0x2c')];}_0x5790c5[_0xb522('0x1e')](_0x4699d8)[_0xb522('0x2d')](_0x541992);};}exports[_0xb522('0x2e')]=function(_0x59d25f,_0x246e03,_0x1a7ecd){if(!_0x59d25f['body'][_0xb522('0x2f')]('text')&&!_0x59d25f[_0xb522('0x30')]['hasOwnProperty'](_0xb522('0x31'))){throw new db[(_0xb522('0x32'))]['ValidationError'](_0xb522('0x33'));}else{if(_0x59d25f['body'][_0xb522('0x2f')]('TemplateId')&&!_0x59d25f['body'][_0xb522('0x2f')](_0xb522('0x34'))){throw new db[(_0xb522('0x32'))][(_0xb522('0x35'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x59d25f[_0xb522('0x30')][_0xb522('0x2f')](_0xb522('0x36'))){throw new db[(_0xb522('0x32'))][(_0xb522('0x35'))](_0xb522('0x37'));}else{try{var _0x4c6251=JSON[_0xb522('0x38')](_0x59d25f['body']['recipients']);}catch(_0x380660){logger[_0xb522('0x2b')](_0x380660);throw new db['Sequelize'][(_0xb522('0x35'))](_0xb522('0x39'));}var _0x2776e9=[_0xb522('0x3a'),_0xb522('0x3b'),_0xb522('0x3c'),_0xb522('0x3d'),'smsqueue',_0xb522('0x3e'),_0xb522('0x3f'),'team','user'];if(_[_0xb522('0x40')](_0x4c6251,function(_0x18de7d){return!_[_0xb522('0x41')](_0x2776e9,_0x18de7d[_0xb522('0x42')]['toLowerCase']());})){throw new db[(_0xb522('0x32'))]['ValidationError']('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x4f6d71={};_0x4f6d71[_0xb522('0x43')]=_0x59d25f[_0xb522('0x30')][_0xb522('0x2f')](_0xb522('0x43'))?_0x59d25f[_0xb522('0x30')][_0xb522('0x43')]:_0x59d25f['user'][_0xb522('0x44')];_0x4f6d71[_0xb522('0x45')]=_[_0xb522('0x46')](_0x59d25f[_0xb522('0x30')]['recipientsDescription'])?null:_0x59d25f['body'][_0xb522('0x45')];_0x4f6d71[_0xb522('0x47')]=_0x59d25f[_0xb522('0x30')][_0xb522('0x47')]||![];_0x4f6d71['SenderId']=_0x59d25f[_0xb522('0x48')]['id'];return getContent(_0x59d25f[_0xb522('0x30')])[_0xb522('0x2a')](function(_0x3b4be2){_0x4f6d71[_0xb522('0x30')]=_0x3b4be2;return getRecipients(_0x4c6251);})[_0xb522('0x2a')](function(_0x68b847){_0x4f6d71[_0xb522('0x49')]=_[_0xb522('0x4a')](_0x68b847)[_0xb522('0x4b')](',');return db[_0xb522('0x4c')][_0xb522('0x4d')](function(_0x53e2f0){return db[_0xb522('0x4e')][_0xb522('0x4f')](_0x4f6d71,{'raw':!![],'transaction':_0x53e2f0})[_0xb522('0x2a')](function(_0x293e83){var _0x187460={'sender':_0x4f6d71[_0xb522('0x43')],'description':_0x4f6d71['recipientsDescription'],'content':_0x4f6d71[_0xb522('0x30')],'beep':_0x4f6d71['beep']};_0x68b847['forEach'](function(_0x5e545c){_0x187460[_0xb522('0x50')]=_0x5e545c;socket[_0xb522('0x51')](_0xb522('0x52'),_0x187460);});return _0x293e83;});});})[_0xb522('0x2a')](respondWithResult(_0x246e03,0xc9))['catch'](handleError(_0x246e03,null));};function getContent(_0xd22336){return new BPromise(function(_0x48ab64,_0x4dfe7e){if(_0xd22336[_0xb522('0x53')]){_0x48ab64(_0xd22336['text']);return;}return db[_0xb522('0x54')][_0xb522('0x55')]({'attributes':['html'],'where':{'id':_0xd22336['TemplateId']},'raw':!![]})[_0xb522('0x2a')](function(_0x2ce92a){if(!_0x2ce92a)throw new db[(_0xb522('0x32'))][(_0xb522('0x35'))](_0xb522('0x56'));var _0x128bf4=Mustache[_0xb522('0x57')](_0x2ce92a['html'],_0xd22336[_0xb522('0x34')]);_0x48ab64(_0x128bf4);})[_0xb522('0x58')](function(_0x1786d7){_0x4dfe7e(_0x1786d7);});});}function getRecipients(_0x3e19b5){return new BPromise(function(_0xb25d48,_0x430349){var _0x4d0110=[];var _0x4ec757=[];_0x3e19b5[_0xb522('0x59')](function(_0x5ab63e){var _0x298608=_['startCase'](_0x5ab63e[_0xb522('0x42')]['toLowerCase']());if(_0x298608===_0xb522('0x5a')){_0x4d0110=_['union'](_0x4d0110,_0x5ab63e[_0xb522('0x5b')]);}else{if(_[_0xb522('0x41')](_0x298608,_0xb522('0x5c')))_0x298608=_0x298608[_0xb522('0x5d')](_0xb522('0x5c'),_0xb522('0x5e'));_0x5ab63e[_0xb522('0x5b')][_0xb522('0x59')](function(_0x48b45c){_0x4ec757[_0xb522('0x5f')](getAgents(_0x298608,_0x48b45c));});}});return BPromise['all'](_0x4ec757)[_0xb522('0x2a')](function(_0xc215e9){_0x4d0110=_['union'](_0x4d0110,_['flatten'](_0xc215e9));_0xb25d48(_0x4d0110);})['catch'](function(_0x45d05f){_0x430349(_0x45d05f);});});}function getAgents(_0x4de672,_0x4db67e){return new BPromise(function(_0x4647d6,_0x46aecc){return db[_0x4de672]['findOne']({'where':{'id':_0x4db67e}})[_0xb522('0x2a')](function(_0x264e3f){return _0x264e3f[_0xb522('0x60')]({'attributes':['id'],'raw':!![]})[_0xb522('0x2a')](function(_0x10eed2){var _0x50e0ea=_[_0xb522('0x61')](_0x10eed2,'id');_0x4647d6(_0x50e0ea);});})[_0xb522('0x58')](function(_0x536815){_0x46aecc(_0x536815);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index 504c04f..e530bf3 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 _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 +var _0x2032=['exports','../../mysqldb','Notification','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x14a0a0,_0x45d0cf){var _0x56b651=function(_0x1fae09){while(--_0x1fae09){_0x14a0a0['push'](_0x14a0a0['shift']());}};_0x56b651(++_0x45d0cf);}(_0x2032,0xd9));var _0x2203=function(_0x5dcfb1,_0x5659f3){_0x5dcfb1=_0x5dcfb1-0x0;var _0x5b08da=_0x2032[_0x5dcfb1];return _0x5b08da;};'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 d1d7fbd..1ee0921 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 _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 +var _0x2d18=['path','./notification.attributes','exports','define','Notification','notifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3ada78,_0x104fb7){var _0x38f686=function(_0x5d094c){while(--_0x5d094c){_0x3ada78['push'](_0x3ada78['shift']());}};_0x38f686(++_0x104fb7);}(_0x2d18,0x1e8));var _0x82d1=function(_0x5ef1a3,_0x399b81){_0x5ef1a3=_0x5ef1a3-0x0;var _0x18331b=_0x2d18[_0x5ef1a3];return _0x18331b;};'use strict';var _=require(_0x82d1('0x0'));var util=require(_0x82d1('0x1'));var logger=require(_0x82d1('0x2'))(_0x82d1('0x3'));var moment=require(_0x82d1('0x4'));var BPromise=require(_0x82d1('0x5'));var rp=require(_0x82d1('0x6'));var fs=require('fs');var path=require(_0x82d1('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x82d1('0x8'));module[_0x82d1('0x9')]=function(_0x3bc656,_0x50f997){return _0x3bc656[_0x82d1('0xa')](_0x82d1('0xb'),attributes,{'tableName':_0x82d1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x82d1('0xd'),'collate':_0x82d1('0xe')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index 96134a4..0ec09e8 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 _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 +var _0x05c2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./notification.socket','request','then','info','Notification,\x20%s,\x20%s','Notification,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x05c2,0x1b8));var _0x205c=function(_0x451dea,_0x20874f){_0x451dea=_0x451dea-0x0;var _0x185d38=_0x05c2[_0x451dea];return _0x185d38;};'use strict';var _=require('lodash');var util=require(_0x205c('0x0'));var moment=require(_0x205c('0x1'));var BPromise=require(_0x205c('0x2'));var rs=require(_0x205c('0x3'));var fs=require('fs');var Redis=require(_0x205c('0x4'));var db=require(_0x205c('0x5'))['db'];var utils=require(_0x205c('0x6'));var logger=require(_0x205c('0x7'))('rpc');var config=require(_0x205c('0x8'));var jayson=require(_0x205c('0x9'));var client=jayson[_0x205c('0xa')][_0x205c('0xb')]({'port':0x232a});config[_0x205c('0xc')]=_[_0x205c('0xd')](config[_0x205c('0xc')],{'host':_0x205c('0xe'),'port':0x18eb});var socket=require(_0x205c('0xf'))(new Redis(config[_0x205c('0xc')]));require(_0x205c('0x10'))['register'](socket);function respondWithRpcPromise(_0x1b9ca1,_0x4c2188,_0x8c7d47){return new BPromise(function(_0x29e6ad,_0x1510a1){return client[_0x205c('0x11')](_0x1b9ca1,_0x8c7d47)[_0x205c('0x12')](function(_0x4af896){logger[_0x205c('0x13')](_0x205c('0x14'),_0x4c2188,'request\x20sent');logger['debug'](_0x205c('0x15'),_0x4c2188,'request\x20sent',JSON['stringify'](_0x4af896));if(_0x4af896[_0x205c('0x16')]){if(_0x4af896[_0x205c('0x16')]['code']===0x1f4){logger['error'](_0x205c('0x14'),_0x4c2188,_0x4af896['error'][_0x205c('0x17')]);return _0x1510a1(_0x4af896[_0x205c('0x16')]['message']);}logger['error'](_0x205c('0x14'),_0x4c2188,_0x4af896[_0x205c('0x16')][_0x205c('0x17')]);return _0x29e6ad(_0x4af896[_0x205c('0x16')][_0x205c('0x17')]);}else{logger[_0x205c('0x13')](_0x205c('0x14'),_0x4c2188,'request\x20sent');_0x29e6ad(_0x4af896[_0x205c('0x18')][_0x205c('0x17')]);}})[_0x205c('0x19')](function(_0x39cf22){logger['error'](_0x205c('0x14'),_0x4c2188,_0x39cf22);_0x1510a1(_0x39cf22);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 24a9620..82ddfe5 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 _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 +var _0xdd36=['update','emit','register','length','notification:','./notification.events','remove'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xdd36,0xfa));var _0x6dd3=function(_0x691be6,_0x24ca8d){_0x691be6=_0x691be6-0x0;var _0x259a51=_0xdd36[_0x691be6];return _0x259a51;};'use strict';var NotificationEvents=require(_0x6dd3('0x0'));var events=['save',_0x6dd3('0x1'),_0x6dd3('0x2')];function createListener(_0x5191aa,_0x5b0c7b){return function(_0x2ae041){_0x5b0c7b[_0x6dd3('0x3')](_0x5191aa,_0x2ae041);};}function removeListener(_0x2428d4,_0x20487e){return function(){NotificationEvents['removeListener'](_0x2428d4,_0x20487e);};}exports[_0x6dd3('0x4')]=function(_0x58ec2c){for(var _0x4e6dc0=0x0,_0x2de678=events[_0x6dd3('0x5')];_0x4e6dc0<_0x2de678;_0x4e6dc0++){var _0xd1398f=events[_0x4e6dc0];var _0x14896a=createListener(_0x6dd3('0x6')+_0xd1398f,_0x58ec2c);NotificationEvents['on'](_0xd1398f,_0x14896a);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index ea6e604..e0dfee4 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 _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 +var _0x972f=['/:id/dispositions','getDispositions','/:id/canned_answers','getApplications','/:id/interactions','/:id/users','getAgents','post','create','addDisposition','addAnswer','notify','/:id/applications','addApplications','addAgents','/:id/send','send','put','delete','destroy','removeDispositions','removeAgents','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','show'];(function(_0xf2682d,_0x48f012){var _0x53dea0=function(_0x47235e){while(--_0x47235e){_0xf2682d['push'](_0xf2682d['shift']());}};_0x53dea0(++_0x48f012);}(_0x972f,0xcf));var _0xf972=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x972f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf972('0x0'));var util=require(_0xf972('0x1'));var path=require('path');var timeout=require(_0xf972('0x2'));var express=require('express');var router=express[_0xf972('0x3')]();var auth=require(_0xf972('0x4'));var interaction=require(_0xf972('0x5'));var config=require(_0xf972('0x6'));var controller=require(_0xf972('0x7'));router['get']('/',auth[_0xf972('0x8')](),controller[_0xf972('0x9')]);router[_0xf972('0xa')](_0xf972('0xb'),auth[_0xf972('0x8')](),controller[_0xf972('0xc')]);router[_0xf972('0xa')](_0xf972('0xd'),auth[_0xf972('0x8')](),controller[_0xf972('0xe')]);router[_0xf972('0xa')](_0xf972('0xf'),auth[_0xf972('0x8')](),controller[_0xf972('0x10')]);router[_0xf972('0xa')](_0xf972('0x11'),auth[_0xf972('0x8')](),controller['getAnswers']);router[_0xf972('0xa')]('/:id/applications',auth[_0xf972('0x8')](),controller[_0xf972('0x12')]);router['get'](_0xf972('0x13'),auth[_0xf972('0x8')](),controller['getInteractions']);router['get'](_0xf972('0x14'),auth[_0xf972('0x8')](),controller[_0xf972('0x15')]);router[_0xf972('0x16')]('/',auth['isAuthenticated'](),controller[_0xf972('0x17')]);router['post'](_0xf972('0xf'),auth['isAuthenticated'](),controller[_0xf972('0x18')]);router[_0xf972('0x16')](_0xf972('0x11'),auth[_0xf972('0x8')](),controller[_0xf972('0x19')]);router[_0xf972('0x16')]('/:id/notify',controller[_0xf972('0x1a')]);router['post'](_0xf972('0x1b'),auth[_0xf972('0x8')](),controller[_0xf972('0x1c')]);router[_0xf972('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0xf972('0x1d')]);router[_0xf972('0x16')](_0xf972('0x1e'),auth[_0xf972('0x8')](),controller[_0xf972('0x1f')]);router[_0xf972('0x20')](_0xf972('0xd'),auth[_0xf972('0x8')](),controller['update']);router[_0xf972('0x21')]('/:id',auth[_0xf972('0x8')](),controller[_0xf972('0x22')]);router[_0xf972('0x21')](_0xf972('0xf'),auth[_0xf972('0x8')](),controller[_0xf972('0x23')]);router['delete'](_0xf972('0x11'),auth[_0xf972('0x8')](),controller['removeAnswers']);router[_0xf972('0x21')](_0xf972('0x14'),auth[_0xf972('0x8')](),controller[_0xf972('0x24')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index d3b113b..5f36bf0 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 _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 +var _0x686c=['generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING'];(function(_0xcc5bbb,_0x24e724){var _0x24874e=function(_0x4df2b3){while(--_0x4df2b3){_0xcc5bbb['push'](_0xcc5bbb['shift']());}};_0x24874e(++_0x24e724);}(_0x686c,0xcf));var _0xc686=function(_0x18eeb7,_0x3af8d2){_0x18eeb7=_0x18eeb7-0x0;var _0x177221=_0x686c[_0x18eeb7];return _0x177221;};'use strict';var Sequelize=require(_0xc686('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xc686('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xc686('0x1')]},'token':{'type':Sequelize[_0xc686('0x1')],'defaultValue':function(){return rs[_0xc686('0x2')]();}},'replyUri':{'type':Sequelize[_0xc686('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xc686('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xc686('0x3')],'defaultValue':function(){return _0xc686('0x4');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc686('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc686('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0xc686('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc686('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc686('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc686('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc686('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xc686('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xc686('0x5')],'defaultValue':![],'comment':_0xc686('0x8'),'set':function(_0x478f62){if(!_0x478f62)this['setDataValue'](_0xc686('0x9'),null);this['setDataValue'](_0xc686('0xa'),_0x478f62);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index f356a2c..ca1b7fa 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 _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 +var _0xa35b=['end','count','offset','Content-Range','json','apply','save','update','get','OpenchannelAccounts','destroy','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','key','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpnechannelAccountId','getDispositions','findOne','length','limit','pick','Disposition','removeDispositions','ids','CannedAnswer','getAnswers','OpenchannelAccountId','findAll','removeAnswers','notify','openchannel','CmContact','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','OpenchannelApplication','applications','Applications','list','orderBy','priority','asc','account','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','messageId','created','interaction','autoclose','push','close','OpenchannelMessage','User','UserId','unshift','agent','*,*,*,*','Start','startRouting','EventManager','addApplications','sequelize','transaction','bulkCreate','getApplications','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','DESC','out','dataValues','Messages','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.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','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','status'];(function(_0x5408c5,_0x317c67){var _0x2c9fe0=function(_0x4cbd5a){while(--_0x4cbd5a){_0x5408c5['push'](_0x5408c5['shift']());}};_0x2c9fe0(++_0x317c67);}(_0xa35b,0x14e));var _0xba35=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xa35b[_0x40a045];return _0x1a687c;};'use strict';var pdf=require(_0xba35('0x0'));var emlformat=require(_0xba35('0x1'));var rimraf=require(_0xba35('0x2'));var zipdir=require(_0xba35('0x3'));var jsonpatch=require(_0xba35('0x4'));var rp=require(_0xba35('0x5'));var moment=require(_0xba35('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xba35('0x7'));var path=require(_0xba35('0x8'));var sox=require(_0xba35('0x9'));var csv=require(_0xba35('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xba35('0xb'));var squel=require('squel');var crypto=require(_0xba35('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xba35('0xa'));var querystring=require(_0xba35('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xba35('0xe'));var qs=require(_0xba35('0xf'));var as=require(_0xba35('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xba35('0x11'));var utils=require(_0xba35('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xba35('0x13')]=_[_0xba35('0x14')](config['redis'],{'host':_0xba35('0x15'),'port':0x18eb});var socket=require(_0xba35('0x16'))(new Redis(config[_0xba35('0x13')]));require(_0xba35('0x17'))[_0xba35('0x18')](socket);var jayson=require(_0xba35('0x19'));var client=jayson[_0xba35('0x1a')][_0xba35('0x1b')]({'port':0x232c});var client9002=jayson[_0xba35('0x1a')][_0xba35('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x359c8a,_0x58d451,_0x1025d8){if(_0x1025d8){var _0xe83efa=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xe83efa[_0xba35('0x1c')](_0x58d451)){return _0x359c8a;}else{throw new db[(_0xba35('0x1d'))][(_0xba35('0x1e'))](_0xba35('0x1f'));}}else{return _0x359c8a;}}function respondWithRpcPromise(_0x1894c4,_0x3f4b4c,_0x3224d0,_0x1b61a0){return new BPromise(function(_0x511412,_0x573eda){var _0x56e0cf=_0x1b61a0||client;return _0x56e0cf[_0xba35('0x20')](_0x1894c4,_0x3224d0)[_0xba35('0x21')](function(_0x26d980){logger['info'](_0xba35('0x22'),_0x3f4b4c,_0xba35('0x23'));logger['debug'](_0xba35('0x24'),_0x3f4b4c,_0xba35('0x23'),JSON[_0xba35('0x25')](_0x26d980));if(_0x26d980[_0xba35('0x26')]){if(_0x26d980[_0xba35('0x26')][_0xba35('0x27')]===0x1f4){logger['error'](_0xba35('0x22'),_0x3f4b4c,_0x26d980['error'][_0xba35('0x28')]);return _0x573eda(_0x26d980[_0xba35('0x26')][_0xba35('0x28')]);}logger['error'](_0xba35('0x22'),_0x3f4b4c,_0x26d980[_0xba35('0x26')]['message']);return _0x511412(_0x26d980[_0xba35('0x26')][_0xba35('0x28')]);}else{logger[_0xba35('0x29')](_0xba35('0x22'),_0x3f4b4c,_0xba35('0x23'));_0x511412(_0x26d980[_0xba35('0x2a')][_0xba35('0x28')]);}})['catch'](function(_0x4562e5){logger['error'](_0xba35('0x22'),_0x3f4b4c,_0x4562e5);_0x573eda(_0x4562e5);});});}function respondWithStatusCode(_0x7bfcf2,_0x2d4be3){_0x2d4be3=_0x2d4be3||0xcc;return function(_0xbd9186){if(_0xbd9186){return _0x7bfcf2['sendStatus'](_0x2d4be3);}return _0x7bfcf2[_0xba35('0x2b')](_0x2d4be3)[_0xba35('0x2c')]();};}function respondWithResult(_0x5d8fb2,_0x5db180){_0x5db180=_0x5db180||0xc8;return function(_0x92887a){if(_0x92887a){return _0x5d8fb2[_0xba35('0x2b')](_0x5db180)['json'](_0x92887a);}};}function respondWithFilteredResult(_0x54501a,_0x574372){return function(_0x31f7fb){if(_0x31f7fb){var _0xc0c9c4=_0x31f7fb[_0xba35('0x2d')],_0xd0594=_0x574372['offset'],_0x18b50f=_0x574372[_0xba35('0x2e')]+_0x574372['limit'],_0x14dea7;if(_0x18b50f>=_0xc0c9c4){_0x18b50f=_0xc0c9c4;_0x14dea7=0xc8;}else{_0x14dea7=0xce;}_0x54501a[_0xba35('0x2b')](_0x14dea7);return _0x54501a['set'](_0xba35('0x2f'),_0xd0594+'-'+_0x18b50f+'/'+_0xc0c9c4)[_0xba35('0x30')](_0x31f7fb);}return null;};}function patchUpdates(_0x1a5424){return function(_0x15bb20){try{jsonpatch[_0xba35('0x31')](_0x15bb20,_0x1a5424,!![]);}catch(_0x5918de){return BPromise['reject'](_0x5918de);}return _0x15bb20[_0xba35('0x32')]();};}function saveUpdates(_0x57d811,_0x1e15d9){return function(_0x47ea7f){if(_0x47ea7f){return _0x47ea7f[_0xba35('0x33')](_0x57d811)['then'](function(_0x2273ae){return _0x2273ae;});}return null;};}function removeEntity(_0x51cf7b,_0x27429e){return function(_0x20d6a3){if(_0x20d6a3){return _0x20d6a3['destroy']()[_0xba35('0x21')](function(){var _0x3f3c01=_0x20d6a3[_0xba35('0x34')]({'plain':!![]});var _0x70c45e=_0xba35('0x35');return db['UserProfileResource'][_0xba35('0x36')]({'where':{'type':_0x70c45e,'resourceId':_0x3f3c01['id']}})[_0xba35('0x21')](function(){return _0x20d6a3;});})[_0xba35('0x21')](function(){_0x51cf7b['status'](0xcc)[_0xba35('0x2c')]();});}};}function handleEntityNotFound(_0xd96f61,_0x261232){return function(_0x28ea4a){if(!_0x28ea4a){_0xd96f61[_0xba35('0x37')](0x194);}return _0x28ea4a;};}function handleError(_0x1a85b6,_0x342885){_0x342885=_0x342885||0x1f4;return function(_0x438eef){logger[_0xba35('0x26')](_0x438eef[_0xba35('0x38')]);if(_0x438eef[_0xba35('0x39')]){delete _0x438eef['name'];}_0x1a85b6[_0xba35('0x2b')](_0x342885)[_0xba35('0x3a')](_0x438eef);};}exports[_0xba35('0x3b')]=function(_0x4824b0,_0x3879a6){var _0x46e32e={'include':[{'model':db[_0xba35('0x3c')],'as':_0xba35('0x3d')}]},_0x49fb41={},_0x586e35={'count':0x0,'rows':[]};var _0x3ec369=_[_0xba35('0x3e')](db[_0xba35('0x3f')][_0xba35('0x40')],function(_0x593020){return{'name':_0x593020[_0xba35('0x41')],'type':_0x593020['type'][_0xba35('0x42')]};});_0x49fb41[_0xba35('0x43')]=_[_0xba35('0x3e')](_0x3ec369,_0xba35('0x39'));_0x49fb41['query']=_[_0xba35('0x44')](_0x4824b0['query']);_0x49fb41[_0xba35('0x45')]=_[_0xba35('0x46')](_0x49fb41['model'],_0x49fb41[_0xba35('0x47')]);_0x46e32e['attributes']=_[_0xba35('0x46')](_0x49fb41['model'],qs[_0xba35('0x48')](_0x4824b0[_0xba35('0x47')][_0xba35('0x48')]));_0x46e32e[_0xba35('0x49')]=_0x46e32e[_0xba35('0x49')]['length']?_0x46e32e[_0xba35('0x49')]:_0x49fb41[_0xba35('0x43')];if(!_0x4824b0['query'][_0xba35('0x4a')](_0xba35('0x4b'))){_0x46e32e['limit']=qs['limit'](_0x4824b0[_0xba35('0x47')]['limit']);_0x46e32e['offset']=qs[_0xba35('0x2e')](_0x4824b0[_0xba35('0x47')][_0xba35('0x2e')]);}_0x46e32e[_0xba35('0x4c')]=qs[_0xba35('0x4d')](_0x4824b0['query']['sort']);_0x46e32e[_0xba35('0x4e')]=qs[_0xba35('0x45')](_['pick'](_0x4824b0[_0xba35('0x47')],_0x49fb41[_0xba35('0x45')]),_0x3ec369);if(_0x4824b0[_0xba35('0x47')][_0xba35('0x4f')]){_0x46e32e[_0xba35('0x4e')]=_['merge'](_0x46e32e[_0xba35('0x4e')],{'$or':_['map'](_0x3ec369,function(_0x58c7b5){if(_0x58c7b5[_0xba35('0x50')]!=='VIRTUAL'){var _0x3483eb={};_0x3483eb[_0x58c7b5[_0xba35('0x39')]]={'$like':'%'+_0x4824b0[_0xba35('0x47')][_0xba35('0x4f')]+'%'};return _0x3483eb;}})});}_0x46e32e=_[_0xba35('0x51')]({},_0x46e32e,_0x4824b0[_0xba35('0x52')]);var _0x2e5f27={'where':_0x46e32e[_0xba35('0x4e')]};return db[_0xba35('0x3f')][_0xba35('0x2d')](_0x2e5f27)[_0xba35('0x21')](function(_0x815b7d){_0x586e35['count']=_0x815b7d;if(_0x4824b0[_0xba35('0x47')][_0xba35('0x53')]){_0x46e32e[_0xba35('0x54')]=[{'all':!![]}];}return db['OpenchannelAccount']['findAll'](_0x46e32e);})[_0xba35('0x21')](function(_0x11c596){_0x586e35[_0xba35('0x55')]=_0x11c596;return _0x586e35;})['then'](respondWithFilteredResult(_0x3879a6,_0x46e32e))[_0xba35('0x56')](handleError(_0x3879a6,null));};exports[_0xba35('0x57')]=function(_0x18cda8,_0x773a24){var _0x27ed25={'raw':![],'where':{'id':_0x18cda8[_0xba35('0x58')]['id']},'include':[{'model':db[_0xba35('0x3c')],'as':_0xba35('0x3d')}]},_0x2aee3f={};_0x2aee3f[_0xba35('0x43')]=_[_0xba35('0x44')](db[_0xba35('0x3f')][_0xba35('0x40')]);_0x2aee3f[_0xba35('0x47')]=_[_0xba35('0x44')](_0x18cda8['query']);_0x2aee3f[_0xba35('0x45')]=_[_0xba35('0x46')](_0x2aee3f[_0xba35('0x43')],_0x2aee3f['query']);_0x27ed25[_0xba35('0x49')]=_[_0xba35('0x46')](_0x2aee3f[_0xba35('0x43')],qs[_0xba35('0x48')](_0x18cda8[_0xba35('0x47')][_0xba35('0x48')]));_0x27ed25['attributes']=_0x27ed25['attributes']['length']?_0x27ed25['attributes']:_0x2aee3f[_0xba35('0x43')];if(_0x18cda8['query'][_0xba35('0x53')]){_0x27ed25['include']=[{'all':!![]}];}_0x27ed25=_[_0xba35('0x51')]({},_0x27ed25,_0x18cda8[_0xba35('0x52')]);return db[_0xba35('0x3f')][_0xba35('0x59')](_0x27ed25)[_0xba35('0x21')](handleEntityNotFound(_0x773a24,null))['then'](respondWithResult(_0x773a24,null))[_0xba35('0x56')](handleError(_0x773a24,null));};exports[_0xba35('0x5a')]=function(_0x56c94f,_0xe52f3e){return db[_0xba35('0x3f')][_0xba35('0x5a')](_0x56c94f[_0xba35('0x5b')],{})[_0xba35('0x21')](function(_0x2d3009){var _0x1da43e=_0x56c94f[_0xba35('0x5c')]['get']({'plain':!![]});if(!_0x1da43e)throw new Error(_0xba35('0x5d'));if(_0x1da43e[_0xba35('0x5e')]==='user'){var _0x3f5525=_0x2d3009['get']({'plain':!![]});var _0x561db2=_0xba35('0x35');return db['UserProfileSection'][_0xba35('0x59')]({'where':{'name':_0x561db2,'userProfileId':_0x1da43e[_0xba35('0x5f')]},'raw':!![]})[_0xba35('0x21')](function(_0x1b865a){if(_0x1b865a&&_0x1b865a[_0xba35('0x60')]===0x0){return db[_0xba35('0x61')][_0xba35('0x5a')]({'name':_0x3f5525[_0xba35('0x39')],'resourceId':_0x3f5525['id'],'type':_0x1b865a[_0xba35('0x39')],'sectionId':_0x1b865a['id']},{})[_0xba35('0x21')](function(){return _0x2d3009;});}else{return _0x2d3009;}})[_0xba35('0x56')](function(_0x24da5d){logger[_0xba35('0x26')](_0xba35('0x62'),_0x24da5d);throw _0x24da5d;});}return _0x2d3009;})[_0xba35('0x21')](respondWithResult(_0xe52f3e,0xc9))['catch'](handleError(_0xe52f3e,null));};exports[_0xba35('0x33')]=function(_0x3d8aaa,_0x19dec7){if(_0x3d8aaa['body']['id']){delete _0x3d8aaa[_0xba35('0x5b')]['id'];}return db[_0xba35('0x3f')][_0xba35('0x59')]({'where':{'id':_0x3d8aaa['params']['id']},'include':[{'model':db[_0xba35('0x3c')],'as':_0xba35('0x3d')}]})[_0xba35('0x21')](handleEntityNotFound(_0x19dec7,null))['then'](saveUpdates(_0x3d8aaa[_0xba35('0x5b')],null))['then'](respondWithResult(_0x19dec7,null))[_0xba35('0x56')](handleError(_0x19dec7,null));};exports[_0xba35('0x36')]=function(_0x180651,_0x3712af){return db[_0xba35('0x3f')][_0xba35('0x59')]({'where':{'id':_0x180651[_0xba35('0x58')]['id']}})[_0xba35('0x21')](handleEntityNotFound(_0x3712af,null))[_0xba35('0x21')](removeEntity(_0x3712af,null))[_0xba35('0x56')](handleError(_0x3712af,null));};exports[_0xba35('0x63')]=function(_0x269f25,_0xe8f696){return db[_0xba35('0x3f')][_0xba35('0x63')]()['then'](respondWithResult(_0xe8f696,null))['catch'](handleError(_0xe8f696,null));};exports[_0xba35('0x64')]=function(_0x52324e,_0x128535,_0x478575){if(_0x52324e[_0xba35('0x5b')]['id']){delete _0x52324e[_0xba35('0x5b')]['id'];}return db[_0xba35('0x3f')]['find']({'where':{'id':_0x52324e['params']['id']}})[_0xba35('0x21')](handleEntityNotFound(_0x128535,null))['then'](function(_0xa98f98){if(_0xa98f98){_0x52324e[_0xba35('0x5b')][_0xba35('0x65')]=_0xa98f98['id'];return db['Disposition']['create'](_0x52324e[_0xba35('0x5b')]);}})[_0xba35('0x21')](respondWithResult(_0x128535,null))[_0xba35('0x56')](handleError(_0x128535,null));};exports[_0xba35('0x66')]=function(_0x374ae9,_0x18aeba,_0x248864){var _0x408a5a={'raw':![],'where':{}};var _0xe1ef5f={};var _0x14a5bd={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xba35('0x67')]({'where':{'id':_0x374ae9[_0xba35('0x58')]['id']}})[_0xba35('0x21')](handleEntityNotFound(_0x18aeba,null))[_0xba35('0x21')](function(_0x5d4f46){if(_0x5d4f46){_0xe1ef5f[_0xba35('0x43')]=_['keys'](db['Disposition'][_0xba35('0x40')]);_0xe1ef5f[_0xba35('0x47')]=_['keys'](_0x374ae9['query']);_0xe1ef5f[_0xba35('0x45')]=_[_0xba35('0x46')](_0xe1ef5f[_0xba35('0x43')],_0xe1ef5f[_0xba35('0x47')]);_0x408a5a[_0xba35('0x49')]=_[_0xba35('0x46')](_0xe1ef5f[_0xba35('0x43')],qs['fields'](_0x374ae9[_0xba35('0x47')][_0xba35('0x48')]));_0x408a5a[_0xba35('0x49')]=_0x408a5a[_0xba35('0x49')][_0xba35('0x68')]?_0x408a5a[_0xba35('0x49')]:_0xe1ef5f['model'];if(!_0x374ae9['query']['hasOwnProperty'](_0xba35('0x4b'))){_0x408a5a[_0xba35('0x69')]=qs[_0xba35('0x69')](_0x374ae9[_0xba35('0x47')][_0xba35('0x69')]);_0x408a5a[_0xba35('0x2e')]=qs[_0xba35('0x2e')](_0x374ae9[_0xba35('0x47')]['offset']);}_0x408a5a[_0xba35('0x4c')]=qs[_0xba35('0x4d')](_0x374ae9[_0xba35('0x47')][_0xba35('0x4d')]);_0x408a5a[_0xba35('0x4e')]=qs['filters'](_[_0xba35('0x6a')](_0x374ae9[_0xba35('0x47')],_0xe1ef5f[_0xba35('0x45')]));_0x408a5a[_0xba35('0x4e')]['OpenchannelAccountId']=_0x5d4f46['id'];if(_0x374ae9[_0xba35('0x47')]['filter']){_0x408a5a[_0xba35('0x4e')]=_[_0xba35('0x51')](_0x408a5a[_0xba35('0x4e')],{'$or':_[_0xba35('0x3e')](_0x408a5a[_0xba35('0x49')],function(_0x53105b){var _0x375dca={};_0x375dca[_0x53105b]={'$like':'%'+_0x374ae9['query']['filter']+'%'};return _0x375dca;})});}_0x408a5a=_['merge']({},_0x408a5a,_0x374ae9[_0xba35('0x52')]);return db[_0xba35('0x6b')]['count']({'where':_0x408a5a[_0xba35('0x4e')]})['then'](function(_0x2a4884){_0x14a5bd[_0xba35('0x2d')]=_0x2a4884;if(_0x374ae9[_0xba35('0x47')]['includeAll']){_0x408a5a['include']=[{'all':!![]}];}return db[_0xba35('0x6b')]['findAll'](_0x408a5a);})['then'](function(_0x3f92ac){_0x14a5bd['rows']=_0x3f92ac;return _0x14a5bd;});}})[_0xba35('0x21')](respondWithFilteredResult(_0x18aeba,_0x408a5a))[_0xba35('0x56')](handleError(_0x18aeba,null));};exports[_0xba35('0x6c')]=function(_0x241b36,_0x18a798,_0x23e81d){return db[_0xba35('0x3f')][_0xba35('0x59')]({'where':{'id':_0x241b36[_0xba35('0x58')]['id']}})['then'](handleEntityNotFound(_0x18a798,null))[_0xba35('0x21')](function(_0x8b59e0){if(_0x8b59e0){return _0x8b59e0[_0xba35('0x6c')](_0x241b36[_0xba35('0x47')][_0xba35('0x6d')]);}})[_0xba35('0x21')](respondWithStatusCode(_0x18a798,null))['catch'](handleError(_0x18a798,null));};exports['addAnswer']=function(_0x412833,_0x1fd4d2,_0x46600a){if(_0x412833[_0xba35('0x5b')]['id']){delete _0x412833[_0xba35('0x5b')]['id'];}return db[_0xba35('0x3f')]['find']({'where':{'id':_0x412833[_0xba35('0x58')]['id']}})[_0xba35('0x21')](handleEntityNotFound(_0x1fd4d2,null))[_0xba35('0x21')](function(_0x384afc){if(_0x384afc){_0x412833[_0xba35('0x5b')]['OpenchannelAccountId']=_0x384afc['id'];return db[_0xba35('0x6e')][_0xba35('0x5a')](_0x412833[_0xba35('0x5b')]);}})['then'](respondWithResult(_0x1fd4d2,null))['catch'](handleError(_0x1fd4d2,null));};exports[_0xba35('0x6f')]=function(_0x5a5447,_0x24eee2,_0x3550a3){var _0x4b5cb2={'raw':![],'where':{}};var _0x4bcc6a={};var _0x50ef6a={'count':0x0,'rows':[]};return db[_0xba35('0x3f')][_0xba35('0x67')]({'where':{'id':_0x5a5447[_0xba35('0x58')]['id']}})['then'](handleEntityNotFound(_0x24eee2,null))[_0xba35('0x21')](function(_0x16ca3e){if(_0x16ca3e){_0x4bcc6a['model']=_[_0xba35('0x44')](db['CannedAnswer'][_0xba35('0x40')]);_0x4bcc6a[_0xba35('0x47')]=_['keys'](_0x5a5447[_0xba35('0x47')]);_0x4bcc6a[_0xba35('0x45')]=_[_0xba35('0x46')](_0x4bcc6a[_0xba35('0x43')],_0x4bcc6a[_0xba35('0x47')]);_0x4b5cb2[_0xba35('0x49')]=_[_0xba35('0x46')](_0x4bcc6a['model'],qs[_0xba35('0x48')](_0x5a5447['query']['fields']));_0x4b5cb2[_0xba35('0x49')]=_0x4b5cb2['attributes'][_0xba35('0x68')]?_0x4b5cb2[_0xba35('0x49')]:_0x4bcc6a[_0xba35('0x43')];if(!_0x5a5447[_0xba35('0x47')][_0xba35('0x4a')](_0xba35('0x4b'))){_0x4b5cb2[_0xba35('0x69')]=qs[_0xba35('0x69')](_0x5a5447[_0xba35('0x47')][_0xba35('0x69')]);_0x4b5cb2[_0xba35('0x2e')]=qs[_0xba35('0x2e')](_0x5a5447[_0xba35('0x47')][_0xba35('0x2e')]);}_0x4b5cb2['order']=qs[_0xba35('0x4d')](_0x5a5447[_0xba35('0x47')][_0xba35('0x4d')]);_0x4b5cb2[_0xba35('0x4e')]=qs[_0xba35('0x45')](_[_0xba35('0x6a')](_0x5a5447[_0xba35('0x47')],_0x4bcc6a[_0xba35('0x45')]));_0x4b5cb2[_0xba35('0x4e')][_0xba35('0x70')]=_0x16ca3e['id'];if(_0x5a5447[_0xba35('0x47')][_0xba35('0x4f')]){_0x4b5cb2[_0xba35('0x4e')]=_[_0xba35('0x51')](_0x4b5cb2[_0xba35('0x4e')],{'$or':_[_0xba35('0x3e')](_0x4b5cb2[_0xba35('0x49')],function(_0xb6f408){var _0x472dde={};_0x472dde[_0xb6f408]={'$like':'%'+_0x5a5447[_0xba35('0x47')][_0xba35('0x4f')]+'%'};return _0x472dde;})});}_0x4b5cb2=_[_0xba35('0x51')]({},_0x4b5cb2,_0x5a5447['options']);return db[_0xba35('0x6e')][_0xba35('0x2d')]({'where':_0x4b5cb2[_0xba35('0x4e')]})[_0xba35('0x21')](function(_0x4f5686){_0x50ef6a[_0xba35('0x2d')]=_0x4f5686;if(_0x5a5447[_0xba35('0x47')][_0xba35('0x53')]){_0x4b5cb2['include']=[{'all':!![]}];}return db[_0xba35('0x6e')][_0xba35('0x71')](_0x4b5cb2);})[_0xba35('0x21')](function(_0x4ccad9){_0x50ef6a['rows']=_0x4ccad9;return _0x50ef6a;});}})['then'](respondWithFilteredResult(_0x24eee2,_0x4b5cb2))[_0xba35('0x56')](handleError(_0x24eee2,null));};exports['removeAnswers']=function(_0x3fd914,_0x4532d1,_0x1a177b){return db[_0xba35('0x3f')][_0xba35('0x59')]({'where':{'id':_0x3fd914[_0xba35('0x58')]['id']}})['then'](handleEntityNotFound(_0x4532d1,null))[_0xba35('0x21')](function(_0x4029d3){if(_0x4029d3){return _0x4029d3[_0xba35('0x72')](_0x3fd914[_0xba35('0x47')][_0xba35('0x6d')]);}})['then'](respondWithStatusCode(_0x4532d1,null))[_0xba35('0x56')](handleError(_0x4532d1,null));};exports[_0xba35('0x73')]=function(_0x50bf7f,_0x1b2695,_0x26c6a4){var _0x1002f4={'body':_0x50bf7f['body'],'channel':_0xba35('0x74')};var _0x980901=[];var _0x5bca67=[];var _0x492fe4={};var _0x473dfc=![];return db[_0xba35('0x75')][_0xba35('0x63')]()[_0xba35('0x21')](function(_0x5293ce){if(!_0x5293ce){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x980901=_[_0xba35('0x76')](_[_0xba35('0x44')](_0x5293ce),[_0xba35('0x77'),_0xba35('0x78')]);_0x5bca67=_[_0xba35('0x76')](_['keys'](_0x5293ce),['createdAt',_0xba35('0x78'),_0xba35('0x79'),_0xba35('0x7a')]);if(_0x50bf7f[_0xba35('0x5b')]['id']){delete _0x50bf7f['body']['id'];}if(_['isNil'](_0x50bf7f[_0xba35('0x5b')][_0xba35('0x7b')])){throw new db[(_0xba35('0x1d'))][(_0xba35('0x1e'))](_0xba35('0x7c'));}if(_[_0xba35('0x7d')](_0x50bf7f[_0xba35('0x5b')][_0xba35('0x5b')])||_0x50bf7f['body']['body']===''){throw new db[(_0xba35('0x1d'))][(_0xba35('0x1e'))](_0xba35('0x7e'));}if(_[_0xba35('0x7d')](_0x50bf7f[_0xba35('0x5b')][_0xba35('0x7f')])){throw new db['Sequelize']['ValidationError'](_0xba35('0x80')+_0x5bca67);}if(!_[_0xba35('0x81')](_0x5bca67,_0x50bf7f[_0xba35('0x5b')][_0xba35('0x7f')])){throw new db[(_0xba35('0x1d'))]['ValidationError'](_0xba35('0x82')+_0x5bca67);}_0x492fe4[_0x50bf7f[_0xba35('0x5b')][_0xba35('0x7f')]]=_0x50bf7f['body'][_0xba35('0x7b')];})[_0xba35('0x21')](function(){return db[_0xba35('0x3f')][_0xba35('0x59')]({'where':{'id':_0x50bf7f[_0xba35('0x58')]['id']},'include':[{'model':db[_0xba35('0x83')],'as':_0xba35('0x84'),'include':[{'model':db[_0xba35('0x75')],'as':_0xba35('0x85'),'where':_0x492fe4,'limit':0x1,'order':[[_0xba35('0x78'),'DESC']]}]},{'model':db[_0xba35('0x86')],'as':'Applications'}]});})[_0xba35('0x21')](handleEntityNotFound(_0x1b2695,null))[_0xba35('0x21')](function(_0x4c38d0){if(_0x4c38d0&&_0x4c38d0['List']){_0x1002f4['account']=_0x4c38d0;_0x1002f4[_0xba35('0x87')]=_0x4c38d0[_0xba35('0x88')];_0x1002f4[_0xba35('0x89')]=_0x4c38d0[_0xba35('0x84')];_0x1002f4[_0xba35('0x87')]=_[_0xba35('0x8a')](_0x1002f4[_0xba35('0x87')],[_0xba35('0x8b')],[_0xba35('0x8c')]);if(_0x1002f4[_0xba35('0x8d')][_0xba35('0x88')]){delete _0x1002f4['account']['Applications'];}if(_0x1002f4[_0xba35('0x8d')]['List']&&_0x1002f4[_0xba35('0x8d')][_0xba35('0x84')]['Contacts']['length']){return _0x1002f4[_0xba35('0x8d')]['List']['Contacts'][0x0];}var _0x3dd403=_[_0xba35('0x14')](_0x50bf7f[_0xba35('0x5b')],{'firstName':_0x50bf7f[_0xba35('0x5b')]['from'],'ListId':_0x4c38d0[_0xba35('0x7a')]});_0x3dd403[_0x50bf7f[_0xba35('0x5b')][_0xba35('0x7f')]]=_0x50bf7f['body'][_0xba35('0x7b')];return db[_0xba35('0x75')][_0xba35('0x5a')](_0x3dd403,{'fields':_0x980901,'raw':!![]});}})[_0xba35('0x21')](handleEntityNotFound(_0x1b2695,null))[_0xba35('0x21')](function(_0x232440){_0x1002f4[_0xba35('0x8e')]=_0x232440;if(_0x232440){var _0x3b482d={'ContactId':_0x232440['id'],'OpenchannelAccountId':_0x50bf7f['params']['id'],'from':(_0x232440[_0xba35('0x8f')]||'')+'\x20'+(_0x232440[_0xba35('0x90')]||'')};var _0x35fe09={'OpenchannelAccountId':_0x50bf7f[_0xba35('0x58')]['id'],'closed':![]};if(_0x50bf7f['body'][_0xba35('0x91')]){_0x35fe09['threadId']=_0x50bf7f[_0xba35('0x5b')][_0xba35('0x91')];return db[_0xba35('0x92')]['find']({'where':_0x35fe09})['then'](function(_0x223f97){if(_0x223f97){return[_0x223f97,![]];}_0x3b482d[_0xba35('0x91')]=_0x50bf7f['body'][_0xba35('0x91')];_0x3b482d[_0xba35('0x93')]=_0x50bf7f[_0xba35('0x5b')]['externalUrl'];return db[_0xba35('0x92')][_0xba35('0x5a')](_0x3b482d)[_0xba35('0x21')](function(_0x33a6eb){return[_0x33a6eb,!![]];});});}else{_0x35fe09[_0xba35('0x91')]=null;}_0x35fe09['ContactId']=_0x232440['id'];return db['OpenchannelInteraction'][_0xba35('0x59')]({'where':_0x35fe09})['then'](function(_0x37db93){if(_0x37db93){return[_0x37db93,![]];}return db[_0xba35('0x92')][_0xba35('0x5a')](_0x3b482d)['then'](function(_0x4f3e4e){return[_0x4f3e4e,!![]];});});}})['spread'](function(_0x52793b,_0x410f6a){if(_0x52793b){_0x473dfc=_0x410f6a;if(!_0x410f6a){var _0x4cd67a={'from':(_0x1002f4[_0xba35('0x8e')][_0xba35('0x8f')]||'')+'\x20'+(_0x1002f4['contact']['lastName']||'')};if(_0x50bf7f['body'][_0xba35('0x91')]&&_0x50bf7f['body'][_0xba35('0x94')]&&_0x50bf7f[_0xba35('0x5b')][_0xba35('0x91')]!=_0x50bf7f[_0xba35('0x5b')][_0xba35('0x94')]){_0x4cd67a[_0xba35('0x91')]=_0x50bf7f[_0xba35('0x5b')]['messageId'];}return _0x52793b['update'](_0x4cd67a);}else{return _0x52793b;}}})['then'](function(_0x286575){_0x1002f4['interaction']=_0x286575[_0xba35('0x34')]({'plain':!![]});_0x1002f4['interaction'][_0xba35('0x95')]=_0x473dfc;if(_0x1002f4[_0xba35('0x96')][_0xba35('0x95')]){if(_0x1002f4[_0xba35('0x8d')][_0xba35('0x97')]){_0x1002f4[_0xba35('0x87')][_0xba35('0x98')]({'id':0x0,'priority':_0x1002f4['applications'][_0xba35('0x68')]+0x1,'app':_0xba35('0x99'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0xba35('0x9a')][_0xba35('0x5a')]({'body':_0x50bf7f[_0xba35('0x5b')][_0xba35('0x5b')],'OpenchannelAccountId':_0x50bf7f[_0xba35('0x58')]['id'],'OpenchannelInteractionId':_0x286575['id'],'direction':'in','ContactId':_0x1002f4[_0xba35('0x8e')]['id'],'AttachmentId':_0x50bf7f[_0xba35('0x5b')]['AttachmentId']});})[_0xba35('0x21')](function(_0xc57cd0){_0x1002f4[_0xba35('0x28')]=_0xc57cd0;if(_0x1002f4['interaction']['UserId']){return db[_0xba35('0x9b')]['find']({'attributes':['id','name'],'where':{'id':_0x1002f4['interaction'][_0xba35('0x9c')]}})[_0xba35('0x21')](function(_0x1094a7){if(_0x1094a7){_0x1002f4[_0xba35('0x87')][_0xba35('0x9d')]({'id':0x0,'priority':0x0,'app':_0xba35('0x9e'),'appdata':_0x1094a7[_0xba35('0x39')]+','+(_0x1002f4[_0xba35('0x8d')]['waitForTheAssignedAgent']||0xa),'interval':_0xba35('0x9f')});_0x1002f4['forcedOwnership']=![];}return respondWithRpcPromise(_0xba35('0xa0'),_0xba35('0xa1'),_0x1002f4);});}return respondWithRpcPromise(_0xba35('0xa0'),_0xba35('0xa1'),_0x1002f4);})[_0xba35('0x21')](function(_0x283774){respondWithRpcPromise(_0xba35('0xa2'),_0xba35('0xa2'),{'event':_0xba35('0x73'),'message':_0x283774},client9002);return _0x283774;})[_0xba35('0x21')](respondWithResult(_0x1b2695,null))[_0xba35('0x56')](handleError(_0x1b2695,null));};exports[_0xba35('0xa3')]=function(_0x30646b,_0x4b9158,_0x35d89c){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x30646b[_0xba35('0x58')]['id']}})[_0xba35('0x21')](handleEntityNotFound(_0x4b9158,null))['then'](function(_0x1690bc){if(_0x1690bc){return db[_0xba35('0xa4')][_0xba35('0xa5')](function(_0x424b45){return db[_0xba35('0x86')][_0xba35('0x36')]({'where':{'OpenchannelAccountId':_0x30646b[_0xba35('0x58')]['id']},'transaction':_0x424b45})[_0xba35('0x21')](function(_0x5e6106){var _0x3b4757=_['map'](_0x30646b['body'],function(_0x30563d){_0x30563d[_0xba35('0x70')]=_0x30646b[_0xba35('0x58')]['id'];return _0x30563d;});return db[_0xba35('0x86')][_0xba35('0xa6')](_0x3b4757,{'transaction':_0x424b45});});})[_0xba35('0x21')](function(){return db[_0xba35('0x86')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x30646b['params']['id']},'order':_0xba35('0x8b')});});}})['then'](respondWithResult(_0x4b9158,null))[_0xba35('0x56')](handleError(_0x4b9158,null));};exports[_0xba35('0xa7')]=function(_0x561ce6,_0xb05484,_0x57887f){var _0x31b139={};var _0x46b71e={};var _0x430c05;var _0x38d50a;return db[_0xba35('0x3f')][_0xba35('0x67')]({'where':{'id':_0x561ce6[_0xba35('0x58')]['id']}})[_0xba35('0x21')](handleEntityNotFound(_0xb05484,null))[_0xba35('0x21')](function(_0x25e879){if(_0x25e879){_0x430c05=_0x25e879;_0x46b71e['model']=_[_0xba35('0x44')](db[_0xba35('0x86')][_0xba35('0x40')]);_0x46b71e[_0xba35('0x47')]=_['keys'](_0x561ce6[_0xba35('0x47')]);_0x46b71e[_0xba35('0x45')]=_[_0xba35('0x46')](_0x46b71e['model'],_0x46b71e[_0xba35('0x47')]);_0x31b139[_0xba35('0x49')]=_[_0xba35('0x46')](_0x46b71e[_0xba35('0x43')],qs[_0xba35('0x48')](_0x561ce6[_0xba35('0x47')][_0xba35('0x48')]));_0x31b139[_0xba35('0x49')]=_0x31b139[_0xba35('0x49')][_0xba35('0x68')]?_0x31b139[_0xba35('0x49')]:_0x46b71e[_0xba35('0x43')];_0x31b139['order']=qs['sort'](_0x561ce6[_0xba35('0x47')][_0xba35('0x4d')]);_0x31b139[_0xba35('0x4e')]=qs[_0xba35('0x45')](_[_0xba35('0x6a')](_0x561ce6[_0xba35('0x47')],_0x46b71e[_0xba35('0x45')]));if(_0x561ce6['query']['filter']){_0x31b139[_0xba35('0x4e')]=_[_0xba35('0x51')](_0x31b139[_0xba35('0x4e')],{'$or':_[_0xba35('0x3e')](_0x31b139[_0xba35('0x49')],function(_0x5c5222){var _0x207ad5={};_0x207ad5[_0x5c5222]={'$like':'%'+_0x561ce6['query'][_0xba35('0x4f')]+'%'};return _0x207ad5;})});}_0x31b139=_[_0xba35('0x51')]({},_0x31b139,_0x561ce6[_0xba35('0x52')]);return _0x430c05['getApplications'](_0x31b139);}})['then'](function(_0x4a5711){if(_0x4a5711){_0x38d50a=_0x4a5711[_0xba35('0x68')];if(!_0x561ce6[_0xba35('0x47')][_0xba35('0x4a')]('nolimit')){_0x31b139[_0xba35('0x69')]=qs[_0xba35('0x69')](_0x561ce6[_0xba35('0x47')][_0xba35('0x69')]);_0x31b139[_0xba35('0x2e')]=qs[_0xba35('0x2e')](_0x561ce6[_0xba35('0x47')][_0xba35('0x2e')]);}return _0x430c05['getApplications'](_0x31b139);}})[_0xba35('0x21')](function(_0x5161a8){if(_0x5161a8){return _0x5161a8?{'count':_0x38d50a,'rows':_0x5161a8}:null;}})['then'](respondWithResult(_0xb05484,null))[_0xba35('0x56')](handleError(_0xb05484,null));};exports['getInteractions']=function(_0x41c408,_0x590924,_0x150128){var _0x17cc42={'raw':![],'where':{}};var _0x47037c={};var _0x1657f9={'count':0x0,'rows':[]};return db[_0xba35('0x3f')][_0xba35('0x67')]({'where':{'id':_0x41c408[_0xba35('0x58')]['id']}})[_0xba35('0x21')](handleEntityNotFound(_0x590924,null))[_0xba35('0x21')](function(_0x331760){if(_0x331760){_0x47037c[_0xba35('0x43')]=_['keys'](db[_0xba35('0x92')][_0xba35('0x40')]);_0x47037c[_0xba35('0x47')]=_[_0xba35('0x44')](_0x41c408['query']);_0x47037c[_0xba35('0x45')]=_[_0xba35('0x46')](_0x47037c[_0xba35('0x43')],_0x47037c[_0xba35('0x47')]);_0x17cc42['attributes']=_[_0xba35('0x46')](_0x47037c[_0xba35('0x43')],qs[_0xba35('0x48')](_0x41c408[_0xba35('0x47')]['fields']));_0x17cc42[_0xba35('0x49')]=_0x17cc42[_0xba35('0x49')][_0xba35('0x68')]?_0x17cc42['attributes']:_0x47037c[_0xba35('0x43')];if(!_0x41c408[_0xba35('0x47')]['hasOwnProperty'](_0xba35('0x4b'))){_0x17cc42[_0xba35('0x69')]=qs[_0xba35('0x69')](_0x41c408[_0xba35('0x47')][_0xba35('0x69')]);_0x17cc42['offset']=qs['offset'](_0x41c408[_0xba35('0x47')][_0xba35('0x2e')]);}_0x17cc42['order']=qs['sort'](_0x41c408[_0xba35('0x47')]['sort']);_0x17cc42[_0xba35('0x4e')]=qs[_0xba35('0x45')](_[_0xba35('0x6a')](_0x41c408['query'],_0x47037c['filters']));_0x17cc42['where'][_0xba35('0x70')]=_0x331760['id'];if(_0x41c408[_0xba35('0x47')][_0xba35('0x4f')]){_0x17cc42[_0xba35('0x4e')]=_[_0xba35('0x51')](_0x17cc42[_0xba35('0x4e')],{'$or':_['map'](_0x17cc42[_0xba35('0x49')],function(_0x566057){var _0x5c9574={};_0x5c9574[_0x566057]={'$like':'%'+_0x41c408['query'][_0xba35('0x4f')]+'%'};return _0x5c9574;})});}_0x17cc42=_[_0xba35('0x51')]({},_0x17cc42,_0x41c408[_0xba35('0x52')]);return db[_0xba35('0x92')][_0xba35('0x2d')]({'where':_0x17cc42[_0xba35('0x4e')]})[_0xba35('0x21')](function(_0x5a1337){_0x1657f9[_0xba35('0x2d')]=_0x5a1337;if(_0x41c408['query'][_0xba35('0x53')]){_0x17cc42['include']=[{'model':db[_0xba35('0x75')],'as':_0xba35('0xa8'),'required':![]},{'model':db[_0xba35('0x9b')],'as':_0xba35('0xa9'),'attributes':[_0xba35('0x39'),_0xba35('0xaa'),_0xba35('0xab')],'required':![]},{'model':db[_0xba35('0xac')],'as':_0xba35('0xad'),'attributes':['id',_0xba35('0x39'),_0xba35('0xae')],'where':_0x41c408[_0xba35('0x47')][_0xba35('0xaf')]?{'id':_0x41c408[_0xba35('0x47')][_0xba35('0xaf')]}:undefined,'required':_0x41c408[_0xba35('0x47')][_0xba35('0xaf')]?!![]:![]}];}return db['OpenchannelInteraction'][_0xba35('0x71')](_0x17cc42);})[_0xba35('0x21')](function(_0x1db318){_0x1657f9[_0xba35('0x55')]=_0x1db318;return _0x1657f9;});}})[_0xba35('0x21')](respondWithFilteredResult(_0x590924,_0x17cc42))[_0xba35('0x56')](handleError(_0x590924,null));};exports[_0xba35('0xb0')]=function(_0x21ac63,_0x2ff37b,_0x1083ad){return db[_0xba35('0x3f')][_0xba35('0x59')]({'where':{'id':_0x21ac63['params']['id']}})[_0xba35('0x21')](handleEntityNotFound(_0x2ff37b,null))[_0xba35('0x21')](function(_0x5192d1){if(_0x5192d1){return _0x5192d1[_0xba35('0xb0')](_0x21ac63['body'][_0xba35('0x6d')],_[_0xba35('0xb1')](_0x21ac63[_0xba35('0x5b')],['ids','id'])||{})[_0xba35('0xb2')](function(_0x207b3c){for(var _0x409b33=0x0;_0x409b33<_0x21ac63[_0xba35('0x5b')]['ids']['length'];_0x409b33+=0x1){socket[_0xba35('0xb3')](_0xba35('0xb4'),{'UserId':_0x21ac63[_0xba35('0x5b')]['ids'][_0x409b33],'OpenchannelAccountId':_0x21ac63[_0xba35('0x58')]['id']});}return _0x207b3c;});}})[_0xba35('0x21')](respondWithResult(_0x2ff37b,null))[_0xba35('0x56')](handleError(_0x2ff37b,null));};exports[_0xba35('0xb5')]=function(_0x3192a8,_0x80705c,_0x5c368a){return db[_0xba35('0x3f')][_0xba35('0x59')]({'where':{'id':_0x3192a8[_0xba35('0x58')]['id']}})[_0xba35('0x21')](handleEntityNotFound(_0x80705c,null))['then'](function(_0x361ddc){if(_0x361ddc){return _0x361ddc[_0xba35('0xb5')](_0x3192a8[_0xba35('0x47')][_0xba35('0x6d')])[_0xba35('0x21')](function(){if(_[_0xba35('0xb6')](_0x3192a8[_0xba35('0x47')]['ids'])){for(var _0x3c863f=0x0;_0x3c863f<_0x3192a8['query'][_0xba35('0x6d')][_0xba35('0x68')];_0x3c863f+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x3192a8[_0xba35('0x47')][_0xba35('0x6d')][_0x3c863f]),'OpenchannelAccountId':Number(_0x3192a8[_0xba35('0x58')]['id'])});}}else{socket[_0xba35('0xb3')](_0xba35('0xb7'),{'UserId':Number(_0x3192a8[_0xba35('0x47')][_0xba35('0x6d')]),'OpenchannelAccountId':Number(_0x3192a8[_0xba35('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x80705c,null))['catch'](handleError(_0x80705c,null));};exports['getAgents']=function(_0x1cecd6,_0x13aad0,_0x252018){var _0x399a86={};var _0x1c34e1={};var _0x3b88d5;var _0x37d408;return db['OpenchannelAccount'][_0xba35('0x67')]({'where':{'id':_0x1cecd6['params']['id']}})['then'](handleEntityNotFound(_0x13aad0,null))['then'](function(_0x462ec8){if(_0x462ec8){_0x3b88d5=_0x462ec8;_0x1c34e1[_0xba35('0x43')]=_[_0xba35('0x44')](db[_0xba35('0x9b')][_0xba35('0x40')]);_0x1c34e1[_0xba35('0x47')]=_['keys'](_0x1cecd6[_0xba35('0x47')]);_0x1c34e1[_0xba35('0x45')]=_[_0xba35('0x46')](_0x1c34e1[_0xba35('0x43')],_0x1c34e1[_0xba35('0x47')]);_0x399a86[_0xba35('0x49')]=_[_0xba35('0x46')](_0x1c34e1[_0xba35('0x43')],qs['fields'](_0x1cecd6[_0xba35('0x47')][_0xba35('0x48')]));_0x399a86[_0xba35('0x49')]=_0x399a86['attributes'][_0xba35('0x68')]?_0x399a86[_0xba35('0x49')]:_0x1c34e1['model'];_0x399a86[_0xba35('0x4c')]=qs['sort'](_0x1cecd6['query']['sort']);_0x399a86[_0xba35('0x4e')]=qs[_0xba35('0x45')](_['pick'](_0x1cecd6[_0xba35('0x47')],_0x1c34e1[_0xba35('0x45')]));if(_0x1cecd6[_0xba35('0x47')][_0xba35('0x4f')]){_0x399a86[_0xba35('0x4e')]=_[_0xba35('0x51')](_0x399a86[_0xba35('0x4e')],{'$or':_['map'](_0x399a86[_0xba35('0x49')],function(_0x5c4a90){var _0x190ce2={};_0x190ce2[_0x5c4a90]={'$like':'%'+_0x1cecd6[_0xba35('0x47')][_0xba35('0x4f')]+'%'};return _0x190ce2;})});}_0x399a86=_[_0xba35('0x51')]({},_0x399a86,_0x1cecd6['options']);return _0x3b88d5['getAgents'](_0x399a86);}})['then'](function(_0x1f2a85){if(_0x1f2a85){_0x37d408=_0x1f2a85['length'];if(!_0x1cecd6[_0xba35('0x47')][_0xba35('0x4a')](_0xba35('0x4b'))){_0x399a86[_0xba35('0x69')]=qs['limit'](_0x1cecd6[_0xba35('0x47')][_0xba35('0x69')]);_0x399a86[_0xba35('0x2e')]=qs[_0xba35('0x2e')](_0x1cecd6[_0xba35('0x47')][_0xba35('0x2e')]);}return _0x3b88d5[_0xba35('0xb8')](_0x399a86);}})[_0xba35('0x21')](function(_0x578e3e){if(_0x578e3e){return _0x578e3e?{'count':_0x37d408,'rows':_0x578e3e}:null;}})['then'](respondWithResult(_0x13aad0,null))[_0xba35('0x56')](handleError(_0x13aad0,null));};exports[_0xba35('0x3a')]=function(_0x232a84,_0x5b1d6c,_0x356e8e){var _0xee4d78,_0x3127a2,_0x4b365f;if(_[_0xba35('0x7d')](_0x232a84[_0xba35('0x5b')][_0xba35('0x5b')])||_0x232a84[_0xba35('0x5b')][_0xba35('0x5b')]===''){throw new db[(_0xba35('0x1d'))]['ValidationError'](_0xba35('0x7e'));}if(_[_0xba35('0x7d')](_0x232a84[_0xba35('0x5b')]['to'])){}_0xee4d78=_0x232a84[_0xba35('0x5b')]['to'];return db[_0xba35('0x3f')][_0xba35('0x67')]({'where':{'id':_0x232a84[_0xba35('0x58')]['id']}})[_0xba35('0x21')](handleEntityNotFound(_0x5b1d6c,null))[_0xba35('0x21')](function(_0x396764){if(_0x396764){return db[_0xba35('0x3f')][_0xba35('0x59')]({'where':{'id':_0x396764['id']},'include':[{'model':db[_0xba35('0x83')],'as':_0xba35('0x84'),'include':[{'model':db['CmContact'],'as':_0xba35('0x85'),'where':{[_0x396764[_0xba35('0x7f')]]:_0xee4d78},'limit':0x1,'order':[[_0xba35('0x78'),_0xba35('0xb9')]]}]}]})[_0xba35('0x21')](handleEntityNotFound(_0x5b1d6c,null))[_0xba35('0x21')](function(_0x2d3f7f){if(_0x2d3f7f&&_0x2d3f7f[_0xba35('0x84')]){_0x3127a2=_0x2d3f7f['get']({'plain':!![]});if(_0x3127a2['List']&&_0x3127a2['List']['Contacts'][_0xba35('0x68')]){return _0x3127a2[_0xba35('0x84')][_0xba35('0x85')][0x0];}return db['CmContact'][_0xba35('0x5a')](_['defaults'](_0x232a84['body'],{'firstName':_0xee4d78,[_0x2d3f7f[_0xba35('0x7f')]]:_0xee4d78,'phone':_0xee4d78,'ListId':_0x3127a2[_0xba35('0x7a')]}));}})['then'](handleEntityNotFound(_0x5b1d6c,null))[_0xba35('0x21')](function(_0x2639b5){if(_0x2639b5){_0x4b365f=_0x2639b5;return db[_0xba35('0x92')][_0xba35('0x59')]({'where':{'ContactId':_0x4b365f['id'],'closed':![],'OpenchannelAccountId':_0x3127a2['id']}})[_0xba35('0x21')](function(_0x17eec2){if(_0x17eec2){return[_0x17eec2,![]];}return db[_0xba35('0x92')][_0xba35('0x5a')]({'UserId':_0x232a84[_0xba35('0x5c')]['id'],'ContactId':_0x4b365f['id'],'OpenchannelAccountId':_0x3127a2['id'],'lastMsgDirection':_0xba35('0xba'),'Messages':[_[_0xba35('0x51')](_0x232a84[_0xba35('0x5b')],{'read':![],'body':_0x232a84['body'][_0xba35('0x5b')],'OpenchannelAccountId':_0x3127a2['id'],'UserId':_0x232a84[_0xba35('0x5c')]['id'],'ContactId':_0x4b365f['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})[_0xba35('0x21')](function(_0x53e1c3){return[_0x53e1c3,!![]];});});}})[_0xba35('0xb2')](function(_0x440cd8,_0xf0df9){if(_0xf0df9){return _0x440cd8;}return db[_0xba35('0x9a')][_0xba35('0x5a')](_['merge'](_0x232a84[_0xba35('0x5b')],{'read':![],'body':_0x232a84[_0xba35('0x5b')][_0xba35('0x5b')],'OpenchannelAccountId':_0x3127a2['id'],'OpenchannelInteractionId':_0x440cd8['id'],'UserId':_0x232a84[_0xba35('0x5c')]['id'],'ContactId':_0x4b365f['id']}))[_0xba35('0x21')](function(_0x2bbf02){_0x440cd8[_0xba35('0xbb')][_0xba35('0xbc')]=[];_0x440cd8[_0xba35('0xbb')]['Messages']['push'](_0x2bbf02[_0xba35('0xbb')]);return _0x440cd8;});});}})['then'](respondWithResult(_0x5b1d6c,null))[_0xba35('0x56')](handleError(_0x5b1d6c,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 4ba9cf0..af8be1e 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 _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 +var _0x2f4f=['hook','exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit'];(function(_0x10784b,_0x59bd34){var _0x3123b4=function(_0x2a58a5){while(--_0x2a58a5){_0x10784b['push'](_0x10784b['shift']());}};_0x3123b4(++_0x59bd34);}(_0x2f4f,0x1d8));var _0xf2f4=function(_0x3aca52,_0x6c028e){_0x3aca52=_0x3aca52-0x0;var _0x4b2fc3=_0x2f4f[_0x3aca52];return _0x4b2fc3;};'use strict';var EventEmitter=require(_0xf2f4('0x0'));var OpenchannelAccount=require(_0xf2f4('0x1'))['db'][_0xf2f4('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xf2f4('0x3')](0x0);var events={'afterCreate':_0xf2f4('0x4'),'afterUpdate':_0xf2f4('0x5'),'afterDestroy':_0xf2f4('0x6')};function emitEvent(_0x3fd958){return function(_0x43d7d7,_0x6511b4,_0x12d19a){OpenchannelAccountEvents[_0xf2f4('0x7')](_0x3fd958+':'+_0x43d7d7['id'],_0x43d7d7);OpenchannelAccountEvents[_0xf2f4('0x7')](_0x3fd958,_0x43d7d7);_0x12d19a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xf2f4('0x8')](e,emitEvent(event));}}module[_0xf2f4('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 5593be7..b30745a 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 _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 +var _0xea5d=['define','OpenchannelAccount','util','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3155bb,_0xf49694){var _0x36ef57=function(_0x226b82){while(--_0x226b82){_0x3155bb['push'](_0x3155bb['shift']());}};_0x36ef57(++_0xf49694);}(_0xea5d,0x132));var _0xdea5=function(_0x5b8b8c,_0x4cd81f){_0x5b8b8c=_0x5b8b8c-0x0;var _0x535c38=_0xea5d[_0x5b8b8c];return _0x535c38;};'use strict';var _=require('lodash');var util=require(_0xdea5('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xdea5('0x1'));var BPromise=require(_0xdea5('0x2'));var rp=require(_0xdea5('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdea5('0x4'));var config=require(_0xdea5('0x5'));var attributes=require('./openchannelAccount.attributes');module['exports']=function(_0x58cdb8,_0x53a52a){return _0x58cdb8[_0xdea5('0x6')](_0xdea5('0x7'),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 00e9a53..43e3cc2 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 _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 +var _0x751a=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x751a,0x102));var _0xa751=function(_0x3fb166,_0x4eb985){_0x3fb166=_0x3fb166-0x0;var _0x5e91be=_0x751a[_0x3fb166];return _0x5e91be;};'use strict';var _=require(_0xa751('0x0'));var util=require(_0xa751('0x1'));var moment=require(_0xa751('0x2'));var BPromise=require(_0xa751('0x3'));var rs=require(_0xa751('0x4'));var fs=require('fs');var Redis=require(_0xa751('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa751('0x6'));var logger=require(_0xa751('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa751('0x8'));var client=jayson[_0xa751('0x9')][_0xa751('0xa')]({'port':0x232a});config[_0xa751('0xb')]=_['defaults'](config[_0xa751('0xb')],{'host':_0xa751('0xc'),'port':0x18eb});var socket=require(_0xa751('0xd'))(new Redis(config[_0xa751('0xb')]));require('./openchannelAccount.socket')[_0xa751('0xe')](socket);function respondWithRpcPromise(_0x3ac873,_0x1b4099,_0x5eb884){return new BPromise(function(_0x3d2e04,_0x3fc0be){return client[_0xa751('0xf')](_0x3ac873,_0x5eb884)[_0xa751('0x10')](function(_0xae5dd1){logger['info'](_0xa751('0x11'),_0x1b4099,_0xa751('0x12'));logger[_0xa751('0x13')](_0xa751('0x14'),_0x1b4099,'request\x20sent',JSON[_0xa751('0x15')](_0xae5dd1));if(_0xae5dd1[_0xa751('0x16')]){if(_0xae5dd1[_0xa751('0x16')]['code']===0x1f4){logger['error'](_0xa751('0x11'),_0x1b4099,_0xae5dd1[_0xa751('0x16')][_0xa751('0x17')]);return _0x3fc0be(_0xae5dd1[_0xa751('0x16')][_0xa751('0x17')]);}logger['error'](_0xa751('0x11'),_0x1b4099,_0xae5dd1[_0xa751('0x16')]['message']);return _0x3d2e04(_0xae5dd1[_0xa751('0x16')][_0xa751('0x17')]);}else{logger['info'](_0xa751('0x11'),_0x1b4099,_0xa751('0x12'));_0x3d2e04(_0xae5dd1[_0xa751('0x18')][_0xa751('0x17')]);}})[_0xa751('0x19')](function(_0x20869e){logger[_0xa751('0x16')](_0xa751('0x11'),_0x1b4099,_0x20869e);_0x3fc0be(_0x20869e);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 0326ea8..9fc5f64 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 _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 +var _0xfa7d=['register','length','openchannelAccount:','./openchannelAccount.events','save','remove','update','emit','removeListener'];(function(_0x7668e5,_0x17d8d3){var _0x5e1208=function(_0x5b0588){while(--_0x5b0588){_0x7668e5['push'](_0x7668e5['shift']());}};_0x5e1208(++_0x17d8d3);}(_0xfa7d,0x162));var _0xdfa7=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xfa7d[_0x24237f];return _0x48298e;};'use strict';var OpenchannelAccountEvents=require(_0xdfa7('0x0'));var events=[_0xdfa7('0x1'),_0xdfa7('0x2'),_0xdfa7('0x3')];function createListener(_0x429743,_0x2192b8){return function(_0x457a16){_0x2192b8[_0xdfa7('0x4')](_0x429743,_0x457a16);};}function removeListener(_0x2908ff,_0x5ebeb7){return function(){OpenchannelAccountEvents[_0xdfa7('0x5')](_0x2908ff,_0x5ebeb7);};}exports[_0xdfa7('0x6')]=function(_0x65b8b6){for(var _0x1d1510=0x0,_0x4cb637=events[_0xdfa7('0x7')];_0x1d1510<_0x4cb637;_0x1d1510++){var _0x4b3fba=events[_0x1d1510];var _0x12781c=createListener(_0xdfa7('0x8')+_0x4b3fba,_0x65b8b6);OpenchannelAccountEvents['on'](_0x4b3fba,_0x12781c);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 9dba0d9..be4f0e1 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 _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 +var _0x0d8b=['../../config/environment','./openchannelApplication.controller','index','get','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x37eb6a,_0x5a3a52){var _0x15da93=function(_0x8995d9){while(--_0x8995d9){_0x37eb6a['push'](_0x37eb6a['shift']());}};_0x15da93(++_0x5a3a52);}(_0x0d8b,0x92));var _0xb0d8=function(_0x24679e,_0x22d9d7){_0x24679e=_0x24679e-0x0;var _0x291f21=_0x0d8b[_0x24679e];return _0x291f21;};'use strict';var multer=require(_0xb0d8('0x0'));var util=require('util');var path=require(_0xb0d8('0x1'));var timeout=require(_0xb0d8('0x2'));var express=require(_0xb0d8('0x3'));var router=express[_0xb0d8('0x4')]();var auth=require(_0xb0d8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb0d8('0x6'));var controller=require(_0xb0d8('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xb0d8('0x8')]);router[_0xb0d8('0x9')](_0xb0d8('0xa'),auth[_0xb0d8('0xb')](),controller[_0xb0d8('0xc')]);router['post']('/',auth[_0xb0d8('0xb')](),controller[_0xb0d8('0xd')]);router[_0xb0d8('0xe')](_0xb0d8('0xa'),auth['isAuthenticated'](),controller[_0xb0d8('0xf')]);router[_0xb0d8('0x10')](_0xb0d8('0xa'),auth['isAuthenticated'](),controller[_0xb0d8('0x11')]);module[_0xb0d8('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index d9bfb7d..2d620ab 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 _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 +var _0x4381=['INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x2bc1e6,_0x1c3ce4){var _0x78a662=function(_0x2b1b41){while(--_0x2b1b41){_0x2bc1e6['push'](_0x2bc1e6['shift']());}};_0x78a662(++_0x1c3ce4);}(_0x4381,0x1d4));var _0x1438=function(_0x15a913,_0x1a077c){_0x15a913=_0x15a913-0x0;var _0xa1483f=_0x4381[_0x15a913];return _0xa1483f;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x1438('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x1438('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x1438('0x2')]()},'description':{'type':Sequelize[_0x1438('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x1438('0x3')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index de4d457..93f4f14 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 _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 +var _0x7621=['rows','catch','params','includeAll','include','options','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','count','offset','limit','apply','save','update','destroy','then','stack','name','send','map','OpenchannelApplication','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL'];(function(_0x314fbc,_0x53d5bd){var _0x4117cf=function(_0x25c4f5){while(--_0x25c4f5){_0x314fbc['push'](_0x314fbc['shift']());}};_0x4117cf(++_0x53d5bd);}(_0x7621,0x91));var _0x1762=function(_0x173bf6,_0x2d2f5c){_0x173bf6=_0x173bf6-0x0;var _0x2504f8=_0x7621[_0x173bf6];return _0x2504f8;};'use strict';var pdf=require(_0x1762('0x0'));var emlformat=require(_0x1762('0x1'));var rimraf=require(_0x1762('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1762('0x3'));var rp=require(_0x1762('0x4'));var moment=require(_0x1762('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1762('0x6'));var util=require(_0x1762('0x7'));var path=require(_0x1762('0x8'));var sox=require(_0x1762('0x9'));var csv=require('to-csv');var ejs=require(_0x1762('0xa'));var fs=require('fs');var _=require(_0x1762('0xb'));var squel=require('squel');var crypto=require(_0x1762('0xc'));var jsforce=require(_0x1762('0xd'));var deskjs=require(_0x1762('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1762('0xf'));var Redis=require(_0x1762('0x10'));var authService=require(_0x1762('0x11'));var qs=require(_0x1762('0x12'));var as=require(_0x1762('0x13'));var hardwareService=require(_0x1762('0x14'));var logger=require(_0x1762('0x15'))(_0x1762('0x16'));var utils=require(_0x1762('0x17'));var config=require(_0x1762('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d18b7,_0x36435d){_0x36435d=_0x36435d||0xcc;return function(_0x21c9e2){if(_0x21c9e2){return _0x5d18b7[_0x1762('0x19')](_0x36435d);}return _0x5d18b7['status'](_0x36435d)[_0x1762('0x1a')]();};}function respondWithResult(_0x3a0602,_0x14867a){_0x14867a=_0x14867a||0xc8;return function(_0x45ee0a){if(_0x45ee0a){return _0x3a0602[_0x1762('0x1b')](_0x14867a)['json'](_0x45ee0a);}};}function respondWithFilteredResult(_0xae7de6,_0x106d3e){return function(_0x2cb80b){if(_0x2cb80b){var _0x4a637b=_0x2cb80b[_0x1762('0x1c')],_0x462a9a=_0x106d3e[_0x1762('0x1d')],_0x11135d=_0x106d3e[_0x1762('0x1d')]+_0x106d3e[_0x1762('0x1e')],_0x25cf86;if(_0x11135d>=_0x4a637b){_0x11135d=_0x4a637b;_0x25cf86=0xc8;}else{_0x25cf86=0xce;}_0xae7de6['status'](_0x25cf86);return _0xae7de6['set']('Content-Range',_0x462a9a+'-'+_0x11135d+'/'+_0x4a637b)['json'](_0x2cb80b);}return null;};}function patchUpdates(_0x3d008d){return function(_0x9bcea2){try{jsonpatch[_0x1762('0x1f')](_0x9bcea2,_0x3d008d,!![]);}catch(_0x435ce9){return BPromise['reject'](_0x435ce9);}return _0x9bcea2[_0x1762('0x20')]();};}function saveUpdates(_0x72c9fd,_0x2d80cb){return function(_0x113c96){if(_0x113c96){return _0x113c96[_0x1762('0x21')](_0x72c9fd)['then'](function(_0x54246f){return _0x54246f;});}return null;};}function removeEntity(_0x425972,_0x2defbc){return function(_0x24e020){if(_0x24e020){return _0x24e020[_0x1762('0x22')]()[_0x1762('0x23')](function(){_0x425972[_0x1762('0x1b')](0xcc)[_0x1762('0x1a')]();});}};}function handleEntityNotFound(_0x47d6bd,_0x3a0418){return function(_0x406ffe){if(!_0x406ffe){_0x47d6bd[_0x1762('0x19')](0x194);}return _0x406ffe;};}function handleError(_0x1e29e7,_0x47a5cb){_0x47a5cb=_0x47a5cb||0x1f4;return function(_0x451403){logger['error'](_0x451403[_0x1762('0x24')]);if(_0x451403[_0x1762('0x25')]){delete _0x451403[_0x1762('0x25')];}_0x1e29e7['status'](_0x47a5cb)[_0x1762('0x26')](_0x451403);};}exports['index']=function(_0x3b29b6,_0x46825e){var _0x1d1c2b={},_0x3a4cd1={},_0x4e9373={'count':0x0,'rows':[]};var _0x333e60=_[_0x1762('0x27')](db[_0x1762('0x28')][_0x1762('0x29')],function(_0x48ed96){return{'name':_0x48ed96['fieldName'],'type':_0x48ed96[_0x1762('0x2a')][_0x1762('0x2b')]};});_0x3a4cd1[_0x1762('0x2c')]=_[_0x1762('0x27')](_0x333e60,_0x1762('0x25'));_0x3a4cd1[_0x1762('0x2d')]=_[_0x1762('0x2e')](_0x3b29b6[_0x1762('0x2d')]);_0x3a4cd1[_0x1762('0x2f')]=_['intersection'](_0x3a4cd1[_0x1762('0x2c')],_0x3a4cd1[_0x1762('0x2d')]);_0x1d1c2b[_0x1762('0x30')]=_[_0x1762('0x31')](_0x3a4cd1[_0x1762('0x2c')],qs[_0x1762('0x32')](_0x3b29b6['query']['fields']));_0x1d1c2b['attributes']=_0x1d1c2b[_0x1762('0x30')][_0x1762('0x33')]?_0x1d1c2b['attributes']:_0x3a4cd1[_0x1762('0x2c')];if(!_0x3b29b6['query'][_0x1762('0x34')]('nolimit')){_0x1d1c2b['limit']=qs['limit'](_0x3b29b6[_0x1762('0x2d')][_0x1762('0x1e')]);_0x1d1c2b[_0x1762('0x1d')]=qs[_0x1762('0x1d')](_0x3b29b6['query'][_0x1762('0x1d')]);}_0x1d1c2b[_0x1762('0x35')]=qs['sort'](_0x3b29b6[_0x1762('0x2d')][_0x1762('0x36')]);_0x1d1c2b[_0x1762('0x37')]=qs['filters'](_['pick'](_0x3b29b6[_0x1762('0x2d')],_0x3a4cd1['filters']),_0x333e60);if(_0x3b29b6[_0x1762('0x2d')][_0x1762('0x38')]){_0x1d1c2b['where']=_[_0x1762('0x39')](_0x1d1c2b[_0x1762('0x37')],{'$or':_[_0x1762('0x27')](_0x333e60,function(_0x4d1f4d){if(_0x4d1f4d[_0x1762('0x2a')]!==_0x1762('0x3a')){var _0x5417cf={};_0x5417cf[_0x4d1f4d[_0x1762('0x25')]]={'$like':'%'+_0x3b29b6[_0x1762('0x2d')]['filter']+'%'};return _0x5417cf;}})});}_0x1d1c2b=_['merge']({},_0x1d1c2b,_0x3b29b6['options']);var _0x294247={'where':_0x1d1c2b['where']};return db[_0x1762('0x28')]['count'](_0x294247)[_0x1762('0x23')](function(_0x4f0138){_0x4e9373[_0x1762('0x1c')]=_0x4f0138;if(_0x3b29b6[_0x1762('0x2d')]['includeAll']){_0x1d1c2b['include']=[{'all':!![]}];}return db[_0x1762('0x28')]['findAll'](_0x1d1c2b);})[_0x1762('0x23')](function(_0x11055c){_0x4e9373[_0x1762('0x3b')]=_0x11055c;return _0x4e9373;})['then'](respondWithFilteredResult(_0x46825e,_0x1d1c2b))[_0x1762('0x3c')](handleError(_0x46825e,null));};exports['show']=function(_0x52898e,_0x51bf7f){var _0x5d64fb={'raw':!![],'where':{'id':_0x52898e[_0x1762('0x3d')]['id']}},_0xa9e61b={};_0xa9e61b[_0x1762('0x2c')]=_[_0x1762('0x2e')](db[_0x1762('0x28')]['rawAttributes']);_0xa9e61b['query']=_['keys'](_0x52898e[_0x1762('0x2d')]);_0xa9e61b[_0x1762('0x2f')]=_[_0x1762('0x31')](_0xa9e61b[_0x1762('0x2c')],_0xa9e61b[_0x1762('0x2d')]);_0x5d64fb[_0x1762('0x30')]=_['intersection'](_0xa9e61b['model'],qs['fields'](_0x52898e['query']['fields']));_0x5d64fb[_0x1762('0x30')]=_0x5d64fb[_0x1762('0x30')][_0x1762('0x33')]?_0x5d64fb[_0x1762('0x30')]:_0xa9e61b['model'];if(_0x52898e[_0x1762('0x2d')][_0x1762('0x3e')]){_0x5d64fb[_0x1762('0x3f')]=[{'all':!![]}];}_0x5d64fb=_[_0x1762('0x39')]({},_0x5d64fb,_0x52898e[_0x1762('0x40')]);return db[_0x1762('0x28')][_0x1762('0x41')](_0x5d64fb)[_0x1762('0x23')](handleEntityNotFound(_0x51bf7f,null))[_0x1762('0x23')](respondWithResult(_0x51bf7f,null))['catch'](handleError(_0x51bf7f,null));};exports['create']=function(_0x36e6d5,_0x303c80){return db[_0x1762('0x28')][_0x1762('0x42')](_0x36e6d5[_0x1762('0x43')],{})[_0x1762('0x23')](respondWithResult(_0x303c80,0xc9))[_0x1762('0x3c')](handleError(_0x303c80,null));};exports[_0x1762('0x21')]=function(_0x5abfd4,_0x29c0fc){if(_0x5abfd4[_0x1762('0x43')]['id']){delete _0x5abfd4['body']['id'];}return db['OpenchannelApplication'][_0x1762('0x41')]({'where':{'id':_0x5abfd4[_0x1762('0x3d')]['id']}})[_0x1762('0x23')](handleEntityNotFound(_0x29c0fc,null))['then'](saveUpdates(_0x5abfd4[_0x1762('0x43')],null))[_0x1762('0x23')](respondWithResult(_0x29c0fc,null))[_0x1762('0x3c')](handleError(_0x29c0fc,null));};exports[_0x1762('0x22')]=function(_0x23325b,_0x47a8de){return db[_0x1762('0x28')][_0x1762('0x41')]({'where':{'id':_0x23325b[_0x1762('0x3d')]['id']}})[_0x1762('0x23')](handleEntityNotFound(_0x47a8de,null))[_0x1762('0x23')](removeEntity(_0x47a8de,null))[_0x1762('0x3c')](handleError(_0x47a8de,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 9d394b1..75bb6a1 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 _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 +var _0x402d=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','../../config/logger','api','moment'];(function(_0x15033b,_0xbc9e85){var _0x5ad13d=function(_0xd08815){while(--_0xd08815){_0x15033b['push'](_0x15033b['shift']());}};_0x5ad13d(++_0xbc9e85);}(_0x402d,0x142));var _0xd402=function(_0x39fdd7,_0x4e509a){_0x39fdd7=_0x39fdd7-0x0;var _0x183c41=_0x402d[_0x39fdd7];return _0x183c41;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd402('0x0'))(_0xd402('0x1'));var moment=require(_0xd402('0x2'));var BPromise=require(_0xd402('0x3'));var rp=require(_0xd402('0x4'));var fs=require('fs');var path=require(_0xd402('0x5'));var rimraf=require(_0xd402('0x6'));var config=require(_0xd402('0x7'));var attributes=require('./openchannelApplication.attributes');module[_0xd402('0x8')]=function(_0x3bd17c,_0x5f2ca6){return _0x3bd17c[_0xd402('0x9')](_0xd402('0xa'),attributes,{'tableName':_0xd402('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd402('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index affeded..d81a7d8 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 _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 +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(_0xf11596,_0x18bfb1){var _0x3459cf=function(_0x4f893b){while(--_0x4f893b){_0xf11596['push'](_0xf11596['shift']());}};_0x3459cf(++_0x18bfb1);}(_0xb10b,0x12a));var _0xbb10=function(_0x1ca890,_0x21d0d3){_0x1ca890=_0x1ca890-0x0;var _0x3f8e01=_0xb10b[_0x1ca890];return _0x3f8e01;};'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 b996a28..0f61a66 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 _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 +var _0x188c=['download','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download'];(function(_0x5090f4,_0x4c771f){var _0x5586dd=function(_0x2887e6){while(--_0x2887e6){_0x5090f4['push'](_0x5090f4['shift']());}};_0x5586dd(++_0x4c771f);}(_0x188c,0x1bb));var _0xc188=function(_0x4ba102,_0x3dc213){_0x4ba102=_0x4ba102-0x0;var _0x1f35e7=_0x188c[_0x4ba102];return _0x1f35e7;};'use strict';var multer=require(_0xc188('0x0'));var util=require(_0xc188('0x1'));var path=require(_0xc188('0x2'));var timeout=require(_0xc188('0x3'));var express=require(_0xc188('0x4'));var router=express[_0xc188('0x5')]();var auth=require(_0xc188('0x6'));var interaction=require(_0xc188('0x7'));var config=require(_0xc188('0x8'));var controller=require(_0xc188('0x9'));router['get']('/',auth[_0xc188('0xa')](),controller['index']);router[_0xc188('0xb')](_0xc188('0xc'),auth[_0xc188('0xa')](),controller[_0xc188('0xd')]);router['get'](_0xc188('0xe'),auth[_0xc188('0xa')](),controller[_0xc188('0xf')]);router[_0xc188('0xb')](_0xc188('0x10'),auth[_0xc188('0xa')](),controller[_0xc188('0x11')]);router[_0xc188('0xb')](_0xc188('0x12'),auth[_0xc188('0xa')](),controller[_0xc188('0x13')]);router[_0xc188('0x14')]('/',auth[_0xc188('0xa')](),controller['create']);router[_0xc188('0x14')](_0xc188('0x10'),auth['isAuthenticated'](),controller[_0xc188('0x15')]);router['post'](_0xc188('0x16'),auth[_0xc188('0xa')](),interaction[_0xc188('0x17')](_0xc188('0x18'),_0xc188('0x19')),controller['addTags']);router[_0xc188('0x1a')](_0xc188('0xe'),auth[_0xc188('0xa')](),interaction[_0xc188('0x17')](_0xc188('0x18'),_0xc188('0x1b')),controller[_0xc188('0x1c')]);router[_0xc188('0x1d')](_0xc188('0xe'),auth['isAuthenticated'](),interaction[_0xc188('0x17')](_0xc188('0x18'),_0xc188('0x1e')),controller[_0xc188('0x1f')]);router[_0xc188('0x1d')](_0xc188('0x16'),auth[_0xc188('0xa')](),controller['removeTags']);module[_0xc188('0x20')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index d2ad4b6..fff3e4a 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 _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 +var _0x1323=['DATE','ENUM','out','sequelize','exports','BOOLEAN','STRING'];(function(_0x50e593,_0x3ae998){var _0x3821d0=function(_0x53c295){while(--_0x53c295){_0x50e593['push'](_0x50e593['shift']());}};_0x3821d0(++_0x3ae998);}(_0x1323,0x114));var _0x3132=function(_0x2fa25a,_0x3fecd8){_0x2fa25a=_0x2fa25a-0x0;var _0x1f80ef=_0x1323[_0x2fa25a];return _0x1f80ef;};'use strict';var Sequelize=require(_0x3132('0x0'));module[_0x3132('0x1')]={'closed':{'type':Sequelize[_0x3132('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x3132('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x3132('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x3132('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x3132('0x5')]('in',_0x3132('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x3132('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 02677d2..55353e6 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 _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 +var _0x704c=['Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','push','all','rows','catch','params','includeAll','create','body','destroy','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','spread','color','emit','openchannelInteractionTags:save','removeTags','download','unix','root','server','tmp','attachments','join','transcript-%d-%s.zip','firstName','lastName','secret','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','format','YYYY-MM-DD','N.A.','closed','closedAt','disposition','threadId','Public','Private','Messages','Attachment','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','direction','renderFile','views','downloadInteraction.html','toFile','.pdf','log','err','unlinkSync','html-pdf','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','Users','map','fullname','Tags','split','forEach','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','from','tools_tags','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','find','ContactId','buildExpression','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','some','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','i.OpenchannelAccountId\x20IS\x20NULL','toString','count','sequelize','keyBy','merge','Account.key','Account.mandatoryDisposition','i.*'];(function(_0x36df0b,_0x461795){var _0x326ed7=function(_0x12e8b2){while(--_0x12e8b2){_0x36df0b['push'](_0x36df0b['shift']());}};_0x326ed7(++_0x461795);}(_0x704c,0x143));var _0xc704=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x704c[_0xbe200f];return _0x192597;};'use strict';var pdf=require(_0xc704('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc704('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc704('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc704('0x3'));var Mustache=require(_0xc704('0x4'));var util=require('util');var path=require(_0xc704('0x5'));var sox=require(_0xc704('0x6'));var csv=require(_0xc704('0x7'));var ejs=require(_0xc704('0x8'));var fs=require('fs');var _=require(_0xc704('0x9'));var squel=require('squel');var crypto=require(_0xc704('0xa'));var jsforce=require(_0xc704('0xb'));var deskjs=require(_0xc704('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc704('0xd'));var Papa=require(_0xc704('0xe'));var Redis=require(_0xc704('0xf'));var authService=require(_0xc704('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc704('0x11'));var hardwareService=require(_0xc704('0x12'));var logger=require('../../config/logger')(_0xc704('0x13'));var utils=require(_0xc704('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xc704('0x15')]=_[_0xc704('0x16')](config['redis'],{'host':_0xc704('0x17'),'port':0x18eb});var socket=require(_0xc704('0x18'))(new Redis(config['redis']));require(_0xc704('0x19'))[_0xc704('0x1a')](socket);function respondWithStatusCode(_0x749ae0,_0x10c3cc){_0x10c3cc=_0x10c3cc||0xcc;return function(_0x5e3c59){if(_0x5e3c59){return _0x749ae0[_0xc704('0x1b')](_0x10c3cc);}return _0x749ae0[_0xc704('0x1c')](_0x10c3cc)[_0xc704('0x1d')]();};}function respondWithResult(_0x134585,_0x2657a3){_0x2657a3=_0x2657a3||0xc8;return function(_0xbf0de1){if(_0xbf0de1){return _0x134585['status'](_0x2657a3)[_0xc704('0x1e')](_0xbf0de1);}};}function respondWithFilteredResult(_0x5f4ee1,_0x51fbcf){return function(_0x582bcb){if(_0x582bcb){var _0x4bdeaf=_0x582bcb['count'],_0x16e675=_0x51fbcf[_0xc704('0x1f')],_0x3781e0=_0x51fbcf[_0xc704('0x1f')]+_0x51fbcf[_0xc704('0x20')],_0x3965bb;if(_0x3781e0>=_0x4bdeaf){_0x3781e0=_0x4bdeaf;_0x3965bb=0xc8;}else{_0x3965bb=0xce;}_0x5f4ee1['status'](_0x3965bb);return _0x5f4ee1[_0xc704('0x21')](_0xc704('0x22'),_0x16e675+'-'+_0x3781e0+'/'+_0x4bdeaf)['json'](_0x582bcb);}return null;};}function patchUpdates(_0x20d0a7){return function(_0x199d4c){try{jsonpatch[_0xc704('0x23')](_0x199d4c,_0x20d0a7,!![]);}catch(_0x3008b8){return BPromise[_0xc704('0x24')](_0x3008b8);}return _0x199d4c[_0xc704('0x25')]();};}function saveUpdates(_0x42c5ca,_0x28e38f){return function(_0x1575c0){if(_0x1575c0){return _0x1575c0[_0xc704('0x26')](_0x42c5ca)[_0xc704('0x27')](function(_0x961339){return _0x961339;});}return null;};}function removeEntity(_0x562e47,_0x2f9c77){return function(_0x41f6cf){if(_0x41f6cf){return _0x41f6cf['destroy']()[_0xc704('0x27')](function(){_0x562e47[_0xc704('0x1c')](0xcc)[_0xc704('0x1d')]();});}};}function handleEntityNotFound(_0x4d21d9,_0x2b6c21){return function(_0x2f7ed2){if(!_0x2f7ed2){_0x4d21d9[_0xc704('0x1b')](0x194);}return _0x2f7ed2;};}function handleError(_0x29b8ca,_0x52171f){_0x52171f=_0x52171f||0x1f4;return function(_0x4d0b4d){logger[_0xc704('0x28')](_0x4d0b4d[_0xc704('0x29')]);if(_0x4d0b4d[_0xc704('0x2a')]){delete _0x4d0b4d[_0xc704('0x2a')];}_0x29b8ca[_0xc704('0x1c')](_0x52171f)[_0xc704('0x2b')](_0x4d0b4d);};}function getInteractionUsers(_0x23952c,_0x16bb27){return new BPromise(function(_0x4829bc,_0x25c197){try{if(_0x16bb27[_0x23952c['id']]){_0x23952c[_0xc704('0x2c')]=_[_0xc704('0x2d')](_0x16bb27[_0x23952c['id']],function(_0x2b857b){return{'id':_0x2b857b['id'],'fullname':_0x2b857b[_0xc704('0x2e')]};});}}catch(_0xe6cd06){_0x25c197(_0xe6cd06);}_0x4829bc(_0x23952c);});}function getInteractionTags(_0x2d7c51,_0x5a091b){return new BPromise(function(_0x8bff3f,_0x4f8c6e){try{if(_0x2d7c51['TagIds']){_0x2d7c51[_0xc704('0x2f')]=[];_0x2d7c51['TagIds'][_0xc704('0x30')](',')[_0xc704('0x31')](function(_0x27d8ed){_0x2d7c51[_0xc704('0x2f')]['push'](_0x5a091b[_0x27d8ed]);});}delete _0x2d7c51['TagIds'];}catch(_0xc63f95){_0x4f8c6e(_0xc63f95);}_0x8bff3f(_0x2d7c51);});}function updateOpenchannelInteraction(_0x1d0dc8,_0x5644b6,_0x463e68){return new BPromise(function(_0x3dc113,_0x3b94b3){return getInteractionUsers(_0x1d0dc8,_0x463e68)[_0xc704('0x27')](function(_0x2b4835){return getInteractionTags(_0x2b4835,_0x5644b6);})[_0xc704('0x27')](function(_0x437345){_0x3dc113(_0x437345);})['catch'](function(_0x197140){_0x3b94b3(_0x197140);});});}exports['index']=function(_0x18af47,_0x463885){var _0x51aa49={},_0x1f4c7c={},_0x55a74f={'count':0x0,'rows':[]};var _0x231603=_[_0xc704('0x2d')](db[_0xc704('0x32')][_0xc704('0x33')],function(_0x3fe0e4){return{'name':_0x3fe0e4[_0xc704('0x34')],'type':_0x3fe0e4[_0xc704('0x35')][_0xc704('0x36')]};});_0x1f4c7c[_0xc704('0x37')]=_['map'](_0x231603,_0xc704('0x2a'));_0x1f4c7c['query']=_[_0xc704('0x38')](_0x18af47[_0xc704('0x39')]);_0x1f4c7c['filters']=_[_0xc704('0x3a')](_0x1f4c7c[_0xc704('0x37')],_0x1f4c7c[_0xc704('0x39')]);_0x51aa49['attributes']=_[_0xc704('0x3a')](_0x1f4c7c[_0xc704('0x37')],qs['fields'](_0x18af47['query'][_0xc704('0x3b')]));_0x51aa49[_0xc704('0x3c')]=_0x51aa49[_0xc704('0x3c')][_0xc704('0x3d')]?_0x51aa49[_0xc704('0x3c')]:_0x1f4c7c[_0xc704('0x37')];if(!_0x18af47[_0xc704('0x39')][_0xc704('0x3e')](_0xc704('0x3f'))){_0x51aa49[_0xc704('0x20')]=qs[_0xc704('0x20')](_0x18af47[_0xc704('0x39')][_0xc704('0x20')]);_0x51aa49['offset']=qs[_0xc704('0x1f')](_0x18af47['query'][_0xc704('0x1f')]);}_0x51aa49[_0xc704('0x40')]=qs[_0xc704('0x41')](_0x18af47[_0xc704('0x39')][_0xc704('0x41')]);_0x51aa49[_0xc704('0x42')]=qs[_0xc704('0x43')](_[_0xc704('0x44')](_0x18af47['query'],_0x1f4c7c[_0xc704('0x43')]),_0x231603);var _0x2caa2b=[];var _0x5553b2=squel[_0xc704('0x45')]()[_0xc704('0x46')]('id')['field'](_0xc704('0x2a'))[_0xc704('0x46')]('color')[_0xc704('0x47')](_0xc704('0x48'));var _0x5c5db7=squel[_0xc704('0x45')]()['field']('u.id')[_0xc704('0x46')](_0xc704('0x49'))[_0xc704('0x46')](_0xc704('0x4a'))[_0xc704('0x47')](_0xc704('0x4b'),'ui')[_0xc704('0x4c')](_0xc704('0x4d'),'u',_0xc704('0x4e'));var _0x1845a2=squel[_0xc704('0x45')]()[_0xc704('0x47')](_0xc704('0x4f'),'i')[_0xc704('0x4c')](_0xc704('0x50'),'c',_0xc704('0x51'))[_0xc704('0x4c')](_0xc704('0x4d'),'o',_0xc704('0x52'))['left_join'](_0xc704('0x53'),'a','a.id\x20=\x20i.OpenchannelAccountId')['left_join'](_0xc704('0x54'),'me',_0xc704('0x55'))[_0xc704('0x4c')](_0xc704('0x56'),'it',_0xc704('0x57'))[_0xc704('0x4c')](_0xc704('0x48'),'t',_0xc704('0x58'));var _0x1e7284=squel[_0xc704('0x59')]();var _0x32ed11=[];var _0x3aff6f=squel['expr']();var _0x5d584d;if(_0x18af47[_0xc704('0x39')][_0xc704('0x5a')]){_0x5d584d=as['parseSearch'](_0x18af47[_0xc704('0x39')][_0xc704('0x5a')]);var _0xd042c0=_0x5d584d[_0xc704('0x5b')];for(var _0x578c25=0x0;_0x578c25<_0x5d584d[_0xc704('0x5c')]['length'];_0x578c25++){var _0xf95d07=_0x5d584d[_0xc704('0x5c')][_0x578c25];var _0x127a8a='i';var _0x23bb85=_['find'](_0x231603,[_0xc704('0x2a'),_0xf95d07['field']]);if(!_0x23bb85){switch(_0xf95d07['field']){case _0xc704('0x5d'):if(_0xf95d07[_0xc704('0x5e')]==0x1){_0x1845a2['having']('`'+_0xf95d07[_0xc704('0x46')]+'`\x20=\x200');}else{_0x1845a2[_0xc704('0x5f')]('`'+_0xf95d07[_0xc704('0x46')]+_0xc704('0x60'));}break;case _0xc704('0x61'):if(_0xf95d07[_0xc704('0x62')]==='$substring'){if(_0xf95d07['value'][_0xc704('0x30')]('\x20')[_0xc704('0x3d')]>0x1){_0x1e7284[_0xd042c0](_0xc704('0x63'),qs[_0xc704('0x64')](_0xf95d07[_0xc704('0x5e')]),null);}else{var _0xa1af3a='%'+_0xf95d07[_0xc704('0x5e')]+'%';_0x1e7284[_0xd042c0]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0xa1af3a,_0xa1af3a,_0xa1af3a);}}else{_0x23bb85=_[_0xc704('0x65')](_0x231603,[_0xc704('0x2a'),_0xc704('0x66')]);_0xf95d07[_0xc704('0x46')]=_0xc704('0x66');_0x5ca3bf=as[_0xc704('0x67')](_0x127a8a,_0x23bb85[_0xc704('0x35')],_0xf95d07);_0x1e7284[_0xd042c0](_0x5ca3bf['text'],_0x5ca3bf['value'][_0xc704('0x68')],_0x5ca3bf[_0xc704('0x5e')]['end']);}break;case'Tag':var _0x1835c1=_0xf95d07['value'][_0xc704('0x30')](',')[_0xc704('0x2d')](function(_0x2e0230){return Number(_0x2e0230);});_0x1835c1[_0xc704('0x31')](function(_0x45924b){_0x3aff6f['or'](_0xc704('0x69'),'%,'+_0x45924b+',%');});_0x32ed11=_[_0xc704('0x6a')](_0x32ed11,_0x1835c1);break;case _0xc704('0x6b'):if(_0xf95d07[_0xc704('0x62')]===_0xc704('0x6c')){_0x1e7284[_0xd042c0](_0xc704('0x6d'),'%'+_0xf95d07[_0xc704('0x5e')]+'%',null);}else{_0x23bb85=_[_0xc704('0x65')](_0x231603,[_0xc704('0x2a'),_0xc704('0x6e')]);_0xf95d07[_0xc704('0x46')]=_0xc704('0x6e');_0x5ca3bf=as[_0xc704('0x67')](_0x127a8a,_0x23bb85[_0xc704('0x35')],_0xf95d07);_0x1e7284[_0xd042c0](_0x5ca3bf[_0xc704('0x6f')],_0x5ca3bf[_0xc704('0x5e')][_0xc704('0x68')],_0x5ca3bf[_0xc704('0x5e')][_0xc704('0x1d')]);}break;case'body':_0x5ca3bf=as[_0xc704('0x67')]('me',null,_0xf95d07);_0x1e7284[_0xd042c0](_0x5ca3bf[_0xc704('0x6f')],_0x5ca3bf[_0xc704('0x5e')][_0xc704('0x68')],_0x5ca3bf[_0xc704('0x5e')][_0xc704('0x1d')]);break;}}else{var _0x5ca3bf=as['buildExpression'](_0x127a8a,_0x23bb85['type'],_0xf95d07);_0x1e7284[_0xd042c0](_0x5ca3bf[_0xc704('0x6f')],_0x5ca3bf['value'][_0xc704('0x68')],_0x5ca3bf[_0xc704('0x5e')][_0xc704('0x1d')]);}}}else{var _0x130c98=_(_0x18af47[_0xc704('0x39')])[_0xc704('0x38')]()[_0xc704('0x2d')](function(_0x4e33d6){return _[_0xc704('0x70')](_0x231603,[_0xc704('0x2a'),_0x4e33d6])?_0x4e33d6:undefined;})['compact']()['value']();if(!_[_0xc704('0x71')](_0x130c98)){_0x130c98[_0xc704('0x31')](function(_0x1fac96){if(_0x1fac96===_0xc704('0x72')){_0x1845a2['where'](_0xc704('0x73'),[][_0xc704('0x74')](_0x18af47[_0xc704('0x39')][_0x1fac96]));}else if(_0x1fac96===_0xc704('0x75')){var _0x1cd95d=JSON[_0xc704('0x76')](_0x18af47[_0xc704('0x39')][_0x1fac96])[_0xc704('0x77')];var _0x4aa81c=JSON[_0xc704('0x76')](_0x18af47[_0xc704('0x39')][_0x1fac96])[_0xc704('0x78')];_0x1845a2['where'](_0xc704('0x79'),_0x1cd95d,_0x4aa81c);}else{if(_0x18af47['query'][_0x1fac96]===_0xc704('0x7a')){_0x1845a2[_0xc704('0x42')]('i.'+_0x1fac96+_0xc704('0x7b'));}else{_0x1845a2[_0xc704('0x42')]('i.'+_0x1fac96+'\x20=\x20?',_0x18af47[_0xc704('0x39')][_0x1fac96]);}}});}if(_0x18af47[_0xc704('0x39')]['read']){if(_0x18af47[_0xc704('0x39')][_0xc704('0x7c')]==0x1){_0x1845a2[_0xc704('0x5f')](_0xc704('0x7d'));}else{_0x1845a2[_0xc704('0x5f')](_0xc704('0x7e'));}}if(_0x18af47['query'][_0xc704('0x7f')]){_0x32ed11=_[_0xc704('0x80')](_0x18af47['query'][_0xc704('0x7f')])?_0x18af47[_0xc704('0x39')][_0xc704('0x7f')]:new Array(_0x18af47[_0xc704('0x39')][_0xc704('0x7f')]);_0x32ed11[_0xc704('0x31')](function(_0x13e055){_0x3aff6f['or'](_0xc704('0x69'),'%,'+_0x13e055+',%');});}if(_0x18af47[_0xc704('0x39')][_0xc704('0x81')]){var _0x478da0=_0x18af47[_0xc704('0x39')][_0xc704('0x81')][_0xc704('0x82')]('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0xc704('0x83')](_0x478da0)){_0x1e7284['or'](_0xc704('0x84'),_0x478da0+'%');}else{_0x1e7284['or'](_0xc704('0x85'),qs['getFullTextValue'](_0x478da0))['or'](_0xc704('0x86'),_0x478da0+'%')['or'](_0xc704('0x87'),_0x478da0+'%');}}}_0x1845a2[_0xc704('0x42')](_0x1e7284);_0x1845a2[_0xc704('0x88')](_0xc704('0x89'));var _0x53f10e={'type':db[_0xc704('0x8a')][_0xc704('0x8b')]['SELECT'],'raw':!![]};var _0x4d7824=_0x1845a2[_0xc704('0x8c')]();_0x4d7824[_0xc704('0x46')]('i.id');_0x4d7824[_0xc704('0x46')](_0xc704('0x8d'),_0xc704('0x5d'));if(_0x51aa49[_0xc704('0x40')]){_0x51aa49[_0xc704('0x40')][_0xc704('0x31')](function(_0x1e62bf){_0x1845a2[_0xc704('0x40')]('i.'+_0x1e62bf[0x0],_0x1e62bf[0x1]==='DESC'?![]:!![]);});}if(!_[_0xc704('0x71')](_0x32ed11)){_0x1845a2['having'](_0x3aff6f);_0x4d7824['where'](_0xc704('0x8e'),_0x32ed11);}BPromise['resolve']()[_0xc704('0x27')](function(){if(!_0x5d584d){if(_0x18af47['query'][_0xc704('0x72')]||_0x18af47[_0xc704('0x39')][_0xc704('0x8f')])return;_0x4d7824[_0xc704('0x42')](_0xc704('0x90'));_0x1845a2[_0xc704('0x42')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}return _0x18af47[_0xc704('0x91')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0xc704('0x27')](function(_0x2dc14b){if(_['isEmpty'](_0x2dc14b)){_0x4d7824[_0xc704('0x42')](_0xc704('0x92'));_0x1845a2[_0xc704('0x42')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x4d7824[_0xc704('0x42')](_0xc704('0x73'),_['map'](_0x2dc14b,'id'));_0x1845a2[_0xc704('0x42')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x2dc14b,'id'));}});})['then'](function(){db['sequelize'][_0xc704('0x39')](_0x4d7824[_0xc704('0x93')](),_0x53f10e)[_0xc704('0x27')](function(_0x3174bf){_0x55a74f[_0xc704('0x94')]=_0x3174bf['length'];if(_0x55a74f[_0xc704('0x94')]===0x0)return[];return db[_0xc704('0x95')]['query'](_0x5553b2[_0xc704('0x93')](),_0x53f10e)['then'](function(_0x312f8c){_0x2caa2b=_[_0xc704('0x96')](_0x312f8c,'id');_0x53f10e=_[_0xc704('0x97')](_0x53f10e,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x18af47[_0xc704('0x39')][_0xc704('0x3b')]){_0x51aa49[_0xc704('0x3c')][_0xc704('0x31')](function(_0x4abc36){_0x1845a2[_0xc704('0x46')]('i.'+_0x4abc36);});}else{_0x1845a2['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xc704('0x5d'));_0x1845a2[_0xc704('0x46')]('a.key',_0xc704('0x98'));_0x1845a2['field']('a.mandatoryDisposition',_0xc704('0x99'));_0x1845a2['field'](_0xc704('0x9a'));_0x1845a2[_0xc704('0x46')]('c.firstName',_0xc704('0x9b'));_0x1845a2[_0xc704('0x46')](_0xc704('0x9c'),_0xc704('0x9d'));_0x1845a2['field'](_0xc704('0x9e'),_0xc704('0x9f'));_0x1845a2[_0xc704('0x46')](_0xc704('0xa0'),_0xc704('0xa1'));_0x1845a2[_0xc704('0x46')](_0xc704('0xa2'),_0xc704('0xa3'));_0x1845a2[_0xc704('0x46')]('c.fax','Contact.fax');_0x1845a2[_0xc704('0x46')](_0xc704('0xa4'),_0xc704('0xa5'));_0x1845a2[_0xc704('0x46')](_0xc704('0xa6'),_0xc704('0xa7'));_0x1845a2[_0xc704('0x46')](_0xc704('0xa8'),'TagIds');}if(_0x51aa49[_0xc704('0x20')])_0x1845a2[_0xc704('0x20')](_0x51aa49[_0xc704('0x20')]);if(_0x51aa49[_0xc704('0x1f')])_0x1845a2[_0xc704('0x1f')](_0x51aa49[_0xc704('0x1f')]);return db[_0xc704('0x95')]['query'](_0x1845a2['toString'](),_0x53f10e);})['then'](function(_0x55be10){_0x5c5db7[_0xc704('0x42')](_0xc704('0xa9'),_[_0xc704('0x2d')](_0x55be10,'id'));return db[_0xc704('0x95')]['query'](_0x5c5db7[_0xc704('0x93')](),_0x53f10e)['then'](function(_0x2146f7){var _0x5bd302=_[_0xc704('0xaa')](_0x2146f7,_0xc704('0xab'));var _0x47de21=[];_0x55be10[_0xc704('0x31')](function(_0x9af07a){_0x47de21[_0xc704('0xac')](updateOpenchannelInteraction(_0x9af07a,_0x2caa2b,_0x5bd302));});return BPromise[_0xc704('0xad')](_0x47de21);});});})[_0xc704('0x27')](function(_0x5639da){_0x55a74f[_0xc704('0xae')]=_0x5639da;return _0x55a74f;})[_0xc704('0x27')](respondWithFilteredResult(_0x463885,_0x51aa49));})[_0xc704('0xaf')](handleError(_0x463885,null));};exports['show']=function(_0x35d6d7,_0x517cfa){var _0x3d8d1e={'raw':![],'where':{'id':_0x35d6d7[_0xc704('0xb0')]['id']}},_0x4b33ab={};_0x4b33ab[_0xc704('0x37')]=_[_0xc704('0x38')](db[_0xc704('0x32')][_0xc704('0x33')]);_0x4b33ab[_0xc704('0x39')]=_[_0xc704('0x38')](_0x35d6d7[_0xc704('0x39')]);_0x4b33ab[_0xc704('0x43')]=_[_0xc704('0x3a')](_0x4b33ab[_0xc704('0x37')],_0x4b33ab['query']);_0x3d8d1e[_0xc704('0x3c')]=_[_0xc704('0x3a')](_0x4b33ab[_0xc704('0x37')],qs[_0xc704('0x3b')](_0x35d6d7[_0xc704('0x39')]['fields']));_0x3d8d1e[_0xc704('0x3c')]=_0x3d8d1e[_0xc704('0x3c')][_0xc704('0x3d')]?_0x3d8d1e['attributes']:_0x4b33ab[_0xc704('0x37')];if(_0x35d6d7[_0xc704('0x39')][_0xc704('0xb1')]){_0x3d8d1e['include']=[{'all':!![]}];}_0x3d8d1e=_[_0xc704('0x97')]({},_0x3d8d1e,_0x35d6d7['options']);return db[_0xc704('0x32')][_0xc704('0x65')](_0x3d8d1e)['then'](handleEntityNotFound(_0x517cfa,null))[_0xc704('0x27')](respondWithResult(_0x517cfa,null))['catch'](handleError(_0x517cfa,null));};exports[_0xc704('0xb2')]=function(_0x35edc3,_0x390ae3){return db[_0xc704('0x32')][_0xc704('0xb2')](_0x35edc3[_0xc704('0xb3')],{})['then'](respondWithResult(_0x390ae3,0xc9))['catch'](handleError(_0x390ae3,null));};exports['update']=function(_0x52627d,_0x1e6bff){if(_0x52627d['body']['id']){delete _0x52627d[_0xc704('0xb3')]['id'];}return db[_0xc704('0x32')]['find']({'where':{'id':_0x52627d[_0xc704('0xb0')]['id']}})['then'](handleEntityNotFound(_0x1e6bff,null))[_0xc704('0x27')](saveUpdates(_0x52627d['body'],null))[_0xc704('0x27')](respondWithResult(_0x1e6bff,null))['catch'](handleError(_0x1e6bff,null));};exports[_0xc704('0xb4')]=function(_0x530270,_0x34e096){return db[_0xc704('0x32')]['find']({'where':{'id':_0x530270['params']['id']}})[_0xc704('0x27')](handleEntityNotFound(_0x34e096,null))[_0xc704('0x27')](removeEntity(_0x34e096,null))['catch'](handleError(_0x34e096,null));};exports['describe']=function(_0x4f51e5,_0x33723a){return db[_0xc704('0x32')]['describe']()[_0xc704('0x27')](respondWithResult(_0x33723a,null))[_0xc704('0xaf')](handleError(_0x33723a,null));};exports[_0xc704('0xb5')]=function(_0x3041c1,_0x493b95,_0x278600){return db[_0xc704('0xb6')][_0xc704('0x65')]({'where':{'id':_0x3041c1[_0xc704('0xb0')]['id']}})['then'](handleEntityNotFound(_0x493b95,null))[_0xc704('0x27')](function(_0x3ed71a){if(_0x3ed71a){return _0x3ed71a['addMessage'](_0x3041c1[_0xc704('0xb3')][_0xc704('0xb7')],_[_0xc704('0xb8')](_0x3041c1[_0xc704('0xb3')],['ids','id'])||{});}})[_0xc704('0x27')](respondWithResult(_0x493b95,null))[_0xc704('0xaf')](handleError(_0x493b95,null));};exports[_0xc704('0xb9')]=function(_0x25ea20,_0x19205c,_0x39b508){var _0x12ee0e={'raw':![],'where':{}};var _0x1de01f={};var _0x13b597={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xc704('0xba')]({'where':{'id':_0x25ea20['params']['id']}})[_0xc704('0x27')](handleEntityNotFound(_0x19205c,null))['then'](function(_0x36b945){if(_0x36b945){_0x1de01f['model']=_[_0xc704('0x38')](db['OpenchannelMessage'][_0xc704('0x33')]);_0x1de01f[_0xc704('0x39')]=_[_0xc704('0x38')](_0x25ea20[_0xc704('0x39')]);_0x1de01f[_0xc704('0x43')]=_[_0xc704('0x3a')](_0x1de01f[_0xc704('0x37')],_0x1de01f[_0xc704('0x39')]);_0x12ee0e[_0xc704('0x3c')]=_[_0xc704('0x3a')](_0x1de01f[_0xc704('0x37')],qs[_0xc704('0x3b')](_0x25ea20[_0xc704('0x39')][_0xc704('0x3b')]));_0x12ee0e[_0xc704('0x3c')]=_0x12ee0e['attributes'][_0xc704('0x3d')]?_0x12ee0e['attributes']:_0x1de01f['model'];if(!_0x25ea20['query'][_0xc704('0x3e')](_0xc704('0x3f'))){_0x12ee0e[_0xc704('0x20')]=qs[_0xc704('0x20')](_0x25ea20['query']['limit']);_0x12ee0e[_0xc704('0x1f')]=qs[_0xc704('0x1f')](_0x25ea20['query'][_0xc704('0x1f')]);}_0x12ee0e['order']=qs[_0xc704('0x41')](_0x25ea20['query'][_0xc704('0x41')]);_0x12ee0e['where']=qs[_0xc704('0x43')](_[_0xc704('0x44')](_0x25ea20['query'],_0x1de01f[_0xc704('0x43')]));_0x12ee0e['where'][_0xc704('0xab')]=_0x36b945['id'];if(_0x25ea20[_0xc704('0x39')]['filter']){_0x12ee0e['where']=_[_0xc704('0x97')](_0x12ee0e['where'],{'$or':_[_0xc704('0x2d')](_0x12ee0e['attributes'],function(_0x325f44){var _0x4f3692={};_0x4f3692[_0x325f44]={'$like':'%'+_0x25ea20[_0xc704('0x39')]['filter']+'%'};return _0x4f3692;})});}if(_0x25ea20['query'][_0xc704('0x77')]){var _0x3a75e1=_0x25ea20[_0xc704('0x39')][_0xc704('0x77')]['split'](',');var _0x1778db={};_0x1778db[_0x3a75e1[0x0]]={'$gte':moment(_0x3a75e1[0x1])['format'](_0xc704('0xbb'))};_0x12ee0e[_0xc704('0x42')]=_[_0xc704('0x97')](_0x12ee0e[_0xc704('0x42')],_0x1778db);}_0x12ee0e=_['merge']({},_0x12ee0e,_0x25ea20[_0xc704('0xbc')]);return db['OpenchannelMessage'][_0xc704('0x94')]({'where':_0x12ee0e[_0xc704('0x42')]})['then'](function(_0x14989f){_0x13b597[_0xc704('0x94')]=_0x14989f;if(_0x25ea20[_0xc704('0x39')][_0xc704('0xb1')]){_0x12ee0e[_0xc704('0xbd')]=[{'all':!![]}];}return db[_0xc704('0xb6')][_0xc704('0xbe')](_0x12ee0e);})[_0xc704('0x27')](function(_0x2414e2){_0x13b597[_0xc704('0xae')]=_0x2414e2;return _0x13b597;});}})['then'](respondWithFilteredResult(_0x19205c,_0x12ee0e))[_0xc704('0xaf')](handleError(_0x19205c,null));};exports['addTags']=function(_0x200d24,_0x13de1f,_0x4d07b2){return db[_0xc704('0x32')][_0xc704('0x65')]({'where':{'id':_0x200d24[_0xc704('0xb0')]['id']}})[_0xc704('0x27')](handleEntityNotFound(_0x13de1f,null))[_0xc704('0x27')](function(_0x5a280d){if(_0x5a280d){return _0x5a280d['setTags'](_0x200d24[_0xc704('0xb3')][_0xc704('0xb7')],_['omit'](_0x200d24[_0xc704('0xb3')],[_0xc704('0xb7'),'id'])||{})[_0xc704('0xbf')](function(){return db['Tag'][_0xc704('0xbe')]({'attributes':['id',_0xc704('0x2a'),_0xc704('0xc0')],'where':{'id':_0x200d24[_0xc704('0xb3')][_0xc704('0xb7')]}});})[_0xc704('0x27')](function(_0x2be78d){socket[_0xc704('0xc1')](_0xc704('0xc2'),{'id':Number(_0x200d24[_0xc704('0xb0')]['id']),'tags':_0x2be78d||[]});return{'id':Number(_0x200d24[_0xc704('0xb0')]['id']),'tags':_0x2be78d||[]};});}})['then'](respondWithResult(_0x13de1f,null))['catch'](handleError(_0x13de1f,null));};exports[_0xc704('0xc3')]=function(_0xfffcf8,_0x214b1b,_0x38ce34){return db[_0xc704('0x32')][_0xc704('0x65')]({'where':{'id':_0xfffcf8[_0xc704('0xb0')]['id']}})[_0xc704('0x27')](handleEntityNotFound(_0x214b1b,null))[_0xc704('0x27')](function(_0x14471b){if(_0x14471b){return _0x14471b[_0xc704('0xc3')](_0xfffcf8['query']['ids']);}})[_0xc704('0x27')](respondWithStatusCode(_0x214b1b,null))[_0xc704('0xaf')](handleError(_0x214b1b,null));};exports[_0xc704('0xc4')]=function(_0x10134e,_0x16cdc1){var _0xa219e0=moment()[_0xc704('0xc5')]()['toString']();var _0x2d2826=path['join'](config[_0xc704('0xc6')],_0xc704('0xc7'),'files',_0xc704('0xc8'));var _0x51c823=path['join'](config[_0xc704('0xc6')],'server','files',_0xc704('0xc9'));var _0x321b99=path[_0xc704('0xca')](_0x2d2826,_0xa219e0);var _0x567d83=util['format'](_0xc704('0xcb'),_0x10134e[_0xc704('0xb0')]['id'],_0xa219e0);var _0xfbba99=path['join'](_0x2d2826,_0x567d83);var _0xeda700=[];_0xeda700[_0xc704('0xac')]({'model':db[_0xc704('0x6b')],'as':_0xc704('0x6b'),'attributes':['id',_0xc704('0x2e')],'raw':!![]});_0xeda700['push']({'model':db['CmContact'],'as':_0xc704('0x61'),'attributes':['id',_0xc704('0xcc'),_0xc704('0xcd')],'raw':!![]});if(_0x10134e['query'][_0xc704('0xc9')]){_0xeda700[_0xc704('0xac')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x3cefbd=[{'model':db[_0xc704('0xb6')],'as':'Messages','attributes':['id',_0xc704('0xb3'),_0xc704('0x75'),'direction',_0xc704('0xce'),_0xc704('0x7c')],'include':_0xeda700}];_0x3cefbd['push']({'model':db['OpenchannelAccount'],'as':'Account','attributes':['id',_0xc704('0x2a')]});_0x3cefbd['push']({'model':db['User'],'as':'Owner','attributes':['id',_0xc704('0x2e')]});return db['OpenchannelInteraction'][_0xc704('0x65')]({'where':{'id':_0x10134e['params']['id']},'include':_0x3cefbd})[_0xc704('0x27')](handleEntityNotFound(_0x16cdc1,null))[_0xc704('0x27')](function(_0x37f44a){if(_0x37f44a){var _0x728c1e=_0x37f44a[_0xc704('0xcf')]({'plain':!![]});fs[_0xc704('0xd0')](_0x321b99);var _0x2a1e91={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':_0xc704('0xd1')}},'footer':{'height':_0xc704('0xd2'),'contents':{'default':util['format'](_0xc704('0xd3'),util[_0xc704('0xd4')]('%s\x20#%d','Openchannel',_0x728c1e['id']),moment()[_0xc704('0xd4')](_0xc704('0xd5'))[_0xc704('0x93')]())}}};var _0x46855e={'channel':'Openchannel','account':_0x728c1e['Account'][_0xc704('0x2a')],'agent':_0x728c1e['Owner']?_0x728c1e['Owner'][_0xc704('0x2e')]:_0xc704('0xd6'),'createdAt':moment(_0x728c1e[_0xc704('0x75')])['format'](_0xc704('0xbb'))[_0xc704('0x93')](),'closedAt':_0x728c1e[_0xc704('0xd7')]?moment(_0x728c1e[_0xc704('0xd8')])[_0xc704('0xd4')](_0xc704('0xbb'))[_0xc704('0x93')]():'','disposition':_0x728c1e[_0xc704('0xd9')],'visibility':_0x728c1e[_0xc704('0xda')]?_0xc704('0xdb'):_0xc704('0xdc'),'messages':_(_0x728c1e[_0xc704('0xdd')])['filter']({'secret':![]})['map'](function(_0x169a64){if(_0x169a64['Attachment']){var _0x2193a5=path[_0xc704('0xca')](_0x51c823,_0x169a64[_0xc704('0xde')][_0xc704('0xdf')]);if(fs[_0xc704('0xe0')](_0x2193a5)){fs[_0xc704('0xe1')](_0x2193a5)[_0xc704('0xe2')](fs[_0xc704('0xe3')](path['join'](_0x321b99,_0x169a64[_0xc704('0xde')][_0xc704('0xdf')])));}}return{'date':moment(_0x169a64[_0xc704('0x75')])[_0xc704('0xd4')](_0xc704('0xbb'))[_0xc704('0x93')](),'sender':_0x169a64['direction']===_0xc704('0xe4')?_0x169a64['User']?_0x169a64[_0xc704('0x6b')][_0xc704('0x2e')]:_0xc704('0xe5'):_0x169a64['Contact']['firstName']+(_0x169a64[_0xc704('0x61')][_0xc704('0xcd')]?'\x20'+_0x169a64[_0xc704('0x61')][_0xc704('0xcd')]:''),'body':_0x169a64[_0xc704('0xde')]?_0x169a64[_0xc704('0xde')][_0xc704('0xdf')]:_0x169a64[_0xc704('0xb3')],'direction':_0x169a64[_0xc704('0xe6')]===_0xc704('0xe4')?'A':'C','secret':_0x169a64[_0xc704('0xce')],'read':_0x169a64['read'],'attachment':_0x169a64[_0xc704('0xde')]};})[_0xc704('0x5e')]()};return ejs[_0xc704('0xe7')](path[_0xc704('0xca')](config[_0xc704('0xc6')],_0xc704('0xc7'),_0xc704('0xe8'),_0xc704('0xe9')),{'interaction':_0x46855e})[_0xc704('0x27')](function(_0x4dd4d6){return new BPromise(function(_0x89155c,_0x25251c){pdf[_0xc704('0xb2')](_0x4dd4d6,_0x2a1e91)[_0xc704('0xea')](path[_0xc704('0xca')](_0x321b99,'transcript-'+_0x728c1e['id']+'-'+_0xa219e0+_0xc704('0xeb')),function(_0xf7300d,_0x186a88){if(_0xf7300d)return _0x25251c(_0xf7300d);_0x89155c(_0x186a88);});});})[_0xc704('0x27')](function(){return new BPromise(function(_0x580713,_0x4174fc){zipdir(_0x321b99,{'saveTo':_0xfbba99},function(_0x2c7879,_0xbaf58a){if(_0x2c7879)return _0x4174fc(_0x2c7879);return _0x580713(_0xbaf58a);});})[_0xc704('0x27')](function(){return new BPromise(function(_0x32af23,_0x290a0e){rimraf(_0x321b99,function(_0x4e9910){if(_0x4e9910)_0x290a0e(_0x4e9910);return _0x32af23();});});})[_0xc704('0x27')](function(){return _0x16cdc1[_0xc704('0xc4')](_0xfbba99,_0x567d83,function(_0x2714fc){if(_0x2714fc){console[_0xc704('0xec')](_0xc704('0xed'),_0x2714fc);}else{fs[_0xc704('0xee')](_0xfbba99);}});});});}else{return _0x16cdc1[_0xc704('0x1b')](0xc8);}})[_0xc704('0xaf')](handleError(_0x16cdc1,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 6971ab6..01e76af 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 _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 +var _0x7955=['findAll','then','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','setDataValue','Users','map'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x7955,0x127));var _0x5795=function(_0x104209,_0x59e25e){_0x104209=_0x104209-0x0;var _0x100749=_0x7955[_0x104209];return _0x100749;};'use strict';var EventEmitter=require(_0x5795('0x0'));var OpenchannelInteraction=require(_0x5795('0x1'))['db'][_0x5795('0x2')];var OpenchannelMessage=require(_0x5795('0x1'))['db'][_0x5795('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x5795('0x4')](0x0);var events={'afterCreate':_0x5795('0x5'),'afterUpdate':_0x5795('0x6'),'afterDestroy':_0x5795('0x7')};function emitEvent(_0x218aa9){return function(_0x5143cd,_0x4ce6d8,_0x194344){_0x5143cd['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x383c6d){_0x5143cd[_0x5795('0x8')](_0x5795('0x9'),_0x383c6d[_0x5795('0xa')](function(_0x4cf993){return{'id':_0x4cf993['id']};}));return OpenchannelMessage[_0x5795('0xb')]({'where':{'OpenchannelInteractionId':_0x5143cd['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5795('0xc')](function(_0x56d1ff){_0x5143cd['setDataValue']('unreadMessages',_0x56d1ff[_0x5795('0xd')]);OpenchannelInteractionEvents[_0x5795('0xe')](_0x218aa9+':'+_0x5143cd['id'],_0x5143cd);OpenchannelInteractionEvents[_0x5795('0xe')](_0x218aa9,_0x5143cd);_0x194344(null);})['catch'](_0x194344(null));};}for(var e in events){if(events[_0x5795('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x5795('0x10')](e,emitEvent(event));}}module[_0x5795('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 46e7efd..5ba73de 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 _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 +var _0x99c9=['../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x27f704,_0x369a80){var _0x389f0a=function(_0x613c2e){while(--_0x613c2e){_0x27f704['push'](_0x27f704['shift']());}};_0x389f0a(++_0x369a80);}(_0x99c9,0x13c));var _0x999c=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x99c9[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0x999c('0x0'));var util=require(_0x999c('0x1'));var logger=require(_0x999c('0x2'))(_0x999c('0x3'));var moment=require(_0x999c('0x4'));var BPromise=require(_0x999c('0x5'));var rp=require(_0x999c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x999c('0x7'));var config=require(_0x999c('0x8'));var attributes=require(_0x999c('0x9'));module[_0x999c('0xa')]=function(_0x2bdd73,_0x14df32){return _0x2bdd73[_0x999c('0xb')](_0x999c('0xc'),attributes,{'tableName':_0x999c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xb88ec1,_0x329252,_0x3c58ba){if(_0xb88ec1[_0x999c('0xe')](_0x999c('0xf'))){_0xb88ec1['closedAt']=moment()[_0x999c('0x10')](_0x999c('0x11'));}_0x3c58ba(null,_0xb88ec1);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 9302806..915d35a 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 _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 +var _0xd15b=['redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','where','attributes','limit','debug','AddTagsToOpenchannelInteraction','find','addTags','ids','spread','AddTags','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x488982,_0x3e260c){var _0xfe389c=function(_0x2f8670){while(--_0x2f8670){_0x488982['push'](_0x488982['shift']());}};_0xfe389c(++_0x3e260c);}(_0xd15b,0x1e2));var _0xbd15=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd15b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xbd15('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbd15('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd15('0x2'));var db=require(_0xbd15('0x3'))['db'];var utils=require(_0xbd15('0x4'));var logger=require(_0xbd15('0x5'))(_0xbd15('0x6'));var config=require(_0xbd15('0x7'));var jayson=require(_0xbd15('0x8'));var client=jayson[_0xbd15('0x9')]['http']({'port':0x232a});config[_0xbd15('0xa')]=_[_0xbd15('0xb')](config[_0xbd15('0xa')],{'host':_0xbd15('0xc'),'port':0x18eb});var socket=require(_0xbd15('0xd'))(new Redis(config[_0xbd15('0xa')]));require('./openchannelInteraction.socket')[_0xbd15('0xe')](socket);function respondWithRpcPromise(_0x52ae4a,_0x2857d7,_0x1d3ca7){return new BPromise(function(_0x575d77,_0x169fd8){return client[_0xbd15('0xf')](_0x52ae4a,_0x1d3ca7)[_0xbd15('0x10')](function(_0x2dadc8){logger[_0xbd15('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2857d7,'request\x20sent');logger['debug']('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x2857d7,_0xbd15('0x12'),JSON[_0xbd15('0x13')](_0x2dadc8));if(_0x2dadc8[_0xbd15('0x14')]){if(_0x2dadc8[_0xbd15('0x14')][_0xbd15('0x15')]===0x1f4){logger[_0xbd15('0x14')](_0xbd15('0x16'),_0x2857d7,_0x2dadc8[_0xbd15('0x14')]['message']);return _0x169fd8(_0x2dadc8[_0xbd15('0x14')][_0xbd15('0x17')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x2857d7,_0x2dadc8[_0xbd15('0x14')]['message']);return _0x575d77(_0x2dadc8['error'][_0xbd15('0x17')]);}else{logger['info'](_0xbd15('0x16'),_0x2857d7,_0xbd15('0x12'));_0x575d77(_0x2dadc8[_0xbd15('0x18')][_0xbd15('0x17')]);}})[_0xbd15('0x19')](function(_0xd1c07a){logger['error'](_0xbd15('0x16'),_0x2857d7,_0xd1c07a);_0x169fd8(_0xd1c07a);});});}exports[_0xbd15('0x1a')]=function(_0x3dfc73){var _0x44cd4c=this;return new Promise(function(_0x390690,_0x1ad0c0){return db[_0xbd15('0x1b')][_0xbd15('0x1c')](_0x3dfc73[_0xbd15('0x1d')],{'raw':_0x3dfc73[_0xbd15('0x1e')]?_0x3dfc73[_0xbd15('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3dfc73[_0xbd15('0x1e')]?_0x3dfc73['options'][_0xbd15('0x1f')]||null:null,'attributes':_0x3dfc73[_0xbd15('0x1e')]?_0x3dfc73['options'][_0xbd15('0x20')]||null:null,'limit':_0x3dfc73[_0xbd15('0x1e')]?_0x3dfc73['options'][_0xbd15('0x21')]||null:null})[_0xbd15('0x10')](function(_0x561bec){logger[_0xbd15('0x11')](_0xbd15('0x1a'),_0x3dfc73);logger[_0xbd15('0x22')](_0xbd15('0x1a'),_0x3dfc73,JSON[_0xbd15('0x13')](_0x561bec));_0x390690(_0x561bec);})[_0xbd15('0x19')](function(_0x4ecbc2){logger[_0xbd15('0x14')](_0xbd15('0x1a'),_0x4ecbc2[_0xbd15('0x17')],_0x3dfc73);_0x1ad0c0(_0x44cd4c[_0xbd15('0x14')](0x1f4,_0x4ecbc2[_0xbd15('0x17')]));});});};exports[_0xbd15('0x23')]=function(_0x13b37b){return new Promise(function(_0x5745c5,_0x506441){return db[_0xbd15('0x1b')][_0xbd15('0x24')]({'where':_0x13b37b[_0xbd15('0x1e')]?_0x13b37b[_0xbd15('0x1e')][_0xbd15('0x1f')]||null:null})[_0xbd15('0x10')](function(_0x4c77b8){if(_0x4c77b8){return _0x4c77b8[_0xbd15('0x25')](_0x13b37b['body'][_0xbd15('0x26')],_['omit'](_0x13b37b['body'],['ids','id'])||{});}})[_0xbd15('0x27')](function(_0x3b58b2){logger['info'](_0xbd15('0x28'),_0x13b37b);logger['debug'](_0xbd15('0x28'),_0x13b37b,JSON[_0xbd15('0x13')](_0x3b58b2));_0x5745c5(_0x3b58b2);})[_0xbd15('0x19')](function(_0x4b3cbf){logger[_0xbd15('0x14')](_0xbd15('0x28'),_0x4b3cbf[_0xbd15('0x17')],_0x13b37b);_0x506441(_this[_0xbd15('0x14')](0x1f4,_0x4b3cbf[_0xbd15('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index e64b7a1..7390032 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 _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 +var _0x15b5=['register','length','openchannelInteraction:','./openchannelInteraction.events','remove','update','emit','removeListener'];(function(_0x13fc6a,_0x2ec04d){var _0x1f5e1f=function(_0x102c6d){while(--_0x102c6d){_0x13fc6a['push'](_0x13fc6a['shift']());}};_0x1f5e1f(++_0x2ec04d);}(_0x15b5,0x7b));var _0x515b=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x15b5[_0x4bb66f];return _0xf2772f;};'use strict';var OpenchannelInteractionEvents=require(_0x515b('0x0'));var events=['save',_0x515b('0x1'),_0x515b('0x2')];function createListener(_0x4128b0,_0x35a1cf){return function(_0xf8d734){_0x35a1cf[_0x515b('0x3')](_0x4128b0,_0xf8d734);};}function removeListener(_0x5e04ae,_0x503305){return function(){OpenchannelInteractionEvents[_0x515b('0x4')](_0x5e04ae,_0x503305);};}exports[_0x515b('0x5')]=function(_0x13cf37){for(var _0x17e0c6=0x0,_0x484010=events[_0x515b('0x6')];_0x17e0c6<_0x484010;_0x17e0c6++){var _0x1eb652=events[_0x17e0c6];var _0x22defc=createListener(_0x515b('0x7')+_0x1eb652,_0x13cf37);OpenchannelInteractionEvents['on'](_0x1eb652,_0x22defc);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index bb62327..de05f8e 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 _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 +var _0x81df=['show','tracked','openchannel','openchannelmessage:create','create','/:id','update','put','/:id/accept','reject','destroy','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe'];(function(_0x509239,_0x4fab00){var _0x39eae0=function(_0x5b4cf4){while(--_0x5b4cf4){_0x509239['push'](_0x509239['shift']());}};_0x39eae0(++_0x4fab00);}(_0x81df,0x170));var _0xf81d=function(_0x51c940,_0x2ca1c4){_0x51c940=_0x51c940-0x0;var _0x4d7029=_0x81df[_0x51c940];return _0x4d7029;};'use strict';var multer=require(_0xf81d('0x0'));var util=require('util');var path=require(_0xf81d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf81d('0x2')]();var auth=require(_0xf81d('0x3'));var interaction=require(_0xf81d('0x4'));var config=require(_0xf81d('0x5'));var controller=require('./openchannelMessage.controller');router['get']('/',auth[_0xf81d('0x6')](),controller['index']);router[_0xf81d('0x7')](_0xf81d('0x8'),auth[_0xf81d('0x6')](),controller[_0xf81d('0x9')]);router[_0xf81d('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xf81d('0xa')]);router['post']('/',auth[_0xf81d('0x6')](),interaction[_0xf81d('0xb')](_0xf81d('0xc'),_0xf81d('0xd')),controller[_0xf81d('0xe')]);router['put'](_0xf81d('0xf'),auth[_0xf81d('0x6')](),controller[_0xf81d('0x10')]);router[_0xf81d('0x11')](_0xf81d('0x12'),auth[_0xf81d('0x6')](),controller['accept']);router[_0xf81d('0x11')]('/:id/reject',auth[_0xf81d('0x6')](),controller[_0xf81d('0x13')]);router['delete'](_0xf81d('0xf'),auth[_0xf81d('0x6')](),controller[_0xf81d('0x14')]);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 7d3e543..431172f 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 _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 +var _0xd9d2=['sequelize','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x970ecf,_0x5f35ad){var _0x3dec37=function(_0x105993){while(--_0x105993){_0x970ecf['push'](_0x970ecf['shift']());}};_0x3dec37(++_0x5f35ad);}(_0xd9d2,0x17a));var _0x2d9d=function(_0x3bc188,_0x374a54){_0x3bc188=_0x3bc188-0x0;var _0x50306f=_0xd9d2[_0x3bc188];return _0x50306f;};'use strict';var Sequelize=require(_0x2d9d('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x2d9d('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x2d9d('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x2d9d('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2d9d('0x3')]('in',_0x2d9d('0x4')),'defaultValue':_0x2d9d('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x2d9d('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index b5664fe..82560fb 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 _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 +var _0xedd9=['socket.io-emitter','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~!@#$%^&-_=+[{]}.','info','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','OpenchannelMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','catch','show','params','find','create','body','describe','openchannel-interactions','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','openchannel','agent','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost'];(function(_0x283386,_0x195525){var _0x2ddd75=function(_0x160b29){while(--_0x160b29){_0x283386['push'](_0x283386['shift']());}};_0x2ddd75(++_0x195525);}(_0xedd9,0x1c5));var _0x9edd=function(_0x28f4c2,_0x1479c4){_0x28f4c2=_0x28f4c2-0x0;var _0x12d573=_0xedd9[_0x28f4c2];return _0x12d573;};'use strict';var pdf=require(_0x9edd('0x0'));var emlformat=require(_0x9edd('0x1'));var rimraf=require(_0x9edd('0x2'));var zipdir=require(_0x9edd('0x3'));var jsonpatch=require(_0x9edd('0x4'));var rp=require('request-promise');var moment=require(_0x9edd('0x5'));var BPromise=require(_0x9edd('0x6'));var Mustache=require(_0x9edd('0x7'));var util=require('util');var path=require(_0x9edd('0x8'));var sox=require(_0x9edd('0x9'));var csv=require(_0x9edd('0xa'));var ejs=require(_0x9edd('0xb'));var fs=require('fs');var _=require(_0x9edd('0xc'));var squel=require(_0x9edd('0xd'));var crypto=require(_0x9edd('0xe'));var jsforce=require(_0x9edd('0xf'));var deskjs=require(_0x9edd('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9edd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9edd('0x12'));var hardwareService=require(_0x9edd('0x13'));var logger=require(_0x9edd('0x14'))('api');var utils=require(_0x9edd('0x15'));var config=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];config[_0x9edd('0x18')]=_[_0x9edd('0x19')](config[_0x9edd('0x18')],{'host':_0x9edd('0x1a'),'port':0x18eb});var socket=require(_0x9edd('0x1b'))(new Redis(config[_0x9edd('0x18')]));require('./openchannelMessage.socket')[_0x9edd('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9edd('0x1d')][_0x9edd('0x1e')]({'port':0x232c});var client9002=jayson[_0x9edd('0x1d')][_0x9edd('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x139afe,_0x1e29aa,_0x245f00){if(_0x245f00){var _0x2654ad=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2654ad[_0x9edd('0x1f')](_0x1e29aa)){return _0x139afe;}else{throw new db[(_0x9edd('0x20'))][(_0x9edd('0x21'))](_0x9edd('0x22'));}}else{return _0x139afe;}}function respondWithRpcPromise(_0xed4a93,_0x4d0447,_0x49fd20,_0x364b69){return new BPromise(function(_0x356a23,_0x4ca261){var _0x4af725=_0x364b69||client;return _0x4af725['request'](_0xed4a93,_0x49fd20)['then'](function(_0xe67958){logger[_0x9edd('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x4d0447,_0x9edd('0x24'));logger['debug'](_0x9edd('0x25'),_0x4d0447,_0x9edd('0x24'),JSON[_0x9edd('0x26')](_0xe67958));if(_0xe67958[_0x9edd('0x27')]){if(_0xe67958[_0x9edd('0x27')][_0x9edd('0x28')]===0x1f4){logger[_0x9edd('0x27')](_0x9edd('0x29'),_0x4d0447,_0xe67958[_0x9edd('0x27')][_0x9edd('0x2a')]);return _0x4ca261(_0xe67958[_0x9edd('0x27')][_0x9edd('0x2a')]);}logger['error'](_0x9edd('0x29'),_0x4d0447,_0xe67958['error'][_0x9edd('0x2a')]);return _0x356a23(_0xe67958[_0x9edd('0x27')][_0x9edd('0x2a')]);}else{logger[_0x9edd('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x4d0447,_0x9edd('0x24'));_0x356a23(_0xe67958['result']['message']);}})['catch'](function(_0x56e7a1){logger['error'](_0x9edd('0x29'),_0x4d0447,_0x56e7a1);_0x4ca261(_0x56e7a1);});});}function respondWithStatusCode(_0x524c99,_0x4f3b1d){_0x4f3b1d=_0x4f3b1d||0xcc;return function(_0x3f78db){if(_0x3f78db){return _0x524c99[_0x9edd('0x2b')](_0x4f3b1d);}return _0x524c99[_0x9edd('0x2c')](_0x4f3b1d)[_0x9edd('0x2d')]();};}function respondWithResult(_0x5b9716,_0x232f2f){_0x232f2f=_0x232f2f||0xc8;return function(_0x3aec6d){if(_0x3aec6d){return _0x5b9716['status'](_0x232f2f)['json'](_0x3aec6d);}};}function respondWithFilteredResult(_0x3f4894,_0x1dbdac){return function(_0x1ec855){if(_0x1ec855){var _0x12dd91=_0x1ec855[_0x9edd('0x2e')],_0x5a30f0=_0x1dbdac[_0x9edd('0x2f')],_0x34715f=_0x1dbdac['offset']+_0x1dbdac[_0x9edd('0x30')],_0x151991;if(_0x34715f>=_0x12dd91){_0x34715f=_0x12dd91;_0x151991=0xc8;}else{_0x151991=0xce;}_0x3f4894['status'](_0x151991);return _0x3f4894[_0x9edd('0x31')](_0x9edd('0x32'),_0x5a30f0+'-'+_0x34715f+'/'+_0x12dd91)['json'](_0x1ec855);}return null;};}function patchUpdates(_0x3fd477){return function(_0x1f8766){try{jsonpatch[_0x9edd('0x33')](_0x1f8766,_0x3fd477,!![]);}catch(_0x3a4041){return BPromise[_0x9edd('0x34')](_0x3a4041);}return _0x1f8766[_0x9edd('0x35')]();};}function saveUpdates(_0x459ba7,_0x371bf2){return function(_0x194d35){if(_0x194d35){return _0x194d35[_0x9edd('0x36')](_0x459ba7)[_0x9edd('0x37')](function(_0x28c87a){return _0x28c87a;});}return null;};}function removeEntity(_0x2537db,_0x561361){return function(_0x346741){if(_0x346741){return _0x346741[_0x9edd('0x38')]()['then'](function(){_0x2537db[_0x9edd('0x2c')](0xcc)[_0x9edd('0x2d')]();});}};}function handleEntityNotFound(_0x581903,_0x1385d0){return function(_0x4bc3cc){if(!_0x4bc3cc){_0x581903[_0x9edd('0x2b')](0x194);}return _0x4bc3cc;};}function handleError(_0x22f5fe,_0x128573){_0x128573=_0x128573||0x1f4;return function(_0x19744d){logger[_0x9edd('0x27')](_0x19744d[_0x9edd('0x39')]);if(_0x19744d[_0x9edd('0x3a')]){delete _0x19744d['name'];}_0x22f5fe[_0x9edd('0x2c')](_0x128573)[_0x9edd('0x3b')](_0x19744d);};}exports['index']=function(_0x45def9,_0x4ff6d7){var _0xde8a42={},_0x7574f6={},_0x2a5c39={'count':0x0,'rows':[]};var _0xf7176c=_[_0x9edd('0x3c')](db[_0x9edd('0x3d')][_0x9edd('0x3e')],function(_0x5be513){return{'name':_0x5be513[_0x9edd('0x3f')],'type':_0x5be513['type'][_0x9edd('0x40')]};});_0x7574f6[_0x9edd('0x41')]=_[_0x9edd('0x3c')](_0xf7176c,'name');_0x7574f6[_0x9edd('0x42')]=_[_0x9edd('0x43')](_0x45def9['query']);_0x7574f6[_0x9edd('0x44')]=_[_0x9edd('0x45')](_0x7574f6[_0x9edd('0x41')],_0x7574f6[_0x9edd('0x42')]);_0xde8a42[_0x9edd('0x46')]=_[_0x9edd('0x45')](_0x7574f6[_0x9edd('0x41')],qs[_0x9edd('0x47')](_0x45def9[_0x9edd('0x42')]['fields']));_0xde8a42[_0x9edd('0x46')]=_0xde8a42[_0x9edd('0x46')][_0x9edd('0x48')]?_0xde8a42[_0x9edd('0x46')]:_0x7574f6[_0x9edd('0x41')];if(!_0x45def9[_0x9edd('0x42')][_0x9edd('0x49')](_0x9edd('0x4a'))){_0xde8a42[_0x9edd('0x30')]=qs['limit'](_0x45def9['query'][_0x9edd('0x30')]);_0xde8a42[_0x9edd('0x2f')]=qs[_0x9edd('0x2f')](_0x45def9[_0x9edd('0x42')]['offset']);}_0xde8a42[_0x9edd('0x4b')]=qs[_0x9edd('0x4c')](_0x45def9[_0x9edd('0x42')]['sort']);_0xde8a42[_0x9edd('0x4d')]=qs[_0x9edd('0x44')](_[_0x9edd('0x4e')](_0x45def9[_0x9edd('0x42')],_0x7574f6[_0x9edd('0x44')]),_0xf7176c);if(_0x45def9[_0x9edd('0x42')][_0x9edd('0x4f')]){_0xde8a42[_0x9edd('0x4d')]=_[_0x9edd('0x50')](_0xde8a42['where'],{'$or':_[_0x9edd('0x3c')](_0xf7176c,function(_0x157dc0){if(_0x157dc0[_0x9edd('0x51')]!=='VIRTUAL'){var _0x4ed1ab={};_0x4ed1ab[_0x157dc0['name']]={'$like':'%'+_0x45def9[_0x9edd('0x42')][_0x9edd('0x4f')]+'%'};return _0x4ed1ab;}})});}_0xde8a42=_['merge']({},_0xde8a42,_0x45def9[_0x9edd('0x52')]);var _0x3aacd3={'where':_0xde8a42[_0x9edd('0x4d')]};return db['OpenchannelMessage'][_0x9edd('0x2e')](_0x3aacd3)[_0x9edd('0x37')](function(_0x58a5f7){_0x2a5c39[_0x9edd('0x2e')]=_0x58a5f7;if(_0x45def9['query'][_0x9edd('0x53')]){_0xde8a42[_0x9edd('0x54')]=[{'all':!![]}];}return db[_0x9edd('0x3d')]['findAll'](_0xde8a42);})[_0x9edd('0x37')](function(_0x53adae){_0x2a5c39['rows']=_0x53adae;return _0x2a5c39;})[_0x9edd('0x37')](respondWithFilteredResult(_0x4ff6d7,_0xde8a42))[_0x9edd('0x55')](handleError(_0x4ff6d7,null));};exports[_0x9edd('0x56')]=function(_0x7a518f,_0x330960){var _0x1761ed={'raw':!![],'where':{'id':_0x7a518f[_0x9edd('0x57')]['id']}},_0x4f29b6={};_0x4f29b6[_0x9edd('0x41')]=_[_0x9edd('0x43')](db[_0x9edd('0x3d')]['rawAttributes']);_0x4f29b6['query']=_[_0x9edd('0x43')](_0x7a518f[_0x9edd('0x42')]);_0x4f29b6[_0x9edd('0x44')]=_[_0x9edd('0x45')](_0x4f29b6['model'],_0x4f29b6['query']);_0x1761ed[_0x9edd('0x46')]=_[_0x9edd('0x45')](_0x4f29b6[_0x9edd('0x41')],qs['fields'](_0x7a518f[_0x9edd('0x42')][_0x9edd('0x47')]));_0x1761ed['attributes']=_0x1761ed[_0x9edd('0x46')][_0x9edd('0x48')]?_0x1761ed[_0x9edd('0x46')]:_0x4f29b6[_0x9edd('0x41')];if(_0x7a518f['query'][_0x9edd('0x53')]){_0x1761ed[_0x9edd('0x54')]=[{'all':!![]}];}_0x1761ed=_[_0x9edd('0x50')]({},_0x1761ed,_0x7a518f['options']);return db[_0x9edd('0x3d')][_0x9edd('0x58')](_0x1761ed)[_0x9edd('0x37')](handleEntityNotFound(_0x330960,null))['then'](respondWithResult(_0x330960,null))[_0x9edd('0x55')](handleError(_0x330960,null));};exports['create']=function(_0x15a8d2,_0xa3eb90){return db['OpenchannelMessage'][_0x9edd('0x59')](_0x15a8d2[_0x9edd('0x5a')],{})[_0x9edd('0x37')](respondWithResult(_0xa3eb90,0xc9))[_0x9edd('0x55')](handleError(_0xa3eb90,null));};exports[_0x9edd('0x36')]=function(_0x9b25ea,_0x19586e){if(_0x9b25ea[_0x9edd('0x5a')]['id']){delete _0x9b25ea[_0x9edd('0x5a')]['id'];}return db[_0x9edd('0x3d')][_0x9edd('0x58')]({'where':{'id':_0x9b25ea['params']['id']}})['then'](handleEntityNotFound(_0x19586e,null))[_0x9edd('0x37')](saveUpdates(_0x9b25ea[_0x9edd('0x5a')],null))[_0x9edd('0x37')](respondWithResult(_0x19586e,null))[_0x9edd('0x55')](handleError(_0x19586e,null));};exports[_0x9edd('0x38')]=function(_0x1728ed,_0x568352){return db[_0x9edd('0x3d')][_0x9edd('0x58')]({'where':{'id':_0x1728ed[_0x9edd('0x57')]['id']}})[_0x9edd('0x37')](handleEntityNotFound(_0x568352,null))[_0x9edd('0x37')](removeEntity(_0x568352,null))['catch'](handleError(_0x568352,null));};exports[_0x9edd('0x5b')]=function(_0x1bf6ad,_0x5b4103){return db[_0x9edd('0x3d')][_0x9edd('0x5b')]()['then'](respondWithResult(_0x5b4103,null))['catch'](handleError(_0x5b4103,null));};var interaction_log=require(_0x9edd('0x14'))(_0x9edd('0x5c'));exports[_0x9edd('0x5d')]=function(_0x1ac8b0,_0x496c1d,_0x4e34a5){var _0x26b7ac={'channel':'openchannel'};if(_0x1ac8b0['body']['id']){delete _0x1ac8b0[_0x9edd('0x5a')]['id'];}_0x1ac8b0['body'][_0x9edd('0x5e')]=!![];_0x1ac8b0[_0x9edd('0x5a')]['readAt']=moment()[_0x9edd('0x5f')](_0x9edd('0x60'));_0x1ac8b0[_0x9edd('0x5a')]['UserId']=_0x1ac8b0['body'][_0x9edd('0x61')]||_0x1ac8b0[_0x9edd('0x62')]['id'];return db[_0x9edd('0x3d')]['find']({'where':{'id':_0x1ac8b0['params']['id'],'UserId':null},'include':[{'model':db[_0x9edd('0x63')],'as':_0x9edd('0x64')}]})[_0x9edd('0x37')](handleEntityNotFound(_0x496c1d,null))[_0x9edd('0x37')](saveUpdates(_0x1ac8b0[_0x9edd('0x5a')],null))[_0x9edd('0x37')](function(_0x5f14e1){if(_0x5f14e1){_0x26b7ac[_0x9edd('0x2a')]=_0x5f14e1[_0x9edd('0x65')]({'plain':!![]});return db['OpenchannelInteraction'][_0x9edd('0x58')]({'where':{'id':_0x5f14e1['OpenchannelInteractionId']}});}return null;})[_0x9edd('0x37')](handleEntityNotFound(_0x496c1d,null))['then'](function(_0x15b2f6){if(_0x15b2f6){return _0x15b2f6[_0x9edd('0x36')]({'UserId':_0x1ac8b0[_0x9edd('0x5a')][_0x9edd('0x61')],'read1stAt':_[_0x9edd('0x66')](_0x15b2f6[_0x9edd('0x67')])?moment()[_0x9edd('0x5f')](_0x9edd('0x60')):undefined});}return null;})[_0x9edd('0x37')](function(_0x210a1b){if(_0x210a1b){_0x26b7ac[_0x9edd('0x68')]=_0x210a1b['get']({'plain':!![]});interaction_log[_0x9edd('0x23')](_0x9edd('0x69'),_0x1ac8b0[_0x9edd('0x62')]['id'],_0x1ac8b0[_0x9edd('0x62')][_0x9edd('0x3a')],_0x1ac8b0[_0x9edd('0x62')][_0x9edd('0x6a')],_0x26b7ac['interaction']['id'],_0x1ac8b0[_0x9edd('0x5a')]?JSON['stringify'](_0x1ac8b0[_0x9edd('0x5a')]):'null');return respondWithRpcPromise('AcceptMessage',_0x9edd('0x6b'),_0x26b7ac);}return null;})[_0x9edd('0x37')](function(_0x4e3d02){if(_0x4e3d02){if(_0x1ac8b0[_0x9edd('0x5a')][_0x9edd('0x6c')]){_0x26b7ac[_0x9edd('0x2a')][_0x9edd('0x6d')]=util[_0x9edd('0x5f')](_0x9edd('0x6e'),_0x1ac8b0[_0x9edd('0x62')][_0x9edd('0x3a')]);_0x26b7ac['message']['channel']=_0x26b7ac[_0x9edd('0x6f')];_0x26b7ac[_0x9edd('0x2a')][_0x9edd('0x70')]=_0x9edd('0x5d');return respondWithRpcPromise('EventManager',_0x9edd('0x71'),{'event':'acceptmessage','message':_0x26b7ac[_0x9edd('0x2a')]},client9002)[_0x9edd('0x37')](function(){return _0x26b7ac;});}return _0x26b7ac;}return null;})[_0x9edd('0x37')](respondWithResult(_0x496c1d,null))[_0x9edd('0x55')](handleError(_0x496c1d,null));};var interaction_log=require(_0x9edd('0x14'))('openchannel-interactions');exports[_0x9edd('0x34')]=function(_0x3e186a,_0x2cf96d,_0x19863d){var _0x57aa51={'agent':{},'channel':_0x9edd('0x72')};if(_0x3e186a[_0x9edd('0x5a')]['id']){delete _0x3e186a[_0x9edd('0x5a')]['id'];}_0x3e186a[_0x9edd('0x5a')][_0x9edd('0x61')]=_0x3e186a[_0x9edd('0x5a')][_0x9edd('0x61')]||_0x3e186a[_0x9edd('0x62')]['id'];_0x57aa51[_0x9edd('0x73')]['id']=_0x3e186a['body'][_0x9edd('0x61')];return db[_0x9edd('0x3d')][_0x9edd('0x58')]({'where':{'id':_0x3e186a[_0x9edd('0x57')]['id'],'UserId':null}})[_0x9edd('0x37')](handleEntityNotFound(_0x2cf96d,null))[_0x9edd('0x37')](function(_0x282843){if(_0x282843){_0x57aa51[_0x9edd('0x2a')]=_0x282843['get']({'plain':!![]});return db['OpenchannelInteraction'][_0x9edd('0x58')]({'where':{'id':_0x282843[_0x9edd('0x74')]}});}return null;})[_0x9edd('0x37')](handleEntityNotFound(_0x2cf96d,null))['then'](function(_0x238ec4){if(_0x238ec4){_0x57aa51['interaction']=_0x238ec4['get']({'plain':!![]});interaction_log[_0x9edd('0x23')](_0x9edd('0x75'),_0x3e186a['user']['id'],_0x3e186a['user'][_0x9edd('0x3a')],_0x3e186a[_0x9edd('0x62')][_0x9edd('0x6a')],_0x57aa51[_0x9edd('0x68')]['id'],_0x3e186a[_0x9edd('0x5a')]?JSON[_0x9edd('0x26')](_0x3e186a[_0x9edd('0x5a')]):'null');return respondWithRpcPromise(_0x9edd('0x76'),'rejectMessage',_0x57aa51);}return null;})[_0x9edd('0x37')](function(_0x5088a8){if(_0x5088a8){_0x5088a8['message']['interface']=util[_0x9edd('0x5f')]('SIP/%s',_0x3e186a['user'][_0x9edd('0x3a')]);_0x5088a8[_0x9edd('0x2a')]['channel']=_0x57aa51[_0x9edd('0x6f')];_0x5088a8['message']['event']=_0x9edd('0x34');respondWithRpcPromise(_0x9edd('0x71'),_0x9edd('0x71'),{'event':_0x9edd('0x77'),'message':_0x5088a8['message']},client9002);return _0x57aa51;}return null;})['then'](respondWithResult(_0x2cf96d,null))[_0x9edd('0x55')](handleError(_0x2cf96d,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index b5b0cea..720b8a7 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 _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 +var _0x4d24=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3c5e3f,_0x4da46f){var _0x5cd134=function(_0x353ac1){while(--_0x353ac1){_0x3c5e3f['push'](_0x3c5e3f['shift']());}};_0x5cd134(++_0x4da46f);}(_0x4d24,0x135));var _0x44d2=function(_0x23574a,_0x56231a){_0x23574a=_0x23574a-0x0;var _0x155559=_0x4d24[_0x23574a];return _0x155559;};'use strict';var EventEmitter=require(_0x44d2('0x0'));var OpenchannelMessage=require(_0x44d2('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x44d2('0x2')](0x0);var events={'afterCreate':_0x44d2('0x3'),'afterUpdate':_0x44d2('0x4'),'afterDestroy':_0x44d2('0x5')};function emitEvent(_0x3a1a9c){return function(_0x57f4f6,_0x1f6bee,_0x59700b){OpenchannelMessageEvents['emit'](_0x3a1a9c+':'+_0x57f4f6['id'],_0x57f4f6);OpenchannelMessageEvents[_0x44d2('0x6')](_0x3a1a9c,_0x57f4f6);_0x59700b(null);};}for(var e in events){if(events[_0x44d2('0x7')](e)){var event=events[e];OpenchannelMessage[_0x44d2('0x8')](e,emitEvent(event));}}module[_0x44d2('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 4092e8b..3526c8b 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 _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 +var _0xfa75=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./openchannelMessage.attributes','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','out','secret','UserId','findOne','OpenchannelInteractionId','then','update','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','omit','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch','error','inspect','finally'];(function(_0x2c90c1,_0x446eda){var _0xcb55d4=function(_0x30e230){while(--_0x30e230){_0x2c90c1['push'](_0x2c90c1['shift']());}};_0xcb55d4(++_0x446eda);}(_0xfa75,0x101));var _0x5fa7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfa75[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x5fa7('0x0'));var util=require(_0x5fa7('0x1'));var logger=require(_0x5fa7('0x2'))('api');var moment=require(_0x5fa7('0x3'));var BPromise=require(_0x5fa7('0x4'));var rp=require(_0x5fa7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5fa7('0x6'));var config=require('../../config/environment');var attributes=require(_0x5fa7('0x7'));module['exports']=function(_0x215885,_0xb09ee9){return _0x215885['define'](_0x5fa7('0x8'),attributes,{'tableName':_0x5fa7('0x9'),'paranoid':![],'indexes':[{'name':_0x5fa7('0xa'),'fields':[_0x5fa7('0xb')],'type':_0x5fa7('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2ef61d,_0x8d0a27,_0xfb8c33){var _0x31fa06=_0x215885[_0x5fa7('0xd')];var _0x22e684=_0x2ef61d[_0x5fa7('0xe')]({'plain':!![]});if(_0x22e684[_0x5fa7('0xf')]['toLowerCase']()==='in'||_0x22e684['direction']['toLowerCase']()===_0x5fa7('0x10')&&!_0x22e684[_0x5fa7('0x11')]&&!_['isNil'](_0x22e684[_0x5fa7('0x12')])){_0x31fa06['OpenchannelInteraction'][_0x5fa7('0x13')]({'where':{'id':_0x22e684[_0x5fa7('0x14')]}})[_0x5fa7('0x15')](function(_0x4947ec){if(_0x4947ec){_0x4947ec[_0x5fa7('0x16')]({'lastMsgAt':_0x22e684['createdAt'],'lastMsgDirection':_0x22e684[_0x5fa7('0xf')]['toLowerCase']()});}})['catch'](function(_0x298894){console['error'](_0x298894);});}if(_0x22e684[_0x5fa7('0xf')]==='out'&&!_0x22e684[_0x5fa7('0x11')]){var _0x2c720c;_0x31fa06[_0x5fa7('0x17')][_0x5fa7('0x18')]()[_0x5fa7('0x15')](function(_0x3edccb){return _0x31fa06[_0x5fa7('0x19')][_0x5fa7('0x1a')]({'where':{'id':_0x22e684[_0x5fa7('0x1b')]},'include':[{'model':_0x31fa06[_0x5fa7('0x1c')],'as':'Interactions','where':{'id':_0x22e684[_0x5fa7('0x14')]},'limit':0x1,'include':[{'model':_0x31fa06[_0x5fa7('0x17')],'as':_0x5fa7('0x1d'),'attributes':_[_0x5fa7('0x1e')](_0x3edccb)}]}]});})[_0x5fa7('0x15')](function(_0x5b97e8){_0x2c720c=_0x5b97e8['get']({'plain':!![]});if(_0x2c720c&&_0x2c720c[_0x5fa7('0x1f')]){logger[_0x5fa7('0x20')](_0x5fa7('0x21'),_0x5fa7('0x22'),util[_0x5fa7('0x23')](_0x5fa7('0x24'),_0x22e684['id'],_0x2c720c[_0x5fa7('0x1f')]));if(_0x2c720c[_0x5fa7('0x25')]&&_0x2c720c[_0x5fa7('0x25')][_0x5fa7('0x26')]){_0x22e684[_0x5fa7('0x27')]=_[_0x5fa7('0x28')](_0x2c720c['Interactions'][0x0],_0x5fa7('0x1d'));_0x22e684[_0x5fa7('0x1d')]=_0x2c720c[_0x5fa7('0x25')][0x0][_0x5fa7('0x1d')];}var _0x8d0a27={'method':'POST','uri':encodeURI(_0x2c720c['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x8d0a27[_0x5fa7('0x29')]){case _0x5fa7('0x2a'):_0x8d0a27['qs']=_0x22e684;break;case'POST':_0x8d0a27[_0x5fa7('0xb')]=_0x22e684;break;}return rp(_0x8d0a27)[_0x5fa7('0x15')](function(_0x6fb55){logger[_0x5fa7('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x5fa7('0x22'),util['format'](_0x5fa7('0x2b'),_0x22e684['id'],_0x2c720c[_0x5fa7('0x1f')]));if(_0x6fb55[_0x5fa7('0xb')][_0x5fa7('0x2c')]&&_0x6fb55[_0x5fa7('0xb')][_0x5fa7('0x2c')]!=_0x22e684[_0x5fa7('0x27')][_0x5fa7('0x2c')]){return _0x31fa06['OpenchannelInteraction'][_0x5fa7('0x16')]({'threadId':_0x6fb55[_0x5fa7('0xb')]['threadId']},{'logging':!![],'where':{'id':_0x22e684['Interaction']['id']}});}else{return;}})[_0x5fa7('0x15')](function(){return _0x2ef61d[_0x5fa7('0x16')]({'read':!![]});})[_0x5fa7('0x2d')](function(_0x18ea80){logger[_0x5fa7('0x2e')](_0x5fa7('0x21'),'afterCreate',util[_0x5fa7('0x2f')](_0x18ea80,{'showHidden':![],'depth':null}));_0xfb8c33();});}else{_0xfb8c33();}})[_0x5fa7('0x30')](function(){_0xfb8c33();});}else{_0xfb8c33();}}},'charset':_0x5fa7('0x31'),'collate':_0x5fa7('0x32')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 1ed71b4..e14081c 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 _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 +var _0xcd2f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','OpenchannelMessage,\x20%s,\x20%s','message','info','result','catch','CreateOpenchannelMessage','create','body','options','raw'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd2f,0xf8));var _0xfcd2=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xcd2f[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xfcd2('0x0'));var rs=require(_0xfcd2('0x1'));var fs=require('fs');var Redis=require(_0xfcd2('0x2'));var db=require(_0xfcd2('0x3'))['db'];var utils=require(_0xfcd2('0x4'));var logger=require(_0xfcd2('0x5'))(_0xfcd2('0x6'));var config=require(_0xfcd2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfcd2('0x8')][_0xfcd2('0x9')]({'port':0x232a});config[_0xfcd2('0xa')]=_[_0xfcd2('0xb')](config[_0xfcd2('0xa')],{'host':_0xfcd2('0xc'),'port':0x18eb});var socket=require(_0xfcd2('0xd'))(new Redis(config[_0xfcd2('0xa')]));require(_0xfcd2('0xe'))[_0xfcd2('0xf')](socket);function respondWithRpcPromise(_0x3c4880,_0x53999a,_0x5994cf){return new BPromise(function(_0x18fa4d,_0x24cd5d){return client[_0xfcd2('0x10')](_0x3c4880,_0x5994cf)[_0xfcd2('0x11')](function(_0x53777e){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x53999a,'request\x20sent');logger['debug'](_0xfcd2('0x12'),_0x53999a,_0xfcd2('0x13'),JSON['stringify'](_0x53777e));if(_0x53777e[_0xfcd2('0x14')]){if(_0x53777e[_0xfcd2('0x14')]['code']===0x1f4){logger['error'](_0xfcd2('0x15'),_0x53999a,_0x53777e[_0xfcd2('0x14')][_0xfcd2('0x16')]);return _0x24cd5d(_0x53777e[_0xfcd2('0x14')][_0xfcd2('0x16')]);}logger['error'](_0xfcd2('0x15'),_0x53999a,_0x53777e[_0xfcd2('0x14')][_0xfcd2('0x16')]);return _0x18fa4d(_0x53777e[_0xfcd2('0x14')][_0xfcd2('0x16')]);}else{logger[_0xfcd2('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0x53999a,_0xfcd2('0x13'));_0x18fa4d(_0x53777e[_0xfcd2('0x18')][_0xfcd2('0x16')]);}})[_0xfcd2('0x19')](function(_0x580184){logger[_0xfcd2('0x14')](_0xfcd2('0x15'),_0x53999a,_0x580184);_0x24cd5d(_0x580184);});});}exports[_0xfcd2('0x1a')]=function(_0x6bfdfc){var _0x40666e=this;return new Promise(function(_0x273a2a,_0x266c86){return db['OpenchannelMessage'][_0xfcd2('0x1b')](_0x6bfdfc[_0xfcd2('0x1c')],{'raw':_0x6bfdfc[_0xfcd2('0x1d')]?_0x6bfdfc[_0xfcd2('0x1d')][_0xfcd2('0x1e')]===undefined?!![]:![]:!![]})[_0xfcd2('0x11')](function(_0x19ea4a){logger[_0xfcd2('0x17')](_0xfcd2('0x1a'),_0x6bfdfc);logger['debug'](_0xfcd2('0x1a'),_0x6bfdfc,JSON['stringify'](_0x19ea4a));_0x273a2a(_0x19ea4a);})[_0xfcd2('0x19')](function(_0x9baa91){logger['error']('CreateOpenchannelMessage',_0x9baa91[_0xfcd2('0x16')],_0x6bfdfc);_0x266c86(_0x40666e[_0xfcd2('0x14')](0x1f4,_0x9baa91[_0xfcd2('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 4a6b360..712a06c 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 _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 +var _0xe706=['register','length','openchannelMessage:','./openchannelMessage.events','save','remove','emit','removeListener'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0xe706,0xa3));var _0x6e70=function(_0x353d3d,_0xc7ebc){_0x353d3d=_0x353d3d-0x0;var _0x1c5409=_0xe706[_0x353d3d];return _0x1c5409;};'use strict';var OpenchannelMessageEvents=require(_0x6e70('0x0'));var events=[_0x6e70('0x1'),_0x6e70('0x2'),'update'];function createListener(_0x2cae77,_0x315629){return function(_0x2ca810){_0x315629[_0x6e70('0x3')](_0x2cae77,_0x2ca810);};}function removeListener(_0x142c27,_0x2164a4){return function(){OpenchannelMessageEvents[_0x6e70('0x4')](_0x142c27,_0x2164a4);};}exports[_0x6e70('0x5')]=function(_0x1b0389){for(var _0x4381d1=0x0,_0x36357b=events[_0x6e70('0x6')];_0x4381d1<_0x36357b;_0x4381d1++){var _0x45a2d4=events[_0x4381d1];var _0x188ed3=createListener(_0x6e70('0x7')+_0x45a2d4,_0x1b0389);OpenchannelMessageEvents['on'](_0x45a2d4,_0x188ed3);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 340ef5e..451deb9 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 _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 +var _0xaeab=['describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addAgents','put','delete','destroy','removeTeams','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index'];(function(_0x1c7334,_0x69ec11){var _0x3bc5c6=function(_0x2e8634){while(--_0x2e8634){_0x1c7334['push'](_0x1c7334['shift']());}};_0x3bc5c6(++_0x69ec11);}(_0xaeab,0x91));var _0xbaea=function(_0x5c928b,_0x43cc19){_0x5c928b=_0x5c928b-0x0;var _0x579f4b=_0xaeab[_0x5c928b];return _0x579f4b;};'use strict';var multer=require(_0xbaea('0x0'));var util=require('util');var path=require(_0xbaea('0x1'));var timeout=require('connect-timeout');var express=require(_0xbaea('0x2'));var router=express[_0xbaea('0x3')]();var auth=require(_0xbaea('0x4'));var interaction=require(_0xbaea('0x5'));var config=require(_0xbaea('0x6'));var controller=require(_0xbaea('0x7'));router[_0xbaea('0x8')]('/',auth[_0xbaea('0x9')](),controller[_0xbaea('0xa')]);router[_0xbaea('0x8')]('/describe',auth[_0xbaea('0x9')](),controller[_0xbaea('0xb')]);router[_0xbaea('0x8')](_0xbaea('0xc'),auth[_0xbaea('0x9')](),controller[_0xbaea('0xd')]);router[_0xbaea('0x8')](_0xbaea('0xe'),auth['isAuthenticated'](),controller[_0xbaea('0xf')]);router[_0xbaea('0x8')](_0xbaea('0x10'),auth[_0xbaea('0x9')](),controller[_0xbaea('0x11')]);router['get'](_0xbaea('0x12'),auth[_0xbaea('0x9')](),controller['getAgents']);router[_0xbaea('0x13')]('/',auth[_0xbaea('0x9')](),controller[_0xbaea('0x14')]);router[_0xbaea('0x13')](_0xbaea('0x10'),auth[_0xbaea('0x9')](),controller['addTeams']);router['post'](_0xbaea('0x12'),auth[_0xbaea('0x9')](),controller[_0xbaea('0x15')]);router[_0xbaea('0x16')](_0xbaea('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xbaea('0x17')](_0xbaea('0xc'),auth['isAuthenticated'](),controller[_0xbaea('0x18')]);router[_0xbaea('0x17')](_0xbaea('0x10'),auth[_0xbaea('0x9')](),controller[_0xbaea('0x19')]);router[_0xbaea('0x17')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 4381421..a758e95 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 _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 +var _0x7f86=['beepall','roundrobin','sequelize','exports','STRING','name','ENUM','rrmemory'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7f86,0xea));var _0x67f8=function(_0x245b14,_0x4ecfd5){_0x245b14=_0x245b14-0x0;var _0x31dd58=_0x7f86[_0x245b14];return _0x31dd58;};'use strict';var Sequelize=require(_0x67f8('0x0'));module[_0x67f8('0x1')]={'name':{'type':Sequelize[_0x67f8('0x2')],'unique':_0x67f8('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x67f8('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x67f8('0x4')](_0x67f8('0x5'),_0x67f8('0x6'),_0x67f8('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 61439be..caa835e 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 _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 +var _0x41c1=['fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./openchannelQueue.socket','status','end','json','count','offset','set','Content-Range','reject','save','then','destroy','get','OpenchannelQueues','UserProfileResource','sendStatus','error','name','send','map','OpenchannelQueue','rawAttributes','fieldName','type','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','length','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','findOne','UserOpenchannelQueue','filter','agent','updatedAt','createdAt','format','%s/%s','openchannelPause','getTeams','addTeams','ids','Team','User','Agents','online','interface','flatMap','sequelize','transaction','forEach','emit','userOpenchannelQueue:save','select','field','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','all','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','spread','isArray','getAgents','html-pdf','eml-format'];(function(_0xfef5e4,_0x1b049c){var _0x3a38d7=function(_0xabd1b7){while(--_0xabd1b7){_0xfef5e4['push'](_0xfef5e4['shift']());}};_0x3a38d7(++_0x1b049c);}(_0x41c1,0x199));var _0x141c=function(_0x2fdce0,_0x496242){_0x2fdce0=_0x2fdce0-0x0;var _0x36f07e=_0x41c1[_0x2fdce0];return _0x36f07e;};'use strict';var pdf=require(_0x141c('0x0'));var emlformat=require(_0x141c('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x141c('0x2'));var rp=require(_0x141c('0x3'));var moment=require(_0x141c('0x4'));var BPromise=require(_0x141c('0x5'));var Mustache=require(_0x141c('0x6'));var util=require(_0x141c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x141c('0x8'));var ejs=require(_0x141c('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x141c('0xa'));var crypto=require('crypto');var jsforce=require(_0x141c('0xb'));var deskjs=require(_0x141c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x141c('0xd'));var Papa=require(_0x141c('0xe'));var Redis=require('ioredis');var authService=require(_0x141c('0xf'));var qs=require(_0x141c('0x10'));var as=require(_0x141c('0x11'));var hardwareService=require(_0x141c('0x12'));var logger=require(_0x141c('0x13'))(_0x141c('0x14'));var utils=require('../../config/utils');var config=require(_0x141c('0x15'));var db=require(_0x141c('0x16'))['db'];config['redis']=_[_0x141c('0x17')](config['redis'],{'host':_0x141c('0x18'),'port':0x18eb});var socket=require(_0x141c('0x19'))(new Redis(config[_0x141c('0x1a')]));require(_0x141c('0x1b'))['register'](socket);function respondWithStatusCode(_0x504d55,_0x1e365d){_0x1e365d=_0x1e365d||0xcc;return function(_0x2f5a17){if(_0x2f5a17){return _0x504d55['sendStatus'](_0x1e365d);}return _0x504d55[_0x141c('0x1c')](_0x1e365d)[_0x141c('0x1d')]();};}function respondWithResult(_0x306145,_0x44bd2e){_0x44bd2e=_0x44bd2e||0xc8;return function(_0x6c9592){if(_0x6c9592){return _0x306145[_0x141c('0x1c')](_0x44bd2e)[_0x141c('0x1e')](_0x6c9592);}};}function respondWithFilteredResult(_0x5ba362,_0x5c10c1){return function(_0x5a367e){if(_0x5a367e){var _0x4316b8=_0x5a367e[_0x141c('0x1f')],_0x1b13af=_0x5c10c1[_0x141c('0x20')],_0x12e28d=_0x5c10c1['offset']+_0x5c10c1['limit'],_0x2b59b8;if(_0x12e28d>=_0x4316b8){_0x12e28d=_0x4316b8;_0x2b59b8=0xc8;}else{_0x2b59b8=0xce;}_0x5ba362[_0x141c('0x1c')](_0x2b59b8);return _0x5ba362[_0x141c('0x21')](_0x141c('0x22'),_0x1b13af+'-'+_0x12e28d+'/'+_0x4316b8)[_0x141c('0x1e')](_0x5a367e);}return null;};}function patchUpdates(_0x13758c){return function(_0x482652){try{jsonpatch['apply'](_0x482652,_0x13758c,!![]);}catch(_0x5006f1){return BPromise[_0x141c('0x23')](_0x5006f1);}return _0x482652[_0x141c('0x24')]();};}function saveUpdates(_0x4abbde,_0x519483){return function(_0x3341a4){if(_0x3341a4){return _0x3341a4['update'](_0x4abbde)[_0x141c('0x25')](function(_0x5c62e2){return _0x5c62e2;});}return null;};}function removeEntity(_0x34924e,_0x422ea3){return function(_0x1697d6){if(_0x1697d6){return _0x1697d6[_0x141c('0x26')]()['then'](function(){var _0x3266e3=_0x1697d6[_0x141c('0x27')]({'plain':!![]});var _0x4c3b43=_0x141c('0x28');return db[_0x141c('0x29')][_0x141c('0x26')]({'where':{'type':_0x4c3b43,'resourceId':_0x3266e3['id']}})[_0x141c('0x25')](function(){return _0x1697d6;});})['then'](function(){_0x34924e[_0x141c('0x1c')](0xcc)[_0x141c('0x1d')]();});}};}function handleEntityNotFound(_0x28d17a,_0x1381f9){return function(_0x95413d){if(!_0x95413d){_0x28d17a[_0x141c('0x2a')](0x194);}return _0x95413d;};}function handleError(_0x3f5a7b,_0x1d91ff){_0x1d91ff=_0x1d91ff||0x1f4;return function(_0x32fba9){logger[_0x141c('0x2b')](_0x32fba9['stack']);if(_0x32fba9[_0x141c('0x2c')]){delete _0x32fba9[_0x141c('0x2c')];}_0x3f5a7b['status'](_0x1d91ff)[_0x141c('0x2d')](_0x32fba9);};}exports['index']=function(_0x379850,_0x29c684){var _0x40a319={},_0x26d3a4={},_0x2d716c={'count':0x0,'rows':[]};var _0x4dfa7f=_[_0x141c('0x2e')](db[_0x141c('0x2f')][_0x141c('0x30')],function(_0x6ad6d3){return{'name':_0x6ad6d3[_0x141c('0x31')],'type':_0x6ad6d3[_0x141c('0x32')]['key']};});_0x26d3a4[_0x141c('0x33')]=_[_0x141c('0x2e')](_0x4dfa7f,_0x141c('0x2c'));_0x26d3a4[_0x141c('0x34')]=_['keys'](_0x379850[_0x141c('0x34')]);_0x26d3a4['filters']=_['intersection'](_0x26d3a4['model'],_0x26d3a4[_0x141c('0x34')]);_0x40a319[_0x141c('0x35')]=_[_0x141c('0x36')](_0x26d3a4[_0x141c('0x33')],qs[_0x141c('0x37')](_0x379850['query']['fields']));_0x40a319[_0x141c('0x35')]=_0x40a319['attributes']['length']?_0x40a319[_0x141c('0x35')]:_0x26d3a4[_0x141c('0x33')];if(!_0x379850[_0x141c('0x34')][_0x141c('0x38')](_0x141c('0x39'))){_0x40a319[_0x141c('0x3a')]=qs[_0x141c('0x3a')](_0x379850[_0x141c('0x34')][_0x141c('0x3a')]);_0x40a319[_0x141c('0x20')]=qs['offset'](_0x379850[_0x141c('0x34')]['offset']);}_0x40a319[_0x141c('0x3b')]=qs[_0x141c('0x3c')](_0x379850[_0x141c('0x34')][_0x141c('0x3c')]);_0x40a319[_0x141c('0x3d')]=qs[_0x141c('0x3e')](_[_0x141c('0x3f')](_0x379850[_0x141c('0x34')],_0x26d3a4['filters']),_0x4dfa7f);if(_0x379850[_0x141c('0x34')]['filter']){_0x40a319[_0x141c('0x3d')]=_[_0x141c('0x40')](_0x40a319[_0x141c('0x3d')],{'$or':_[_0x141c('0x2e')](_0x4dfa7f,function(_0x7f3819){if(_0x7f3819['type']!==_0x141c('0x41')){var _0x353e8a={};_0x353e8a[_0x7f3819[_0x141c('0x2c')]]={'$like':'%'+_0x379850[_0x141c('0x34')]['filter']+'%'};return _0x353e8a;}})});}_0x40a319=_['merge']({},_0x40a319,_0x379850[_0x141c('0x42')]);var _0x52d9b4={'where':_0x40a319['where']};return db[_0x141c('0x2f')][_0x141c('0x1f')](_0x52d9b4)['then'](function(_0x1817dd){_0x2d716c['count']=_0x1817dd;if(_0x379850[_0x141c('0x34')][_0x141c('0x43')]){_0x40a319[_0x141c('0x44')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0x141c('0x45')](_0x40a319);})[_0x141c('0x25')](function(_0xee1716){_0x2d716c[_0x141c('0x46')]=_0xee1716;return _0x2d716c;})[_0x141c('0x25')](respondWithFilteredResult(_0x29c684,_0x40a319))[_0x141c('0x47')](handleError(_0x29c684,null));};exports[_0x141c('0x48')]=function(_0xd71fd8,_0x3bdf56){var _0x10ee9a={'raw':!![],'where':{'id':_0xd71fd8['params']['id']}},_0x210ed2={};_0x210ed2[_0x141c('0x33')]=_[_0x141c('0x49')](db[_0x141c('0x2f')]['rawAttributes']);_0x210ed2[_0x141c('0x34')]=_['keys'](_0xd71fd8[_0x141c('0x34')]);_0x210ed2[_0x141c('0x3e')]=_['intersection'](_0x210ed2[_0x141c('0x33')],_0x210ed2[_0x141c('0x34')]);_0x10ee9a['attributes']=_['intersection'](_0x210ed2[_0x141c('0x33')],qs[_0x141c('0x37')](_0xd71fd8['query'][_0x141c('0x37')]));_0x10ee9a[_0x141c('0x35')]=_0x10ee9a['attributes'][_0x141c('0x4a')]?_0x10ee9a['attributes']:_0x210ed2['model'];if(_0xd71fd8[_0x141c('0x34')][_0x141c('0x43')]){_0x10ee9a[_0x141c('0x44')]=[{'all':!![]}];}_0x10ee9a=_['merge']({},_0x10ee9a,_0xd71fd8[_0x141c('0x42')]);return db['OpenchannelQueue'][_0x141c('0x4b')](_0x10ee9a)[_0x141c('0x25')](handleEntityNotFound(_0x3bdf56,null))[_0x141c('0x25')](respondWithResult(_0x3bdf56,null))[_0x141c('0x47')](handleError(_0x3bdf56,null));};exports['create']=function(_0xab8527,_0x23eb76){return db[_0x141c('0x2f')]['create'](_0xab8527[_0x141c('0x4c')],{})[_0x141c('0x25')](function(_0x37cc1e){var _0x10bff4=_0xab8527[_0x141c('0x4d')]['get']({'plain':!![]});if(!_0x10bff4)throw new Error(_0x141c('0x4e'));if(_0x10bff4[_0x141c('0x4f')]===_0x141c('0x4d')){var _0x9d6892=_0x37cc1e[_0x141c('0x27')]({'plain':!![]});var _0x2e1d99=_0x141c('0x28');return db[_0x141c('0x50')][_0x141c('0x4b')]({'where':{'name':_0x2e1d99,'userProfileId':_0x10bff4[_0x141c('0x51')]},'raw':!![]})['then'](function(_0x4e93fa){if(_0x4e93fa&&_0x4e93fa[_0x141c('0x52')]===0x0){return db[_0x141c('0x29')][_0x141c('0x53')]({'name':_0x9d6892['name'],'resourceId':_0x9d6892['id'],'type':_0x4e93fa['name'],'sectionId':_0x4e93fa['id']},{})[_0x141c('0x25')](function(){return _0x37cc1e;});}else{return _0x37cc1e;}})['catch'](function(_0x329543){logger[_0x141c('0x2b')](_0x141c('0x54'),_0x329543);throw _0x329543;});}return _0x37cc1e;})[_0x141c('0x25')](respondWithResult(_0x23eb76,0xc9))[_0x141c('0x47')](handleError(_0x23eb76,null));};exports[_0x141c('0x55')]=function(_0x3590ef,_0x39c192){if(_0x3590ef[_0x141c('0x4c')]['id']){delete _0x3590ef[_0x141c('0x4c')]['id'];}return db[_0x141c('0x2f')]['find']({'where':{'id':_0x3590ef[_0x141c('0x56')]['id']}})[_0x141c('0x25')](handleEntityNotFound(_0x39c192,null))[_0x141c('0x25')](saveUpdates(_0x3590ef[_0x141c('0x4c')],null))[_0x141c('0x25')](respondWithResult(_0x39c192,null))['catch'](handleError(_0x39c192,null));};exports[_0x141c('0x26')]=function(_0x283177,_0x23f8e4){return db[_0x141c('0x2f')]['find']({'where':{'id':_0x283177[_0x141c('0x56')]['id']}})[_0x141c('0x25')](handleEntityNotFound(_0x23f8e4,null))[_0x141c('0x25')](removeEntity(_0x23f8e4,null))[_0x141c('0x47')](handleError(_0x23f8e4,null));};exports['describe']=function(_0x59d824,_0x5dfa32){return db[_0x141c('0x2f')][_0x141c('0x57')]()[_0x141c('0x25')](respondWithResult(_0x5dfa32,null))[_0x141c('0x47')](handleError(_0x5dfa32,null));};exports[_0x141c('0x58')]=function(_0x4920a1,_0x48cc86,_0x15f5c8){var _0x377c24={'raw':!![],'where':{}},_0x5ba12b={},_0x210e32;return db[_0x141c('0x2f')][_0x141c('0x59')]({'where':{'id':_0x4920a1[_0x141c('0x56')]['id']}})[_0x141c('0x25')](handleEntityNotFound(_0x48cc86,null))[_0x141c('0x25')](function(_0x5c8524){if(_0x5c8524){_0x210e32=_0x5c8524['get']({'plain':!![]});_0x5ba12b[_0x141c('0x33')]=_[_0x141c('0x49')](db[_0x141c('0x5a')][_0x141c('0x30')]);_0x5ba12b[_0x141c('0x34')]=_[_0x141c('0x49')](_0x4920a1[_0x141c('0x34')]);_0x5ba12b[_0x141c('0x3e')]=_[_0x141c('0x36')](_0x5ba12b['model'],_0x5ba12b['query']);_0x377c24[_0x141c('0x35')]=_[_0x141c('0x36')](_0x5ba12b[_0x141c('0x33')],qs[_0x141c('0x37')](_0x4920a1[_0x141c('0x34')]['fields']));_0x377c24[_0x141c('0x35')]=_0x377c24[_0x141c('0x35')][_0x141c('0x4a')]?_0x377c24[_0x141c('0x35')]:_0x5ba12b[_0x141c('0x33')];if(!_0x4920a1[_0x141c('0x34')][_0x141c('0x38')](_0x141c('0x39'))){_0x377c24['limit']=qs[_0x141c('0x3a')](_0x4920a1[_0x141c('0x34')][_0x141c('0x3a')]);_0x377c24[_0x141c('0x20')]=qs['offset'](_0x4920a1[_0x141c('0x34')]['offset']);}_0x377c24[_0x141c('0x3b')]=qs[_0x141c('0x3c')](_0x4920a1[_0x141c('0x34')][_0x141c('0x3c')]);_0x377c24[_0x141c('0x3d')]=qs['filters'](_[_0x141c('0x3f')](_0x4920a1['query'],_0x5ba12b[_0x141c('0x3e')]));_0x377c24[_0x141c('0x3d')]['OpenchannelQueueId']=_0x5c8524['id'];if(_0x4920a1[_0x141c('0x34')][_0x141c('0x5b')]){_0x377c24[_0x141c('0x3d')]=_[_0x141c('0x40')](_0x377c24[_0x141c('0x3d')],{'$or':_[_0x141c('0x2e')](_0x377c24['attributes'],function(_0x2be6bf){var _0x196c8b={};_0x196c8b[_0x2be6bf]={'$like':'%'+_0x4920a1['query'][_0x141c('0x5b')]+'%'};return _0x196c8b;})});}_0x377c24=_['merge']({},_0x377c24,_0x4920a1['options']);return db[_0x141c('0x5a')][_0x141c('0x45')](_0x377c24);}})['then'](function(_0x3a87fe){if(_0x3a87fe){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x3a87fe,'UserId'),'role':_0x141c('0x5c')},'attributes':['id',_0x141c('0x2c'),'openchannelPause',_0x141c('0x5d'),_0x141c('0x5e')]});}})[_0x141c('0x25')](function(_0x639fb0){if(_0x639fb0){return{'count':_0x639fb0['count'],'rows':_[_0x141c('0x2e')](_0x639fb0[_0x141c('0x46')],function(_0x5e6f5a){return{'membername':_0x5e6f5a[_0x141c('0x2c')],'UserId':_0x5e6f5a['id'],'queue_name':_0x210e32[_0x141c('0x2c')],'OpenchannelQueueId':_0x210e32['id'],'interface':util[_0x141c('0x5f')](_0x141c('0x60'),'SIP',_0x5e6f5a['name']),'penalty':0x0,'paused':_0x5e6f5a[_0x141c('0x61')],'createdAt':_0x5e6f5a[_0x141c('0x5e')],'updatedAt':_0x5e6f5a[_0x141c('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x141c('0x25')](respondWithFilteredResult(_0x48cc86,_0x377c24))[_0x141c('0x47')](handleError(_0x48cc86,null));};exports[_0x141c('0x62')]=function(_0x24d8e6,_0x203c1a,_0x2cf102){var _0x3c4156={};var _0x3298e1={};var _0x560db6;var _0x58f581;return db[_0x141c('0x2f')][_0x141c('0x59')]({'where':{'id':_0x24d8e6['params']['id']}})[_0x141c('0x25')](handleEntityNotFound(_0x203c1a,null))[_0x141c('0x25')](function(_0x2bbd07){if(_0x2bbd07){_0x560db6=_0x2bbd07;_0x3298e1[_0x141c('0x33')]=_['keys'](db['Team'][_0x141c('0x30')]);_0x3298e1[_0x141c('0x34')]=_[_0x141c('0x49')](_0x24d8e6[_0x141c('0x34')]);_0x3298e1[_0x141c('0x3e')]=_[_0x141c('0x36')](_0x3298e1[_0x141c('0x33')],_0x3298e1['query']);_0x3c4156[_0x141c('0x35')]=_[_0x141c('0x36')](_0x3298e1[_0x141c('0x33')],qs[_0x141c('0x37')](_0x24d8e6[_0x141c('0x34')][_0x141c('0x37')]));_0x3c4156[_0x141c('0x35')]=_0x3c4156['attributes'][_0x141c('0x4a')]?_0x3c4156[_0x141c('0x35')]:_0x3298e1[_0x141c('0x33')];_0x3c4156[_0x141c('0x3b')]=qs[_0x141c('0x3c')](_0x24d8e6[_0x141c('0x34')][_0x141c('0x3c')]);_0x3c4156[_0x141c('0x3d')]=qs[_0x141c('0x3e')](_['pick'](_0x24d8e6[_0x141c('0x34')],_0x3298e1[_0x141c('0x3e')]));if(_0x24d8e6['query'][_0x141c('0x5b')]){_0x3c4156[_0x141c('0x3d')]=_[_0x141c('0x40')](_0x3c4156[_0x141c('0x3d')],{'$or':_[_0x141c('0x2e')](_0x3c4156[_0x141c('0x35')],function(_0x2ac55d){var _0x22942a={};_0x22942a[_0x2ac55d]={'$like':'%'+_0x24d8e6[_0x141c('0x34')][_0x141c('0x5b')]+'%'};return _0x22942a;})});}_0x3c4156=_[_0x141c('0x40')]({},_0x3c4156,_0x24d8e6[_0x141c('0x42')]);return _0x560db6[_0x141c('0x62')](_0x3c4156);}})['then'](function(_0x1eb7d7){if(_0x1eb7d7){_0x58f581=_0x1eb7d7[_0x141c('0x4a')];if(!_0x24d8e6['query'][_0x141c('0x38')](_0x141c('0x39'))){_0x3c4156[_0x141c('0x3a')]=qs['limit'](_0x24d8e6[_0x141c('0x34')][_0x141c('0x3a')]);_0x3c4156[_0x141c('0x20')]=qs[_0x141c('0x20')](_0x24d8e6[_0x141c('0x34')][_0x141c('0x20')]);}return _0x560db6[_0x141c('0x62')](_0x3c4156);}})[_0x141c('0x25')](function(_0x3f21e5){if(_0x3f21e5){return _0x3f21e5?{'count':_0x58f581,'rows':_0x3f21e5}:null;}})[_0x141c('0x25')](respondWithResult(_0x203c1a,null))[_0x141c('0x47')](handleError(_0x203c1a,null));};exports[_0x141c('0x63')]=function(_0x4ad3ad,_0x335cd5,_0x93dbae){var _0x4387d5=_0x4ad3ad[_0x141c('0x4c')][_0x141c('0x64')];return db[_0x141c('0x65')][_0x141c('0x45')]({'where':{'id':_0x4387d5},'attributes':['id'],'include':[{'model':db[_0x141c('0x66')],'as':_0x141c('0x67'),'attributes':['id','name',_0x141c('0x68'),'voicePause',_0x141c('0x69')],'raw':!![]}]})[_0x141c('0x25')](function(_0x27694a){if(_0x27694a){var _0x370c72=_[_0x141c('0x6a')](_0x27694a,function(_0x4f403a){var _0xda2283=_0x4f403a[_0x141c('0x27')]({'plain':!![]});return _0xda2283[_0x141c('0x67')];});return db[_0x141c('0x2f')][_0x141c('0x4b')]({'where':{'id':_0x4ad3ad[_0x141c('0x56')]['id']}})[_0x141c('0x25')](function(_0x47d4e9){return db[_0x141c('0x6b')][_0x141c('0x6c')](function(_0x483857){return _0x47d4e9['addTeams'](_0x4387d5,{'transaction':_0x483857})['then'](function(){return BPromise['each'](_0x370c72,function(_0x283b62){return db[_0x141c('0x5a')]['findOrCreate']({'where':{'UserId':_0x283b62['id'],'OpenchannelQueueId':_0x4ad3ad['params']['id']},'transaction':_0x483857});});})['then'](function(){_0x370c72[_0x141c('0x6d')](function(_0x43a58a){socket[_0x141c('0x6e')](_0x141c('0x6f'),{'UserId':_0x43a58a['id'],'OpenchannelQueueId':_0x47d4e9['id']});});});});});}})[_0x141c('0x25')](respondWithStatusCode(_0x335cd5,null))['catch'](handleError(_0x335cd5,null));};exports['removeTeams']=function(_0x21d201,_0x3af237,_0x3315db){return db[_0x141c('0x65')][_0x141c('0x45')]({'where':{'id':_0x21d201[_0x141c('0x34')][_0x141c('0x64')]},'attributes':['id'],'include':[{'model':db[_0x141c('0x66')],'as':_0x141c('0x67'),'attributes':['id'],'raw':!![]}]})[_0x141c('0x25')](handleEntityNotFound(_0x3af237,null))[_0x141c('0x25')](function(_0x5c220a){var _0x4a4dd8=_[_0x141c('0x2e')](_0x5c220a,'id');var _0x454296=[];var _0x15770f=[];var _0x50e90e=squel[_0x141c('0x70')]();_0x50e90e[_0x141c('0x71')]('tq.TeamId')[_0x141c('0x72')](_0x141c('0x73'),'tq')[_0x141c('0x74')](_0x141c('0x75'),'ut',_0x141c('0x76'))['where'](_0x141c('0x77'),_0x21d201[_0x141c('0x56')]['id']);for(var _0xdeb7d4=0x0;_0xdeb7d4<_0x5c220a[_0x141c('0x4a')];_0xdeb7d4+=0x1){let _0x1bed26=_0x5c220a[_0xdeb7d4];for(var _0x27b61c=0x0;_0x27b61c<_0x1bed26[_0x141c('0x67')][_0x141c('0x4a')];_0x27b61c+=0x1){let _0x5b3f35=_0x1bed26[_0x141c('0x67')][_0x27b61c];var _0x4e771e=_0x50e90e[_0x141c('0x78')]();_0x4e771e['where'](_0x141c('0x79'),_0x5b3f35['id']);_0x15770f[_0x141c('0x7a')](db[_0x141c('0x6b')]['query'](_0x4e771e[_0x141c('0x7b')](),{'type':db['sequelize'][_0x141c('0x7c')]['SELECT']})[_0x141c('0x25')](function(_0x5a26d3){if(_0x5a26d3['length']===0x1){return _0x5b3f35['id'];}else{var _0x456f4d=_['every'](_['map'](_0x5a26d3,_0x141c('0x7d')),function(_0x2746e3){return _['includes'](_0x4a4dd8,_0x2746e3);});if(_0x456f4d){return _0x5b3f35['id'];}}}));}}return BPromise[_0x141c('0x7e')](_0x15770f)[_0x141c('0x25')](function(_0x22763e){_0x454296=_(_0x454296)[_0x141c('0x7f')](_0x22763e)[_0x141c('0x80')]()[_0x141c('0x81')]();return db[_0x141c('0x2f')][_0x141c('0x4b')]({'where':{'id':_0x21d201[_0x141c('0x56')]['id']}})[_0x141c('0x25')](function(_0x5f36c6){return db[_0x141c('0x6b')][_0x141c('0x6c')](function(_0x1b63cf){return _0x5f36c6['removeTeams'](_0x21d201['query'][_0x141c('0x64')],{'transaction':_0x1b63cf})[_0x141c('0x25')](function(){if(!_[_0x141c('0x82')](_0x454296)){return _0x5f36c6[_0x141c('0x83')](_0x454296,{'transaction':_0x1b63cf});}})['then'](function(){_0x454296[_0x141c('0x6d')](function(_0x302157){socket[_0x141c('0x6e')](_0x141c('0x84'),{'UserId':_0x302157,'OpenchannelQueueId':_0x5f36c6['id']});});});});});});})[_0x141c('0x25')](respondWithStatusCode(_0x3af237,null))[_0x141c('0x47')](handleError(_0x3af237,null));};exports[_0x141c('0x85')]=function(_0x44c768,_0x2c1900,_0x412ce9){return db[_0x141c('0x2f')][_0x141c('0x4b')]({'where':{'id':_0x44c768[_0x141c('0x56')]['id']}})[_0x141c('0x25')](handleEntityNotFound(_0x2c1900,null))[_0x141c('0x25')](function(_0x2e52f2){if(_0x2e52f2){return _0x2e52f2[_0x141c('0x85')](_0x44c768[_0x141c('0x4c')][_0x141c('0x64')],_['omit'](_0x44c768[_0x141c('0x4c')],[_0x141c('0x64'),'id'])||{})[_0x141c('0x86')](function(_0x1f4c9c){for(var _0x48d1cb=0x0;_0x48d1cb<_0x44c768[_0x141c('0x4c')][_0x141c('0x64')][_0x141c('0x4a')];_0x48d1cb+=0x1){socket[_0x141c('0x6e')](_0x141c('0x6f'),{'UserId':_0x44c768[_0x141c('0x4c')][_0x141c('0x64')][_0x48d1cb],'OpenchannelQueueId':_0x44c768[_0x141c('0x56')]['id']});}return _0x1f4c9c;});}})[_0x141c('0x25')](respondWithResult(_0x2c1900,null))[_0x141c('0x47')](handleError(_0x2c1900,null));};exports[_0x141c('0x83')]=function(_0x445240,_0x1303a2,_0x1a8398){return db[_0x141c('0x2f')][_0x141c('0x4b')]({'where':{'id':_0x445240[_0x141c('0x56')]['id']}})[_0x141c('0x25')](handleEntityNotFound(_0x1303a2,null))['then'](function(_0x17ca79){if(_0x17ca79){return _0x17ca79['removeAgents'](_0x445240[_0x141c('0x34')][_0x141c('0x64')])[_0x141c('0x25')](function(){if(_[_0x141c('0x87')](_0x445240[_0x141c('0x34')][_0x141c('0x64')])){for(var _0x2606bd=0x0;_0x2606bd<_0x445240[_0x141c('0x34')][_0x141c('0x64')]['length'];_0x2606bd+=0x1){socket[_0x141c('0x6e')](_0x141c('0x84'),{'UserId':Number(_0x445240[_0x141c('0x34')]['ids'][_0x2606bd]),'OpenchannelQueueId':Number(_0x445240[_0x141c('0x56')]['id'])});}}else{socket[_0x141c('0x6e')](_0x141c('0x84'),{'UserId':Number(_0x445240[_0x141c('0x34')][_0x141c('0x64')]),'OpenchannelQueueId':Number(_0x445240[_0x141c('0x56')]['id'])});}});}})[_0x141c('0x25')](respondWithStatusCode(_0x1303a2,null))[_0x141c('0x47')](handleError(_0x1303a2,null));};exports[_0x141c('0x88')]=function(_0x163f71,_0x1d802e,_0x102b9c){var _0x25e30d={};var _0x502ff6={};var _0x510f60;var _0x4ae838;return db['OpenchannelQueue'][_0x141c('0x59')]({'where':{'id':_0x163f71[_0x141c('0x56')]['id']}})[_0x141c('0x25')](handleEntityNotFound(_0x1d802e,null))[_0x141c('0x25')](function(_0x574b6f){if(_0x574b6f){_0x510f60=_0x574b6f;_0x502ff6[_0x141c('0x33')]=_['keys'](db[_0x141c('0x66')]['rawAttributes']);_0x502ff6['query']=_['keys'](_0x163f71['query']);_0x502ff6[_0x141c('0x3e')]=_[_0x141c('0x36')](_0x502ff6['model'],_0x502ff6[_0x141c('0x34')]);_0x25e30d[_0x141c('0x35')]=_[_0x141c('0x36')](_0x502ff6[_0x141c('0x33')],qs[_0x141c('0x37')](_0x163f71[_0x141c('0x34')]['fields']));_0x25e30d[_0x141c('0x35')]=_0x25e30d[_0x141c('0x35')]['length']?_0x25e30d[_0x141c('0x35')]:_0x502ff6[_0x141c('0x33')];_0x25e30d['order']=qs[_0x141c('0x3c')](_0x163f71[_0x141c('0x34')]['sort']);_0x25e30d['where']=qs[_0x141c('0x3e')](_[_0x141c('0x3f')](_0x163f71[_0x141c('0x34')],_0x502ff6[_0x141c('0x3e')]));if(_0x163f71[_0x141c('0x34')][_0x141c('0x5b')]){_0x25e30d['where']=_['merge'](_0x25e30d[_0x141c('0x3d')],{'$or':_[_0x141c('0x2e')](_0x25e30d[_0x141c('0x35')],function(_0x37fe04){var _0x18815d={};_0x18815d[_0x37fe04]={'$like':'%'+_0x163f71[_0x141c('0x34')]['filter']+'%'};return _0x18815d;})});}_0x25e30d=_[_0x141c('0x40')]({},_0x25e30d,_0x163f71[_0x141c('0x42')]);return _0x510f60[_0x141c('0x88')](_0x25e30d);}})[_0x141c('0x25')](function(_0x3a8a93){if(_0x3a8a93){_0x4ae838=_0x3a8a93[_0x141c('0x4a')];if(!_0x163f71[_0x141c('0x34')][_0x141c('0x38')](_0x141c('0x39'))){_0x25e30d[_0x141c('0x3a')]=qs[_0x141c('0x3a')](_0x163f71[_0x141c('0x34')]['limit']);_0x25e30d['offset']=qs[_0x141c('0x20')](_0x163f71[_0x141c('0x34')][_0x141c('0x20')]);}return _0x510f60[_0x141c('0x88')](_0x25e30d);}})['then'](function(_0x5b752b){if(_0x5b752b){return _0x5b752b?{'count':_0x4ae838,'rows':_0x5b752b}:null;}})['then'](respondWithResult(_0x1d802e,null))[_0x141c('0x47')](handleError(_0x1d802e,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 9995157..b9c9b98 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 _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 +var _0xe42c=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0x1238b4,_0x502ecb){var _0x1b61e2=function(_0x1ab529){while(--_0x1ab529){_0x1238b4['push'](_0x1238b4['shift']());}};_0x1b61e2(++_0x502ecb);}(_0xe42c,0x17f));var _0xce42=function(_0x124b11,_0xbf7eb8){_0x124b11=_0x124b11-0x0;var _0x1b7766=_0xe42c[_0x124b11];return _0x1b7766;};'use strict';var EventEmitter=require(_0xce42('0x0'));var OpenchannelQueue=require(_0xce42('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xce42('0x2')](0x0);var events={'afterCreate':_0xce42('0x3'),'afterUpdate':_0xce42('0x4'),'afterDestroy':_0xce42('0x5')};function emitEvent(_0x1ce311){return function(_0x485cfe,_0x46f2ca,_0x2ff21c){OpenchannelQueueEvents[_0xce42('0x6')](_0x1ce311+':'+_0x485cfe['id'],_0x485cfe);OpenchannelQueueEvents[_0xce42('0x6')](_0x1ce311,_0x485cfe);_0x2ff21c(null);};}for(var e in events){if(events[_0xce42('0x7')](e)){var event=events[e];OpenchannelQueue[_0xce42('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 13e114a..f7e85b3 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 _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 +var _0xe71e=['api','moment','request-promise','path','rimraf','./openchannelQueue.attributes','openchannel_queues','lodash','../../config/logger'];(function(_0x15d827,_0x3476c7){var _0x1875df=function(_0x2a4968){while(--_0x2a4968){_0x15d827['push'](_0x15d827['shift']());}};_0x1875df(++_0x3476c7);}(_0xe71e,0x103));var _0xee71=function(_0xf52322,_0x4e2427){_0xf52322=_0xf52322-0x0;var _0x528e53=_0xe71e[_0xf52322];return _0x528e53;};'use strict';var _=require(_0xee71('0x0'));var util=require('util');var logger=require(_0xee71('0x1'))(_0xee71('0x2'));var moment=require(_0xee71('0x3'));var BPromise=require('bluebird');var rp=require(_0xee71('0x4'));var fs=require('fs');var path=require(_0xee71('0x5'));var rimraf=require(_0xee71('0x6'));var config=require('../../config/environment');var attributes=require(_0xee71('0x7'));module['exports']=function(_0x58f350,_0xdcc84f){return _0x58f350['define']('OpenchannelQueue',attributes,{'tableName':_0xee71('0x8'),'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 c9e1bdb..563625b 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 _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 +var _0x40d3=['redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetOpenchannelQueue','findAll','options','where','attributes','limit','include','model','map','find','raw','ShowOpenchannelQueue','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xd20f67,_0x1e1be0){var _0x211f4f=function(_0x339239){while(--_0x339239){_0xd20f67['push'](_0xd20f67['shift']());}};_0x211f4f(++_0x1e1be0);}(_0x40d3,0x144));var _0x340d=function(_0x40f0c4,_0xacceb9){_0x40f0c4=_0x40f0c4-0x0;var _0x1aeaac=_0x40d3[_0x40f0c4];return _0x1aeaac;};'use strict';var _=require(_0x340d('0x0'));var util=require(_0x340d('0x1'));var moment=require(_0x340d('0x2'));var BPromise=require('bluebird');var rs=require(_0x340d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x340d('0x4'))['db'];var utils=require(_0x340d('0x5'));var logger=require(_0x340d('0x6'))(_0x340d('0x7'));var config=require(_0x340d('0x8'));var jayson=require(_0x340d('0x9'));var client=jayson[_0x340d('0xa')][_0x340d('0xb')]({'port':0x232a});config[_0x340d('0xc')]=_[_0x340d('0xd')](config[_0x340d('0xc')],{'host':_0x340d('0xe'),'port':0x18eb});var socket=require(_0x340d('0xf'))(new Redis(config[_0x340d('0xc')]));require(_0x340d('0x10'))[_0x340d('0x11')](socket);function respondWithRpcPromise(_0x561739,_0x1c7a22,_0x61a8c8){return new BPromise(function(_0x37ad42,_0x4bbf1a){return client[_0x340d('0x12')](_0x561739,_0x61a8c8)[_0x340d('0x13')](function(_0x56a53d){logger['info'](_0x340d('0x14'),_0x1c7a22,_0x340d('0x15'));logger[_0x340d('0x16')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x1c7a22,'request\x20sent',JSON[_0x340d('0x17')](_0x56a53d));if(_0x56a53d[_0x340d('0x18')]){if(_0x56a53d[_0x340d('0x18')][_0x340d('0x19')]===0x1f4){logger[_0x340d('0x18')](_0x340d('0x14'),_0x1c7a22,_0x56a53d[_0x340d('0x18')][_0x340d('0x1a')]);return _0x4bbf1a(_0x56a53d[_0x340d('0x18')][_0x340d('0x1a')]);}logger[_0x340d('0x18')](_0x340d('0x14'),_0x1c7a22,_0x56a53d[_0x340d('0x18')][_0x340d('0x1a')]);return _0x37ad42(_0x56a53d['error']['message']);}else{logger[_0x340d('0x1b')](_0x340d('0x14'),_0x1c7a22,'request\x20sent');_0x37ad42(_0x56a53d[_0x340d('0x1c')]['message']);}})[_0x340d('0x1d')](function(_0x5718ae){logger[_0x340d('0x18')](_0x340d('0x14'),_0x1c7a22,_0x5718ae);_0x4bbf1a(_0x5718ae);});});}exports[_0x340d('0x1e')]=function(_0x45dede){var _0x177c04=this;return new Promise(function(_0x32cd28,_0x168334){return db['OpenchannelQueue'][_0x340d('0x1f')]({'raw':_0x45dede[_0x340d('0x20')]?_0x45dede[_0x340d('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x45dede[_0x340d('0x20')]?_0x45dede['options'][_0x340d('0x21')]||null:null,'attributes':_0x45dede[_0x340d('0x20')]?_0x45dede[_0x340d('0x20')][_0x340d('0x22')]||null:null,'limit':_0x45dede[_0x340d('0x20')]?_0x45dede['options'][_0x340d('0x23')]||null:null,'include':_0x45dede[_0x340d('0x20')]?_0x45dede[_0x340d('0x20')][_0x340d('0x24')]?_['map'](_0x45dede[_0x340d('0x20')][_0x340d('0x24')],function(_0x3fe430){return{'model':db[_0x3fe430[_0x340d('0x25')]],'as':_0x3fe430['as'],'attributes':_0x3fe430[_0x340d('0x22')],'include':_0x3fe430[_0x340d('0x24')]?_[_0x340d('0x26')](_0x3fe430[_0x340d('0x24')],function(_0x495a70){return{'model':db[_0x495a70[_0x340d('0x25')]],'as':_0x495a70['as'],'attributes':_0x495a70[_0x340d('0x22')],'include':_0x495a70[_0x340d('0x24')]?_[_0x340d('0x26')](_0x495a70[_0x340d('0x24')],function(_0x1e26af){return{'model':db[_0x1e26af[_0x340d('0x25')]],'as':_0x1e26af['as'],'attributes':_0x1e26af[_0x340d('0x22')]};}):[]};}):[]};}):[]:[]})[_0x340d('0x13')](function(_0x1e0a6a){logger['info'](_0x340d('0x1e'),_0x45dede);logger[_0x340d('0x16')](_0x340d('0x1e'),_0x45dede,JSON[_0x340d('0x17')](_0x1e0a6a));_0x32cd28(_0x1e0a6a);})[_0x340d('0x1d')](function(_0x9f2bb6){logger[_0x340d('0x18')](_0x340d('0x1e'),_0x9f2bb6['message'],_0x45dede);_0x168334(_0x177c04[_0x340d('0x18')](0x1f4,_0x9f2bb6[_0x340d('0x1a')]));});});};exports['ShowOpenchannelQueue']=function(_0x17505a){var _0x2c6df1=this;return new Promise(function(_0x4fda65,_0x194805){return db['OpenchannelQueue'][_0x340d('0x27')]({'raw':_0x17505a[_0x340d('0x20')]?_0x17505a[_0x340d('0x20')][_0x340d('0x28')]===undefined?!![]:![]:!![],'where':_0x17505a['options']?_0x17505a[_0x340d('0x20')][_0x340d('0x21')]||null:null,'attributes':_0x17505a[_0x340d('0x20')]?_0x17505a[_0x340d('0x20')][_0x340d('0x22')]||null:null,'include':_0x17505a[_0x340d('0x20')]?_0x17505a[_0x340d('0x20')][_0x340d('0x24')]?_[_0x340d('0x26')](_0x17505a[_0x340d('0x20')][_0x340d('0x24')],function(_0x2ab98f){return{'model':db[_0x2ab98f[_0x340d('0x25')]],'as':_0x2ab98f['as'],'attributes':_0x2ab98f[_0x340d('0x22')],'include':_0x2ab98f['include']?_[_0x340d('0x26')](_0x2ab98f[_0x340d('0x24')],function(_0x140ac2){return{'model':db[_0x140ac2[_0x340d('0x25')]],'as':_0x140ac2['as'],'attributes':_0x140ac2[_0x340d('0x22')],'include':_0x140ac2['include']?_[_0x340d('0x26')](_0x140ac2[_0x340d('0x24')],function(_0x15b855){return{'model':db[_0x15b855[_0x340d('0x25')]],'as':_0x15b855['as'],'attributes':_0x15b855[_0x340d('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x22dae5){logger[_0x340d('0x1b')](_0x340d('0x29'),_0x17505a);logger['debug'](_0x340d('0x29'),_0x17505a,JSON[_0x340d('0x17')](_0x22dae5));_0x4fda65(_0x22dae5);})['catch'](function(_0x23511f){logger[_0x340d('0x18')]('ShowOpenchannelQueue',_0x23511f['message'],_0x17505a);_0x194805(_0x2c6df1[_0x340d('0x18')](0x1f4,_0x23511f['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index c77106b..b8004d0 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 _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 +var _0x194f=['length','openchannelQueue:','./openchannelQueue.events','remove','emit','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x194f,0x164));var _0xf194=function(_0x314414,_0x578618){_0x314414=_0x314414-0x0;var _0x586ae8=_0x194f[_0x314414];return _0x586ae8;};'use strict';var OpenchannelQueueEvents=require(_0xf194('0x0'));var events=['save',_0xf194('0x1'),'update'];function createListener(_0x3efa2b,_0x5de10c){return function(_0x4c1be6){_0x5de10c[_0xf194('0x2')](_0x3efa2b,_0x4c1be6);};}function removeListener(_0x320aa9,_0x5d5b73){return function(){OpenchannelQueueEvents['removeListener'](_0x320aa9,_0x5d5b73);};}exports[_0xf194('0x3')]=function(_0x632cb7){for(var _0x513d43=0x0,_0x5b65e3=events[_0xf194('0x4')];_0x513d43<_0x5b65e3;_0x513d43++){var _0x1d0de5=events[_0x513d43];var _0x354319=createListener(_0xf194('0x5')+_0x1d0de5,_0x632cb7);OpenchannelQueueEvents['on'](_0x1d0de5,_0x354319);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 16862e0..59c009a 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 _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 +var _0x8a48=['show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','/describe','describe','/:id'];(function(_0xf80b3,_0x25d5f3){var _0x10c489=function(_0x3c5aee){while(--_0x3c5aee){_0xf80b3['push'](_0xf80b3['shift']());}};_0x10c489(++_0x25d5f3);}(_0x8a48,0x171));var _0x88a4=function(_0x46ffe2,_0x46c452){_0x46ffe2=_0x46ffe2-0x0;var _0x5b6ebe=_0x8a48[_0x46ffe2];return _0x5b6ebe;};'use strict';var multer=require(_0x88a4('0x0'));var util=require('util');var path=require(_0x88a4('0x1'));var timeout=require(_0x88a4('0x2'));var express=require(_0x88a4('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x88a4('0x4'));var config=require(_0x88a4('0x5'));var controller=require(_0x88a4('0x6'));router['get']('/',auth[_0x88a4('0x7')](),controller['index']);router['get'](_0x88a4('0x8'),auth[_0x88a4('0x7')](),controller[_0x88a4('0x9')]);router['get'](_0x88a4('0xa'),auth[_0x88a4('0x7')](),controller[_0x88a4('0xb')]);router[_0x88a4('0xc')]('/',auth[_0x88a4('0x7')](),controller[_0x88a4('0xd')]);router[_0x88a4('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x88a4('0xf')]);router[_0x88a4('0x10')](_0x88a4('0xa'),auth['isAuthenticated'](),controller[_0x88a4('0x11')]);module[_0x88a4('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 3b7c199..1029b3e 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 _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 +var _0xa9d3=['STRING','DATE','moment'];(function(_0x3b154c,_0xeb1aba){var _0x5f4488=function(_0x59c1c1){while(--_0x59c1c1){_0x3b154c['push'](_0x3b154c['shift']());}};_0x5f4488(++_0xeb1aba);}(_0xa9d3,0xad));var _0x3a9d=function(_0x406eed,_0xca9500){_0x406eed=_0x406eed-0x0;var _0x3ef1fc=_0xa9d3[_0x406eed];return _0x3ef1fc;};'use strict';var moment=require(_0x3a9d('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x3a9d('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x3a9d('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x3a9d('0x2')]},'exitAt':{'type':Sequelize[_0x3a9d('0x2')]},'reason':{'type':Sequelize[_0x3a9d('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 9b96e6f..cafdeba 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 _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 +var _0x05d0=['error','stack','name','send','index','OpenchannelQueueReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','find','create','body','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','update','then'];(function(_0x5c5d46,_0x56794c){var _0x2de47d=function(_0x532d39){while(--_0x532d39){_0x5c5d46['push'](_0x5c5d46['shift']());}};_0x2de47d(++_0x56794c);}(_0x05d0,0x101));var _0x005d=function(_0x1fa18d,_0x2dc169){_0x1fa18d=_0x1fa18d-0x0;var _0x5934a6=_0x05d0[_0x1fa18d];return _0x5934a6;};'use strict';var pdf=require(_0x005d('0x0'));var emlformat=require(_0x005d('0x1'));var rimraf=require(_0x005d('0x2'));var zipdir=require(_0x005d('0x3'));var jsonpatch=require(_0x005d('0x4'));var rp=require(_0x005d('0x5'));var moment=require(_0x005d('0x6'));var BPromise=require(_0x005d('0x7'));var Mustache=require(_0x005d('0x8'));var util=require('util');var path=require(_0x005d('0x9'));var sox=require(_0x005d('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x005d('0xb'));var squel=require(_0x005d('0xc'));var crypto=require('crypto');var jsforce=require(_0x005d('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x005d('0xe'));var Papa=require(_0x005d('0xf'));var Redis=require('ioredis');var authService=require(_0x005d('0x10'));var qs=require(_0x005d('0x11'));var as=require(_0x005d('0x12'));var hardwareService=require(_0x005d('0x13'));var logger=require(_0x005d('0x14'))(_0x005d('0x15'));var utils=require(_0x005d('0x16'));var config=require('../../config/environment');var db=require(_0x005d('0x17'))['db'];function respondWithStatusCode(_0x2bbc4a,_0x490c15){_0x490c15=_0x490c15||0xcc;return function(_0x3be168){if(_0x3be168){return _0x2bbc4a[_0x005d('0x18')](_0x490c15);}return _0x2bbc4a[_0x005d('0x19')](_0x490c15)['end']();};}function respondWithResult(_0x3bdfd6,_0x30e3d2){_0x30e3d2=_0x30e3d2||0xc8;return function(_0x1705a3){if(_0x1705a3){return _0x3bdfd6[_0x005d('0x19')](_0x30e3d2)[_0x005d('0x1a')](_0x1705a3);}};}function respondWithFilteredResult(_0x5b79e2,_0xb2fd54){return function(_0x5595b5){if(_0x5595b5){var _0x2dd11e=_0x5595b5[_0x005d('0x1b')],_0x3ed459=_0xb2fd54[_0x005d('0x1c')],_0x35571d=_0xb2fd54['offset']+_0xb2fd54[_0x005d('0x1d')],_0xd0fbf4;if(_0x35571d>=_0x2dd11e){_0x35571d=_0x2dd11e;_0xd0fbf4=0xc8;}else{_0xd0fbf4=0xce;}_0x5b79e2[_0x005d('0x19')](_0xd0fbf4);return _0x5b79e2['set'](_0x005d('0x1e'),_0x3ed459+'-'+_0x35571d+'/'+_0x2dd11e)['json'](_0x5595b5);}return null;};}function patchUpdates(_0x1c2c54){return function(_0x52e0f2){try{jsonpatch['apply'](_0x52e0f2,_0x1c2c54,!![]);}catch(_0x11d0f3){return BPromise[_0x005d('0x1f')](_0x11d0f3);}return _0x52e0f2[_0x005d('0x20')]();};}function saveUpdates(_0x323682,_0x458537){return function(_0x38aba2){if(_0x38aba2){return _0x38aba2[_0x005d('0x21')](_0x323682)[_0x005d('0x22')](function(_0x1b988d){return _0x1b988d;});}return null;};}function removeEntity(_0x511329,_0x24196c){return function(_0x510cf3){if(_0x510cf3){return _0x510cf3['destroy']()[_0x005d('0x22')](function(){_0x511329[_0x005d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53d2b1,_0x484ad4){return function(_0x50d76f){if(!_0x50d76f){_0x53d2b1[_0x005d('0x18')](0x194);}return _0x50d76f;};}function handleError(_0x24161b,_0x31bc21){_0x31bc21=_0x31bc21||0x1f4;return function(_0x432cca){logger[_0x005d('0x23')](_0x432cca[_0x005d('0x24')]);if(_0x432cca[_0x005d('0x25')]){delete _0x432cca[_0x005d('0x25')];}_0x24161b[_0x005d('0x19')](_0x31bc21)[_0x005d('0x26')](_0x432cca);};}exports[_0x005d('0x27')]=function(_0x3eac08,_0x26c748){var _0x25d536={},_0x596892={},_0x135477={'count':0x0,'rows':[]};var _0x39554a=_['map'](db[_0x005d('0x28')][_0x005d('0x29')],function(_0x3046c3){return{'name':_0x3046c3[_0x005d('0x2a')],'type':_0x3046c3[_0x005d('0x2b')]['key']};});_0x596892[_0x005d('0x2c')]=_[_0x005d('0x2d')](_0x39554a,_0x005d('0x25'));_0x596892[_0x005d('0x2e')]=_[_0x005d('0x2f')](_0x3eac08[_0x005d('0x2e')]);_0x596892[_0x005d('0x30')]=_['intersection'](_0x596892[_0x005d('0x2c')],_0x596892[_0x005d('0x2e')]);_0x25d536['attributes']=_[_0x005d('0x31')](_0x596892[_0x005d('0x2c')],qs[_0x005d('0x32')](_0x3eac08[_0x005d('0x2e')][_0x005d('0x32')]));_0x25d536[_0x005d('0x33')]=_0x25d536[_0x005d('0x33')][_0x005d('0x34')]?_0x25d536['attributes']:_0x596892[_0x005d('0x2c')];if(!_0x3eac08[_0x005d('0x2e')][_0x005d('0x35')](_0x005d('0x36'))){_0x25d536[_0x005d('0x1d')]=qs['limit'](_0x3eac08[_0x005d('0x2e')][_0x005d('0x1d')]);_0x25d536[_0x005d('0x1c')]=qs['offset'](_0x3eac08[_0x005d('0x2e')][_0x005d('0x1c')]);}_0x25d536[_0x005d('0x37')]=qs[_0x005d('0x38')](_0x3eac08[_0x005d('0x2e')][_0x005d('0x38')]);_0x25d536[_0x005d('0x39')]=qs[_0x005d('0x30')](_[_0x005d('0x3a')](_0x3eac08[_0x005d('0x2e')],_0x596892[_0x005d('0x30')]),_0x39554a);if(_0x3eac08['query'][_0x005d('0x3b')]){_0x25d536[_0x005d('0x39')]=_[_0x005d('0x3c')](_0x25d536[_0x005d('0x39')],{'$or':_[_0x005d('0x2d')](_0x39554a,function(_0x28914d){if(_0x28914d['type']!=='VIRTUAL'){var _0x4e3ef5={};_0x4e3ef5[_0x28914d['name']]={'$like':'%'+_0x3eac08[_0x005d('0x2e')][_0x005d('0x3b')]+'%'};return _0x4e3ef5;}})});}_0x25d536=_['merge']({},_0x25d536,_0x3eac08[_0x005d('0x3d')]);var _0x1bd8b6={'where':_0x25d536[_0x005d('0x39')]};return db[_0x005d('0x28')][_0x005d('0x1b')](_0x1bd8b6)['then'](function(_0xa96b96){_0x135477[_0x005d('0x1b')]=_0xa96b96;if(_0x3eac08[_0x005d('0x2e')][_0x005d('0x3e')]){_0x25d536[_0x005d('0x3f')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x005d('0x40')](_0x25d536);})[_0x005d('0x22')](function(_0x18485a){_0x135477[_0x005d('0x41')]=_0x18485a;return _0x135477;})[_0x005d('0x22')](respondWithFilteredResult(_0x26c748,_0x25d536))[_0x005d('0x42')](handleError(_0x26c748,null));};exports['show']=function(_0x301bbd,_0x1096d1){var _0x2cfeb5={'raw':!![],'where':{'id':_0x301bbd['params']['id']}},_0x26d235={};_0x26d235[_0x005d('0x2c')]=_[_0x005d('0x2f')](db[_0x005d('0x28')]['rawAttributes']);_0x26d235[_0x005d('0x2e')]=_[_0x005d('0x2f')](_0x301bbd[_0x005d('0x2e')]);_0x26d235[_0x005d('0x30')]=_[_0x005d('0x31')](_0x26d235['model'],_0x26d235[_0x005d('0x2e')]);_0x2cfeb5[_0x005d('0x33')]=_[_0x005d('0x31')](_0x26d235[_0x005d('0x2c')],qs[_0x005d('0x32')](_0x301bbd[_0x005d('0x2e')][_0x005d('0x32')]));_0x2cfeb5[_0x005d('0x33')]=_0x2cfeb5[_0x005d('0x33')][_0x005d('0x34')]?_0x2cfeb5[_0x005d('0x33')]:_0x26d235[_0x005d('0x2c')];if(_0x301bbd[_0x005d('0x2e')][_0x005d('0x3e')]){_0x2cfeb5[_0x005d('0x3f')]=[{'all':!![]}];}_0x2cfeb5=_['merge']({},_0x2cfeb5,_0x301bbd['options']);return db[_0x005d('0x28')][_0x005d('0x43')](_0x2cfeb5)[_0x005d('0x22')](handleEntityNotFound(_0x1096d1,null))['then'](respondWithResult(_0x1096d1,null))[_0x005d('0x42')](handleError(_0x1096d1,null));};exports[_0x005d('0x44')]=function(_0x45b7f3,_0x4c895b){return db['OpenchannelQueueReport']['create'](_0x45b7f3[_0x005d('0x45')],{})[_0x005d('0x22')](respondWithResult(_0x4c895b,0xc9))[_0x005d('0x42')](handleError(_0x4c895b,null));};exports[_0x005d('0x21')]=function(_0x53ed02,_0x55c5ba){if(_0x53ed02[_0x005d('0x45')]['id']){delete _0x53ed02[_0x005d('0x45')]['id'];}return db['OpenchannelQueueReport'][_0x005d('0x43')]({'where':{'id':_0x53ed02[_0x005d('0x46')]['id']}})[_0x005d('0x22')](handleEntityNotFound(_0x55c5ba,null))[_0x005d('0x22')](saveUpdates(_0x53ed02[_0x005d('0x45')],null))[_0x005d('0x22')](respondWithResult(_0x55c5ba,null))[_0x005d('0x42')](handleError(_0x55c5ba,null));};exports[_0x005d('0x47')]=function(_0x3e3e30,_0x5ccb13){return db[_0x005d('0x28')][_0x005d('0x43')]({'where':{'id':_0x3e3e30[_0x005d('0x46')]['id']}})[_0x005d('0x22')](handleEntityNotFound(_0x5ccb13,null))['then'](removeEntity(_0x5ccb13,null))['catch'](handleError(_0x5ccb13,null));};exports[_0x005d('0x48')]=function(_0x3f7376,_0x2da8d9){return db['OpenchannelQueueReport'][_0x005d('0x48')]()[_0x005d('0x22')](respondWithResult(_0x2da8d9,null))['catch'](handleError(_0x2da8d9,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index c2df965..9a8754d 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 _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 +var _0xd28c=['moment','bluebird','request-promise','path','rimraf','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','util','../../config/logger','api'];(function(_0x546aaf,_0x1ed138){var _0x1cbf6d=function(_0x36c837){while(--_0x36c837){_0x546aaf['push'](_0x546aaf['shift']());}};_0x1cbf6d(++_0x1ed138);}(_0xd28c,0x72));var _0xcd28=function(_0x3eeb72,_0x2956ba){_0x3eeb72=_0x3eeb72-0x0;var _0x1d2261=_0xd28c[_0x3eeb72];return _0x1d2261;};'use strict';var _=require('lodash');var util=require(_0xcd28('0x0'));var logger=require(_0xcd28('0x1'))(_0xcd28('0x2'));var moment=require(_0xcd28('0x3'));var BPromise=require(_0xcd28('0x4'));var rp=require(_0xcd28('0x5'));var fs=require('fs');var path=require(_0xcd28('0x6'));var rimraf=require(_0xcd28('0x7'));var config=require('../../config/environment');var attributes=require(_0xcd28('0x8'));module[_0xcd28('0x9')]=function(_0x4ddfda,_0x71e64a){return _0x4ddfda[_0xcd28('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0xcd28('0xb'),'paranoid':![],'indexes':[{'name':_0xcd28('0xc'),'fields':[_0xcd28('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 d15b49a..379675f 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 _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 +var _0xc6ac=['http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','stringify','catch','update','where','attributes','UpdateOpenchannelQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2ccfe2,_0x5c4561){var _0x3bbfca=function(_0x34a9be){while(--_0x34a9be){_0x2ccfe2['push'](_0x2ccfe2['shift']());}};_0x3bbfca(++_0x5c4561);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x3e6db9,_0x51d66c){_0x3e6db9=_0x3e6db9-0x0;var _0x24ad42=_0xc6ac[_0x3e6db9];return _0x24ad42;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});}exports[_0xcc6a('0x18')]=function(_0x33079c){var _0x12ef33=this;return new Promise(function(_0x2d9585,_0x412bc7){return db[_0xcc6a('0x19')][_0xcc6a('0x1a')](_0x33079c[_0xcc6a('0x1b')],{'raw':_0x33079c['options']?_0x33079c[_0xcc6a('0x1c')][_0xcc6a('0x1d')]===undefined?!![]:![]:!![]})[_0xcc6a('0xf')](function(_0x368a6e){logger[_0xcc6a('0x10')](_0xcc6a('0x18'),_0x33079c);logger[_0xcc6a('0x12')](_0xcc6a('0x18'),_0x33079c,JSON[_0xcc6a('0x1e')](_0x368a6e));_0x2d9585(_0x368a6e);})[_0xcc6a('0x1f')](function(_0x329d17){logger[_0xcc6a('0x15')]('CreateOpenchannelQueueReport',_0x329d17[_0xcc6a('0x17')],_0x33079c);_0x412bc7(_0x12ef33[_0xcc6a('0x15')](0x1f4,_0x329d17[_0xcc6a('0x17')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x10016a){var _0x294486=this;return new Promise(function(_0x3a00e5,_0x3ed7ce){return db[_0xcc6a('0x19')][_0xcc6a('0x20')](_0x10016a['body'],{'raw':_0x10016a[_0xcc6a('0x1c')]?_0x10016a[_0xcc6a('0x1c')][_0xcc6a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10016a['options']?_0x10016a[_0xcc6a('0x1c')][_0xcc6a('0x21')]||null:null,'attributes':_0x10016a['options']?_0x10016a[_0xcc6a('0x1c')][_0xcc6a('0x22')]||null:null,'limit':_0x10016a[_0xcc6a('0x1c')]?_0x10016a[_0xcc6a('0x1c')]['limit']||null:null})[_0xcc6a('0xf')](function(_0x3cf14c){logger[_0xcc6a('0x10')]('UpdateOpenchannelQueueReport',_0x10016a);logger[_0xcc6a('0x12')]('UpdateOpenchannelQueueReport',_0x10016a,JSON['stringify'](_0x3cf14c));_0x3a00e5(_0x3cf14c);})[_0xcc6a('0x1f')](function(_0x2e9f41){logger[_0xcc6a('0x15')](_0xcc6a('0x23'),_0x2e9f41[_0xcc6a('0x17')],_0x10016a);_0x3ed7ce(_0x294486[_0xcc6a('0x15')](0x1f4,_0x2e9f41['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index babc988..c626ef9 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(_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 +var _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x420b24,_0x382adc){var _0x4da552=function(_0x4e1623){while(--_0x4e1623){_0x420b24['push'](_0x420b24['shift']());}};_0x4da552(++_0x382adc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 46d11c6..49717b4 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 _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 +var _0x4680=['account','queue','DATE','NOW','moment','sequelize','STRING','ENUM'];(function(_0x8b8564,_0x162976){var _0x360c61=function(_0x164cc9){while(--_0x164cc9){_0x8b8564['push'](_0x8b8564['shift']());}};_0x360c61(++_0x162976);}(_0x4680,0xc4));var _0x0468=function(_0x3a190,_0xa45a01){_0x3a190=_0x3a190-0x0;var _0x233687=_0x4680[_0x3a190];return _0x233687;};'use strict';var moment=require(_0x0468('0x0'));var Sequelize=require(_0x0468('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x0468('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0468('0x3')](_0x0468('0x4'),'agent',_0x0468('0x5')),'allowNull':![],'defaultValue':_0x0468('0x5')},'transferredAt':{'type':Sequelize[_0x0468('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x0468('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 739e8cc..3d58c67 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 _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 +var _0xeb30=['filters','model','intersection','fields','attributes','length','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','find','body','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','query','keys'];(function(_0x2ecff3,_0x38b472){var _0x38b67e=function(_0x227206){while(--_0x227206){_0x2ecff3['push'](_0x2ecff3['shift']());}};_0x38b67e(++_0x38b472);}(_0xeb30,0xb0));var _0x0eb3=function(_0x8a0ba2,_0x14e3ce){_0x8a0ba2=_0x8a0ba2-0x0;var _0x5d6c97=_0xeb30[_0x8a0ba2];return _0x5d6c97;};'use strict';var pdf=require(_0x0eb3('0x0'));var emlformat=require(_0x0eb3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0eb3('0x2'));var jsonpatch=require(_0x0eb3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0eb3('0x4'));var Mustache=require('mustache');var util=require(_0x0eb3('0x5'));var path=require(_0x0eb3('0x6'));var sox=require(_0x0eb3('0x7'));var csv=require(_0x0eb3('0x8'));var ejs=require(_0x0eb3('0x9'));var fs=require('fs');var _=require(_0x0eb3('0xa'));var squel=require(_0x0eb3('0xb'));var crypto=require(_0x0eb3('0xc'));var jsforce=require(_0x0eb3('0xd'));var deskjs=require(_0x0eb3('0xe'));var toCsv=require(_0x0eb3('0x8'));var querystring=require('querystring');var Papa=require(_0x0eb3('0xf'));var Redis=require(_0x0eb3('0x10'));var authService=require(_0x0eb3('0x11'));var qs=require(_0x0eb3('0x12'));var as=require(_0x0eb3('0x13'));var hardwareService=require(_0x0eb3('0x14'));var logger=require('../../config/logger')(_0x0eb3('0x15'));var utils=require(_0x0eb3('0x16'));var config=require(_0x0eb3('0x17'));var db=require(_0x0eb3('0x18'))['db'];function respondWithStatusCode(_0x5b213b,_0x586bbc){_0x586bbc=_0x586bbc||0xcc;return function(_0x449d71){if(_0x449d71){return _0x5b213b[_0x0eb3('0x19')](_0x586bbc);}return _0x5b213b[_0x0eb3('0x1a')](_0x586bbc)[_0x0eb3('0x1b')]();};}function respondWithResult(_0x284e1f,_0x16d1ed){_0x16d1ed=_0x16d1ed||0xc8;return function(_0x5dee5d){if(_0x5dee5d){return _0x284e1f[_0x0eb3('0x1a')](_0x16d1ed)[_0x0eb3('0x1c')](_0x5dee5d);}};}function respondWithFilteredResult(_0x3fb588,_0x1141bd){return function(_0x2aae53){if(_0x2aae53){var _0x460075=_0x2aae53[_0x0eb3('0x1d')],_0x11d92c=_0x1141bd[_0x0eb3('0x1e')],_0x16712c=_0x1141bd[_0x0eb3('0x1e')]+_0x1141bd['limit'],_0x54e01d;if(_0x16712c>=_0x460075){_0x16712c=_0x460075;_0x54e01d=0xc8;}else{_0x54e01d=0xce;}_0x3fb588[_0x0eb3('0x1a')](_0x54e01d);return _0x3fb588[_0x0eb3('0x1f')](_0x0eb3('0x20'),_0x11d92c+'-'+_0x16712c+'/'+_0x460075)[_0x0eb3('0x1c')](_0x2aae53);}return null;};}function patchUpdates(_0x5c5507){return function(_0x1812a7){try{jsonpatch['apply'](_0x1812a7,_0x5c5507,!![]);}catch(_0x4cc136){return BPromise[_0x0eb3('0x21')](_0x4cc136);}return _0x1812a7[_0x0eb3('0x22')]();};}function saveUpdates(_0x535a47,_0x2a29fe){return function(_0x1b3d45){if(_0x1b3d45){return _0x1b3d45[_0x0eb3('0x23')](_0x535a47)[_0x0eb3('0x24')](function(_0x5f2d21){return _0x5f2d21;});}return null;};}function removeEntity(_0x3edd30,_0x141072){return function(_0x3d78b9){if(_0x3d78b9){return _0x3d78b9['destroy']()[_0x0eb3('0x24')](function(){_0x3edd30[_0x0eb3('0x1a')](0xcc)[_0x0eb3('0x1b')]();});}};}function handleEntityNotFound(_0x3f1499,_0xf4fe17){return function(_0x821941){if(!_0x821941){_0x3f1499['sendStatus'](0x194);}return _0x821941;};}function handleError(_0x55f9fc,_0x19093c){_0x19093c=_0x19093c||0x1f4;return function(_0x3a4c50){logger['error'](_0x3a4c50[_0x0eb3('0x25')]);if(_0x3a4c50[_0x0eb3('0x26')]){delete _0x3a4c50[_0x0eb3('0x26')];}_0x55f9fc[_0x0eb3('0x1a')](_0x19093c)[_0x0eb3('0x27')](_0x3a4c50);};}exports[_0x0eb3('0x28')]=function(_0x208831,_0x62d6d3){var _0x4ff7b={},_0x28f640={},_0x1b6b7f={'count':0x0,'rows':[]};var _0x479262=_[_0x0eb3('0x29')](db[_0x0eb3('0x2a')][_0x0eb3('0x2b')],function(_0x4d2829){return{'name':_0x4d2829[_0x0eb3('0x2c')],'type':_0x4d2829[_0x0eb3('0x2d')][_0x0eb3('0x2e')]};});_0x28f640['model']=_[_0x0eb3('0x29')](_0x479262,'name');_0x28f640[_0x0eb3('0x2f')]=_[_0x0eb3('0x30')](_0x208831[_0x0eb3('0x2f')]);_0x28f640[_0x0eb3('0x31')]=_['intersection'](_0x28f640[_0x0eb3('0x32')],_0x28f640[_0x0eb3('0x2f')]);_0x4ff7b['attributes']=_[_0x0eb3('0x33')](_0x28f640['model'],qs[_0x0eb3('0x34')](_0x208831['query']['fields']));_0x4ff7b[_0x0eb3('0x35')]=_0x4ff7b[_0x0eb3('0x35')][_0x0eb3('0x36')]?_0x4ff7b[_0x0eb3('0x35')]:_0x28f640[_0x0eb3('0x32')];if(!_0x208831[_0x0eb3('0x2f')]['hasOwnProperty'](_0x0eb3('0x37'))){_0x4ff7b[_0x0eb3('0x38')]=qs[_0x0eb3('0x38')](_0x208831[_0x0eb3('0x2f')][_0x0eb3('0x38')]);_0x4ff7b['offset']=qs[_0x0eb3('0x1e')](_0x208831[_0x0eb3('0x2f')][_0x0eb3('0x1e')]);}_0x4ff7b[_0x0eb3('0x39')]=qs[_0x0eb3('0x3a')](_0x208831[_0x0eb3('0x2f')][_0x0eb3('0x3a')]);_0x4ff7b['where']=qs[_0x0eb3('0x31')](_[_0x0eb3('0x3b')](_0x208831[_0x0eb3('0x2f')],_0x28f640[_0x0eb3('0x31')]),_0x479262);if(_0x208831[_0x0eb3('0x2f')][_0x0eb3('0x3c')]){_0x4ff7b[_0x0eb3('0x3d')]=_['merge'](_0x4ff7b[_0x0eb3('0x3d')],{'$or':_['map'](_0x479262,function(_0x219ca3){if(_0x219ca3[_0x0eb3('0x2d')]!==_0x0eb3('0x3e')){var _0x4c891f={};_0x4c891f[_0x219ca3['name']]={'$like':'%'+_0x208831[_0x0eb3('0x2f')][_0x0eb3('0x3c')]+'%'};return _0x4c891f;}})});}_0x4ff7b=_[_0x0eb3('0x3f')]({},_0x4ff7b,_0x208831[_0x0eb3('0x40')]);var _0x2f80a8={'where':_0x4ff7b[_0x0eb3('0x3d')]};return db['OpenchannelTransferReport']['count'](_0x2f80a8)[_0x0eb3('0x24')](function(_0x2f2e2e){_0x1b6b7f['count']=_0x2f2e2e;if(_0x208831[_0x0eb3('0x2f')]['includeAll']){_0x4ff7b[_0x0eb3('0x41')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x0eb3('0x42')](_0x4ff7b);})['then'](function(_0x26a9db){_0x1b6b7f[_0x0eb3('0x43')]=_0x26a9db;return _0x1b6b7f;})['then'](respondWithFilteredResult(_0x62d6d3,_0x4ff7b))[_0x0eb3('0x44')](handleError(_0x62d6d3,null));};exports[_0x0eb3('0x45')]=function(_0x11367b,_0x36c9ca){var _0xfe3a4={'raw':!![],'where':{'id':_0x11367b[_0x0eb3('0x46')]['id']}},_0x43b25c={};_0x43b25c[_0x0eb3('0x32')]=_[_0x0eb3('0x30')](db['OpenchannelTransferReport'][_0x0eb3('0x2b')]);_0x43b25c[_0x0eb3('0x2f')]=_[_0x0eb3('0x30')](_0x11367b[_0x0eb3('0x2f')]);_0x43b25c[_0x0eb3('0x31')]=_[_0x0eb3('0x33')](_0x43b25c[_0x0eb3('0x32')],_0x43b25c[_0x0eb3('0x2f')]);_0xfe3a4[_0x0eb3('0x35')]=_[_0x0eb3('0x33')](_0x43b25c['model'],qs[_0x0eb3('0x34')](_0x11367b[_0x0eb3('0x2f')][_0x0eb3('0x34')]));_0xfe3a4[_0x0eb3('0x35')]=_0xfe3a4[_0x0eb3('0x35')][_0x0eb3('0x36')]?_0xfe3a4[_0x0eb3('0x35')]:_0x43b25c['model'];if(_0x11367b[_0x0eb3('0x2f')]['includeAll']){_0xfe3a4[_0x0eb3('0x41')]=[{'all':!![]}];}_0xfe3a4=_[_0x0eb3('0x3f')]({},_0xfe3a4,_0x11367b[_0x0eb3('0x40')]);return db[_0x0eb3('0x2a')][_0x0eb3('0x47')](_0xfe3a4)[_0x0eb3('0x24')](handleEntityNotFound(_0x36c9ca,null))['then'](respondWithResult(_0x36c9ca,null))[_0x0eb3('0x44')](handleError(_0x36c9ca,null));};exports['create']=function(_0x3879ea,_0x42b9a9){return db[_0x0eb3('0x2a')]['create'](_0x3879ea['body'],{})[_0x0eb3('0x24')](respondWithResult(_0x42b9a9,0xc9))[_0x0eb3('0x44')](handleError(_0x42b9a9,null));};exports[_0x0eb3('0x23')]=function(_0x19019e,_0x4a85a9){if(_0x19019e[_0x0eb3('0x48')]['id']){delete _0x19019e['body']['id'];}return db[_0x0eb3('0x2a')][_0x0eb3('0x47')]({'where':{'id':_0x19019e[_0x0eb3('0x46')]['id']}})[_0x0eb3('0x24')](handleEntityNotFound(_0x4a85a9,null))[_0x0eb3('0x24')](saveUpdates(_0x19019e['body'],null))[_0x0eb3('0x24')](respondWithResult(_0x4a85a9,null))['catch'](handleError(_0x4a85a9,null));};exports[_0x0eb3('0x49')]=function(_0x4a7434,_0xea297){return db[_0x0eb3('0x2a')][_0x0eb3('0x47')]({'where':{'id':_0x4a7434[_0x0eb3('0x46')]['id']}})['then'](handleEntityNotFound(_0xea297,null))['then'](removeEntity(_0xea297,null))[_0x0eb3('0x44')](handleError(_0xea297,null));};exports[_0x0eb3('0x4a')]=function(_0x5d6465,_0x310332){return db[_0x0eb3('0x2a')]['describe']()['then'](respondWithResult(_0x310332,null))[_0x0eb3('0x44')](handleError(_0x310332,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index e8dc3d5..4c191eb 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 _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 +var _0xe60c=['moment','bluebird','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x168a43,_0x5d0242){var _0x64a456=function(_0x562471){while(--_0x562471){_0x168a43['push'](_0x168a43['shift']());}};_0x64a456(++_0x5d0242);}(_0xe60c,0x1ca));var _0xce60=function(_0xacb1e2,_0x55e0ab){_0xacb1e2=_0xacb1e2-0x0;var _0x463815=_0xe60c[_0xacb1e2];return _0x463815;};'use strict';var _=require(_0xce60('0x0'));var util=require(_0xce60('0x1'));var logger=require(_0xce60('0x2'))(_0xce60('0x3'));var moment=require(_0xce60('0x4'));var BPromise=require(_0xce60('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce60('0x6'));var rimraf=require(_0xce60('0x7'));var config=require(_0xce60('0x8'));var attributes=require(_0xce60('0x9'));module[_0xce60('0xa')]=function(_0x35fd1e,_0x3b8377){return _0x35fd1e[_0xce60('0xb')]('OpenchannelTransferReport',attributes,{'tableName':_0xce60('0xc'),'paranoid':![],'indexes':[{'name':_0xce60('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index bb411c8..8c63fcb 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 _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 +var _0xdcfa=['http','request','then','info','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xdcfa,0xad));var _0xadcf=function(_0x500d35,_0x3f5d69){_0x500d35=_0x500d35-0x0;var _0x383af4=_0xdcfa[_0x500d35];return _0x383af4;};'use strict';var _=require(_0xadcf('0x0'));var util=require('util');var moment=require(_0xadcf('0x1'));var BPromise=require('bluebird');var rs=require(_0xadcf('0x2'));var fs=require('fs');var Redis=require(_0xadcf('0x3'));var db=require(_0xadcf('0x4'))['db'];var utils=require(_0xadcf('0x5'));var logger=require(_0xadcf('0x6'))(_0xadcf('0x7'));var config=require(_0xadcf('0x8'));var jayson=require(_0xadcf('0x9'));var client=jayson[_0xadcf('0xa')][_0xadcf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x182f1c,_0x381b4c,_0x5a98ab){return new BPromise(function(_0x41cdbf,_0x5db108){return client[_0xadcf('0xc')](_0x182f1c,_0x5a98ab)[_0xadcf('0xd')](function(_0x58be29){logger[_0xadcf('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x381b4c,_0xadcf('0xf'));logger['debug'](_0xadcf('0x10'),_0x381b4c,_0xadcf('0xf'),JSON['stringify'](_0x58be29));if(_0x58be29[_0xadcf('0x11')]){if(_0x58be29[_0xadcf('0x11')][_0xadcf('0x12')]===0x1f4){logger[_0xadcf('0x11')](_0xadcf('0x13'),_0x381b4c,_0x58be29[_0xadcf('0x11')]['message']);return _0x5db108(_0x58be29[_0xadcf('0x11')][_0xadcf('0x14')]);}logger[_0xadcf('0x11')](_0xadcf('0x13'),_0x381b4c,_0x58be29[_0xadcf('0x11')]['message']);return _0x41cdbf(_0x58be29[_0xadcf('0x11')][_0xadcf('0x14')]);}else{logger['info'](_0xadcf('0x13'),_0x381b4c,_0xadcf('0xf'));_0x41cdbf(_0x58be29[_0xadcf('0x15')][_0xadcf('0x14')]);}})[_0xadcf('0x16')](function(_0x4d9333){logger[_0xadcf('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x381b4c,_0x4d9333);_0x5db108(_0x4d9333);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index d9fc75b..2549bd9 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 _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 +var _0xca20=['../../config/environment','./pause.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x52e450,_0xb2cc86){var _0x2a5d4c=function(_0x2c1f4a){while(--_0x2c1f4a){_0x52e450['push'](_0x52e450['shift']());}};_0x2a5d4c(++_0xb2cc86);}(_0xca20,0xcc));var _0x0ca2=function(_0x112e2a,_0x364486){_0x112e2a=_0x112e2a-0x0;var _0x4f8af9=_0xca20[_0x112e2a];return _0x4f8af9;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x0ca2('0x0'));var express=require('express');var router=express[_0x0ca2('0x1')]();var auth=require(_0x0ca2('0x2'));var interaction=require(_0x0ca2('0x3'));var config=require(_0x0ca2('0x4'));var controller=require(_0x0ca2('0x5'));router[_0x0ca2('0x6')]('/',auth['isAuthenticated'](),controller[_0x0ca2('0x7')]);router[_0x0ca2('0x6')](_0x0ca2('0x8'),auth[_0x0ca2('0x9')](),controller[_0x0ca2('0xa')]);router[_0x0ca2('0xb')]('/',auth['isAuthenticated'](),controller[_0x0ca2('0xc')]);router[_0x0ca2('0xd')](_0x0ca2('0x8'),auth['isAuthenticated'](),controller[_0x0ca2('0xe')]);router[_0x0ca2('0xf')](_0x0ca2('0x8'),auth[_0x0ca2('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 0b558d0..aae827f 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 _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 +var _0xb243=['exports','STRING','sequelize'];(function(_0x209d28,_0x1ee824){var _0x1be78d=function(_0x4a46f0){while(--_0x4a46f0){_0x209d28['push'](_0x209d28['shift']());}};_0x1be78d(++_0x1ee824);}(_0xb243,0xaa));var _0x3b24=function(_0x15844a,_0x492ebd){_0x15844a=_0x15844a-0x0;var _0x1922c7=_0xb243[_0x15844a];return _0x1922c7;};'use strict';var Sequelize=require(_0x3b24('0x0'));module[_0x3b24('0x1')]={'name':{'type':Sequelize[_0x3b24('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index ebcda9c..9bf9d14 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 _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 +var _0x7243=['Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource','stack','name','map','Pause','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','nolimit','limit','sort','where','pick','filter','merge','findAll','rows','catch','show','params','intersection','includeAll','options','find','create','user','get'];(function(_0x86d62,_0x336d5c){var _0x430684=function(_0x4e3ccf){while(--_0x4e3ccf){_0x86d62['push'](_0x86d62['shift']());}};_0x430684(++_0x336d5c);}(_0x7243,0xfe));var _0x3724=function(_0x2fc53b,_0x2a5c18){_0x2fc53b=_0x2fc53b-0x0;var _0x536a35=_0x7243[_0x2fc53b];return _0x536a35;};'use strict';var pdf=require(_0x3724('0x0'));var emlformat=require(_0x3724('0x1'));var rimraf=require(_0x3724('0x2'));var zipdir=require(_0x3724('0x3'));var jsonpatch=require(_0x3724('0x4'));var rp=require('request-promise');var moment=require(_0x3724('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3724('0x6'));var util=require(_0x3724('0x7'));var path=require(_0x3724('0x8'));var sox=require(_0x3724('0x9'));var csv=require(_0x3724('0xa'));var ejs=require(_0x3724('0xb'));var fs=require('fs');var _=require(_0x3724('0xc'));var squel=require(_0x3724('0xd'));var crypto=require(_0x3724('0xe'));var jsforce=require(_0x3724('0xf'));var deskjs=require(_0x3724('0x10'));var toCsv=require(_0x3724('0xa'));var querystring=require(_0x3724('0x11'));var Papa=require(_0x3724('0x12'));var Redis=require(_0x3724('0x13'));var authService=require(_0x3724('0x14'));var qs=require(_0x3724('0x15'));var as=require(_0x3724('0x16'));var hardwareService=require(_0x3724('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x3724('0x18'));var config=require('../../config/environment');var db=require(_0x3724('0x19'))['db'];function respondWithStatusCode(_0x5d7a52,_0x2d3fcb){_0x2d3fcb=_0x2d3fcb||0xcc;return function(_0x9ea002){if(_0x9ea002){return _0x5d7a52[_0x3724('0x1a')](_0x2d3fcb);}return _0x5d7a52[_0x3724('0x1b')](_0x2d3fcb)[_0x3724('0x1c')]();};}function respondWithResult(_0x475981,_0x334d4d){_0x334d4d=_0x334d4d||0xc8;return function(_0x217954){if(_0x217954){return _0x475981[_0x3724('0x1b')](_0x334d4d)[_0x3724('0x1d')](_0x217954);}};}function respondWithFilteredResult(_0x29f611,_0x406bef){return function(_0x3033eb){if(_0x3033eb){var _0x205aae=_0x3033eb[_0x3724('0x1e')],_0x2b7223=_0x406bef[_0x3724('0x1f')],_0x45606b=_0x406bef['offset']+_0x406bef['limit'],_0x18a372;if(_0x45606b>=_0x205aae){_0x45606b=_0x205aae;_0x18a372=0xc8;}else{_0x18a372=0xce;}_0x29f611[_0x3724('0x1b')](_0x18a372);return _0x29f611[_0x3724('0x20')](_0x3724('0x21'),_0x2b7223+'-'+_0x45606b+'/'+_0x205aae)[_0x3724('0x1d')](_0x3033eb);}return null;};}function patchUpdates(_0xed1c79){return function(_0x4c1dde){try{jsonpatch[_0x3724('0x22')](_0x4c1dde,_0xed1c79,!![]);}catch(_0x9fcf13){return BPromise[_0x3724('0x23')](_0x9fcf13);}return _0x4c1dde[_0x3724('0x24')]();};}function saveUpdates(_0x59fc5b,_0x161398){return function(_0x1ad0fe){if(_0x1ad0fe){return _0x1ad0fe['update'](_0x59fc5b)[_0x3724('0x25')](function(_0x507188){return _0x507188;});}return null;};}function removeEntity(_0x2bcfa4,_0x22d31a){return function(_0x54c0bf){if(_0x54c0bf){return _0x54c0bf[_0x3724('0x26')]()[_0x3724('0x25')](function(){var _0x51887d=_0x54c0bf['get']({'plain':!![]});var _0x5750ed='Pauses';return db[_0x3724('0x27')][_0x3724('0x26')]({'where':{'type':_0x5750ed,'resourceId':_0x51887d['id']}})[_0x3724('0x25')](function(){return _0x54c0bf;});})[_0x3724('0x25')](function(){_0x2bcfa4[_0x3724('0x1b')](0xcc)[_0x3724('0x1c')]();});}};}function handleEntityNotFound(_0x23fb6a,_0x371a45){return function(_0x4605fb){if(!_0x4605fb){_0x23fb6a[_0x3724('0x1a')](0x194);}return _0x4605fb;};}function handleError(_0x2cf028,_0x314354){_0x314354=_0x314354||0x1f4;return function(_0x4c9145){logger['error'](_0x4c9145[_0x3724('0x28')]);if(_0x4c9145[_0x3724('0x29')]){delete _0x4c9145['name'];}_0x2cf028['status'](_0x314354)['send'](_0x4c9145);};}exports['index']=function(_0x23fbca,_0x2b0de7){var _0x149a18={},_0x5a124d={},_0x165a73={'count':0x0,'rows':[]};var _0x1848f0=_[_0x3724('0x2a')](db[_0x3724('0x2b')][_0x3724('0x2c')],function(_0x332def){return{'name':_0x332def[_0x3724('0x2d')],'type':_0x332def[_0x3724('0x2e')][_0x3724('0x2f')]};});_0x5a124d[_0x3724('0x30')]=_[_0x3724('0x2a')](_0x1848f0,_0x3724('0x29'));_0x5a124d['query']=_[_0x3724('0x31')](_0x23fbca[_0x3724('0x32')]);_0x5a124d[_0x3724('0x33')]=_['intersection'](_0x5a124d[_0x3724('0x30')],_0x5a124d[_0x3724('0x32')]);_0x149a18[_0x3724('0x34')]=_['intersection'](_0x5a124d[_0x3724('0x30')],qs[_0x3724('0x35')](_0x23fbca[_0x3724('0x32')][_0x3724('0x35')]));_0x149a18[_0x3724('0x34')]=_0x149a18[_0x3724('0x34')][_0x3724('0x36')]?_0x149a18[_0x3724('0x34')]:_0x5a124d[_0x3724('0x30')];if(!_0x23fbca['query']['hasOwnProperty'](_0x3724('0x37'))){_0x149a18['limit']=qs[_0x3724('0x38')](_0x23fbca[_0x3724('0x32')][_0x3724('0x38')]);_0x149a18[_0x3724('0x1f')]=qs[_0x3724('0x1f')](_0x23fbca[_0x3724('0x32')]['offset']);}_0x149a18['order']=qs['sort'](_0x23fbca['query'][_0x3724('0x39')]);_0x149a18[_0x3724('0x3a')]=qs[_0x3724('0x33')](_[_0x3724('0x3b')](_0x23fbca[_0x3724('0x32')],_0x5a124d[_0x3724('0x33')]),_0x1848f0);if(_0x23fbca[_0x3724('0x32')][_0x3724('0x3c')]){_0x149a18['where']=_[_0x3724('0x3d')](_0x149a18[_0x3724('0x3a')],{'$or':_[_0x3724('0x2a')](_0x1848f0,function(_0x402c0a){if(_0x402c0a[_0x3724('0x2e')]!=='VIRTUAL'){var _0x2891e7={};_0x2891e7[_0x402c0a[_0x3724('0x29')]]={'$like':'%'+_0x23fbca[_0x3724('0x32')]['filter']+'%'};return _0x2891e7;}})});}_0x149a18=_[_0x3724('0x3d')]({},_0x149a18,_0x23fbca['options']);var _0x46d4df={'where':_0x149a18['where']};return db[_0x3724('0x2b')][_0x3724('0x1e')](_0x46d4df)['then'](function(_0x1aebb2){_0x165a73['count']=_0x1aebb2;if(_0x23fbca[_0x3724('0x32')]['includeAll']){_0x149a18['include']=[{'all':!![]}];}return db[_0x3724('0x2b')][_0x3724('0x3e')](_0x149a18);})[_0x3724('0x25')](function(_0x5498ed){_0x165a73[_0x3724('0x3f')]=_0x5498ed;return _0x165a73;})[_0x3724('0x25')](respondWithFilteredResult(_0x2b0de7,_0x149a18))[_0x3724('0x40')](handleError(_0x2b0de7,null));};exports[_0x3724('0x41')]=function(_0x1d8ad2,_0x1e8fe3){var _0xdae0b5={'raw':!![],'where':{'id':_0x1d8ad2[_0x3724('0x42')]['id']}},_0x126089={};_0x126089[_0x3724('0x30')]=_[_0x3724('0x31')](db[_0x3724('0x2b')][_0x3724('0x2c')]);_0x126089['query']=_['keys'](_0x1d8ad2[_0x3724('0x32')]);_0x126089['filters']=_['intersection'](_0x126089[_0x3724('0x30')],_0x126089[_0x3724('0x32')]);_0xdae0b5['attributes']=_[_0x3724('0x43')](_0x126089[_0x3724('0x30')],qs['fields'](_0x1d8ad2['query'][_0x3724('0x35')]));_0xdae0b5[_0x3724('0x34')]=_0xdae0b5['attributes'][_0x3724('0x36')]?_0xdae0b5['attributes']:_0x126089[_0x3724('0x30')];if(_0x1d8ad2[_0x3724('0x32')][_0x3724('0x44')]){_0xdae0b5['include']=[{'all':!![]}];}_0xdae0b5=_['merge']({},_0xdae0b5,_0x1d8ad2[_0x3724('0x45')]);return db['Pause'][_0x3724('0x46')](_0xdae0b5)[_0x3724('0x25')](handleEntityNotFound(_0x1e8fe3,null))['then'](respondWithResult(_0x1e8fe3,null))['catch'](handleError(_0x1e8fe3,null));};exports[_0x3724('0x47')]=function(_0x5e0d48,_0x5d7fcf){return db['Pause']['create'](_0x5e0d48['body'],{})[_0x3724('0x25')](function(_0x4d456d){var _0x474e6a=_0x5e0d48[_0x3724('0x48')][_0x3724('0x49')]({'plain':!![]});if(!_0x474e6a)throw new Error(_0x3724('0x4a'));if(_0x474e6a['role']===_0x3724('0x48')){var _0x3359dd=_0x4d456d['get']({'plain':!![]});var _0x11c26c='Pauses';return db[_0x3724('0x4b')][_0x3724('0x46')]({'where':{'name':_0x11c26c,'userProfileId':_0x474e6a[_0x3724('0x4c')]},'raw':!![]})['then'](function(_0x3c6b8d){if(_0x3c6b8d&&_0x3c6b8d[_0x3724('0x4d')]===0x0){return db[_0x3724('0x27')]['create']({'name':_0x3359dd[_0x3724('0x29')],'resourceId':_0x3359dd['id'],'type':_0x3c6b8d[_0x3724('0x29')],'sectionId':_0x3c6b8d['id']},{})[_0x3724('0x25')](function(){return _0x4d456d;});}else{return _0x4d456d;}})[_0x3724('0x40')](function(_0x495125){logger[_0x3724('0x4e')](_0x3724('0x4f'),_0x495125);throw _0x495125;});}return _0x4d456d;})[_0x3724('0x25')](respondWithResult(_0x5d7fcf,0xc9))[_0x3724('0x40')](handleError(_0x5d7fcf,null));};exports[_0x3724('0x50')]=function(_0xc5ba5d,_0x1897d5){if(_0xc5ba5d[_0x3724('0x51')]['id']){delete _0xc5ba5d['body']['id'];}return db[_0x3724('0x2b')]['find']({'where':{'id':_0xc5ba5d[_0x3724('0x42')]['id']}})['then'](handleEntityNotFound(_0x1897d5,null))[_0x3724('0x25')](saveUpdates(_0xc5ba5d['body'],null))[_0x3724('0x25')](respondWithResult(_0x1897d5,null))[_0x3724('0x40')](handleError(_0x1897d5,null));};exports[_0x3724('0x26')]=function(_0x2126f5,_0x29942f){return db[_0x3724('0x2b')]['find']({'where':{'id':_0x2126f5[_0x3724('0x42')]['id']}})[_0x3724('0x25')](handleEntityNotFound(_0x29942f,null))[_0x3724('0x25')](removeEntity(_0x29942f,null))[_0x3724('0x40')](handleError(_0x29942f,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index ab55849..4522509 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 _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 +var _0x578c=['../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x578c,0x158));var _0xc578=function(_0x2987fd,_0x4e13c8){_0x2987fd=_0x2987fd-0x0;var _0x56587d=_0x578c[_0x2987fd];return _0x56587d;};'use strict';var _=require(_0xc578('0x0'));var util=require(_0xc578('0x1'));var logger=require(_0xc578('0x2'))('api');var moment=require(_0xc578('0x3'));var BPromise=require(_0xc578('0x4'));var rp=require(_0xc578('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc578('0x6'));var config=require(_0xc578('0x7'));var attributes=require(_0xc578('0x8'));module[_0xc578('0x9')]=function(_0x178786,_0x3305c9){return _0x178786[_0xc578('0xa')](_0xc578('0xb'),attributes,{'tableName':_0xc578('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 9fcad0a..161bbeb 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 _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 +var _0x350a=['raw','where','attributes','map','include','model','info','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowPause','find','options'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x350a,0xb1));var _0xa350=function(_0x18afca,_0x4219d9){_0x18afca=_0x18afca-0x0;var _0x11603f=_0x350a[_0x18afca];return _0x11603f;};'use strict';var _=require(_0xa350('0x0'));var util=require(_0xa350('0x1'));var moment=require(_0xa350('0x2'));var BPromise=require('bluebird');var rs=require(_0xa350('0x3'));var fs=require('fs');var Redis=require(_0xa350('0x4'));var db=require(_0xa350('0x5'))['db'];var utils=require(_0xa350('0x6'));var logger=require(_0xa350('0x7'))(_0xa350('0x8'));var config=require('../../config/environment');var jayson=require(_0xa350('0x9'));var client=jayson[_0xa350('0xa')][_0xa350('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x279c69,_0x578c99,_0x229c80){return new BPromise(function(_0x3973fc,_0x5b04af){return client[_0xa350('0xc')](_0x279c69,_0x229c80)[_0xa350('0xd')](function(_0xce8765){logger['info'](_0xa350('0xe'),_0x578c99,_0xa350('0xf'));logger[_0xa350('0x10')](_0xa350('0x11'),_0x578c99,_0xa350('0xf'),JSON[_0xa350('0x12')](_0xce8765));if(_0xce8765[_0xa350('0x13')]){if(_0xce8765[_0xa350('0x13')][_0xa350('0x14')]===0x1f4){logger['error'](_0xa350('0xe'),_0x578c99,_0xce8765[_0xa350('0x13')][_0xa350('0x15')]);return _0x5b04af(_0xce8765['error'][_0xa350('0x15')]);}logger['error'](_0xa350('0xe'),_0x578c99,_0xce8765[_0xa350('0x13')][_0xa350('0x15')]);return _0x3973fc(_0xce8765[_0xa350('0x13')]['message']);}else{logger['info']('Pause,\x20%s,\x20%s',_0x578c99,_0xa350('0xf'));_0x3973fc(_0xce8765[_0xa350('0x16')][_0xa350('0x15')]);}})[_0xa350('0x17')](function(_0x538d69){logger[_0xa350('0x13')]('Pause,\x20%s,\x20%s',_0x578c99,_0x538d69);_0x5b04af(_0x538d69);});});}exports[_0xa350('0x18')]=function(_0x1aec00){var _0x5bca8a=this;return new Promise(function(_0x1a7abd,_0x9cef1c){return db['Pause'][_0xa350('0x19')]({'raw':_0x1aec00[_0xa350('0x1a')]?_0x1aec00[_0xa350('0x1a')][_0xa350('0x1b')]===undefined?!![]:![]:!![],'where':_0x1aec00[_0xa350('0x1a')]?_0x1aec00[_0xa350('0x1a')][_0xa350('0x1c')]||null:null,'attributes':_0x1aec00['options']?_0x1aec00[_0xa350('0x1a')][_0xa350('0x1d')]||null:null,'include':_0x1aec00[_0xa350('0x1a')]?_0x1aec00['options']['include']?_[_0xa350('0x1e')](_0x1aec00['options'][_0xa350('0x1f')],function(_0x2b8b2f){return{'model':db[_0x2b8b2f[_0xa350('0x20')]],'as':_0x2b8b2f['as'],'attributes':_0x2b8b2f['attributes'],'include':_0x2b8b2f[_0xa350('0x1f')]?_['map'](_0x2b8b2f[_0xa350('0x1f')],function(_0x313a24){return{'model':db[_0x313a24[_0xa350('0x20')]],'as':_0x313a24['as'],'attributes':_0x313a24['attributes'],'include':_0x313a24[_0xa350('0x1f')]?_['map'](_0x313a24[_0xa350('0x1f')],function(_0x4328e3){return{'model':db[_0x4328e3[_0xa350('0x20')]],'as':_0x4328e3['as'],'attributes':_0x4328e3['attributes']};}):[]};}):[]};}):[]:[]})[_0xa350('0xd')](function(_0x5aa688){logger[_0xa350('0x21')](_0xa350('0x18'),_0x1aec00);logger[_0xa350('0x10')]('ShowPause',_0x1aec00,JSON[_0xa350('0x12')](_0x5aa688));_0x1a7abd(_0x5aa688);})[_0xa350('0x17')](function(_0x56e3d1){logger['error'](_0xa350('0x18'),_0x56e3d1['message'],_0x1aec00);_0x9cef1c(_0x5bca8a[_0xa350('0x13')](0x1f4,_0x56e3d1[_0xa350('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 5f7c461..269646e 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 _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 +var _0x24c7=['join','root','originalname','replace','format','%s-%s%s','basename','extname','now','single','webhookPost','put','/:id','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/webhook','webhookGet','show','/:id/download','diskStorage'];(function(_0x5c8f3e,_0x33ba70){var _0xb55f35=function(_0x48f8ef){while(--_0x48f8ef){_0x5c8f3e['push'](_0x5c8f3e['shift']());}};_0xb55f35(++_0x33ba70);}(_0x24c7,0x182));var _0x724c=function(_0x1c7252,_0x2840e3){_0x1c7252=_0x1c7252-0x0;var _0x1f9dc6=_0x24c7[_0x1c7252];return _0x1f9dc6;};'use strict';var multer=require(_0x724c('0x0'));var util=require(_0x724c('0x1'));var path=require(_0x724c('0x2'));var timeout=require(_0x724c('0x3'));var express=require(_0x724c('0x4'));var router=express[_0x724c('0x5')]();var auth=require(_0x724c('0x6'));var interaction=require(_0x724c('0x7'));var config=require(_0x724c('0x8'));var controller=require('./plugin.controller');router[_0x724c('0x9')]('/',auth[_0x724c('0xa')](),controller[_0x724c('0xb')]);router[_0x724c('0x9')](_0x724c('0xc'),controller[_0x724c('0xd')]);router['get']('/:id',auth[_0x724c('0xa')](),controller[_0x724c('0xe')]);router[_0x724c('0x9')](_0x724c('0xf'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x724c('0x10')]({'destination':function(_0x328f26,_0x154de1,_0x322897){_0x322897(null,path[_0x724c('0x11')](config[_0x724c('0x12')],'server/files/plugins'));},'filename':function(_0x4f41cb,_0xa7f2a8,_0x41ca22){_0xa7f2a8[_0x724c('0x13')]=_0xa7f2a8[_0x724c('0x13')][_0x724c('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x41ca22(null,util[_0x724c('0x15')](_0x724c('0x16'),path[_0x724c('0x17')](_0xa7f2a8[_0x724c('0x13')],path[_0x724c('0x18')](_0xa7f2a8[_0x724c('0x13')])),Date[_0x724c('0x19')](),path[_0x724c('0x18')](_0xa7f2a8[_0x724c('0x13')])));}})});router['post']('/',upload[_0x724c('0x1a')]('file'),controller['upload']);router['post']('/webhook',controller[_0x724c('0x1b')]);router[_0x724c('0x1c')](_0x724c('0x1d'),auth[_0x724c('0xa')](),controller['update']);router[_0x724c('0x1e')]('/:id',auth[_0x724c('0xa')](),controller[_0x724c('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 5ee2b50..8f2c62b 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 _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 +var _0x67ee=['BOOLEAN','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING','ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x47cdaa,_0x49ef2a){var _0x3d016d=function(_0x46001b){while(--_0x46001b){_0x47cdaa['push'](_0x47cdaa['shift']());}};_0x3d016d(++_0x49ef2a);}(_0x67ee,0xde));var _0xe67e=function(_0x3b5ec3,_0x580f19){_0x3b5ec3=_0x3b5ec3-0x0;var _0x1ccf86=_0x67ee[_0x3b5ec3];return _0x1ccf86;};'use strict';var Sequelize=require(_0xe67e('0x0'));module['exports']={'name':{'type':Sequelize[_0xe67e('0x1')]},'type':{'type':Sequelize[_0xe67e('0x2')]('html',_0xe67e('0x3'))},'description':{'type':Sequelize[_0xe67e('0x4')]},'version':{'type':Sequelize[_0xe67e('0x4')]},'path':{'type':Sequelize['STRING'],'comment':_0xe67e('0x5')},'active':{'type':Sequelize[_0xe67e('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0xe67e('0x7'),_0xe67e('0x8'),_0xe67e('0x9'),_0xe67e('0xa')),'defaultValue':'always','comment':_0xe67e('0xb')},'icon':{'type':Sequelize[_0xe67e('0x1')]},'adminUrl':{'type':Sequelize[_0xe67e('0x1')]},'agentUrl':{'type':Sequelize[_0xe67e('0x1')]},'scriptName':{'type':Sequelize[_0xe67e('0x1')]},'scriptPath':{'type':Sequelize[_0xe67e('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index fd09d83..dd3dab1 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 _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 +var _0x7a88=['hostname','port','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','sox','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','redis','defaults','localhost','./plugin.socket','register','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','index','Plugin','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','count','findAll','rows','catch','params','includeAll','options','find','join','root','server/files/plugins','format','%s.zip','basename','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','path','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','download','Error','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','html','parameters','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','scriptName','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','script','scriptPath','create','body','role','userProfileId','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','delete','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified'];(function(_0x1147ab,_0x10e72b){var _0x55cb5a=function(_0x364bd6){while(--_0x364bd6){_0x1147ab['push'](_0x1147ab['shift']());}};_0x55cb5a(++_0x10e72b);}(_0x7a88,0x155));var _0x87a8=function(_0x27a7d3,_0x24ca5b){_0x27a7d3=_0x27a7d3-0x0;var _0x107ab8=_0x7a88[_0x27a7d3];return _0x107ab8;};'use strict';var pdf=require(_0x87a8('0x0'));var emlformat=require(_0x87a8('0x1'));var rimraf=require(_0x87a8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x87a8('0x3'));var rp=require(_0x87a8('0x4'));var moment=require('moment');var BPromise=require(_0x87a8('0x5'));var Mustache=require('mustache');var util=require(_0x87a8('0x6'));var path=require('path');var sox=require(_0x87a8('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x87a8('0x8'));var crypto=require(_0x87a8('0x9'));var jsforce=require(_0x87a8('0xa'));var deskjs=require(_0x87a8('0xb'));var toCsv=require('to-csv');var querystring=require(_0x87a8('0xc'));var Papa=require(_0x87a8('0xd'));var extract=require(_0x87a8('0xe'));var rimraf=require('rimraf');var archiver=require(_0x87a8('0xf'));var Redis=require(_0x87a8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x87a8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x87a8('0x12'))(_0x87a8('0x13'));var utils=require(_0x87a8('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x87a8('0x15')]=_[_0x87a8('0x16')](config['redis'],{'host':_0x87a8('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x87a8('0x15')]));require(_0x87a8('0x18'))[_0x87a8('0x19')](socket);function respondWithStatusCode(_0x290d79,_0x5004c4){_0x5004c4=_0x5004c4||0xcc;return function(_0x2085d1){if(_0x2085d1){return _0x290d79[_0x87a8('0x1a')](_0x5004c4);}return _0x290d79[_0x87a8('0x1b')](_0x5004c4)['end']();};}function respondWithResult(_0x1e3065,_0x55fcb9){_0x55fcb9=_0x55fcb9||0xc8;return function(_0x2bc94d){if(_0x2bc94d){return _0x1e3065[_0x87a8('0x1b')](_0x55fcb9)[_0x87a8('0x1c')](_0x2bc94d);}};}function respondWithFilteredResult(_0x286071,_0x5eb5f7){return function(_0x487634){if(_0x487634){var _0x395fa2=_0x487634['count'],_0xada6fb=_0x5eb5f7['offset'],_0x20d137=_0x5eb5f7[_0x87a8('0x1d')]+_0x5eb5f7[_0x87a8('0x1e')],_0x148c5c;if(_0x20d137>=_0x395fa2){_0x20d137=_0x395fa2;_0x148c5c=0xc8;}else{_0x148c5c=0xce;}_0x286071['status'](_0x148c5c);return _0x286071[_0x87a8('0x1f')](_0x87a8('0x20'),_0xada6fb+'-'+_0x20d137+'/'+_0x395fa2)[_0x87a8('0x1c')](_0x487634);}return null;};}function patchUpdates(_0x1b4cb9){return function(_0x52cfb3){try{jsonpatch[_0x87a8('0x21')](_0x52cfb3,_0x1b4cb9,!![]);}catch(_0xe99bcb){return BPromise[_0x87a8('0x22')](_0xe99bcb);}return _0x52cfb3[_0x87a8('0x23')]();};}function saveUpdates(_0x5b8248,_0x464d30){return function(_0x1b2b29){if(_0x1b2b29){return _0x1b2b29[_0x87a8('0x24')](_0x5b8248)[_0x87a8('0x25')](function(_0x3bcf0d){return _0x3bcf0d;});}return null;};}function removeEntity(_0x59531a,_0x5b7263){return function(_0x5d3a1f){if(_0x5d3a1f){return _0x5d3a1f[_0x87a8('0x26')]()['then'](function(){var _0x5c793b=_0x5d3a1f[_0x87a8('0x27')]({'plain':!![]});var _0x39bd39=_0x87a8('0x28');return db[_0x87a8('0x29')][_0x87a8('0x26')]({'where':{'type':_0x39bd39,'resourceId':_0x5c793b['id']}})['then'](function(){return _0x5d3a1f;});})['then'](function(){_0x59531a[_0x87a8('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ecc58,_0xb65df3){return function(_0x17fa2){if(!_0x17fa2){_0x4ecc58[_0x87a8('0x1a')](0x194);}return _0x17fa2;};}function handleError(_0x40fce2,_0x25dd9f){_0x25dd9f=_0x25dd9f||0x1f4;return function(_0x15038b){logger[_0x87a8('0x2a')](_0x15038b[_0x87a8('0x2b')]);if(_0x15038b[_0x87a8('0x2c')]){delete _0x15038b[_0x87a8('0x2c')];}_0x40fce2[_0x87a8('0x1b')](_0x25dd9f)[_0x87a8('0x2d')](_0x15038b);};}exports[_0x87a8('0x2e')]=function(_0x3aa513,_0x3b883e){var _0x4ef0d5={},_0x5b6d8a={},_0x281428={'count':0x0,'rows':[]};var _0x4aaa1e=_['map'](db[_0x87a8('0x2f')][_0x87a8('0x30')],function(_0x16c0a4){return{'name':_0x16c0a4[_0x87a8('0x31')],'type':_0x16c0a4[_0x87a8('0x32')][_0x87a8('0x33')]};});_0x5b6d8a[_0x87a8('0x34')]=_[_0x87a8('0x35')](_0x4aaa1e,_0x87a8('0x2c'));_0x5b6d8a[_0x87a8('0x36')]=_[_0x87a8('0x37')](_0x3aa513['query']);_0x5b6d8a['filters']=_[_0x87a8('0x38')](_0x5b6d8a[_0x87a8('0x34')],_0x5b6d8a[_0x87a8('0x36')]);_0x4ef0d5['attributes']=_['intersection'](_0x5b6d8a[_0x87a8('0x34')],qs[_0x87a8('0x39')](_0x3aa513['query']['fields']));_0x4ef0d5[_0x87a8('0x3a')]=_0x4ef0d5[_0x87a8('0x3a')][_0x87a8('0x3b')]?_0x4ef0d5[_0x87a8('0x3a')]:_0x5b6d8a[_0x87a8('0x34')];if(!_0x3aa513[_0x87a8('0x36')]['hasOwnProperty'](_0x87a8('0x3c'))){_0x4ef0d5['limit']=qs[_0x87a8('0x1e')](_0x3aa513['query'][_0x87a8('0x1e')]);_0x4ef0d5[_0x87a8('0x1d')]=qs[_0x87a8('0x1d')](_0x3aa513[_0x87a8('0x36')][_0x87a8('0x1d')]);}_0x4ef0d5[_0x87a8('0x3d')]=qs[_0x87a8('0x3e')](_0x3aa513['query'][_0x87a8('0x3e')]);_0x4ef0d5[_0x87a8('0x3f')]=qs[_0x87a8('0x40')](_[_0x87a8('0x41')](_0x3aa513[_0x87a8('0x36')],_0x5b6d8a[_0x87a8('0x40')]),_0x4aaa1e);if(_0x3aa513[_0x87a8('0x36')][_0x87a8('0x42')]){_0x4ef0d5['where']=_[_0x87a8('0x43')](_0x4ef0d5[_0x87a8('0x3f')],{'$or':_[_0x87a8('0x35')](_0x4aaa1e,function(_0x2e5068){if(_0x2e5068['type']!==_0x87a8('0x44')){var _0x469dd0={};_0x469dd0[_0x2e5068[_0x87a8('0x2c')]]={'$like':'%'+_0x3aa513['query']['filter']+'%'};return _0x469dd0;}})});}_0x4ef0d5=_[_0x87a8('0x43')]({},_0x4ef0d5,_0x3aa513['options']);var _0x3adc09={'where':_0x4ef0d5[_0x87a8('0x3f')]};return db[_0x87a8('0x2f')][_0x87a8('0x45')](_0x3adc09)[_0x87a8('0x25')](function(_0x558a84){_0x281428['count']=_0x558a84;if(_0x3aa513[_0x87a8('0x36')]['includeAll']){_0x4ef0d5['include']=[{'all':!![]}];}return db[_0x87a8('0x2f')][_0x87a8('0x46')](_0x4ef0d5);})['then'](function(_0x4f5073){_0x281428[_0x87a8('0x47')]=_0x4f5073;return _0x281428;})['then'](respondWithFilteredResult(_0x3b883e,_0x4ef0d5))[_0x87a8('0x48')](handleError(_0x3b883e,null));};exports['show']=function(_0x180292,_0x4229e5){var _0x3ca3aa={'raw':!![],'where':{'id':_0x180292[_0x87a8('0x49')]['id']}},_0x17f9b7={};_0x17f9b7['model']=_[_0x87a8('0x37')](db['Plugin'][_0x87a8('0x30')]);_0x17f9b7['query']=_[_0x87a8('0x37')](_0x180292['query']);_0x17f9b7[_0x87a8('0x40')]=_[_0x87a8('0x38')](_0x17f9b7[_0x87a8('0x34')],_0x17f9b7[_0x87a8('0x36')]);_0x3ca3aa['attributes']=_[_0x87a8('0x38')](_0x17f9b7[_0x87a8('0x34')],qs['fields'](_0x180292[_0x87a8('0x36')][_0x87a8('0x39')]));_0x3ca3aa[_0x87a8('0x3a')]=_0x3ca3aa[_0x87a8('0x3a')]['length']?_0x3ca3aa[_0x87a8('0x3a')]:_0x17f9b7[_0x87a8('0x34')];if(_0x180292[_0x87a8('0x36')][_0x87a8('0x4a')]){_0x3ca3aa['include']=[{'all':!![]}];}_0x3ca3aa=_[_0x87a8('0x43')]({},_0x3ca3aa,_0x180292[_0x87a8('0x4b')]);return db[_0x87a8('0x2f')][_0x87a8('0x4c')](_0x3ca3aa)[_0x87a8('0x25')](handleEntityNotFound(_0x4229e5,null))['then'](respondWithResult(_0x4229e5,null))[_0x87a8('0x48')](handleError(_0x4229e5,null));};exports['download']=function(_0x777f04,_0x2a4b4f,_0x27e159){return db[_0x87a8('0x2f')]['find']({'where':{'id':_0x777f04[_0x87a8('0x49')]['id']},'attributes':[_0x87a8('0x2c'),'path'],'raw':!![]})[_0x87a8('0x25')](handleEntityNotFound(_0x2a4b4f,null))[_0x87a8('0x25')](function(_0x39a96e){if(_0x39a96e){var _0x51e7c6=path[_0x87a8('0x4d')](config[_0x87a8('0x4e')],_0x87a8('0x4f'),util[_0x87a8('0x50')](_0x87a8('0x51'),path[_0x87a8('0x52')](_0x39a96e['path'])));var _0x4db288=fs['createWriteStream'](_0x51e7c6);var _0x173ce1=archiver('zip',{'zlib':{'level':0x9}});_0x173ce1['on'](_0x87a8('0x53'),function(_0x126faf){if(_0x126faf[_0x87a8('0x54')]===_0x87a8('0x55')){logger[_0x87a8('0x2a')](_0x126faf);}else{throw new db[(_0x87a8('0x56'))]['Error'](_0x87a8('0x57'));}});_0x173ce1['on'](_0x87a8('0x2a'),function(_0x499b89){throw new db[(_0x87a8('0x56'))]['Error'](_0x87a8('0x57'));});_0x173ce1[_0x87a8('0x58')](_0x4db288);_0x173ce1[_0x87a8('0x59')](_0x87a8('0x5a'),{'cwd':path[_0x87a8('0x4d')](config[_0x87a8('0x4e')],_0x87a8('0x4f'),path[_0x87a8('0x5b')](_0x39a96e[_0x87a8('0x5c')])),'ignore':[path[_0x87a8('0x4d')](path['basename'](_0x39a96e['path']),_0x87a8('0x5d')),path[_0x87a8('0x4d')](path[_0x87a8('0x52')](_0x39a96e[_0x87a8('0x5c')]),_0x87a8('0x5e'))],'nodir':!![]})[_0x87a8('0x5f')]();_0x4db288['on'](_0x87a8('0x60'),function(){if(!fs[_0x87a8('0x61')](_0x51e7c6)){throw new db[(_0x87a8('0x56'))]['Error'](_0x87a8('0x62'));}return _0x2a4b4f[_0x87a8('0x63')](_0x51e7c6,util['format'](_0x87a8('0x51'),path[_0x87a8('0x52')](_0x39a96e[_0x87a8('0x5c')])),function(_0xb601f6){if(_0xb601f6){throw new db[(_0x87a8('0x56'))][(_0x87a8('0x64'))](_0x87a8('0x65'));}fs[_0x87a8('0x66')](_0x51e7c6);logger[_0x87a8('0x67')](_0x87a8('0x68'));logger[_0x87a8('0x67')]('Temporary\x20file\x20removed');});});}return null;})[_0x87a8('0x48')](handleError(_0x2a4b4f,null));};exports['upload']=function(_0x1ffb22,_0x3151f2,_0x24e74e){var _0x365f15=path[_0x87a8('0x52')](_0x1ffb22[_0x87a8('0x69')][_0x87a8('0x6a')],path[_0x87a8('0x6b')](_0x1ffb22[_0x87a8('0x69')][_0x87a8('0x6a')]));var _0x6fb42a=path[_0x87a8('0x4d')](config['root'],_0x87a8('0x4f'),_0x1ffb22[_0x87a8('0x69')]['filename']);var _0x30f030=path['join'](config[_0x87a8('0x4e')],_0x87a8('0x4f'),_0x365f15);logger[_0x87a8('0x67')]('Plugin\x20upload\x20filepath:\x20%s',_0x6fb42a);logger[_0x87a8('0x67')](_0x87a8('0x6c'),_0x30f030);try{fs[_0x87a8('0x6d')](_0x6fb42a,parseInt(_0x87a8('0x6e'),0x8));extract(_0x6fb42a,{'dir':_0x30f030},function(_0x1f5822){if(_0x1f5822){logger['error'](_0x1f5822);handleError(_0x1f5822,!![]);};var _0x5ad329=fs[_0x87a8('0x6f')](_0x30f030);if(_0x5ad329['length']>0x1){removeReferences(_0x6fb42a,_0x30f030);logger['error'](_0x87a8('0x70'));return _0x24e74e(new Error('Invalid\x20plugin\x20structure'));}var _0x184ad4=fs[_0x87a8('0x71')](path[_0x87a8('0x4d')](_0x30f030,_0x5ad329[0x0]));if(_0x184ad4['isFile']()){removeReferences(_0x6fb42a,_0x30f030);logger[_0x87a8('0x2a')]('Invalid\x20plugin\x20structure');return _0x24e74e(new Error('Invalid\x20plugin\x20structure'));}if(_0x184ad4[_0x87a8('0x72')]()){var _0x139f8e=fs[_0x87a8('0x6f')](path[_0x87a8('0x4d')](_0x30f030,_0x5ad329[0x0]));if(_0x139f8e[_0x87a8('0x3b')]===0x0){removeReferences(_0x6fb42a,_0x30f030);logger['error'](_0x87a8('0x70'));return _0x24e74e(new Error(_0x87a8('0x70')));}var _0xbf584a=_0x139f8e['some'](function(_0x28cbe0){return _0x28cbe0===_0x87a8('0x73');});if(!_0xbf584a){return _0x24e74e(new Error(_0x87a8('0x74')));}var _0x5047e6=fs[_0x87a8('0x75')](path[_0x87a8('0x4d')](_0x30f030,_0x5ad329[0x0],_0x87a8('0x73')));var _0x3ceeb0=JSON[_0x87a8('0x76')](_0x5047e6);if(_0x87a8('0x77')==typeof _0x3ceeb0[_0x87a8('0x2c')]){return _0x24e74e(new Error(_0x87a8('0x78')));}if(_0x87a8('0x77')==typeof _0x3ceeb0['type']){return _0x24e74e(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x87a8('0x77')==typeof _0x3ceeb0['version']){return _0x24e74e(new Error(_0x87a8('0x79')));}if('undefined'==typeof _0x3ceeb0['parameters']){return _0x24e74e(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x3ceeb0[_0x87a8('0x32')]===_0x87a8('0x7a')){if(_0x87a8('0x77')==typeof _0x3ceeb0[_0x87a8('0x7b')]['views']){return _0x24e74e(new Error(_0x87a8('0x7c')));}if(_0x87a8('0x77')==typeof _0x3ceeb0[_0x87a8('0x7b')][_0x87a8('0x7d')][_0x87a8('0x7e')]&&'undefined'==typeof _0x3ceeb0[_0x87a8('0x7b')][_0x87a8('0x7d')][_0x87a8('0x7f')]){return _0x24e74e(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x3ceeb0[_0x87a8('0x32')]==='script'){if('undefined'==typeof _0x3ceeb0[_0x87a8('0x7b')][_0x87a8('0x80')]){return _0x24e74e(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0x3ceeb0[_0x87a8('0x7b')]['scriptPath']){return _0x24e74e(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x24e74e(new Error(_0x87a8('0x81')));}var _0x811040=_0x3ceeb0[_0x87a8('0x2c')];var _0x35695d=_0x3ceeb0[_0x87a8('0x82')];var _0x47cfeb=_0x3ceeb0['type'];var _0x12028c=_0x3ceeb0['sidebar']?_0x3ceeb0[_0x87a8('0x83')]:_0x87a8('0x84');var _0x3e0a54=_0x3ceeb0[_0x87a8('0x85')]?_0x3ceeb0['icon']:_0x87a8('0x86');var _0x24b38a='';var _0x131986='';var _0x23eea7='';var _0x58e5f7='';var _0x1343d7=_0x3ceeb0['version'];if(_0x47cfeb===_0x87a8('0x7a')){if(_0x87a8('0x77')!=typeof _0x3ceeb0['parameters'][_0x87a8('0x7d')][_0x87a8('0x7e')]){var _0x4ab499=_0x3ceeb0[_0x87a8('0x7b')]['views'][_0x87a8('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x87a8('0x87')](_0x4ab499)){_0x24b38a=path['join']('plugins',_0x365f15,_0x5ad329[0x0],_0x4ab499);}else{_0x24b38a=_0x4ab499;}}else{logger[_0x87a8('0x67')](_0x87a8('0x88'));}if(_0x87a8('0x77')!=typeof _0x3ceeb0[_0x87a8('0x7b')]['views'][_0x87a8('0x7f')]){var _0x59d50a=_0x3ceeb0[_0x87a8('0x7b')][_0x87a8('0x7d')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x87a8('0x87')](_0x59d50a)){_0x131986=path[_0x87a8('0x4d')](_0x87a8('0x89'),_0x365f15,_0x5ad329[0x0],_0x59d50a);}else{_0x131986=_0x59d50a;}}else{logger[_0x87a8('0x67')](_0x87a8('0x8a'));}}else if(_0x47cfeb===_0x87a8('0x8b')){_0x23eea7=_0x3ceeb0[_0x87a8('0x7b')][_0x87a8('0x80')];_0x58e5f7=_0x3ceeb0[_0x87a8('0x7b')][_0x87a8('0x8c')];if(_0x87a8('0x77')!=typeof _0x3ceeb0[_0x87a8('0x7b')]['views']){if(_0x87a8('0x77')!=typeof _0x3ceeb0[_0x87a8('0x7b')]['views'][_0x87a8('0x7e')]){var _0x4ab499=_0x3ceeb0['parameters'][_0x87a8('0x7d')][_0x87a8('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x87a8('0x87')](_0x4ab499)){_0x24b38a=path['join'](_0x87a8('0x89'),_0x365f15,_0x5ad329[0x0],_0x4ab499);}else{_0x24b38a=_0x4ab499;}}if(_0x87a8('0x77')!=typeof _0x3ceeb0[_0x87a8('0x7b')][_0x87a8('0x7d')][_0x87a8('0x7f')]){var _0x59d50a=_0x3ceeb0[_0x87a8('0x7b')][_0x87a8('0x7d')][_0x87a8('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x87a8('0x87')](_0x59d50a)){_0x131986=path[_0x87a8('0x4d')](_0x87a8('0x89'),_0x365f15,_0x5ad329[0x0],_0x59d50a);}else{_0x131986=_0x59d50a;}}}}var _0x5740e8={'name':_0x811040,'description':_0x35695d,'path':path[_0x87a8('0x4d')](_0x365f15,_0x5ad329[0x0]),'type':_0x47cfeb,'sidebar':_0x12028c,'icon':_0x3e0a54,'adminUrl':_0x24b38a,'agentUrl':_0x131986,'scriptName':_0x23eea7,'scriptPath':_0x58e5f7,'version':_0x1343d7};removeReferences(_0x6fb42a,null);return db['Plugin'][_0x87a8('0x8d')](_0x5740e8)['then'](function(_0x2bb00c){var _0x124ec0={'role':_0x1ffb22[_0x87a8('0x8e')][_0x87a8('0x8f')],'userProfileId':_0x1ffb22[_0x87a8('0x8e')][_0x87a8('0x90')]};if(!_0x124ec0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x124ec0[_0x87a8('0x8f')]===_0x87a8('0x91')){var _0x2e933a=_0x2bb00c[_0x87a8('0x27')]({'plain':!![]});return db[_0x87a8('0x92')][_0x87a8('0x4c')]({'where':{'name':_0x87a8('0x28'),'userProfileId':_0x124ec0['userProfileId']},'raw':!![]})['then'](function(_0x53b8c7){if(_0x53b8c7&&_0x53b8c7[_0x87a8('0x93')]===0x0){return db[_0x87a8('0x29')][_0x87a8('0x8d')]({'name':_0x2e933a[_0x87a8('0x2c')],'resourceId':_0x2e933a['id'],'type':_0x53b8c7['name'],'sectionId':_0x53b8c7['id']},{})[_0x87a8('0x25')](function(){return _0x2bb00c;});}else{return _0x2bb00c;}})[_0x87a8('0x48')](function(_0x4d90d4){logger[_0x87a8('0x2a')](_0x87a8('0x94'),_0x4d90d4);throw _0x4d90d4;});}return _0x2bb00c;})[_0x87a8('0x25')](respondWithResult(_0x3151f2,null))[_0x87a8('0x48')](handleError(_0x3151f2,null));}});}catch(_0x932b2a){_0x3151f2['status'](0x1f4)[_0x87a8('0x2d')](_0x932b2a);}};function removeReferences(_0x32930d,_0x5427d4){try{if(_0x32930d){fs[_0x87a8('0x66')](_0x32930d);logger[_0x87a8('0x67')]('Zip\x20archive\x20removed');}if(_0x5427d4){rimraf(_0x5427d4,function(){});logger['info'](_0x87a8('0x95'));}}catch(_0x4704fd){logger[_0x87a8('0x2a')](_0x4704fd);}}exports[_0x87a8('0x24')]=function(_0x534ef5,_0x5e3614,_0x2b944e){return db[_0x87a8('0x2f')]['find']({'where':{'id':_0x534ef5[_0x87a8('0x49')]['id']}})[_0x87a8('0x25')](handleEntityNotFound(_0x5e3614,null))['then'](saveUpdates(_0x534ef5[_0x87a8('0x8e')],null))[_0x87a8('0x25')](respondWithResult(_0x5e3614,null))[_0x87a8('0x48')](handleError(_0x5e3614,null));};exports[_0x87a8('0x96')]=function(_0x1e2a26,_0x500498,_0x4c03ce){return db[_0x87a8('0x2f')][_0x87a8('0x4c')]({'where':{'id':_0x1e2a26['params']['id']}})['then'](function(_0x101898){if(_0x101898){return _0x101898[_0x87a8('0x26')]();}})[_0x87a8('0x25')](function(_0x151a35){rimraf(path['join'](config[_0x87a8('0x4e')],_0x87a8('0x4f'),path[_0x87a8('0x5b')](_0x151a35['path'])),function(){});return _0x151a35;})[_0x87a8('0x25')](handleEntityNotFound(_0x500498,null))[_0x87a8('0x25')](respondWithStatusCode(_0x500498,null))[_0x87a8('0x48')](handleError(_0x500498,null));};exports['webhookGet']=function(_0x518bd7,_0x423c30,_0x56d895){return BPromise[_0x87a8('0x97')]()[_0x87a8('0x25')](function(){if(!_0x518bd7[_0x87a8('0x36')][_0x87a8('0x5c')]){throw new Error(_0x87a8('0x98'));}if(!_0x518bd7['query']['port']){throw new Error(_0x87a8('0x99'));}var _0x2a2ccd=_0x518bd7[_0x87a8('0x36')][_0x87a8('0x9a')]?_0x518bd7[_0x87a8('0x36')][_0x87a8('0x9a')]+':'+_0x518bd7['query']['port']:'http://localhost:'+_0x518bd7[_0x87a8('0x36')][_0x87a8('0x9b')];var _0x283f65=_0x518bd7['query'][_0x87a8('0x1c')]?_0x518bd7[_0x87a8('0x36')]['json']:!![];var _0x352785=_0x518bd7['query'][_0x87a8('0x9c')]?_0x518bd7[_0x87a8('0x36')][_0x87a8('0x9c')]:null;var _0x58c777={'method':_0x518bd7[_0x87a8('0x9d')],'uri':util['format'](_0x87a8('0x9e'),_0x2a2ccd,_0x518bd7[_0x87a8('0x36')][_0x87a8('0x5c')]),'json':_0x283f65,'resolveWithFullResponse':!![],'encoding':_0x352785,'qs':_0x518bd7[_0x87a8('0x36')]};if(_0x518bd7[_0x87a8('0x9f')]){_0x58c777['headers']=_0x518bd7[_0x87a8('0x9f')];if(_0x58c777[_0x87a8('0x9f')][_0x87a8('0xa0')]){delete _0x58c777[_0x87a8('0x9f')][_0x87a8('0xa0')];}}if(_0x58c777[_0x87a8('0x9f')][_0x87a8('0xa1')]){delete _0x58c777[_0x87a8('0x9f')][_0x87a8('0xa1')];}return rp(_0x58c777);})['then'](function(_0x43a862){if(_0x43a862){_0x423c30[_0x87a8('0x1f')](_0x43a862[_0x87a8('0x9f')]);logger[_0x87a8('0x67')](_0x43a862[_0x87a8('0x8e')]);if(_[_0x87a8('0xa2')](_0x518bd7[_0x87a8('0x36')][_0x87a8('0x5c')],'download')&&_0x43a862['statusCode']==0x1f4){return _0x423c30[_0x87a8('0x1a')](_0x43a862[_0x87a8('0xa3')]);}else{return _0x423c30[_0x87a8('0x1b')](_0x43a862[_0x87a8('0xa3')])[_0x87a8('0x2d')](_0x43a862[_0x87a8('0x8e')]);}}else{return _0x423c30[_0x87a8('0x1a')](0xc8);}})[_0x87a8('0x48')](handleError(_0x423c30,null));};exports[_0x87a8('0xa4')]=function(_0x976769,_0x100d36,_0x53d4e1){return BPromise[_0x87a8('0x97')]()['then'](function(){if(!_0x976769[_0x87a8('0x36')]['path']){throw new Error(_0x87a8('0x98'));}if(!_0x976769[_0x87a8('0x36')][_0x87a8('0x9b')]){throw new Error(_0x87a8('0x99'));}var _0x54b343=_0x976769['query'][_0x87a8('0x9a')]?_0x976769[_0x87a8('0x36')][_0x87a8('0x9a')]+':'+_0x976769['query'][_0x87a8('0x9b')]:'http://localhost:'+_0x976769[_0x87a8('0x36')]['port'];var _0x11e4ee=_0x976769[_0x87a8('0x36')][_0x87a8('0x1c')]?_0x976769[_0x87a8('0x36')][_0x87a8('0x1c')]:!![];var _0x21a8d7=_0x976769['query'][_0x87a8('0x9c')]?_0x976769[_0x87a8('0x36')][_0x87a8('0x9c')]:null;var _0x4948c0={'method':_0x976769['method'],'uri':util[_0x87a8('0x50')](_0x87a8('0x9e'),_0x54b343,_0x976769['query'][_0x87a8('0x5c')]),'json':_0x11e4ee,'resolveWithFullResponse':!![],'encoding':_0x21a8d7,'body':_0x976769['body']};if(_0x976769[_0x87a8('0x9f')]){_0x4948c0[_0x87a8('0x9f')]=_0x976769[_0x87a8('0x9f')];if(_0x4948c0['headers']['content-length']){delete _0x4948c0[_0x87a8('0x9f')]['content-length'];}}if(_0x4948c0['headers'][_0x87a8('0xa1')]){delete _0x4948c0['headers'][_0x87a8('0xa1')];}return rp(_0x4948c0);})[_0x87a8('0x25')](function(_0x4d98fd){if(_0x4d98fd){_0x100d36[_0x87a8('0x1f')](_0x4d98fd[_0x87a8('0x9f')]);logger['info'](_0x4d98fd[_0x87a8('0x8e')]);return _0x100d36[_0x87a8('0x1b')](_0x4d98fd[_0x87a8('0xa3')])[_0x87a8('0x2d')](_0x4d98fd[_0x87a8('0x8e')]);}else{return _0x100d36['sendStatus'](0xc8);}})[_0x87a8('0x48')](handleError(_0x100d36,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 13708d4..c5126e0 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 _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 +var _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x271332,_0x4876dd){var _0x35f689=function(_0x16aeb9){while(--_0x16aeb9){_0x271332['push'](_0x271332['shift']());}};_0x35f689(++_0x4876dd);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5f66[_0x2b4411];return _0x8e41ef;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x65f6('0x0'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){PluginEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);PluginEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index bdad68e..2eff931 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 _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 +var _0x8ef6=['exports','define','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./plugin.attributes'];(function(_0x28dbd6,_0x469c6d){var _0x583143=function(_0x2c7e8d){while(--_0x2c7e8d){_0x28dbd6['push'](_0x28dbd6['shift']());}};_0x583143(++_0x469c6d);}(_0x8ef6,0xf2));var _0x68ef=function(_0x58a61e,_0x44ef9f){_0x58a61e=_0x58a61e-0x0;var _0x27030d=_0x8ef6[_0x58a61e];return _0x27030d;};'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 diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 7a37681..4f32976 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 _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 +var _0xf1fb=['defaults','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreatePlugin','Plugin','body','options','raw','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0xf1fb,0x174));var _0xbf1f=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xf1fb[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require(_0xbf1f('0x0'));var util=require(_0xbf1f('0x1'));var moment=require(_0xbf1f('0x2'));var BPromise=require('bluebird');var rs=require(_0xbf1f('0x3'));var fs=require('fs');var Redis=require(_0xbf1f('0x4'));var db=require(_0xbf1f('0x5'))['db'];var utils=require(_0xbf1f('0x6'));var logger=require(_0xbf1f('0x7'))(_0xbf1f('0x8'));var config=require('../../config/environment');var jayson=require(_0xbf1f('0x9'));var client=jayson[_0xbf1f('0xa')][_0xbf1f('0xb')]({'port':0x232a});config[_0xbf1f('0xc')]=_[_0xbf1f('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbf1f('0xe'))(new Redis(config[_0xbf1f('0xc')]));require(_0xbf1f('0xf'))[_0xbf1f('0x10')](socket);function respondWithRpcPromise(_0x303f6d,_0x2cb60e,_0xbef57e){return new BPromise(function(_0x1cee6c,_0x414f57){return client[_0xbf1f('0x11')](_0x303f6d,_0xbef57e)[_0xbf1f('0x12')](function(_0x36bb2a){logger[_0xbf1f('0x13')](_0xbf1f('0x14'),_0x2cb60e,'request\x20sent');logger[_0xbf1f('0x15')](_0xbf1f('0x16'),_0x2cb60e,_0xbf1f('0x17'),JSON[_0xbf1f('0x18')](_0x36bb2a));if(_0x36bb2a[_0xbf1f('0x19')]){if(_0x36bb2a[_0xbf1f('0x19')][_0xbf1f('0x1a')]===0x1f4){logger[_0xbf1f('0x19')](_0xbf1f('0x14'),_0x2cb60e,_0x36bb2a['error']['message']);return _0x414f57(_0x36bb2a[_0xbf1f('0x19')][_0xbf1f('0x1b')]);}logger['error'](_0xbf1f('0x14'),_0x2cb60e,_0x36bb2a[_0xbf1f('0x19')]['message']);return _0x1cee6c(_0x36bb2a[_0xbf1f('0x19')]['message']);}else{logger[_0xbf1f('0x13')](_0xbf1f('0x14'),_0x2cb60e,'request\x20sent');_0x1cee6c(_0x36bb2a[_0xbf1f('0x1c')]['message']);}})['catch'](function(_0x241039){logger[_0xbf1f('0x19')]('Plugin,\x20%s,\x20%s',_0x2cb60e,_0x241039);_0x414f57(_0x241039);});});}exports[_0xbf1f('0x1d')]=function(_0x23b687){var _0x5bff90=this;return new Promise(function(_0x5e7913,_0x3c7554){return db[_0xbf1f('0x1e')]['create'](_0x23b687[_0xbf1f('0x1f')],{'raw':_0x23b687[_0xbf1f('0x20')]?_0x23b687['options'][_0xbf1f('0x21')]===undefined?!![]:![]:!![]})[_0xbf1f('0x12')](function(_0x2accfb){logger['info']('CreatePlugin',_0x23b687);logger[_0xbf1f('0x15')](_0xbf1f('0x1d'),_0x23b687,JSON[_0xbf1f('0x18')](_0x2accfb));_0x5e7913(_0x2accfb);})[_0xbf1f('0x22')](function(_0x1198d7){logger['error'](_0xbf1f('0x1d'),_0x1198d7[_0xbf1f('0x1b')],_0x23b687);_0x3c7554(_0x5bff90['error'](0x1f4,_0x1198d7['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 0401969..278c79e 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 _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 +var _0xc0ef=['removeListener','register','length','plugin:','./plugin.events','save','remove','update','emit'];(function(_0x753dc7,_0x3f487f){var _0x2a109c=function(_0x238e48){while(--_0x238e48){_0x753dc7['push'](_0x753dc7['shift']());}};_0x2a109c(++_0x3f487f);}(_0xc0ef,0xee));var _0xfc0e=function(_0x37db66,_0x23b4ad){_0x37db66=_0x37db66-0x0;var _0x3fbaca=_0xc0ef[_0x37db66];return _0x3fbaca;};'use strict';var PluginEvents=require(_0xfc0e('0x0'));var events=[_0xfc0e('0x1'),_0xfc0e('0x2'),_0xfc0e('0x3')];function createListener(_0x204877,_0x18fdd9){return function(_0x5c1851){_0x18fdd9[_0xfc0e('0x4')](_0x204877,_0x5c1851);};}function removeListener(_0x1187cd,_0x2c13ed){return function(){PluginEvents[_0xfc0e('0x5')](_0x1187cd,_0x2c13ed);};}exports[_0xfc0e('0x6')]=function(_0x3b2cc0){for(var _0x5efd00=0x0,_0x11e8ed=events[_0xfc0e('0x7')];_0x5efd00<_0x11e8ed;_0x5efd00++){var _0x51d9bf=events[_0x5efd00];var _0x2d600d=createListener(_0xfc0e('0x8')+_0x51d9bf,_0x3b2cc0);PluginEvents['on'](_0x51d9bf,_0x2d600d);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 4f38433..8ccff7c 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 _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 +var _0xd14e=['update','delete','destroy','exports','express','Router','./pm2.controller','get','isAuthenticated','create','put','/:id'];(function(_0x34aa84,_0x5ec2b6){var _0x5f4442=function(_0x5dc960){while(--_0x5dc960){_0x34aa84['push'](_0x34aa84['shift']());}};_0x5f4442(++_0x5ec2b6);}(_0xd14e,0x19c));var _0xed14=function(_0x5cd3b5,_0x3fda6d){_0x5cd3b5=_0x5cd3b5-0x0;var _0x508a31=_0xd14e[_0x5cd3b5];return _0x508a31;};'use strict';var express=require(_0xed14('0x0'));var router=express[_0xed14('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xed14('0x2'));router[_0xed14('0x3')]('/',auth[_0xed14('0x4')](),controller['index']);router[_0xed14('0x3')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xed14('0x4')](),controller[_0xed14('0x5')]);router[_0xed14('0x6')](_0xed14('0x7'),auth[_0xed14('0x4')](),controller[_0xed14('0x8')]);router[_0xed14('0x9')]('/:id',auth[_0xed14('0x4')](),controller[_0xed14('0xa')]);module[_0xed14('0xb')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 159b623..b6b99f5 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 _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 +var _0xb983=['update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','name','send','npm\x20install','info','list','reject','catch','show','params','then','create','body','script','join','cwd','chdir','start','dump'];(function(_0x5440e5,_0x56fac9){var _0x6c5beb=function(_0x381227){while(--_0x381227){_0x5440e5['push'](_0x5440e5['shift']());}};_0x6c5beb(++_0x56fac9);}(_0xb983,0x19f));var _0x3b98=function(_0x53b594,_0x559767){_0x53b594=_0x53b594-0x0;var _0x1e616f=_0xb983[_0x53b594];return _0x1e616f;};'use strict';var _=require(_0x3b98('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x3b98('0x1'))(_0x3b98('0x2'));var path=require(_0x3b98('0x3'));var exec=require(_0x3b98('0x4'))[_0x3b98('0x5')];var BPromise=require(_0x3b98('0x6'));function handleEntityNotFound(_0x521bbb,_0x2373d6){return function(_0x5457b0){if(!_0x5457b0){_0x521bbb[_0x3b98('0x7')](0x194);;}return _0x5457b0;};}function respondWithResult(_0x134d27,_0x42901e){_0x42901e=_0x42901e||0xc8;return function(_0xbc272d){if(_0xbc272d){return _0x134d27[_0x3b98('0x8')](_0x42901e)[_0x3b98('0x9')](_0xbc272d);}return null;};}function handleError(_0x22eebc,_0x2fb257){_0x2fb257=_0x2fb257||0x1f4;return function(_0x25ce87){logger[_0x3b98('0xa')](_0x25ce87['stack']);if(_0x25ce87[_0x3b98('0xb')]){delete _0x25ce87[_0x3b98('0xb')];}_0x22eebc['status'](_0x2fb257)[_0x3b98('0xc')](_0x25ce87);};}function execChildProcess(){return new BPromise(function(_0x4946ca,_0x46f794){exec(_0x3b98('0xd'),function(_0x102735,_0x5cddf5,_0x20e6d7){logger['info'](_0x5cddf5);logger[_0x3b98('0xe')](_0x20e6d7);if(_0x102735){logger[_0x3b98('0xa')](_0x102735);return _0x46f794(_0x102735);}return _0x4946ca(_0x5cddf5);});});}exports['index']=function(_0x32f622,_0x3e0419){return pm2[_0x3b98('0xf')]()['then'](function(_0x1674a3){if(_0x1674a3){var _0x4edc88=_[_0x3b98('0x10')](_0x1674a3,function(_0x57f265){return _0x57f265[_0x3b98('0xb')]==='express'||_0x57f265[_0x3b98('0xb')]==='motion2';});return{'rows':_0x4edc88,'count':_0x4edc88['length']};}return null;})['then'](respondWithResult(_0x3e0419,null))[_0x3b98('0x11')](handleError(_0x3e0419,null));};exports[_0x3b98('0x12')]=function(_0xbddb91,_0x51f3aa){return pm2['describe'](_0xbddb91[_0x3b98('0x13')]['id'])['then'](respondWithResult(_0x51f3aa,null))[_0x3b98('0x14')](handleEntityNotFound(_0x51f3aa,null))['catch'](handleError(_0x51f3aa,null));};exports[_0x3b98('0x15')]=function(_0x1d2e83,_0x2950a9){if(_0x1d2e83[_0x3b98('0x16')][_0x3b98('0xb')]&&_0x1d2e83[_0x3b98('0x16')][_0x3b98('0x17')]){var _0x348fbd=path[_0x3b98('0x18')](__dirname,'../../files/plugins',_0x1d2e83['body'][_0x3b98('0x17')]);var _0x4de00e=process[_0x3b98('0x19')]();process['chdir'](path['dirname'](_0x348fbd));return execChildProcess()[_0x3b98('0x14')](function(_0x200a60){process[_0x3b98('0x1a')](_0x4de00e);return pm2[_0x3b98('0x1b')]({'name':_0x1d2e83[_0x3b98('0x16')][_0x3b98('0xb')],'script':_0x348fbd});})[_0x3b98('0x14')](function(_0x54c35e){pm2[_0x3b98('0x1c')]();return _0x54c35e[0x0];})[_0x3b98('0x14')](respondWithResult(_0x2950a9,0xc9))[_0x3b98('0x11')](handleError(_0x2950a9,null));}else{return _0x2950a9['status'](0x1f4)[_0x3b98('0xc')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x3b98('0x1d')]=function(_0x3edaec,_0x1be8e8){if(_0x3edaec[_0x3b98('0x16')]['id']){delete _0x3edaec[_0x3b98('0x16')]['id'];}var _0x42f036={'online':_0x3b98('0x1e'),'stopped':_0x3b98('0x1f')};if(_0x42f036[_0x3b98('0x20')](_0x3edaec[_0x3b98('0x16')][_0x3b98('0x8')])){return pm2[_0x42f036[_0x3edaec['body']['status']]](_0x3edaec[_0x3b98('0x13')]['id'])[_0x3b98('0x14')](respondWithResult(_0x1be8e8,0xc8))['catch'](handleError(_0x1be8e8,null));}else{return _0x1be8e8[_0x3b98('0x8')](0x1f4)[_0x3b98('0xc')]({'message':_0x3b98('0x21')});}};exports[_0x3b98('0x22')]=function(_0x50bd11,_0x3ad32b){if(_0x50bd11[_0x3b98('0x16')]['id']){delete _0x50bd11['body']['id'];}if(_0x50bd11[_0x3b98('0x13')]['id']){return pm2[_0x3b98('0x23')](_0x50bd11[_0x3b98('0x13')]['id'])[_0x3b98('0x14')](function(_0x4ebd9b){pm2[_0x3b98('0x1c')]();return _0x4ebd9b[0x0];})[_0x3b98('0x14')](respondWithResult(_0x3ad32b,null))[_0x3b98('0x11')](handleError(_0x3ad32b,null));}else{return _0x3ad32b[_0x3b98('0x8')](0x1f4)[_0x3b98('0xc')]({'message':_0x3b98('0x24')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index b5ca4e2..16d4ba9 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 _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 +var _0x386b=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','path','connect-timeout','express'];(function(_0x1bc3dc,_0x48aa24){var _0x1b4af8=function(_0x365c85){while(--_0x365c85){_0x1bc3dc['push'](_0x1bc3dc['shift']());}};_0x1b4af8(++_0x48aa24);}(_0x386b,0xcb));var _0xb386=function(_0x5da4dd,_0x367f52){_0x5da4dd=_0x5da4dd-0x0;var _0x5d6cb5=_0x386b[_0x5da4dd];return _0x5d6cb5;};'use strict';var multer=require('multer');var util=require(_0xb386('0x0'));var path=require(_0xb386('0x1'));var timeout=require(_0xb386('0x2'));var express=require(_0xb386('0x3'));var router=express[_0xb386('0x4')]();var auth=require(_0xb386('0x5'));var interaction=require(_0xb386('0x6'));var config=require(_0xb386('0x7'));module[_0xb386('0x8')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index c6aebce..b752c35 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 _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 +var _0xbe58=['STRING','sequelize','exports','INTEGER','DATE'];(function(_0x130705,_0x2d266b){var _0x1fa991=function(_0x395639){while(--_0x395639){_0x130705['push'](_0x130705['shift']());}};_0x1fa991(++_0x2d266b);}(_0xbe58,0x196));var _0x8be5=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xbe58[_0xc4001c];return _0x49f7bc;};'use strict';var Sequelize=require(_0x8be5('0x0'));module[_0x8be5('0x1')]={'state':{'type':Sequelize[_0x8be5('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x8be5('0x3')]},'uniqueid':{'type':Sequelize[_0x8be5('0x4')]},'starttime':{'type':Sequelize[_0x8be5('0x3')]},'responsetime':{'type':Sequelize[_0x8be5('0x3')]},'ringtime':{'type':Sequelize[_0x8be5('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x8be5('0x4')]},'campaigntype':{'type':Sequelize[_0x8be5('0x4')]},'membername':{'type':Sequelize[_0x8be5('0x4')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index f5ae4c4..93d2435 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 _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 +var _0xb41c=['define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','request-promise','./reportAgentPreview.attributes'];(function(_0x15cff2,_0x13bb7c){var _0x1ed7af=function(_0x35519f){while(--_0x35519f){_0x15cff2['push'](_0x15cff2['shift']());}};_0x1ed7af(++_0x13bb7c);}(_0xb41c,0x150));var _0xcb41=function(_0x3eea23,_0x3472b7){_0x3eea23=_0x3eea23-0x0;var _0x1dc63a=_0xb41c[_0x3eea23];return _0x1dc63a;};'use strict';var _=require(_0xcb41('0x0'));var util=require(_0xcb41('0x1'));var logger=require(_0xcb41('0x2'))(_0xcb41('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcb41('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcb41('0x5'));module['exports']=function(_0x18dd7c,_0x2e46a7){return _0x18dd7c[_0xcb41('0x6')](_0xcb41('0x7'),attributes,{'tableName':_0xcb41('0x8'),'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 ebe40fb..26559b5 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 _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 +var _0xb2e5=['rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ReportAgentPreview,\x20%s,\x20%s','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0xb2e5,0x89));var _0x5b2e=function(_0x21d02a,_0x2c1ebe){_0x21d02a=_0x21d02a-0x0;var _0x32307e=_0xb2e5[_0x21d02a];return _0x32307e;};'use strict';var _=require(_0x5b2e('0x0'));var util=require(_0x5b2e('0x1'));var moment=require(_0x5b2e('0x2'));var BPromise=require(_0x5b2e('0x3'));var rs=require(_0x5b2e('0x4'));var fs=require('fs');var Redis=require(_0x5b2e('0x5'));var db=require(_0x5b2e('0x6'))['db'];var utils=require(_0x5b2e('0x7'));var logger=require('../../config/logger')(_0x5b2e('0x8'));var config=require(_0x5b2e('0x9'));var jayson=require(_0x5b2e('0xa'));var client=jayson[_0x5b2e('0xb')][_0x5b2e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x145a23,_0x5d3324,_0x2f4046){return new BPromise(function(_0xcebec3,_0x193356){return client['request'](_0x145a23,_0x2f4046)['then'](function(_0x34e123){logger[_0x5b2e('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x5d3324,_0x5b2e('0xe'));logger[_0x5b2e('0xf')](_0x5b2e('0x10'),_0x5d3324,'request\x20sent',JSON[_0x5b2e('0x11')](_0x34e123));if(_0x34e123['error']){if(_0x34e123[_0x5b2e('0x12')][_0x5b2e('0x13')]===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x5d3324,_0x34e123['error'][_0x5b2e('0x14')]);return _0x193356(_0x34e123[_0x5b2e('0x12')]['message']);}logger[_0x5b2e('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x5d3324,_0x34e123[_0x5b2e('0x12')]['message']);return _0xcebec3(_0x34e123[_0x5b2e('0x12')]['message']);}else{logger[_0x5b2e('0xd')](_0x5b2e('0x15'),_0x5d3324,_0x5b2e('0xe'));_0xcebec3(_0x34e123[_0x5b2e('0x16')][_0x5b2e('0x14')]);}})[_0x5b2e('0x17')](function(_0xdad0f4){logger[_0x5b2e('0x12')](_0x5b2e('0x15'),_0x5d3324,_0xdad0f4);_0x193356(_0xdad0f4);});});}exports[_0x5b2e('0x18')]=function(_0x3dc69a){var _0x453d8d=this;return new Promise(function(_0x154146,_0x590948){return db[_0x5b2e('0x19')][_0x5b2e('0x1a')](_0x3dc69a[_0x5b2e('0x1b')],{'raw':_0x3dc69a['options']?_0x3dc69a[_0x5b2e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x21ea7a){logger['info']('CreateReportAgentPreview',_0x3dc69a);logger[_0x5b2e('0xf')](_0x5b2e('0x18'),_0x3dc69a,JSON[_0x5b2e('0x11')](_0x21ea7a));_0x154146(_0x21ea7a);})[_0x5b2e('0x17')](function(_0x33c82c){logger[_0x5b2e('0x12')]('CreateReportAgentPreview',_0x33c82c[_0x5b2e('0x14')],_0x3dc69a);_0x590948(_0x453d8d['error'](0x1f4,_0x33c82c[_0x5b2e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 4b7e14d..6603cdb 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 _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 +var _0xa288=['/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','queueNotify','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','util','express','Router','../../components/auth/service','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','/outbound','outboundChannels','put','/agents/:id/capacity','/telephones','telephones','/trunks','trunks','campaigns'];(function(_0x3b1a52,_0x82c312){var _0x2bfca1=function(_0x3fd338){while(--_0x3fd338){_0x3b1a52['push'](_0x3b1a52['shift']());}};_0x2bfca1(++_0x82c312);}(_0xa288,0x6b));var _0x8a28=function(_0x31a910,_0x1f87b5){_0x31a910=_0x31a910-0x0;var _0x5024df=_0xa288[_0x31a910];return _0x5024df;};'use strict';var multer=require('multer');var util=require(_0x8a28('0x0'));var path=require('path');var express=require(_0x8a28('0x1'));var router=express[_0x8a28('0x2')]();var auth=require(_0x8a28('0x3'));var controller=require('./rpc.controller');router[_0x8a28('0x4')]('/voice/channels',auth[_0x8a28('0x5')](),controller[_0x8a28('0x6')]);router[_0x8a28('0x4')](_0x8a28('0x7'),auth[_0x8a28('0x5')](),controller['voiceChannelMixMonitor']);router[_0x8a28('0x4')](_0x8a28('0x8'),auth['isAuthenticated'](),controller['voiceChannelStopMixMonitor']);router[_0x8a28('0x4')](_0x8a28('0x9'),auth['isAuthenticated'](),controller[_0x8a28('0xa')]);router[_0x8a28('0x4')]('/chat/queues',auth[_0x8a28('0x5')](),controller[_0x8a28('0xb')]);router[_0x8a28('0x4')](_0x8a28('0xc'),auth[_0x8a28('0x5')](),controller[_0x8a28('0xd')]);router[_0x8a28('0x4')](_0x8a28('0xe'),auth['isAuthenticated'](),controller[_0x8a28('0xf')]);router[_0x8a28('0x4')](_0x8a28('0x10'),auth['isAuthenticated'](),controller['openchannelQueues']);router[_0x8a28('0x4')](_0x8a28('0x11'),auth['isAuthenticated'](),controller[_0x8a28('0x12')]);router['get'](_0x8a28('0x13'),auth[_0x8a28('0x5')](),controller[_0x8a28('0x14')]);router[_0x8a28('0x4')](_0x8a28('0x15'),auth['isAuthenticated'](),controller['faxQueues']);router[_0x8a28('0x4')](_0x8a28('0x16'),auth['isAuthenticated'](),controller[_0x8a28('0x17')]);router[_0x8a28('0x4')](_0x8a28('0x18'),auth[_0x8a28('0x5')](),controller[_0x8a28('0x19')]);router[_0x8a28('0x4')](_0x8a28('0x1a'),auth[_0x8a28('0x5')](),controller[_0x8a28('0x1b')]);router[_0x8a28('0x4')](_0x8a28('0x1c'),auth[_0x8a28('0x5')](),controller[_0x8a28('0x1d')]);router[_0x8a28('0x4')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x8a28('0x5')](),controller[_0x8a28('0x1e')]);router[_0x8a28('0x4')](_0x8a28('0x1f'),auth[_0x8a28('0x5')](),controller['showVoiceQueues']);router['get'](_0x8a28('0x20'),auth[_0x8a28('0x5')](),controller['outbound']);router[_0x8a28('0x4')]('/outbound/channels',auth[_0x8a28('0x5')](),controller[_0x8a28('0x21')]);router[_0x8a28('0x4')]('/agents',auth[_0x8a28('0x5')](),controller['agents']);router[_0x8a28('0x22')](_0x8a28('0x23'),auth[_0x8a28('0x5')](),controller['agentCapacity']);router['get'](_0x8a28('0x24'),auth[_0x8a28('0x5')](),controller[_0x8a28('0x25')]);router['get'](_0x8a28('0x26'),auth['isAuthenticated'](),controller[_0x8a28('0x27')]);router[_0x8a28('0x4')]('/campaigns',auth[_0x8a28('0x5')](),controller[_0x8a28('0x28')]);router[_0x8a28('0x4')](_0x8a28('0x29'),auth[_0x8a28('0x5')](),controller[_0x8a28('0x2a')]);router[_0x8a28('0x4')](_0x8a28('0x2b'),auth[_0x8a28('0x5')](),controller[_0x8a28('0x2c')]);router[_0x8a28('0x4')](_0x8a28('0x2d'),auth['isAuthenticated'](),controller['mailQueuesWaitingInteractions']);router[_0x8a28('0x4')](_0x8a28('0x2e'),auth[_0x8a28('0x5')](),controller[_0x8a28('0x2f')]);router[_0x8a28('0x4')](_0x8a28('0x30'),auth[_0x8a28('0x5')](),controller[_0x8a28('0x31')]);router[_0x8a28('0x4')]('/whatsapp/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x8a28('0x32')]);router['get']('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x8a28('0x33')]);router[_0x8a28('0x34')](_0x8a28('0x35'),auth[_0x8a28('0x5')](),controller['queueNotify'](_0x8a28('0x36')));router[_0x8a28('0x4')](_0x8a28('0x37'),auth['isAuthenticated'](),controller[_0x8a28('0x38')]);router[_0x8a28('0x34')]('/chat/queues/:id/notify',auth['isAuthenticated'](),controller[_0x8a28('0x39')](_0x8a28('0x3a')));router['get'](_0x8a28('0x3b'),auth[_0x8a28('0x5')](),controller[_0x8a28('0x3c')]);router[_0x8a28('0x34')]('/fax/queues/:id/notify',auth[_0x8a28('0x5')](),controller['queueNotify'](_0x8a28('0x3d')));router['get'](_0x8a28('0x3e'),auth[_0x8a28('0x5')](),controller['showFaxQueues']);router[_0x8a28('0x34')](_0x8a28('0x3f'),auth[_0x8a28('0x5')](),controller[_0x8a28('0x39')](_0x8a28('0x40')));router[_0x8a28('0x4')](_0x8a28('0x41'),auth[_0x8a28('0x5')](),controller['showOpenchannelQueues']);router[_0x8a28('0x34')](_0x8a28('0x42'),auth['isAuthenticated'](),controller[_0x8a28('0x39')]('sms'));router[_0x8a28('0x34')](_0x8a28('0x43'),auth[_0x8a28('0x5')](),controller[_0x8a28('0x39')](_0x8a28('0x44')));router[_0x8a28('0x4')](_0x8a28('0x45'),auth[_0x8a28('0x5')](),controller[_0x8a28('0x46')]);router['get'](_0x8a28('0x47'),auth[_0x8a28('0x5')](),controller[_0x8a28('0x48')]);router[_0x8a28('0x34')](_0x8a28('0x49'),auth[_0x8a28('0x5')](),controller['agentNotify']);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index b249315..d052c58 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 _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 +var _0xf0db=['WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','queueNotify','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Interaction','update','queue','MessageId','InteractionId','From','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','User','Agent\x20not\x20found','Message','messageId','\x20Message\x20not\x20found','TransferReport','Start','agent','agentTransferTimeout','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','catch','json','sendStatus','stack','name','status','isNil','find','voiceChannels','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','query','params','voiceQueues','VoiceQueues','showVoiceQueues','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','SIP/%s','interface','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','SmsQueues'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xf0db,0x112));var _0xbf0d=function(_0x4d27da,_0x2648d5){_0x4d27da=_0x4d27da-0x0;var _0x19f779=_0xf0db[_0x4d27da];return _0x19f779;};'use strict';var BPromise=require('bluebird');var moment=require(_0xbf0d('0x0'));var _=require(_0xbf0d('0x1'));var util=require('util');var db=require(_0xbf0d('0x2'))['db'];var logger=require(_0xbf0d('0x3'))(_0xbf0d('0x4'));var jayson=require(_0xbf0d('0x5'));var amiClient=jayson[_0xbf0d('0x6')][_0xbf0d('0x7')]({'port':0x232a});var mailClient=jayson[_0xbf0d('0x6')][_0xbf0d('0x7')]({'port':0x232b});var routingClient=jayson[_0xbf0d('0x6')][_0xbf0d('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x24a46c,_0x2e10fb,_0x420a4c){return new BPromise(function(_0x44e6ec,_0x418976){var _0x322424=_0x420a4c?_0x420a4c:amiClient;return _0x322424[_0xbf0d('0x8')](_0x24a46c,_0x2e10fb)[_0xbf0d('0x9')](function(_0x1312f3){if(_0x1312f3[_0xbf0d('0xa')]){if(_0x1312f3[_0xbf0d('0xa')][_0xbf0d('0xb')]===0x1f4){return _0x418976(_0x1312f3[_0xbf0d('0xa')][_0xbf0d('0xc')]);}return _0x44e6ec(_0x1312f3[_0xbf0d('0xa')][_0xbf0d('0xc')]);}else{_0x44e6ec(_0x1312f3['result']);}})[_0xbf0d('0xd')](function(_0x433164){_0x418976(_0x433164);});});}function respondWithResult(_0x34a485,_0x2269dc){_0x2269dc=_0x2269dc||0xc8;return function(_0x21d3f3){if(_0x21d3f3){return _0x34a485['status'](_0x2269dc)[_0xbf0d('0xe')](_0x21d3f3);}return _0x34a485[_0xbf0d('0xf')](0x194);};}function handleError(_0x3bf110,_0xfe1e25){_0xfe1e25=_0xfe1e25||0x1f4;return function(_0x331a3d){logger['error'](_0x331a3d[_0xbf0d('0x10')]);if(_0x331a3d[_0xbf0d('0x11')]){delete _0x331a3d[_0xbf0d('0x11')];}_0x3bf110[_0xbf0d('0x12')](_0xfe1e25)['send'](_0x331a3d);};}function findById(_0x518f29){return function(_0xf7b86e){if(!_[_0xbf0d('0x13')](_0x518f29)&&!_[_0xbf0d('0x13')](_0xf7b86e)&&!_[_0xbf0d('0x13')](_0xf7b86e['rows'])){return _[_0xbf0d('0x14')](_0xf7b86e['rows'],function(_0x4ef290){return _0x4ef290['id']==_0x518f29;});}return null;};}exports[_0xbf0d('0x15')]=function(_0x2a78c4,_0x52d154){return respondWithRpcPromise('VoiceChannels',_0x2a78c4['query'])[_0xbf0d('0x9')](respondWithResult(_0x52d154,null))[_0xbf0d('0xd')](handleError(_0x52d154,null));};exports[_0xbf0d('0x16')]=function(_0x32c625,_0x898b75){return respondWithRpcPromise(_0xbf0d('0x17'),_[_0xbf0d('0x18')](_0x32c625['query'],_0x32c625['params']))[_0xbf0d('0x9')](respondWithResult(_0x898b75,null))[_0xbf0d('0xd')](handleError(_0x898b75,null));};exports[_0xbf0d('0x19')]=function(_0x26d604,_0x586f2c){return respondWithRpcPromise(_0xbf0d('0x1a'),_[_0xbf0d('0x18')](_0x26d604[_0xbf0d('0x1b')],_0x26d604[_0xbf0d('0x1c')]))[_0xbf0d('0x9')](respondWithResult(_0x586f2c,null))[_0xbf0d('0xd')](handleError(_0x586f2c,null));};exports[_0xbf0d('0x1d')]=function(_0x39e7c0,_0x184868){return respondWithRpcPromise(_0xbf0d('0x1e'),_0x39e7c0[_0xbf0d('0x1b')])[_0xbf0d('0x9')](respondWithResult(_0x184868,null))['catch'](handleError(_0x184868,null));};exports[_0xbf0d('0x1f')]=function(_0x309eee,_0xad8fd3){return respondWithRpcPromise('VoiceQueues',_0x309eee[_0xbf0d('0x1b')])[_0xbf0d('0x9')](findById(_0x309eee['params']['id']))[_0xbf0d('0x9')](respondWithResult(_0xad8fd3,null))[_0xbf0d('0xd')](handleError(_0xad8fd3,null));};exports['voiceQueuesPreview']=function(_0x116e64,_0x4b12b5){return respondWithRpcPromise(_0xbf0d('0x20'),_['merge'](_0x116e64[_0xbf0d('0x1b')],_0x116e64[_0xbf0d('0x1c')]))['then'](respondWithResult(_0x4b12b5,null))[_0xbf0d('0xd')](handleError(_0x4b12b5,null));};exports[_0xbf0d('0x21')]=function(_0x2ae600,_0x365547){return respondWithRpcPromise('VoiceQueuesChannels',_0x2ae600[_0xbf0d('0x1b')])[_0xbf0d('0x9')](respondWithResult(_0x365547,null))[_0xbf0d('0xd')](handleError(_0x365547,null));};exports[_0xbf0d('0x22')]=function(_0x429213,_0x4fe150){return respondWithRpcPromise(_0xbf0d('0x23'),_[_0xbf0d('0x18')](_0x429213[_0xbf0d('0x1b')],_0x429213[_0xbf0d('0x1c')]))['then'](respondWithResult(_0x4fe150,null))[_0xbf0d('0xd')](handleError(_0x4fe150,null));};exports[_0xbf0d('0x24')]=function(_0x5e1d30,_0x261ae4){return respondWithRpcPromise(_0xbf0d('0x25'),_['merge'](_0x5e1d30[_0xbf0d('0x1b')],_0x5e1d30[_0xbf0d('0x1c')]))[_0xbf0d('0x9')](respondWithResult(_0x261ae4,null))[_0xbf0d('0xd')](handleError(_0x261ae4,null));};exports[_0xbf0d('0x26')]=function(_0x5e8d09,_0x225fce){return respondWithRpcPromise(_0xbf0d('0x27'),_[_0xbf0d('0x18')](_0x5e8d09['query'],_0x5e8d09['params']))[_0xbf0d('0x9')](respondWithResult(_0x225fce,null))[_0xbf0d('0xd')](handleError(_0x225fce,null));};exports[_0xbf0d('0x28')]=function(_0x96a4ac,_0x3ed097){return respondWithRpcPromise('Outbound',_0x96a4ac['query'])[_0xbf0d('0x9')](respondWithResult(_0x3ed097,null))[_0xbf0d('0xd')](handleError(_0x3ed097,null));};exports[_0xbf0d('0x29')]=function(_0xb635f5,_0xc267e9){return respondWithRpcPromise(_0xbf0d('0x2a'),_0xb635f5[_0xbf0d('0x1b')])[_0xbf0d('0x9')](respondWithResult(_0xc267e9,null))['catch'](handleError(_0xc267e9,null));};exports[_0xbf0d('0x2b')]=function(_0x399fc0,_0x12c4a2){var _0x50ceae;return respondWithRpcPromise(_0xbf0d('0x2c'),_0x399fc0['query'])['then'](function(_0x2cfa24){_0x50ceae=_0x2cfa24;return respondWithRpcPromise(_0xbf0d('0x2c'),_0x399fc0[_0xbf0d('0x1b')],routingClient);})[_0xbf0d('0x9')](function(_0x2b1e88){return _['merge']({},_0x2b1e88,_0x50ceae);})['then'](respondWithResult(_0x12c4a2,null))['catch'](handleError(_0x12c4a2,null));};exports[_0xbf0d('0x2d')]=function(_0x173a59,_0x862d84){if(_0x173a59[_0xbf0d('0x2e')]&&_0x173a59[_0xbf0d('0x2e')][_0xbf0d('0x2f')]&&_0x173a59[_0xbf0d('0x30')]&&_0x173a59[_0xbf0d('0x30')][_0xbf0d('0x11')]){for(var _0x383680 in _0x173a59[_0xbf0d('0x2e')]['interaction']){if(_0x173a59[_0xbf0d('0x2e')]['interaction'][_0xbf0d('0x31')](_0x383680)){db[_0xbf0d('0x32')]['findAll']({'where':{'channel':_0x383680,'membername':_0x173a59[_0xbf0d('0x30')]['name'],'type':_0xbf0d('0x33'),'exitAt':null,'uniqueid':_0x173a59['body'][_0xbf0d('0x2f')][_0x383680]&&_0x173a59['body'][_0xbf0d('0x2f')][_0x383680][_0xbf0d('0x34')]?{'$notIn':_0x173a59['body'][_0xbf0d('0x2f')][_0x383680]}:{'$ne':null}}})['then'](function(_0x6d8a60){var _0x102197=moment()[_0xbf0d('0x35')](_0xbf0d('0x36'));for(var _0x3c996b=0x0,_0x2d6c8d=_0x6d8a60[_0xbf0d('0x34')];_0x3c996b<_0x2d6c8d;_0x3c996b+=0x1){_0x6d8a60[_0x3c996b][_0xbf0d('0x37')]({'exitAt':_0x102197});}});for(var _0x5ec2c2=0x0;_0x5ec2c2<_0x173a59[_0xbf0d('0x2e')][_0xbf0d('0x2f')][_0x383680][_0xbf0d('0x34')];_0x5ec2c2+=0x1){db[_0xbf0d('0x32')][_0xbf0d('0x38')]({'where':{'channel':_0x383680,'membername':_0x173a59[_0xbf0d('0x30')][_0xbf0d('0x11')],'type':_0xbf0d('0x33'),'uniqueid':_0x173a59[_0xbf0d('0x2e')][_0xbf0d('0x2f')][_0x383680][_0x5ec2c2],'exitAt':null},'defaults':{'channel':_0x383680,'membername':_0x173a59['user'][_0xbf0d('0x11')],'interface':_[_0xbf0d('0x13')](_0x173a59['user']['interface'])?util['format'](_0xbf0d('0x39'),_0x173a59[_0xbf0d('0x30')][_0xbf0d('0x11')]):_0x173a59[_0xbf0d('0x30')][_0xbf0d('0x3a')],'type':'INTERACTION','enterAt':moment()[_0xbf0d('0x35')](_0xbf0d('0x36')),'role':'agent','internal':_0x173a59['user'][_0xbf0d('0x3b')],'uniqueid':_0x173a59[_0xbf0d('0x2e')]['interaction'][_0x383680][_0x5ec2c2]}});}}}}return respondWithRpcPromise(_0xbf0d('0x3c'),{'id':_0x173a59[_0xbf0d('0x1c')]['id'],'capacity':_0x173a59[_0xbf0d('0x2e')][_0xbf0d('0x3d')]},routingClient)[_0xbf0d('0x9')](respondWithResult(_0x862d84,null))[_0xbf0d('0xd')](handleError(_0x862d84,null));};exports[_0xbf0d('0x3e')]=function(_0x528304,_0x5a8e8c){return respondWithRpcPromise(_0xbf0d('0x3f'),_0x528304[_0xbf0d('0x1b')])[_0xbf0d('0x9')](respondWithResult(_0x5a8e8c,null))['catch'](handleError(_0x5a8e8c,null));};exports[_0xbf0d('0x40')]=function(_0x34f7e1,_0x27232b){return respondWithRpcPromise(_0xbf0d('0x41'),_0x34f7e1[_0xbf0d('0x1b')])[_0xbf0d('0x9')](respondWithResult(_0x27232b,null))[_0xbf0d('0xd')](handleError(_0x27232b,null));};exports['campaigns']=function(_0x113233,_0x1a253e){return respondWithRpcPromise(_0xbf0d('0x42'),_0x113233[_0xbf0d('0x1b')])[_0xbf0d('0x9')](respondWithResult(_0x1a253e,null))[_0xbf0d('0xd')](handleError(_0x1a253e,null));};exports[_0xbf0d('0x43')]=function(_0x4e2b38,_0xd46d91){return respondWithRpcPromise(_0xbf0d('0x44'),_0x4e2b38[_0xbf0d('0x1b')],routingClient)[_0xbf0d('0x9')](respondWithResult(_0xd46d91,null))[_0xbf0d('0xd')](handleError(_0xd46d91,null));};exports['showChatQueues']=function(_0x3218fe,_0xdc7fab){return respondWithRpcPromise(_0xbf0d('0x44'),_0x3218fe[_0xbf0d('0x1b')],routingClient)[_0xbf0d('0x9')](findById(_0x3218fe[_0xbf0d('0x1c')]['id']))['then'](respondWithResult(_0xdc7fab,null))['catch'](handleError(_0xdc7fab,null));};exports[_0xbf0d('0x45')]=function(_0xd95760,_0x40c3e3){return respondWithRpcPromise(_0xbf0d('0x46'),_0xd95760[_0xbf0d('0x1b')],routingClient)[_0xbf0d('0x9')](respondWithResult(_0x40c3e3,null))[_0xbf0d('0xd')](handleError(_0x40c3e3,null));};exports[_0xbf0d('0x47')]=function(_0x81cf29,_0x3e9c7d){return respondWithRpcPromise(_0xbf0d('0x46'),_0x81cf29[_0xbf0d('0x1b')],routingClient)['then'](findById(_0x81cf29[_0xbf0d('0x1c')]['id']))[_0xbf0d('0x9')](respondWithResult(_0x3e9c7d,null))[_0xbf0d('0xd')](handleError(_0x3e9c7d,null));};exports[_0xbf0d('0x48')]=function(_0x4d6c2e,_0x47b556){return respondWithRpcPromise(_0xbf0d('0x49'),_0x4d6c2e['query'],mailClient)['then'](respondWithResult(_0x47b556,null))[_0xbf0d('0xd')](handleError(_0x47b556,null));};exports['openchannelQueues']=function(_0x41b161,_0x40e068){return respondWithRpcPromise(_0xbf0d('0x4a'),_0x41b161['query'],routingClient)[_0xbf0d('0x9')](respondWithResult(_0x40e068,null))['catch'](handleError(_0x40e068,null));};exports[_0xbf0d('0x4b')]=function(_0x23c6d6,_0x4feb20){return respondWithRpcPromise(_0xbf0d('0x4a'),_0x23c6d6[_0xbf0d('0x1b')],routingClient)[_0xbf0d('0x9')](findById(_0x23c6d6['params']['id']))[_0xbf0d('0x9')](respondWithResult(_0x4feb20,null))[_0xbf0d('0xd')](handleError(_0x4feb20,null));};exports['smsQueues']=function(_0x3365ba,_0x451235){return respondWithRpcPromise('SmsQueues',_0x3365ba[_0xbf0d('0x1b')],routingClient)[_0xbf0d('0x9')](respondWithResult(_0x451235,null))[_0xbf0d('0xd')](handleError(_0x451235,null));};exports['showSmsQueues']=function(_0x290b61,_0x181f1e){return respondWithRpcPromise(_0xbf0d('0x4c'),_0x290b61[_0xbf0d('0x1b')],routingClient)['then'](findById(_0x290b61['params']['id']))[_0xbf0d('0x9')](respondWithResult(_0x181f1e,null))['catch'](handleError(_0x181f1e,null));};exports['whatsappQueues']=function(_0x42ca12,_0x1e5768){return respondWithRpcPromise(_0xbf0d('0x4d'),_0x42ca12[_0xbf0d('0x1b')],routingClient)[_0xbf0d('0x9')](respondWithResult(_0x1e5768,null))['catch'](handleError(_0x1e5768,null));};exports[_0xbf0d('0x4e')]=function(_0xbc29bd,_0x5eea4b){return respondWithRpcPromise(_0xbf0d('0x4d'),_0xbc29bd['query'],routingClient)[_0xbf0d('0x9')](findById(_0xbc29bd['params']['id']))[_0xbf0d('0x9')](respondWithResult(_0x5eea4b,null))['catch'](handleError(_0x5eea4b,null));};exports['faxQueues']=function(_0x535134,_0x24e906){return respondWithRpcPromise(_0xbf0d('0x4f'),_0x535134['query'],routingClient)[_0xbf0d('0x9')](respondWithResult(_0x24e906,null))[_0xbf0d('0xd')](handleError(_0x24e906,null));};exports[_0xbf0d('0x50')]=function(_0x1a0258,_0x1a4335){return respondWithRpcPromise(_0xbf0d('0x4f'),_0x1a0258[_0xbf0d('0x1b')],routingClient)['then'](findById(_0x1a0258[_0xbf0d('0x1c')]['id']))[_0xbf0d('0x9')](respondWithResult(_0x1a4335,null))['catch'](handleError(_0x1a4335,null));};exports['faxAccounts']=function(_0x406f46,_0x569301){return respondWithRpcPromise(_0xbf0d('0x51'),_0x406f46['query'])[_0xbf0d('0x9')](respondWithResult(_0x569301,null))[_0xbf0d('0xd')](handleError(_0x569301,null));};exports['chatQueuesWaitingInteractions']=function(_0x15122e,_0x1b012b){return respondWithRpcPromise(_0xbf0d('0x52'),_0x15122e[_0xbf0d('0x1b')],routingClient)[_0xbf0d('0x9')](respondWithResult(_0x1b012b,null))[_0xbf0d('0xd')](handleError(_0x1b012b,null));};exports[_0xbf0d('0x53')]=function(_0x1047fd,_0x33aa0a){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x1047fd[_0xbf0d('0x1b')],routingClient)['then'](respondWithResult(_0x33aa0a,null))[_0xbf0d('0xd')](handleError(_0x33aa0a,null));};exports[_0xbf0d('0x54')]=function(_0x14ff50,_0x45ba40){return respondWithRpcPromise(_0xbf0d('0x55'),_0x14ff50[_0xbf0d('0x1b')],routingClient)['then'](respondWithResult(_0x45ba40,null))[_0xbf0d('0xd')](handleError(_0x45ba40,null));};exports['smsQueuesWaitingInteractions']=function(_0xd8e48f,_0x3c04b0){return respondWithRpcPromise(_0xbf0d('0x56'),_0xd8e48f[_0xbf0d('0x1b')],routingClient)['then'](respondWithResult(_0x3c04b0,null))[_0xbf0d('0xd')](handleError(_0x3c04b0,null));};exports[_0xbf0d('0x57')]=function(_0x1324cf,_0x1c1240){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x1324cf[_0xbf0d('0x1b')],routingClient)[_0xbf0d('0x9')](respondWithResult(_0x1c1240,null))[_0xbf0d('0xd')](handleError(_0x1c1240,null));};exports['faxQueuesWaitingInteractions']=function(_0x23acbf,_0x491e3a){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x23acbf[_0xbf0d('0x1b')],routingClient)[_0xbf0d('0x9')](respondWithResult(_0x491e3a,null))[_0xbf0d('0xd')](handleError(_0x491e3a,null));};exports[_0xbf0d('0x58')]=function(_0x41e70c){return function(_0x7b98ce,_0x4235b4){var _0x239425,_0xf421ba;var _0x3d93f8=_['capitalize'](_0x41e70c);var _0x4d6938=_0x41e70c===_0xbf0d('0x59')?_0xbf0d('0x5a'):_0xbf0d('0x5b');return db[_0x3d93f8+_0xbf0d('0x5c')][_0xbf0d('0x5d')]({'raw':!![],'where':{'id':_0x7b98ce[_0xbf0d('0x1c')]['id']}})[_0xbf0d('0x9')](function(_0x4da820){if(_[_0xbf0d('0x13')](_0x4da820)){throw new Error(_0x3d93f8+_0xbf0d('0x5e'));}_0x239425=_0x4da820;return db[_0x3d93f8+'Message'][_0xbf0d('0x5d')]({'where':{'id':_0x7b98ce['body']['messageId']},'include':[{'model':db[_0x3d93f8+'Interaction'],'as':_0xbf0d('0x5f')},{'model':db[_0x3d93f8+_0x4d6938],'as':_0xbf0d('0x5b')}]});})[_0xbf0d('0x9')](function(_0xef944f){if(_['isNil'](_0xef944f)){throw new Error(_0x3d93f8+'\x20Message\x20not\x20found');}_0xf421ba=_0xef944f;return _0xef944f[_0xbf0d('0x60')]({'read':0x0,'readAt':null,'UserId':null});})[_0xbf0d('0x9')](function(){var _0x35b2fb={'uniqueid':_0x41e70c+'.'+_0xf421ba['id']+'.'+_0xf421ba['Interaction']['id'],'FromUserId':_0x7b98ce[_0xbf0d('0x30')]['id'],'type':_0xbf0d('0x61')};_0x35b2fb[_0x3d93f8+_0xbf0d('0x62')]=_0xf421ba['id'];_0x35b2fb[_0x3d93f8+_0xbf0d('0x63')]=_0xf421ba['Interaction']['id'];_0x35b2fb[_0xbf0d('0x64')+_0x3d93f8+_0x4d6938+'Id']=_0xf421ba[_0xbf0d('0x5b')]['id'];_0x35b2fb['To'+_0x3d93f8+'QueueId']=_0x239425['id'];return db[_0x3d93f8+'TransferReport'][_0xbf0d('0x65')](_0x35b2fb);})[_0xbf0d('0x9')](function(){return respondWithRpcPromise('Start',{'channel':_0x41e70c,'interaction':_0xf421ba['Interaction'],'message':_0xf421ba,'account':_0xf421ba[_0xbf0d('0x5b')],'applications':[{'id':0x0,'priority':0x1,'app':_0xbf0d('0x61'),'appdata':_0x239425[_0xbf0d('0x11')]+','+(_0xf421ba[_0xbf0d('0x5b')][_0xbf0d('0x66')]||0x12c),'interval':_0xbf0d('0x67')}]},routingClient);})[_0xbf0d('0x9')](respondWithResult(_0x4235b4,null))[_0xbf0d('0xd')](handleError(_0x4235b4,null));};};exports[_0xbf0d('0x68')]=function(_0x4c212e,_0x309edd){var _0x5bc3bb,_0x1ea941;if(_[_0xbf0d('0x13')](_0x4c212e['body'][_0xbf0d('0x69')])){throw new Error(_0xbf0d('0x6a'));}var _0x3cedde=_0x4c212e[_0xbf0d('0x2e')]['channel'];var _0x40ac1b=_[_0xbf0d('0x6b')](_0x3cedde);var _0x188a30=_0x3cedde===_0xbf0d('0x59')?_0xbf0d('0x5a'):_0xbf0d('0x5b');return db[_0xbf0d('0x6c')][_0xbf0d('0x5d')]({'raw':!![],'where':{'id':_0x4c212e[_0xbf0d('0x1c')]['id'],'role':'agent'}})[_0xbf0d('0x9')](function(_0x5427b9){if(_['isNil'](_0x5427b9)){throw new Error(_0xbf0d('0x6d'));}_0x5bc3bb=_0x5427b9;return db[_0x40ac1b+_0xbf0d('0x6e')][_0xbf0d('0x5d')]({'where':{'id':_0x4c212e[_0xbf0d('0x2e')][_0xbf0d('0x6f')]},'include':[{'model':db[_0x40ac1b+_0xbf0d('0x5f')],'as':_0xbf0d('0x5f')},{'model':db[_0x40ac1b+_0x188a30],'as':_0xbf0d('0x5b')}]});})[_0xbf0d('0x9')](function(_0x39bd15){if(_['isNil'](_0x39bd15)){throw new Error(_0x40ac1b+_0xbf0d('0x70'));}_0x1ea941=_0x39bd15;return _0x39bd15[_0xbf0d('0x60')]({'read':0x0,'readAt':null,'UserId':null});})[_0xbf0d('0x9')](function(){var _0xe57d06={'uniqueid':_0x3cedde+'.'+_0x1ea941['id']+'.'+_0x1ea941[_0xbf0d('0x5f')]['id'],'FromUserId':_0x4c212e[_0xbf0d('0x30')]['id'],'type':'queue','ToUserId':_0x5bc3bb['id']};_0xe57d06[_0x40ac1b+_0xbf0d('0x62')]=_0x1ea941['id'];_0xe57d06[_0x40ac1b+'InteractionId']=_0x1ea941[_0xbf0d('0x5f')]['id'];_0xe57d06['From'+_0x40ac1b+_0x188a30+'Id']=_0x1ea941['Account']['id'];return db[_0x40ac1b+_0xbf0d('0x71')]['create'](_0xe57d06);})['then'](function(){return respondWithRpcPromise(_0xbf0d('0x72'),{'channel':_0x3cedde,'interaction':_0x1ea941[_0xbf0d('0x5f')],'message':_0x1ea941,'account':_0x1ea941[_0xbf0d('0x5b')],'applications':[{'id':0x0,'priority':0x1,'app':_0xbf0d('0x73'),'appdata':_0x5bc3bb[_0xbf0d('0x11')]+','+(_0x1ea941['Account'][_0xbf0d('0x74')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xbf0d('0x9')](respondWithResult(_0x309edd,null))[_0xbf0d('0xd')](handleError(_0x309edd,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 268e898..66cac8a 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 _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 +var _0x26b3=['isAuthenticated','index','get','/:id/run','run','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller'];(function(_0x130e1e,_0x5b87bc){var _0x50e0cc=function(_0xc202ee){while(--_0xc202ee){_0x130e1e['push'](_0x130e1e['shift']());}};_0x50e0cc(++_0x5b87bc);}(_0x26b3,0x115));var _0x326b=function(_0x353e23,_0x9a9a75){_0x353e23=_0x353e23-0x0;var _0x422cab=_0x26b3[_0x353e23];return _0x422cab;};'use strict';var multer=require(_0x326b('0x0'));var util=require(_0x326b('0x1'));var path=require(_0x326b('0x2'));var timeout=require(_0x326b('0x3'));var express=require('express');var router=express[_0x326b('0x4')]();var auth=require(_0x326b('0x5'));var interaction=require(_0x326b('0x6'));var config=require(_0x326b('0x7'));var controller=require(_0x326b('0x8'));router['get']('/',auth[_0x326b('0x9')](),controller[_0x326b('0xa')]);router[_0x326b('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x326b('0xb')](_0x326b('0xc'),auth['isAuthenticated'](),controller[_0x326b('0xd')]);router[_0x326b('0xe')]('/',auth[_0x326b('0x9')](),controller[_0x326b('0xf')]);router[_0x326b('0x10')]('/:id',auth[_0x326b('0x9')](),controller[_0x326b('0x11')]);router[_0x326b('0x12')](_0x326b('0x13'),auth[_0x326b('0x9')](),controller[_0x326b('0x14')]);module[_0x326b('0x15')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 4cd5b22..29986f5 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 _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 +var _0xdfa0=['hours','minutes','csv','pdf','xlsx','ENUM','default','custom','BOOLEAN','TEXT','sequelize','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','quarters','weeks','days'];(function(_0x4f1a18,_0x5e26cd){var _0x158bd7=function(_0x2bde23){while(--_0x2bde23){_0x4f1a18['push'](_0x4f1a18['shift']());}};_0x158bd7(++_0x5e26cd);}(_0xdfa0,0x69));var _0x0dfa=function(_0x2861f5,_0x4f83f3){_0x2861f5=_0x2861f5-0x0;var _0x4286f8=_0xdfa0[_0x2861f5];return _0x4286f8;};'use strict';var Sequelize=require(_0x0dfa('0x0'));module['exports']={'name':{'type':Sequelize[_0x0dfa('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x0dfa('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x0dfa('0x1')],'allowNull':![],'defaultValue':_0x0dfa('0x2')},'startAt':{'type':Sequelize[_0x0dfa('0x3')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x0dfa('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x0dfa('0x5'),_0x0dfa('0x6'),'months',_0x0dfa('0x7'),_0x0dfa('0x8'),_0x0dfa('0x9'),_0x0dfa('0xa')),'allowNull':![],'defaultValue':_0x0dfa('0x8')},'output':{'type':Sequelize['ENUM'](_0x0dfa('0xb'),_0x0dfa('0xc'),_0x0dfa('0xd')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x0dfa('0xe')]('custom',_0x0dfa('0xf')),'allowNull':![],'defaultValue':_0x0dfa('0x10')},'sendMail':{'type':Sequelize[_0x0dfa('0x11')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x0dfa('0x12')]},'bcc':{'type':Sequelize[_0x0dfa('0x12')]},'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 d9c432a..a6c6c05 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 _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 +var _0xfdf4=['squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','json','offset','set','Content-Range','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','index','Schedule','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash'];(function(_0x898ef8,_0x3d0ef9){var _0x3a55ed=function(_0x196629){while(--_0x196629){_0x898ef8['push'](_0x898ef8['shift']());}};_0x3a55ed(++_0x3d0ef9);}(_0xfdf4,0xef));var _0x4fdf=function(_0x1bd588,_0x3d22e9){_0x1bd588=_0x1bd588-0x0;var _0x2e3666=_0xfdf4[_0x1bd588];return _0x2e3666;};'use strict';var pdf=require(_0x4fdf('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4fdf('0x1'));var jsonpatch=require(_0x4fdf('0x2'));var rp=require(_0x4fdf('0x3'));var moment=require('moment');var BPromise=require(_0x4fdf('0x4'));var Mustache=require(_0x4fdf('0x5'));var util=require(_0x4fdf('0x6'));var path=require('path');var sox=require(_0x4fdf('0x7'));var csv=require('to-csv');var ejs=require(_0x4fdf('0x8'));var fs=require('fs');var _=require(_0x4fdf('0x9'));var squel=require(_0x4fdf('0xa'));var crypto=require(_0x4fdf('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4fdf('0xc'));var toCsv=require(_0x4fdf('0xd'));var querystring=require(_0x4fdf('0xe'));var Papa=require('papaparse');var Redis=require(_0x4fdf('0xf'));var authService=require(_0x4fdf('0x10'));var qs=require(_0x4fdf('0x11'));var as=require(_0x4fdf('0x12'));var hardwareService=require(_0x4fdf('0x13'));var logger=require(_0x4fdf('0x14'))(_0x4fdf('0x15'));var utils=require('../../config/utils');var config=require(_0x4fdf('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b5840,_0x2b646e){_0x2b646e=_0x2b646e||0xcc;return function(_0x281315){if(_0x281315){return _0x4b5840['sendStatus'](_0x2b646e);}return _0x4b5840[_0x4fdf('0x17')](_0x2b646e)[_0x4fdf('0x18')]();};}function respondWithResult(_0x36aa42,_0x530d55){_0x530d55=_0x530d55||0xc8;return function(_0x41ff59){if(_0x41ff59){return _0x36aa42[_0x4fdf('0x17')](_0x530d55)[_0x4fdf('0x19')](_0x41ff59);}};}function respondWithFilteredResult(_0x54e256,_0x4b51a4){return function(_0x5a9059){if(_0x5a9059){var _0x2e6a1e=_0x5a9059['count'],_0x3ab329=_0x4b51a4[_0x4fdf('0x1a')],_0x14685c=_0x4b51a4[_0x4fdf('0x1a')]+_0x4b51a4['limit'],_0x44869e;if(_0x14685c>=_0x2e6a1e){_0x14685c=_0x2e6a1e;_0x44869e=0xc8;}else{_0x44869e=0xce;}_0x54e256['status'](_0x44869e);return _0x54e256[_0x4fdf('0x1b')](_0x4fdf('0x1c'),_0x3ab329+'-'+_0x14685c+'/'+_0x2e6a1e)[_0x4fdf('0x19')](_0x5a9059);}return null;};}function patchUpdates(_0x28e7df){return function(_0x1ee4a1){try{jsonpatch['apply'](_0x1ee4a1,_0x28e7df,!![]);}catch(_0x913232){return BPromise[_0x4fdf('0x1d')](_0x913232);}return _0x1ee4a1[_0x4fdf('0x1e')]();};}function saveUpdates(_0xfab34,_0xa15656){return function(_0x3afc4f){if(_0x3afc4f){return _0x3afc4f[_0x4fdf('0x1f')](_0xfab34)[_0x4fdf('0x20')](function(_0x4617cf){return _0x4617cf;});}return null;};}function removeEntity(_0x33bd5d,_0x50d2bb){return function(_0xbbb040){if(_0xbbb040){return _0xbbb040[_0x4fdf('0x21')]()[_0x4fdf('0x20')](function(){var _0x4c4f1c=_0xbbb040[_0x4fdf('0x22')]({'plain':!![]});var _0x3638e8=_0x4fdf('0x23');return db[_0x4fdf('0x24')][_0x4fdf('0x21')]({'where':{'type':_0x3638e8,'resourceId':_0x4c4f1c['id']}})[_0x4fdf('0x20')](function(){return _0xbbb040;});})['then'](function(){_0x33bd5d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f37aa,_0xfc2869){return function(_0x31534c){if(!_0x31534c){_0x2f37aa['sendStatus'](0x194);}return _0x31534c;};}function handleError(_0x4267a4,_0x467e29){_0x467e29=_0x467e29||0x1f4;return function(_0x6b04a8){logger[_0x4fdf('0x25')](_0x6b04a8[_0x4fdf('0x26')]);if(_0x6b04a8[_0x4fdf('0x27')]){delete _0x6b04a8['name'];}_0x4267a4[_0x4fdf('0x17')](_0x467e29)[_0x4fdf('0x28')](_0x6b04a8);};}exports[_0x4fdf('0x29')]=function(_0x4c3a4c,_0x12a6b1){var _0x16f61a={},_0x56e564={},_0x1013ad={'count':0x0,'rows':[]};var _0x39cbcf=_['map'](db[_0x4fdf('0x2a')][_0x4fdf('0x2b')],function(_0x49e79d){return{'name':_0x49e79d['fieldName'],'type':_0x49e79d[_0x4fdf('0x2c')][_0x4fdf('0x2d')]};});_0x56e564[_0x4fdf('0x2e')]=_['map'](_0x39cbcf,_0x4fdf('0x27'));_0x56e564[_0x4fdf('0x2f')]=_['keys'](_0x4c3a4c[_0x4fdf('0x2f')]);_0x56e564[_0x4fdf('0x30')]=_[_0x4fdf('0x31')](_0x56e564[_0x4fdf('0x2e')],_0x56e564[_0x4fdf('0x2f')]);_0x16f61a[_0x4fdf('0x32')]=_['intersection'](_0x56e564['model'],qs[_0x4fdf('0x33')](_0x4c3a4c[_0x4fdf('0x2f')][_0x4fdf('0x33')]));_0x16f61a[_0x4fdf('0x32')]=_0x16f61a[_0x4fdf('0x32')][_0x4fdf('0x34')]?_0x16f61a[_0x4fdf('0x32')]:_0x56e564[_0x4fdf('0x2e')];if(!_0x4c3a4c['query'][_0x4fdf('0x35')]('nolimit')){_0x16f61a[_0x4fdf('0x36')]=qs[_0x4fdf('0x36')](_0x4c3a4c[_0x4fdf('0x2f')]['limit']);_0x16f61a['offset']=qs[_0x4fdf('0x1a')](_0x4c3a4c['query'][_0x4fdf('0x1a')]);}_0x16f61a[_0x4fdf('0x37')]=qs[_0x4fdf('0x38')](_0x4c3a4c[_0x4fdf('0x2f')][_0x4fdf('0x38')]);_0x16f61a[_0x4fdf('0x39')]=qs[_0x4fdf('0x30')](_[_0x4fdf('0x3a')](_0x4c3a4c['query'],_0x56e564[_0x4fdf('0x30')]),_0x39cbcf);if(_0x4c3a4c[_0x4fdf('0x2f')][_0x4fdf('0x3b')]){_0x16f61a['where']=_[_0x4fdf('0x3c')](_0x16f61a[_0x4fdf('0x39')],{'$or':_[_0x4fdf('0x3d')](_0x39cbcf,function(_0x9ba55c){if(_0x9ba55c[_0x4fdf('0x2c')]!==_0x4fdf('0x3e')){var _0x47560c={};_0x47560c[_0x9ba55c[_0x4fdf('0x27')]]={'$like':'%'+_0x4c3a4c[_0x4fdf('0x2f')][_0x4fdf('0x3b')]+'%'};return _0x47560c;}})});}_0x16f61a=_[_0x4fdf('0x3c')]({},_0x16f61a,_0x4c3a4c[_0x4fdf('0x3f')]);var _0x5bf915={'where':_0x16f61a[_0x4fdf('0x39')]};return db[_0x4fdf('0x2a')][_0x4fdf('0x40')](_0x5bf915)[_0x4fdf('0x20')](function(_0x5d536d){_0x1013ad[_0x4fdf('0x40')]=_0x5d536d;if(_0x4c3a4c[_0x4fdf('0x2f')][_0x4fdf('0x41')]){_0x16f61a['include']=[{'all':!![]}];}return db[_0x4fdf('0x2a')][_0x4fdf('0x42')](_0x16f61a);})[_0x4fdf('0x20')](function(_0x203fcb){_0x1013ad[_0x4fdf('0x43')]=_0x203fcb;return _0x1013ad;})[_0x4fdf('0x20')](respondWithFilteredResult(_0x12a6b1,_0x16f61a))[_0x4fdf('0x44')](handleError(_0x12a6b1,null));};exports[_0x4fdf('0x45')]=function(_0x3ba2bc,_0x515065){var _0x428635={'raw':![],'where':{'id':_0x3ba2bc[_0x4fdf('0x46')]['id']}},_0x1e861f={};_0x1e861f[_0x4fdf('0x2e')]=_[_0x4fdf('0x47')](db[_0x4fdf('0x2a')]['rawAttributes']);_0x1e861f[_0x4fdf('0x2f')]=_['keys'](_0x3ba2bc['query']);_0x1e861f[_0x4fdf('0x30')]=_[_0x4fdf('0x31')](_0x1e861f[_0x4fdf('0x2e')],_0x1e861f[_0x4fdf('0x2f')]);_0x428635['attributes']=_[_0x4fdf('0x31')](_0x1e861f[_0x4fdf('0x2e')],qs[_0x4fdf('0x33')](_0x3ba2bc[_0x4fdf('0x2f')]['fields']));_0x428635[_0x4fdf('0x32')]=_0x428635[_0x4fdf('0x32')]['length']?_0x428635[_0x4fdf('0x32')]:_0x1e861f['model'];if(_0x3ba2bc[_0x4fdf('0x2f')][_0x4fdf('0x41')]){_0x428635[_0x4fdf('0x48')]=[{'all':!![]}];}_0x428635=_[_0x4fdf('0x3c')]({},_0x428635,_0x3ba2bc['options']);return db[_0x4fdf('0x2a')][_0x4fdf('0x49')](_0x428635)[_0x4fdf('0x20')](handleEntityNotFound(_0x515065,null))[_0x4fdf('0x20')](respondWithResult(_0x515065,null))[_0x4fdf('0x44')](handleError(_0x515065,null));};exports[_0x4fdf('0x4a')]=function(_0x2a0fcb,_0x345e07){return db[_0x4fdf('0x2a')][_0x4fdf('0x4a')](_0x2a0fcb[_0x4fdf('0x4b')],{})[_0x4fdf('0x20')](function(_0x59df79){var _0x591e8f=_0x2a0fcb[_0x4fdf('0x4c')][_0x4fdf('0x22')]({'plain':!![]});if(!_0x591e8f)throw new Error(_0x4fdf('0x4d'));if(_0x591e8f[_0x4fdf('0x4e')]===_0x4fdf('0x4c')){var _0x2223bb=_0x59df79[_0x4fdf('0x22')]({'plain':!![]});var _0x2e6e07=_0x4fdf('0x23');return db['UserProfileSection'][_0x4fdf('0x49')]({'where':{'name':_0x2e6e07,'userProfileId':_0x591e8f['userProfileId']},'raw':!![]})['then'](function(_0x5ef477){if(_0x5ef477&&_0x5ef477[_0x4fdf('0x4f')]===0x0){return db[_0x4fdf('0x24')][_0x4fdf('0x4a')]({'name':_0x2223bb[_0x4fdf('0x27')],'resourceId':_0x2223bb['id'],'type':_0x5ef477[_0x4fdf('0x27')],'sectionId':_0x5ef477['id']},{})[_0x4fdf('0x20')](function(){return _0x59df79;});}else{return _0x59df79;}})['catch'](function(_0x2c3106){logger['error'](_0x4fdf('0x50'),_0x2c3106);throw _0x2c3106;});}return _0x59df79;})['then'](respondWithResult(_0x345e07,0xc9))['catch'](handleError(_0x345e07,null));};exports[_0x4fdf('0x1f')]=function(_0x1c3ff8,_0x11e36e){if(_0x1c3ff8[_0x4fdf('0x4b')]['id']){delete _0x1c3ff8[_0x4fdf('0x4b')]['id'];}return db['Schedule'][_0x4fdf('0x49')]({'where':{'id':_0x1c3ff8[_0x4fdf('0x46')]['id']}})[_0x4fdf('0x20')](handleEntityNotFound(_0x11e36e,null))['then'](saveUpdates(_0x1c3ff8[_0x4fdf('0x4b')],null))[_0x4fdf('0x20')](respondWithResult(_0x11e36e,null))[_0x4fdf('0x44')](handleError(_0x11e36e,null));};exports[_0x4fdf('0x21')]=function(_0x515da7,_0x33bdf8){return db[_0x4fdf('0x2a')][_0x4fdf('0x49')]({'where':{'id':_0x515da7[_0x4fdf('0x46')]['id']}})[_0x4fdf('0x20')](handleEntityNotFound(_0x33bdf8,null))[_0x4fdf('0x20')](removeEntity(_0x33bdf8,null))[_0x4fdf('0x44')](handleError(_0x33bdf8,null));};exports[_0x4fdf('0x51')]=function(_0x40aa70,_0x4e2652,_0x50311e){var _0x494314=require(_0x4fdf('0x52'));return db[_0x4fdf('0x2a')][_0x4fdf('0x49')]({'where':{'id':_0x40aa70[_0x4fdf('0x46')]['id']},'raw':!![]})[_0x4fdf('0x20')](handleEntityNotFound(_0x4e2652,null))['then'](function(){_0x494314[_0x4fdf('0x51')](_0x40aa70[_0x4fdf('0x46')]['id']);})[_0x4fdf('0x20')](respondWithStatusCode(_0x4e2652,null))[_0x4fdf('0x44')](handleError(_0x4e2652,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index caa3e14..53f56d7 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 _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 +var _0x0f89=['../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x444396,_0x15fcd6){var _0x34bce4=function(_0x240afe){while(--_0x240afe){_0x444396['push'](_0x444396['shift']());}};_0x34bce4(++_0x15fcd6);}(_0x0f89,0x172));var _0x90f8=function(_0x236efb,_0x2bc7f9){_0x236efb=_0x236efb-0x0;var _0x3979c9=_0x0f89[_0x236efb];return _0x3979c9;};'use strict';var _=require(_0x90f8('0x0'));var util=require(_0x90f8('0x1'));var logger=require('../../config/logger')(_0x90f8('0x2'));var moment=require(_0x90f8('0x3'));var BPromise=require(_0x90f8('0x4'));var rp=require(_0x90f8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x90f8('0x6'));var config=require(_0x90f8('0x7'));var attributes=require(_0x90f8('0x8'));module[_0x90f8('0x9')]=function(_0x5a7a91,_0x9c9360){return _0x5a7a91[_0x90f8('0xa')](_0x90f8('0xb'),attributes,{'tableName':_0x90f8('0xc'),'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 30e3d4c..5b3c111 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 _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 +var _0xe6f8=['message','info','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x13c436,_0x2d6d22){var _0x31cac5=function(_0x391288){while(--_0x391288){_0x13c436['push'](_0x13c436['shift']());}};_0x31cac5(++_0x2d6d22);}(_0xe6f8,0x115));var _0x8e6f=function(_0x118335,_0x13d68a){_0x118335=_0x118335-0x0;var _0x1e59d1=_0xe6f8[_0x118335];return _0x1e59d1;};'use strict';var _=require('lodash');var util=require(_0x8e6f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8e6f('0x1'));var fs=require('fs');var Redis=require(_0x8e6f('0x2'));var db=require(_0x8e6f('0x3'))['db'];var utils=require(_0x8e6f('0x4'));var logger=require('../../config/logger')(_0x8e6f('0x5'));var config=require(_0x8e6f('0x6'));var jayson=require(_0x8e6f('0x7'));var client=jayson['client'][_0x8e6f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x492769,_0x1a0a04,_0x3eb036){return new BPromise(function(_0x664c61,_0x2032ab){return client[_0x8e6f('0x9')](_0x492769,_0x3eb036)['then'](function(_0x15fcfe){logger['info'](_0x8e6f('0xa'),_0x1a0a04,'request\x20sent');logger[_0x8e6f('0xb')](_0x8e6f('0xc'),_0x1a0a04,_0x8e6f('0xd'),JSON[_0x8e6f('0xe')](_0x15fcfe));if(_0x15fcfe[_0x8e6f('0xf')]){if(_0x15fcfe[_0x8e6f('0xf')][_0x8e6f('0x10')]===0x1f4){logger[_0x8e6f('0xf')]('Schedule,\x20%s,\x20%s',_0x1a0a04,_0x15fcfe[_0x8e6f('0xf')][_0x8e6f('0x11')]);return _0x2032ab(_0x15fcfe[_0x8e6f('0xf')][_0x8e6f('0x11')]);}logger[_0x8e6f('0xf')](_0x8e6f('0xa'),_0x1a0a04,_0x15fcfe['error']['message']);return _0x664c61(_0x15fcfe[_0x8e6f('0xf')][_0x8e6f('0x11')]);}else{logger[_0x8e6f('0x12')](_0x8e6f('0xa'),_0x1a0a04,'request\x20sent');_0x664c61(_0x15fcfe[_0x8e6f('0x13')]['message']);}})[_0x8e6f('0x14')](function(_0x160459){logger[_0x8e6f('0xf')](_0x8e6f('0xa'),_0x1a0a04,_0x160459);_0x2032ab(_0x160459);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index e28a80a..8fb61c3 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 _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 +var _0xc0fd=['get','/describe','/:id','show','/:id/download','download','create','put','delete','destroy','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','index'];(function(_0x3bbf26,_0xed9a38){var _0x57fc2e=function(_0x54b61d){while(--_0x54b61d){_0x3bbf26['push'](_0x3bbf26['shift']());}};_0x57fc2e(++_0xed9a38);}(_0xc0fd,0x1e5));var _0xdc0f=function(_0x1c8a99,_0x5c7fdc){_0x1c8a99=_0x1c8a99-0x0;var _0x528f40=_0xc0fd[_0x1c8a99];return _0x528f40;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdc0f('0x0'));var timeout=require(_0xdc0f('0x1'));var express=require('express');var router=express[_0xdc0f('0x2')]();var auth=require(_0xdc0f('0x3'));var interaction=require(_0xdc0f('0x4'));var config=require(_0xdc0f('0x5'));var controller=require(_0xdc0f('0x6'));router['get']('/',auth[_0xdc0f('0x7')](),controller[_0xdc0f('0x8')]);router[_0xdc0f('0x9')](_0xdc0f('0xa'),auth[_0xdc0f('0x7')](),controller['describe']);router[_0xdc0f('0x9')](_0xdc0f('0xb'),auth[_0xdc0f('0x7')](),controller[_0xdc0f('0xc')]);router[_0xdc0f('0x9')](_0xdc0f('0xd'),auth['isAuthenticated'](),controller[_0xdc0f('0xe')]);router['post']('/',auth[_0xdc0f('0x7')](),controller[_0xdc0f('0xf')]);router[_0xdc0f('0x10')]('/:id',auth[_0xdc0f('0x7')](),controller['update']);router[_0xdc0f('0x11')]('/:id',auth[_0xdc0f('0x7')](),controller[_0xdc0f('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 5137489..42a7b48 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 _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 +var _0x24ca=['format','MM-DD-YYYY\x20HH:mm','toString','createdAt','sequelize','path','../../config/environment','exports','getDataValue','value','extname','STRING','replace','INTEGER','setDataValue','startedAt','subtract','closedAt','duration','DATE'];(function(_0x469100,_0x537385){var _0x26efb8=function(_0xa9898a){while(--_0xa9898a){_0x469100['push'](_0x469100['shift']());}};_0x26efb8(++_0x537385);}(_0x24ca,0x1bc));var _0xa24c=function(_0x1602ef,_0x447aba){_0x1602ef=_0x1602ef-0x0;var _0x5870ee=_0x24ca[_0x1602ef];return _0x5870ee;};'use strict';var Sequelize=require(_0xa24c('0x0'));var moment=require('moment');var path=require(_0xa24c('0x1'));var config=require(_0xa24c('0x2'));module[_0xa24c('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xa24c('0x4')](_0xa24c('0x5'))?path[_0xa24c('0x6')](this[_0xa24c('0x4')](_0xa24c('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0xa24c('0x7')]},'channel':{'type':Sequelize[_0xa24c('0x7')]},'value':{'type':Sequelize[_0xa24c('0x7')],'set':function(_0x2dd348){var _0x257264=_0x2dd348[_0xa24c('0x8')](/\\/g,'/');this['setDataValue'](_0xa24c('0x5'),_0x257264);}},'rating':{'type':Sequelize[_0xa24c('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xa24c('0x9')],'set':function(_0x5eac78){this[_0xa24c('0xa')](_0xa24c('0xb'),moment()[_0xa24c('0xc')](_0x5eac78,'ms'));this[_0xa24c('0xa')](_0xa24c('0xd'),moment());this[_0xa24c('0xa')](_0xa24c('0xe'),_0x5eac78);}},'startedAt':{'type':Sequelize[_0xa24c('0xf')],'get':function(){return moment(this[_0xa24c('0x4')]('startedAt'))[_0xa24c('0x10')](_0xa24c('0x11'))[_0xa24c('0x12')]();}},'closedAt':{'type':Sequelize[_0xa24c('0xf')],'get':function(){return moment(this['getDataValue'](_0xa24c('0xd')))[_0xa24c('0x10')](_0xa24c('0x11'))[_0xa24c('0x12')]();}},'createdAt':{'type':Sequelize[_0xa24c('0xf')],'get':function(){return moment(this[_0xa24c('0x4')](_0xa24c('0x13')))['format']('MM-DD-YYYY\x20HH:mm')[_0xa24c('0x12')]();}},'updatedAt':{'type':Sequelize[_0xa24c('0xf')],'get':function(){return moment(this['getDataValue']('updatedAt'))[_0xa24c('0x10')](_0xa24c('0x11'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 71f7710..52c44f1 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 _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 +var _0x9981=['keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','name','options','include','rows','catch','show','params','includeAll','find','create','body','update','closedAt','value','describe','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','download','Not\x20found','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','save','then','end','sendStatus','error','stack','send','index','map','ScreenRecording','rawAttributes','type','model','differenceBy','format','query'];(function(_0x2b56d7,_0x35745a){var _0x1b48b3=function(_0xbc38b6){while(--_0xbc38b6){_0x2b56d7['push'](_0x2b56d7['shift']());}};_0x1b48b3(++_0x35745a);}(_0x9981,0x163));var _0x1998=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9981[_0x1969a7];return _0x3d665f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1998('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1998('0x1'));var BPromise=require(_0x1998('0x2'));var Mustache=require(_0x1998('0x3'));var util=require(_0x1998('0x4'));var path=require('path');var sox=require(_0x1998('0x5'));var csv=require('to-csv');var ejs=require(_0x1998('0x6'));var fs=require('fs');var _=require(_0x1998('0x7'));var squel=require(_0x1998('0x8'));var crypto=require('crypto');var jsforce=require(_0x1998('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x1998('0xa'));var querystring=require(_0x1998('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1998('0xc'));var qs=require(_0x1998('0xd'));var as=require(_0x1998('0xe'));var hardwareService=require(_0x1998('0xf'));var logger=require(_0x1998('0x10'))(_0x1998('0x11'));var utils=require(_0x1998('0x12'));var config=require(_0x1998('0x13'));var db=require(_0x1998('0x14'))['db'];function respondWithStatusCode(_0x2bc60d,_0x42337f){_0x42337f=_0x42337f||0xcc;return function(_0x4b7557){if(_0x4b7557){return _0x2bc60d['sendStatus'](_0x42337f);}return _0x2bc60d[_0x1998('0x15')](_0x42337f)['end']();};}function respondWithResult(_0x577e11,_0x5ef0c8){_0x5ef0c8=_0x5ef0c8||0xc8;return function(_0x16b208){if(_0x16b208){return _0x577e11[_0x1998('0x15')](_0x5ef0c8)[_0x1998('0x16')](_0x16b208);}};}function respondWithFilteredResult(_0x20d361,_0x57cb73){return function(_0xcf4bff){if(_0xcf4bff){var _0x308266=_0xcf4bff[_0x1998('0x17')],_0x17b236=_0x57cb73['offset'],_0x526b77=_0x57cb73[_0x1998('0x18')]+_0x57cb73[_0x1998('0x19')],_0x4d7ede;if(_0x526b77>=_0x308266){_0x526b77=_0x308266;_0x4d7ede=0xc8;}else{_0x4d7ede=0xce;}_0x20d361[_0x1998('0x15')](_0x4d7ede);return _0x20d361[_0x1998('0x1a')](_0x1998('0x1b'),_0x17b236+'-'+_0x526b77+'/'+_0x308266)['json'](_0xcf4bff);}return null;};}function patchUpdates(_0x1d7ec9){return function(_0x501cb3){try{jsonpatch[_0x1998('0x1c')](_0x501cb3,_0x1d7ec9,!![]);}catch(_0x294f12){return BPromise['reject'](_0x294f12);}return _0x501cb3[_0x1998('0x1d')]();};}function saveUpdates(_0x1b42d5,_0x4d4e89){return function(_0x192d41){if(_0x192d41){return _0x192d41['update'](_0x1b42d5)[_0x1998('0x1e')](function(_0x2e592c){return _0x2e592c;});}return null;};}function removeEntity(_0x4dc4a7,_0x2eab3b){return function(_0x24b9e8){if(_0x24b9e8){return _0x24b9e8['destroy']()[_0x1998('0x1e')](function(){_0x4dc4a7[_0x1998('0x15')](0xcc)[_0x1998('0x1f')]();});}};}function handleEntityNotFound(_0x5228a7,_0x1e9a39){return function(_0x160fae){if(!_0x160fae){_0x5228a7[_0x1998('0x20')](0x194);}return _0x160fae;};}function handleError(_0x3ec875,_0x1a477a){_0x1a477a=_0x1a477a||0x1f4;return function(_0x4b3c13){logger[_0x1998('0x21')](_0x4b3c13[_0x1998('0x22')]);if(_0x4b3c13['name']){delete _0x4b3c13['name'];}_0x3ec875[_0x1998('0x15')](_0x1a477a)[_0x1998('0x23')](_0x4b3c13);};}exports[_0x1998('0x24')]=function(_0xcd422c,_0x31489c){var _0x284986={},_0x3de9c1={},_0x1a3e6f={'count':0x0,'rows':[]};var _0x5d441b=_[_0x1998('0x25')](db[_0x1998('0x26')][_0x1998('0x27')],function(_0x5b9764){return{'name':_0x5b9764['fieldName'],'type':_0x5b9764[_0x1998('0x28')]['key']};});_0x3de9c1[_0x1998('0x29')]=_[_0x1998('0x2a')](_['map'](_0x5d441b,'name'),[_0x1998('0x2b')]);_0x3de9c1[_0x1998('0x2c')]=_[_0x1998('0x2d')](_0xcd422c['query']);_0x3de9c1['filters']=_[_0x1998('0x2e')](_0x3de9c1['model'],_0x3de9c1[_0x1998('0x2c')]);_0x284986[_0x1998('0x2f')]=_[_0x1998('0x2e')](_0x3de9c1[_0x1998('0x29')],qs[_0x1998('0x30')](_0xcd422c['query'][_0x1998('0x30')]));_0x284986[_0x1998('0x2f')]=_0x284986[_0x1998('0x2f')][_0x1998('0x31')]?_0x284986[_0x1998('0x2f')]:_0x3de9c1[_0x1998('0x29')];if(!_0xcd422c[_0x1998('0x2c')][_0x1998('0x32')](_0x1998('0x33'))){_0x284986[_0x1998('0x19')]=qs[_0x1998('0x19')](_0xcd422c[_0x1998('0x2c')][_0x1998('0x19')]);_0x284986[_0x1998('0x18')]=qs[_0x1998('0x18')](_0xcd422c['query']['offset']);}_0x284986[_0x1998('0x34')]=qs[_0x1998('0x35')](_0xcd422c[_0x1998('0x2c')][_0x1998('0x35')]);_0x284986[_0x1998('0x36')]=qs['filters'](_['pick'](_0xcd422c[_0x1998('0x2c')],_0x3de9c1[_0x1998('0x37')]),_0x5d441b);if(_0xcd422c[_0x1998('0x2c')][_0x1998('0x38')]){_0x284986[_0x1998('0x36')]=_[_0x1998('0x39')](_0x284986[_0x1998('0x36')],{'$or':_[_0x1998('0x25')](_0x5d441b,function(_0xde017b){if(_0xde017b[_0x1998('0x28')]!=='VIRTUAL'){var _0x4aea9b={};_0x4aea9b[_0xde017b[_0x1998('0x3a')]]={'$like':'%'+_0xcd422c[_0x1998('0x2c')][_0x1998('0x38')]+'%'};return _0x4aea9b;}})});}_0x284986=_[_0x1998('0x39')]({},_0x284986,_0xcd422c[_0x1998('0x3b')]);var _0x2657b5={'where':_0x284986[_0x1998('0x36')]};return db[_0x1998('0x26')][_0x1998('0x17')](_0x2657b5)['then'](function(_0x5a323c){_0x1a3e6f[_0x1998('0x17')]=_0x5a323c;if(_0xcd422c['query']['includeAll']){_0x284986[_0x1998('0x3c')]=[{'all':!![]}];}return db[_0x1998('0x26')]['findAll'](_0x284986);})[_0x1998('0x1e')](function(_0x3fce62){_0x1a3e6f[_0x1998('0x3d')]=_0x3fce62;return _0x1a3e6f;})[_0x1998('0x1e')](respondWithFilteredResult(_0x31489c,_0x284986))[_0x1998('0x3e')](handleError(_0x31489c,null));};exports[_0x1998('0x3f')]=function(_0x1f8671,_0x4a82ba){var _0x3b866d={'raw':![],'where':{'id':_0x1f8671[_0x1998('0x40')]['id']}},_0x4cb1fa={};_0x4cb1fa[_0x1998('0x29')]=_[_0x1998('0x2d')](db[_0x1998('0x26')][_0x1998('0x27')]);_0x4cb1fa[_0x1998('0x2c')]=_[_0x1998('0x2d')](_0x1f8671['query']);_0x4cb1fa[_0x1998('0x37')]=_[_0x1998('0x2e')](_0x4cb1fa[_0x1998('0x29')],_0x4cb1fa[_0x1998('0x2c')]);_0x3b866d[_0x1998('0x2f')]=_[_0x1998('0x2e')](_0x4cb1fa['model'],qs['fields'](_0x1f8671['query']['fields']));_0x3b866d[_0x1998('0x2f')]=_0x3b866d[_0x1998('0x2f')]['length']?_0x3b866d[_0x1998('0x2f')]:_0x4cb1fa['model'];if(_0x1f8671['query'][_0x1998('0x41')]){_0x3b866d[_0x1998('0x3c')]=[{'all':!![]}];}_0x3b866d=_[_0x1998('0x39')]({},_0x3b866d,_0x1f8671['options']);return db[_0x1998('0x26')][_0x1998('0x42')](_0x3b866d)[_0x1998('0x1e')](handleEntityNotFound(_0x4a82ba,null))[_0x1998('0x1e')](respondWithResult(_0x4a82ba,null))['catch'](handleError(_0x4a82ba,null));};exports[_0x1998('0x43')]=function(_0x447fdd,_0xbd584d){return db[_0x1998('0x26')][_0x1998('0x43')](_0x447fdd[_0x1998('0x44')],{})[_0x1998('0x1e')](respondWithResult(_0xbd584d,0xc9))[_0x1998('0x3e')](handleError(_0xbd584d,null));};exports[_0x1998('0x45')]=function(_0x179e8d,_0x1a2246){if(_0x179e8d[_0x1998('0x44')]['id']){delete _0x179e8d[_0x1998('0x44')]['id'];}delete _0x179e8d[_0x1998('0x44')]['duration'];delete _0x179e8d[_0x1998('0x44')]['createdAt'];delete _0x179e8d['body'][_0x1998('0x46')];delete _0x179e8d[_0x1998('0x44')][_0x1998('0x47')];return db[_0x1998('0x26')][_0x1998('0x42')]({'where':{'id':_0x179e8d[_0x1998('0x40')]['id']}})[_0x1998('0x1e')](handleEntityNotFound(_0x1a2246,null))['then'](saveUpdates(_0x179e8d[_0x1998('0x44')],null))[_0x1998('0x1e')](respondWithResult(_0x1a2246,null))['catch'](handleError(_0x1a2246,null));};exports[_0x1998('0x48')]=function(_0x5bdbdf,_0x141d7d){return db[_0x1998('0x26')]['describe']()[_0x1998('0x1e')](respondWithResult(_0x141d7d,null))[_0x1998('0x3e')](handleError(_0x141d7d,null));};exports['download']=function(_0x38c2ce,_0x462331,_0x2bfdd6){var _0x55faab=require(_0x1998('0x49'));var _0x2c401b=![];var _0x4db1d7={};if(_0x38c2ce['query'][_0x1998('0x28')]&&_0x38c2ce[_0x1998('0x2c')]['type']===_0x1998('0x4a')){_0x4db1d7[_0x1998('0x4a')]=_0x38c2ce['params']['id'];}else{_0x4db1d7['id']=_0x38c2ce[_0x1998('0x40')]['id'];}return db[_0x1998('0x26')][_0x1998('0x42')]({'where':_0x4db1d7,'attributes':['id',_0x1998('0x47')],'raw':!![]})[_0x1998('0x1e')](handleEntityNotFound(_0x462331,null))['then'](function(_0x57a9cb){if(_0x57a9cb){var _0x456023=path[_0x1998('0x4b')](config[_0x1998('0x4c')],_0x1998('0x4d'),_0x57a9cb[_0x1998('0x47')]);var _0x44006e=util[_0x1998('0x2b')](_0x1998('0x4e'),_0x456023);if(fs['existsSync'](_0x44006e)){_0x2c401b=!![];return _0x55faab[_0x1998('0x4f')](_0x44006e,_0x456023,config[_0x1998('0x50')][_0x1998('0x51')])[_0x1998('0x1e')](function(){return _0x57a9cb;});}return _0x57a9cb;}})['then'](function(_0x1b9cab){if(_0x1b9cab){var _0x226c6e=path[_0x1998('0x4b')](config[_0x1998('0x4c')],_0x1998('0x4d'),_0x1b9cab['value']);if(!fs[_0x1998('0x52')](_0x226c6e)){throw new db[(_0x1998('0x53'))][(_0x1998('0x54'))](_0x1998('0x55'));}if(_0x1b9cab[_0x1998('0x56')]){return _0x462331['download'](_0x226c6e,_0x1b9cab['filename']+path[_0x1998('0x57')](_0x226c6e),function(){if(_0x2c401b){fs[_0x1998('0x58')](_0x226c6e);}});}else{return _0x462331[_0x1998('0x59')](_0x226c6e,function(_0x6bb568){if(_0x2c401b){fs['unlink'](_0x226c6e);}});}}})['catch'](function(_0x23e0b1){if(_0x23e0b1['message']===_0x1998('0x55')){_0x462331[_0x1998('0x15')](0x194)['send'](_0x1998('0x5a'));}else{return handleError(_0x462331,null);}});};exports[_0x1998('0x5b')]=function(_0x487105,_0x4c07a1){return db[_0x1998('0x26')]['find']({'where':{'id':_0x487105[_0x1998('0x40')]['id']}})[_0x1998('0x1e')](function(_0x58cb15){if(!_0x58cb15)throw new ReferenceError(_0x1998('0x5c'));return _0x58cb15;})[_0x1998('0x1e')](function(_0x3c0ca8){var _0x2e298d=path[_0x1998('0x4b')](config[_0x1998('0x4c')],'server/files/screen_recordings',_0x3c0ca8[_0x1998('0x47')]);logger[_0x1998('0x5d')](_0x1998('0x5e'),_0x2e298d);if(!_[_0x1998('0x5f')](_0x3c0ca8['value'])&&fs[_0x1998('0x52')](_0x2e298d)){logger[_0x1998('0x5d')](_0x1998('0x60')+_0x2e298d+_0x1998('0x61'));fs[_0x1998('0x62')](_0x2e298d);}_0x2e298d=_0x2e298d+_0x1998('0x63');if(!_[_0x1998('0x5f')](_0x3c0ca8[_0x1998('0x47')])&&fs[_0x1998('0x52')](_0x2e298d)){logger['info'](_0x1998('0x60')+_0x2e298d+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x2e298d);}return _0x3c0ca8;})['then'](function(_0x3f44e5){if(!_0x3f44e5)throw new InternalError();return _0x3f44e5[_0x1998('0x5b')]();})[_0x1998('0x1e')](function(){_0x4c07a1['status'](0xcc)['end']();})[_0x1998('0x3e')](handleError(_0x4c07a1,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index a7e4b51..bd665ef 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 _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 +var _0x799b=['path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','api','moment','bluebird','request-promise'];(function(_0x1d53a8,_0x533494){var _0x2a3bbc=function(_0x127c2a){while(--_0x127c2a){_0x1d53a8['push'](_0x1d53a8['shift']());}};_0x2a3bbc(++_0x533494);}(_0x799b,0x18f));var _0xb799=function(_0x30463a,_0x154f4b){_0x30463a=_0x30463a-0x0;var _0x2b556b=_0x799b[_0x30463a];return _0x2b556b;};'use strict';var _=require(_0xb799('0x0'));var util=require(_0xb799('0x1'));var logger=require('../../config/logger')(_0xb799('0x2'));var moment=require(_0xb799('0x3'));var BPromise=require(_0xb799('0x4'));var rp=require(_0xb799('0x5'));var fs=require('fs');var path=require(_0xb799('0x6'));var rimraf=require(_0xb799('0x7'));var config=require(_0xb799('0x8'));var attributes=require(_0xb799('0x9'));module[_0xb799('0xa')]=function(_0x549bb8,_0x2eb9f5){return _0x549bb8[_0xb799('0xb')](_0xb799('0xc'),attributes,{'tableName':_0xb799('0xd'),'paranoid':![],'indexes':[{'name':_0xb799('0xe'),'fields':[_0xb799('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 5525119..ea956ff 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(_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 +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(_0x58b5ad,_0x3136cc){var _0xb11e73=function(_0x42fe65){while(--_0x42fe65){_0x58b5ad['push'](_0x58b5ad['shift']());}};_0xb11e73(++_0x3136cc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 9e79900..db6b94e 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 _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 +var _0x2a2b=['gdpr','/:id/preferred','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','file','logologin','post','single','addLogoLogin','favicon','/:id/favicon','isAuthenticated','update','exports','path','express','Router','../../components/interaction/service','../../config/environment','./setting.controller','index','get','/:id','show','/:id/logo','getLogo','/:id/logo_login'];(function(_0x44a2de,_0x1b7846){var _0xd465b6=function(_0x5258f5){while(--_0x5258f5){_0x44a2de['push'](_0x44a2de['shift']());}};_0xd465b6(++_0x1b7846);}(_0x2a2b,0xc5));var _0xb2a2=function(_0x673e91,_0x5066f8){_0x673e91=_0x673e91-0x0;var _0x3ee5cb=_0x2a2b[_0x673e91];return _0x3ee5cb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb2a2('0x0'));var timeout=require('connect-timeout');var express=require(_0xb2a2('0x1'));var router=express[_0xb2a2('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xb2a2('0x3'));var config=require(_0xb2a2('0x4'));var controller=require(_0xb2a2('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xb2a2('0x6')]);router[_0xb2a2('0x7')](_0xb2a2('0x8'),controller[_0xb2a2('0x9')]);router[_0xb2a2('0x7')](_0xb2a2('0xa'),controller[_0xb2a2('0xb')]);router[_0xb2a2('0x7')](_0xb2a2('0xc'),controller['getLogoLogin']);router[_0xb2a2('0x7')]('/:id/gdpr',controller[_0xb2a2('0xd')]);router[_0xb2a2('0x7')](_0xb2a2('0xe'),controller['getPreferred']);router[_0xb2a2('0x7')]('/:id/favicon',controller[_0xb2a2('0xf')]);var upload=multer({'storage':multer[_0xb2a2('0x10')]({'destination':function(_0x9f5e67,_0x2b7f5a,_0x115164){_0x115164(null,path[_0xb2a2('0x11')](config[_0xb2a2('0x12')],_0xb2a2('0x13')));},'filename':function(_0x107312,_0x1a659d,_0x3ccae0){_0x3ccae0(null,util[_0xb2a2('0x14')](_0xb2a2('0x15'),_0xb2a2('0x16'),path[_0xb2a2('0x17')](_0x1a659d[_0xb2a2('0x18')])));}})});router['post']('/:id/logo',upload['single'](_0xb2a2('0x19')),controller['addLogo']);var upload=multer({'storage':multer[_0xb2a2('0x10')]({'destination':function(_0x375ed6,_0x387a88,_0x115655){_0x115655(null,path[_0xb2a2('0x11')](config[_0xb2a2('0x12')],'server/files/images/logos/'));},'filename':function(_0x55a42d,_0x274468,_0x8a7b8f){_0x8a7b8f(null,util[_0xb2a2('0x14')](_0xb2a2('0x15'),_0xb2a2('0x1a'),path['extname'](_0x274468[_0xb2a2('0x18')])));}})});router[_0xb2a2('0x1b')]('/:id/logo_login',upload[_0xb2a2('0x1c')](_0xb2a2('0x19')),controller[_0xb2a2('0x1d')]);var upload=multer({'storage':multer[_0xb2a2('0x10')]({'destination':function(_0x4fa6c7,_0x270d01,_0x1677f5){_0x1677f5(null,path['join'](config[_0xb2a2('0x12')],_0xb2a2('0x13')));},'filename':function(_0x488207,_0x4cf597,_0x42cd42){_0x42cd42(null,util['format']('%s%s','preferred',path[_0xb2a2('0x17')](_0x4cf597[_0xb2a2('0x18')])));}})});router[_0xb2a2('0x1b')](_0xb2a2('0xe'),upload[_0xb2a2('0x1c')](_0xb2a2('0x19')),controller['addPreferred']);var upload=multer({'storage':multer[_0xb2a2('0x10')]({'destination':function(_0x1b9d31,_0x5a6c97,_0x38f2d9){_0x38f2d9(null,path[_0xb2a2('0x11')](config[_0xb2a2('0x12')],_0xb2a2('0x13')));},'filename':function(_0x27d35b,_0x25056b,_0x2669b6){_0x2669b6(null,util[_0xb2a2('0x14')]('%s%s',_0xb2a2('0x1e'),path[_0xb2a2('0x17')](_0x25056b[_0xb2a2('0x18')])));}})});router[_0xb2a2('0x1b')](_0xb2a2('0x1f'),upload['single'](_0xb2a2('0x19')),controller['addFavicon']);router['put'](_0xb2a2('0x8'),auth[_0xb2a2('0x20')](),controller[_0xb2a2('0x21')]);module[_0xb2a2('0x22')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index cddab6d..0d71acc 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 _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 +var _0xb465=['exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate'];(function(_0x34178c,_0x10c45a){var _0x2fe800=function(_0x438262){while(--_0x438262){_0x34178c['push'](_0x34178c['shift']());}};_0x2fe800(++_0x10c45a);}(_0xb465,0x171));var _0x5b46=function(_0x472288,_0x224948){_0x472288=_0x472288-0x0;var _0x219f62=_0xb465[_0x472288];return _0x219f62;};'use strict';var Sequelize=require('sequelize');module[_0x5b46('0x0')]={'min_internal':{'type':Sequelize[_0x5b46('0x1')](0xb),'unique':_0x5b46('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x5b46('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x5b46('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x5b46('0x4')],'defaultValue':_0x5b46('0x5')},'logo':{'type':Sequelize[_0x5b46('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x5b46('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x5b46('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x5b46('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x5b46('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x5b46('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x5b46('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x5b46('0x4')]},'pageTitle':{'type':Sequelize[_0x5b46('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x5b46('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x5b46('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x5b46('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x5b46('0x4')],'defaultValue':_0x5b46('0x7')},'enableEmailPreview':{'type':Sequelize[_0x5b46('0x6')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x5b46('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x5b46('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x5b46('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x5b46('0x4')],'defaultValue':_0x5b46('0x8')},'chatTimeout':{'type':Sequelize[_0x5b46('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x5b46('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x5b46('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x5b46('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x5b46('0x4')]},'defaultFavicon':{'type':Sequelize[_0x5b46('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x5b46('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x5b46('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x5b46('0x1')]},'transcribeRegion':{'type':Sequelize[_0x5b46('0x4')]},'sentiment':{'type':Sequelize[_0x5b46('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x5b46('0x1')]},'sentimentRegion':{'type':Sequelize[_0x5b46('0x4')]},'language':{'type':Sequelize[_0x5b46('0x4')]},'bucket':{'type':Sequelize[_0x5b46('0x4')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 16213d9..bd6b8b1 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 _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 +var _0xc1a2=['keys','include','find','body','addLogo','file','filename','logo','params','addLogoLogin','../../config/license/util','server/files/images/logos','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','download','getLicense','loginLogo','defaultLoginLogo','default_loginLogo.svg','securePassword','addPreferred','getPreferred','default_preferred.png','\x20not\x20found','addFavicon','getFavicon','default_favicon.ico','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','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~!@#$%^&-_=+[{]}.','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','destroy','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show'];(function(_0x520b29,_0x312a4f){var _0xca8806=function(_0x4d7ca2){while(--_0x4d7ca2){_0x520b29['push'](_0x520b29['shift']());}};_0xca8806(++_0x312a4f);}(_0xc1a2,0x191));var _0x2c1a=function(_0x4649c4,_0x4c8c1a){_0x4649c4=_0x4649c4-0x0;var _0x4166e2=_0xc1a2[_0x4649c4];return _0x4166e2;};'use strict';var pdf=require(_0x2c1a('0x0'));var emlformat=require(_0x2c1a('0x1'));var rimraf=require(_0x2c1a('0x2'));var zipdir=require(_0x2c1a('0x3'));var jsonpatch=require(_0x2c1a('0x4'));var rp=require('request-promise');var moment=require(_0x2c1a('0x5'));var BPromise=require(_0x2c1a('0x6'));var Mustache=require(_0x2c1a('0x7'));var util=require('util');var path=require(_0x2c1a('0x8'));var sox=require(_0x2c1a('0x9'));var csv=require('to-csv');var ejs=require(_0x2c1a('0xa'));var fs=require('fs');var _=require(_0x2c1a('0xb'));var squel=require(_0x2c1a('0xc'));var crypto=require('crypto');var jsforce=require(_0x2c1a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2c1a('0xe'));var querystring=require(_0x2c1a('0xf'));var Papa=require(_0x2c1a('0x10'));var Redis=require('ioredis');var authService=require(_0x2c1a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2c1a('0x12'));var hardwareService=require(_0x2c1a('0x13'));var logger=require('../../config/logger')(_0x2c1a('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x2c1a('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x2c1a('0x16')][_0x2c1a('0x17')]({'port':0x232a});function checkPasswordPattern(_0x35a454,_0x21e810,_0x262377){if(_0x262377){var _0xc7788=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xc7788[_0x2c1a('0x18')](_0x21e810)){return _0x35a454;}else{throw new db[(_0x2c1a('0x19'))][(_0x2c1a('0x1a'))](_0x2c1a('0x1b'));}}else{return _0x35a454;}}function respondWithRpcPromise(_0x14e420,_0x39e92b,_0x38ac8d,_0x3f67f5){return new BPromise(function(_0x47df44,_0x158b2d){var _0x2cb78a=_0x3f67f5||client;return _0x2cb78a[_0x2c1a('0x1c')](_0x14e420,_0x38ac8d)[_0x2c1a('0x1d')](function(_0x2d7910){logger[_0x2c1a('0x1e')](_0x2c1a('0x1f'),_0x39e92b,_0x2c1a('0x20'));logger[_0x2c1a('0x21')](_0x2c1a('0x22'),_0x39e92b,_0x2c1a('0x20'),JSON[_0x2c1a('0x23')](_0x2d7910));if(_0x2d7910[_0x2c1a('0x24')]){if(_0x2d7910['error'][_0x2c1a('0x25')]===0x1f4){logger['error'](_0x2c1a('0x1f'),_0x39e92b,_0x2d7910[_0x2c1a('0x24')]['message']);return _0x158b2d(_0x2d7910[_0x2c1a('0x24')][_0x2c1a('0x26')]);}logger[_0x2c1a('0x24')](_0x2c1a('0x1f'),_0x39e92b,_0x2d7910[_0x2c1a('0x24')]['message']);return _0x47df44(_0x2d7910[_0x2c1a('0x24')][_0x2c1a('0x26')]);}else{logger['info'](_0x2c1a('0x1f'),_0x39e92b,_0x2c1a('0x20'));_0x47df44(_0x2d7910[_0x2c1a('0x27')][_0x2c1a('0x26')]);}})['catch'](function(_0x4f6f2f){logger['error'](_0x2c1a('0x1f'),_0x39e92b,_0x4f6f2f);_0x158b2d(_0x4f6f2f);});});}function respondWithStatusCode(_0xb25ab1,_0x20e308){_0x20e308=_0x20e308||0xcc;return function(_0x33d291){if(_0x33d291){return _0xb25ab1[_0x2c1a('0x28')](_0x20e308);}return _0xb25ab1[_0x2c1a('0x29')](_0x20e308)[_0x2c1a('0x2a')]();};}function respondWithResult(_0x35762e,_0x80a5fd){_0x80a5fd=_0x80a5fd||0xc8;return function(_0x3cbd59){if(_0x3cbd59){return _0x35762e[_0x2c1a('0x29')](_0x80a5fd)[_0x2c1a('0x2b')](_0x3cbd59);}};}function respondWithFilteredResult(_0x3601e6,_0x3b1d2e){return function(_0x15ed31){if(_0x15ed31){var _0x3cbe41=_0x15ed31[_0x2c1a('0x2c')],_0x332e47=_0x3b1d2e[_0x2c1a('0x2d')],_0x131c93=_0x3b1d2e[_0x2c1a('0x2d')]+_0x3b1d2e['limit'],_0x1a6c36;if(_0x131c93>=_0x3cbe41){_0x131c93=_0x3cbe41;_0x1a6c36=0xc8;}else{_0x1a6c36=0xce;}_0x3601e6[_0x2c1a('0x29')](_0x1a6c36);return _0x3601e6['set'](_0x2c1a('0x2e'),_0x332e47+'-'+_0x131c93+'/'+_0x3cbe41)[_0x2c1a('0x2b')](_0x15ed31);}return null;};}function patchUpdates(_0x1eb662){return function(_0x1cb959){try{jsonpatch[_0x2c1a('0x2f')](_0x1cb959,_0x1eb662,!![]);}catch(_0x1beead){return BPromise[_0x2c1a('0x30')](_0x1beead);}return _0x1cb959[_0x2c1a('0x31')]();};}function saveUpdates(_0x4daac2,_0x2364c6){return function(_0x438684){if(_0x438684){return _0x438684[_0x2c1a('0x32')](_0x4daac2)[_0x2c1a('0x1d')](function(_0x45a6f1){return _0x45a6f1;});}return null;};}function removeEntity(_0x26b7dd,_0x3d55d4){return function(_0x467a17){if(_0x467a17){return _0x467a17[_0x2c1a('0x33')]()[_0x2c1a('0x1d')](function(){_0x26b7dd[_0x2c1a('0x29')](0xcc)[_0x2c1a('0x2a')]();});}};}function handleEntityNotFound(_0x11a7aa,_0x13a3af){return function(_0x5e11fa){if(!_0x5e11fa){_0x11a7aa[_0x2c1a('0x28')](0x194);}return _0x5e11fa;};}function handleError(_0x5f504e,_0x5f4053){_0x5f4053=_0x5f4053||0x1f4;return function(_0x147270){logger['error'](_0x147270['stack']);if(_0x147270[_0x2c1a('0x34')]){delete _0x147270[_0x2c1a('0x34')];}_0x5f504e['status'](_0x5f4053)[_0x2c1a('0x35')](_0x147270);};}exports[_0x2c1a('0x36')]=function(_0x223df0,_0x539aff){var _0x2c665b={},_0x295eee={},_0x4244de={'count':0x0,'rows':[]};var _0x5392a7=_[_0x2c1a('0x37')](db[_0x2c1a('0x38')][_0x2c1a('0x39')],function(_0x54e881){return{'name':_0x54e881[_0x2c1a('0x3a')],'type':_0x54e881[_0x2c1a('0x3b')][_0x2c1a('0x3c')]};});_0x295eee[_0x2c1a('0x3d')]=_['map'](_0x5392a7,_0x2c1a('0x34'));_0x295eee[_0x2c1a('0x3e')]=_['keys'](_0x223df0[_0x2c1a('0x3e')]);_0x295eee[_0x2c1a('0x3f')]=_[_0x2c1a('0x40')](_0x295eee[_0x2c1a('0x3d')],_0x295eee['query']);_0x2c665b[_0x2c1a('0x41')]=_['intersection'](_0x295eee[_0x2c1a('0x3d')],qs[_0x2c1a('0x42')](_0x223df0[_0x2c1a('0x3e')][_0x2c1a('0x42')]));_0x2c665b[_0x2c1a('0x41')]=_0x2c665b['attributes'][_0x2c1a('0x43')]?_0x2c665b['attributes']:_0x295eee[_0x2c1a('0x3d')];if(!_0x223df0['query'][_0x2c1a('0x44')](_0x2c1a('0x45'))){_0x2c665b[_0x2c1a('0x46')]=qs[_0x2c1a('0x46')](_0x223df0[_0x2c1a('0x3e')][_0x2c1a('0x46')]);_0x2c665b[_0x2c1a('0x2d')]=qs['offset'](_0x223df0[_0x2c1a('0x3e')]['offset']);}_0x2c665b[_0x2c1a('0x47')]=qs['sort'](_0x223df0[_0x2c1a('0x3e')][_0x2c1a('0x48')]);_0x2c665b[_0x2c1a('0x49')]=qs[_0x2c1a('0x3f')](_['pick'](_0x223df0[_0x2c1a('0x3e')],_0x295eee[_0x2c1a('0x3f')]),_0x5392a7);if(_0x223df0[_0x2c1a('0x3e')][_0x2c1a('0x4a')]){_0x2c665b['where']=_[_0x2c1a('0x4b')](_0x2c665b[_0x2c1a('0x49')],{'$or':_['map'](_0x5392a7,function(_0x830c59){if(_0x830c59[_0x2c1a('0x3b')]!==_0x2c1a('0x4c')){var _0x33bb74={};_0x33bb74[_0x830c59[_0x2c1a('0x34')]]={'$like':'%'+_0x223df0[_0x2c1a('0x3e')]['filter']+'%'};return _0x33bb74;}})});}_0x2c665b=_[_0x2c1a('0x4b')]({},_0x2c665b,_0x223df0[_0x2c1a('0x4d')]);var _0x235236={'where':_0x2c665b[_0x2c1a('0x49')]};return db[_0x2c1a('0x38')]['count'](_0x235236)[_0x2c1a('0x1d')](function(_0x4c4f82){_0x4244de[_0x2c1a('0x2c')]=_0x4c4f82;if(_0x223df0[_0x2c1a('0x3e')][_0x2c1a('0x4e')]){_0x2c665b['include']=[{'all':!![]}];}return db[_0x2c1a('0x38')][_0x2c1a('0x4f')](_0x2c665b);})[_0x2c1a('0x1d')](function(_0xd5c146){_0x4244de[_0x2c1a('0x50')]=_0xd5c146;return _0x4244de;})[_0x2c1a('0x1d')](respondWithFilteredResult(_0x539aff,_0x2c665b))[_0x2c1a('0x51')](handleError(_0x539aff,null));};exports[_0x2c1a('0x52')]=function(_0x45d194,_0x28d4a4){var _0x216919={'raw':![],'where':{'id':_0x45d194['params']['id']}},_0xc90c60={};_0xc90c60['model']=_[_0x2c1a('0x53')](db[_0x2c1a('0x38')][_0x2c1a('0x39')]);_0xc90c60['query']=_['keys'](_0x45d194['query']);_0xc90c60[_0x2c1a('0x3f')]=_['intersection'](_0xc90c60[_0x2c1a('0x3d')],_0xc90c60[_0x2c1a('0x3e')]);_0x216919[_0x2c1a('0x41')]=_[_0x2c1a('0x40')](_0xc90c60['model'],qs[_0x2c1a('0x42')](_0x45d194['query'][_0x2c1a('0x42')]));_0x216919[_0x2c1a('0x41')]=_0x216919[_0x2c1a('0x41')][_0x2c1a('0x43')]?_0x216919[_0x2c1a('0x41')]:_0xc90c60[_0x2c1a('0x3d')];if(_0x45d194['query'][_0x2c1a('0x4e')]){_0x216919[_0x2c1a('0x54')]=[{'all':!![]}];}_0x216919=_[_0x2c1a('0x4b')]({},_0x216919,_0x45d194[_0x2c1a('0x4d')]);return db['Setting'][_0x2c1a('0x55')](_0x216919)[_0x2c1a('0x1d')](handleEntityNotFound(_0x28d4a4,null))[_0x2c1a('0x1d')](respondWithResult(_0x28d4a4,null))[_0x2c1a('0x51')](handleError(_0x28d4a4,null));};exports[_0x2c1a('0x32')]=function(_0x59a850,_0x208a16){if(_0x59a850[_0x2c1a('0x56')]['id']){delete _0x59a850['body']['id'];}return db['Setting'][_0x2c1a('0x55')]({'where':{'id':_0x59a850['params']['id']}})[_0x2c1a('0x1d')](handleEntityNotFound(_0x208a16,null))['then'](saveUpdates(_0x59a850[_0x2c1a('0x56')],null))[_0x2c1a('0x1d')](respondWithResult(_0x208a16,null))['catch'](handleError(_0x208a16,null));};exports[_0x2c1a('0x57')]=function(_0x71d923,_0x635578,_0x5c76d2){if(_0x71d923['file']&&_0x71d923[_0x2c1a('0x58')][_0x2c1a('0x59')]){_0x71d923[_0x2c1a('0x56')][_0x2c1a('0x5a')]=_0x71d923[_0x2c1a('0x58')][_0x2c1a('0x59')];}return db['Setting']['find']({'where':{'id':_0x71d923[_0x2c1a('0x5b')]['id']}})[_0x2c1a('0x1d')](handleEntityNotFound(_0x635578,null))[_0x2c1a('0x1d')](saveUpdates(_0x71d923[_0x2c1a('0x56')],null))[_0x2c1a('0x1d')](respondWithResult(_0x635578,null))[_0x2c1a('0x51')](handleError(_0x635578,null));};exports[_0x2c1a('0x5c')]=function(_0x1ecb22,_0x1e39aa,_0x4ca7bc){if(_0x1ecb22[_0x2c1a('0x58')]&&_0x1ecb22[_0x2c1a('0x58')][_0x2c1a('0x59')]){_0x1ecb22[_0x2c1a('0x56')]['loginLogo']=_0x1ecb22[_0x2c1a('0x58')][_0x2c1a('0x59')];}return db['Setting'][_0x2c1a('0x55')]({'where':{'id':_0x1ecb22[_0x2c1a('0x5b')]['id']}})[_0x2c1a('0x1d')](handleEntityNotFound(_0x1e39aa,null))[_0x2c1a('0x1d')](saveUpdates(_0x1ecb22[_0x2c1a('0x56')],null))[_0x2c1a('0x1d')](respondWithResult(_0x1e39aa,null))[_0x2c1a('0x51')](handleError(_0x1e39aa,null));};var utilLicense=require(_0x2c1a('0x5d'));exports['getLogo']=function(_0x28f9cf,_0x2157bf,_0x59cd9b){var _0x3d365e=_0x2c1a('0x5e');var _0x2a2651={'custom':![]};return utilLicense['getLicense']()[_0x2c1a('0x1d')](function(_0x2fe44f){if(_0x2fe44f){_0x2a2651=_0x2fe44f;}return db[_0x2c1a('0x38')][_0x2c1a('0x55')]({'where':{'id':_0x28f9cf[_0x2c1a('0x5b')]['id']},'attributes':[_0x2c1a('0x5a'),'loginLogo',_0x2c1a('0x5f'),_0x2c1a('0x60'),_0x2c1a('0x61'),'defaultLoginLogo',_0x2c1a('0x62'),_0x2c1a('0x63')],'raw':!![]});})['then'](handleEntityNotFound(_0x2157bf,null))[_0x2c1a('0x1d')](function(_0x36d3fa){if(_0x36d3fa){var _0x43c649=_0x36d3fa[_0x2c1a('0x5a')]&&fs[_0x2c1a('0x64')](path[_0x2c1a('0x65')](config[_0x2c1a('0x66')],_0x3d365e,_[_0x2c1a('0x67')](_0x36d3fa[_0x2c1a('0x5a')])))?path[_0x2c1a('0x65')](config['root'],_0x3d365e,_['toLower'](_0x36d3fa[_0x2c1a('0x5a')])):path[_0x2c1a('0x65')](config[_0x2c1a('0x66')],_0x3d365e,_[_0x2c1a('0x67')](_0x2c1a('0x68')));var _0x6c55d0=_0x2c1a('0x69')+_[_0x2c1a('0x6a')](_0x2c1a('0x5a'));if(_0x36d3fa[_0x6c55d0]||!_0x2a2651[_0x2c1a('0x6b')]){_0x43c649=path[_0x2c1a('0x65')](config['root'],_0x3d365e,_[_0x2c1a('0x67')](_0x2c1a('0x68')));}if(!fs[_0x2c1a('0x64')](_0x43c649)){throw new db[(_0x2c1a('0x19'))][(_0x2c1a('0x1a'))](_['upperFirst'](_0x2c1a('0x5a'))+'\x20not\x20found');}return _0x2157bf[_0x2c1a('0x6c')](_0x43c649);}})['catch'](handleError(_0x2157bf,null));};var utilLicense=require(_0x2c1a('0x5d'));exports['getLogoLogin']=function(_0x3bb16e,_0x2bb35e,_0x324cd4){var _0x13e4e4=_0x2c1a('0x5e');var _0x46136b={'custom':![]};return utilLicense[_0x2c1a('0x6d')]()[_0x2c1a('0x1d')](function(_0x2b6113){if(_0x2b6113){_0x46136b=_0x2b6113;}return db['Setting'][_0x2c1a('0x55')]({'where':{'id':_0x3bb16e[_0x2c1a('0x5b')]['id']},'attributes':[_0x2c1a('0x5a'),_0x2c1a('0x6e'),_0x2c1a('0x5f'),'favicon',_0x2c1a('0x61'),_0x2c1a('0x6f'),_0x2c1a('0x62'),_0x2c1a('0x63')],'raw':!![]});})[_0x2c1a('0x1d')](handleEntityNotFound(_0x2bb35e,null))['then'](function(_0x3a2de5){if(_0x3a2de5){var _0x588f94=_0x3a2de5[_0x2c1a('0x6e')]&&fs[_0x2c1a('0x64')](path[_0x2c1a('0x65')](config[_0x2c1a('0x66')],_0x13e4e4,_['toLower'](_0x3a2de5[_0x2c1a('0x6e')])))?path[_0x2c1a('0x65')](config['root'],_0x13e4e4,_['toLower'](_0x3a2de5['loginLogo'])):path[_0x2c1a('0x65')](config[_0x2c1a('0x66')],_0x13e4e4,_['toLower'](_0x2c1a('0x70')));var _0x121087=_0x2c1a('0x69')+_['upperFirst'](_0x2c1a('0x6e'));if(_0x3a2de5[_0x121087]||!_0x46136b['custom']){_0x588f94=path[_0x2c1a('0x65')](config[_0x2c1a('0x66')],_0x13e4e4,_[_0x2c1a('0x67')]('default_loginLogo.svg'));}if(!fs[_0x2c1a('0x64')](_0x588f94)){throw new db[(_0x2c1a('0x19'))][(_0x2c1a('0x1a'))](_[_0x2c1a('0x6a')]('loginLogo')+'\x20not\x20found');}return _0x2bb35e[_0x2c1a('0x6c')](_0x588f94);}})[_0x2c1a('0x51')](handleError(_0x2bb35e,null));};exports['gdpr']=function(_0x466db5,_0x4bf0b5){return db[_0x2c1a('0x38')][_0x2c1a('0x55')]({'where':{'id':_0x466db5[_0x2c1a('0x5b')]['id']},'attributes':[_0x2c1a('0x71')]})[_0x2c1a('0x1d')](respondWithResult(_0x4bf0b5,null))[_0x2c1a('0x51')](handleError(_0x4bf0b5,null));};exports[_0x2c1a('0x72')]=function(_0xf10bdc,_0x456065,_0x56efa9){if(_0xf10bdc[_0x2c1a('0x58')]&&_0xf10bdc['file']['filename']){_0xf10bdc['body']['preferred']=_0xf10bdc[_0x2c1a('0x58')][_0x2c1a('0x59')];}return db[_0x2c1a('0x38')][_0x2c1a('0x55')]({'where':{'id':_0xf10bdc[_0x2c1a('0x5b')]['id']}})[_0x2c1a('0x1d')](handleEntityNotFound(_0x456065,null))['then'](saveUpdates(_0xf10bdc[_0x2c1a('0x56')],null))[_0x2c1a('0x1d')](respondWithResult(_0x456065,null))['catch'](handleError(_0x456065,null));};var utilLicense=require('../../config/license/util');exports[_0x2c1a('0x73')]=function(_0x514ce7,_0x46f149,_0x2bfabe){var _0x100a32=_0x2c1a('0x5e');var _0x1a2905={'custom':![]};return utilLicense['getLicense']()[_0x2c1a('0x1d')](function(_0x5aec3b){if(_0x5aec3b){_0x1a2905=_0x5aec3b;}return db[_0x2c1a('0x38')]['find']({'where':{'id':_0x514ce7['params']['id']},'attributes':[_0x2c1a('0x5a'),_0x2c1a('0x6e'),_0x2c1a('0x5f'),_0x2c1a('0x60'),_0x2c1a('0x61'),_0x2c1a('0x6f'),_0x2c1a('0x62'),_0x2c1a('0x63')],'raw':!![]});})[_0x2c1a('0x1d')](handleEntityNotFound(_0x46f149,null))[_0x2c1a('0x1d')](function(_0xb905eb){if(_0xb905eb){var _0x757835=_0xb905eb[_0x2c1a('0x5f')]&&fs[_0x2c1a('0x64')](path[_0x2c1a('0x65')](config[_0x2c1a('0x66')],_0x100a32,_[_0x2c1a('0x67')](_0xb905eb[_0x2c1a('0x5f')])))?path[_0x2c1a('0x65')](config[_0x2c1a('0x66')],_0x100a32,_[_0x2c1a('0x67')](_0xb905eb[_0x2c1a('0x5f')])):path[_0x2c1a('0x65')](config['root'],_0x100a32,_['toLower'](_0x2c1a('0x74')));var _0x40698a=_0x2c1a('0x69')+_[_0x2c1a('0x6a')](_0x2c1a('0x5f'));if(_0xb905eb[_0x40698a]||!_0x1a2905[_0x2c1a('0x6b')]||!_0x1a2905[_0x2c1a('0x5f')]){_0x757835=path[_0x2c1a('0x65')](config[_0x2c1a('0x66')],_0x100a32,_[_0x2c1a('0x67')](_0x2c1a('0x74')));}if(!fs[_0x2c1a('0x64')](_0x757835)){throw new db[(_0x2c1a('0x19'))][(_0x2c1a('0x1a'))](_['upperFirst'](_0x2c1a('0x5f'))+_0x2c1a('0x75'));}return _0x46f149['download'](_0x757835);}})[_0x2c1a('0x51')](handleError(_0x46f149,null));};exports[_0x2c1a('0x76')]=function(_0x273cf1,_0x23112d,_0x3cc675){if(_0x273cf1[_0x2c1a('0x58')]&&_0x273cf1[_0x2c1a('0x58')]['filename']){_0x273cf1[_0x2c1a('0x56')][_0x2c1a('0x60')]=_0x273cf1[_0x2c1a('0x58')][_0x2c1a('0x59')];}return db[_0x2c1a('0x38')][_0x2c1a('0x55')]({'where':{'id':_0x273cf1['params']['id']}})[_0x2c1a('0x1d')](handleEntityNotFound(_0x23112d,null))[_0x2c1a('0x1d')](saveUpdates(_0x273cf1[_0x2c1a('0x56')],null))[_0x2c1a('0x1d')](respondWithResult(_0x23112d,null))[_0x2c1a('0x51')](handleError(_0x23112d,null));};var utilLicense=require('../../config/license/util');exports[_0x2c1a('0x77')]=function(_0x568621,_0x4a2ee8,_0xb62670){var _0x3df7d1=_0x2c1a('0x5e');var _0x35fc3d={'custom':![]};return utilLicense['getLicense']()[_0x2c1a('0x1d')](function(_0x1ee704){if(_0x1ee704){_0x35fc3d=_0x1ee704;}return db[_0x2c1a('0x38')][_0x2c1a('0x55')]({'where':{'id':_0x568621[_0x2c1a('0x5b')]['id']},'attributes':['logo',_0x2c1a('0x6e'),_0x2c1a('0x5f'),_0x2c1a('0x60'),_0x2c1a('0x61'),'defaultLoginLogo',_0x2c1a('0x62'),_0x2c1a('0x63')],'raw':!![]});})[_0x2c1a('0x1d')](handleEntityNotFound(_0x4a2ee8,null))[_0x2c1a('0x1d')](function(_0x796a2b){if(_0x796a2b){var _0x31df1b=_0x796a2b[_0x2c1a('0x60')]&&fs[_0x2c1a('0x64')](path[_0x2c1a('0x65')](config[_0x2c1a('0x66')],_0x3df7d1,_[_0x2c1a('0x67')](_0x796a2b[_0x2c1a('0x60')])))?path[_0x2c1a('0x65')](config[_0x2c1a('0x66')],_0x3df7d1,_[_0x2c1a('0x67')](_0x796a2b[_0x2c1a('0x60')])):path[_0x2c1a('0x65')](config[_0x2c1a('0x66')],_0x3df7d1,_['toLower'](_0x2c1a('0x78')));var _0x428ad1=_0x2c1a('0x69')+_[_0x2c1a('0x6a')]('favicon');if(_0x796a2b[_0x428ad1]||!_0x35fc3d[_0x2c1a('0x6b')]){_0x31df1b=path['join'](config[_0x2c1a('0x66')],_0x3df7d1,_[_0x2c1a('0x67')](_0x2c1a('0x78')));}if(!fs['existsSync'](_0x31df1b)){throw new db[(_0x2c1a('0x19'))][(_0x2c1a('0x1a'))](_[_0x2c1a('0x6a')](_0x2c1a('0x60'))+_0x2c1a('0x75'));}return _0x4a2ee8['download'](_0x31df1b);}})[_0x2c1a('0x51')](handleError(_0x4a2ee8,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 6cf0b09..eb2ab22 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 _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 +var _0x1cbc=['util','moment','bluebird','request-promise','path','../../config/environment','./setting.attributes','exports','lodash'];(function(_0x369605,_0x4f5da9){var _0x48f6e3=function(_0x47ce1f){while(--_0x47ce1f){_0x369605['push'](_0x369605['shift']());}};_0x48f6e3(++_0x4f5da9);}(_0x1cbc,0x19d));var _0xc1cb=function(_0x598efc,_0x5e971c){_0x598efc=_0x598efc-0x0;var _0x435e4f=_0x1cbc[_0x598efc];return _0x435e4f;};'use strict';var _=require(_0xc1cb('0x0'));var util=require(_0xc1cb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc1cb('0x2'));var BPromise=require(_0xc1cb('0x3'));var rp=require(_0xc1cb('0x4'));var fs=require('fs');var path=require(_0xc1cb('0x5'));var rimraf=require('rimraf');var config=require(_0xc1cb('0x6'));var attributes=require(_0xc1cb('0x7'));module[_0xc1cb('0x8')]=function(_0x25fe12,_0x40d18c){return _0x25fe12['define']('Setting',attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 8f86e7a..47da89d 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 _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 +var _0xf68e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','then','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','Setting,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird'];(function(_0xdbc55a,_0x3e72d4){var _0x43f617=function(_0x3f9802){while(--_0x3f9802){_0xdbc55a['push'](_0xdbc55a['shift']());}};_0x43f617(++_0x3e72d4);}(_0xf68e,0x1b4));var _0xef68=function(_0x2588f0,_0x36455){_0x2588f0=_0x2588f0-0x0;var _0xe05c1=_0xf68e[_0x2588f0];return _0xe05c1;};'use strict';var _=require(_0xef68('0x0'));var util=require(_0xef68('0x1'));var moment=require(_0xef68('0x2'));var BPromise=require(_0xef68('0x3'));var rs=require(_0xef68('0x4'));var fs=require('fs');var Redis=require(_0xef68('0x5'));var db=require(_0xef68('0x6'))['db'];var utils=require(_0xef68('0x7'));var logger=require(_0xef68('0x8'))('rpc');var config=require(_0xef68('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x21119a,_0x4866bd,_0x1c8c79){return new BPromise(function(_0x11a196,_0xc1b0a0){return client[_0xef68('0xa')](_0x21119a,_0x1c8c79)[_0xef68('0xb')](function(_0x7393c9){logger[_0xef68('0xc')]('Setting,\x20%s,\x20%s',_0x4866bd,_0xef68('0xd'));logger['debug'](_0xef68('0xe'),_0x4866bd,_0xef68('0xd'),JSON[_0xef68('0xf')](_0x7393c9));if(_0x7393c9['error']){if(_0x7393c9[_0xef68('0x10')]['code']===0x1f4){logger['error'](_0xef68('0x11'),_0x4866bd,_0x7393c9[_0xef68('0x10')][_0xef68('0x12')]);return _0xc1b0a0(_0x7393c9['error']['message']);}logger[_0xef68('0x10')](_0xef68('0x11'),_0x4866bd,_0x7393c9[_0xef68('0x10')][_0xef68('0x12')]);return _0x11a196(_0x7393c9[_0xef68('0x10')][_0xef68('0x12')]);}else{logger[_0xef68('0xc')](_0xef68('0x11'),_0x4866bd,_0xef68('0xd'));_0x11a196(_0x7393c9['result']['message']);}})[_0xef68('0x13')](function(_0x3f6782){logger['error']('Setting,\x20%s,\x20%s',_0x4866bd,_0x3f6782);_0xc1b0a0(_0x3f6782);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 18439fd..d527539 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 _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 +var _0x7a84=['getApplications','getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/notify','notify','addApplications','send','/:id/status','status','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications'];(function(_0x145a54,_0x2cbcca){var _0x5ec128=function(_0x3d2f79){while(--_0x3d2f79){_0x145a54['push'](_0x145a54['shift']());}};_0x5ec128(++_0x2cbcca);}(_0x7a84,0x186));var _0x47a8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7a84[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x47a8('0x0'));var path=require(_0x47a8('0x1'));var timeout=require(_0x47a8('0x2'));var express=require('express');var router=express[_0x47a8('0x3')]();var auth=require(_0x47a8('0x4'));var interaction=require(_0x47a8('0x5'));var config=require('../../config/environment');var controller=require(_0x47a8('0x6'));router[_0x47a8('0x7')]('/',auth[_0x47a8('0x8')](),controller['index']);router['get']('/describe',auth[_0x47a8('0x8')](),controller[_0x47a8('0x9')]);router['get'](_0x47a8('0xa'),auth[_0x47a8('0x8')](),controller[_0x47a8('0xb')]);router[_0x47a8('0x7')](_0x47a8('0xc'),auth[_0x47a8('0x8')](),controller[_0x47a8('0xd')]);router['get'](_0x47a8('0xe'),auth['isAuthenticated'](),controller[_0x47a8('0xf')]);router[_0x47a8('0x7')](_0x47a8('0x10'),auth['isAuthenticated'](),controller[_0x47a8('0x11')]);router[_0x47a8('0x7')]('/:id/interactions',auth[_0x47a8('0x8')](),controller[_0x47a8('0x12')]);router[_0x47a8('0x7')]('/:id/status',controller[_0x47a8('0x13')]);router['get'](_0x47a8('0x14'),auth[_0x47a8('0x8')](),controller[_0x47a8('0x15')]);router[_0x47a8('0x16')]('/',auth[_0x47a8('0x8')](),controller[_0x47a8('0x17')]);router[_0x47a8('0x16')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x47a8('0x18')]);router[_0x47a8('0x16')](_0x47a8('0xe'),auth[_0x47a8('0x8')](),controller['addAnswer']);router[_0x47a8('0x16')](_0x47a8('0x19'),controller[_0x47a8('0x1a')]);router[_0x47a8('0x16')]('/:id/applications',auth['isAuthenticated'](),controller[_0x47a8('0x1b')]);router[_0x47a8('0x16')]('/:id/send',auth[_0x47a8('0x8')](),controller[_0x47a8('0x1c')]);router['post'](_0x47a8('0x1d'),controller[_0x47a8('0x1e')]);router[_0x47a8('0x16')]('/:id/users',auth[_0x47a8('0x8')](),controller['addAgents']);router['put'](_0x47a8('0xa'),auth[_0x47a8('0x8')](),controller[_0x47a8('0x1f')]);router['delete'](_0x47a8('0xa'),auth[_0x47a8('0x8')](),controller[_0x47a8('0x20')]);router[_0x47a8('0x21')](_0x47a8('0xc'),auth[_0x47a8('0x8')](),controller[_0x47a8('0x22')]);router[_0x47a8('0x21')](_0x47a8('0xe'),auth[_0x47a8('0x8')](),controller[_0x47a8('0x23')]);router[_0x47a8('0x21')]('/:id/users',auth[_0x47a8('0x8')](),controller[_0x47a8('0x24')]);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 b92b463..d52bd0b 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 _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 +var _0xb0cf=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate','ENUM','twilio','clicksend','plivo','clickatell','csc','infobip','intelepeer','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER'];(function(_0x4b5b68,_0x4ba484){var _0x364346=function(_0x29eb21){while(--_0x29eb21){_0x4b5b68['push'](_0x4b5b68['shift']());}};_0x364346(++_0x4ba484);}(_0xb0cf,0x107));var _0xfb0c=function(_0x3c6622,_0xeac315){_0x3c6622=_0x3c6622-0x0;var _0x4299a6=_0xb0cf[_0x3c6622];return _0x4299a6;};'use strict';var Sequelize=require(_0xfb0c('0x0'));var rs=require(_0xfb0c('0x1'));module[_0xfb0c('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xfb0c('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xfb0c('0x4')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xfb0c('0x4')],'defaultValue':function(){return rs[_0xfb0c('0x5')]();}},'phone':{'type':Sequelize[_0xfb0c('0x4')]},'type':{'type':Sequelize[_0xfb0c('0x6')](_0xfb0c('0x7'),'skebby','connectel',_0xfb0c('0x8'),_0xfb0c('0x9'),_0xfb0c('0xa'),_0xfb0c('0xb'),_0xfb0c('0xc'),_0xfb0c('0xd'))},'accountSid':{'type':Sequelize[_0xfb0c('0x4')]},'authId':{'type':Sequelize[_0xfb0c('0x4')]},'authToken':{'type':Sequelize[_0xfb0c('0x4')]},'smsMethod':{'type':Sequelize[_0xfb0c('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0xfb0c('0x4')]},'password':{'type':Sequelize[_0xfb0c('0x4')]},'apiKey':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xfb0c('0x4')]},'deliveryReport':{'type':Sequelize[_0xfb0c('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0xfb0c('0x4')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xfb0c('0xf');}},'notificationSound':{'type':Sequelize[_0xfb0c('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfb0c('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfb0c('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfb0c('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfb0c('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xfb0c('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfb0c('0x10')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xfb0c('0xe')],'defaultValue':![],'comment':_0xfb0c('0x11'),'set':function(_0x29382d){if(!_0x29382d)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xfb0c('0x12')](_0xfb0c('0x13'),_0x29382d);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 3b2d319..8bc0410 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 _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 +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(_0x58c103,_0x151375){var _0x418962=function(_0xa23ac){while(--_0xa23ac){_0x58c103['push'](_0x58c103['shift']());}};_0x418962(++_0x151375);}(_0x7a54,0x106));var _0x47a5=function(_0x2a70ac,_0x5467f7){_0x2a70ac=_0x2a70ac-0x0;var _0x54ebb5=_0x7a54[_0x2a70ac];return _0x54ebb5;};'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 e8f5e32..710d76d 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 _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 +var _0x3165=['events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4a3094,_0x179b88){var _0x58105b=function(_0x4a661e){while(--_0x4a661e){_0x4a3094['push'](_0x4a3094['shift']());}};_0x58105b(++_0x179b88);}(_0x3165,0xbb));var _0x5316=function(_0x4409e6,_0x767847){_0x4409e6=_0x4409e6-0x0;var _0x348c46=_0x3165[_0x4409e6];return _0x348c46;};'use strict';var EventEmitter=require(_0x5316('0x0'));var SmsAccount=require(_0x5316('0x1'))['db'][_0x5316('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x5316('0x3')](0x0);var events={'afterCreate':_0x5316('0x4'),'afterUpdate':_0x5316('0x5'),'afterDestroy':_0x5316('0x6')};function emitEvent(_0x49d016){return function(_0x2be3f6,_0x5b2c3a,_0x266eb8){SmsAccountEvents[_0x5316('0x7')](_0x49d016+':'+_0x2be3f6['id'],_0x2be3f6);SmsAccountEvents[_0x5316('0x7')](_0x49d016,_0x2be3f6);_0x266eb8(null);};}for(var e in events){if(events[_0x5316('0x8')](e)){var event=events[e];SmsAccount[_0x5316('0x9')](e,emitEvent(event));}}module[_0x5316('0xa')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 0e0fd24..aa912c0 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 _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 +var _0xe923=['bluebird','request-promise','./smsAccount.attributes','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0x5737ab,_0x1c385c){var _0xcf4678=function(_0x5e5a6e){while(--_0x5e5a6e){_0x5737ab['push'](_0x5737ab['shift']());}};_0xcf4678(++_0x1c385c);}(_0xe923,0xd7));var _0x3e92=function(_0x22d1ef,_0x4a5152){_0x22d1ef=_0x22d1ef-0x0;var _0x47c5a3=_0xe923[_0x22d1ef];return _0x47c5a3;};'use strict';var _=require(_0x3e92('0x0'));var util=require(_0x3e92('0x1'));var logger=require(_0x3e92('0x2'))(_0x3e92('0x3'));var moment=require(_0x3e92('0x4'));var BPromise=require(_0x3e92('0x5'));var rp=require(_0x3e92('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3e92('0x7'));module[_0x3e92('0x8')]=function(_0x3c92ce,_0x38eefe){return _0x3c92ce[_0x3e92('0x9')]('SmsAccount',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 9aab520..7966200 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 _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 +var _0x882f=['register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','redis','./smsAccount.socket'];(function(_0x53f37f,_0xfb0b18){var _0x2fe5f8=function(_0x76ef2d){while(--_0x76ef2d){_0x53f37f['push'](_0x53f37f['shift']());}};_0x2fe5f8(++_0xfb0b18);}(_0x882f,0xa8));var _0xf882=function(_0x1acefc,_0x5da0bf){_0x1acefc=_0x1acefc-0x0;var _0x543527=_0x882f[_0x1acefc];return _0x543527;};'use strict';var _=require(_0xf882('0x0'));var util=require(_0xf882('0x1'));var moment=require(_0xf882('0x2'));var BPromise=require(_0xf882('0x3'));var rs=require(_0xf882('0x4'));var fs=require('fs');var Redis=require(_0xf882('0x5'));var db=require(_0xf882('0x6'))['db'];var utils=require(_0xf882('0x7'));var logger=require(_0xf882('0x8'))(_0xf882('0x9'));var config=require(_0xf882('0xa'));var jayson=require(_0xf882('0xb'));var client=jayson['client'][_0xf882('0xc')]({'port':0x232a});config['redis']=_[_0xf882('0xd')](config['redis'],{'host':_0xf882('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf882('0xf')]));require(_0xf882('0x10'))[_0xf882('0x11')](socket);function respondWithRpcPromise(_0x5cf96c,_0x297ac8,_0x1e3ade){return new BPromise(function(_0x6e4a1,_0x317004){return client['request'](_0x5cf96c,_0x1e3ade)[_0xf882('0x12')](function(_0x201d14){logger[_0xf882('0x13')](_0xf882('0x14'),_0x297ac8,_0xf882('0x15'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x297ac8,_0xf882('0x15'),JSON[_0xf882('0x16')](_0x201d14));if(_0x201d14[_0xf882('0x17')]){if(_0x201d14[_0xf882('0x17')]['code']===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x297ac8,_0x201d14['error'][_0xf882('0x18')]);return _0x317004(_0x201d14[_0xf882('0x17')]['message']);}logger['error'](_0xf882('0x14'),_0x297ac8,_0x201d14[_0xf882('0x17')][_0xf882('0x18')]);return _0x6e4a1(_0x201d14[_0xf882('0x17')][_0xf882('0x18')]);}else{logger[_0xf882('0x13')](_0xf882('0x14'),_0x297ac8,_0xf882('0x15'));_0x6e4a1(_0x201d14[_0xf882('0x19')][_0xf882('0x18')]);}})[_0xf882('0x1a')](function(_0x3372d6){logger[_0xf882('0x17')]('SmsAccount,\x20%s,\x20%s',_0x297ac8,_0x3372d6);_0x317004(_0x3372d6);});});}exports[_0xf882('0x1b')]=function(_0x2c3638){var _0xcaf07f=this;return new Promise(function(_0x46a97d,_0x316378){return db[_0xf882('0x1c')][_0xf882('0x1d')]({'raw':_0x2c3638[_0xf882('0x1e')]?_0x2c3638[_0xf882('0x1e')][_0xf882('0x1f')]===undefined?!![]:![]:!![],'where':_0x2c3638['options']?_0x2c3638['options'][_0xf882('0x20')]||null:null,'attributes':_0x2c3638['options']?_0x2c3638['options'][_0xf882('0x21')]||null:null,'include':_0x2c3638[_0xf882('0x1e')]?_0x2c3638['options'][_0xf882('0x22')]?_['map'](_0x2c3638['options']['include'],function(_0x294013){return{'model':db[_0x294013[_0xf882('0x23')]],'as':_0x294013['as'],'attributes':_0x294013['attributes'],'include':_0x294013[_0xf882('0x22')]?_['map'](_0x294013['include'],function(_0x3dbe21){return{'model':db[_0x3dbe21[_0xf882('0x23')]],'as':_0x3dbe21['as'],'attributes':_0x3dbe21[_0xf882('0x21')],'include':_0x3dbe21['include']?_['map'](_0x3dbe21['include'],function(_0x1f3793){return{'model':db[_0x1f3793[_0xf882('0x23')]],'as':_0x1f3793['as'],'attributes':_0x1f3793['attributes']};}):[]};}):[]};}):[]:[]})[_0xf882('0x12')](function(_0x146a86){logger[_0xf882('0x13')]('ShowSmsAccount',_0x2c3638);logger[_0xf882('0x24')]('ShowSmsAccount',_0x2c3638,JSON[_0xf882('0x16')](_0x146a86));_0x46a97d(_0x146a86);})['catch'](function(_0x1bd403){logger[_0xf882('0x17')](_0xf882('0x1b'),_0x1bd403['message'],_0x2c3638);_0x316378(_0xcaf07f[_0xf882('0x17')](0x1f4,_0x1bd403[_0xf882('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 414014b..529149b 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 _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 +var _0xf35d=['register','length','./smsAccount.events','remove','emit','removeListener'];(function(_0x1bc00d,_0x4daebf){var _0xf61005=function(_0x1daadf){while(--_0x1daadf){_0x1bc00d['push'](_0x1bc00d['shift']());}};_0xf61005(++_0x4daebf);}(_0xf35d,0x17c));var _0xdf35=function(_0x17c3ea,_0x18f9a4){_0x17c3ea=_0x17c3ea-0x0;var _0x476d7f=_0xf35d[_0x17c3ea];return _0x476d7f;};'use strict';var SmsAccountEvents=require(_0xdf35('0x0'));var events=['save',_0xdf35('0x1'),'update'];function createListener(_0x1c77d6,_0x2c4abd){return function(_0x5a1692){_0x2c4abd[_0xdf35('0x2')](_0x1c77d6,_0x5a1692);};}function removeListener(_0x523d72,_0x222e83){return function(){SmsAccountEvents[_0xdf35('0x3')](_0x523d72,_0x222e83);};}exports[_0xdf35('0x4')]=function(_0x7cfe71){for(var _0x41036b=0x0,_0x30e2ee=events[_0xdf35('0x5')];_0x41036b<_0x30e2ee;_0x41036b++){var _0x5802cf=events[_0x41036b];var _0x49eb59=createListener('smsAccount:'+_0x5802cf,_0x7cfe71);SmsAccountEvents['on'](_0x5802cf,_0x49eb59);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 64fc057..885f759 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 _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 +var _0xb7d2=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','exports','util'];(function(_0x2006b9,_0x4c8332){var _0x5ebfe7=function(_0x39c9e4){while(--_0x39c9e4){_0x2006b9['push'](_0x2006b9['shift']());}};_0x5ebfe7(++_0x4c8332);}(_0xb7d2,0x71));var _0x2b7d=function(_0x42f522,_0x594a2c){_0x42f522=_0x42f522-0x0;var _0x1a1377=_0xb7d2[_0x42f522];return _0x1a1377;};'use strict';var multer=require('multer');var util=require(_0x2b7d('0x0'));var path=require(_0x2b7d('0x1'));var timeout=require(_0x2b7d('0x2'));var express=require(_0x2b7d('0x3'));var router=express[_0x2b7d('0x4')]();var auth=require(_0x2b7d('0x5'));var interaction=require(_0x2b7d('0x6'));var config=require('../../config/environment');var controller=require(_0x2b7d('0x7'));router[_0x2b7d('0x8')]('/',auth[_0x2b7d('0x9')](),controller[_0x2b7d('0xa')]);router[_0x2b7d('0x8')]('/:id',auth[_0x2b7d('0x9')](),controller[_0x2b7d('0xb')]);router[_0x2b7d('0xc')]('/',auth[_0x2b7d('0x9')](),controller[_0x2b7d('0xd')]);router[_0x2b7d('0xe')](_0x2b7d('0xf'),auth[_0x2b7d('0x9')](),controller['update']);router[_0x2b7d('0x10')](_0x2b7d('0xf'),auth[_0x2b7d('0x9')](),controller[_0x2b7d('0x11')]);module[_0x2b7d('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 9181a11..eae5130 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 _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 +var _0x2f15=['*,*,*,*','INTEGER','STRING','TEXT'];(function(_0x1b2e01,_0x174576){var _0x1425e5=function(_0x9b174f){while(--_0x9b174f){_0x1b2e01['push'](_0x1b2e01['shift']());}};_0x1425e5(++_0x174576);}(_0x2f15,0xad));var _0x52f1=function(_0x286892,_0xe74dd9){_0x286892=_0x286892-0x0;var _0x318e28=_0x2f15[_0x286892];return _0x318e28;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x52f1('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x52f1('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x52f1('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x52f1('0x1')],'defaultValue':_0x52f1('0x3')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 917461e..a26e261 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 _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 +var _0xb78e=['show','params','keys','length','create','body','find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','update','then','error','stack','name','send','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','count','includeAll','include','rows','catch'];(function(_0x43b65f,_0xb59f1e){var _0x303772=function(_0x31a33e){while(--_0x31a33e){_0x43b65f['push'](_0x43b65f['shift']());}};_0x303772(++_0xb59f1e);}(_0xb78e,0x1c9));var _0xeb78=function(_0xaa72b3,_0xbd6780){_0xaa72b3=_0xaa72b3-0x0;var _0x3f7bf3=_0xb78e[_0xaa72b3];return _0x3f7bf3;};'use strict';var pdf=require(_0xeb78('0x0'));var emlformat=require(_0xeb78('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xeb78('0x2'));var jsonpatch=require(_0xeb78('0x3'));var rp=require(_0xeb78('0x4'));var moment=require(_0xeb78('0x5'));var BPromise=require(_0xeb78('0x6'));var Mustache=require(_0xeb78('0x7'));var util=require(_0xeb78('0x8'));var path=require(_0xeb78('0x9'));var sox=require('sox');var csv=require(_0xeb78('0xa'));var ejs=require(_0xeb78('0xb'));var fs=require('fs');var _=require(_0xeb78('0xc'));var squel=require(_0xeb78('0xd'));var crypto=require(_0xeb78('0xe'));var jsforce=require(_0xeb78('0xf'));var deskjs=require(_0xeb78('0x10'));var toCsv=require('to-csv');var querystring=require(_0xeb78('0x11'));var Papa=require(_0xeb78('0x12'));var Redis=require(_0xeb78('0x13'));var authService=require(_0xeb78('0x14'));var qs=require(_0xeb78('0x15'));var as=require(_0xeb78('0x16'));var hardwareService=require(_0xeb78('0x17'));var logger=require(_0xeb78('0x18'))(_0xeb78('0x19'));var utils=require('../../config/utils');var config=require(_0xeb78('0x1a'));var db=require(_0xeb78('0x1b'))['db'];function respondWithStatusCode(_0x3725e3,_0x259df2){_0x259df2=_0x259df2||0xcc;return function(_0x9dbe51){if(_0x9dbe51){return _0x3725e3[_0xeb78('0x1c')](_0x259df2);}return _0x3725e3[_0xeb78('0x1d')](_0x259df2)[_0xeb78('0x1e')]();};}function respondWithResult(_0x41bec0,_0x9bcc79){_0x9bcc79=_0x9bcc79||0xc8;return function(_0x5d50cf){if(_0x5d50cf){return _0x41bec0[_0xeb78('0x1d')](_0x9bcc79)[_0xeb78('0x1f')](_0x5d50cf);}};}function respondWithFilteredResult(_0x4e8b8c,_0x538485){return function(_0x53be89){if(_0x53be89){var _0x23a0d0=_0x53be89['count'],_0x50ebae=_0x538485[_0xeb78('0x20')],_0xa28d5e=_0x538485['offset']+_0x538485[_0xeb78('0x21')],_0x247cb1;if(_0xa28d5e>=_0x23a0d0){_0xa28d5e=_0x23a0d0;_0x247cb1=0xc8;}else{_0x247cb1=0xce;}_0x4e8b8c[_0xeb78('0x1d')](_0x247cb1);return _0x4e8b8c['set'](_0xeb78('0x22'),_0x50ebae+'-'+_0xa28d5e+'/'+_0x23a0d0)[_0xeb78('0x1f')](_0x53be89);}return null;};}function patchUpdates(_0x1cb338){return function(_0x5368ad){try{jsonpatch[_0xeb78('0x23')](_0x5368ad,_0x1cb338,!![]);}catch(_0x2c43c5){return BPromise['reject'](_0x2c43c5);}return _0x5368ad['save']();};}function saveUpdates(_0x455e30,_0x106c5d){return function(_0x42eacb){if(_0x42eacb){return _0x42eacb[_0xeb78('0x24')](_0x455e30)[_0xeb78('0x25')](function(_0x425de5){return _0x425de5;});}return null;};}function removeEntity(_0x2cf7cc,_0x3ea071){return function(_0x18f08d){if(_0x18f08d){return _0x18f08d['destroy']()['then'](function(){_0x2cf7cc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c8e66,_0x5b15d8){return function(_0x2159c1){if(!_0x2159c1){_0x3c8e66[_0xeb78('0x1c')](0x194);}return _0x2159c1;};}function handleError(_0x566336,_0x777ca3){_0x777ca3=_0x777ca3||0x1f4;return function(_0x4ac816){logger[_0xeb78('0x26')](_0x4ac816[_0xeb78('0x27')]);if(_0x4ac816[_0xeb78('0x28')]){delete _0x4ac816[_0xeb78('0x28')];}_0x566336['status'](_0x777ca3)[_0xeb78('0x29')](_0x4ac816);};}exports['index']=function(_0x31ad03,_0x23295a){var _0x4493bb={},_0x5263fc={},_0x1028ba={'count':0x0,'rows':[]};var _0x1e7d56=_[_0xeb78('0x2a')](db[_0xeb78('0x2b')][_0xeb78('0x2c')],function(_0x3516b8){return{'name':_0x3516b8[_0xeb78('0x2d')],'type':_0x3516b8[_0xeb78('0x2e')][_0xeb78('0x2f')]};});_0x5263fc[_0xeb78('0x30')]=_[_0xeb78('0x2a')](_0x1e7d56,'name');_0x5263fc['query']=_['keys'](_0x31ad03[_0xeb78('0x31')]);_0x5263fc[_0xeb78('0x32')]=_[_0xeb78('0x33')](_0x5263fc['model'],_0x5263fc[_0xeb78('0x31')]);_0x4493bb[_0xeb78('0x34')]=_[_0xeb78('0x33')](_0x5263fc[_0xeb78('0x30')],qs[_0xeb78('0x35')](_0x31ad03[_0xeb78('0x31')][_0xeb78('0x35')]));_0x4493bb[_0xeb78('0x34')]=_0x4493bb[_0xeb78('0x34')]['length']?_0x4493bb[_0xeb78('0x34')]:_0x5263fc['model'];if(!_0x31ad03[_0xeb78('0x31')][_0xeb78('0x36')](_0xeb78('0x37'))){_0x4493bb[_0xeb78('0x21')]=qs[_0xeb78('0x21')](_0x31ad03[_0xeb78('0x31')]['limit']);_0x4493bb['offset']=qs[_0xeb78('0x20')](_0x31ad03[_0xeb78('0x31')][_0xeb78('0x20')]);}_0x4493bb[_0xeb78('0x38')]=qs[_0xeb78('0x39')](_0x31ad03['query'][_0xeb78('0x39')]);_0x4493bb[_0xeb78('0x3a')]=qs[_0xeb78('0x32')](_[_0xeb78('0x3b')](_0x31ad03[_0xeb78('0x31')],_0x5263fc[_0xeb78('0x32')]),_0x1e7d56);if(_0x31ad03['query']['filter']){_0x4493bb['where']=_['merge'](_0x4493bb[_0xeb78('0x3a')],{'$or':_[_0xeb78('0x2a')](_0x1e7d56,function(_0x24a6e3){if(_0x24a6e3['type']!==_0xeb78('0x3c')){var _0x194cb5={};_0x194cb5[_0x24a6e3['name']]={'$like':'%'+_0x31ad03['query']['filter']+'%'};return _0x194cb5;}})});}_0x4493bb=_[_0xeb78('0x3d')]({},_0x4493bb,_0x31ad03[_0xeb78('0x3e')]);var _0x1ec55a={'where':_0x4493bb['where']};return db[_0xeb78('0x2b')][_0xeb78('0x3f')](_0x1ec55a)[_0xeb78('0x25')](function(_0x4fb001){_0x1028ba[_0xeb78('0x3f')]=_0x4fb001;if(_0x31ad03[_0xeb78('0x31')][_0xeb78('0x40')]){_0x4493bb[_0xeb78('0x41')]=[{'all':!![]}];}return db['SmsApplication']['findAll'](_0x4493bb);})[_0xeb78('0x25')](function(_0xa0284a){_0x1028ba[_0xeb78('0x42')]=_0xa0284a;return _0x1028ba;})[_0xeb78('0x25')](respondWithFilteredResult(_0x23295a,_0x4493bb))[_0xeb78('0x43')](handleError(_0x23295a,null));};exports[_0xeb78('0x44')]=function(_0x200600,_0x37d604){var _0x47567d={'raw':!![],'where':{'id':_0x200600[_0xeb78('0x45')]['id']}},_0x571552={};_0x571552[_0xeb78('0x30')]=_[_0xeb78('0x46')](db['SmsApplication'][_0xeb78('0x2c')]);_0x571552['query']=_[_0xeb78('0x46')](_0x200600[_0xeb78('0x31')]);_0x571552[_0xeb78('0x32')]=_['intersection'](_0x571552[_0xeb78('0x30')],_0x571552[_0xeb78('0x31')]);_0x47567d[_0xeb78('0x34')]=_[_0xeb78('0x33')](_0x571552[_0xeb78('0x30')],qs['fields'](_0x200600[_0xeb78('0x31')][_0xeb78('0x35')]));_0x47567d['attributes']=_0x47567d[_0xeb78('0x34')][_0xeb78('0x47')]?_0x47567d[_0xeb78('0x34')]:_0x571552['model'];if(_0x200600[_0xeb78('0x31')][_0xeb78('0x40')]){_0x47567d[_0xeb78('0x41')]=[{'all':!![]}];}_0x47567d=_[_0xeb78('0x3d')]({},_0x47567d,_0x200600[_0xeb78('0x3e')]);return db[_0xeb78('0x2b')]['find'](_0x47567d)['then'](handleEntityNotFound(_0x37d604,null))[_0xeb78('0x25')](respondWithResult(_0x37d604,null))[_0xeb78('0x43')](handleError(_0x37d604,null));};exports['create']=function(_0x108f8b,_0x3ee867){return db[_0xeb78('0x2b')][_0xeb78('0x48')](_0x108f8b[_0xeb78('0x49')],{})[_0xeb78('0x25')](respondWithResult(_0x3ee867,0xc9))[_0xeb78('0x43')](handleError(_0x3ee867,null));};exports[_0xeb78('0x24')]=function(_0x9d5b17,_0x2ba296){if(_0x9d5b17[_0xeb78('0x49')]['id']){delete _0x9d5b17[_0xeb78('0x49')]['id'];}return db[_0xeb78('0x2b')][_0xeb78('0x4a')]({'where':{'id':_0x9d5b17[_0xeb78('0x45')]['id']}})['then'](handleEntityNotFound(_0x2ba296,null))[_0xeb78('0x25')](saveUpdates(_0x9d5b17[_0xeb78('0x49')],null))[_0xeb78('0x25')](respondWithResult(_0x2ba296,null))[_0xeb78('0x43')](handleError(_0x2ba296,null));};exports['destroy']=function(_0x35cedb,_0x135106){return db[_0xeb78('0x2b')][_0xeb78('0x4a')]({'where':{'id':_0x35cedb[_0xeb78('0x45')]['id']}})['then'](handleEntityNotFound(_0x135106,null))['then'](removeEntity(_0x135106,null))['catch'](handleError(_0x135106,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index a94a6f0..6dcc603 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 _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 +var _0x86d5=['sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication'];(function(_0x3f4dd9,_0xe0b819){var _0x31c54a=function(_0x25e6c6){while(--_0x25e6c6){_0x3f4dd9['push'](_0x3f4dd9['shift']());}};_0x31c54a(++_0xe0b819);}(_0x86d5,0x1e3));var _0x586d=function(_0x3ed50d,_0x428212){_0x3ed50d=_0x3ed50d-0x0;var _0x41fdb5=_0x86d5[_0x3ed50d];return _0x41fdb5;};'use strict';var _=require(_0x586d('0x0'));var util=require('util');var logger=require(_0x586d('0x1'))(_0x586d('0x2'));var moment=require('moment');var BPromise=require(_0x586d('0x3'));var rp=require(_0x586d('0x4'));var fs=require('fs');var path=require(_0x586d('0x5'));var rimraf=require(_0x586d('0x6'));var config=require(_0x586d('0x7'));var attributes=require(_0x586d('0x8'));module[_0x586d('0x9')]=function(_0x51b8b0,_0x3fac92){return _0x51b8b0[_0x586d('0xa')](_0x586d('0xb'),attributes,{'tableName':_0x586d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x586d('0xd'),'collate':_0x586d('0xe')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 76bae54..5fb42bd 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 _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 +var _0x04f1=['http','request','then','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','info','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x193a9f,_0x53bcc3){var _0x369b17=function(_0x304f91){while(--_0x304f91){_0x193a9f['push'](_0x193a9f['shift']());}};_0x369b17(++_0x53bcc3);}(_0x04f1,0x92));var _0x104f=function(_0x36b124,_0x43eaec){_0x36b124=_0x36b124-0x0;var _0x18a336=_0x04f1[_0x36b124];return _0x18a336;};'use strict';var _=require(_0x104f('0x0'));var util=require(_0x104f('0x1'));var moment=require(_0x104f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x104f('0x3'));var db=require(_0x104f('0x4'))['db'];var utils=require(_0x104f('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x104f('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x289bb8,_0x5b7110,_0x1d5651){return new BPromise(function(_0x57acf5,_0x47582b){return client[_0x104f('0x7')](_0x289bb8,_0x1d5651)[_0x104f('0x8')](function(_0x37891c){logger['info']('SmsApplication,\x20%s,\x20%s',_0x5b7110,_0x104f('0x9'));logger[_0x104f('0xa')](_0x104f('0xb'),_0x5b7110,_0x104f('0x9'),JSON[_0x104f('0xc')](_0x37891c));if(_0x37891c[_0x104f('0xd')]){if(_0x37891c[_0x104f('0xd')][_0x104f('0xe')]===0x1f4){logger[_0x104f('0xd')](_0x104f('0xf'),_0x5b7110,_0x37891c['error'][_0x104f('0x10')]);return _0x47582b(_0x37891c[_0x104f('0xd')][_0x104f('0x10')]);}logger[_0x104f('0xd')](_0x104f('0xf'),_0x5b7110,_0x37891c[_0x104f('0xd')][_0x104f('0x10')]);return _0x57acf5(_0x37891c[_0x104f('0xd')][_0x104f('0x10')]);}else{logger[_0x104f('0x11')](_0x104f('0xf'),_0x5b7110,_0x104f('0x9'));_0x57acf5(_0x37891c[_0x104f('0x12')][_0x104f('0x10')]);}})['catch'](function(_0x12b9a6){logger[_0x104f('0xd')](_0x104f('0xf'),_0x5b7110,_0x12b9a6);_0x47582b(_0x12b9a6);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 76f2b69..242b35b 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 _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 +var _0x8f22=['smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','sms','smsinteraction:addtags','addTags','/:id','tracked'];(function(_0x3e9041,_0x58ab0e){var _0xf111fe=function(_0x2e9293){while(--_0x2e9293){_0x3e9041['push'](_0x3e9041['shift']());}};_0xf111fe(++_0x58ab0e);}(_0x8f22,0x1e3));var _0x28f2=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8f22[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x28f2('0x0'));var util=require(_0x28f2('0x1'));var path=require(_0x28f2('0x2'));var timeout=require(_0x28f2('0x3'));var express=require(_0x28f2('0x4'));var router=express[_0x28f2('0x5')]();var auth=require(_0x28f2('0x6'));var interaction=require(_0x28f2('0x7'));var config=require(_0x28f2('0x8'));var controller=require(_0x28f2('0x9'));router[_0x28f2('0xa')]('/',auth[_0x28f2('0xb')](),controller[_0x28f2('0xc')]);router[_0x28f2('0xa')](_0x28f2('0xd'),auth[_0x28f2('0xb')](),controller['describe']);router['get']('/:id',auth[_0x28f2('0xb')](),controller[_0x28f2('0xe')]);router[_0x28f2('0xa')](_0x28f2('0xf'),auth[_0x28f2('0xb')](),controller[_0x28f2('0x10')]);router['get'](_0x28f2('0x11'),auth['isAuthenticated'](),controller[_0x28f2('0x12')]);router[_0x28f2('0x13')]('/',auth[_0x28f2('0xb')](),controller['create']);router[_0x28f2('0x13')](_0x28f2('0xf'),auth['isAuthenticated'](),controller[_0x28f2('0x14')]);router[_0x28f2('0x13')](_0x28f2('0x15'),auth[_0x28f2('0xb')](),interaction['tracked'](_0x28f2('0x16'),_0x28f2('0x17')),controller[_0x28f2('0x18')]);router['put'](_0x28f2('0x19'),auth['isAuthenticated'](),interaction[_0x28f2('0x1a')](_0x28f2('0x16'),_0x28f2('0x1b')),controller[_0x28f2('0x1c')]);router[_0x28f2('0x1d')](_0x28f2('0x19'),auth[_0x28f2('0xb')](),interaction[_0x28f2('0x1a')](_0x28f2('0x16'),_0x28f2('0x1e')),controller[_0x28f2('0x1f')]);router[_0x28f2('0x1d')]('/:id/tags',auth['isAuthenticated'](),controller[_0x28f2('0x20')]);module[_0x28f2('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 40b5e1d..8c349c4 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 _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 +var _0x0713=['DATE','STRING','ENUM','out','exports','BOOLEAN'];(function(_0x5db657,_0x2f40b3){var _0x2d6e70=function(_0x358ed2){while(--_0x358ed2){_0x5db657['push'](_0x5db657['shift']());}};_0x2d6e70(++_0x2f40b3);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x3071('0x0')]={'closed':{'type':Sequelize[_0x3071('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3071('0x2')]},'disposition':{'type':Sequelize[_0x3071('0x3')]},'note':{'type':Sequelize[_0x3071('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x3071('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x3071('0x4')]('in',_0x3071('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3071('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x3071('0x4')]('in',_0x3071('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 405a68a..3b4fe31 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 _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 +var _0x70e0=['u.id','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','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','sqlOperator','length','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','body','start','end','keys','some','compact','isEmpty','SmsAccountId','where','i.SmsAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','order','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.phone','c.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','show','params','includeAll','include','create','describe','SmsMessage','addMessage','ids','omit','getMessages','findOne','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','files','tmp','join','server','transcript-%d-%s.zip','CmContact','lastName','Messages','SmsAccount','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','\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','closed','direction','out','System','firstName','renderFile','root','views','toFile','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','sendStatus','status','count','offset','limit','apply','reject','update','then','destroy','error','name','send','map','fullname','Tags','TagIds','split','forEach','catch','index','SmsInteraction','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','sort','pick','field','color','from','tools_tags','select'];(function(_0x4026d1,_0x53f826){var _0x4f978e=function(_0x1dd9f){while(--_0x1dd9f){_0x4026d1['push'](_0x4026d1['shift']());}};_0x4f978e(++_0x53f826);}(_0x70e0,0x17b));var _0x070e=function(_0x126a63,_0x25f4ec){_0x126a63=_0x126a63-0x0;var _0x1bf55d=_0x70e0[_0x126a63];return _0x1bf55d;};'use strict';var pdf=require(_0x070e('0x0'));var emlformat=require(_0x070e('0x1'));var rimraf=require(_0x070e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var Mustache=require(_0x070e('0x6'));var util=require('util');var path=require(_0x070e('0x7'));var sox=require('sox');var csv=require(_0x070e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0x8'));var querystring=require(_0x070e('0xc'));var Papa=require(_0x070e('0xd'));var Redis=require(_0x070e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0xf'));var hardwareService=require(_0x070e('0x10'));var logger=require(_0x070e('0x11'))(_0x070e('0x12'));var utils=require(_0x070e('0x13'));var config=require(_0x070e('0x14'));var db=require(_0x070e('0x15'))['db'];config[_0x070e('0x16')]=_[_0x070e('0x17')](config[_0x070e('0x16')],{'host':_0x070e('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x070e('0x19'))['register'](socket);function respondWithStatusCode(_0x4a33d2,_0x5bae0f){_0x5bae0f=_0x5bae0f||0xcc;return function(_0x11d2ce){if(_0x11d2ce){return _0x4a33d2[_0x070e('0x1a')](_0x5bae0f);}return _0x4a33d2['status'](_0x5bae0f)['end']();};}function respondWithResult(_0x373d86,_0xeae1a5){_0xeae1a5=_0xeae1a5||0xc8;return function(_0x180897){if(_0x180897){return _0x373d86[_0x070e('0x1b')](_0xeae1a5)['json'](_0x180897);}};}function respondWithFilteredResult(_0x49861b,_0x17e2e4){return function(_0x2bd937){if(_0x2bd937){var _0x38f6e6=_0x2bd937[_0x070e('0x1c')],_0x2060cc=_0x17e2e4[_0x070e('0x1d')],_0x364b3f=_0x17e2e4[_0x070e('0x1d')]+_0x17e2e4[_0x070e('0x1e')],_0x5037eb;if(_0x364b3f>=_0x38f6e6){_0x364b3f=_0x38f6e6;_0x5037eb=0xc8;}else{_0x5037eb=0xce;}_0x49861b[_0x070e('0x1b')](_0x5037eb);return _0x49861b['set']('Content-Range',_0x2060cc+'-'+_0x364b3f+'/'+_0x38f6e6)['json'](_0x2bd937);}return null;};}function patchUpdates(_0x9907cf){return function(_0x3004f0){try{jsonpatch[_0x070e('0x1f')](_0x3004f0,_0x9907cf,!![]);}catch(_0x4be0d7){return BPromise[_0x070e('0x20')](_0x4be0d7);}return _0x3004f0['save']();};}function saveUpdates(_0xf8dd5d,_0x3f6985){return function(_0x27a01e){if(_0x27a01e){return _0x27a01e[_0x070e('0x21')](_0xf8dd5d)[_0x070e('0x22')](function(_0xa86797){return _0xa86797;});}return null;};}function removeEntity(_0xe405e,_0x164cdf){return function(_0x595c7e){if(_0x595c7e){return _0x595c7e[_0x070e('0x23')]()[_0x070e('0x22')](function(){_0xe405e[_0x070e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf17c56,_0x5f3e9d){return function(_0x4a2dbd){if(!_0x4a2dbd){_0xf17c56[_0x070e('0x1a')](0x194);}return _0x4a2dbd;};}function handleError(_0x25f6e,_0x41deb1){_0x41deb1=_0x41deb1||0x1f4;return function(_0x1743cc){logger[_0x070e('0x24')](_0x1743cc['stack']);if(_0x1743cc[_0x070e('0x25')]){delete _0x1743cc[_0x070e('0x25')];}_0x25f6e[_0x070e('0x1b')](_0x41deb1)[_0x070e('0x26')](_0x1743cc);};}function getInteractionUsers(_0x43dd96,_0x28d7f2){return new BPromise(function(_0x1a1892,_0x26373b){try{if(_0x28d7f2[_0x43dd96['id']]){_0x43dd96['Users']=_[_0x070e('0x27')](_0x28d7f2[_0x43dd96['id']],function(_0x351641){return{'id':_0x351641['id'],'fullname':_0x351641[_0x070e('0x28')]};});}}catch(_0x56fc12){_0x26373b(_0x56fc12);}_0x1a1892(_0x43dd96);});}function getInteractionTags(_0x5c5f0d,_0x13097f){return new BPromise(function(_0x46065c,_0xa6c0ab){try{if(_0x5c5f0d['TagIds']){_0x5c5f0d[_0x070e('0x29')]=[];_0x5c5f0d[_0x070e('0x2a')][_0x070e('0x2b')](',')[_0x070e('0x2c')](function(_0x53d473){_0x5c5f0d['Tags']['push'](_0x13097f[_0x53d473]);});}delete _0x5c5f0d['TagIds'];}catch(_0xdf8945){_0xa6c0ab(_0xdf8945);}_0x46065c(_0x5c5f0d);});}function updateSmsInteraction(_0x4e0a7d,_0x1dff97,_0x323cf1){return new BPromise(function(_0x4f8130,_0x47a739){return getInteractionUsers(_0x4e0a7d,_0x323cf1)[_0x070e('0x22')](function(_0x3454c7){return getInteractionTags(_0x3454c7,_0x1dff97);})['then'](function(_0x546a16){_0x4f8130(_0x546a16);})[_0x070e('0x2d')](function(_0x27dd1f){_0x47a739(_0x27dd1f);});});}exports[_0x070e('0x2e')]=function(_0x31fdc5,_0x18f0ad){var _0x5f530d={},_0x482cc2={},_0x24d17d={'count':0x0,'rows':[]};var _0x3011c4=_[_0x070e('0x27')](db[_0x070e('0x2f')][_0x070e('0x30')],function(_0x4deaf8){return{'name':_0x4deaf8[_0x070e('0x31')],'type':_0x4deaf8[_0x070e('0x32')]['key']};});_0x482cc2[_0x070e('0x33')]=_[_0x070e('0x27')](_0x3011c4,'name');_0x482cc2['query']=_['keys'](_0x31fdc5[_0x070e('0x34')]);_0x482cc2[_0x070e('0x35')]=_[_0x070e('0x36')](_0x482cc2[_0x070e('0x33')],_0x482cc2[_0x070e('0x34')]);_0x5f530d['attributes']=_[_0x070e('0x36')](_0x482cc2[_0x070e('0x33')],qs[_0x070e('0x37')](_0x31fdc5['query'][_0x070e('0x37')]));_0x5f530d[_0x070e('0x38')]=_0x5f530d[_0x070e('0x38')]['length']?_0x5f530d[_0x070e('0x38')]:_0x482cc2[_0x070e('0x33')];if(!_0x31fdc5['query'][_0x070e('0x39')]('nolimit')){_0x5f530d[_0x070e('0x1e')]=qs[_0x070e('0x1e')](_0x31fdc5[_0x070e('0x34')][_0x070e('0x1e')]);_0x5f530d[_0x070e('0x1d')]=qs['offset'](_0x31fdc5[_0x070e('0x34')]['offset']);}_0x5f530d['order']=qs[_0x070e('0x3a')](_0x31fdc5[_0x070e('0x34')][_0x070e('0x3a')]);_0x5f530d['where']=qs[_0x070e('0x35')](_[_0x070e('0x3b')](_0x31fdc5[_0x070e('0x34')],_0x482cc2[_0x070e('0x35')]),_0x3011c4);var _0x4a4ee3=[];var _0x13e4e0=squel['select']()['field']('id')['field'](_0x070e('0x25'))[_0x070e('0x3c')](_0x070e('0x3d'))[_0x070e('0x3e')](_0x070e('0x3f'));var _0x562aa4=squel[_0x070e('0x40')]()['field'](_0x070e('0x41'))[_0x070e('0x3c')](_0x070e('0x42'))['field']('ui.SmsInteractionId')[_0x070e('0x3e')]('user_has_sms_interactions','ui')[_0x070e('0x43')](_0x070e('0x44'),'u',_0x070e('0x45'));var _0x5f5675=squel[_0x070e('0x40')]()[_0x070e('0x3e')]('sms_interactions','i')['left_join'](_0x070e('0x46'),'c',_0x070e('0x47'))[_0x070e('0x43')](_0x070e('0x44'),'o',_0x070e('0x48'))['left_join'](_0x070e('0x49'),'a',_0x070e('0x4a'))[_0x070e('0x43')](_0x070e('0x4b'),'me',_0x070e('0x4c'))[_0x070e('0x43')](_0x070e('0x4d'),'it',_0x070e('0x4e'))[_0x070e('0x43')](_0x070e('0x3f'),'t',_0x070e('0x4f'));var _0x3be553=squel[_0x070e('0x50')]();var _0x216d27=[];var _0x402c82=squel['expr']();var _0x171621;if(_0x31fdc5[_0x070e('0x34')][_0x070e('0x51')]){_0x171621=as[_0x070e('0x52')](_0x31fdc5[_0x070e('0x34')][_0x070e('0x51')]);var _0x3f0763=_0x171621[_0x070e('0x53')];for(var _0x1c64d2=0x0;_0x1c64d2<_0x171621['conditions'][_0x070e('0x54')];_0x1c64d2++){var _0x4c22da=_0x171621[_0x070e('0x55')][_0x1c64d2];var _0x2be643='i';var _0x4abbe9=_[_0x070e('0x56')](_0x3011c4,[_0x070e('0x25'),_0x4c22da[_0x070e('0x3c')]]);if(!_0x4abbe9){switch(_0x4c22da[_0x070e('0x3c')]){case _0x070e('0x57'):if(_0x4c22da[_0x070e('0x58')]==0x1){_0x5f5675[_0x070e('0x59')]('`'+_0x4c22da['field']+_0x070e('0x5a'));}else{_0x5f5675['having']('`'+_0x4c22da['field']+_0x070e('0x5b'));}break;case _0x070e('0x5c'):if(_0x4c22da[_0x070e('0x5d')]===_0x070e('0x5e')){if(_0x4c22da[_0x070e('0x58')][_0x070e('0x2b')]('\x20')[_0x070e('0x54')]>0x1){_0x3be553[_0x3f0763](_0x070e('0x5f'),qs['getFullTextValue'](_0x4c22da[_0x070e('0x58')]),null);}else{var _0x51d27d='%'+_0x4c22da['value']+'%';_0x3be553[_0x3f0763](_0x070e('0x60'),_0x51d27d,_0x51d27d,_0x51d27d);}}else{_0x4abbe9=_[_0x070e('0x56')](_0x3011c4,['name',_0x070e('0x61')]);_0x4c22da[_0x070e('0x3c')]=_0x070e('0x61');_0x841c89=as[_0x070e('0x62')](_0x2be643,_0x4abbe9[_0x070e('0x32')],_0x4c22da);_0x3be553[_0x3f0763](_0x841c89[_0x070e('0x63')],_0x841c89[_0x070e('0x58')]['start'],_0x841c89['value']['end']);}break;case _0x070e('0x64'):var _0x1948a5=_0x4c22da[_0x070e('0x58')][_0x070e('0x2b')](',')['map'](function(_0x25f34c){return Number(_0x25f34c);});_0x1948a5['forEach'](function(_0x212710){_0x402c82['or'](_0x070e('0x65'),'%,'+_0x212710+',%');});_0x216d27=_[_0x070e('0x66')](_0x216d27,_0x1948a5);break;case _0x070e('0x67'):if(_0x4c22da[_0x070e('0x5d')]===_0x070e('0x5e')){_0x3be553[_0x3f0763]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4c22da[_0x070e('0x58')]+'%',null);}else{_0x4abbe9=_[_0x070e('0x56')](_0x3011c4,[_0x070e('0x25'),'UserId']);_0x4c22da[_0x070e('0x3c')]=_0x070e('0x68');_0x841c89=as['buildExpression'](_0x2be643,_0x4abbe9[_0x070e('0x32')],_0x4c22da);_0x3be553[_0x3f0763](_0x841c89['text'],_0x841c89[_0x070e('0x58')]['start'],_0x841c89['value']['end']);}break;case _0x070e('0x69'):_0x841c89=as[_0x070e('0x62')]('me',null,_0x4c22da);_0x3be553[_0x3f0763](_0x841c89[_0x070e('0x63')],_0x841c89[_0x070e('0x58')][_0x070e('0x6a')],_0x841c89[_0x070e('0x58')]['end']);break;}}else{var _0x841c89=as['buildExpression'](_0x2be643,_0x4abbe9[_0x070e('0x32')],_0x4c22da);_0x3be553[_0x3f0763](_0x841c89['text'],_0x841c89[_0x070e('0x58')][_0x070e('0x6a')],_0x841c89['value'][_0x070e('0x6b')]);}}}else{var _0x50399e=_(_0x31fdc5[_0x070e('0x34')])[_0x070e('0x6c')]()[_0x070e('0x27')](function(_0x2b172a){return _[_0x070e('0x6d')](_0x3011c4,[_0x070e('0x25'),_0x2b172a])?_0x2b172a:undefined;})[_0x070e('0x6e')]()[_0x070e('0x58')]();if(!_[_0x070e('0x6f')](_0x50399e)){_0x50399e[_0x070e('0x2c')](function(_0x40c560){if(_0x40c560===_0x070e('0x70')){_0x5f5675[_0x070e('0x71')](_0x070e('0x72'),[]['concat'](_0x31fdc5[_0x070e('0x34')][_0x40c560]));}else if(_0x40c560===_0x070e('0x73')){var _0x381c83=JSON[_0x070e('0x74')](_0x31fdc5['query'][_0x40c560])[_0x070e('0x75')];var _0x4e8e58=JSON[_0x070e('0x74')](_0x31fdc5[_0x070e('0x34')][_0x40c560])[_0x070e('0x76')];_0x5f5675[_0x070e('0x71')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x381c83,_0x4e8e58);}else{if(_0x31fdc5[_0x070e('0x34')][_0x40c560]===_0x070e('0x77')){_0x5f5675[_0x070e('0x71')]('i.'+_0x40c560+_0x070e('0x78'));}else{_0x5f5675['where']('i.'+_0x40c560+_0x070e('0x79'),_0x31fdc5['query'][_0x40c560]);}}});}if(_0x31fdc5[_0x070e('0x34')][_0x070e('0x7a')]){if(_0x31fdc5[_0x070e('0x34')][_0x070e('0x7a')]==0x1){_0x5f5675[_0x070e('0x59')]('`unreadMessages`\x20=\x200');}else{_0x5f5675[_0x070e('0x59')](_0x070e('0x7b'));}}if(_0x31fdc5[_0x070e('0x34')][_0x070e('0x7c')]){_0x216d27=_['isArray'](_0x31fdc5[_0x070e('0x34')]['tag'])?_0x31fdc5[_0x070e('0x34')][_0x070e('0x7c')]:new Array(_0x31fdc5[_0x070e('0x34')]['tag']);_0x216d27[_0x070e('0x2c')](function(_0x4d344c){_0x402c82['or'](_0x070e('0x65'),'%,'+_0x4d344c+',%');});}if(_0x31fdc5['query'][_0x070e('0x7d')]){var _0x17b28c=_0x31fdc5['query'][_0x070e('0x7d')]['replace']('\x5c','\x5c\x5c')[_0x070e('0x7e')]('\x27\x27',_0x070e('0x7f'));if(qs['isNumeric'](_0x17b28c)){_0x3be553['or']('i.id\x20LIKE\x20?',_0x17b28c+'%')['or'](_0x070e('0x80'),_0x17b28c+'%');}else{_0x3be553['or'](_0x070e('0x81'),qs[_0x070e('0x82')](_0x17b28c))['or'](_0x070e('0x83'),_0x17b28c+'%');}}}_0x5f5675[_0x070e('0x71')](_0x3be553);_0x5f5675[_0x070e('0x84')](_0x070e('0x85'));var _0x332c8a={'type':db[_0x070e('0x86')][_0x070e('0x87')][_0x070e('0x88')],'raw':!![]};var _0x25670e=_0x5f5675[_0x070e('0x89')]();_0x25670e['field'](_0x070e('0x85'));_0x25670e[_0x070e('0x3c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x5f530d[_0x070e('0x8a')]){_0x5f530d[_0x070e('0x8a')][_0x070e('0x2c')](function(_0x24bbc7){_0x5f5675[_0x070e('0x8a')]('i.'+_0x24bbc7[0x0],_0x24bbc7[0x1]===_0x070e('0x8b')?![]:!![]);});}if(!_[_0x070e('0x6f')](_0x216d27)){_0x5f5675[_0x070e('0x59')](_0x402c82);_0x25670e[_0x070e('0x71')](_0x070e('0x8c'),_0x216d27);}BPromise[_0x070e('0x8d')]()[_0x070e('0x22')](function(){if(!_0x171621){if(_0x31fdc5[_0x070e('0x34')]['SmsAccountId']||_0x31fdc5['query']['journey'])return;_0x25670e[_0x070e('0x71')](_0x070e('0x8e'));_0x5f5675[_0x070e('0x71')](_0x070e('0x8e'));return;}return _0x31fdc5['user'][_0x070e('0x8f')]({'attributes':['id'],'raw':!![]})[_0x070e('0x22')](function(_0x416dde){if(_[_0x070e('0x6f')](_0x416dde)){_0x25670e[_0x070e('0x71')](_0x070e('0x90'));_0x5f5675['where'](_0x070e('0x90'));}else{_0x25670e['where'](_0x070e('0x72'),_[_0x070e('0x27')](_0x416dde,'id'));_0x5f5675[_0x070e('0x71')](_0x070e('0x72'),_[_0x070e('0x27')](_0x416dde,'id'));}});})['then'](function(){db[_0x070e('0x91')][_0x070e('0x34')](_0x25670e['toString'](),_0x332c8a)[_0x070e('0x22')](function(_0x1e1d27){_0x24d17d['count']=_0x1e1d27[_0x070e('0x54')];if(_0x24d17d[_0x070e('0x1c')]===0x0)return[];return db[_0x070e('0x91')]['query'](_0x13e4e0[_0x070e('0x92')](),_0x332c8a)[_0x070e('0x22')](function(_0x134b72){_0x4a4ee3=_[_0x070e('0x93')](_0x134b72,'id');_0x332c8a=_[_0x070e('0x94')](_0x332c8a,{'model':db[_0x070e('0x2f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x31fdc5[_0x070e('0x34')][_0x070e('0x37')]){_0x5f530d[_0x070e('0x38')][_0x070e('0x2c')](function(_0x1b1a0c){_0x5f5675[_0x070e('0x3c')]('i.'+_0x1b1a0c);});}else{_0x5f5675[_0x070e('0x3c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x070e('0x57'));_0x5f5675[_0x070e('0x3c')](_0x070e('0x95'),_0x070e('0x96'));_0x5f5675[_0x070e('0x3c')](_0x070e('0x97'),'Account.mandatoryDisposition');_0x5f5675['field']('i.*');_0x5f5675[_0x070e('0x3c')](_0x070e('0x98'),_0x070e('0x99'));_0x5f5675[_0x070e('0x3c')]('c.lastName',_0x070e('0x9a'));_0x5f5675[_0x070e('0x3c')](_0x070e('0x9b'),'Contact.email');_0x5f5675[_0x070e('0x3c')]('c.phone',_0x070e('0x9c'));_0x5f5675[_0x070e('0x3c')]('c.mobile','Contact.mobile');_0x5f5675[_0x070e('0x3c')](_0x070e('0x9d'),'Contact.fax');_0x5f5675[_0x070e('0x3c')]('o.fullname','Owner.fullname');_0x5f5675['field'](_0x070e('0x9e'),_0x070e('0x9f'));_0x5f5675[_0x070e('0x3c')](_0x070e('0xa0'),_0x070e('0x2a'));}if(_0x5f530d[_0x070e('0x1e')])_0x5f5675[_0x070e('0x1e')](_0x5f530d[_0x070e('0x1e')]);if(_0x5f530d[_0x070e('0x1d')])_0x5f5675[_0x070e('0x1d')](_0x5f530d[_0x070e('0x1d')]);return db[_0x070e('0x91')][_0x070e('0x34')](_0x5f5675[_0x070e('0x92')](),_0x332c8a);})[_0x070e('0x22')](function(_0x3f2bb5){_0x562aa4[_0x070e('0x71')](_0x070e('0xa1'),_[_0x070e('0x27')](_0x3f2bb5,'id'));return db[_0x070e('0x91')][_0x070e('0x34')](_0x562aa4[_0x070e('0x92')](),_0x332c8a)['then'](function(_0x4124cc){var _0x276e6e=_[_0x070e('0xa2')](_0x4124cc,_0x070e('0xa3'));var _0x495403=[];_0x3f2bb5[_0x070e('0x2c')](function(_0x32fa3b){_0x495403[_0x070e('0xa4')](updateSmsInteraction(_0x32fa3b,_0x4a4ee3,_0x276e6e));});return BPromise[_0x070e('0xa5')](_0x495403);});});})[_0x070e('0x22')](function(_0x2ceb4f){_0x24d17d['rows']=_0x2ceb4f;return _0x24d17d;})['then'](respondWithFilteredResult(_0x18f0ad,_0x5f530d));})['catch'](handleError(_0x18f0ad,null));};exports[_0x070e('0xa6')]=function(_0x5a482f,_0x26e9c1){var _0x42f6df={'raw':![],'where':{'id':_0x5a482f[_0x070e('0xa7')]['id']}},_0x4dba5f={};_0x4dba5f[_0x070e('0x33')]=_['keys'](db['SmsInteraction'][_0x070e('0x30')]);_0x4dba5f[_0x070e('0x34')]=_[_0x070e('0x6c')](_0x5a482f[_0x070e('0x34')]);_0x4dba5f[_0x070e('0x35')]=_['intersection'](_0x4dba5f[_0x070e('0x33')],_0x4dba5f['query']);_0x42f6df[_0x070e('0x38')]=_[_0x070e('0x36')](_0x4dba5f['model'],qs[_0x070e('0x37')](_0x5a482f[_0x070e('0x34')][_0x070e('0x37')]));_0x42f6df[_0x070e('0x38')]=_0x42f6df[_0x070e('0x38')][_0x070e('0x54')]?_0x42f6df['attributes']:_0x4dba5f[_0x070e('0x33')];if(_0x5a482f[_0x070e('0x34')][_0x070e('0xa8')]){_0x42f6df[_0x070e('0xa9')]=[{'all':!![]}];}_0x42f6df=_[_0x070e('0x94')]({},_0x42f6df,_0x5a482f['options']);return db[_0x070e('0x2f')][_0x070e('0x56')](_0x42f6df)[_0x070e('0x22')](handleEntityNotFound(_0x26e9c1,null))[_0x070e('0x22')](respondWithResult(_0x26e9c1,null))[_0x070e('0x2d')](handleError(_0x26e9c1,null));};exports[_0x070e('0xaa')]=function(_0x248347,_0x4546eb){return db[_0x070e('0x2f')][_0x070e('0xaa')](_0x248347[_0x070e('0x69')],{})[_0x070e('0x22')](respondWithResult(_0x4546eb,0xc9))[_0x070e('0x2d')](handleError(_0x4546eb,null));};exports[_0x070e('0x21')]=function(_0xf0fde5,_0x3ecfe5){if(_0xf0fde5['body']['id']){delete _0xf0fde5['body']['id'];}return db[_0x070e('0x2f')][_0x070e('0x56')]({'where':{'id':_0xf0fde5['params']['id']}})['then'](handleEntityNotFound(_0x3ecfe5,null))['then'](saveUpdates(_0xf0fde5['body'],null))[_0x070e('0x22')](respondWithResult(_0x3ecfe5,null))[_0x070e('0x2d')](handleError(_0x3ecfe5,null));};exports[_0x070e('0x23')]=function(_0x12ea06,_0x409811){return db[_0x070e('0x2f')][_0x070e('0x56')]({'where':{'id':_0x12ea06[_0x070e('0xa7')]['id']}})[_0x070e('0x22')](handleEntityNotFound(_0x409811,null))[_0x070e('0x22')](removeEntity(_0x409811,null))['catch'](handleError(_0x409811,null));};exports[_0x070e('0xab')]=function(_0x36cfe2,_0x49c66a){return db[_0x070e('0x2f')][_0x070e('0xab')]()[_0x070e('0x22')](respondWithResult(_0x49c66a,null))[_0x070e('0x2d')](handleError(_0x49c66a,null));};exports['addMessage']=function(_0x2d46fb,_0x36a689,_0x214bea){return db[_0x070e('0xac')]['find']({'where':{'id':_0x2d46fb[_0x070e('0xa7')]['id']}})[_0x070e('0x22')](handleEntityNotFound(_0x36a689,null))[_0x070e('0x22')](function(_0xebbb53){if(_0xebbb53){return _0xebbb53[_0x070e('0xad')](_0x2d46fb[_0x070e('0x69')][_0x070e('0xae')],_[_0x070e('0xaf')](_0x2d46fb[_0x070e('0x69')],[_0x070e('0xae'),'id'])||{});}})[_0x070e('0x22')](respondWithResult(_0x36a689,null))['catch'](handleError(_0x36a689,null));};exports[_0x070e('0xb0')]=function(_0x2b5210,_0x5e3263,_0x5ccb8d){var _0x6ac3c9={'raw':![],'where':{}};var _0x53f6e7={};var _0x2c759a={'count':0x0,'rows':[]};return db[_0x070e('0x2f')][_0x070e('0xb1')]({'where':{'id':_0x2b5210[_0x070e('0xa7')]['id']}})[_0x070e('0x22')](handleEntityNotFound(_0x5e3263,null))[_0x070e('0x22')](function(_0x3dc050){if(_0x3dc050){_0x53f6e7['model']=_[_0x070e('0x6c')](db[_0x070e('0xac')][_0x070e('0x30')]);_0x53f6e7[_0x070e('0x34')]=_['keys'](_0x2b5210['query']);_0x53f6e7[_0x070e('0x35')]=_[_0x070e('0x36')](_0x53f6e7[_0x070e('0x33')],_0x53f6e7['query']);_0x6ac3c9[_0x070e('0x38')]=_[_0x070e('0x36')](_0x53f6e7['model'],qs[_0x070e('0x37')](_0x2b5210[_0x070e('0x34')][_0x070e('0x37')]));_0x6ac3c9[_0x070e('0x38')]=_0x6ac3c9[_0x070e('0x38')][_0x070e('0x54')]?_0x6ac3c9['attributes']:_0x53f6e7['model'];if(!_0x2b5210[_0x070e('0x34')]['hasOwnProperty'](_0x070e('0xb2'))){_0x6ac3c9[_0x070e('0x1e')]=qs['limit'](_0x2b5210[_0x070e('0x34')]['limit']);_0x6ac3c9[_0x070e('0x1d')]=qs[_0x070e('0x1d')](_0x2b5210[_0x070e('0x34')][_0x070e('0x1d')]);}_0x6ac3c9[_0x070e('0x8a')]=qs[_0x070e('0x3a')](_0x2b5210['query'][_0x070e('0x3a')]);_0x6ac3c9[_0x070e('0x71')]=qs['filters'](_['pick'](_0x2b5210[_0x070e('0x34')],_0x53f6e7[_0x070e('0x35')]));_0x6ac3c9[_0x070e('0x71')][_0x070e('0xa3')]=_0x3dc050['id'];if(_0x2b5210[_0x070e('0x34')][_0x070e('0x7d')]){_0x6ac3c9[_0x070e('0x71')]=_[_0x070e('0x94')](_0x6ac3c9['where'],{'$or':_[_0x070e('0x27')](_0x6ac3c9[_0x070e('0x38')],function(_0x26a0be){var _0x2f5597={};_0x2f5597[_0x26a0be]={'$like':'%'+_0x2b5210[_0x070e('0x34')][_0x070e('0x7d')]+'%'};return _0x2f5597;})});}if(_0x2b5210[_0x070e('0x34')][_0x070e('0x75')]){var _0x522513=_0x2b5210[_0x070e('0x34')][_0x070e('0x75')][_0x070e('0x2b')](',');var _0xbc61f2={};_0xbc61f2[_0x522513[0x0]]={'$gte':moment(_0x522513[0x1])[_0x070e('0xb3')](_0x070e('0xb4'))};_0x6ac3c9[_0x070e('0x71')]=_[_0x070e('0x94')](_0x6ac3c9[_0x070e('0x71')],_0xbc61f2);}_0x6ac3c9=_[_0x070e('0x94')]({},_0x6ac3c9,_0x2b5210['options']);return db['SmsMessage'][_0x070e('0x1c')]({'where':_0x6ac3c9[_0x070e('0x71')]})[_0x070e('0x22')](function(_0x567202){_0x2c759a[_0x070e('0x1c')]=_0x567202;if(_0x2b5210[_0x070e('0x34')]['includeAll']){_0x6ac3c9[_0x070e('0xa9')]=[{'all':!![]}];}return db[_0x070e('0xac')][_0x070e('0xb5')](_0x6ac3c9);})[_0x070e('0x22')](function(_0x3af8fe){_0x2c759a[_0x070e('0xb6')]=_0x3af8fe;return _0x2c759a;});}})['then'](respondWithFilteredResult(_0x5e3263,_0x6ac3c9))['catch'](handleError(_0x5e3263,null));};exports[_0x070e('0xb7')]=function(_0x3f3d7e,_0x532f83,_0x4055ba){return db[_0x070e('0x2f')][_0x070e('0x56')]({'where':{'id':_0x3f3d7e[_0x070e('0xa7')]['id']}})[_0x070e('0x22')](handleEntityNotFound(_0x532f83,null))[_0x070e('0x22')](function(_0x4870da){if(_0x4870da){return _0x4870da[_0x070e('0xb8')](_0x3f3d7e[_0x070e('0x69')]['ids'],_[_0x070e('0xaf')](_0x3f3d7e[_0x070e('0x69')],[_0x070e('0xae'),'id'])||{})[_0x070e('0xb9')](function(){return db['Tag']['findAll']({'attributes':['id',_0x070e('0x25'),_0x070e('0x3d')],'where':{'id':_0x3f3d7e[_0x070e('0x69')][_0x070e('0xae')]}});})[_0x070e('0x22')](function(_0x32f1e7){socket[_0x070e('0xba')](_0x070e('0xbb'),{'id':Number(_0x3f3d7e[_0x070e('0xa7')]['id']),'tags':_0x32f1e7||[]});return{'id':Number(_0x3f3d7e[_0x070e('0xa7')]['id']),'tags':_0x32f1e7||[]};});}})['then'](respondWithResult(_0x532f83,null))[_0x070e('0x2d')](handleError(_0x532f83,null));};exports[_0x070e('0xbc')]=function(_0x1de175,_0x205fc7,_0x49f3df){return db[_0x070e('0x2f')][_0x070e('0x56')]({'where':{'id':_0x1de175['params']['id']}})['then'](handleEntityNotFound(_0x205fc7,null))[_0x070e('0x22')](function(_0x4684c7){if(_0x4684c7){return _0x4684c7[_0x070e('0xbc')](_0x1de175['query'][_0x070e('0xae')]);}})[_0x070e('0x22')](respondWithStatusCode(_0x205fc7,null))[_0x070e('0x2d')](handleError(_0x205fc7,null));};exports[_0x070e('0xbd')]=function(_0x34b5ae,_0x5605da){var _0x271bb9=moment()[_0x070e('0xbe')]()['toString']();var _0x2a94f9=path['join'](config['root'],'server',_0x070e('0xbf'),_0x070e('0xc0'));var _0x118a77=path[_0x070e('0xc1')](config['root'],_0x070e('0xc2'),_0x070e('0xbf'),'attachments');var _0x3c6a6e=path[_0x070e('0xc1')](_0x2a94f9,_0x271bb9);var _0x24448e=util[_0x070e('0xb3')](_0x070e('0xc3'),_0x34b5ae[_0x070e('0xa7')]['id'],_0x271bb9);var _0x50fbb4=path[_0x070e('0xc1')](_0x2a94f9,_0x24448e);var _0x4c35db=[];_0x4c35db[_0x070e('0xa4')]({'model':db[_0x070e('0x67')],'as':_0x070e('0x67'),'attributes':['id','fullname'],'raw':!![]});_0x4c35db[_0x070e('0xa4')]({'model':db[_0x070e('0xc4')],'as':_0x070e('0x5c'),'attributes':['id','firstName',_0x070e('0xc5')],'raw':!![]});var _0x3a5086=[{'model':db['SmsMessage'],'as':_0x070e('0xc6'),'attributes':['id',_0x070e('0x69'),'createdAt','direction','secret','read'],'include':_0x4c35db}];_0x3a5086[_0x070e('0xa4')]({'model':db[_0x070e('0xc7')],'as':_0x070e('0xc8'),'attributes':['id',_0x070e('0x25')]});_0x3a5086[_0x070e('0xa4')]({'model':db[_0x070e('0x67')],'as':_0x070e('0xc9'),'attributes':['id',_0x070e('0x28')]});return db['SmsInteraction']['find']({'where':{'id':_0x34b5ae['params']['id']},'include':_0x3a5086})['then'](handleEntityNotFound(_0x5605da,null))[_0x070e('0x22')](function(_0x41e59b){if(_0x41e59b){var _0x28208d=_0x41e59b[_0x070e('0xca')]({'plain':!![]});fs[_0x070e('0xcb')](_0x3c6a6e);var _0x4a07aa={'format':'A4','border':'10px','header':{'height':_0x070e('0xcc'),'contents':{'first':_0x070e('0xcd')}},'footer':{'height':'30px','contents':{'default':util[_0x070e('0xb3')](_0x070e('0xce'),util[_0x070e('0xb3')](_0x070e('0xcf'),_0x070e('0xd0'),_0x28208d['id']),moment()[_0x070e('0xb3')]('YYYY-MM-DD')[_0x070e('0x92')]())}}};var _0x1d48a9={'channel':_0x070e('0xd0'),'account':_0x28208d['Account'][_0x070e('0x25')],'agent':_0x28208d[_0x070e('0xc9')]?_0x28208d[_0x070e('0xc9')][_0x070e('0x28')]:'N.A.','createdAt':moment(_0x28208d[_0x070e('0x73')])[_0x070e('0xb3')]('YYYY-MM-DD\x20HH:mm:ss')[_0x070e('0x92')](),'closedAt':_0x28208d[_0x070e('0xd1')]?moment(_0x28208d['closedAt'])[_0x070e('0xb3')]('YYYY-MM-DD\x20HH:mm:ss')[_0x070e('0x92')]():'','disposition':_0x28208d['disposition'],'messages':_(_0x28208d[_0x070e('0xc6')])['filter']({'secret':![]})['map'](function(_0x1c4f6c){return{'date':moment(_0x1c4f6c['createdAt'])['format'](_0x070e('0xb4'))[_0x070e('0x92')](),'sender':_0x1c4f6c[_0x070e('0xd2')]===_0x070e('0xd3')?_0x1c4f6c[_0x070e('0x67')]?_0x1c4f6c['User'][_0x070e('0x28')]:_0x070e('0xd4'):_0x1c4f6c[_0x070e('0x5c')][_0x070e('0xd5')]+(_0x1c4f6c[_0x070e('0x5c')][_0x070e('0xc5')]?'\x20'+_0x1c4f6c['Contact'][_0x070e('0xc5')]:''),'body':_0x1c4f6c[_0x070e('0x69')],'direction':_0x1c4f6c[_0x070e('0xd2')]===_0x070e('0xd3')?'A':'C','secret':_0x1c4f6c['secret'],'read':_0x1c4f6c['read']};})[_0x070e('0x58')]()};return ejs[_0x070e('0xd6')](path[_0x070e('0xc1')](config[_0x070e('0xd7')],_0x070e('0xc2'),_0x070e('0xd8'),'downloadInteraction.html'),{'interaction':_0x1d48a9})[_0x070e('0x22')](function(_0x32f28b){return new BPromise(function(_0x1e05c9,_0x3a894e){pdf[_0x070e('0xaa')](_0x32f28b,_0x4a07aa)[_0x070e('0xd9')](path['join'](_0x3c6a6e,'transcript-'+_0x28208d['id']+'-'+_0x271bb9+_0x070e('0xda')),function(_0x43e514,_0x193c72){if(_0x43e514)return _0x3a894e(_0x43e514);_0x1e05c9(_0x193c72);});});})[_0x070e('0x22')](function(){return new BPromise(function(_0x3a8dd7,_0x167139){zipdir(_0x3c6a6e,{'saveTo':_0x50fbb4},function(_0x257569,_0x5d69bc){if(_0x257569)return _0x167139(_0x257569);return _0x3a8dd7(_0x5d69bc);});})[_0x070e('0x22')](function(){return new BPromise(function(_0x5e244a,_0xfe12a6){rimraf(_0x3c6a6e,function(_0x5dc059){if(_0x5dc059)_0xfe12a6(_0x5dc059);return _0x5e244a();});});})['then'](function(){return _0x5605da['download'](_0x50fbb4,_0x24448e,function(_0x383f39){if(_0x383f39){console[_0x070e('0xdb')](_0x070e('0xdc'),_0x383f39);}else{fs[_0x070e('0xdd')](_0x50fbb4);}});});});}else{return _0x5605da[_0x070e('0x1a')](0xc8);}})[_0x070e('0x2d')](handleError(_0x5605da,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 5c60e05..6e72b9f 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 _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 +var _0x72b1=['unreadMessages','length','emit','catch','hasOwnProperty','hook','events','SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','getUsers','Users','findAll','then'];(function(_0x5e3126,_0xd58a03){var _0x5b5f8c=function(_0x3f8352){while(--_0x3f8352){_0x5e3126['push'](_0x5e3126['shift']());}};_0x5b5f8c(++_0xd58a03);}(_0x72b1,0x16e));var _0x172b=function(_0x48f96b,_0x1b3edf){_0x48f96b=_0x48f96b-0x0;var _0x362247=_0x72b1[_0x48f96b];return _0x362247;};'use strict';var EventEmitter=require(_0x172b('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x172b('0x1')];var SmsMessage=require(_0x172b('0x2'))['db'][_0x172b('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x172b('0x4')](0x0);var events={'afterCreate':_0x172b('0x5'),'afterUpdate':_0x172b('0x6'),'afterDestroy':_0x172b('0x7')};function emitEvent(_0x558038){return function(_0x3781f3,_0x40c72e,_0x475fd6){_0x3781f3[_0x172b('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x345e5e){_0x3781f3['setDataValue'](_0x172b('0x9'),_0x345e5e['map'](function(_0x6680e0){return{'id':_0x6680e0['id']};}));return SmsMessage[_0x172b('0xa')]({'where':{'SmsInteractionId':_0x3781f3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x172b('0xb')](function(_0x392f1e){_0x3781f3['setDataValue'](_0x172b('0xc'),_0x392f1e[_0x172b('0xd')]);SmsInteractionEvents[_0x172b('0xe')](_0x558038+':'+_0x3781f3['id'],_0x3781f3);SmsInteractionEvents[_0x172b('0xe')](_0x558038,_0x3781f3);_0x475fd6(null);})[_0x172b('0xf')](_0x475fd6(null));};}for(var e in events){if(events[_0x172b('0x10')](e)){var event=events[e];SmsInteraction[_0x172b('0x11')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 7c9b3a8..337a715 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 _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 +var _0xde9e=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','sms_interactions','changed'];(function(_0x49279c,_0x56da65){var _0x472c04=function(_0x6b5a3d){while(--_0x6b5a3d){_0x49279c['push'](_0x49279c['shift']());}};_0x472c04(++_0x56da65);}(_0xde9e,0x70));var _0xede9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde9e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xede9('0x0'));var logger=require(_0xede9('0x1'))(_0xede9('0x2'));var moment=require(_0xede9('0x3'));var BPromise=require(_0xede9('0x4'));var rp=require(_0xede9('0x5'));var fs=require('fs');var path=require(_0xede9('0x6'));var rimraf=require(_0xede9('0x7'));var config=require(_0xede9('0x8'));var attributes=require(_0xede9('0x9'));module['exports']=function(_0x2635c6,_0x16392b){return _0x2635c6[_0xede9('0xa')](_0xede9('0xb'),attributes,{'tableName':_0xede9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x582dfb,_0x33c600,_0x12003e){if(_0x582dfb[_0xede9('0xd')](_0xede9('0xe'))){_0x582dfb[_0xede9('0xf')]=moment()[_0xede9('0x10')](_0xede9('0x11'));}_0x12003e(null,_0x582dfb);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index f866a47..c8a1fde 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 _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 +var _0xb9be=['SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SmsInteraction,\x20%s,\x20%s','SmsInteraction','body','options','where','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','./smsInteraction.socket','register','request','then','info','request\x20sent','debug'];(function(_0x49edf5,_0x3bc3b6){var _0x1ddfd5=function(_0x1d38a5){while(--_0x1d38a5){_0x49edf5['push'](_0x49edf5['shift']());}};_0x1ddfd5(++_0x3bc3b6);}(_0xb9be,0xfe));var _0xeb9b=function(_0x16bb4b,_0x5fe431){_0x16bb4b=_0x16bb4b-0x0;var _0x8aeb84=_0xb9be[_0x16bb4b];return _0x8aeb84;};'use strict';var _=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var moment=require(_0xeb9b('0x2'));var BPromise=require(_0xeb9b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb9b('0x4'));var db=require(_0xeb9b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xeb9b('0x6'))('rpc');var config=require(_0xeb9b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xeb9b('0x8')][_0xeb9b('0x9')]({'port':0x232a});config[_0xeb9b('0xa')]=_[_0xeb9b('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xeb9b('0xc'))[_0xeb9b('0xd')](socket);function respondWithRpcPromise(_0x4de18c,_0x2d4bbb,_0x2e1457){return new BPromise(function(_0x1da2dd,_0x2fd165){return client[_0xeb9b('0xe')](_0x4de18c,_0x2e1457)[_0xeb9b('0xf')](function(_0x2ad597){logger[_0xeb9b('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x2d4bbb,_0xeb9b('0x11'));logger[_0xeb9b('0x12')](_0xeb9b('0x13'),_0x2d4bbb,_0xeb9b('0x11'),JSON[_0xeb9b('0x14')](_0x2ad597));if(_0x2ad597[_0xeb9b('0x15')]){if(_0x2ad597[_0xeb9b('0x15')]['code']===0x1f4){logger[_0xeb9b('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x2d4bbb,_0x2ad597['error'][_0xeb9b('0x16')]);return _0x2fd165(_0x2ad597[_0xeb9b('0x15')]['message']);}logger['error']('SmsInteraction,\x20%s,\x20%s',_0x2d4bbb,_0x2ad597[_0xeb9b('0x15')][_0xeb9b('0x16')]);return _0x1da2dd(_0x2ad597[_0xeb9b('0x15')][_0xeb9b('0x16')]);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0x2d4bbb,'request\x20sent');_0x1da2dd(_0x2ad597[_0xeb9b('0x17')]['message']);}})[_0xeb9b('0x18')](function(_0x1ab5de){logger[_0xeb9b('0x15')](_0xeb9b('0x19'),_0x2d4bbb,_0x1ab5de);_0x2fd165(_0x1ab5de);});});}exports['UpdateSmsInteraction']=function(_0x4d7e7f){var _0x376271=this;return new Promise(function(_0x460d36,_0x288b56){return db[_0xeb9b('0x1a')]['update'](_0x4d7e7f[_0xeb9b('0x1b')],{'raw':_0x4d7e7f[_0xeb9b('0x1c')]?_0x4d7e7f[_0xeb9b('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d7e7f[_0xeb9b('0x1c')]?_0x4d7e7f[_0xeb9b('0x1c')][_0xeb9b('0x1d')]||null:null,'attributes':_0x4d7e7f[_0xeb9b('0x1c')]?_0x4d7e7f[_0xeb9b('0x1c')]['attributes']||null:null,'limit':_0x4d7e7f[_0xeb9b('0x1c')]?_0x4d7e7f['options'][_0xeb9b('0x1e')]||null:null})[_0xeb9b('0xf')](function(_0x3f8912){logger[_0xeb9b('0x10')](_0xeb9b('0x1f'),_0x4d7e7f);logger['debug'](_0xeb9b('0x1f'),_0x4d7e7f,JSON[_0xeb9b('0x14')](_0x3f8912));_0x460d36(_0x3f8912);})['catch'](function(_0x3c59eb){logger['error'](_0xeb9b('0x1f'),_0x3c59eb[_0xeb9b('0x16')],_0x4d7e7f);_0x288b56(_0x376271['error'](0x1f4,_0x3c59eb[_0xeb9b('0x16')]));});});};exports[_0xeb9b('0x20')]=function(_0x3ee1ae){return new Promise(function(_0x1354c7,_0x8c9d5b){return db[_0xeb9b('0x1a')][_0xeb9b('0x21')]({'where':_0x3ee1ae[_0xeb9b('0x1c')]?_0x3ee1ae[_0xeb9b('0x1c')][_0xeb9b('0x1d')]||null:null})[_0xeb9b('0xf')](function(_0x3838a2){if(_0x3838a2){return _0x3838a2[_0xeb9b('0x22')](_0x3ee1ae[_0xeb9b('0x1b')][_0xeb9b('0x23')],_[_0xeb9b('0x24')](_0x3ee1ae['body'],['ids','id'])||{});}})[_0xeb9b('0x25')](function(_0xa94d18){logger[_0xeb9b('0x10')](_0xeb9b('0x26'),_0x3ee1ae);logger['debug'](_0xeb9b('0x26'),_0x3ee1ae,JSON['stringify'](_0xa94d18));_0x1354c7(_0xa94d18);})[_0xeb9b('0x18')](function(_0x1bb0da){logger[_0xeb9b('0x15')](_0xeb9b('0x26'),_0x1bb0da[_0xeb9b('0x16')],_0x3ee1ae);_0x8c9d5b(_this[_0xeb9b('0x15')](0x1f4,_0x1bb0da['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 753756b..6443a70 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 _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 +var _0x5f66=['length','smsInteraction:','save','update','emit','register'];(function(_0x44aab6,_0x55ddb8){var _0x5f3d87=function(_0x169da0){while(--_0x169da0){_0x44aab6['push'](_0x44aab6['shift']());}};_0x5f3d87(++_0x55ddb8);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5f66[_0x3e5086];return _0xfeb102;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x65f6('0x0'),'remove',_0x65f6('0x1')];function createListener(_0x2f06ae,_0x3461cd){return function(_0xbce843){_0x3461cd[_0x65f6('0x2')](_0x2f06ae,_0xbce843);};}function removeListener(_0x5eb9ad,_0x3c5029){return function(){SmsInteractionEvents['removeListener'](_0x5eb9ad,_0x3c5029);};}exports[_0x65f6('0x3')]=function(_0x22b017){for(var _0x4ec221=0x0,_0x4ed98f=events[_0x65f6('0x4')];_0x4ec221<_0x4ed98f;_0x4ec221++){var _0x2c6571=events[_0x4ec221];var _0x112079=createListener(_0x65f6('0x5')+_0x2c6571,_0x22b017);SmsInteractionEvents['on'](_0x2c6571,_0x112079);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index afb9bdd..52384dd 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 _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 +var _0x4004=['show','post','tracked','sms','create','/:id/status','status','put','update','/:id/accept','accept','reject','delete','exports','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','describe','/:id'];(function(_0xf5e69c,_0x80e8e5){var _0x5cb064=function(_0x587335){while(--_0x587335){_0xf5e69c['push'](_0xf5e69c['shift']());}};_0x5cb064(++_0x80e8e5);}(_0x4004,0x72));var _0x4400=function(_0x568ec8,_0x1e0f23){_0x568ec8=_0x568ec8-0x0;var _0x52b2be=_0x4004[_0x568ec8];return _0x52b2be;};'use strict';var multer=require('multer');var util=require(_0x4400('0x0'));var path=require(_0x4400('0x1'));var timeout=require(_0x4400('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4400('0x3'));var config=require(_0x4400('0x4'));var controller=require(_0x4400('0x5'));router[_0x4400('0x6')]('/',auth[_0x4400('0x7')](),controller[_0x4400('0x8')]);router[_0x4400('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x4400('0x9')]);router[_0x4400('0x6')](_0x4400('0xa'),auth[_0x4400('0x7')](),controller[_0x4400('0xb')]);router[_0x4400('0xc')]('/',auth[_0x4400('0x7')](),interaction[_0x4400('0xd')](_0x4400('0xe'),'smsmessage:create'),controller[_0x4400('0xf')]);router[_0x4400('0xc')](_0x4400('0x10'),controller[_0x4400('0x11')]);router[_0x4400('0x12')](_0x4400('0xa'),auth[_0x4400('0x7')](),controller[_0x4400('0x13')]);router[_0x4400('0x12')](_0x4400('0x14'),auth[_0x4400('0x7')](),controller[_0x4400('0x15')]);router[_0x4400('0x12')]('/:id/reject',auth[_0x4400('0x7')](),controller[_0x4400('0x16')]);router[_0x4400('0x17')](_0x4400('0xa'),auth[_0x4400('0x7')](),controller['destroy']);module[_0x4400('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 88605b2..e42eed6 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 _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 +var _0x2452=['exports','BOOLEAN','ENUM','out','STRING','DATE','sequelize'];(function(_0x3ff2f9,_0x544ba1){var _0x3b0913=function(_0x554288){while(--_0x554288){_0x3ff2f9['push'](_0x3ff2f9['shift']());}};_0x3b0913(++_0x544ba1);}(_0x2452,0x179));var _0x2245=function(_0x9a138c,_0x2607f8){_0x9a138c=_0x9a138c-0x0;var _0x3771a3=_0x2452[_0x9a138c];return _0x3771a3;};'use strict';var Sequelize=require(_0x2245('0x0'));module[_0x2245('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x2245('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2245('0x3')]('in',_0x2245('0x4')),'defaultValue':_0x2245('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x2245('0x5')](0xbe)},'phone':{'type':Sequelize[_0x2245('0x5')]},'readAt':{'type':Sequelize[_0x2245('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 79ecc89..54d6d5c 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 _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 +var _0xca56=['error','code','message','info','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','end','stack','name','send','map','SmsMessage','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','create','body','describe','sms-interactions','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','find','CmContact','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','SIP/%s','channel','event','accept','EventManager','acceptmessage','agent','RejectMessage','rejectMessage','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','MessageUUID','messageId','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','socket.io-emitter','register','jayson/promise','http','client','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','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x299b9c,_0xd252d2){var _0x4adff8=function(_0x3e19cb){while(--_0x3e19cb){_0x299b9c['push'](_0x299b9c['shift']());}};_0x4adff8(++_0xd252d2);}(_0xca56,0xee));var _0x6ca5=function(_0x3528e8,_0x5f4ffe){_0x3528e8=_0x3528e8-0x0;var _0x47231d=_0xca56[_0x3528e8];return _0x47231d;};'use strict';var pdf=require(_0x6ca5('0x0'));var emlformat=require(_0x6ca5('0x1'));var rimraf=require(_0x6ca5('0x2'));var zipdir=require(_0x6ca5('0x3'));var jsonpatch=require(_0x6ca5('0x4'));var rp=require(_0x6ca5('0x5'));var moment=require(_0x6ca5('0x6'));var BPromise=require(_0x6ca5('0x7'));var Mustache=require(_0x6ca5('0x8'));var util=require('util');var path=require(_0x6ca5('0x9'));var sox=require(_0x6ca5('0xa'));var csv=require(_0x6ca5('0xb'));var ejs=require(_0x6ca5('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6ca5('0xd'));var crypto=require(_0x6ca5('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6ca5('0xb'));var querystring=require(_0x6ca5('0xf'));var Papa=require(_0x6ca5('0x10'));var Redis=require(_0x6ca5('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6ca5('0x12'));var hardwareService=require(_0x6ca5('0x13'));var logger=require(_0x6ca5('0x14'))(_0x6ca5('0x15'));var utils=require(_0x6ca5('0x16'));var config=require('../../config/environment');var db=require(_0x6ca5('0x17'))['db'];config['redis']=_[_0x6ca5('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6ca5('0x19'))(new Redis(config['redis']));require('./smsMessage.socket')[_0x6ca5('0x1a')](socket);var jayson=require(_0x6ca5('0x1b'));var client=jayson['client'][_0x6ca5('0x1c')]({'port':0x232c});var client9002=jayson[_0x6ca5('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x40483f,_0x19debd,_0x1cdfdc){if(_0x1cdfdc){var _0x115381=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x115381[_0x6ca5('0x1e')](_0x19debd)){return _0x40483f;}else{throw new db['Sequelize'][(_0x6ca5('0x1f'))](_0x6ca5('0x20'));}}else{return _0x40483f;}}function respondWithRpcPromise(_0x579a6e,_0x2b3daf,_0xd48e56,_0x4fefd0){return new BPromise(function(_0x100df4,_0x929bbf){var _0x15ffb6=_0x4fefd0||client;return _0x15ffb6[_0x6ca5('0x21')](_0x579a6e,_0xd48e56)[_0x6ca5('0x22')](function(_0x1115ae){logger['info'](_0x6ca5('0x23'),_0x2b3daf,_0x6ca5('0x24'));logger[_0x6ca5('0x25')](_0x6ca5('0x26'),_0x2b3daf,_0x6ca5('0x24'),JSON[_0x6ca5('0x27')](_0x1115ae));if(_0x1115ae[_0x6ca5('0x28')]){if(_0x1115ae[_0x6ca5('0x28')][_0x6ca5('0x29')]===0x1f4){logger[_0x6ca5('0x28')](_0x6ca5('0x23'),_0x2b3daf,_0x1115ae[_0x6ca5('0x28')][_0x6ca5('0x2a')]);return _0x929bbf(_0x1115ae[_0x6ca5('0x28')][_0x6ca5('0x2a')]);}logger['error'](_0x6ca5('0x23'),_0x2b3daf,_0x1115ae[_0x6ca5('0x28')][_0x6ca5('0x2a')]);return _0x100df4(_0x1115ae[_0x6ca5('0x28')]['message']);}else{logger[_0x6ca5('0x2b')](_0x6ca5('0x23'),_0x2b3daf,_0x6ca5('0x24'));_0x100df4(_0x1115ae[_0x6ca5('0x2c')][_0x6ca5('0x2a')]);}})[_0x6ca5('0x2d')](function(_0x241614){logger['error'](_0x6ca5('0x23'),_0x2b3daf,_0x241614);_0x929bbf(_0x241614);});});}function respondWithStatusCode(_0x405979,_0x100120){_0x100120=_0x100120||0xcc;return function(_0x150f54){if(_0x150f54){return _0x405979[_0x6ca5('0x2e')](_0x100120);}return _0x405979[_0x6ca5('0x2f')](_0x100120)['end']();};}function respondWithResult(_0xa570e4,_0x31ab9c){_0x31ab9c=_0x31ab9c||0xc8;return function(_0x3f0756){if(_0x3f0756){return _0xa570e4[_0x6ca5('0x2f')](_0x31ab9c)[_0x6ca5('0x30')](_0x3f0756);}};}function respondWithFilteredResult(_0x2d6558,_0x441436){return function(_0x451c2d){if(_0x451c2d){var _0x360172=_0x451c2d[_0x6ca5('0x31')],_0x1d6420=_0x441436[_0x6ca5('0x32')],_0x3e30c5=_0x441436[_0x6ca5('0x32')]+_0x441436[_0x6ca5('0x33')],_0x2230d4;if(_0x3e30c5>=_0x360172){_0x3e30c5=_0x360172;_0x2230d4=0xc8;}else{_0x2230d4=0xce;}_0x2d6558[_0x6ca5('0x2f')](_0x2230d4);return _0x2d6558[_0x6ca5('0x34')](_0x6ca5('0x35'),_0x1d6420+'-'+_0x3e30c5+'/'+_0x360172)[_0x6ca5('0x30')](_0x451c2d);}return null;};}function patchUpdates(_0x5b95ce){return function(_0x40c4b7){try{jsonpatch['apply'](_0x40c4b7,_0x5b95ce,!![]);}catch(_0x22cd7f){return BPromise[_0x6ca5('0x36')](_0x22cd7f);}return _0x40c4b7[_0x6ca5('0x37')]();};}function saveUpdates(_0x170203,_0x5942a3){return function(_0x1f1798){if(_0x1f1798){return _0x1f1798[_0x6ca5('0x38')](_0x170203)[_0x6ca5('0x22')](function(_0x3d769a){return _0x3d769a;});}return null;};}function removeEntity(_0xce09fb,_0x322699){return function(_0x526fce){if(_0x526fce){return _0x526fce[_0x6ca5('0x39')]()[_0x6ca5('0x22')](function(){_0xce09fb['status'](0xcc)[_0x6ca5('0x3a')]();});}};}function handleEntityNotFound(_0x37aab3,_0x16fc54){return function(_0x57bb45){if(!_0x57bb45){_0x37aab3[_0x6ca5('0x2e')](0x194);}return _0x57bb45;};}function handleError(_0x2d9b2d,_0x22682a){_0x22682a=_0x22682a||0x1f4;return function(_0xb3801){logger['error'](_0xb3801[_0x6ca5('0x3b')]);if(_0xb3801[_0x6ca5('0x3c')]){delete _0xb3801[_0x6ca5('0x3c')];}_0x2d9b2d[_0x6ca5('0x2f')](_0x22682a)[_0x6ca5('0x3d')](_0xb3801);};}exports['index']=function(_0x39b970,_0x23bca2){var _0x1f014f={},_0x218c52={},_0x50d856={'count':0x0,'rows':[]};var _0x9261a8=_[_0x6ca5('0x3e')](db[_0x6ca5('0x3f')]['rawAttributes'],function(_0x380c54){return{'name':_0x380c54[_0x6ca5('0x40')],'type':_0x380c54[_0x6ca5('0x41')][_0x6ca5('0x42')]};});_0x218c52['model']=_[_0x6ca5('0x3e')](_0x9261a8,_0x6ca5('0x3c'));_0x218c52['query']=_[_0x6ca5('0x43')](_0x39b970[_0x6ca5('0x44')]);_0x218c52[_0x6ca5('0x45')]=_[_0x6ca5('0x46')](_0x218c52[_0x6ca5('0x47')],_0x218c52[_0x6ca5('0x44')]);_0x1f014f[_0x6ca5('0x48')]=_[_0x6ca5('0x46')](_0x218c52[_0x6ca5('0x47')],qs[_0x6ca5('0x49')](_0x39b970[_0x6ca5('0x44')]['fields']));_0x1f014f[_0x6ca5('0x48')]=_0x1f014f[_0x6ca5('0x48')][_0x6ca5('0x4a')]?_0x1f014f[_0x6ca5('0x48')]:_0x218c52['model'];if(!_0x39b970[_0x6ca5('0x44')][_0x6ca5('0x4b')]('nolimit')){_0x1f014f[_0x6ca5('0x33')]=qs[_0x6ca5('0x33')](_0x39b970['query'][_0x6ca5('0x33')]);_0x1f014f['offset']=qs['offset'](_0x39b970['query'][_0x6ca5('0x32')]);}_0x1f014f[_0x6ca5('0x4c')]=qs[_0x6ca5('0x4d')](_0x39b970[_0x6ca5('0x44')][_0x6ca5('0x4d')]);_0x1f014f[_0x6ca5('0x4e')]=qs[_0x6ca5('0x45')](_['pick'](_0x39b970['query'],_0x218c52[_0x6ca5('0x45')]),_0x9261a8);if(_0x39b970[_0x6ca5('0x44')][_0x6ca5('0x4f')]){_0x1f014f[_0x6ca5('0x4e')]=_[_0x6ca5('0x50')](_0x1f014f['where'],{'$or':_[_0x6ca5('0x3e')](_0x9261a8,function(_0x2c882e){if(_0x2c882e[_0x6ca5('0x41')]!==_0x6ca5('0x51')){var _0x246c96={};_0x246c96[_0x2c882e['name']]={'$like':'%'+_0x39b970['query'][_0x6ca5('0x4f')]+'%'};return _0x246c96;}})});}_0x1f014f=_['merge']({},_0x1f014f,_0x39b970[_0x6ca5('0x52')]);var _0x1a7be0={'where':_0x1f014f['where']};return db[_0x6ca5('0x3f')][_0x6ca5('0x31')](_0x1a7be0)[_0x6ca5('0x22')](function(_0x1d7bc0){_0x50d856['count']=_0x1d7bc0;if(_0x39b970[_0x6ca5('0x44')][_0x6ca5('0x53')]){_0x1f014f[_0x6ca5('0x54')]=[{'all':!![]}];}return db[_0x6ca5('0x3f')][_0x6ca5('0x55')](_0x1f014f);})[_0x6ca5('0x22')](function(_0x259642){_0x50d856[_0x6ca5('0x56')]=_0x259642;return _0x50d856;})['then'](respondWithFilteredResult(_0x23bca2,_0x1f014f))[_0x6ca5('0x2d')](handleError(_0x23bca2,null));};exports['show']=function(_0x4e6eda,_0x246ed0){var _0x2f1590={'raw':!![],'where':{'id':_0x4e6eda[_0x6ca5('0x57')]['id']}},_0x2bddc4={};_0x2bddc4[_0x6ca5('0x47')]=_[_0x6ca5('0x43')](db[_0x6ca5('0x3f')][_0x6ca5('0x58')]);_0x2bddc4[_0x6ca5('0x44')]=_[_0x6ca5('0x43')](_0x4e6eda['query']);_0x2bddc4[_0x6ca5('0x45')]=_['intersection'](_0x2bddc4[_0x6ca5('0x47')],_0x2bddc4[_0x6ca5('0x44')]);_0x2f1590['attributes']=_[_0x6ca5('0x46')](_0x2bddc4['model'],qs['fields'](_0x4e6eda[_0x6ca5('0x44')][_0x6ca5('0x49')]));_0x2f1590[_0x6ca5('0x48')]=_0x2f1590['attributes'][_0x6ca5('0x4a')]?_0x2f1590[_0x6ca5('0x48')]:_0x2bddc4['model'];if(_0x4e6eda[_0x6ca5('0x44')]['includeAll']){_0x2f1590[_0x6ca5('0x54')]=[{'all':!![]}];}_0x2f1590=_[_0x6ca5('0x50')]({},_0x2f1590,_0x4e6eda['options']);return db[_0x6ca5('0x3f')]['find'](_0x2f1590)[_0x6ca5('0x22')](handleEntityNotFound(_0x246ed0,null))[_0x6ca5('0x22')](respondWithResult(_0x246ed0,null))[_0x6ca5('0x2d')](handleError(_0x246ed0,null));};exports[_0x6ca5('0x59')]=function(_0x163132,_0x4d7f0c){return db['SmsMessage']['create'](_0x163132[_0x6ca5('0x5a')],{})['then'](respondWithResult(_0x4d7f0c,0xc9))[_0x6ca5('0x2d')](handleError(_0x4d7f0c,null));};exports[_0x6ca5('0x38')]=function(_0x37e8d1,_0x58fbad){if(_0x37e8d1[_0x6ca5('0x5a')]['id']){delete _0x37e8d1[_0x6ca5('0x5a')]['id'];}return db[_0x6ca5('0x3f')]['find']({'where':{'id':_0x37e8d1['params']['id']}})[_0x6ca5('0x22')](handleEntityNotFound(_0x58fbad,null))[_0x6ca5('0x22')](saveUpdates(_0x37e8d1[_0x6ca5('0x5a')],null))[_0x6ca5('0x22')](respondWithResult(_0x58fbad,null))[_0x6ca5('0x2d')](handleError(_0x58fbad,null));};exports[_0x6ca5('0x39')]=function(_0x265cf2,_0x3f5941){return db['SmsMessage']['find']({'where':{'id':_0x265cf2['params']['id']}})[_0x6ca5('0x22')](handleEntityNotFound(_0x3f5941,null))[_0x6ca5('0x22')](removeEntity(_0x3f5941,null))['catch'](handleError(_0x3f5941,null));};exports[_0x6ca5('0x5b')]=function(_0x1a4913,_0xe3793b){return db[_0x6ca5('0x3f')][_0x6ca5('0x5b')]()['then'](respondWithResult(_0xe3793b,null))[_0x6ca5('0x2d')](handleError(_0xe3793b,null));};var interaction_log=require(_0x6ca5('0x14'))(_0x6ca5('0x5c'));exports['accept']=function(_0xba6093,_0x1321c5,_0x26c110){var _0x351be1={'channel':_0x6ca5('0x5d')};if(_0xba6093['body']['id']){delete _0xba6093['body']['id'];}_0xba6093[_0x6ca5('0x5a')][_0x6ca5('0x5e')]=!![];_0xba6093[_0x6ca5('0x5a')]['readAt']=moment()[_0x6ca5('0x5f')](_0x6ca5('0x60'));_0xba6093[_0x6ca5('0x5a')]['UserId']=_0xba6093[_0x6ca5('0x5a')][_0x6ca5('0x61')]||_0xba6093[_0x6ca5('0x62')]['id'];return db['SmsMessage'][_0x6ca5('0x63')]({'where':{'id':_0xba6093[_0x6ca5('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x6ca5('0x64')],'as':'Contact'}]})[_0x6ca5('0x22')](handleEntityNotFound(_0x1321c5,null))[_0x6ca5('0x22')](saveUpdates(_0xba6093[_0x6ca5('0x5a')],null))[_0x6ca5('0x22')](function(_0x4f4c21){if(_0x4f4c21){_0x351be1['message']=_0x4f4c21[_0x6ca5('0x65')]({'plain':!![]});return db[_0x6ca5('0x66')][_0x6ca5('0x63')]({'where':{'id':_0x4f4c21[_0x6ca5('0x67')]}});}return null;})[_0x6ca5('0x22')](handleEntityNotFound(_0x1321c5,null))[_0x6ca5('0x22')](function(_0x39867b){if(_0x39867b){return _0x39867b[_0x6ca5('0x38')]({'UserId':_0xba6093['body']['UserId'],'read1stAt':_[_0x6ca5('0x68')](_0x39867b[_0x6ca5('0x69')])?moment()[_0x6ca5('0x5f')](_0x6ca5('0x60')):undefined});}return null;})['then'](function(_0x5c1c7b){if(_0x5c1c7b){_0x351be1[_0x6ca5('0x6a')]=_0x5c1c7b[_0x6ca5('0x65')]({'plain':!![]});interaction_log[_0x6ca5('0x2b')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xba6093['user']['id'],_0xba6093[_0x6ca5('0x62')][_0x6ca5('0x3c')],_0xba6093[_0x6ca5('0x62')][_0x6ca5('0x6b')],_0x351be1[_0x6ca5('0x6a')]['id'],_0xba6093[_0x6ca5('0x5a')]?JSON[_0x6ca5('0x27')](_0xba6093[_0x6ca5('0x5a')]):_0x6ca5('0x6c'));return respondWithRpcPromise(_0x6ca5('0x6d'),_0x6ca5('0x6e'),_0x351be1);}return null;})[_0x6ca5('0x22')](function(_0x266a01){if(_0x266a01){if(_0xba6093[_0x6ca5('0x5a')]['manual']){_0x351be1[_0x6ca5('0x2a')]['interface']=util[_0x6ca5('0x5f')](_0x6ca5('0x6f'),_0xba6093[_0x6ca5('0x62')][_0x6ca5('0x3c')]);_0x351be1['message']['channel']=_0x351be1[_0x6ca5('0x70')];_0x351be1[_0x6ca5('0x2a')][_0x6ca5('0x71')]=_0x6ca5('0x72');return respondWithRpcPromise(_0x6ca5('0x73'),'EventManager',{'event':_0x6ca5('0x74'),'message':_0x351be1[_0x6ca5('0x2a')]},client9002)[_0x6ca5('0x22')](function(){return _0x351be1;});}return _0x351be1;}return null;})[_0x6ca5('0x22')](respondWithResult(_0x1321c5,null))['catch'](handleError(_0x1321c5,null));};var interaction_log=require(_0x6ca5('0x14'))('sms-interactions');exports[_0x6ca5('0x36')]=function(_0x58d6ce,_0x34b960,_0x3a7997){var _0x3447a0={'agent':{},'channel':_0x6ca5('0x5d')};if(_0x58d6ce[_0x6ca5('0x5a')]['id']){delete _0x58d6ce[_0x6ca5('0x5a')]['id'];}_0x58d6ce[_0x6ca5('0x5a')]['UserId']=_0x58d6ce['body']['UserId']||_0x58d6ce['user']['id'];_0x3447a0[_0x6ca5('0x75')]['id']=_0x58d6ce[_0x6ca5('0x5a')][_0x6ca5('0x61')];return db[_0x6ca5('0x3f')][_0x6ca5('0x63')]({'where':{'id':_0x58d6ce[_0x6ca5('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x34b960,null))[_0x6ca5('0x22')](function(_0x5d9fc5){if(_0x5d9fc5){_0x3447a0[_0x6ca5('0x2a')]=_0x5d9fc5[_0x6ca5('0x65')]({'plain':!![]});return db[_0x6ca5('0x66')][_0x6ca5('0x63')]({'where':{'id':_0x5d9fc5[_0x6ca5('0x67')]}});}return null;})[_0x6ca5('0x22')](handleEntityNotFound(_0x34b960,null))['then'](function(_0x31dd76){if(_0x31dd76){_0x3447a0['interaction']=_0x31dd76[_0x6ca5('0x65')]({'plain':!![]});interaction_log[_0x6ca5('0x2b')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x58d6ce['user']['id'],_0x58d6ce[_0x6ca5('0x62')][_0x6ca5('0x3c')],_0x58d6ce[_0x6ca5('0x62')][_0x6ca5('0x6b')],_0x3447a0[_0x6ca5('0x6a')]['id'],_0x58d6ce['body']?JSON[_0x6ca5('0x27')](_0x58d6ce[_0x6ca5('0x5a')]):_0x6ca5('0x6c'));return respondWithRpcPromise(_0x6ca5('0x76'),_0x6ca5('0x77'),_0x3447a0);}return null;})['then'](function(_0x537848){if(_0x537848){_0x537848[_0x6ca5('0x2a')]['interface']=util[_0x6ca5('0x5f')](_0x6ca5('0x6f'),_0x58d6ce[_0x6ca5('0x62')][_0x6ca5('0x3c')]);_0x537848['message'][_0x6ca5('0x70')]=_0x3447a0[_0x6ca5('0x70')];_0x537848[_0x6ca5('0x2a')][_0x6ca5('0x71')]='reject';respondWithRpcPromise(_0x6ca5('0x73'),'EventManager',{'event':_0x6ca5('0x78'),'message':_0x537848[_0x6ca5('0x2a')]},client9002);return _0x3447a0;}return null;})[_0x6ca5('0x22')](respondWithResult(_0x34b960,null))['catch'](handleError(_0x34b960,null));};exports['status']=function(_0x166c25,_0x3e4722,_0x16a725){if(_0x166c25[_0x6ca5('0x5a')]['id']){delete _0x166c25[_0x6ca5('0x5a')]['id'];}var _0x572c0e;return db[_0x6ca5('0x3f')]['find']({'where':{'id':_0x166c25[_0x6ca5('0x57')]['id']}})['then'](handleEntityNotFound(_0x3e4722,null))[_0x6ca5('0x22')](function(_0x6faf17){if(_0x6faf17){_0x572c0e=_0x6faf17;return db[_0x6ca5('0x79')][_0x6ca5('0x63')]({'where':{'id':_0x6faf17[_0x6ca5('0x7a')]}});}})[_0x6ca5('0x22')](handleEntityNotFound(_0x3e4722,null))[_0x6ca5('0x22')](function(_0x20f649){if(_0x20f649){logger[_0x6ca5('0x25')](_0x6ca5('0x26'),'status',_0x6ca5('0x7b'),_0x20f649[_0x6ca5('0x41')],util[_0x6ca5('0x7c')](_0x166c25['body'],{'showHidden':![],'depth':null}));switch(_0x20f649[_0x6ca5('0x41')]){case'twilio':if(_0x166c25[_0x6ca5('0x5a')][_0x6ca5('0x7d')]&&_0x166c25[_0x6ca5('0x5a')][_0x6ca5('0x7d')]===_0x572c0e['messageId']){return _0x572c0e['update']({'read':!![]});}else{logger[_0x6ca5('0x28')](_0x6ca5('0x7e'),'status',_0x6ca5('0x7f'),util['inspect'](_0x166c25['body'],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x166c25[_0x6ca5('0x5a')]['MessageUUID']&&_0x166c25['body'][_0x6ca5('0x80')]===_0x572c0e[_0x6ca5('0x81')]&&_[_0x6ca5('0x82')]([_0x6ca5('0x83'),_0x6ca5('0x84')],_0x166c25[_0x6ca5('0x5a')][_0x6ca5('0x85')])>=0x0){return _0x572c0e[_0x6ca5('0x38')]({'read':!![]});}else{logger[_0x6ca5('0x28')](_0x6ca5('0x7e'),_0x6ca5('0x2f'),_0x6ca5('0x86'),util[_0x6ca5('0x7c')](_0x166c25[_0x6ca5('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x6ca5('0x87'):var _0x44dcb4=_0x166c25[_0x6ca5('0x5a')][_0x6ca5('0x88')][0x0];if(_0x44dcb4[_0x6ca5('0x2f')][_0x6ca5('0x89')]===_0x6ca5('0x8a')){return _0x572c0e[_0x6ca5('0x38')]({'read':!![]});}else{logger[_0x6ca5('0x28')](_0x6ca5('0x7e'),'status',_0x6ca5('0x87'),util[_0x6ca5('0x7c')](_0x166c25[_0x6ca5('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x572c0e;}})[_0x6ca5('0x22')](respondWithResult(_0x3e4722,null))[_0x6ca5('0x2d')](handleError(_0x3e4722,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 2c4872d..dd82670 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 _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 +var _0x3dc4=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsMessage'];(function(_0x2e878c,_0x4d6f8a){var _0x4f96ff=function(_0x2fdb28){while(--_0x2fdb28){_0x2e878c['push'](_0x2e878c['shift']());}};_0x4f96ff(++_0x4d6f8a);}(_0x3dc4,0x76));var _0x43dc=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x3dc4[_0x167cc1];return _0x10bc4b;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x43dc('0x0'))['db'][_0x43dc('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x43dc('0x2')](0x0);var events={'afterCreate':_0x43dc('0x3'),'afterUpdate':_0x43dc('0x4'),'afterDestroy':_0x43dc('0x5')};function emitEvent(_0x1b4f47){return function(_0x2b0b60,_0xd49543,_0x268030){SmsMessageEvents['emit'](_0x1b4f47+':'+_0x2b0b60['id'],_0x2b0b60);SmsMessageEvents[_0x43dc('0x6')](_0x1b4f47,_0x2b0b60);_0x268030(null);};}for(var e in events){if(events[_0x43dc('0x7')](e)){var event=events[e];SmsMessage[_0x43dc('0x8')](e,emitEvent(event));}}module[_0x43dc('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index c416c98..a34130c 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 _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 +var _0x4aaf=['bluebird','path','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','get','direction','secret','isNil','UserId','SmsInteraction','findOne','then','update','createdAt','catch','find','type','authToken','phone','messages','remote','/api/sms/messages/','/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','body','smsMethod','sender','login?username=','&password=','split','sms','session_key','total_sent','internal_order_id','deliveryReport','skebby','senderString','POST','https://smsapi.connectel.se/api/send/','requestid','read','connectel','Missing\x20parameters:\x20authToken','clicksend','password','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','http_code','data','queued_count','head','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','apiKey','login','text','timestamp','sort','length','createHash','md5','hex','signature=','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x4aaf,0x1d0));var _0xf4aa=function(_0x323d3a,_0x325482){_0x323d3a=_0x323d3a-0x0;var _0x24847a=_0x4aaf[_0x323d3a];return _0x24847a;};'use strict';var _=require(_0xf4aa('0x0'));var util=require(_0xf4aa('0x1'));var logger=require('../../config/logger')(_0xf4aa('0x2'));var moment=require(_0xf4aa('0x3'));var BPromise=require(_0xf4aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf4aa('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module[_0xf4aa('0x6')]=function(_0x3c3590,_0x57618d){return _0x3c3590[_0xf4aa('0x7')](_0xf4aa('0x8'),attributes,{'tableName':_0xf4aa('0x9'),'paranoid':![],'indexes':[{'name':_0xf4aa('0xa'),'fields':[_0xf4aa('0xa')]},{'name':_0xf4aa('0xb'),'fields':['body'],'type':_0xf4aa('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1061c0,_0x46a242,_0x3a926f){var _0x26ff51=_0x3c3590['models'];var _0x4ae625=_0x1061c0[_0xf4aa('0xd')]({'plain':!![]});if(_0x4ae625[_0xf4aa('0xe')]['toLowerCase']()==='in'||_0x4ae625[_0xf4aa('0xe')]['toLowerCase']()==='out'&&!_0x4ae625[_0xf4aa('0xf')]&&!_[_0xf4aa('0x10')](_0x4ae625[_0xf4aa('0x11')])){_0x26ff51[_0xf4aa('0x12')][_0xf4aa('0x13')]({'where':{'id':_0x4ae625['SmsInteractionId']}})[_0xf4aa('0x14')](function(_0x370f96){if(_0x370f96){_0x370f96[_0xf4aa('0x15')]({'lastMsgAt':_0x4ae625[_0xf4aa('0x16')],'lastMsgDirection':_0x4ae625['direction']['toLowerCase']()});}})[_0xf4aa('0x17')](function(_0x1f88c1){console['error'](_0x1f88c1);});}if(_0x4ae625['direction']==='out'&&!_0x4ae625[_0xf4aa('0xf')]){var _0x260525;_0x26ff51['SmsAccount'][_0xf4aa('0x18')]({'where':{'id':_0x4ae625['SmsAccountId']},'raw':!![]})[_0xf4aa('0x14')](function(_0x14584e){_0x260525=_0x14584e;if(_0x260525&&_0x260525[_0xf4aa('0x19')]){switch(_0x260525[_0xf4aa('0x19')]){case'twilio':var _0x1293eb=require('twilio');if(_0x260525['accountSid']&&_0x260525[_0xf4aa('0x1a')]&&_0x260525[_0xf4aa('0x1b')]){var _0x2429b2=new _0x1293eb(_0x260525['accountSid'],_0x260525['authToken']);_0x2429b2[_0xf4aa('0x1c')]['create']({'body':_0x4ae625['body'],'to':_0x4ae625[_0xf4aa('0x1b')],'from':_0x260525['phone'],'statusCallback':_0x260525[_0xf4aa('0x1d')]+_0xf4aa('0x1e')+_0x4ae625['id']+_0xf4aa('0x1f')+_0x260525[_0xf4aa('0x20')]})[_0xf4aa('0x14')](function(_0x4fee08){if(_0x4fee08['sid']){return _0x1061c0[_0xf4aa('0x15')]({'messageId':_0x4fee08[_0xf4aa('0x21')]});}})[_0xf4aa('0x17')](function(_0x2b203c){logger[_0xf4aa('0x22')](_0xf4aa('0x23'),_0xf4aa('0x24'),_0xf4aa('0x25'),util[_0xf4aa('0x26')](_0x2b203c,{'showHidden':![],'depth':null}));});}else{logger[_0xf4aa('0x22')](_0xf4aa('0x23'),_0xf4aa('0x24'),_0xf4aa('0x25'),_0xf4aa('0x27'));}break;case'skebby':var _0x87a039=_0xf4aa('0x28');if(_0x260525[_0xf4aa('0x29')]&&_0x260525['password']){var _0x448296={'recipient':[_0x4ae625[_0xf4aa('0x1b')]],'message':_0x4ae625[_0xf4aa('0x2a')],'message_type':_0x260525[_0xf4aa('0x2b')]};if(_0x260525[_0xf4aa('0x2b')]&&_0x260525['smsMethod']!=='SI'){_0x448296[_0xf4aa('0x2c')]=_0x260525['phone'];}var _0x3e7133={'url':_0x87a039+_0xf4aa('0x2d')+_0x260525[_0xf4aa('0x29')]+_0xf4aa('0x2e')+_0x260525['password'],'method':'GET'};rp(_0x3e7133)[_0xf4aa('0x14')](function(_0xc3f60b){var _0x9d1d17=_0xc3f60b[_0xf4aa('0x2f')](';');var _0x53be68={'user_key':_0x9d1d17[0x0],'session_key':_0x9d1d17[0x1]};_0x3e7133={'url':_0x87a039+_0xf4aa('0x30'),'method':'POST','headers':{'user_key':_0x53be68['user_key'],'Session_key':_0x53be68[_0xf4aa('0x31')]},'json':!![],'body':_0x448296};return rp(_0x3e7133);})[_0xf4aa('0x14')](function(_0x13724b){if(_0x13724b[_0xf4aa('0x32')]>=0x1){var _0x3b0b43={'messageId':_0x13724b[_0xf4aa('0x33')]};if(_0x260525[_0xf4aa('0x2b')]!=='GP'||!_0x260525[_0xf4aa('0x34')]){_0x3b0b43['read']=!![];}return _0x1061c0['update'](_0x3b0b43);}else{return logger['error'](_0xf4aa('0x23'),_0xf4aa('0x24'),_0xf4aa('0x35'),util[_0xf4aa('0x26')](_0x13724b,{'showHidden':![],'depth':null}));}})[_0xf4aa('0x17')](function(_0x4da375){return logger[_0xf4aa('0x22')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf4aa('0x24'),_0xf4aa('0x35'),util['inspect'](_0x4da375,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf4aa('0x23'),'afterCreate',_0xf4aa('0x35'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x260525[_0xf4aa('0x1a')]){var _0x574aad={'recipient':_0x4ae625['phone'],'message':_0x4ae625[_0xf4aa('0x2a')],'sender':_0x260525[_0xf4aa('0x36')]||_0x260525[_0xf4aa('0x1b')],'authorization':_0x260525['authToken']};var _0x46a242={'method':_0xf4aa('0x37'),'uri':_0xf4aa('0x38'),'body':_0x574aad,'json':!![]};rp(_0x46a242)[_0xf4aa('0x14')](function(_0x4fb5c2){var _0x3b8536={'messageId':_0x4fb5c2[_0xf4aa('0x39')]};if(!_0x260525[_0xf4aa('0x34')]){_0x3b8536[_0xf4aa('0x3a')]=!![];}return _0x1061c0[_0xf4aa('0x15')](_0x3b8536);})[_0xf4aa('0x17')](function(_0x44072c){logger[_0xf4aa('0x22')](_0xf4aa('0x23'),_0xf4aa('0x24'),'connectel',util[_0xf4aa('0x26')](_0x44072c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf4aa('0x23'),_0xf4aa('0x24'),_0xf4aa('0x3b'),_0xf4aa('0x3c'));}break;case _0xf4aa('0x3d'):if(_0x260525[_0xf4aa('0x29')]&&_0x260525[_0xf4aa('0x3e')]){var _0x574aad={'messages':[{'source':_0xf4aa('0x3f'),'to':_0x4ae625[_0xf4aa('0x1b')],'body':_0x4ae625[_0xf4aa('0x2a')],'from':_0x260525[_0xf4aa('0x36')]||_0x260525['phone']}]};var _0x2ea8fc=util[_0xf4aa('0x40')](_0xf4aa('0x41'),_0x260525[_0xf4aa('0x29')],_0x260525[_0xf4aa('0x3e')]);var _0x46a242={'method':_0xf4aa('0x37'),'uri':_0xf4aa('0x42'),'body':_0x574aad,'headers':{'Authorization':util[_0xf4aa('0x40')]('Basic\x20%s',new Buffer(_0x2ea8fc)[_0xf4aa('0x43')]('base64'))},'json':!![]};rp(_0x46a242)['then'](function(_0x3238f7){if(_0x3238f7['http_code']>=0xc8&&_0x3238f7[_0xf4aa('0x44')]<=0xce){if(_0x3238f7[_0xf4aa('0x45')]&&_0x3238f7[_0xf4aa('0x45')][_0xf4aa('0x46')]>0x0){var _0x11d545=_[_0xf4aa('0x47')](_0x3238f7[_0xf4aa('0x45')][_0xf4aa('0x1c')]);var _0x4ad546={'messageId':_0x11d545['message_id']};if(!_0x260525[_0xf4aa('0x34')]){_0x4ad546['read']=!![];}return _0x1061c0['update'](_0x4ad546);}else{logger[_0xf4aa('0x22')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf4aa('0x24'),'clickSend',util[_0xf4aa('0x26')](_0x3238f7,{'showHidden':![],'depth':null}));}}else{logger[_0xf4aa('0x22')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf4aa('0x24'),_0xf4aa('0x48'),util[_0xf4aa('0x26')](_0x3238f7,{'showHidden':![],'depth':null}));}})['catch'](function(_0x17cea8){logger['error'](_0xf4aa('0x23'),'afterCreate',_0xf4aa('0x48'),util['inspect'](_0x17cea8,{'showHidden':![],'depth':null}));});}else{logger[_0xf4aa('0x22')](_0xf4aa('0x23'),_0xf4aa('0x24'),_0xf4aa('0x48'),_0xf4aa('0x49'));}break;case _0xf4aa('0x4a'):if(_0x260525[_0xf4aa('0x4b')]&&_0x260525[_0xf4aa('0x1a')]){var _0x574aad={'dst':_0x4ae625[_0xf4aa('0x1b')],'text':_0x4ae625[_0xf4aa('0x2a')],'src':_0x260525[_0xf4aa('0x36')]||_0x260525[_0xf4aa('0x1b')],'url':_0x260525[_0xf4aa('0x1d')]+'/api/sms/messages/'+_0x4ae625['id']+_0xf4aa('0x1f')+_0x260525[_0xf4aa('0x20')]};var _0x2ea8fc=util[_0xf4aa('0x40')]('%s:%s',_0x260525[_0xf4aa('0x4b')],_0x260525[_0xf4aa('0x1a')]);var _0x46a242={'method':_0xf4aa('0x37'),'uri':util[_0xf4aa('0x40')](_0xf4aa('0x4c'),_0x260525[_0xf4aa('0x4b')]),'body':_0x574aad,'headers':{'Authorization':util['format'](_0xf4aa('0x4d'),new Buffer(_0x2ea8fc)['toString'](_0xf4aa('0x4e')))},'json':!![]};rp(_0x46a242)['then'](function(_0x35c859){var _0x3288bd={'messageId':_0x35c859[_0xf4aa('0x4f')][0x0]};return _0x1061c0['update'](_0x3288bd);})[_0xf4aa('0x17')](function(_0x1ca5ef){logger[_0xf4aa('0x22')](_0xf4aa('0x23'),_0xf4aa('0x24'),_0xf4aa('0x4a'),util[_0xf4aa('0x26')](_0x1ca5ef,{'showHidden':![],'depth':null}));});}else{logger[_0xf4aa('0x22')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf4aa('0x24'),_0xf4aa('0x4a'),_0xf4aa('0x50'));}break;case _0xf4aa('0x51'):if(_0x260525[_0xf4aa('0x29')]&&_0x260525[_0xf4aa('0x3e')]){if(_0x260525['baseUrl']){var _0x3e807f={'method':_0xf4aa('0x37'),'uri':_0x260525[_0xf4aa('0x52')]+'/auth/1/session','body':{'username':_0x260525[_0xf4aa('0x29')],'password':_0x260525['password']},'json':!![]};return rp(_0x3e807f)['then'](function(_0x7cb9e8){var _0x3e7190={'method':_0xf4aa('0x37'),'uri':_0x260525[_0xf4aa('0x52')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x260525[_0xf4aa('0x1b')],'destinations':[{'to':_0x4ae625['phone']}],'text':_0x4ae625['body'],'notifyUrl':_0x260525[_0xf4aa('0x1d')]+_0xf4aa('0x1e')+_0x4ae625['id']+_0xf4aa('0x1f')+_0x260525[_0xf4aa('0x20')],'notifyContentType':_0xf4aa('0x53'),'callbackData':_0x260525['phone']+';'+_0x4ae625[_0xf4aa('0x2a')]}]},'headers':{'Authorization':_0xf4aa('0x54')+_0x7cb9e8[_0xf4aa('0x20')]},'json':!![]};return rp(_0x3e7190)['then'](function(_0x10bfcc){if(_0x10bfcc[_0xf4aa('0x1c')]){var _0x17ac3d={'messageId':_0x10bfcc['messages'][0x0][_0xf4aa('0xa')]};if(!_0x260525['deliveryReport']){_0x17ac3d['read']=!![];}return _0x1061c0['update'](_0x17ac3d);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf4aa('0x51'),util[_0xf4aa('0x26')](_0x10bfcc,{'showHidden':![],'depth':null}));}});})[_0xf4aa('0x17')](function(_0x174b26){return logger[_0xf4aa('0x22')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf4aa('0x24'),_0xf4aa('0x51'),util['inspect'](_0x174b26,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf4aa('0x23'),_0xf4aa('0x24'),_0xf4aa('0x51'),_0xf4aa('0x55'));}}else{logger[_0xf4aa('0x22')](_0xf4aa('0x23'),_0xf4aa('0x24'),_0xf4aa('0x51'),_0xf4aa('0x49'));}break;case _0xf4aa('0x56'):var _0x1ae670=require('crypto');if(_0x260525[_0xf4aa('0x57')]){var _0x45fdec={};_0x45fdec[_0xf4aa('0x58')]=_0x260525[_0xf4aa('0x29')];_0x45fdec[_0xf4aa('0x1b')]=_0x4ae625[_0xf4aa('0x1b')];_0x45fdec['sender']=_0x260525['phone'];_0x45fdec[_0xf4aa('0x59')]=_0x4ae625['body'];_0x45fdec[_0xf4aa('0x5a')]=+new Date();var _0x30d1ab='';var _0x5144ff='';var _0x186f1c=Object['keys'](_0x45fdec);_0x186f1c[_0xf4aa('0x5b')]();for(var _0x235444=0x0;_0x235444<_0x186f1c[_0xf4aa('0x5c')];_0x235444++){if(_0x30d1ab!=''){_0x30d1ab+='&';}_0x30d1ab+=_0x186f1c[_0x235444]+'='+encodeURIComponent(_0x45fdec[_0x186f1c[_0x235444]]);_0x5144ff+=_0x45fdec[_0x186f1c[_0x235444]];}_0x5144ff+=_0x260525[_0xf4aa('0x57')];_0x5144ff=_0x1ae670[_0xf4aa('0x5d')](_0xf4aa('0x5e'))[_0xf4aa('0x15')](_0x5144ff)['digest'](_0xf4aa('0x5f'));if(_0x30d1ab!==''){_0x30d1ab+='&';}_0x30d1ab+=_0xf4aa('0x60')+_0x5144ff;var _0x3e7133={'method':_0xf4aa('0x61'),'uri':_0x260525[_0xf4aa('0x52')]+_0xf4aa('0x62')+_0x30d1ab,'json':!![]};return rp(_0x3e7133)[_0xf4aa('0x14')](function(_0x2d6666){var _0x16bb38=Object['keys'](_0x2d6666);if(_0x2d6666[_0x16bb38[0x0]]['error']&&parseInt(_0x2d6666[_0x16bb38[0x0]]['error'])===0x0){var _0x5422ad={'messageId':_0x2d6666[_0x16bb38[0x0]][_0xf4aa('0x63')]};if(!_0x260525[_0xf4aa('0x34')]){_0x5422ad['read']=!![];}return _0x1061c0[_0xf4aa('0x15')](_0x5422ad);}else{return logger[_0xf4aa('0x22')](_0xf4aa('0x23'),_0xf4aa('0x24'),_0xf4aa('0x56'),util[_0xf4aa('0x26')](_0x2d6666[_0xf4aa('0x22')],{'showHidden':![],'depth':null}));}})[_0xf4aa('0x17')](function(_0x15a9d4){return logger[_0xf4aa('0x22')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf4aa('0x24'),_0xf4aa('0x56'),util[_0xf4aa('0x26')](_0x15a9d4,{'showHidden':![],'depth':null}));});}else{logger[_0xf4aa('0x22')](_0xf4aa('0x23'),_0xf4aa('0x24'),_0xf4aa('0x56'),_0xf4aa('0x64'));}break;case _0xf4aa('0x65'):if(_0x260525[_0xf4aa('0x57')]){var _0xca5ada={'method':_0xf4aa('0x37'),'uri':_0xf4aa('0x66'),'headers':{'Authorization':_0x260525['apiKey']},'body':{'content':_0x4ae625[_0xf4aa('0x2a')],'to':[_0x4ae625['phone']],'from':_0x260525['phone'],'binary':![],'clientMessageId':_0xf4aa('0x67'),'charset':_0xf4aa('0x68')},'json':!![]};rp(_0xca5ada)[_0xf4aa('0x14')](function(_0x2103a1){if(!_0x2103a1[_0xf4aa('0x22')]){var _0x109e40={'messageId':_0x2103a1[_0xf4aa('0x1c')][0x0][_0xf4aa('0x69')]};if(!_0x260525[_0xf4aa('0x34')]){_0x109e40['read']=!![];}return _0x1061c0[_0xf4aa('0x15')](_0x109e40);}else{return logger[_0xf4aa('0x22')](_0xf4aa('0x23'),_0xf4aa('0x24'),'clickatell',util[_0xf4aa('0x26')](_0x2103a1[_0xf4aa('0x22')],{'showHidden':![],'depth':null}));}})[_0xf4aa('0x17')](function(_0x461d1d){return logger['error'](_0xf4aa('0x23'),_0xf4aa('0x24'),_0xf4aa('0x65'),util[_0xf4aa('0x26')](_0x461d1d,{'showHidden':![],'depth':null}));});}else{logger[_0xf4aa('0x22')](_0xf4aa('0x23'),_0xf4aa('0x24'),_0xf4aa('0x65'),_0xf4aa('0x64'));}break;case'intelepeer':if(_0x260525[_0xf4aa('0x57')]){var _0x4b9f6f={};var _0x3e7133={'method':'POST','uri':_0xf4aa('0x6a'),'headers':{'Authorization':'Bearer\x20'+_0x260525[_0xf4aa('0x57')],'Content-Type':_0xf4aa('0x53')},'body':{'from':_0x260525[_0xf4aa('0x1b')],'to':_0x4ae625[_0xf4aa('0x1b')],'text':_0x4ae625[_0xf4aa('0x2a')]},'json':!![]};return rp(_0x3e7133)[_0xf4aa('0x14')](function(_0x599f82){if(_0x599f82[_0xf4aa('0x6b')]==0xca){_0x4b9f6f[_0xf4aa('0x6c')]=_0x599f82;var _0x2d093b={'method':'POST','uri':_0xf4aa('0x6d'),'headers':{'Authorization':'Bearer\x20'+_0x260525[_0xf4aa('0x57')],'Content-Type':_0xf4aa('0x53')},'body':{'refid':_0x4b9f6f[_0xf4aa('0x6c')]['refid']},'json':!![]};return rp(_0x2d093b)[_0xf4aa('0x14')](function(_0xd1dbdc){_0x4b9f6f[_0xf4aa('0x6e')]=_0xd1dbdc;var _0x2c7e00={'messageId':_0x4b9f6f[_0xf4aa('0x6c')][_0xf4aa('0x6f')],'read':!![]};return _0x1061c0[_0xf4aa('0x15')](_0x2c7e00);});}else{return logger['error'](_0xf4aa('0x23'),_0xf4aa('0x24'),_0xf4aa('0x70'),util[_0xf4aa('0x26')](_0x599f82,{'showHidden':![],'depth':null}));}})['catch'](function(_0x25115d){return logger['error'](_0xf4aa('0x23'),_0xf4aa('0x24'),_0xf4aa('0x70'),util[_0xf4aa('0x26')](_0x25115d,{'showHidden':![],'depth':null}));});}else{return logger[_0xf4aa('0x22')](_0xf4aa('0x23'),_0xf4aa('0x24'),_0xf4aa('0x70'),_0xf4aa('0x71'));}break;}}})[_0xf4aa('0x72')](function(){_0x3a926f();});}else{_0x3a926f();}}},'charset':_0xf4aa('0x73'),'collate':_0xf4aa('0x74')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index eb55179..4f02d69 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 _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 +var _0x1a85=['info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','options','raw','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','socket.io-emitter','register','request','then'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x1a85,0x178));var _0x51a8=function(_0x23c791,_0xa8bee3){_0x23c791=_0x23c791-0x0;var _0x57b777=_0x1a85[_0x23c791];return _0x57b777;};'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});config['redis']=_[_0x51a8('0x8')](config[_0x51a8('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x51a8('0xa'))(new Redis(config['redis']));require('./smsMessage.socket')[_0x51a8('0xb')](socket);function respondWithRpcPromise(_0x2f276b,_0x1a476d,_0x45a3f4){return new BPromise(function(_0x418f06,_0x421fa4){return client[_0x51a8('0xc')](_0x2f276b,_0x45a3f4)[_0x51a8('0xd')](function(_0x34c887){logger[_0x51a8('0xe')](_0x51a8('0xf'),_0x1a476d,_0x51a8('0x10'));logger[_0x51a8('0x11')](_0x51a8('0x12'),_0x1a476d,_0x51a8('0x10'),JSON[_0x51a8('0x13')](_0x34c887));if(_0x34c887[_0x51a8('0x14')]){if(_0x34c887['error'][_0x51a8('0x15')]===0x1f4){logger[_0x51a8('0x14')](_0x51a8('0xf'),_0x1a476d,_0x34c887['error'][_0x51a8('0x16')]);return _0x421fa4(_0x34c887['error'][_0x51a8('0x16')]);}logger[_0x51a8('0x14')](_0x51a8('0xf'),_0x1a476d,_0x34c887[_0x51a8('0x14')][_0x51a8('0x16')]);return _0x418f06(_0x34c887[_0x51a8('0x14')][_0x51a8('0x16')]);}else{logger['info'](_0x51a8('0xf'),_0x1a476d,_0x51a8('0x10'));_0x418f06(_0x34c887[_0x51a8('0x17')][_0x51a8('0x16')]);}})[_0x51a8('0x18')](function(_0x544886){logger['error'](_0x51a8('0xf'),_0x1a476d,_0x544886);_0x421fa4(_0x544886);});});}exports[_0x51a8('0x19')]=function(_0x2217ce){var _0x2f2681=this;return new Promise(function(_0x2a4c4c,_0x3bc044){return db[_0x51a8('0x1a')][_0x51a8('0x1b')](_0x2217ce['body'],{'raw':_0x2217ce[_0x51a8('0x1c')]?_0x2217ce['options'][_0x51a8('0x1d')]===undefined?!![]:![]:!![]})[_0x51a8('0xd')](function(_0x8bda40){logger[_0x51a8('0xe')]('CreateSmsMessage',_0x2217ce);logger[_0x51a8('0x11')]('CreateSmsMessage',_0x2217ce,JSON['stringify'](_0x8bda40));_0x2a4c4c(_0x8bda40);})[_0x51a8('0x18')](function(_0x52e503){logger[_0x51a8('0x14')](_0x51a8('0x19'),_0x52e503[_0x51a8('0x16')],_0x2217ce);_0x3bc044(_0x2f2681[_0x51a8('0x14')](0x1f4,_0x52e503[_0x51a8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index c28c5d3..40a5403 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 _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 +var _0x3895=['register','length','smsMessage:','./smsMessage.events','save','remove','update','removeListener'];(function(_0x49cb71,_0x2f0149){var _0x3a50fd=function(_0x48c304){while(--_0x48c304){_0x49cb71['push'](_0x49cb71['shift']());}};_0x3a50fd(++_0x2f0149);}(_0x3895,0x6b));var _0x5389=function(_0x2e6c41,_0x21b274){_0x2e6c41=_0x2e6c41-0x0;var _0x3f3907=_0x3895[_0x2e6c41];return _0x3f3907;};'use strict';var SmsMessageEvents=require(_0x5389('0x0'));var events=[_0x5389('0x1'),_0x5389('0x2'),_0x5389('0x3')];function createListener(_0x5c62da,_0x233e4e){return function(_0x34fbd0){_0x233e4e['emit'](_0x5c62da,_0x34fbd0);};}function removeListener(_0x486157,_0x14234){return function(){SmsMessageEvents[_0x5389('0x4')](_0x486157,_0x14234);};}exports[_0x5389('0x5')]=function(_0xba3399){for(var _0x3af75d=0x0,_0x2ae650=events[_0x5389('0x6')];_0x3af75d<_0x2ae650;_0x3af75d++){var _0x30f7b1=events[_0x3af75d];var _0x112bf9=createListener(_0x5389('0x7')+_0x30f7b1,_0xba3399);SmsMessageEvents['on'](_0x30f7b1,_0x112bf9);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 923c57b..6da01e0 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 _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 +var _0x7958=['../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','update','delete','removeTeams','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x549278,_0x450754){var _0x1ea9a1=function(_0x2e559d){while(--_0x2e559d){_0x549278['push'](_0x549278['shift']());}};_0x1ea9a1(++_0x450754);}(_0x7958,0x126));var _0x8795=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7958[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x8795('0x0'));var util=require(_0x8795('0x1'));var path=require('path');var timeout=require(_0x8795('0x2'));var express=require(_0x8795('0x3'));var router=express[_0x8795('0x4')]();var auth=require(_0x8795('0x5'));var interaction=require(_0x8795('0x6'));var config=require(_0x8795('0x7'));var controller=require(_0x8795('0x8'));router[_0x8795('0x9')]('/',auth['isAuthenticated'](),controller[_0x8795('0xa')]);router[_0x8795('0x9')](_0x8795('0xb'),auth['isAuthenticated'](),controller[_0x8795('0xc')]);router['get'](_0x8795('0xd'),auth[_0x8795('0xe')](),controller[_0x8795('0xf')]);router[_0x8795('0x9')](_0x8795('0x10'),auth[_0x8795('0xe')](),controller[_0x8795('0x11')]);router[_0x8795('0x9')](_0x8795('0x12'),auth[_0x8795('0xe')](),controller[_0x8795('0x13')]);router[_0x8795('0x9')](_0x8795('0x14'),auth['isAuthenticated'](),controller[_0x8795('0x15')]);router[_0x8795('0x16')]('/',auth[_0x8795('0xe')](),controller[_0x8795('0x17')]);router[_0x8795('0x16')](_0x8795('0x12'),auth[_0x8795('0xe')](),controller['addTeams']);router['post']('/:id/users',auth[_0x8795('0xe')](),controller[_0x8795('0x18')]);router[_0x8795('0x19')](_0x8795('0xd'),auth[_0x8795('0xe')](),controller[_0x8795('0x1a')]);router[_0x8795('0x1b')]('/:id',auth[_0x8795('0xe')](),controller['destroy']);router[_0x8795('0x1b')](_0x8795('0x12'),auth[_0x8795('0xe')](),controller[_0x8795('0x1c')]);router[_0x8795('0x1b')](_0x8795('0x14'),auth[_0x8795('0xe')](),controller['removeAgents']);module[_0x8795('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index c135cd0..e466cd6 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 _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 +var _0x61db=['name','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x3b502e,_0x2b9361){var _0x3ef3d6=function(_0x46c1ce){while(--_0x46c1ce){_0x3b502e['push'](_0x3b502e['shift']());}};_0x3ef3d6(++_0x2b9361);}(_0x61db,0xdd));var _0xb61d=function(_0x13192c,_0x52cf73){_0x13192c=_0x13192c-0x0;var _0x4b32fe=_0x61db[_0x13192c];return _0x4b32fe;};'use strict';var Sequelize=require(_0xb61d('0x0'));module[_0xb61d('0x1')]={'name':{'type':Sequelize[_0xb61d('0x2')],'unique':_0xb61d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb61d('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb61d('0x4')](_0xb61d('0x5'),_0xb61d('0x6'),_0xb61d('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 4529034..bf75d2c 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 _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 +var _0x2365=['every','TeamId','all','union','compact','value','transaction','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','isArray','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','destroy','then','UserProfileResource','end','error','stack','name','send','index','SmsQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','options','count','includeAll','include','rows','catch','show','params','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','UserSmsQueue','hasOwnProperty','pick','SmsQueueId','map','User','findAndCountAll','UserId','agent','smsPause','updatedAt','%s/%s','SIP','getTeams','findOne','Team','addTeams','ids','online','voicePause','interface','flatMap','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','Agents','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','SELECT'];(function(_0x3b2244,_0x54873f){var _0x2dcc14=function(_0x53d73f){while(--_0x53d73f){_0x3b2244['push'](_0x3b2244['shift']());}};_0x2dcc14(++_0x54873f);}(_0x2365,0x12c));var _0x5236=function(_0x2774d0,_0x3a67c8){_0x2774d0=_0x2774d0-0x0;var _0x12f981=_0x2365[_0x2774d0];return _0x12f981;};'use strict';var pdf=require(_0x5236('0x0'));var emlformat=require(_0x5236('0x1'));var rimraf=require(_0x5236('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5236('0x3'));var rp=require('request-promise');var moment=require(_0x5236('0x4'));var BPromise=require(_0x5236('0x5'));var Mustache=require('mustache');var util=require(_0x5236('0x6'));var path=require(_0x5236('0x7'));var sox=require(_0x5236('0x8'));var csv=require(_0x5236('0x9'));var ejs=require(_0x5236('0xa'));var fs=require('fs');var _=require(_0x5236('0xb'));var squel=require(_0x5236('0xc'));var crypto=require(_0x5236('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5236('0xe'));var toCsv=require(_0x5236('0x9'));var querystring=require(_0x5236('0xf'));var Papa=require(_0x5236('0x10'));var Redis=require(_0x5236('0x11'));var authService=require(_0x5236('0x12'));var qs=require(_0x5236('0x13'));var as=require(_0x5236('0x14'));var hardwareService=require(_0x5236('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x5236('0x16'))['db'];config[_0x5236('0x17')]=_[_0x5236('0x18')](config[_0x5236('0x17')],{'host':_0x5236('0x19'),'port':0x18eb});var socket=require(_0x5236('0x1a'))(new Redis(config['redis']));require(_0x5236('0x1b'))['register'](socket);function respondWithStatusCode(_0x247d2f,_0xd086c){_0xd086c=_0xd086c||0xcc;return function(_0x2b292d){if(_0x2b292d){return _0x247d2f[_0x5236('0x1c')](_0xd086c);}return _0x247d2f[_0x5236('0x1d')](_0xd086c)['end']();};}function respondWithResult(_0x3f5e7e,_0x34e928){_0x34e928=_0x34e928||0xc8;return function(_0x573ba0){if(_0x573ba0){return _0x3f5e7e[_0x5236('0x1d')](_0x34e928)['json'](_0x573ba0);}};}function respondWithFilteredResult(_0x290fa9,_0x476193){return function(_0x14a949){if(_0x14a949){var _0x1b86d7=_0x14a949['count'],_0x1236d3=_0x476193[_0x5236('0x1e')],_0x4bead1=_0x476193['offset']+_0x476193[_0x5236('0x1f')],_0xaffe33;if(_0x4bead1>=_0x1b86d7){_0x4bead1=_0x1b86d7;_0xaffe33=0xc8;}else{_0xaffe33=0xce;}_0x290fa9[_0x5236('0x1d')](_0xaffe33);return _0x290fa9[_0x5236('0x20')](_0x5236('0x21'),_0x1236d3+'-'+_0x4bead1+'/'+_0x1b86d7)[_0x5236('0x22')](_0x14a949);}return null;};}function patchUpdates(_0x8af02f){return function(_0x53579e){try{jsonpatch[_0x5236('0x23')](_0x53579e,_0x8af02f,!![]);}catch(_0x4ea5f3){return BPromise[_0x5236('0x24')](_0x4ea5f3);}return _0x53579e[_0x5236('0x25')]();};}function saveUpdates(_0x1a58dd,_0x2d1502){return function(_0x22e525){if(_0x22e525){return _0x22e525['update'](_0x1a58dd)['then'](function(_0x2c5bf8){return _0x2c5bf8;});}return null;};}function removeEntity(_0x2282bb,_0x3c65d5){return function(_0x514ed5){if(_0x514ed5){return _0x514ed5[_0x5236('0x26')]()[_0x5236('0x27')](function(){var _0x2cc658=_0x514ed5['get']({'plain':!![]});var _0x49dca5='SmsQueues';return db[_0x5236('0x28')][_0x5236('0x26')]({'where':{'type':_0x49dca5,'resourceId':_0x2cc658['id']}})[_0x5236('0x27')](function(){return _0x514ed5;});})[_0x5236('0x27')](function(){_0x2282bb[_0x5236('0x1d')](0xcc)[_0x5236('0x29')]();});}};}function handleEntityNotFound(_0x129725,_0x4bc3b9){return function(_0x309291){if(!_0x309291){_0x129725['sendStatus'](0x194);}return _0x309291;};}function handleError(_0x30e86f,_0x591c41){_0x591c41=_0x591c41||0x1f4;return function(_0x16a93f){logger[_0x5236('0x2a')](_0x16a93f[_0x5236('0x2b')]);if(_0x16a93f[_0x5236('0x2c')]){delete _0x16a93f[_0x5236('0x2c')];}_0x30e86f[_0x5236('0x1d')](_0x591c41)[_0x5236('0x2d')](_0x16a93f);};}exports[_0x5236('0x2e')]=function(_0x38de0b,_0x7c2358){var _0x3b3792={},_0xdd4e96={},_0x4015f0={'count':0x0,'rows':[]};var _0x290db0=_['map'](db[_0x5236('0x2f')][_0x5236('0x30')],function(_0x238508){return{'name':_0x238508[_0x5236('0x31')],'type':_0x238508[_0x5236('0x32')][_0x5236('0x33')]};});_0xdd4e96[_0x5236('0x34')]=_['map'](_0x290db0,'name');_0xdd4e96[_0x5236('0x35')]=_['keys'](_0x38de0b[_0x5236('0x35')]);_0xdd4e96[_0x5236('0x36')]=_[_0x5236('0x37')](_0xdd4e96[_0x5236('0x34')],_0xdd4e96[_0x5236('0x35')]);_0x3b3792['attributes']=_[_0x5236('0x37')](_0xdd4e96[_0x5236('0x34')],qs[_0x5236('0x38')](_0x38de0b[_0x5236('0x35')][_0x5236('0x38')]));_0x3b3792[_0x5236('0x39')]=_0x3b3792['attributes'][_0x5236('0x3a')]?_0x3b3792[_0x5236('0x39')]:_0xdd4e96[_0x5236('0x34')];if(!_0x38de0b[_0x5236('0x35')]['hasOwnProperty'](_0x5236('0x3b'))){_0x3b3792['limit']=qs['limit'](_0x38de0b['query'][_0x5236('0x1f')]);_0x3b3792[_0x5236('0x1e')]=qs[_0x5236('0x1e')](_0x38de0b['query'][_0x5236('0x1e')]);}_0x3b3792[_0x5236('0x3c')]=qs[_0x5236('0x3d')](_0x38de0b[_0x5236('0x35')][_0x5236('0x3d')]);_0x3b3792[_0x5236('0x3e')]=qs[_0x5236('0x36')](_['pick'](_0x38de0b[_0x5236('0x35')],_0xdd4e96[_0x5236('0x36')]),_0x290db0);if(_0x38de0b[_0x5236('0x35')][_0x5236('0x3f')]){_0x3b3792['where']=_[_0x5236('0x40')](_0x3b3792[_0x5236('0x3e')],{'$or':_['map'](_0x290db0,function(_0x539c53){if(_0x539c53[_0x5236('0x32')]!=='VIRTUAL'){var _0x49b97f={};_0x49b97f[_0x539c53[_0x5236('0x2c')]]={'$like':'%'+_0x38de0b[_0x5236('0x35')][_0x5236('0x3f')]+'%'};return _0x49b97f;}})});}_0x3b3792=_['merge']({},_0x3b3792,_0x38de0b[_0x5236('0x41')]);var _0x44adc0={'where':_0x3b3792[_0x5236('0x3e')]};return db[_0x5236('0x2f')][_0x5236('0x42')](_0x44adc0)[_0x5236('0x27')](function(_0x345736){_0x4015f0[_0x5236('0x42')]=_0x345736;if(_0x38de0b[_0x5236('0x35')][_0x5236('0x43')]){_0x3b3792[_0x5236('0x44')]=[{'all':!![]}];}return db[_0x5236('0x2f')]['findAll'](_0x3b3792);})['then'](function(_0x12cfcf){_0x4015f0[_0x5236('0x45')]=_0x12cfcf;return _0x4015f0;})[_0x5236('0x27')](respondWithFilteredResult(_0x7c2358,_0x3b3792))[_0x5236('0x46')](handleError(_0x7c2358,null));};exports[_0x5236('0x47')]=function(_0x60dc78,_0x1e180a){var _0x30e317={'raw':!![],'where':{'id':_0x60dc78[_0x5236('0x48')]['id']}},_0x1626e0={};_0x1626e0[_0x5236('0x34')]=_[_0x5236('0x49')](db[_0x5236('0x2f')][_0x5236('0x30')]);_0x1626e0['query']=_[_0x5236('0x49')](_0x60dc78[_0x5236('0x35')]);_0x1626e0['filters']=_['intersection'](_0x1626e0[_0x5236('0x34')],_0x1626e0[_0x5236('0x35')]);_0x30e317[_0x5236('0x39')]=_[_0x5236('0x37')](_0x1626e0['model'],qs['fields'](_0x60dc78[_0x5236('0x35')][_0x5236('0x38')]));_0x30e317[_0x5236('0x39')]=_0x30e317[_0x5236('0x39')]['length']?_0x30e317[_0x5236('0x39')]:_0x1626e0[_0x5236('0x34')];if(_0x60dc78[_0x5236('0x35')]['includeAll']){_0x30e317[_0x5236('0x44')]=[{'all':!![]}];}_0x30e317=_[_0x5236('0x40')]({},_0x30e317,_0x60dc78[_0x5236('0x41')]);return db[_0x5236('0x2f')][_0x5236('0x4a')](_0x30e317)[_0x5236('0x27')](handleEntityNotFound(_0x1e180a,null))['then'](respondWithResult(_0x1e180a,null))[_0x5236('0x46')](handleError(_0x1e180a,null));};exports[_0x5236('0x4b')]=function(_0xad436,_0x4852ba){return db['SmsQueue']['create'](_0xad436['body'],{})[_0x5236('0x27')](function(_0x4c085a){var _0x4ad4e4=_0xad436[_0x5236('0x4c')][_0x5236('0x4d')]({'plain':!![]});if(!_0x4ad4e4)throw new Error(_0x5236('0x4e'));if(_0x4ad4e4[_0x5236('0x4f')]===_0x5236('0x4c')){var _0x1a1233=_0x4c085a[_0x5236('0x4d')]({'plain':!![]});var _0x546c11=_0x5236('0x50');return db[_0x5236('0x51')][_0x5236('0x4a')]({'where':{'name':_0x546c11,'userProfileId':_0x4ad4e4[_0x5236('0x52')]},'raw':!![]})[_0x5236('0x27')](function(_0x3a6e2a){if(_0x3a6e2a&&_0x3a6e2a[_0x5236('0x53')]===0x0){return db['UserProfileResource'][_0x5236('0x4b')]({'name':_0x1a1233[_0x5236('0x2c')],'resourceId':_0x1a1233['id'],'type':_0x3a6e2a[_0x5236('0x2c')],'sectionId':_0x3a6e2a['id']},{})[_0x5236('0x27')](function(){return _0x4c085a;});}else{return _0x4c085a;}})[_0x5236('0x46')](function(_0x3482b6){logger['error'](_0x5236('0x54'),_0x3482b6);throw _0x3482b6;});}return _0x4c085a;})[_0x5236('0x27')](respondWithResult(_0x4852ba,0xc9))[_0x5236('0x46')](handleError(_0x4852ba,null));};exports[_0x5236('0x55')]=function(_0x5976a6,_0x13ab88){if(_0x5976a6[_0x5236('0x56')]['id']){delete _0x5976a6[_0x5236('0x56')]['id'];}return db['SmsQueue'][_0x5236('0x4a')]({'where':{'id':_0x5976a6[_0x5236('0x48')]['id']}})[_0x5236('0x27')](handleEntityNotFound(_0x13ab88,null))[_0x5236('0x27')](saveUpdates(_0x5976a6[_0x5236('0x56')],null))[_0x5236('0x27')](respondWithResult(_0x13ab88,null))[_0x5236('0x46')](handleError(_0x13ab88,null));};exports[_0x5236('0x26')]=function(_0xb25167,_0x578951){return db['SmsQueue'][_0x5236('0x4a')]({'where':{'id':_0xb25167[_0x5236('0x48')]['id']}})[_0x5236('0x27')](handleEntityNotFound(_0x578951,null))[_0x5236('0x27')](removeEntity(_0x578951,null))[_0x5236('0x46')](handleError(_0x578951,null));};exports[_0x5236('0x57')]=function(_0x12637d,_0x3e5329){return db[_0x5236('0x2f')][_0x5236('0x57')]()[_0x5236('0x27')](respondWithResult(_0x3e5329,null))[_0x5236('0x46')](handleError(_0x3e5329,null));};exports[_0x5236('0x58')]=function(_0x24c399,_0x1afeef,_0x2400dd){var _0x1e4f0b={'raw':!![],'where':{}},_0x4fb449={},_0x2821c6;return db[_0x5236('0x2f')]['findOne']({'where':{'id':_0x24c399[_0x5236('0x48')]['id']}})[_0x5236('0x27')](handleEntityNotFound(_0x1afeef,null))[_0x5236('0x27')](function(_0x3fb7e8){if(_0x3fb7e8){_0x2821c6=_0x3fb7e8[_0x5236('0x4d')]({'plain':!![]});_0x4fb449[_0x5236('0x34')]=_['keys'](db[_0x5236('0x59')][_0x5236('0x30')]);_0x4fb449[_0x5236('0x35')]=_['keys'](_0x24c399[_0x5236('0x35')]);_0x4fb449[_0x5236('0x36')]=_[_0x5236('0x37')](_0x4fb449['model'],_0x4fb449[_0x5236('0x35')]);_0x1e4f0b[_0x5236('0x39')]=_[_0x5236('0x37')](_0x4fb449['model'],qs[_0x5236('0x38')](_0x24c399[_0x5236('0x35')][_0x5236('0x38')]));_0x1e4f0b['attributes']=_0x1e4f0b[_0x5236('0x39')][_0x5236('0x3a')]?_0x1e4f0b[_0x5236('0x39')]:_0x4fb449[_0x5236('0x34')];if(!_0x24c399['query'][_0x5236('0x5a')](_0x5236('0x3b'))){_0x1e4f0b[_0x5236('0x1f')]=qs['limit'](_0x24c399[_0x5236('0x35')][_0x5236('0x1f')]);_0x1e4f0b[_0x5236('0x1e')]=qs[_0x5236('0x1e')](_0x24c399[_0x5236('0x35')][_0x5236('0x1e')]);}_0x1e4f0b['order']=qs['sort'](_0x24c399['query'][_0x5236('0x3d')]);_0x1e4f0b[_0x5236('0x3e')]=qs[_0x5236('0x36')](_[_0x5236('0x5b')](_0x24c399[_0x5236('0x35')],_0x4fb449[_0x5236('0x36')]));_0x1e4f0b['where'][_0x5236('0x5c')]=_0x3fb7e8['id'];if(_0x24c399[_0x5236('0x35')][_0x5236('0x3f')]){_0x1e4f0b[_0x5236('0x3e')]=_[_0x5236('0x40')](_0x1e4f0b[_0x5236('0x3e')],{'$or':_[_0x5236('0x5d')](_0x1e4f0b[_0x5236('0x39')],function(_0x51c8a2){var _0x2698a6={};_0x2698a6[_0x51c8a2]={'$like':'%'+_0x24c399[_0x5236('0x35')]['filter']+'%'};return _0x2698a6;})});}_0x1e4f0b=_['merge']({},_0x1e4f0b,_0x24c399['options']);return db['UserSmsQueue']['findAll'](_0x1e4f0b);}})[_0x5236('0x27')](function(_0x54de27){if(_0x54de27){return db[_0x5236('0x5e')][_0x5236('0x5f')]({'where':{'id':_['map'](_0x54de27,_0x5236('0x60')),'role':_0x5236('0x61')},'attributes':['id',_0x5236('0x2c'),_0x5236('0x62'),_0x5236('0x63'),'createdAt']});}})[_0x5236('0x27')](function(_0x1af18e){if(_0x1af18e){return{'count':_0x1af18e[_0x5236('0x42')],'rows':_[_0x5236('0x5d')](_0x1af18e['rows'],function(_0x2656ed){return{'membername':_0x2656ed[_0x5236('0x2c')],'UserId':_0x2656ed['id'],'queue_name':_0x2821c6[_0x5236('0x2c')],'SmsQueueId':_0x2821c6['id'],'interface':util['format'](_0x5236('0x64'),_0x5236('0x65'),_0x2656ed[_0x5236('0x2c')]),'penalty':0x0,'paused':_0x2656ed[_0x5236('0x62')],'createdAt':_0x2656ed['createdAt'],'updatedAt':_0x2656ed[_0x5236('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5236('0x27')](respondWithFilteredResult(_0x1afeef,_0x1e4f0b))['catch'](handleError(_0x1afeef,null));};exports[_0x5236('0x66')]=function(_0xba5beb,_0x49ea33,_0x2c0362){var _0x8bc85b={};var _0x3f044d={};var _0x406ca5;var _0x536fd5;return db[_0x5236('0x2f')][_0x5236('0x67')]({'where':{'id':_0xba5beb[_0x5236('0x48')]['id']}})[_0x5236('0x27')](handleEntityNotFound(_0x49ea33,null))[_0x5236('0x27')](function(_0x4ed8c0){if(_0x4ed8c0){_0x406ca5=_0x4ed8c0;_0x3f044d['model']=_[_0x5236('0x49')](db[_0x5236('0x68')][_0x5236('0x30')]);_0x3f044d[_0x5236('0x35')]=_[_0x5236('0x49')](_0xba5beb[_0x5236('0x35')]);_0x3f044d[_0x5236('0x36')]=_[_0x5236('0x37')](_0x3f044d[_0x5236('0x34')],_0x3f044d[_0x5236('0x35')]);_0x8bc85b[_0x5236('0x39')]=_[_0x5236('0x37')](_0x3f044d[_0x5236('0x34')],qs[_0x5236('0x38')](_0xba5beb[_0x5236('0x35')][_0x5236('0x38')]));_0x8bc85b[_0x5236('0x39')]=_0x8bc85b['attributes'][_0x5236('0x3a')]?_0x8bc85b[_0x5236('0x39')]:_0x3f044d[_0x5236('0x34')];_0x8bc85b['order']=qs[_0x5236('0x3d')](_0xba5beb[_0x5236('0x35')][_0x5236('0x3d')]);_0x8bc85b[_0x5236('0x3e')]=qs[_0x5236('0x36')](_[_0x5236('0x5b')](_0xba5beb[_0x5236('0x35')],_0x3f044d[_0x5236('0x36')]));if(_0xba5beb['query'][_0x5236('0x3f')]){_0x8bc85b[_0x5236('0x3e')]=_[_0x5236('0x40')](_0x8bc85b['where'],{'$or':_[_0x5236('0x5d')](_0x8bc85b['attributes'],function(_0x47cf0e){var _0x724cca={};_0x724cca[_0x47cf0e]={'$like':'%'+_0xba5beb[_0x5236('0x35')][_0x5236('0x3f')]+'%'};return _0x724cca;})});}_0x8bc85b=_[_0x5236('0x40')]({},_0x8bc85b,_0xba5beb['options']);return _0x406ca5[_0x5236('0x66')](_0x8bc85b);}})[_0x5236('0x27')](function(_0x174242){if(_0x174242){_0x536fd5=_0x174242[_0x5236('0x3a')];if(!_0xba5beb[_0x5236('0x35')][_0x5236('0x5a')](_0x5236('0x3b'))){_0x8bc85b['limit']=qs[_0x5236('0x1f')](_0xba5beb[_0x5236('0x35')]['limit']);_0x8bc85b['offset']=qs['offset'](_0xba5beb[_0x5236('0x35')][_0x5236('0x1e')]);}return _0x406ca5[_0x5236('0x66')](_0x8bc85b);}})[_0x5236('0x27')](function(_0x3b4a64){if(_0x3b4a64){return _0x3b4a64?{'count':_0x536fd5,'rows':_0x3b4a64}:null;}})[_0x5236('0x27')](respondWithResult(_0x49ea33,null))[_0x5236('0x46')](handleError(_0x49ea33,null));};exports[_0x5236('0x69')]=function(_0x3a5ac0,_0x2e7687,_0x4b370f){var _0x1472cd=_0x3a5ac0[_0x5236('0x56')][_0x5236('0x6a')];return db[_0x5236('0x68')]['findAll']({'where':{'id':_0x1472cd},'attributes':['id'],'include':[{'model':db[_0x5236('0x5e')],'as':'Agents','attributes':['id','name',_0x5236('0x6b'),_0x5236('0x6c'),_0x5236('0x6d')],'raw':!![]}]})['then'](function(_0x1c8198){if(_0x1c8198){var _0x5de43e=_[_0x5236('0x6e')](_0x1c8198,function(_0x5ce1f0){var _0x55e53b=_0x5ce1f0['get']({'plain':!![]});return _0x55e53b['Agents'];});return db['SmsQueue'][_0x5236('0x4a')]({'where':{'id':_0x3a5ac0[_0x5236('0x48')]['id']}})['then'](function(_0x195922){return db['sequelize']['transaction'](function(_0x573917){return _0x195922['addTeams'](_0x1472cd,{'transaction':_0x573917})[_0x5236('0x27')](function(){return BPromise[_0x5236('0x6f')](_0x5de43e,function(_0x559cee){return db[_0x5236('0x59')][_0x5236('0x70')]({'where':{'UserId':_0x559cee['id'],'SmsQueueId':_0x3a5ac0[_0x5236('0x48')]['id']},'transaction':_0x573917});});})[_0x5236('0x27')](function(){_0x5de43e[_0x5236('0x71')](function(_0x46748e){socket[_0x5236('0x72')](_0x5236('0x73'),{'UserId':_0x46748e['id'],'SmsQueueId':_0x195922['id']});});});});});}})['then'](respondWithStatusCode(_0x2e7687,null))[_0x5236('0x46')](handleError(_0x2e7687,null));};exports[_0x5236('0x74')]=function(_0x5eac79,_0x2c9c8b,_0x294528){return db[_0x5236('0x68')]['findAll']({'where':{'id':_0x5eac79[_0x5236('0x35')][_0x5236('0x6a')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5236('0x75'),'attributes':['id'],'raw':!![]}]})[_0x5236('0x27')](handleEntityNotFound(_0x2c9c8b,null))['then'](function(_0x35b981){var _0x20ad15=_[_0x5236('0x5d')](_0x35b981,'id');var _0x2a387b=[];var _0x399320=[];var _0x170e16=squel[_0x5236('0x76')]();_0x170e16['field'](_0x5236('0x77'))[_0x5236('0x78')]('team_has_sms_queues','tq')[_0x5236('0x79')](_0x5236('0x7a'),'ut',_0x5236('0x7b'))[_0x5236('0x3e')](_0x5236('0x7c'),_0x5eac79[_0x5236('0x48')]['id']);for(var _0x1f6fa9=0x0;_0x1f6fa9<_0x35b981[_0x5236('0x3a')];_0x1f6fa9+=0x1){let _0x29a77f=_0x35b981[_0x1f6fa9];for(var _0x2bcbad=0x0;_0x2bcbad<_0x29a77f[_0x5236('0x75')][_0x5236('0x3a')];_0x2bcbad+=0x1){let _0x41a5ce=_0x29a77f[_0x5236('0x75')][_0x2bcbad];var _0x3d436b=_0x170e16['clone']();_0x3d436b['where'](_0x5236('0x7d'),_0x41a5ce['id']);_0x399320[_0x5236('0x7e')](db['sequelize'][_0x5236('0x35')](_0x3d436b['toString'](),{'type':db[_0x5236('0x7f')]['QueryTypes'][_0x5236('0x80')]})[_0x5236('0x27')](function(_0x229f36){if(_0x229f36[_0x5236('0x3a')]===0x1){return _0x41a5ce['id'];}else{var _0x4e0e4f=_[_0x5236('0x81')](_['map'](_0x229f36,_0x5236('0x82')),function(_0x4d735b){return _['includes'](_0x20ad15,_0x4d735b);});if(_0x4e0e4f){return _0x41a5ce['id'];}}}));}}return BPromise[_0x5236('0x83')](_0x399320)[_0x5236('0x27')](function(_0x2f93ca){_0x2a387b=_(_0x2a387b)[_0x5236('0x84')](_0x2f93ca)[_0x5236('0x85')]()[_0x5236('0x86')]();return db[_0x5236('0x2f')][_0x5236('0x4a')]({'where':{'id':_0x5eac79[_0x5236('0x48')]['id']}})['then'](function(_0x552b08){return db[_0x5236('0x7f')][_0x5236('0x87')](function(_0x47a222){return _0x552b08[_0x5236('0x74')](_0x5eac79[_0x5236('0x35')]['ids'],{'transaction':_0x47a222})[_0x5236('0x27')](function(){if(!_[_0x5236('0x88')](_0x2a387b)){return _0x552b08[_0x5236('0x89')](_0x2a387b,{'transaction':_0x47a222});}})[_0x5236('0x27')](function(){_0x2a387b[_0x5236('0x71')](function(_0x1d0d56){socket[_0x5236('0x72')](_0x5236('0x8a'),{'UserId':_0x1d0d56,'SmsQueueId':_0x552b08['id']});});});});});});})[_0x5236('0x27')](respondWithStatusCode(_0x2c9c8b,null))['catch'](handleError(_0x2c9c8b,null));};exports[_0x5236('0x8b')]=function(_0x4ff356,_0x248697,_0x37feab){return db[_0x5236('0x2f')][_0x5236('0x4a')]({'where':{'id':_0x4ff356[_0x5236('0x48')]['id']}})[_0x5236('0x27')](handleEntityNotFound(_0x248697,null))['then'](function(_0x51fd5a){if(_0x51fd5a){return _0x51fd5a['addAgents'](_0x4ff356[_0x5236('0x56')][_0x5236('0x6a')],_[_0x5236('0x8c')](_0x4ff356[_0x5236('0x56')],['ids','id'])||{})['spread'](function(_0x149133){for(var _0x33b948=0x0;_0x33b948<_0x4ff356['body'][_0x5236('0x6a')]['length'];_0x33b948+=0x1){socket[_0x5236('0x72')](_0x5236('0x73'),{'UserId':_0x4ff356[_0x5236('0x56')][_0x5236('0x6a')][_0x33b948],'SmsQueueId':_0x4ff356[_0x5236('0x48')]['id']});}return _0x149133;});}})[_0x5236('0x27')](respondWithResult(_0x248697,null))[_0x5236('0x46')](handleError(_0x248697,null));};exports['removeAgents']=function(_0x5e0a6b,_0xcb108,_0x4194e6){return db[_0x5236('0x2f')]['find']({'where':{'id':_0x5e0a6b[_0x5236('0x48')]['id']}})[_0x5236('0x27')](handleEntityNotFound(_0xcb108,null))['then'](function(_0x464309){if(_0x464309){return _0x464309['removeAgents'](_0x5e0a6b[_0x5236('0x35')][_0x5236('0x6a')])['then'](function(){if(_[_0x5236('0x8d')](_0x5e0a6b[_0x5236('0x35')][_0x5236('0x6a')])){for(var _0x21cb4a=0x0;_0x21cb4a<_0x5e0a6b[_0x5236('0x35')]['ids'][_0x5236('0x3a')];_0x21cb4a+=0x1){socket[_0x5236('0x72')](_0x5236('0x8a'),{'UserId':Number(_0x5e0a6b[_0x5236('0x35')][_0x5236('0x6a')][_0x21cb4a]),'SmsQueueId':Number(_0x5e0a6b[_0x5236('0x48')]['id'])});}}else{socket[_0x5236('0x72')](_0x5236('0x8a'),{'UserId':Number(_0x5e0a6b[_0x5236('0x35')][_0x5236('0x6a')]),'SmsQueueId':Number(_0x5e0a6b['params']['id'])});}});}})['then'](respondWithStatusCode(_0xcb108,null))[_0x5236('0x46')](handleError(_0xcb108,null));};exports[_0x5236('0x8e')]=function(_0x13638e,_0x33fdd4,_0x435808){var _0x249979={};var _0x19e8a5={};var _0x52c2c0;var _0x1fbe36;return db[_0x5236('0x2f')]['findOne']({'where':{'id':_0x13638e[_0x5236('0x48')]['id']}})[_0x5236('0x27')](handleEntityNotFound(_0x33fdd4,null))[_0x5236('0x27')](function(_0x33ce74){if(_0x33ce74){_0x52c2c0=_0x33ce74;_0x19e8a5[_0x5236('0x34')]=_['keys'](db[_0x5236('0x5e')]['rawAttributes']);_0x19e8a5[_0x5236('0x35')]=_[_0x5236('0x49')](_0x13638e[_0x5236('0x35')]);_0x19e8a5['filters']=_[_0x5236('0x37')](_0x19e8a5[_0x5236('0x34')],_0x19e8a5[_0x5236('0x35')]);_0x249979['attributes']=_['intersection'](_0x19e8a5[_0x5236('0x34')],qs[_0x5236('0x38')](_0x13638e[_0x5236('0x35')][_0x5236('0x38')]));_0x249979[_0x5236('0x39')]=_0x249979[_0x5236('0x39')]['length']?_0x249979[_0x5236('0x39')]:_0x19e8a5['model'];_0x249979['order']=qs[_0x5236('0x3d')](_0x13638e[_0x5236('0x35')][_0x5236('0x3d')]);_0x249979[_0x5236('0x3e')]=qs[_0x5236('0x36')](_[_0x5236('0x5b')](_0x13638e[_0x5236('0x35')],_0x19e8a5[_0x5236('0x36')]));if(_0x13638e[_0x5236('0x35')]['filter']){_0x249979[_0x5236('0x3e')]=_[_0x5236('0x40')](_0x249979[_0x5236('0x3e')],{'$or':_[_0x5236('0x5d')](_0x249979[_0x5236('0x39')],function(_0x2aca8e){var _0x1cec4b={};_0x1cec4b[_0x2aca8e]={'$like':'%'+_0x13638e[_0x5236('0x35')][_0x5236('0x3f')]+'%'};return _0x1cec4b;})});}_0x249979=_[_0x5236('0x40')]({},_0x249979,_0x13638e[_0x5236('0x41')]);return _0x52c2c0['getAgents'](_0x249979);}})[_0x5236('0x27')](function(_0x315239){if(_0x315239){_0x1fbe36=_0x315239[_0x5236('0x3a')];if(!_0x13638e[_0x5236('0x35')][_0x5236('0x5a')](_0x5236('0x3b'))){_0x249979[_0x5236('0x1f')]=qs[_0x5236('0x1f')](_0x13638e[_0x5236('0x35')]['limit']);_0x249979[_0x5236('0x1e')]=qs[_0x5236('0x1e')](_0x13638e[_0x5236('0x35')][_0x5236('0x1e')]);}return _0x52c2c0[_0x5236('0x8e')](_0x249979);}})[_0x5236('0x27')](function(_0x11faa9){if(_0x11faa9){return _0x11faa9?{'count':_0x1fbe36,'rows':_0x11faa9}:null;}})[_0x5236('0x27')](respondWithResult(_0x33fdd4,null))['catch'](handleError(_0x33fdd4,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index a8f6a86..8a869e8 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 _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 +var _0x3403=['SmsQueue','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x3410fe,_0x48f9de){var _0x277fd2=function(_0x70231b){while(--_0x70231b){_0x3410fe['push'](_0x3410fe['shift']());}};_0x277fd2(++_0x48f9de);}(_0x3403,0x1b7));var _0x3340=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x3403[_0x36ed48];return _0x51c63a;};'use strict';var EventEmitter=require(_0x3340('0x0'));var SmsQueue=require(_0x3340('0x1'))['db'][_0x3340('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x3340('0x3')](0x0);var events={'afterCreate':_0x3340('0x4'),'afterUpdate':'update','afterDestroy':_0x3340('0x5')};function emitEvent(_0x4a9304){return function(_0x29c9db,_0xebee87,_0x584394){SmsQueueEvents[_0x3340('0x6')](_0x4a9304+':'+_0x29c9db['id'],_0x29c9db);SmsQueueEvents['emit'](_0x4a9304,_0x29c9db);_0x584394(null);};}for(var e in events){if(events[_0x3340('0x7')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x3340('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 153ac93..b94f1dd 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 _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 +var _0xdf3b=['moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','util','api'];(function(_0x5de482,_0x1134d8){var _0x105db9=function(_0x5e5095){while(--_0x5e5095){_0x5de482['push'](_0x5de482['shift']());}};_0x105db9(++_0x1134d8);}(_0xdf3b,0x172));var _0xbdf3=function(_0x131acf,_0x4b4597){_0x131acf=_0x131acf-0x0;var _0x40d32e=_0xdf3b[_0x131acf];return _0x40d32e;};'use strict';var _=require('lodash');var util=require(_0xbdf3('0x0'));var logger=require('../../config/logger')(_0xbdf3('0x1'));var moment=require(_0xbdf3('0x2'));var BPromise=require(_0xbdf3('0x3'));var rp=require(_0xbdf3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbdf3('0x5'));var config=require(_0xbdf3('0x6'));var attributes=require(_0xbdf3('0x7'));module[_0xbdf3('0x8')]=function(_0x46a1fe,_0x36aa91){return _0x46a1fe[_0xbdf3('0x9')](_0xbdf3('0xa'),attributes,{'tableName':_0xbdf3('0xb'),'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 ee94632..4d89669 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 _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 +var _0xb577=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSmsQueue','findAll','options','raw','where','attributes','include','map','model','stringify','ShowSmsQueue','SmsQueue','find','lodash','util','moment','bluebird'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xb577,0x1e8));var _0x7b57=function(_0x4f3e33,_0x5704a8){_0x4f3e33=_0x4f3e33-0x0;var _0x1a070c=_0xb577[_0x4f3e33];return _0x1a070c;};'use strict';var _=require(_0x7b57('0x0'));var util=require(_0x7b57('0x1'));var moment=require(_0x7b57('0x2'));var BPromise=require(_0x7b57('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b57('0x4'));var db=require(_0x7b57('0x5'))['db'];var utils=require(_0x7b57('0x6'));var logger=require(_0x7b57('0x7'))('rpc');var config=require(_0x7b57('0x8'));var jayson=require(_0x7b57('0x9'));var client=jayson[_0x7b57('0xa')][_0x7b57('0xb')]({'port':0x232a});config[_0x7b57('0xc')]=_['defaults'](config[_0x7b57('0xc')],{'host':_0x7b57('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7b57('0xe'))[_0x7b57('0xf')](socket);function respondWithRpcPromise(_0x2db415,_0x49e5c2,_0x11205e){return new BPromise(function(_0x6e22a9,_0x4b97ce){return client[_0x7b57('0x10')](_0x2db415,_0x11205e)[_0x7b57('0x11')](function(_0x36ea0a){logger[_0x7b57('0x12')](_0x7b57('0x13'),_0x49e5c2,_0x7b57('0x14'));logger[_0x7b57('0x15')](_0x7b57('0x16'),_0x49e5c2,_0x7b57('0x14'),JSON['stringify'](_0x36ea0a));if(_0x36ea0a[_0x7b57('0x17')]){if(_0x36ea0a[_0x7b57('0x17')][_0x7b57('0x18')]===0x1f4){logger['error'](_0x7b57('0x13'),_0x49e5c2,_0x36ea0a[_0x7b57('0x17')][_0x7b57('0x19')]);return _0x4b97ce(_0x36ea0a['error']['message']);}logger[_0x7b57('0x17')](_0x7b57('0x13'),_0x49e5c2,_0x36ea0a[_0x7b57('0x17')]['message']);return _0x6e22a9(_0x36ea0a[_0x7b57('0x17')][_0x7b57('0x19')]);}else{logger['info'](_0x7b57('0x13'),_0x49e5c2,_0x7b57('0x14'));_0x6e22a9(_0x36ea0a[_0x7b57('0x1a')]['message']);}})[_0x7b57('0x1b')](function(_0x90c48a){logger[_0x7b57('0x17')](_0x7b57('0x13'),_0x49e5c2,_0x90c48a);_0x4b97ce(_0x90c48a);});});}exports[_0x7b57('0x1c')]=function(_0x4263b4){var _0x4fc450=this;return new Promise(function(_0xc3a258,_0x5d0c5e){return db['SmsQueue'][_0x7b57('0x1d')]({'raw':_0x4263b4['options']?_0x4263b4[_0x7b57('0x1e')][_0x7b57('0x1f')]===undefined?!![]:![]:!![],'where':_0x4263b4[_0x7b57('0x1e')]?_0x4263b4[_0x7b57('0x1e')][_0x7b57('0x20')]||null:null,'attributes':_0x4263b4[_0x7b57('0x1e')]?_0x4263b4['options'][_0x7b57('0x21')]||null:null,'limit':_0x4263b4['options']?_0x4263b4[_0x7b57('0x1e')]['limit']||null:null,'include':_0x4263b4[_0x7b57('0x1e')]?_0x4263b4[_0x7b57('0x1e')][_0x7b57('0x22')]?_[_0x7b57('0x23')](_0x4263b4[_0x7b57('0x1e')][_0x7b57('0x22')],function(_0x476650){return{'model':db[_0x476650[_0x7b57('0x24')]],'as':_0x476650['as'],'attributes':_0x476650[_0x7b57('0x21')],'include':_0x476650[_0x7b57('0x22')]?_['map'](_0x476650[_0x7b57('0x22')],function(_0x457752){return{'model':db[_0x457752['model']],'as':_0x457752['as'],'attributes':_0x457752['attributes'],'include':_0x457752[_0x7b57('0x22')]?_[_0x7b57('0x23')](_0x457752[_0x7b57('0x22')],function(_0x1b9756){return{'model':db[_0x1b9756['model']],'as':_0x1b9756['as'],'attributes':_0x1b9756[_0x7b57('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7b57('0x11')](function(_0x5d48a2){logger[_0x7b57('0x12')](_0x7b57('0x1c'),_0x4263b4);logger[_0x7b57('0x15')]('GetSmsQueue',_0x4263b4,JSON[_0x7b57('0x25')](_0x5d48a2));_0xc3a258(_0x5d48a2);})[_0x7b57('0x1b')](function(_0x2a3f24){logger['error'](_0x7b57('0x1c'),_0x2a3f24[_0x7b57('0x19')],_0x4263b4);_0x5d0c5e(_0x4fc450[_0x7b57('0x17')](0x1f4,_0x2a3f24[_0x7b57('0x19')]));});});};exports[_0x7b57('0x26')]=function(_0x364d1d){var _0x1ec839=this;return new Promise(function(_0x30979c,_0x445379){return db[_0x7b57('0x27')][_0x7b57('0x28')]({'raw':_0x364d1d[_0x7b57('0x1e')]?_0x364d1d['options'][_0x7b57('0x1f')]===undefined?!![]:![]:!![],'where':_0x364d1d[_0x7b57('0x1e')]?_0x364d1d[_0x7b57('0x1e')]['where']||null:null,'attributes':_0x364d1d[_0x7b57('0x1e')]?_0x364d1d[_0x7b57('0x1e')]['attributes']||null:null,'include':_0x364d1d[_0x7b57('0x1e')]?_0x364d1d[_0x7b57('0x1e')]['include']?_[_0x7b57('0x23')](_0x364d1d[_0x7b57('0x1e')][_0x7b57('0x22')],function(_0x1eb2cb){return{'model':db[_0x1eb2cb[_0x7b57('0x24')]],'as':_0x1eb2cb['as'],'attributes':_0x1eb2cb[_0x7b57('0x21')],'include':_0x1eb2cb[_0x7b57('0x22')]?_[_0x7b57('0x23')](_0x1eb2cb['include'],function(_0x1f323f){return{'model':db[_0x1f323f[_0x7b57('0x24')]],'as':_0x1f323f['as'],'attributes':_0x1f323f[_0x7b57('0x21')],'include':_0x1f323f[_0x7b57('0x22')]?_['map'](_0x1f323f['include'],function(_0x3ae852){return{'model':db[_0x3ae852['model']],'as':_0x3ae852['as'],'attributes':_0x3ae852[_0x7b57('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7b57('0x11')](function(_0x2b764d){logger[_0x7b57('0x12')](_0x7b57('0x26'),_0x364d1d);logger[_0x7b57('0x15')]('ShowSmsQueue',_0x364d1d,JSON[_0x7b57('0x25')](_0x2b764d));_0x30979c(_0x2b764d);})[_0x7b57('0x1b')](function(_0x2c8d85){logger['error'](_0x7b57('0x26'),_0x2c8d85[_0x7b57('0x19')],_0x364d1d);_0x445379(_0x1ec839['error'](0x1f4,_0x2c8d85[_0x7b57('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 5a4b117..f34ada3 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 _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 +var _0x57af=['register','length','smsQueue:','./smsQueue.events','save','remove','update','emit','removeListener'];(function(_0x2c2980,_0x34282a){var _0x2a20a9=function(_0x537b18){while(--_0x537b18){_0x2c2980['push'](_0x2c2980['shift']());}};_0x2a20a9(++_0x34282a);}(_0x57af,0x6f));var _0xf57a=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x57af[_0x13d07a];return _0x5ee0ee;};'use strict';var SmsQueueEvents=require(_0xf57a('0x0'));var events=[_0xf57a('0x1'),_0xf57a('0x2'),_0xf57a('0x3')];function createListener(_0x2ee9c1,_0x4bccb4){return function(_0x5d8346){_0x4bccb4[_0xf57a('0x4')](_0x2ee9c1,_0x5d8346);};}function removeListener(_0x5ee378,_0x54187d){return function(){SmsQueueEvents[_0xf57a('0x5')](_0x5ee378,_0x54187d);};}exports[_0xf57a('0x6')]=function(_0xef98fc){for(var _0x377d80=0x0,_0xf37a67=events[_0xf57a('0x7')];_0x377d80<_0xf37a67;_0x377d80++){var _0xd63224=events[_0x377d80];var _0x25ec72=createListener(_0xf57a('0x8')+_0xd63224,_0xef98fc);SmsQueueEvents['on'](_0xd63224,_0x25ec72);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 5d57db6..f70acdf 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 _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 +var _0xf796=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer','path'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xf796,0x7c));var _0x6f79=function(_0x5162b2,_0x1e3779){_0x5162b2=_0x5162b2-0x0;var _0x4c1063=_0xf796[_0x5162b2];return _0x4c1063;};'use strict';var multer=require(_0x6f79('0x0'));var util=require('util');var path=require(_0x6f79('0x1'));var timeout=require('connect-timeout');var express=require(_0x6f79('0x2'));var router=express[_0x6f79('0x3')]();var auth=require(_0x6f79('0x4'));var interaction=require(_0x6f79('0x5'));var config=require(_0x6f79('0x6'));var controller=require(_0x6f79('0x7'));router[_0x6f79('0x8')]('/',auth[_0x6f79('0x9')](),controller[_0x6f79('0xa')]);router[_0x6f79('0x8')](_0x6f79('0xb'),auth[_0x6f79('0x9')](),controller[_0x6f79('0xc')]);router[_0x6f79('0x8')](_0x6f79('0xd'),auth[_0x6f79('0x9')](),controller[_0x6f79('0xe')]);router[_0x6f79('0xf')]('/',auth[_0x6f79('0x9')](),controller['create']);router[_0x6f79('0x10')]('/:id',auth[_0x6f79('0x9')](),controller[_0x6f79('0x11')]);router[_0x6f79('0x12')](_0x6f79('0xd'),auth['isAuthenticated'](),controller[_0x6f79('0x13')]);module[_0x6f79('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index b0a6510..3ea8a4d 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 _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 +var _0x7d75=['sequelize','exports','STRING','DATE','moment'];(function(_0x282f79,_0x1c1417){var _0x3bbdeb=function(_0x441de6){while(--_0x441de6){_0x282f79['push'](_0x282f79['shift']());}};_0x3bbdeb(++_0x1c1417);}(_0x7d75,0x1e9));var _0x57d7=function(_0x2ae232,_0x4e0754){_0x2ae232=_0x2ae232-0x0;var _0x36deae=_0x7d75[_0x2ae232];return _0x36deae;};'use strict';var moment=require(_0x57d7('0x0'));var Sequelize=require(_0x57d7('0x1'));module[_0x57d7('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x57d7('0x3')]},'joinAt':{'type':Sequelize[_0x57d7('0x4')]},'leaveAt':{'type':Sequelize[_0x57d7('0x4')]},'acceptAt':{'type':Sequelize[_0x57d7('0x4')]},'exitAt':{'type':Sequelize[_0x57d7('0x4')]},'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 aba2c9b..f0731e8 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(_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 +var _0xc4aa=['request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xc4aa[_0x5a776b];return _0xbbef59;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var db=require(_0xac4a('0x15'))['db'];function respondWithStatusCode(_0x2a0776,_0x24291d){_0x24291d=_0x24291d||0xcc;return function(_0x5e16aa){if(_0x5e16aa){return _0x2a0776[_0xac4a('0x16')](_0x24291d);}return _0x2a0776[_0xac4a('0x17')](_0x24291d)[_0xac4a('0x18')]();};}function respondWithResult(_0x6e00d4,_0x1b4313){_0x1b4313=_0x1b4313||0xc8;return function(_0x3b71c0){if(_0x3b71c0){return _0x6e00d4[_0xac4a('0x17')](_0x1b4313)[_0xac4a('0x19')](_0x3b71c0);}};}function respondWithFilteredResult(_0x190418,_0x42c7fc){return function(_0x11e101){if(_0x11e101){var _0x26dbb8=_0x11e101[_0xac4a('0x1a')],_0x4a2119=_0x42c7fc[_0xac4a('0x1b')],_0x402fff=_0x42c7fc[_0xac4a('0x1b')]+_0x42c7fc[_0xac4a('0x1c')],_0x34d797;if(_0x402fff>=_0x26dbb8){_0x402fff=_0x26dbb8;_0x34d797=0xc8;}else{_0x34d797=0xce;}_0x190418[_0xac4a('0x17')](_0x34d797);return _0x190418[_0xac4a('0x1d')]('Content-Range',_0x4a2119+'-'+_0x402fff+'/'+_0x26dbb8)['json'](_0x11e101);}return null;};}function patchUpdates(_0x21a729){return function(_0x13c8eb){try{jsonpatch[_0xac4a('0x1e')](_0x13c8eb,_0x21a729,!![]);}catch(_0x4d837c){return BPromise[_0xac4a('0x1f')](_0x4d837c);}return _0x13c8eb[_0xac4a('0x20')]();};}function saveUpdates(_0x3752e4,_0x3a3cdb){return function(_0x123694){if(_0x123694){return _0x123694[_0xac4a('0x21')](_0x3752e4)[_0xac4a('0x22')](function(_0x3ca790){return _0x3ca790;});}return null;};}function removeEntity(_0x534092,_0x3d8f0a){return function(_0x3204ad){if(_0x3204ad){return _0x3204ad['destroy']()[_0xac4a('0x22')](function(){_0x534092[_0xac4a('0x17')](0xcc)[_0xac4a('0x18')]();});}};}function handleEntityNotFound(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(!_0x1b7998){_0x947d8e[_0xac4a('0x16')](0x194);}return _0x1b7998;};}function handleError(_0x15435c,_0x412494){_0x412494=_0x412494||0x1f4;return function(_0x594f36){logger[_0xac4a('0x23')](_0x594f36[_0xac4a('0x24')]);if(_0x594f36[_0xac4a('0x25')]){delete _0x594f36[_0xac4a('0x25')];}_0x15435c[_0xac4a('0x17')](_0x412494)[_0xac4a('0x26')](_0x594f36);};}exports[_0xac4a('0x27')]=function(_0x14832b,_0x472c57){var _0x1c13dc={},_0x20202c={},_0x4e17ce={'count':0x0,'rows':[]};var _0x23b061=_[_0xac4a('0x28')](db[_0xac4a('0x29')][_0xac4a('0x2a')],function(_0x116700){return{'name':_0x116700['fieldName'],'type':_0x116700['type'][_0xac4a('0x2b')]};});_0x20202c[_0xac4a('0x2c')]=_[_0xac4a('0x28')](_0x23b061,'name');_0x20202c['query']=_[_0xac4a('0x2d')](_0x14832b[_0xac4a('0x2e')]);_0x20202c[_0xac4a('0x2f')]=_[_0xac4a('0x30')](_0x20202c[_0xac4a('0x2c')],_0x20202c['query']);_0x1c13dc[_0xac4a('0x31')]=_['intersection'](_0x20202c[_0xac4a('0x2c')],qs['fields'](_0x14832b[_0xac4a('0x2e')][_0xac4a('0x32')]));_0x1c13dc[_0xac4a('0x31')]=_0x1c13dc[_0xac4a('0x31')][_0xac4a('0x33')]?_0x1c13dc[_0xac4a('0x31')]:_0x20202c[_0xac4a('0x2c')];if(!_0x14832b[_0xac4a('0x2e')][_0xac4a('0x34')](_0xac4a('0x35'))){_0x1c13dc[_0xac4a('0x1c')]=qs[_0xac4a('0x1c')](_0x14832b[_0xac4a('0x2e')][_0xac4a('0x1c')]);_0x1c13dc['offset']=qs[_0xac4a('0x1b')](_0x14832b[_0xac4a('0x2e')]['offset']);}_0x1c13dc[_0xac4a('0x36')]=qs[_0xac4a('0x37')](_0x14832b['query']['sort']);_0x1c13dc[_0xac4a('0x38')]=qs[_0xac4a('0x2f')](_[_0xac4a('0x39')](_0x14832b[_0xac4a('0x2e')],_0x20202c['filters']),_0x23b061);if(_0x14832b[_0xac4a('0x2e')][_0xac4a('0x3a')]){_0x1c13dc['where']=_[_0xac4a('0x3b')](_0x1c13dc[_0xac4a('0x38')],{'$or':_[_0xac4a('0x28')](_0x23b061,function(_0x5f0eb8){if(_0x5f0eb8[_0xac4a('0x3c')]!==_0xac4a('0x3d')){var _0x1b5427={};_0x1b5427[_0x5f0eb8['name']]={'$like':'%'+_0x14832b[_0xac4a('0x2e')][_0xac4a('0x3a')]+'%'};return _0x1b5427;}})});}_0x1c13dc=_['merge']({},_0x1c13dc,_0x14832b['options']);var _0x4319a1={'where':_0x1c13dc['where']};return db['SmsQueueReport']['count'](_0x4319a1)['then'](function(_0x41b757){_0x4e17ce[_0xac4a('0x1a')]=_0x41b757;if(_0x14832b[_0xac4a('0x2e')][_0xac4a('0x3e')]){_0x1c13dc[_0xac4a('0x3f')]=[{'all':!![]}];}return db[_0xac4a('0x29')][_0xac4a('0x40')](_0x1c13dc);})[_0xac4a('0x22')](function(_0x28292c){_0x4e17ce[_0xac4a('0x41')]=_0x28292c;return _0x4e17ce;})[_0xac4a('0x22')](respondWithFilteredResult(_0x472c57,_0x1c13dc))[_0xac4a('0x42')](handleError(_0x472c57,null));};exports['show']=function(_0x5086ff,_0x5cd24f){var _0x1e1cc5={'raw':!![],'where':{'id':_0x5086ff[_0xac4a('0x43')]['id']}},_0x5c46a={};_0x5c46a[_0xac4a('0x2c')]=_[_0xac4a('0x2d')](db[_0xac4a('0x29')][_0xac4a('0x2a')]);_0x5c46a[_0xac4a('0x2e')]=_[_0xac4a('0x2d')](_0x5086ff[_0xac4a('0x2e')]);_0x5c46a['filters']=_[_0xac4a('0x30')](_0x5c46a[_0xac4a('0x2c')],_0x5c46a[_0xac4a('0x2e')]);_0x1e1cc5[_0xac4a('0x31')]=_[_0xac4a('0x30')](_0x5c46a['model'],qs[_0xac4a('0x32')](_0x5086ff[_0xac4a('0x2e')]['fields']));_0x1e1cc5[_0xac4a('0x31')]=_0x1e1cc5['attributes'][_0xac4a('0x33')]?_0x1e1cc5[_0xac4a('0x31')]:_0x5c46a[_0xac4a('0x2c')];if(_0x5086ff[_0xac4a('0x2e')][_0xac4a('0x3e')]){_0x1e1cc5[_0xac4a('0x3f')]=[{'all':!![]}];}_0x1e1cc5=_[_0xac4a('0x3b')]({},_0x1e1cc5,_0x5086ff[_0xac4a('0x44')]);return db[_0xac4a('0x29')][_0xac4a('0x45')](_0x1e1cc5)[_0xac4a('0x22')](handleEntityNotFound(_0x5cd24f,null))[_0xac4a('0x22')](respondWithResult(_0x5cd24f,null))['catch'](handleError(_0x5cd24f,null));};exports[_0xac4a('0x46')]=function(_0x41d11d,_0xeca4e9){return db['SmsQueueReport'][_0xac4a('0x46')](_0x41d11d[_0xac4a('0x47')],{})['then'](respondWithResult(_0xeca4e9,0xc9))[_0xac4a('0x42')](handleError(_0xeca4e9,null));};exports['update']=function(_0x244950,_0xe620f6){if(_0x244950[_0xac4a('0x47')]['id']){delete _0x244950['body']['id'];}return db['SmsQueueReport'][_0xac4a('0x45')]({'where':{'id':_0x244950['params']['id']}})[_0xac4a('0x22')](handleEntityNotFound(_0xe620f6,null))['then'](saveUpdates(_0x244950[_0xac4a('0x47')],null))['then'](respondWithResult(_0xe620f6,null))[_0xac4a('0x42')](handleError(_0xe620f6,null));};exports[_0xac4a('0x48')]=function(_0x424f9b,_0x1c8c39){return db['SmsQueueReport'][_0xac4a('0x45')]({'where':{'id':_0x424f9b[_0xac4a('0x43')]['id']}})[_0xac4a('0x22')](handleEntityNotFound(_0x1c8c39,null))[_0xac4a('0x22')](removeEntity(_0x1c8c39,null))[_0xac4a('0x42')](handleError(_0x1c8c39,null));};exports[_0xac4a('0x49')]=function(_0x187306,_0x4e6e19){return db[_0xac4a('0x29')][_0xac4a('0x49')]()['then'](respondWithResult(_0x4e6e19,null))[_0xac4a('0x42')](handleError(_0x4e6e19,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 614bfca..905a174 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 _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 +var _0x38a5=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x424c0f,_0x31a27d){var _0x265bf4=function(_0x419f69){while(--_0x419f69){_0x424c0f['push'](_0x424c0f['shift']());}};_0x265bf4(++_0x31a27d);}(_0x38a5,0x69));var _0x538a=function(_0x41296f,_0x4c1ffb){_0x41296f=_0x41296f-0x0;var _0x160a49=_0x38a5[_0x41296f];return _0x160a49;};'use strict';var _=require(_0x538a('0x0'));var util=require(_0x538a('0x1'));var logger=require(_0x538a('0x2'))(_0x538a('0x3'));var moment=require('moment');var BPromise=require(_0x538a('0x4'));var rp=require(_0x538a('0x5'));var fs=require('fs');var path=require(_0x538a('0x6'));var rimraf=require(_0x538a('0x7'));var config=require(_0x538a('0x8'));var attributes=require(_0x538a('0x9'));module[_0x538a('0xa')]=function(_0x16ab09,_0x1e3587){return _0x16ab09[_0x538a('0xb')](_0x538a('0xc'),attributes,{'tableName':_0x538a('0xd'),'paranoid':![],'indexes':[{'name':_0x538a('0xe'),'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 d82111c..3e1a7e1 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 _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 +var _0x48e3=['debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSmsQueueReport','create','raw','stringify','UpdateSmsQueueReport','SmsQueueReport','update','options','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x27b3c1,_0x224593){var _0x131c65=function(_0x3fcd58){while(--_0x3fcd58){_0x27b3c1['push'](_0x27b3c1['shift']());}};_0x131c65(++_0x224593);}(_0x48e3,0x151));var _0x348e=function(_0x49f447,_0x5907fe){_0x49f447=_0x49f447-0x0;var _0x2a05fd=_0x48e3[_0x49f447];return _0x2a05fd;};'use strict';var _=require(_0x348e('0x0'));var util=require(_0x348e('0x1'));var moment=require('moment');var BPromise=require(_0x348e('0x2'));var rs=require(_0x348e('0x3'));var fs=require('fs');var Redis=require(_0x348e('0x4'));var db=require(_0x348e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x348e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x348e('0x7'));var client=jayson[_0x348e('0x8')][_0x348e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e88ee,_0x3bd432,_0x5f1192){return new BPromise(function(_0x4c43c6,_0x36f041){return client[_0x348e('0xa')](_0x3e88ee,_0x5f1192)[_0x348e('0xb')](function(_0x3b57ab){logger[_0x348e('0xc')](_0x348e('0xd'),_0x3bd432,_0x348e('0xe'));logger[_0x348e('0xf')](_0x348e('0x10'),_0x3bd432,_0x348e('0xe'),JSON['stringify'](_0x3b57ab));if(_0x3b57ab[_0x348e('0x11')]){if(_0x3b57ab['error'][_0x348e('0x12')]===0x1f4){logger[_0x348e('0x11')](_0x348e('0xd'),_0x3bd432,_0x3b57ab[_0x348e('0x11')][_0x348e('0x13')]);return _0x36f041(_0x3b57ab['error'][_0x348e('0x13')]);}logger[_0x348e('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x3bd432,_0x3b57ab['error'][_0x348e('0x13')]);return _0x4c43c6(_0x3b57ab[_0x348e('0x11')][_0x348e('0x13')]);}else{logger['info'](_0x348e('0xd'),_0x3bd432,'request\x20sent');_0x4c43c6(_0x3b57ab[_0x348e('0x14')]['message']);}})[_0x348e('0x15')](function(_0x3fa247){logger['error'](_0x348e('0xd'),_0x3bd432,_0x3fa247);_0x36f041(_0x3fa247);});});}exports[_0x348e('0x16')]=function(_0x58f4b8){var _0x5a6c9b=this;return new Promise(function(_0x5a4425,_0x482279){return db['SmsQueueReport'][_0x348e('0x17')](_0x58f4b8['body'],{'raw':_0x58f4b8['options']?_0x58f4b8['options'][_0x348e('0x18')]===undefined?!![]:![]:!![]})[_0x348e('0xb')](function(_0x276fbd){logger[_0x348e('0xc')](_0x348e('0x16'),_0x58f4b8);logger[_0x348e('0xf')]('CreateSmsQueueReport',_0x58f4b8,JSON[_0x348e('0x19')](_0x276fbd));_0x5a4425(_0x276fbd);})[_0x348e('0x15')](function(_0x41267e){logger['error'](_0x348e('0x16'),_0x41267e[_0x348e('0x13')],_0x58f4b8);_0x482279(_0x5a6c9b[_0x348e('0x11')](0x1f4,_0x41267e[_0x348e('0x13')]));});});};exports[_0x348e('0x1a')]=function(_0x4177c1){var _0x4e080b=this;return new Promise(function(_0x58e876,_0x30b8fa){return db[_0x348e('0x1b')][_0x348e('0x1c')](_0x4177c1['body'],{'raw':_0x4177c1[_0x348e('0x1d')]?_0x4177c1['options'][_0x348e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4177c1[_0x348e('0x1d')]?_0x4177c1['options']['where']||null:null,'attributes':_0x4177c1[_0x348e('0x1d')]?_0x4177c1[_0x348e('0x1d')][_0x348e('0x1e')]||null:null,'limit':_0x4177c1[_0x348e('0x1d')]?_0x4177c1['options'][_0x348e('0x1f')]||null:null})[_0x348e('0xb')](function(_0x355974){logger[_0x348e('0xc')](_0x348e('0x1a'),_0x4177c1);logger['debug'](_0x348e('0x1a'),_0x4177c1,JSON[_0x348e('0x19')](_0x355974));_0x58e876(_0x355974);})['catch'](function(_0xc142b5){logger[_0x348e('0x11')]('UpdateSmsQueueReport',_0xc142b5['message'],_0x4177c1);_0x30b8fa(_0x4e080b[_0x348e('0x11')](0x1f4,_0xc142b5[_0x348e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 4cf5d9f..b70b7dd 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 _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 +var _0x5c00=['put','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create'];(function(_0x16b994,_0x22872a){var _0xfc3e0f=function(_0x32d1d8){while(--_0x32d1d8){_0x16b994['push'](_0x16b994['shift']());}};_0xfc3e0f(++_0x22872a);}(_0x5c00,0x17e));var _0x05c0=function(_0x54aea3,_0xae7d81){_0x54aea3=_0x54aea3-0x0;var _0x21ae46=_0x5c00[_0x54aea3];return _0x21ae46;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var auth=require(_0x05c0('0x4'));var interaction=require(_0x05c0('0x5'));var config=require(_0x05c0('0x6'));var controller=require(_0x05c0('0x7'));router['get']('/',auth[_0x05c0('0x8')](),controller[_0x05c0('0x9')]);router[_0x05c0('0xa')](_0x05c0('0xb'),auth['isAuthenticated'](),controller[_0x05c0('0xc')]);router[_0x05c0('0xa')](_0x05c0('0xd'),auth['isAuthenticated'](),controller[_0x05c0('0xe')]);router[_0x05c0('0xf')]('/',auth[_0x05c0('0x8')](),controller[_0x05c0('0x10')]);router[_0x05c0('0x11')](_0x05c0('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x05c0('0x12')]('/:id',auth[_0x05c0('0x8')](),controller[_0x05c0('0x13')]);module[_0x05c0('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index db1ec24..24df2c2 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 _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 +var _0x5533=['NOW','STRING','ENUM','account','agent','queue','DATE'];(function(_0x158ff5,_0x2510b7){var _0x2f2597=function(_0x87870c){while(--_0x87870c){_0x158ff5['push'](_0x158ff5['shift']());}};_0x2f2597(++_0x2510b7);}(_0x5533,0x8d));var _0x3553=function(_0x4e23f5,_0x47bc1f){_0x4e23f5=_0x4e23f5-0x0;var _0x11e69d=_0x5533[_0x4e23f5];return _0x11e69d;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x3553('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x3553('0x1')](_0x3553('0x2'),_0x3553('0x3'),_0x3553('0x4')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x3553('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x3553('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 9f0ef77..ed7da48 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 _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 +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(_0x5ba580,_0x591c61){var _0xb5894f=function(_0x4ca3b2){while(--_0x4ca3b2){_0x5ba580['push'](_0x5ba580['shift']());}};_0xb5894f(++_0x591c61);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'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 diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 8226646..503ed1c 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 _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 +var _0xba34=['./smsTransferReport.attributes','exports','define','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x652914,_0xa0fbc5){var _0x334b9a=function(_0xdb326d){while(--_0xdb326d){_0x652914['push'](_0x652914['shift']());}};_0x334b9a(++_0xa0fbc5);}(_0xba34,0x119));var _0x4ba3=function(_0x1481a2,_0x4dc59c){_0x1481a2=_0x1481a2-0x0;var _0x13cafa=_0xba34[_0x1481a2];return _0x13cafa;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));module[_0x4ba3('0x8')]=function(_0x3590a1,_0xb88621){return _0x3590a1[_0x4ba3('0x9')]('SmsTransferReport',attributes,{'tableName':_0x4ba3('0xa'),'paranoid':![],'indexes':[{'name':_0x4ba3('0xb'),'fields':[_0x4ba3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 1e4c0c7..18f92c2 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 _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 +var _0xc21d=['code','SmsTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc21d,0x89));var _0xdc21=function(_0x5a2142,_0x1554cc){_0x5a2142=_0x5a2142-0x0;var _0x1e3d8c=_0xc21d[_0x5a2142];return _0x1e3d8c;};'use strict';var _=require(_0xdc21('0x0'));var util=require(_0xdc21('0x1'));var moment=require('moment');var BPromise=require(_0xdc21('0x2'));var rs=require(_0xdc21('0x3'));var fs=require('fs');var Redis=require(_0xdc21('0x4'));var db=require(_0xdc21('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdc21('0x6'))(_0xdc21('0x7'));var config=require('../../config/environment');var jayson=require(_0xdc21('0x8'));var client=jayson[_0xdc21('0x9')][_0xdc21('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x92bd98,_0x15f283,_0x16cc3c){return new BPromise(function(_0x57baac,_0x52f2a6){return client['request'](_0x92bd98,_0x16cc3c)[_0xdc21('0xb')](function(_0x45e859){logger[_0xdc21('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x15f283,_0xdc21('0xd'));logger[_0xdc21('0xe')](_0xdc21('0xf'),_0x15f283,_0xdc21('0xd'),JSON['stringify'](_0x45e859));if(_0x45e859['error']){if(_0x45e859[_0xdc21('0x10')][_0xdc21('0x11')]===0x1f4){logger[_0xdc21('0x10')](_0xdc21('0x12'),_0x15f283,_0x45e859[_0xdc21('0x10')]['message']);return _0x52f2a6(_0x45e859[_0xdc21('0x10')][_0xdc21('0x13')]);}logger[_0xdc21('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x15f283,_0x45e859[_0xdc21('0x10')][_0xdc21('0x13')]);return _0x57baac(_0x45e859[_0xdc21('0x10')][_0xdc21('0x13')]);}else{logger[_0xdc21('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x15f283,'request\x20sent');_0x57baac(_0x45e859[_0xdc21('0x14')]['message']);}})[_0xdc21('0x15')](function(_0x5df40a){logger[_0xdc21('0x10')](_0xdc21('0x12'),_0x15f283,_0x5df40a);_0x52f2a6(_0x5df40a);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 0c52798..3d0cdf1 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 _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 +var _0xb769=['server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname','single','file','create','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','/:id/download','download','diskStorage','join','root'];(function(_0x371e83,_0xb4184d){var _0x2352cc=function(_0x3cc2c4){while(--_0x3cc2c4){_0x371e83['push'](_0x371e83['shift']());}};_0x2352cc(++_0xb4184d);}(_0xb769,0x178));var _0x9b76=function(_0x43db46,_0x2a3cdf){_0x43db46=_0x43db46-0x0;var _0x1d435e=_0xb769[_0x43db46];return _0x1d435e;};'use strict';var multer=require(_0x9b76('0x0'));var util=require(_0x9b76('0x1'));var path=require('path');var timeout=require(_0x9b76('0x2'));var express=require(_0x9b76('0x3'));var router=express[_0x9b76('0x4')]();var auth=require(_0x9b76('0x5'));var interaction=require(_0x9b76('0x6'));var config=require('../../config/environment');var controller=require('./sound.controller');router[_0x9b76('0x7')]('/',auth['isAuthenticated'](),controller[_0x9b76('0x8')]);router[_0x9b76('0x7')](_0x9b76('0x9'),auth[_0x9b76('0xa')](),controller['show']);router[_0x9b76('0x7')](_0x9b76('0xb'),auth[_0x9b76('0xa')](),controller[_0x9b76('0xc')]);var upload=multer({'storage':multer[_0x9b76('0xd')]({'destination':function(_0x2e4722,_0x42b748,_0x4f27dd){_0x4f27dd(null,path[_0x9b76('0xe')](config[_0x9b76('0xf')],_0x9b76('0x10')));},'filename':function(_0x32cc23,_0x171ee2,_0x4802a7){_0x171ee2['originalname']=_0x171ee2[_0x9b76('0x11')][_0x9b76('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4802a7(null,util[_0x9b76('0x13')](_0x9b76('0x14'),path['basename'](_0x171ee2[_0x9b76('0x11')],path[_0x9b76('0x15')](_0x171ee2[_0x9b76('0x11')])),Date['now'](),path[_0x9b76('0x15')](_0x171ee2[_0x9b76('0x11')])));}})});router['post']('/',upload[_0x9b76('0x16')](_0x9b76('0x17')),controller[_0x9b76('0x18')]);router['put'](_0x9b76('0x9'),auth[_0x9b76('0xa')](),controller[_0x9b76('0x19')]);router[_0x9b76('0x1a')](_0x9b76('0x9'),auth[_0x9b76('0xa')](),controller[_0x9b76('0x1a')]);module[_0x9b76('0x1b')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 0c8279d..04b2302 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 _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 +var _0x606c=['STRING','name','FLOAT','BIGINT','INTEGER','exports'];(function(_0xa4205d,_0xa25f31){var _0x266d13=function(_0x3a1330){while(--_0x3a1330){_0xa4205d['push'](_0xa4205d['shift']());}};_0x266d13(++_0xa25f31);}(_0x606c,0x1eb));var _0xc606=function(_0x3ee1fe,_0x59f2a1){_0x3ee1fe=_0x3ee1fe-0x0;var _0x1ae57a=_0x606c[_0x3ee1fe];return _0x1ae57a;};'use strict';var Sequelize=require('sequelize');module[_0xc606('0x0')]={'name':{'type':Sequelize[_0xc606('0x1')],'unique':_0xc606('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xc606('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0xc606('0x1')]},'original_duration':{'type':Sequelize[_0xc606('0x3')]},'original_sampleCount':{'type':Sequelize[_0xc606('0x4')]},'original_channelCount':{'type':Sequelize[_0xc606('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0xc606('0x1')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xc606('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xc606('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 18b197d..95aa534 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 _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 +var _0x347f=['eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','sort','where','pick','merge','filter','options','Sound','includeAll','include','findAll','rows','catch','show','params','keys','length','find','download','save_name','converted_format','join','server/files/sounds/converted','Sequelize','format','%s.%s','create','basename','originalname','extname','file','substring','wav','root','server/files/sounds/original','filename','Sound\x20upload\x20filepath:\x20%s','info','chmodSync','0777','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','dest','converted_duration','converted_bitRate','sampleRate','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','send','description','original_format','unlinkSync','end','html-pdf'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x347f,0x71));var _0xf347=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x347f[_0x17d9e3];return _0x14192d;};'use strict';var pdf=require(_0xf347('0x0'));var emlformat=require(_0xf347('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf347('0x2'));var jsonpatch=require(_0xf347('0x3'));var rp=require(_0xf347('0x4'));var moment=require(_0xf347('0x5'));var BPromise=require(_0xf347('0x6'));var Mustache=require(_0xf347('0x7'));var util=require(_0xf347('0x8'));var path=require(_0xf347('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf347('0xa'));var fs=require('fs');var _=require(_0xf347('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf347('0xc'));var deskjs=require(_0xf347('0xd'));var toCsv=require(_0xf347('0xe'));var querystring=require(_0xf347('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf347('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf347('0x11'));var logger=require(_0xf347('0x12'))('api');var utils=require(_0xf347('0x13'));var config=require(_0xf347('0x14'));var db=require(_0xf347('0x15'))['db'];function respondWithStatusCode(_0x9cf064,_0x39c74e){_0x39c74e=_0x39c74e||0xcc;return function(_0x52ff55){if(_0x52ff55){return _0x9cf064['sendStatus'](_0x39c74e);}return _0x9cf064['status'](_0x39c74e)['end']();};}function respondWithResult(_0x4dfbef,_0x2269e7){_0x2269e7=_0x2269e7||0xc8;return function(_0x316123){if(_0x316123){return _0x4dfbef[_0xf347('0x16')](_0x2269e7)[_0xf347('0x17')](_0x316123);}};}function respondWithFilteredResult(_0x36b2f1,_0xc7689f){return function(_0x4b2250){if(_0x4b2250){var _0x4f04f7=_0x4b2250[_0xf347('0x18')],_0x6af8b=_0xc7689f[_0xf347('0x19')],_0x27ad46=_0xc7689f['offset']+_0xc7689f[_0xf347('0x1a')],_0x25f362;if(_0x27ad46>=_0x4f04f7){_0x27ad46=_0x4f04f7;_0x25f362=0xc8;}else{_0x25f362=0xce;}_0x36b2f1['status'](_0x25f362);return _0x36b2f1[_0xf347('0x1b')](_0xf347('0x1c'),_0x6af8b+'-'+_0x27ad46+'/'+_0x4f04f7)[_0xf347('0x17')](_0x4b2250);}return null;};}function patchUpdates(_0x1b2ef1){return function(_0x4ac5c7){try{jsonpatch[_0xf347('0x1d')](_0x4ac5c7,_0x1b2ef1,!![]);}catch(_0x186f9a){return BPromise[_0xf347('0x1e')](_0x186f9a);}return _0x4ac5c7['save']();};}function saveUpdates(_0x1bfc87,_0xb02b75){return function(_0x20e24c){if(_0x20e24c){return _0x20e24c[_0xf347('0x1f')](_0x1bfc87)[_0xf347('0x20')](function(_0x3df522){return _0x3df522;});}return null;};}function removeEntity(_0x37f317,_0x3e7c89){return function(_0x1b83d7){if(_0x1b83d7){return _0x1b83d7[_0xf347('0x21')]()[_0xf347('0x20')](function(){var _0x2db6a6=_0x1b83d7[_0xf347('0x22')]({'plain':!![]});var _0x2ddb40=_0xf347('0x23');return db[_0xf347('0x24')][_0xf347('0x21')]({'where':{'type':_0x2ddb40,'resourceId':_0x2db6a6['id']}})[_0xf347('0x20')](function(){return _0x1b83d7;});})[_0xf347('0x20')](function(){_0x37f317['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ff843,_0x14b96e){return function(_0x3e5cdb){if(!_0x3e5cdb){_0x1ff843['sendStatus'](0x194);}return _0x3e5cdb;};}function handleError(_0x2d7d51,_0x25506b){_0x25506b=_0x25506b||0x1f4;return function(_0x19a6ac){logger[_0xf347('0x25')](_0x19a6ac[_0xf347('0x26')]);if(_0x19a6ac[_0xf347('0x27')]){delete _0x19a6ac['name'];}_0x2d7d51[_0xf347('0x16')](_0x25506b)['send'](_0x19a6ac);};}exports[_0xf347('0x28')]=function(_0x464d25,_0x7c011){var _0x11f54a={},_0x2034a0={},_0x35439e={'count':0x0,'rows':[]};var _0x4673ad=_['map'](db['Sound'][_0xf347('0x29')],function(_0x1c4f83){return{'name':_0x1c4f83[_0xf347('0x2a')],'type':_0x1c4f83[_0xf347('0x2b')][_0xf347('0x2c')]};});_0x2034a0[_0xf347('0x2d')]=_[_0xf347('0x2e')](_0x4673ad,'name');_0x2034a0[_0xf347('0x2f')]=_['keys'](_0x464d25[_0xf347('0x2f')]);_0x2034a0[_0xf347('0x30')]=_[_0xf347('0x31')](_0x2034a0[_0xf347('0x2d')],_0x2034a0[_0xf347('0x2f')]);_0x11f54a[_0xf347('0x32')]=_[_0xf347('0x31')](_0x2034a0['model'],qs[_0xf347('0x33')](_0x464d25[_0xf347('0x2f')][_0xf347('0x33')]));_0x11f54a[_0xf347('0x32')]=_0x11f54a[_0xf347('0x32')]['length']?_0x11f54a[_0xf347('0x32')]:_0x2034a0[_0xf347('0x2d')];if(!_0x464d25[_0xf347('0x2f')]['hasOwnProperty']('nolimit')){_0x11f54a['limit']=qs[_0xf347('0x1a')](_0x464d25[_0xf347('0x2f')][_0xf347('0x1a')]);_0x11f54a[_0xf347('0x19')]=qs['offset'](_0x464d25[_0xf347('0x2f')]['offset']);}_0x11f54a['order']=qs['sort'](_0x464d25[_0xf347('0x2f')][_0xf347('0x34')]);_0x11f54a[_0xf347('0x35')]=qs['filters'](_[_0xf347('0x36')](_0x464d25[_0xf347('0x2f')],_0x2034a0[_0xf347('0x30')]),_0x4673ad);if(_0x464d25[_0xf347('0x2f')]['filter']){_0x11f54a['where']=_[_0xf347('0x37')](_0x11f54a[_0xf347('0x35')],{'$or':_['map'](_0x4673ad,function(_0x22843a){if(_0x22843a['type']!=='VIRTUAL'){var _0x2be94f={};_0x2be94f[_0x22843a[_0xf347('0x27')]]={'$like':'%'+_0x464d25[_0xf347('0x2f')][_0xf347('0x38')]+'%'};return _0x2be94f;}})});}_0x11f54a=_[_0xf347('0x37')]({},_0x11f54a,_0x464d25[_0xf347('0x39')]);var _0x46f1db={'where':_0x11f54a['where']};return db[_0xf347('0x3a')][_0xf347('0x18')](_0x46f1db)['then'](function(_0x12d2d2){_0x35439e[_0xf347('0x18')]=_0x12d2d2;if(_0x464d25[_0xf347('0x2f')][_0xf347('0x3b')]){_0x11f54a[_0xf347('0x3c')]=[{'all':!![]}];}return db[_0xf347('0x3a')][_0xf347('0x3d')](_0x11f54a);})['then'](function(_0x11878f){_0x35439e[_0xf347('0x3e')]=_0x11878f;return _0x35439e;})[_0xf347('0x20')](respondWithFilteredResult(_0x7c011,_0x11f54a))[_0xf347('0x3f')](handleError(_0x7c011,null));};exports[_0xf347('0x40')]=function(_0x4ad5a3,_0x191130){var _0x33e61e={'raw':!![],'where':{'id':_0x4ad5a3[_0xf347('0x41')]['id']}},_0x29df73={};_0x29df73[_0xf347('0x2d')]=_[_0xf347('0x42')](db['Sound'][_0xf347('0x29')]);_0x29df73['query']=_[_0xf347('0x42')](_0x4ad5a3['query']);_0x29df73['filters']=_[_0xf347('0x31')](_0x29df73[_0xf347('0x2d')],_0x29df73[_0xf347('0x2f')]);_0x33e61e['attributes']=_[_0xf347('0x31')](_0x29df73[_0xf347('0x2d')],qs[_0xf347('0x33')](_0x4ad5a3[_0xf347('0x2f')][_0xf347('0x33')]));_0x33e61e[_0xf347('0x32')]=_0x33e61e[_0xf347('0x32')][_0xf347('0x43')]?_0x33e61e[_0xf347('0x32')]:_0x29df73[_0xf347('0x2d')];if(_0x4ad5a3[_0xf347('0x2f')][_0xf347('0x3b')]){_0x33e61e['include']=[{'all':!![]}];}_0x33e61e=_[_0xf347('0x37')]({},_0x33e61e,_0x4ad5a3[_0xf347('0x39')]);return db[_0xf347('0x3a')][_0xf347('0x44')](_0x33e61e)[_0xf347('0x20')](handleEntityNotFound(_0x191130,null))[_0xf347('0x20')](respondWithResult(_0x191130,null))[_0xf347('0x3f')](handleError(_0x191130,null));};exports[_0xf347('0x45')]=function(_0x14d219,_0x59235d,_0x501231){return db[_0xf347('0x3a')][_0xf347('0x44')]({'where':{'id':_0x14d219[_0xf347('0x41')]['id']},'attributes':[_0xf347('0x27'),_0xf347('0x46'),_0xf347('0x47')],'raw':!![]})[_0xf347('0x20')](handleEntityNotFound(_0x59235d,null))[_0xf347('0x20')](function(_0x331481){if(_0x331481){if(!fs['existsSync'](path[_0xf347('0x48')](config['root'],_0xf347('0x49'),_0x331481[_0xf347('0x46')]+'.'+_0x331481[_0xf347('0x47')]))){throw new db[(_0xf347('0x4a'))]['ValidationError']('Sound\x20not\x20found');}return _0x59235d[_0xf347('0x45')](path[_0xf347('0x48')](config['root'],_0xf347('0x49'),util[_0xf347('0x4b')]('%s.%s',_0x331481[_0xf347('0x46')],_0x331481[_0xf347('0x47')])),util[_0xf347('0x4b')](_0xf347('0x4c'),_0x331481['name'],_0x331481['converted_format']));}return null;})[_0xf347('0x3f')](handleError(_0x59235d,null));};exports[_0xf347('0x4d')]=function(_0x48c894,_0x38aedb,_0x32c5eb){var _0x5d1517={'name':path[_0xf347('0x4e')](_0x48c894['file'][_0xf347('0x4f')],path[_0xf347('0x50')](_0x48c894[_0xf347('0x51')]['originalname'])),'save_name':path[_0xf347('0x4e')](_0x48c894['file']['filename'],path['extname'](_0x48c894[_0xf347('0x51')]['filename'])),'original_format':path[_0xf347('0x50')](_0x48c894[_0xf347('0x51')][_0xf347('0x4f')])[_0xf347('0x52')](0x1),'converted_format':_0xf347('0x53')};var _0x4b47cd=path[_0xf347('0x48')](config[_0xf347('0x54')],_0xf347('0x55'),_0x48c894[_0xf347('0x51')][_0xf347('0x56')]);var _0x9c38ae=path['join'](config['root'],_0xf347('0x49'),util[_0xf347('0x4b')](_0xf347('0x4c'),path[_0xf347('0x4e')](_0x48c894[_0xf347('0x51')]['filename'],path[_0xf347('0x50')](_0x48c894[_0xf347('0x51')]['filename'])),_0x5d1517[_0xf347('0x47')]));logger['info'](_0xf347('0x57'),_0x4b47cd);logger[_0xf347('0x58')]('Sound\x20upload\x20destination:\x20%s',_0x9c38ae);try{fs[_0xf347('0x59')](_0x4b47cd,parseInt(_0xf347('0x5a'),0x8));var _0x3eb708=sox['transcode'](_0x4b47cd,_0x9c38ae,{'sampleRate':0x1f40,'format':_0xf347('0x53'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3eb708['on'](_0xf347('0x25'),function(_0x4419d4){fs['unlinkSync'](_0x4b47cd);_0x38aedb['status'](0x1f4)['send'](_0x4419d4);});_0x3eb708['on']('src',function(_0x1e144a){_0x5d1517['original_duration']=isNaN(_0x1e144a[_0xf347('0x5b')])?null:_0x1e144a[_0xf347('0x5b')]*0x3e8;_0x5d1517['original_sampleCount']=isNaN(_0x1e144a[_0xf347('0x5c')])?null:_0x1e144a[_0xf347('0x5c')];_0x5d1517[_0xf347('0x5d')]=isNaN(_0x1e144a['channelCount'])?null:_0x1e144a[_0xf347('0x5e')];_0x5d1517[_0xf347('0x5f')]=isNaN(_0x1e144a[_0xf347('0x60')])?null:_0x1e144a['bitRate'];_0x5d1517['original_sampleRate']=isNaN(_0x1e144a['sampleRate'])?null:_0x1e144a['sampleRate'];});_0x3eb708['on'](_0xf347('0x61'),function(_0x3bc08b){_0x5d1517[_0xf347('0x62')]=isNaN(_0x3bc08b[_0xf347('0x5b')])?null:_0x3bc08b[_0xf347('0x5b')]*0x3e8;_0x5d1517['converted_sampleCount']=isNaN(_0x3bc08b[_0xf347('0x5c')])?null:_0x3bc08b['sampleCount'];_0x5d1517['converted_channelCount']=isNaN(_0x3bc08b[_0xf347('0x5e')])?null:_0x3bc08b[_0xf347('0x5e')];_0x5d1517[_0xf347('0x63')]=isNaN(_0x3bc08b[_0xf347('0x60')])?null:_0x3bc08b[_0xf347('0x60')];_0x5d1517['converted_sampleRate']=isNaN(_0x3bc08b[_0xf347('0x64')])?null:_0x3bc08b[_0xf347('0x64')];});_0x3eb708['on']('end',function(){fs['chmodSync'](_0x9c38ae,parseInt(_0xf347('0x5a'),0x8));return db[_0xf347('0x3a')][_0xf347('0x4d')](_0x5d1517)['then'](function(_0xe426a9){var _0x37150e={'role':_0x48c894[_0xf347('0x65')]['role'],'userProfileId':_0x48c894['body'][_0xf347('0x66')]};if(!_0x37150e)throw new Error(_0xf347('0x67'));if(_0x37150e[_0xf347('0x68')]==='user'){var _0x233ec6=_0xe426a9[_0xf347('0x22')]({'plain':!![]});return db[_0xf347('0x69')][_0xf347('0x44')]({'where':{'name':_0xf347('0x23'),'userProfileId':_0x37150e[_0xf347('0x66')]},'raw':!![]})[_0xf347('0x20')](function(_0x42ec96){if(_0x42ec96&&_0x42ec96[_0xf347('0x6a')]===0x0){return db[_0xf347('0x24')]['create']({'name':_0x233ec6['name'],'resourceId':_0x233ec6['id'],'type':_0x42ec96[_0xf347('0x27')],'sectionId':_0x42ec96['id']},{})[_0xf347('0x20')](function(){return _0xe426a9;});}else{return _0xe426a9;}})['catch'](function(_0x4a1849){logger[_0xf347('0x25')](_0xf347('0x6b'),_0x4a1849);throw _0x4a1849;});}return _0xe426a9;})['then'](respondWithResult(_0x38aedb,null))[_0xf347('0x3f')](handleError(_0x38aedb,null));});_0x3eb708[_0xf347('0x6c')]();}catch(_0x4811af){_0x38aedb[_0xf347('0x16')](0x1f4)[_0xf347('0x6d')](_0x4811af);}};exports['update']=function(_0x174d9f,_0x40ccf9,_0x443f40){return db[_0xf347('0x3a')][_0xf347('0x44')]({'where':{'id':_0x174d9f['params']['id']}})[_0xf347('0x20')](handleEntityNotFound(_0x40ccf9,null))[_0xf347('0x20')](saveUpdates(_[_0xf347('0x36')](_0x174d9f[_0xf347('0x65')],['name',_0xf347('0x6e')]),null))[_0xf347('0x20')](respondWithResult(_0x40ccf9,null))[_0xf347('0x3f')](handleError(_0x40ccf9,null));};exports['delete']=function(_0x58b779,_0x5e5510,_0x5143a0){return db[_0xf347('0x3a')][_0xf347('0x44')]({'where':{'id':_0x58b779[_0xf347('0x41')]['id']}})[_0xf347('0x20')](function(_0x70e5ca){if(_0x70e5ca){return _0x70e5ca[_0xf347('0x21')]();}})[_0xf347('0x20')](function(_0x2cb72d){var _0x19b0ca=path['join'](config[_0xf347('0x54')],'server/files/sounds/original',util[_0xf347('0x4b')](_0xf347('0x4c'),_0x2cb72d[_0xf347('0x46')],_0x2cb72d[_0xf347('0x6f')]));var _0x366fad=path[_0xf347('0x48')](config[_0xf347('0x54')],_0xf347('0x49'),util[_0xf347('0x4b')](_0xf347('0x4c'),_0x2cb72d[_0xf347('0x46')],_0x2cb72d[_0xf347('0x47')]));fs['unlinkSync'](_0x19b0ca);fs[_0xf347('0x70')](_0x366fad);return _0x2cb72d;})[_0xf347('0x20')](function(_0xc2a99e){if(_0xc2a99e){return _0x5e5510['status'](0xcc)[_0xf347('0x71')]();}})[_0xf347('0x20')](handleEntityNotFound(_0x5e5510,null))[_0xf347('0x3f')](handleError(_0x5e5510,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index d918804..39bcf52 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 _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 +var _0xaa14=['api','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','lodash','util','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xaa14,0xfa));var _0x4aa1=function(_0x46ec24,_0x4d2d68){_0x46ec24=_0x46ec24-0x0;var _0x8e7299=_0xaa14[_0x46ec24];return _0x8e7299;};'use strict';var _=require(_0x4aa1('0x0'));var util=require(_0x4aa1('0x1'));var logger=require(_0x4aa1('0x2'))(_0x4aa1('0x3'));var moment=require('moment');var BPromise=require(_0x4aa1('0x4'));var rp=require(_0x4aa1('0x5'));var fs=require('fs');var path=require(_0x4aa1('0x6'));var rimraf=require(_0x4aa1('0x7'));var config=require(_0x4aa1('0x8'));var attributes=require(_0x4aa1('0x9'));module[_0x4aa1('0xa')]=function(_0x4c36c9,_0x30c027){return _0x4c36c9['define']('Sound',attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 6a98a4d..d167a00 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 _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 +var _0xcddc=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowSound','Sound','options','raw','where','attributes','include','map','model','debug','lodash','util','moment','bluebird','randomstring'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xcddc,0x187));var _0xccdd=function(_0x151a5d,_0x3f9902){_0x151a5d=_0x151a5d-0x0;var _0x234dcb=_0xcddc[_0x151a5d];return _0x234dcb;};'use strict';var _=require(_0xccdd('0x0'));var util=require(_0xccdd('0x1'));var moment=require(_0xccdd('0x2'));var BPromise=require(_0xccdd('0x3'));var rs=require(_0xccdd('0x4'));var fs=require('fs');var Redis=require(_0xccdd('0x5'));var db=require(_0xccdd('0x6'))['db'];var utils=require(_0xccdd('0x7'));var logger=require('../../config/logger')(_0xccdd('0x8'));var config=require(_0xccdd('0x9'));var jayson=require(_0xccdd('0xa'));var client=jayson[_0xccdd('0xb')][_0xccdd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x238330,_0x1871e6,_0x57b7f1){return new BPromise(function(_0x442e8c,_0x1e1149){return client[_0xccdd('0xd')](_0x238330,_0x57b7f1)[_0xccdd('0xe')](function(_0x64dde3){logger[_0xccdd('0xf')](_0xccdd('0x10'),_0x1871e6,_0xccdd('0x11'));logger['debug'](_0xccdd('0x12'),_0x1871e6,'request\x20sent',JSON['stringify'](_0x64dde3));if(_0x64dde3[_0xccdd('0x13')]){if(_0x64dde3[_0xccdd('0x13')]['code']===0x1f4){logger[_0xccdd('0x13')](_0xccdd('0x10'),_0x1871e6,_0x64dde3[_0xccdd('0x13')][_0xccdd('0x14')]);return _0x1e1149(_0x64dde3[_0xccdd('0x13')][_0xccdd('0x14')]);}logger['error'](_0xccdd('0x10'),_0x1871e6,_0x64dde3[_0xccdd('0x13')][_0xccdd('0x14')]);return _0x442e8c(_0x64dde3['error'][_0xccdd('0x14')]);}else{logger[_0xccdd('0xf')](_0xccdd('0x10'),_0x1871e6,_0xccdd('0x11'));_0x442e8c(_0x64dde3[_0xccdd('0x15')][_0xccdd('0x14')]);}})[_0xccdd('0x16')](function(_0x74b488){logger[_0xccdd('0x13')]('Sound,\x20%s,\x20%s',_0x1871e6,_0x74b488);_0x1e1149(_0x74b488);});});}exports[_0xccdd('0x17')]=function(_0x4198fa){var _0x49c278=this;return new Promise(function(_0x126504,_0x2584c4){return db[_0xccdd('0x18')]['find']({'raw':_0x4198fa[_0xccdd('0x19')]?_0x4198fa[_0xccdd('0x19')][_0xccdd('0x1a')]===undefined?!![]:![]:!![],'where':_0x4198fa['options']?_0x4198fa[_0xccdd('0x19')][_0xccdd('0x1b')]||null:null,'attributes':_0x4198fa[_0xccdd('0x19')]?_0x4198fa['options'][_0xccdd('0x1c')]||null:null,'include':_0x4198fa[_0xccdd('0x19')]?_0x4198fa[_0xccdd('0x19')][_0xccdd('0x1d')]?_[_0xccdd('0x1e')](_0x4198fa[_0xccdd('0x19')][_0xccdd('0x1d')],function(_0x30f93c){return{'model':db[_0x30f93c['model']],'as':_0x30f93c['as'],'attributes':_0x30f93c['attributes'],'include':_0x30f93c[_0xccdd('0x1d')]?_[_0xccdd('0x1e')](_0x30f93c[_0xccdd('0x1d')],function(_0x465ffd){return{'model':db[_0x465ffd[_0xccdd('0x1f')]],'as':_0x465ffd['as'],'attributes':_0x465ffd[_0xccdd('0x1c')],'include':_0x465ffd['include']?_['map'](_0x465ffd['include'],function(_0x33fa65){return{'model':db[_0x33fa65[_0xccdd('0x1f')]],'as':_0x33fa65['as'],'attributes':_0x33fa65[_0xccdd('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xccdd('0xe')](function(_0x328bb6){logger[_0xccdd('0xf')]('ShowSound',_0x4198fa);logger[_0xccdd('0x20')]('ShowSound',_0x4198fa,JSON['stringify'](_0x328bb6));_0x126504(_0x328bb6);})[_0xccdd('0x16')](function(_0x3b9c43){logger[_0xccdd('0x13')](_0xccdd('0x17'),_0x3b9c43[_0xccdd('0x14')],_0x4198fa);_0x2584c4(_0x49c278['error'](0x1f4,_0x3b9c43['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 9ed8561..d5b3092 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 _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 +var _0xd98f=['create','put','delete','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post'];(function(_0x421ff6,_0x40f195){var _0x177051=function(_0x254bdf){while(--_0x254bdf){_0x421ff6['push'](_0x421ff6['shift']());}};_0x177051(++_0x40f195);}(_0xd98f,0x185));var _0xfd98=function(_0xf4e4b5,_0x3ffb13){_0xf4e4b5=_0xf4e4b5-0x0;var _0xf497e0=_0xd98f[_0xf4e4b5];return _0xf497e0;};'use strict';var multer=require(_0xfd98('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfd98('0x1'));var express=require(_0xfd98('0x2'));var router=express['Router']();var auth=require(_0xfd98('0x3'));var interaction=require(_0xfd98('0x4'));var config=require(_0xfd98('0x5'));var controller=require('./squareMessage.controller');router[_0xfd98('0x6')]('/',auth[_0xfd98('0x7')](),controller[_0xfd98('0x8')]);router[_0xfd98('0x6')](_0xfd98('0x9'),auth[_0xfd98('0x7')](),controller['show']);router[_0xfd98('0xa')]('/',auth[_0xfd98('0x7')](),controller[_0xfd98('0xb')]);router[_0xfd98('0xc')](_0xfd98('0x9'),auth[_0xfd98('0x7')](),controller['update']);router[_0xfd98('0xd')](_0xfd98('0x9'),auth[_0xfd98('0x7')](),controller[_0xfd98('0xe')]);module[_0xfd98('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index f12b31d..7550b85 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 _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 +var _0x82a3=['medium','ENUM','out','sequelize','exports','STRING','TEXT'];(function(_0x76d0dd,_0x16716d){var _0x508d20=function(_0x15af09){while(--_0x15af09){_0x76d0dd['push'](_0x76d0dd['shift']());}};_0x508d20(++_0x16716d);}(_0x82a3,0x1ae));var _0x382a=function(_0x35e4af,_0x28237a){_0x35e4af=_0x35e4af-0x0;var _0x15411e=_0x82a3[_0x35e4af];return _0x15411e;};'use strict';var Sequelize=require(_0x382a('0x0'));module[_0x382a('0x1')]={'uniqueid':{'type':Sequelize[_0x382a('0x2')]},'body':{'type':Sequelize[_0x382a('0x3')](_0x382a('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x382a('0x5')]('in',_0x382a('0x6')),'defaultValue':_0x382a('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 a43ba08..7d344fc 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 _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 +var _0x2277=['ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','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','save','update','stack','name','index','rawAttributes','type','key','map','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','options','SquareMessage','count','then','includeAll','rows','catch','show','params','keys','include','merge','create','body','destroy','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x343fc0,_0x555cc6){var _0x28f5f4=function(_0x132bd7){while(--_0x132bd7){_0x343fc0['push'](_0x343fc0['shift']());}};_0x28f5f4(++_0x555cc6);}(_0x2277,0x121));var _0x7227=function(_0x6f8421,_0x1c5cd9){_0x6f8421=_0x6f8421-0x0;var _0x298060=_0x2277[_0x6f8421];return _0x298060;};'use strict';var pdf=require(_0x7227('0x0'));var emlformat=require(_0x7227('0x1'));var rimraf=require(_0x7227('0x2'));var zipdir=require(_0x7227('0x3'));var jsonpatch=require(_0x7227('0x4'));var rp=require('request-promise');var moment=require(_0x7227('0x5'));var BPromise=require(_0x7227('0x6'));var Mustache=require(_0x7227('0x7'));var util=require(_0x7227('0x8'));var path=require(_0x7227('0x9'));var sox=require(_0x7227('0xa'));var csv=require('to-csv');var ejs=require(_0x7227('0xb'));var fs=require('fs');var _=require(_0x7227('0xc'));var squel=require(_0x7227('0xd'));var crypto=require(_0x7227('0xe'));var jsforce=require(_0x7227('0xf'));var deskjs=require(_0x7227('0x10'));var toCsv=require(_0x7227('0x11'));var querystring=require(_0x7227('0x12'));var Papa=require('papaparse');var Redis=require(_0x7227('0x13'));var authService=require(_0x7227('0x14'));var qs=require(_0x7227('0x15'));var as=require(_0x7227('0x16'));var hardwareService=require(_0x7227('0x17'));var logger=require(_0x7227('0x18'))('api');var utils=require(_0x7227('0x19'));var config=require(_0x7227('0x1a'));var db=require(_0x7227('0x1b'))['db'];function respondWithStatusCode(_0x4596d3,_0x5be9d4){_0x5be9d4=_0x5be9d4||0xcc;return function(_0x33ef31){if(_0x33ef31){return _0x4596d3[_0x7227('0x1c')](_0x5be9d4);}return _0x4596d3[_0x7227('0x1d')](_0x5be9d4)[_0x7227('0x1e')]();};}function respondWithResult(_0x51377c,_0x46df51){_0x46df51=_0x46df51||0xc8;return function(_0x224f6a){if(_0x224f6a){return _0x51377c[_0x7227('0x1d')](_0x46df51)[_0x7227('0x1f')](_0x224f6a);}};}function respondWithFilteredResult(_0x5b9702,_0x34020a){return function(_0x19d6f8){if(_0x19d6f8){var _0x1a3812=_0x19d6f8['count'],_0x3af338=_0x34020a[_0x7227('0x20')],_0x2e6bfc=_0x34020a[_0x7227('0x20')]+_0x34020a[_0x7227('0x21')],_0x4e327d;if(_0x2e6bfc>=_0x1a3812){_0x2e6bfc=_0x1a3812;_0x4e327d=0xc8;}else{_0x4e327d=0xce;}_0x5b9702[_0x7227('0x1d')](_0x4e327d);return _0x5b9702[_0x7227('0x22')](_0x7227('0x23'),_0x3af338+'-'+_0x2e6bfc+'/'+_0x1a3812)[_0x7227('0x1f')](_0x19d6f8);}return null;};}function patchUpdates(_0x5d49de){return function(_0x44c66d){try{jsonpatch[_0x7227('0x24')](_0x44c66d,_0x5d49de,!![]);}catch(_0x5ae68f){return BPromise['reject'](_0x5ae68f);}return _0x44c66d[_0x7227('0x25')]();};}function saveUpdates(_0x9bf896,_0x3e2ac8){return function(_0x1ed639){if(_0x1ed639){return _0x1ed639[_0x7227('0x26')](_0x9bf896)['then'](function(_0x3c9fdf){return _0x3c9fdf;});}return null;};}function removeEntity(_0x317e59,_0x23b66e){return function(_0xae1a68){if(_0xae1a68){return _0xae1a68['destroy']()['then'](function(){_0x317e59[_0x7227('0x1d')](0xcc)[_0x7227('0x1e')]();});}};}function handleEntityNotFound(_0xf2d4f2,_0x54ffcc){return function(_0x170807){if(!_0x170807){_0xf2d4f2[_0x7227('0x1c')](0x194);}return _0x170807;};}function handleError(_0x12dbbe,_0x49d3ab){_0x49d3ab=_0x49d3ab||0x1f4;return function(_0x390d7b){logger['error'](_0x390d7b[_0x7227('0x27')]);if(_0x390d7b[_0x7227('0x28')]){delete _0x390d7b['name'];}_0x12dbbe['status'](_0x49d3ab)['send'](_0x390d7b);};}exports[_0x7227('0x29')]=function(_0x4db380,_0x106809){var _0x5ac51e={},_0x34e955={},_0xe57195={'count':0x0,'rows':[]};var _0x51d44f=_['map'](db['SquareMessage'][_0x7227('0x2a')],function(_0x36ca28){return{'name':_0x36ca28['fieldName'],'type':_0x36ca28[_0x7227('0x2b')][_0x7227('0x2c')]};});_0x34e955['model']=_[_0x7227('0x2d')](_0x51d44f,_0x7227('0x28'));_0x34e955[_0x7227('0x2e')]=_['keys'](_0x4db380[_0x7227('0x2e')]);_0x34e955[_0x7227('0x2f')]=_[_0x7227('0x30')](_0x34e955[_0x7227('0x31')],_0x34e955[_0x7227('0x2e')]);_0x5ac51e[_0x7227('0x32')]=_[_0x7227('0x30')](_0x34e955[_0x7227('0x31')],qs[_0x7227('0x33')](_0x4db380[_0x7227('0x2e')][_0x7227('0x33')]));_0x5ac51e[_0x7227('0x32')]=_0x5ac51e['attributes'][_0x7227('0x34')]?_0x5ac51e['attributes']:_0x34e955[_0x7227('0x31')];if(!_0x4db380[_0x7227('0x2e')]['hasOwnProperty'](_0x7227('0x35'))){_0x5ac51e[_0x7227('0x21')]=qs[_0x7227('0x21')](_0x4db380['query'][_0x7227('0x21')]);_0x5ac51e[_0x7227('0x20')]=qs[_0x7227('0x20')](_0x4db380[_0x7227('0x2e')][_0x7227('0x20')]);}_0x5ac51e[_0x7227('0x36')]=qs[_0x7227('0x37')](_0x4db380[_0x7227('0x2e')][_0x7227('0x37')]);_0x5ac51e['where']=qs[_0x7227('0x2f')](_[_0x7227('0x38')](_0x4db380[_0x7227('0x2e')],_0x34e955[_0x7227('0x2f')]),_0x51d44f);if(_0x4db380[_0x7227('0x2e')][_0x7227('0x39')]){_0x5ac51e[_0x7227('0x3a')]=_['merge'](_0x5ac51e[_0x7227('0x3a')],{'$or':_['map'](_0x51d44f,function(_0x5661c8){if(_0x5661c8[_0x7227('0x2b')]!=='VIRTUAL'){var _0x5a6799={};_0x5a6799[_0x5661c8[_0x7227('0x28')]]={'$like':'%'+_0x4db380[_0x7227('0x2e')][_0x7227('0x39')]+'%'};return _0x5a6799;}})});}_0x5ac51e=_['merge']({},_0x5ac51e,_0x4db380[_0x7227('0x3b')]);var _0x1eddd3={'where':_0x5ac51e[_0x7227('0x3a')]};return db[_0x7227('0x3c')][_0x7227('0x3d')](_0x1eddd3)[_0x7227('0x3e')](function(_0x583574){_0xe57195[_0x7227('0x3d')]=_0x583574;if(_0x4db380[_0x7227('0x2e')][_0x7227('0x3f')]){_0x5ac51e['include']=[{'all':!![]}];}return db[_0x7227('0x3c')]['findAll'](_0x5ac51e);})[_0x7227('0x3e')](function(_0x298d26){_0xe57195[_0x7227('0x40')]=_0x298d26;return _0xe57195;})[_0x7227('0x3e')](respondWithFilteredResult(_0x106809,_0x5ac51e))[_0x7227('0x41')](handleError(_0x106809,null));};exports[_0x7227('0x42')]=function(_0x5811e0,_0x50f9a3){var _0x9928cc={'raw':!![],'where':{'id':_0x5811e0[_0x7227('0x43')]['id']}},_0x316407={};_0x316407[_0x7227('0x31')]=_[_0x7227('0x44')](db['SquareMessage'][_0x7227('0x2a')]);_0x316407['query']=_[_0x7227('0x44')](_0x5811e0[_0x7227('0x2e')]);_0x316407[_0x7227('0x2f')]=_[_0x7227('0x30')](_0x316407[_0x7227('0x31')],_0x316407[_0x7227('0x2e')]);_0x9928cc['attributes']=_[_0x7227('0x30')](_0x316407[_0x7227('0x31')],qs['fields'](_0x5811e0[_0x7227('0x2e')][_0x7227('0x33')]));_0x9928cc[_0x7227('0x32')]=_0x9928cc[_0x7227('0x32')]['length']?_0x9928cc[_0x7227('0x32')]:_0x316407[_0x7227('0x31')];if(_0x5811e0[_0x7227('0x2e')][_0x7227('0x3f')]){_0x9928cc[_0x7227('0x45')]=[{'all':!![]}];}_0x9928cc=_[_0x7227('0x46')]({},_0x9928cc,_0x5811e0[_0x7227('0x3b')]);return db['SquareMessage']['find'](_0x9928cc)[_0x7227('0x3e')](handleEntityNotFound(_0x50f9a3,null))['then'](respondWithResult(_0x50f9a3,null))['catch'](handleError(_0x50f9a3,null));};exports[_0x7227('0x47')]=function(_0x23d15a,_0x225388){return db['SquareMessage'][_0x7227('0x47')](_0x23d15a['body'],{})['then'](respondWithResult(_0x225388,0xc9))[_0x7227('0x41')](handleError(_0x225388,null));};exports[_0x7227('0x26')]=function(_0x7ecb49,_0x3f3186){if(_0x7ecb49[_0x7227('0x48')]['id']){delete _0x7ecb49[_0x7227('0x48')]['id'];}return db[_0x7227('0x3c')]['find']({'where':{'id':_0x7ecb49[_0x7227('0x43')]['id']}})[_0x7227('0x3e')](handleEntityNotFound(_0x3f3186,null))['then'](saveUpdates(_0x7ecb49[_0x7227('0x48')],null))[_0x7227('0x3e')](respondWithResult(_0x3f3186,null))[_0x7227('0x41')](handleError(_0x3f3186,null));};exports[_0x7227('0x49')]=function(_0xc09fcc,_0x4ffa55){return db[_0x7227('0x3c')][_0x7227('0x4a')]({'where':{'id':_0xc09fcc[_0x7227('0x43')]['id']}})['then'](handleEntityNotFound(_0x4ffa55,null))[_0x7227('0x3e')](removeEntity(_0x4ffa55,null))[_0x7227('0x41')](handleError(_0x4ffa55,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 09da8b3..0540900 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 _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 +var _0xfd74=['rimraf','../../config/environment','./squareMessage.attributes','exports','SquareMessage','square_messages','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x2baa22,_0x98a3d1){var _0x15df18=function(_0x2d02f5){while(--_0x2d02f5){_0x2baa22['push'](_0x2baa22['shift']());}};_0x15df18(++_0x98a3d1);}(_0xfd74,0x156));var _0x4fd7=function(_0x32f9ca,_0x2fa8bc){_0x32f9ca=_0x32f9ca-0x0;var _0x52e083=_0xfd74[_0x32f9ca];return _0x52e083;};'use strict';var _=require('lodash');var util=require(_0x4fd7('0x0'));var logger=require(_0x4fd7('0x1'))('api');var moment=require(_0x4fd7('0x2'));var BPromise=require(_0x4fd7('0x3'));var rp=require(_0x4fd7('0x4'));var fs=require('fs');var path=require(_0x4fd7('0x5'));var rimraf=require(_0x4fd7('0x6'));var config=require(_0x4fd7('0x7'));var attributes=require(_0x4fd7('0x8'));module[_0x4fd7('0x9')]=function(_0xc9245d,_0x491b01){return _0xc9245d['define'](_0x4fd7('0xa'),attributes,{'tableName':_0x4fd7('0xb'),'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 bda64b1..0a2c208 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 _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 +var _0xc6c0=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','lodash'];(function(_0x5e4e77,_0x1b84cd){var _0x29074c=function(_0x1c3941){while(--_0x1c3941){_0x5e4e77['push'](_0x5e4e77['shift']());}};_0x29074c(++_0x1b84cd);}(_0xc6c0,0x13e));var _0x0c6c=function(_0x5dc03e,_0x54e60c){_0x5dc03e=_0x5dc03e-0x0;var _0x466a07=_0xc6c0[_0x5dc03e];return _0x466a07;};'use strict';var _=require(_0x0c6c('0x0'));var util=require('util');var moment=require(_0x0c6c('0x1'));var BPromise=require(_0x0c6c('0x2'));var rs=require(_0x0c6c('0x3'));var fs=require('fs');var Redis=require(_0x0c6c('0x4'));var db=require(_0x0c6c('0x5'))['db'];var utils=require(_0x0c6c('0x6'));var logger=require(_0x0c6c('0x7'))(_0x0c6c('0x8'));var config=require(_0x0c6c('0x9'));var jayson=require(_0x0c6c('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1791cb,_0x223b4f,_0x51208d){return new BPromise(function(_0x2e0cd9,_0x15c862){return client[_0x0c6c('0xb')](_0x1791cb,_0x51208d)[_0x0c6c('0xc')](function(_0x317bcf){logger[_0x0c6c('0xd')](_0x0c6c('0xe'),_0x223b4f,_0x0c6c('0xf'));logger[_0x0c6c('0x10')](_0x0c6c('0x11'),_0x223b4f,_0x0c6c('0xf'),JSON[_0x0c6c('0x12')](_0x317bcf));if(_0x317bcf['error']){if(_0x317bcf[_0x0c6c('0x13')]['code']===0x1f4){logger[_0x0c6c('0x13')](_0x0c6c('0xe'),_0x223b4f,_0x317bcf['error'][_0x0c6c('0x14')]);return _0x15c862(_0x317bcf[_0x0c6c('0x13')][_0x0c6c('0x14')]);}logger[_0x0c6c('0x13')](_0x0c6c('0xe'),_0x223b4f,_0x317bcf['error'][_0x0c6c('0x14')]);return _0x2e0cd9(_0x317bcf[_0x0c6c('0x13')][_0x0c6c('0x14')]);}else{logger[_0x0c6c('0xd')](_0x0c6c('0xe'),_0x223b4f,_0x0c6c('0xf'));_0x2e0cd9(_0x317bcf[_0x0c6c('0x15')]['message']);}})[_0x0c6c('0x16')](function(_0x527ade){logger['error']('SquareMessage,\x20%s,\x20%s',_0x223b4f,_0x527ade);_0x15c862(_0x527ade);});});}exports[_0x0c6c('0x17')]=function(_0x530333){var _0x9463e8=this;return new Promise(function(_0x50be43,_0x316dbe){return db[_0x0c6c('0x18')][_0x0c6c('0x19')](_0x530333[_0x0c6c('0x1a')],{'raw':_0x530333['options']?_0x530333[_0x0c6c('0x1b')][_0x0c6c('0x1c')]===undefined?!![]:![]:!![]})[_0x0c6c('0xc')](function(_0x1280fb){logger[_0x0c6c('0xd')](_0x0c6c('0x17'),_0x530333);logger[_0x0c6c('0x10')](_0x0c6c('0x17'),_0x530333,JSON[_0x0c6c('0x12')](_0x1280fb));_0x50be43(_0x1280fb);})['catch'](function(_0x323854){logger[_0x0c6c('0x13')](_0x0c6c('0x17'),_0x323854['message'],_0x530333);_0x316dbe(_0x9463e8[_0x0c6c('0x13')](0x1f4,_0x323854['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 415b499..d028585 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 _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 +var _0x1e1a=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','isAuthenticated','get','show','/:id/test','15s','test','post','create','put','/:id','update','delete'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x1e1a,0x86));var _0xa1e1=function(_0x40c28b,_0x30cdfa){_0x40c28b=_0x40c28b-0x0;var _0x53704f=_0x1e1a[_0x40c28b];return _0x53704f;};'use strict';var multer=require(_0xa1e1('0x0'));var util=require(_0xa1e1('0x1'));var path=require(_0xa1e1('0x2'));var timeout=require(_0xa1e1('0x3'));var express=require('express');var router=express[_0xa1e1('0x4')]();var auth=require(_0xa1e1('0x5'));var interaction=require(_0xa1e1('0x6'));var config=require('../../config/environment');var controller=require(_0xa1e1('0x7'));router['get']('/',auth[_0xa1e1('0x8')](),controller['index']);router[_0xa1e1('0x9')]('/:id',auth[_0xa1e1('0x8')](),controller[_0xa1e1('0xa')]);router[_0xa1e1('0x9')](_0xa1e1('0xb'),auth[_0xa1e1('0x8')](),timeout(_0xa1e1('0xc')),controller[_0xa1e1('0xd')]);router[_0xa1e1('0xe')]('/',auth[_0xa1e1('0x8')](),controller[_0xa1e1('0xf')]);router[_0xa1e1('0x10')](_0xa1e1('0x11'),auth[_0xa1e1('0x8')](),controller[_0xa1e1('0x12')]);router[_0xa1e1('0x13')](_0xa1e1('0x11'),auth[_0xa1e1('0x8')](),controller[_0xa1e1('0x14')]);module[_0xa1e1('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 d85f33f..84c7451 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 _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 +var _0xfa99=['exports','STRING','name','sequelize'];(function(_0x5a78f3,_0x19e237){var _0x2ea856=function(_0x5c3ba6){while(--_0x5c3ba6){_0x5a78f3['push'](_0x5a78f3['shift']());}};_0x2ea856(++_0x19e237);}(_0xfa99,0x1cf));var _0x9fa9=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xfa99[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x9fa9('0x0'));module[_0x9fa9('0x1')]={'name':{'type':Sequelize[_0x9fa9('0x2')],'unique':_0x9fa9('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x9fa9('0x2')]},'description':{'type':Sequelize[_0x9fa9('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 2feeedb..5c85fa0 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 _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 +var _0xa183=['odbc','openSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','set','save','update','then','destroy','ODBC','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','SquareOdbc','findAll','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn'];(function(_0x254081,_0x20731a){var _0x5d1e2a=function(_0x597854){while(--_0x597854){_0x254081['push'](_0x254081['shift']());}};_0x5d1e2a(++_0x20731a);}(_0xa183,0xaa));var _0x3a18=function(_0x2044db,_0x712bbc){_0x2044db=_0x2044db-0x0;var _0x2be1ec=_0xa183[_0x2044db];return _0x2be1ec;};'use strict';var pdf=require(_0x3a18('0x0'));var emlformat=require(_0x3a18('0x1'));var rimraf=require(_0x3a18('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3a18('0x3'));var rp=require(_0x3a18('0x4'));var moment=require(_0x3a18('0x5'));var BPromise=require(_0x3a18('0x6'));var Mustache=require(_0x3a18('0x7'));var util=require('util');var path=require(_0x3a18('0x8'));var sox=require(_0x3a18('0x9'));var csv=require(_0x3a18('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3a18('0xb'));var squel=require(_0x3a18('0xc'));var crypto=require(_0x3a18('0xd'));var jsforce=require(_0x3a18('0xe'));var deskjs=require(_0x3a18('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3a18('0x10'));var Papa=require(_0x3a18('0x11'));var Redis=require(_0x3a18('0x12'));var authService=require(_0x3a18('0x13'));var qs=require(_0x3a18('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3a18('0x15'));var logger=require('../../config/logger')(_0x3a18('0x16'));var utils=require(_0x3a18('0x17'));var config=require(_0x3a18('0x18'));var db=require(_0x3a18('0x19'))['db'];function respondWithStatusCode(_0x188941,_0x4454fb){_0x4454fb=_0x4454fb||0xcc;return function(_0x18c6d5){if(_0x18c6d5){return _0x188941['sendStatus'](_0x4454fb);}return _0x188941[_0x3a18('0x1a')](_0x4454fb)[_0x3a18('0x1b')]();};}function respondWithResult(_0x1d2033,_0x27c061){_0x27c061=_0x27c061||0xc8;return function(_0x386691){if(_0x386691){return _0x1d2033[_0x3a18('0x1a')](_0x27c061)[_0x3a18('0x1c')](_0x386691);}};}function respondWithFilteredResult(_0x2d419e,_0x3c8017){return function(_0x5b500a){if(_0x5b500a){var _0x3f2eb2=_0x5b500a[_0x3a18('0x1d')],_0x170848=_0x3c8017[_0x3a18('0x1e')],_0x5427bb=_0x3c8017[_0x3a18('0x1e')]+_0x3c8017['limit'],_0x589fc0;if(_0x5427bb>=_0x3f2eb2){_0x5427bb=_0x3f2eb2;_0x589fc0=0xc8;}else{_0x589fc0=0xce;}_0x2d419e[_0x3a18('0x1a')](_0x589fc0);return _0x2d419e[_0x3a18('0x1f')]('Content-Range',_0x170848+'-'+_0x5427bb+'/'+_0x3f2eb2)[_0x3a18('0x1c')](_0x5b500a);}return null;};}function patchUpdates(_0x1780af){return function(_0xf61bef){try{jsonpatch['apply'](_0xf61bef,_0x1780af,!![]);}catch(_0x5b6897){return BPromise['reject'](_0x5b6897);}return _0xf61bef[_0x3a18('0x20')]();};}function saveUpdates(_0x22ed8e,_0xa3cdbf){return function(_0x4fd99a){if(_0x4fd99a){return _0x4fd99a[_0x3a18('0x21')](_0x22ed8e)[_0x3a18('0x22')](function(_0x5d0872){return _0x5d0872;});}return null;};}function removeEntity(_0x5c6ef2,_0x565a39){return function(_0x1ab3df){if(_0x1ab3df){return _0x1ab3df[_0x3a18('0x23')]()[_0x3a18('0x22')](function(){var _0x14e4a1=_0x1ab3df['get']({'plain':!![]});var _0x4bd82a=_0x3a18('0x24');return db[_0x3a18('0x25')][_0x3a18('0x23')]({'where':{'type':_0x4bd82a,'resourceId':_0x14e4a1['id']}})['then'](function(){return _0x1ab3df;});})['then'](function(){_0x5c6ef2[_0x3a18('0x1a')](0xcc)[_0x3a18('0x1b')]();});}};}function handleEntityNotFound(_0x109ddc,_0x104c02){return function(_0x2096e9){if(!_0x2096e9){_0x109ddc['sendStatus'](0x194);}return _0x2096e9;};}function handleError(_0x38a4f1,_0x8e02fd){_0x8e02fd=_0x8e02fd||0x1f4;return function(_0x43e77f){logger[_0x3a18('0x26')](_0x43e77f[_0x3a18('0x27')]);if(_0x43e77f[_0x3a18('0x28')]){delete _0x43e77f[_0x3a18('0x28')];}_0x38a4f1[_0x3a18('0x1a')](_0x8e02fd)[_0x3a18('0x29')](_0x43e77f);};}exports['index']=function(_0x55551e,_0x157927){var _0xcb53e1={},_0x144960={},_0x3390ff={'count':0x0,'rows':[]};var _0x3aef93=_[_0x3a18('0x2a')](db['SquareOdbc'][_0x3a18('0x2b')],function(_0x448d20){return{'name':_0x448d20[_0x3a18('0x2c')],'type':_0x448d20[_0x3a18('0x2d')][_0x3a18('0x2e')]};});_0x144960[_0x3a18('0x2f')]=_[_0x3a18('0x2a')](_0x3aef93,'name');_0x144960['query']=_[_0x3a18('0x30')](_0x55551e[_0x3a18('0x31')]);_0x144960['filters']=_['intersection'](_0x144960[_0x3a18('0x2f')],_0x144960['query']);_0xcb53e1[_0x3a18('0x32')]=_[_0x3a18('0x33')](_0x144960[_0x3a18('0x2f')],qs[_0x3a18('0x34')](_0x55551e['query'][_0x3a18('0x34')]));_0xcb53e1[_0x3a18('0x32')]=_0xcb53e1[_0x3a18('0x32')][_0x3a18('0x35')]?_0xcb53e1[_0x3a18('0x32')]:_0x144960[_0x3a18('0x2f')];if(!_0x55551e[_0x3a18('0x31')][_0x3a18('0x36')](_0x3a18('0x37'))){_0xcb53e1['limit']=qs[_0x3a18('0x38')](_0x55551e[_0x3a18('0x31')][_0x3a18('0x38')]);_0xcb53e1[_0x3a18('0x1e')]=qs[_0x3a18('0x1e')](_0x55551e[_0x3a18('0x31')]['offset']);}_0xcb53e1['order']=qs[_0x3a18('0x39')](_0x55551e[_0x3a18('0x31')][_0x3a18('0x39')]);_0xcb53e1['where']=qs[_0x3a18('0x3a')](_['pick'](_0x55551e[_0x3a18('0x31')],_0x144960['filters']),_0x3aef93);if(_0x55551e[_0x3a18('0x31')][_0x3a18('0x3b')]){_0xcb53e1[_0x3a18('0x3c')]=_[_0x3a18('0x3d')](_0xcb53e1[_0x3a18('0x3c')],{'$or':_[_0x3a18('0x2a')](_0x3aef93,function(_0x59c5f0){if(_0x59c5f0[_0x3a18('0x2d')]!==_0x3a18('0x3e')){var _0x2b0ce3={};_0x2b0ce3[_0x59c5f0[_0x3a18('0x28')]]={'$like':'%'+_0x55551e[_0x3a18('0x31')][_0x3a18('0x3b')]+'%'};return _0x2b0ce3;}})});}_0xcb53e1=_['merge']({},_0xcb53e1,_0x55551e[_0x3a18('0x3f')]);var _0x172ec2={'where':_0xcb53e1[_0x3a18('0x3c')]};return db['SquareOdbc']['count'](_0x172ec2)[_0x3a18('0x22')](function(_0xb427f9){_0x3390ff['count']=_0xb427f9;if(_0x55551e[_0x3a18('0x31')][_0x3a18('0x40')]){_0xcb53e1[_0x3a18('0x41')]=[{'all':!![]}];}return db[_0x3a18('0x42')][_0x3a18('0x43')](_0xcb53e1);})[_0x3a18('0x22')](function(_0x169ae7){_0x3390ff['rows']=_0x169ae7;return _0x3390ff;})[_0x3a18('0x22')](respondWithFilteredResult(_0x157927,_0xcb53e1))[_0x3a18('0x44')](handleError(_0x157927,null));};exports[_0x3a18('0x45')]=function(_0x278e2e,_0x48678f){var _0x7d789a={'raw':!![],'where':{'id':_0x278e2e[_0x3a18('0x46')]['id']}},_0x1f669d={};_0x1f669d[_0x3a18('0x2f')]=_[_0x3a18('0x30')](db[_0x3a18('0x42')]['rawAttributes']);_0x1f669d[_0x3a18('0x31')]=_[_0x3a18('0x30')](_0x278e2e[_0x3a18('0x31')]);_0x1f669d[_0x3a18('0x3a')]=_[_0x3a18('0x33')](_0x1f669d['model'],_0x1f669d[_0x3a18('0x31')]);_0x7d789a[_0x3a18('0x32')]=_[_0x3a18('0x33')](_0x1f669d[_0x3a18('0x2f')],qs['fields'](_0x278e2e[_0x3a18('0x31')]['fields']));_0x7d789a[_0x3a18('0x32')]=_0x7d789a[_0x3a18('0x32')][_0x3a18('0x35')]?_0x7d789a[_0x3a18('0x32')]:_0x1f669d['model'];if(_0x278e2e[_0x3a18('0x31')][_0x3a18('0x40')]){_0x7d789a[_0x3a18('0x41')]=[{'all':!![]}];}_0x7d789a=_[_0x3a18('0x3d')]({},_0x7d789a,_0x278e2e[_0x3a18('0x3f')]);return db['SquareOdbc'][_0x3a18('0x47')](_0x7d789a)['then'](handleEntityNotFound(_0x48678f,null))[_0x3a18('0x22')](respondWithResult(_0x48678f,null))[_0x3a18('0x44')](handleError(_0x48678f,null));};exports['create']=function(_0x36afb9,_0x362ab3){return db[_0x3a18('0x42')][_0x3a18('0x48')](_0x36afb9[_0x3a18('0x49')],{})['then'](function(_0x83af53){var _0x6fa23a=_0x36afb9[_0x3a18('0x4a')][_0x3a18('0x4b')]({'plain':!![]});if(!_0x6fa23a)throw new Error(_0x3a18('0x4c'));if(_0x6fa23a[_0x3a18('0x4d')]===_0x3a18('0x4a')){var _0x38aa25=_0x83af53[_0x3a18('0x4b')]({'plain':!![]});var _0x480b7f='ODBC';return db['UserProfileSection'][_0x3a18('0x47')]({'where':{'name':_0x480b7f,'userProfileId':_0x6fa23a['userProfileId']},'raw':!![]})[_0x3a18('0x22')](function(_0x320c06){if(_0x320c06&&_0x320c06[_0x3a18('0x4e')]===0x0){return db['UserProfileResource'][_0x3a18('0x48')]({'name':_0x38aa25[_0x3a18('0x28')],'resourceId':_0x38aa25['id'],'type':_0x320c06[_0x3a18('0x28')],'sectionId':_0x320c06['id']},{})['then'](function(){return _0x83af53;});}else{return _0x83af53;}})[_0x3a18('0x44')](function(_0x17ae0b){logger[_0x3a18('0x26')](_0x3a18('0x4f'),_0x17ae0b);throw _0x17ae0b;});}return _0x83af53;})[_0x3a18('0x22')](respondWithResult(_0x362ab3,0xc9))['catch'](handleError(_0x362ab3,null));};exports['update']=function(_0x26c760,_0x1b115b){if(_0x26c760[_0x3a18('0x49')]['id']){delete _0x26c760[_0x3a18('0x49')]['id'];}return db[_0x3a18('0x42')]['find']({'where':{'id':_0x26c760[_0x3a18('0x46')]['id']}})[_0x3a18('0x22')](handleEntityNotFound(_0x1b115b,null))['then'](saveUpdates(_0x26c760[_0x3a18('0x49')],null))['then'](respondWithResult(_0x1b115b,null))[_0x3a18('0x44')](handleError(_0x1b115b,null));};exports[_0x3a18('0x23')]=function(_0x51fe1c,_0x1c05da){return db['SquareOdbc'][_0x3a18('0x47')]({'where':{'id':_0x51fe1c[_0x3a18('0x46')]['id']}})[_0x3a18('0x22')](handleEntityNotFound(_0x1c05da,null))[_0x3a18('0x22')](removeEntity(_0x1c05da,null))['catch'](handleError(_0x1c05da,null));};exports[_0x3a18('0x50')]=function(_0xb89ce4,_0xc3ee78,_0x5bdba8){var _0x41aede;return db['SquareOdbc']['find']({'where':{'id':_0xb89ce4[_0x3a18('0x46')]['id']},'attributes':['id',_0x3a18('0x51')]})[_0x3a18('0x22')](handleEntityNotFound(_0xc3ee78,null))['then'](function(_0x2de11a){if(_0x2de11a){var _0xae7075=require(_0x3a18('0x52'))();_0xae7075[_0x3a18('0x53')](_0x2de11a[_0x3a18('0x51')]);_0xae7075['closeSync']();return _0x2de11a;}})['then'](respondWithResult(_0xc3ee78,null))[_0x3a18('0x44')](handleError(_0xc3ee78,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index a1d7cf2..a208721 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 _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 +var _0x9ed0=['square_odbc','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc'];(function(_0x340308,_0x576102){var _0x1424c5=function(_0x4c214d){while(--_0x4c214d){_0x340308['push'](_0x340308['shift']());}};_0x1424c5(++_0x576102);}(_0x9ed0,0xe1));var _0x09ed=function(_0x155e04,_0x28cd61){_0x155e04=_0x155e04-0x0;var _0x4590d0=_0x9ed0[_0x155e04];return _0x4590d0;};'use strict';var _=require(_0x09ed('0x0'));var util=require(_0x09ed('0x1'));var logger=require(_0x09ed('0x2'))(_0x09ed('0x3'));var moment=require(_0x09ed('0x4'));var BPromise=require(_0x09ed('0x5'));var rp=require(_0x09ed('0x6'));var fs=require('fs');var path=require(_0x09ed('0x7'));var rimraf=require('rimraf');var config=require(_0x09ed('0x8'));var attributes=require(_0x09ed('0x9'));module[_0x09ed('0xa')]=function(_0x41eb8c,_0x95ea90){return _0x41eb8c[_0x09ed('0xb')](_0x09ed('0xc'),attributes,{'tableName':_0x09ed('0xd'),'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 2151159..bb106fe 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 _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 +var _0x7217=['where','attributes','map','include','model','ShowSquareOdbc','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareOdbc','find','options','raw'];(function(_0x386628,_0x31b5f0){var _0x1ff37b=function(_0x337cea){while(--_0x337cea){_0x386628['push'](_0x386628['shift']());}};_0x1ff37b(++_0x31b5f0);}(_0x7217,0x19e));var _0x7721=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x7217[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowSquareOdbc']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowSquareOdbc',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index e5dcf8b..7dbb7fb 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 _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 +var _0xb574=['getUsers','post','create','addUsers','put','/:id','delete','destroy','removeUsers','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','/:id/users','isAuthenticated'];(function(_0x443547,_0x21d7a8){var _0x1423a8=function(_0x2f8d47){while(--_0x2f8d47){_0x443547['push'](_0x443547['shift']());}};_0x1423a8(++_0x21d7a8);}(_0xb574,0x106));var _0x4b57=function(_0x9c4ce4,_0x4a8da2){_0x9c4ce4=_0x9c4ce4-0x0;var _0x2ed040=_0xb574[_0x9c4ce4];return _0x2ed040;};'use strict';var multer=require(_0x4b57('0x0'));var util=require(_0x4b57('0x1'));var path=require('path');var timeout=require(_0x4b57('0x2'));var express=require(_0x4b57('0x3'));var router=express['Router']();var auth=require(_0x4b57('0x4'));var interaction=require(_0x4b57('0x5'));var config=require(_0x4b57('0x6'));var controller=require(_0x4b57('0x7'));router[_0x4b57('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4b57('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x4b57('0x9'),auth[_0x4b57('0xa')](),controller[_0x4b57('0xb')]);router[_0x4b57('0xc')]('/',auth[_0x4b57('0xa')](),controller[_0x4b57('0xd')]);router[_0x4b57('0xc')](_0x4b57('0x9'),auth['isAuthenticated'](),controller[_0x4b57('0xe')]);router[_0x4b57('0xf')](_0x4b57('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x4b57('0x11')](_0x4b57('0x10'),auth[_0x4b57('0xa')](),controller[_0x4b57('0x12')]);router[_0x4b57('0x11')](_0x4b57('0x9'),auth[_0x4b57('0xa')](),controller[_0x4b57('0x13')]);module[_0x4b57('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 6a7f14b..04c85a2 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 _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 +var _0x22cb=['production','utf8','sequelize','exports','STRING','TEXT','long','getDataValue','preproduction','toString','BLOB'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x22cb,0x65));var _0xb22c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x22cb[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xb22c('0x0'));module[_0xb22c('0x1')]={'name':{'type':Sequelize[_0xb22c('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xb22c('0x2')]},'notes':{'type':Sequelize[_0xb22c('0x3')]},'preproduction':{'type':Sequelize['BLOB'](_0xb22c('0x4')),'get':function(){if(this[_0xb22c('0x5')](_0xb22c('0x6'))){return this[_0xb22c('0x5')](_0xb22c('0x6'))[_0xb22c('0x7')]('utf8');}}},'production':{'type':Sequelize[_0xb22c('0x8')](_0xb22c('0x4')),'get':function(){if(this['getDataValue']('production')){return this['getDataValue'](_0xb22c('0x9'))[_0xb22c('0x7')](_0xb22c('0xa'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 5f6af6b..cb94bb9 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 _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 +var _0x99a1=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','user','get','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addUsers','ids','omit','removeUsers','isArray','userSquareProject:remove','emit','getUsers','findOne','eml-format','fast-json-patch','moment','bluebird','mustache','sox','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','defaults','redis','localhost','./squareProject.socket','register','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','SquareProjects','UserProfileResource','then','error','stack','name','send','map','SquareProject','fieldName'];(function(_0x47355d,_0x538398){var _0x4badc1=function(_0x41a4d2){while(--_0x41a4d2){_0x47355d['push'](_0x47355d['shift']());}};_0x4badc1(++_0x538398);}(_0x99a1,0x1f4));var _0x199a=function(_0x2ce705,_0x3a0316){_0x2ce705=_0x2ce705-0x0;var _0x3e70fb=_0x99a1[_0x2ce705];return _0x3e70fb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x199a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x199a('0x1'));var rp=require('request-promise');var moment=require(_0x199a('0x2'));var BPromise=require(_0x199a('0x3'));var Mustache=require(_0x199a('0x4'));var util=require('util');var path=require('path');var sox=require(_0x199a('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x199a('0x6'));var squel=require('squel');var crypto=require(_0x199a('0x7'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x199a('0x8'));var querystring=require(_0x199a('0x9'));var Papa=require(_0x199a('0xa'));var Redis=require(_0x199a('0xb'));var authService=require(_0x199a('0xc'));var qs=require(_0x199a('0xd'));var as=require(_0x199a('0xe'));var hardwareService=require(_0x199a('0xf'));var logger=require(_0x199a('0x10'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0x199a('0x11')](config[_0x199a('0x12')],{'host':_0x199a('0x13'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x199a('0x12')]));require(_0x199a('0x14'))[_0x199a('0x15')](socket);function respondWithStatusCode(_0x3ba25a,_0x21db0a){_0x21db0a=_0x21db0a||0xcc;return function(_0x2261ca){if(_0x2261ca){return _0x3ba25a[_0x199a('0x16')](_0x21db0a);}return _0x3ba25a['status'](_0x21db0a)[_0x199a('0x17')]();};}function respondWithResult(_0x511f7d,_0x57b7ff){_0x57b7ff=_0x57b7ff||0xc8;return function(_0x557e07){if(_0x557e07){return _0x511f7d[_0x199a('0x18')](_0x57b7ff)['json'](_0x557e07);}};}function respondWithFilteredResult(_0x52142a,_0x2048b3){return function(_0x3df5a3){if(_0x3df5a3){var _0xaeadb0=_0x3df5a3[_0x199a('0x19')],_0x4f5af8=_0x2048b3['offset'],_0x2ae2ee=_0x2048b3[_0x199a('0x1a')]+_0x2048b3[_0x199a('0x1b')],_0x134301;if(_0x2ae2ee>=_0xaeadb0){_0x2ae2ee=_0xaeadb0;_0x134301=0xc8;}else{_0x134301=0xce;}_0x52142a['status'](_0x134301);return _0x52142a[_0x199a('0x1c')](_0x199a('0x1d'),_0x4f5af8+'-'+_0x2ae2ee+'/'+_0xaeadb0)[_0x199a('0x1e')](_0x3df5a3);}return null;};}function patchUpdates(_0x3711a4){return function(_0x45ccbc){try{jsonpatch[_0x199a('0x1f')](_0x45ccbc,_0x3711a4,!![]);}catch(_0x562959){return BPromise[_0x199a('0x20')](_0x562959);}return _0x45ccbc[_0x199a('0x21')]();};}function saveUpdates(_0x55e7ec,_0x1ed173){return function(_0x2af592){if(_0x2af592){return _0x2af592[_0x199a('0x22')](_0x55e7ec)['then'](function(_0x1259c6){return _0x1259c6;});}return null;};}function removeEntity(_0xf08389,_0x21afa5){return function(_0x3f05db){if(_0x3f05db){return _0x3f05db[_0x199a('0x23')]()['then'](function(){var _0x4c12ca=_0x3f05db['get']({'plain':!![]});var _0x4dcaba=_0x199a('0x24');return db[_0x199a('0x25')][_0x199a('0x23')]({'where':{'type':_0x4dcaba,'resourceId':_0x4c12ca['id']}})[_0x199a('0x26')](function(){return _0x3f05db;});})[_0x199a('0x26')](function(){_0xf08389['status'](0xcc)[_0x199a('0x17')]();});}};}function handleEntityNotFound(_0x4228a4,_0x38c3e7){return function(_0x2453f6){if(!_0x2453f6){_0x4228a4[_0x199a('0x16')](0x194);}return _0x2453f6;};}function handleError(_0x4fc9af,_0x351bc9){_0x351bc9=_0x351bc9||0x1f4;return function(_0x16264a){logger[_0x199a('0x27')](_0x16264a[_0x199a('0x28')]);if(_0x16264a[_0x199a('0x29')]){delete _0x16264a[_0x199a('0x29')];}_0x4fc9af['status'](_0x351bc9)[_0x199a('0x2a')](_0x16264a);};}exports['index']=function(_0x396c71,_0x448a59){var _0x76e1da={},_0x52eb1b={},_0x1b3998={'count':0x0,'rows':[]};var _0x16d162=_[_0x199a('0x2b')](db[_0x199a('0x2c')]['rawAttributes'],function(_0x55c754){return{'name':_0x55c754[_0x199a('0x2d')],'type':_0x55c754[_0x199a('0x2e')][_0x199a('0x2f')]};});_0x52eb1b[_0x199a('0x30')]=_['map'](_0x16d162,'name');_0x52eb1b[_0x199a('0x31')]=_[_0x199a('0x32')](_0x396c71[_0x199a('0x31')]);_0x52eb1b[_0x199a('0x33')]=_[_0x199a('0x34')](_0x52eb1b[_0x199a('0x30')],_0x52eb1b[_0x199a('0x31')]);_0x76e1da[_0x199a('0x35')]=_[_0x199a('0x34')](_0x52eb1b[_0x199a('0x30')],qs[_0x199a('0x36')](_0x396c71[_0x199a('0x31')][_0x199a('0x36')]));_0x76e1da[_0x199a('0x35')]=_0x76e1da[_0x199a('0x35')][_0x199a('0x37')]?_0x76e1da[_0x199a('0x35')]:_0x52eb1b[_0x199a('0x30')];if(!_0x396c71[_0x199a('0x31')][_0x199a('0x38')](_0x199a('0x39'))){_0x76e1da['limit']=qs[_0x199a('0x1b')](_0x396c71['query']['limit']);_0x76e1da[_0x199a('0x1a')]=qs[_0x199a('0x1a')](_0x396c71[_0x199a('0x31')][_0x199a('0x1a')]);}_0x76e1da[_0x199a('0x3a')]=qs[_0x199a('0x3b')](_0x396c71[_0x199a('0x31')][_0x199a('0x3b')]);_0x76e1da[_0x199a('0x3c')]=qs[_0x199a('0x33')](_[_0x199a('0x3d')](_0x396c71[_0x199a('0x31')],_0x52eb1b['filters']),_0x16d162);if(_0x396c71[_0x199a('0x31')][_0x199a('0x3e')]){_0x76e1da[_0x199a('0x3c')]=_['merge'](_0x76e1da['where'],{'$or':_[_0x199a('0x2b')](_0x16d162,function(_0x915b07){if(_0x915b07[_0x199a('0x2e')]!==_0x199a('0x3f')){var _0x5dfc4c={};_0x5dfc4c[_0x915b07['name']]={'$like':'%'+_0x396c71[_0x199a('0x31')][_0x199a('0x3e')]+'%'};return _0x5dfc4c;}})});}_0x76e1da=_[_0x199a('0x40')]({},_0x76e1da,_0x396c71[_0x199a('0x41')]);var _0x21d3fe={'where':_0x76e1da['where']};return db[_0x199a('0x2c')]['count'](_0x21d3fe)[_0x199a('0x26')](function(_0x51b46){_0x1b3998[_0x199a('0x19')]=_0x51b46;if(_0x396c71[_0x199a('0x31')][_0x199a('0x42')]){_0x76e1da[_0x199a('0x43')]=[{'all':!![]}];}return db[_0x199a('0x2c')][_0x199a('0x44')](_0x76e1da);})[_0x199a('0x26')](function(_0x3e9ad9){_0x1b3998[_0x199a('0x45')]=_0x3e9ad9;return _0x1b3998;})[_0x199a('0x26')](respondWithFilteredResult(_0x448a59,_0x76e1da))[_0x199a('0x46')](handleError(_0x448a59,null));};exports[_0x199a('0x47')]=function(_0x443b85,_0x2c16c0){var _0x4abe95={'raw':![],'where':{'id':_0x443b85['params']['id']}},_0x31c4a5={};_0x31c4a5[_0x199a('0x30')]=_[_0x199a('0x32')](db[_0x199a('0x2c')]['rawAttributes']);_0x31c4a5['query']=_[_0x199a('0x32')](_0x443b85[_0x199a('0x31')]);_0x31c4a5[_0x199a('0x33')]=_['intersection'](_0x31c4a5[_0x199a('0x30')],_0x31c4a5[_0x199a('0x31')]);_0x4abe95['attributes']=_[_0x199a('0x34')](_0x31c4a5[_0x199a('0x30')],qs['fields'](_0x443b85['query'][_0x199a('0x36')]));_0x4abe95[_0x199a('0x35')]=_0x4abe95[_0x199a('0x35')][_0x199a('0x37')]?_0x4abe95[_0x199a('0x35')]:_0x31c4a5['model'];if(_0x443b85[_0x199a('0x31')][_0x199a('0x42')]){_0x4abe95['include']=[{'all':!![]}];}_0x4abe95=_['merge']({},_0x4abe95,_0x443b85[_0x199a('0x41')]);return db[_0x199a('0x2c')][_0x199a('0x48')](_0x4abe95)[_0x199a('0x26')](handleEntityNotFound(_0x2c16c0,null))[_0x199a('0x26')](respondWithResult(_0x2c16c0,null))[_0x199a('0x46')](handleError(_0x2c16c0,null));};exports[_0x199a('0x49')]=function(_0x496eaf,_0x2d5372){return db[_0x199a('0x2c')][_0x199a('0x49')](_0x496eaf['body'],{})[_0x199a('0x26')](function(_0x281991){var _0x35a34e=_0x496eaf[_0x199a('0x4a')][_0x199a('0x4b')]({'plain':!![]});if(!_0x35a34e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35a34e[_0x199a('0x4c')]===_0x199a('0x4a')){var _0x13b2f7=_0x281991['get']({'plain':!![]});var _0x1492d7='SquareProjects';return db['UserProfileSection']['find']({'where':{'name':_0x1492d7,'userProfileId':_0x35a34e[_0x199a('0x4d')]},'raw':!![]})['then'](function(_0x2343f3){if(_0x2343f3&&_0x2343f3[_0x199a('0x4e')]===0x0){return db[_0x199a('0x25')]['create']({'name':_0x13b2f7['name'],'resourceId':_0x13b2f7['id'],'type':_0x2343f3[_0x199a('0x29')],'sectionId':_0x2343f3['id']},{})[_0x199a('0x26')](function(){return _0x281991;});}else{return _0x281991;}})[_0x199a('0x46')](function(_0x53d615){logger[_0x199a('0x27')](_0x199a('0x4f'),_0x53d615);throw _0x53d615;});}return _0x281991;})[_0x199a('0x26')](respondWithResult(_0x2d5372,0xc9))[_0x199a('0x46')](handleError(_0x2d5372,null));};exports['update']=function(_0x1dee0f,_0xfbe4d4){if(_0x1dee0f[_0x199a('0x50')]['id']){delete _0x1dee0f[_0x199a('0x50')]['id'];}return db[_0x199a('0x2c')][_0x199a('0x48')]({'where':{'id':_0x1dee0f['params']['id']}})[_0x199a('0x26')](handleEntityNotFound(_0xfbe4d4,null))[_0x199a('0x26')](saveUpdates(_0x1dee0f['body'],null))['then'](respondWithResult(_0xfbe4d4,null))[_0x199a('0x46')](handleError(_0xfbe4d4,null));};exports['destroy']=function(_0x49aeb2,_0x9199f9){return db[_0x199a('0x2c')][_0x199a('0x48')]({'where':{'id':_0x49aeb2[_0x199a('0x51')]['id']}})['then'](handleEntityNotFound(_0x9199f9,null))[_0x199a('0x26')](removeEntity(_0x9199f9,null))['catch'](handleError(_0x9199f9,null));};exports[_0x199a('0x52')]=function(_0x17bc30,_0x2e4a4b,_0x339920){return db[_0x199a('0x2c')]['find']({'where':{'id':_0x17bc30[_0x199a('0x51')]['id']}})[_0x199a('0x26')](handleEntityNotFound(_0x2e4a4b,null))[_0x199a('0x26')](function(_0x532f7e){if(_0x532f7e){return _0x532f7e[_0x199a('0x52')](_0x17bc30[_0x199a('0x50')][_0x199a('0x53')],_[_0x199a('0x54')](_0x17bc30[_0x199a('0x50')],[_0x199a('0x53'),'id'])||{});}})['then'](respondWithResult(_0x2e4a4b,null))[_0x199a('0x46')](handleError(_0x2e4a4b,null));};exports[_0x199a('0x55')]=function(_0x3942e9,_0x718e00,_0x268dc9){return db[_0x199a('0x2c')]['find']({'where':{'id':_0x3942e9[_0x199a('0x51')]['id']}})[_0x199a('0x26')](handleEntityNotFound(_0x718e00,null))[_0x199a('0x26')](function(_0xb2ce6c){if(_0xb2ce6c){return _0xb2ce6c[_0x199a('0x55')](_0x3942e9[_0x199a('0x31')]['ids'])['then'](function(){if(_[_0x199a('0x56')](_0x3942e9[_0x199a('0x31')]['ids'])){for(var _0x3ec5a0=0x0;_0x3ec5a0<_0x3942e9['query'][_0x199a('0x53')]['length'];_0x3ec5a0+=0x1){socket['emit'](_0x199a('0x57'),{'UserId':Number(_0x3942e9[_0x199a('0x31')][_0x199a('0x53')][_0x3ec5a0]),'SquareProjectId':Number(_0x3942e9['params']['id'])});}}else{socket[_0x199a('0x58')](_0x199a('0x57'),{'UserId':Number(_0x3942e9[_0x199a('0x31')][_0x199a('0x53')]),'SquareProjectId':Number(_0x3942e9[_0x199a('0x51')]['id'])});}});}})[_0x199a('0x26')](respondWithStatusCode(_0x718e00,null))['catch'](handleError(_0x718e00,null));};exports[_0x199a('0x59')]=function(_0x3e1c26,_0x51b7c3,_0x320c23){var _0x2dcba0={};var _0x249cff={};var _0x20e7a4;var _0x855076;return db[_0x199a('0x2c')][_0x199a('0x5a')]({'where':{'id':_0x3e1c26[_0x199a('0x51')]['id']}})[_0x199a('0x26')](handleEntityNotFound(_0x51b7c3,null))[_0x199a('0x26')](function(_0x13a1bd){if(_0x13a1bd){_0x20e7a4=_0x13a1bd;_0x249cff[_0x199a('0x30')]=_[_0x199a('0x32')](db['User']['rawAttributes']);_0x249cff['query']=_['keys'](_0x3e1c26['query']);_0x249cff[_0x199a('0x33')]=_[_0x199a('0x34')](_0x249cff['model'],_0x249cff['query']);_0x2dcba0[_0x199a('0x35')]=_[_0x199a('0x34')](_0x249cff[_0x199a('0x30')],qs[_0x199a('0x36')](_0x3e1c26[_0x199a('0x31')][_0x199a('0x36')]));_0x2dcba0[_0x199a('0x35')]=_0x2dcba0['attributes']['length']?_0x2dcba0[_0x199a('0x35')]:_0x249cff[_0x199a('0x30')];_0x2dcba0[_0x199a('0x3a')]=qs[_0x199a('0x3b')](_0x3e1c26[_0x199a('0x31')][_0x199a('0x3b')]);_0x2dcba0[_0x199a('0x3c')]=qs[_0x199a('0x33')](_[_0x199a('0x3d')](_0x3e1c26[_0x199a('0x31')],_0x249cff['filters']));if(_0x3e1c26[_0x199a('0x31')][_0x199a('0x3e')]){_0x2dcba0[_0x199a('0x3c')]=_[_0x199a('0x40')](_0x2dcba0[_0x199a('0x3c')],{'$or':_[_0x199a('0x2b')](_0x2dcba0[_0x199a('0x35')],function(_0x1b3ed0){var _0x3d1eee={};_0x3d1eee[_0x1b3ed0]={'$like':'%'+_0x3e1c26[_0x199a('0x31')]['filter']+'%'};return _0x3d1eee;})});}_0x2dcba0=_[_0x199a('0x40')]({},_0x2dcba0,_0x3e1c26[_0x199a('0x41')]);return _0x20e7a4[_0x199a('0x59')](_0x2dcba0);}})[_0x199a('0x26')](function(_0x56a2ce){if(_0x56a2ce){_0x855076=_0x56a2ce['length'];if(!_0x3e1c26[_0x199a('0x31')][_0x199a('0x38')](_0x199a('0x39'))){_0x2dcba0[_0x199a('0x1b')]=qs[_0x199a('0x1b')](_0x3e1c26[_0x199a('0x31')][_0x199a('0x1b')]);_0x2dcba0[_0x199a('0x1a')]=qs[_0x199a('0x1a')](_0x3e1c26['query'][_0x199a('0x1a')]);}return _0x20e7a4['getUsers'](_0x2dcba0);}})[_0x199a('0x26')](function(_0x53ad0d){if(_0x53ad0d){return _0x53ad0d?{'count':_0x855076,'rows':_0x53ad0d}:null;}})['then'](respondWithResult(_0x51b7c3,null))[_0x199a('0x46')](handleError(_0x51b7c3,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index fc73686..f1cb32a 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 _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 +var _0xbaa8=['setMaxListeners','remove','emit','hook','exports','events','../../mysqldb','SquareProject'];(function(_0x92712a,_0x37be16){var _0x957fac=function(_0x432bc4){while(--_0x432bc4){_0x92712a['push'](_0x92712a['shift']());}};_0x957fac(++_0x37be16);}(_0xbaa8,0x1a5));var _0x8baa=function(_0x201e24,_0x4a4c44){_0x201e24=_0x201e24-0x0;var _0x5f0269=_0xbaa8[_0x201e24];return _0x5f0269;};'use strict';var EventEmitter=require(_0x8baa('0x0'));var SquareProject=require(_0x8baa('0x1'))['db'][_0x8baa('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x8baa('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8baa('0x4')};function emitEvent(_0x12ed3f){return function(_0x3fa162,_0x4510a3,_0x50dae1){SquareProjectEvents[_0x8baa('0x5')](_0x12ed3f+':'+_0x3fa162['id'],_0x3fa162);SquareProjectEvents[_0x8baa('0x5')](_0x12ed3f,_0x3fa162);_0x50dae1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x8baa('0x6')](e,emitEvent(event));}}module[_0x8baa('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 4b69957..2763ca9 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 _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 +var _0x1927=['path','rimraf','../../config/environment','./squareProject.attributes','exports','SquareProject','square_projects','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x152136,_0x4f14f1){var _0x20df44=function(_0x362877){while(--_0x362877){_0x152136['push'](_0x152136['shift']());}};_0x20df44(++_0x4f14f1);}(_0x1927,0x1c1));var _0x7192=function(_0xd3ac55,_0x3915b6){_0xd3ac55=_0xd3ac55-0x0;var _0x526e60=_0x1927[_0xd3ac55];return _0x526e60;};'use strict';var _=require(_0x7192('0x0'));var util=require(_0x7192('0x1'));var logger=require(_0x7192('0x2'))(_0x7192('0x3'));var moment=require(_0x7192('0x4'));var BPromise=require('bluebird');var rp=require(_0x7192('0x5'));var fs=require('fs');var path=require(_0x7192('0x6'));var rimraf=require(_0x7192('0x7'));var config=require(_0x7192('0x8'));var attributes=require(_0x7192('0x9'));module[_0x7192('0xa')]=function(_0x4c32b7,_0x419fc4){return _0x4c32b7['define'](_0x7192('0xb'),attributes,{'tableName':_0x7192('0xc'),'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 e1a382e..18e80b2 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 _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 +var _0x6a5f=['include','ShowSquareProject','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','message','result','catch','SquareProject','find','raw','options','where','attributes','map'];(function(_0x4e12fb,_0x59342c){var _0xdba8b2=function(_0x429cfd){while(--_0x429cfd){_0x4e12fb['push'](_0x4e12fb['shift']());}};_0xdba8b2(++_0x59342c);}(_0x6a5f,0x1bf));var _0xf6a5=function(_0x565404,_0x846949){_0x565404=_0x565404-0x0;var _0x2b0bb3=_0x6a5f[_0x565404];return _0x2b0bb3;};'use strict';var _=require(_0xf6a5('0x0'));var util=require(_0xf6a5('0x1'));var moment=require(_0xf6a5('0x2'));var BPromise=require(_0xf6a5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf6a5('0x4'));var db=require(_0xf6a5('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf6a5('0x6'));var config=require(_0xf6a5('0x7'));var jayson=require(_0xf6a5('0x8'));var client=jayson[_0xf6a5('0x9')][_0xf6a5('0xa')]({'port':0x232a});config[_0xf6a5('0xb')]=_[_0xf6a5('0xc')](config[_0xf6a5('0xb')],{'host':_0xf6a5('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf6a5('0xb')]));require(_0xf6a5('0xe'))[_0xf6a5('0xf')](socket);function respondWithRpcPromise(_0x4cbd7e,_0x449e8e,_0x1638b8){return new BPromise(function(_0x3e4f67,_0x45d69a){return client[_0xf6a5('0x10')](_0x4cbd7e,_0x1638b8)[_0xf6a5('0x11')](function(_0xb50471){logger[_0xf6a5('0x12')](_0xf6a5('0x13'),_0x449e8e,_0xf6a5('0x14'));logger[_0xf6a5('0x15')](_0xf6a5('0x16'),_0x449e8e,_0xf6a5('0x14'),JSON['stringify'](_0xb50471));if(_0xb50471['error']){if(_0xb50471[_0xf6a5('0x17')]['code']===0x1f4){logger[_0xf6a5('0x17')](_0xf6a5('0x13'),_0x449e8e,_0xb50471[_0xf6a5('0x17')][_0xf6a5('0x18')]);return _0x45d69a(_0xb50471[_0xf6a5('0x17')][_0xf6a5('0x18')]);}logger['error'](_0xf6a5('0x13'),_0x449e8e,_0xb50471[_0xf6a5('0x17')][_0xf6a5('0x18')]);return _0x3e4f67(_0xb50471[_0xf6a5('0x17')][_0xf6a5('0x18')]);}else{logger[_0xf6a5('0x12')]('SquareProject,\x20%s,\x20%s',_0x449e8e,_0xf6a5('0x14'));_0x3e4f67(_0xb50471[_0xf6a5('0x19')]['message']);}})[_0xf6a5('0x1a')](function(_0x556a11){logger[_0xf6a5('0x17')](_0xf6a5('0x13'),_0x449e8e,_0x556a11);_0x45d69a(_0x556a11);});});}exports['ShowSquareProject']=function(_0xebbef4){var _0x3acca2=this;return new Promise(function(_0x1a1b2f,_0x3196ee){return db[_0xf6a5('0x1b')][_0xf6a5('0x1c')]({'raw':_0xebbef4['options']?_0xebbef4['options'][_0xf6a5('0x1d')]===undefined?!![]:![]:!![],'where':_0xebbef4[_0xf6a5('0x1e')]?_0xebbef4['options'][_0xf6a5('0x1f')]||null:null,'attributes':_0xebbef4[_0xf6a5('0x1e')]?_0xebbef4[_0xf6a5('0x1e')][_0xf6a5('0x20')]||null:null,'include':_0xebbef4[_0xf6a5('0x1e')]?_0xebbef4['options']['include']?_[_0xf6a5('0x21')](_0xebbef4[_0xf6a5('0x1e')][_0xf6a5('0x22')],function(_0x4d7774){return{'model':db[_0x4d7774['model']],'as':_0x4d7774['as'],'attributes':_0x4d7774[_0xf6a5('0x20')],'include':_0x4d7774[_0xf6a5('0x22')]?_[_0xf6a5('0x21')](_0x4d7774[_0xf6a5('0x22')],function(_0x4ca99a){return{'model':db[_0x4ca99a['model']],'as':_0x4ca99a['as'],'attributes':_0x4ca99a[_0xf6a5('0x20')],'include':_0x4ca99a[_0xf6a5('0x22')]?_[_0xf6a5('0x21')](_0x4ca99a[_0xf6a5('0x22')],function(_0x1fa3cb){return{'model':db[_0x1fa3cb['model']],'as':_0x1fa3cb['as'],'attributes':_0x1fa3cb[_0xf6a5('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf6a5('0x11')](function(_0x2ad243){logger[_0xf6a5('0x12')](_0xf6a5('0x23'),_0xebbef4);logger['debug']('ShowSquareProject',_0xebbef4,JSON[_0xf6a5('0x24')](_0x2ad243));_0x1a1b2f(_0x2ad243);})[_0xf6a5('0x1a')](function(_0x5b39c9){logger['error'](_0xf6a5('0x23'),_0x5b39c9[_0xf6a5('0x18')],_0xebbef4);_0x3196ee(_0x3acca2[_0xf6a5('0x17')](0x1f4,_0x5b39c9['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 856ae2a..3dcb5d1 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 _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 +var _0xda19=['removeListener','register','length','save','remove'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0xda19,0xd5));var _0x9da1=function(_0x214e18,_0x13189b){_0x214e18=_0x214e18-0x0;var _0x323044=_0xda19[_0x214e18];return _0x323044;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x9da1('0x0'),_0x9da1('0x1'),'update'];function createListener(_0x175479,_0x503770){return function(_0x435076){_0x503770['emit'](_0x175479,_0x435076);};}function removeListener(_0x2a77c7,_0xef6f5a){return function(){SquareProjectEvents[_0x9da1('0x2')](_0x2a77c7,_0xef6f5a);};}exports[_0x9da1('0x3')]=function(_0x156faf){for(var _0x2dcbc6=0x0,_0x23e4f7=events[_0x9da1('0x4')];_0x2dcbc6<_0x23e4f7;_0x2dcbc6++){var _0x1c24e6=events[_0x2dcbc6];var _0x5e2d18=createListener('squareProject:'+_0x1c24e6,_0x156faf);SquareProjectEvents['on'](_0x1c24e6,_0x5e2d18);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 214e874..48930d4 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 _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 +var _0x505a=['download','create','/:id','update','delete','/:id/delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show'];(function(_0x3d5df9,_0x5b3623){var _0x50ba39=function(_0x3c0de0){while(--_0x3c0de0){_0x3d5df9['push'](_0x3d5df9['shift']());}};_0x50ba39(++_0x5b3623);}(_0x505a,0x1d4));var _0xa505=function(_0x3fdfd0,_0x785356){_0x3fdfd0=_0x3fdfd0-0x0;var _0xe00443=_0x505a[_0x3fdfd0];return _0xe00443;};'use strict';var multer=require(_0xa505('0x0'));var util=require(_0xa505('0x1'));var path=require(_0xa505('0x2'));var timeout=require(_0xa505('0x3'));var express=require('express');var router=express[_0xa505('0x4')]();var auth=require(_0xa505('0x5'));var interaction=require(_0xa505('0x6'));var config=require(_0xa505('0x7'));var controller=require('./squareRecording.controller');router[_0xa505('0x8')]('/',auth['isAuthenticated'](),controller[_0xa505('0x9')]);router[_0xa505('0x8')]('/:id',auth[_0xa505('0xa')](),controller[_0xa505('0xb')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xa505('0xc')]);router['post']('/',auth[_0xa505('0xa')](),controller[_0xa505('0xd')]);router['put'](_0xa505('0xe'),auth[_0xa505('0xa')](),controller[_0xa505('0xf')]);router[_0xa505('0x10')](_0xa505('0x11'),auth[_0xa505('0xa')](),controller[_0xa505('0x12')]);module[_0xa505('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index f40fee9..3a5d989 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 _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 +var _0x84db=['VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','exports','STRING'];(function(_0x1cdbc7,_0x2d4be0){var _0x22ddce=function(_0xa4142a){while(--_0xa4142a){_0x1cdbc7['push'](_0x1cdbc7['shift']());}};_0x22ddce(++_0x2d4be0);}(_0x84db,0x195));var _0xb84d=function(_0x4dae05,_0x4ee4f2){_0x4dae05=_0x4dae05-0x0;var _0x3db1ad=_0x84db[_0x4dae05];return _0x3db1ad;};'use strict';var Sequelize=require(_0xb84d('0x0'));module[_0xb84d('0x1')]={'uniqueid':{'type':Sequelize[_0xb84d('0x2')]},'callerid':{'type':Sequelize[_0xb84d('0x2')]},'calleridname':{'type':Sequelize[_0xb84d('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xb84d('0x2')]},'projectName':{'type':Sequelize[_0xb84d('0x2')]},'saveName':{'type':Sequelize[_0xb84d('0x2')]},'filename':{'type':Sequelize[_0xb84d('0x2')]},'savePath':{'type':Sequelize[_0xb84d('0x2')]},'format':{'type':Sequelize[_0xb84d('0x3')],'get':function(){var _0x993268='';var _0x132018=this[_0xb84d('0x4')](_0xb84d('0x5'));if(_0x132018){_0x993268=_0x132018[_0xb84d('0x6')](_0x132018[_0xb84d('0x7')]('.'));}return _0x993268;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 313d938..ed906dd 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 _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 +var _0x51e7=['zip-dir','fast-json-patch','request-promise','mustache','path','sox','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','error','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','create','body','download','../../components/encryptor','uniqueid','filename','savePath','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','destroy','Entity\x20not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf'];(function(_0x2dd003,_0x1c3812){var _0xde824f=function(_0x4bc70b){while(--_0x4bc70b){_0x2dd003['push'](_0x2dd003['shift']());}};_0xde824f(++_0x1c3812);}(_0x51e7,0xb8));var _0x751e=function(_0x273280,_0x16254e){_0x273280=_0x273280-0x0;var _0x28ea92=_0x51e7[_0x273280];return _0x28ea92;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x751e('0x0'));var rimraf=require(_0x751e('0x1'));var zipdir=require(_0x751e('0x2'));var jsonpatch=require(_0x751e('0x3'));var rp=require(_0x751e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x751e('0x5'));var util=require('util');var path=require(_0x751e('0x6'));var sox=require(_0x751e('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x751e('0x8'));var crypto=require(_0x751e('0x9'));var jsforce=require(_0x751e('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x751e('0xb'));var Papa=require('papaparse');var Redis=require(_0x751e('0xc'));var authService=require(_0x751e('0xd'));var qs=require(_0x751e('0xe'));var as=require(_0x751e('0xf'));var hardwareService=require(_0x751e('0x10'));var logger=require(_0x751e('0x11'))('api');var utils=require(_0x751e('0x12'));var config=require(_0x751e('0x13'));var db=require(_0x751e('0x14'))['db'];function respondWithStatusCode(_0x6b1566,_0x201ee9){_0x201ee9=_0x201ee9||0xcc;return function(_0x1dc66a){if(_0x1dc66a){return _0x6b1566[_0x751e('0x15')](_0x201ee9);}return _0x6b1566[_0x751e('0x16')](_0x201ee9)[_0x751e('0x17')]();};}function respondWithResult(_0x45c38a,_0x180cc1){_0x180cc1=_0x180cc1||0xc8;return function(_0xd0e7ac){if(_0xd0e7ac){return _0x45c38a[_0x751e('0x16')](_0x180cc1)[_0x751e('0x18')](_0xd0e7ac);}};}function respondWithFilteredResult(_0x4e68a8,_0x134b9f){return function(_0x1cb927){if(_0x1cb927){var _0x1c82c7=_0x1cb927[_0x751e('0x19')],_0x2254cf=_0x134b9f[_0x751e('0x1a')],_0x80c9bc=_0x134b9f[_0x751e('0x1a')]+_0x134b9f[_0x751e('0x1b')],_0x1178e8;if(_0x80c9bc>=_0x1c82c7){_0x80c9bc=_0x1c82c7;_0x1178e8=0xc8;}else{_0x1178e8=0xce;}_0x4e68a8['status'](_0x1178e8);return _0x4e68a8[_0x751e('0x1c')](_0x751e('0x1d'),_0x2254cf+'-'+_0x80c9bc+'/'+_0x1c82c7)[_0x751e('0x18')](_0x1cb927);}return null;};}function patchUpdates(_0x1d9853){return function(_0x29e850){try{jsonpatch[_0x751e('0x1e')](_0x29e850,_0x1d9853,!![]);}catch(_0x4326c9){return BPromise['reject'](_0x4326c9);}return _0x29e850['save']();};}function saveUpdates(_0x2c6b3a,_0x1a3986){return function(_0x243e0e){if(_0x243e0e){return _0x243e0e[_0x751e('0x1f')](_0x2c6b3a)[_0x751e('0x20')](function(_0x1e7c0b){return _0x1e7c0b;});}return null;};}function removeEntity(_0x596bbe,_0x3f0597){return function(_0x547db6){if(_0x547db6){return _0x547db6['destroy']()[_0x751e('0x20')](function(){_0x596bbe['status'](0xcc)[_0x751e('0x17')]();});}};}function handleEntityNotFound(_0x11ef01,_0x4f62b9){return function(_0x5af6c1){if(!_0x5af6c1){_0x11ef01[_0x751e('0x15')](0x194);}return _0x5af6c1;};}function handleError(_0x16032c,_0x1c623f){_0x1c623f=_0x1c623f||0x1f4;return function(_0x5c5562){logger[_0x751e('0x21')](_0x5c5562['stack']);if(_0x5c5562[_0x751e('0x22')]){delete _0x5c5562[_0x751e('0x22')];}_0x16032c[_0x751e('0x16')](_0x1c623f)[_0x751e('0x23')](_0x5c5562);};}exports[_0x751e('0x24')]=function(_0x11943b,_0x3e7f00){var _0x32562e={},_0x39d77c={},_0x45fb42={'count':0x0,'rows':[]};var _0x205580=_[_0x751e('0x25')](db[_0x751e('0x26')][_0x751e('0x27')],function(_0xf76e6b){return{'name':_0xf76e6b[_0x751e('0x28')],'type':_0xf76e6b[_0x751e('0x29')][_0x751e('0x2a')]};});_0x39d77c[_0x751e('0x2b')]=_['map'](_0x205580,'name');_0x39d77c['query']=_[_0x751e('0x2c')](_0x11943b[_0x751e('0x2d')]);_0x39d77c[_0x751e('0x2e')]=_[_0x751e('0x2f')](_0x39d77c[_0x751e('0x2b')],_0x39d77c[_0x751e('0x2d')]);_0x32562e['attributes']=_['intersection'](_0x39d77c['model'],qs['fields'](_0x11943b[_0x751e('0x2d')][_0x751e('0x30')]));_0x32562e[_0x751e('0x31')]=_0x32562e[_0x751e('0x31')][_0x751e('0x32')]?_0x32562e['attributes']:_0x39d77c[_0x751e('0x2b')];if(!_0x11943b[_0x751e('0x2d')][_0x751e('0x33')](_0x751e('0x34'))){_0x32562e[_0x751e('0x1b')]=qs[_0x751e('0x1b')](_0x11943b['query']['limit']);_0x32562e[_0x751e('0x1a')]=qs[_0x751e('0x1a')](_0x11943b[_0x751e('0x2d')]['offset']);}_0x32562e[_0x751e('0x35')]=qs[_0x751e('0x36')](_0x11943b[_0x751e('0x2d')][_0x751e('0x36')]);_0x32562e[_0x751e('0x37')]=qs[_0x751e('0x2e')](_['pick'](_0x11943b[_0x751e('0x2d')],_0x39d77c[_0x751e('0x2e')]),_0x205580);if(_0x11943b[_0x751e('0x2d')][_0x751e('0x38')]){_0x32562e[_0x751e('0x37')]=_[_0x751e('0x39')](_0x32562e[_0x751e('0x37')],{'$or':_[_0x751e('0x25')](_0x205580,function(_0x286b60){if(_0x286b60[_0x751e('0x29')]!==_0x751e('0x3a')){var _0x21818e={};_0x21818e[_0x286b60[_0x751e('0x22')]]={'$like':'%'+_0x11943b[_0x751e('0x2d')][_0x751e('0x38')]+'%'};return _0x21818e;}})});}_0x32562e=_[_0x751e('0x39')]({},_0x32562e,_0x11943b[_0x751e('0x3b')]);var _0x1fa893={'where':_0x32562e[_0x751e('0x37')]};return db[_0x751e('0x26')][_0x751e('0x19')](_0x1fa893)[_0x751e('0x20')](function(_0x13ec91){_0x45fb42[_0x751e('0x19')]=_0x13ec91;if(_0x11943b[_0x751e('0x2d')][_0x751e('0x3c')]){_0x32562e[_0x751e('0x3d')]=[{'all':!![]}];}return db['SquareRecording'][_0x751e('0x3e')](_0x32562e);})[_0x751e('0x20')](function(_0x38b653){_0x45fb42['rows']=_0x38b653;return _0x45fb42;})['then'](respondWithFilteredResult(_0x3e7f00,_0x32562e))['catch'](handleError(_0x3e7f00,null));};exports[_0x751e('0x3f')]=function(_0x4b212a,_0x2441f0){var _0x4454ad={'raw':!![],'where':{'id':_0x4b212a[_0x751e('0x40')]['id']}},_0x21dff6={};_0x21dff6['model']=_[_0x751e('0x2c')](db[_0x751e('0x26')][_0x751e('0x27')]);_0x21dff6[_0x751e('0x2d')]=_[_0x751e('0x2c')](_0x4b212a['query']);_0x21dff6[_0x751e('0x2e')]=_[_0x751e('0x2f')](_0x21dff6[_0x751e('0x2b')],_0x21dff6['query']);_0x4454ad[_0x751e('0x31')]=_['intersection'](_0x21dff6[_0x751e('0x2b')],qs['fields'](_0x4b212a[_0x751e('0x2d')][_0x751e('0x30')]));_0x4454ad['attributes']=_0x4454ad['attributes'][_0x751e('0x32')]?_0x4454ad[_0x751e('0x31')]:_0x21dff6['model'];if(_0x4b212a[_0x751e('0x2d')][_0x751e('0x3c')]){_0x4454ad[_0x751e('0x3d')]=[{'all':!![]}];}_0x4454ad=_['merge']({},_0x4454ad,_0x4b212a[_0x751e('0x3b')]);return db[_0x751e('0x26')][_0x751e('0x41')](_0x4454ad)[_0x751e('0x20')](handleEntityNotFound(_0x2441f0,null))['then'](respondWithResult(_0x2441f0,null))[_0x751e('0x42')](handleError(_0x2441f0,null));};exports[_0x751e('0x43')]=function(_0x38ef3c,_0x37b6d6){return db['SquareRecording'][_0x751e('0x43')](_0x38ef3c['body'],{})[_0x751e('0x20')](respondWithResult(_0x37b6d6,0xc9))[_0x751e('0x42')](handleError(_0x37b6d6,null));};exports[_0x751e('0x1f')]=function(_0x1edb24,_0x14ecee){if(_0x1edb24[_0x751e('0x44')]['id']){delete _0x1edb24[_0x751e('0x44')]['id'];}return db[_0x751e('0x26')][_0x751e('0x41')]({'where':{'id':_0x1edb24['params']['id']}})['then'](handleEntityNotFound(_0x14ecee,null))['then'](saveUpdates(_0x1edb24['body'],null))[_0x751e('0x20')](respondWithResult(_0x14ecee,null))[_0x751e('0x42')](handleError(_0x14ecee,null));};exports[_0x751e('0x45')]=function(_0x67136e,_0x55449a,_0x5a73d3){var _0x1f4cac=require(_0x751e('0x46'));var _0x44bcd0=![];var _0x571520={};if(_0x67136e[_0x751e('0x2d')][_0x751e('0x29')]&&_0x67136e[_0x751e('0x2d')][_0x751e('0x29')]===_0x751e('0x47')){_0x571520[_0x751e('0x47')]=_0x67136e[_0x751e('0x40')]['id'];}else{_0x571520['id']=_0x67136e[_0x751e('0x40')]['id'];}return db[_0x751e('0x26')][_0x751e('0x41')]({'where':_0x571520,'attributes':['id','savePath',_0x751e('0x48')],'raw':!![]})['then'](handleEntityNotFound(_0x55449a,null))['then'](function(_0x1fcbe9){if(_0x1fcbe9){var _0x24db62=_0x1fcbe9[_0x751e('0x49')];var _0x382b52=util['format'](_0x751e('0x4a'),_0x24db62);if(fs[_0x751e('0x4b')](_0x382b52)){_0x44bcd0=!![];return _0x1f4cac[_0x751e('0x4c')](_0x382b52,_0x24db62,config[_0x751e('0x4d')][_0x751e('0x4e')])[_0x751e('0x20')](function(){return _0x1fcbe9;});}return _0x1fcbe9;}})[_0x751e('0x20')](function(_0x354484){if(_0x354484){var _0x190fa7=_0x354484[_0x751e('0x49')];if(!fs[_0x751e('0x4b')](_0x190fa7)){throw new db[(_0x751e('0x4f'))]['ValidationError'](_0x751e('0x50'));}if(_0x354484['filename']){return _0x55449a[_0x751e('0x45')](_0x190fa7,_0x354484[_0x751e('0x48')]+path[_0x751e('0x51')](_0x190fa7),function(){if(_0x44bcd0){fs[_0x751e('0x52')](_0x190fa7);}});}else{return _0x55449a['download'](_0x190fa7,function(_0x17301e){if(_0x44bcd0){fs[_0x751e('0x52')](_0x190fa7);}});}}})[_0x751e('0x42')](function(_0x4960cd){if(_0x4960cd[_0x751e('0x53')]===_0x751e('0x50')){_0x55449a['status'](0x194)[_0x751e('0x23')](_0x751e('0x54'));}else{return handleError(_0x55449a,null);}});};exports[_0x751e('0x55')]=function(_0x2f7eea,_0x4695b5){return db[_0x751e('0x26')][_0x751e('0x41')]({'where':{'id':_0x2f7eea[_0x751e('0x40')]['id']}})[_0x751e('0x20')](function(_0x49082a){if(!_0x49082a)throw new ReferenceError(_0x751e('0x56'));return _0x49082a;})[_0x751e('0x20')](function(_0x54d806){var _0x3ddb55=_0x54d806[_0x751e('0x49')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x3ddb55);if(!_[_0x751e('0x57')](_0x54d806[_0x751e('0x49')])&&fs[_0x751e('0x4b')](_0x3ddb55)){logger[_0x751e('0x58')](_0x751e('0x59')+_0x3ddb55+_0x751e('0x5a'));fs[_0x751e('0x5b')](_0x3ddb55);}_0x3ddb55=_0x3ddb55+_0x751e('0x5c');if(!_['isNil'](_0x54d806[_0x751e('0x49')])&&fs[_0x751e('0x4b')](_0x3ddb55)){logger[_0x751e('0x58')]('File:\x20\x22'+_0x3ddb55+_0x751e('0x5a'));fs['unlinkSync'](_0x3ddb55);}return _0x54d806;})[_0x751e('0x20')](function(_0x390e19){if(!_0x390e19)throw new InternalError();return _0x390e19[_0x751e('0x55')]();})[_0x751e('0x20')](function(){_0x4695b5['status'](0xcc)[_0x751e('0x17')]();})[_0x751e('0x42')](handleError(_0x4695b5,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 0a01527..ed83126 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 _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 +var _0xa064=['SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment','path','../../config/environment','./squareRecording.attributes'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa064,0x192));var _0x4a06=function(_0x3d91fd,_0x3a768b){_0x3d91fd=_0x3d91fd-0x0;var _0x137a3a=_0xa064[_0x3d91fd];return _0x137a3a;};'use strict';var _=require(_0x4a06('0x0'));var util=require(_0x4a06('0x1'));var logger=require(_0x4a06('0x2'))(_0x4a06('0x3'));var moment=require(_0x4a06('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a06('0x5'));var rimraf=require('rimraf');var config=require(_0x4a06('0x6'));var attributes=require(_0x4a06('0x7'));module['exports']=function(_0x3f2099,_0x54c9ed){return _0x3f2099['define'](_0x4a06('0x8'),attributes,{'tableName':_0x4a06('0x9'),'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 072914c..6f4f914 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 _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 +var _0xecfb=['body','options','raw','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','CreateSquareRecording','SquareRecording','create'];(function(_0x576e92,_0x165314){var _0x24c32e=function(_0x1648b1){while(--_0x1648b1){_0x576e92['push'](_0x576e92['shift']());}};_0x24c32e(++_0x165314);}(_0xecfb,0xb9));var _0xbecf=function(_0x426641,_0x26d64c){_0x426641=_0x426641-0x0;var _0x1a1ece=_0xecfb[_0x426641];return _0x1a1ece;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbecf('0x0'));var fs=require('fs');var Redis=require(_0xbecf('0x1'));var db=require(_0xbecf('0x2'))['db'];var utils=require(_0xbecf('0x3'));var logger=require('../../config/logger')(_0xbecf('0x4'));var config=require(_0xbecf('0x5'));var jayson=require(_0xbecf('0x6'));var client=jayson[_0xbecf('0x7')][_0xbecf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c90d9,_0x4d6612,_0x5e9736){return new BPromise(function(_0x4f947d,_0x58a907){return client[_0xbecf('0x9')](_0x1c90d9,_0x5e9736)[_0xbecf('0xa')](function(_0x1a889e){logger['info'](_0xbecf('0xb'),_0x4d6612,_0xbecf('0xc'));logger[_0xbecf('0xd')](_0xbecf('0xe'),_0x4d6612,_0xbecf('0xc'),JSON[_0xbecf('0xf')](_0x1a889e));if(_0x1a889e[_0xbecf('0x10')]){if(_0x1a889e[_0xbecf('0x10')][_0xbecf('0x11')]===0x1f4){logger[_0xbecf('0x10')](_0xbecf('0xb'),_0x4d6612,_0x1a889e['error']['message']);return _0x58a907(_0x1a889e[_0xbecf('0x10')]['message']);}logger['error'](_0xbecf('0xb'),_0x4d6612,_0x1a889e['error'][_0xbecf('0x12')]);return _0x4f947d(_0x1a889e[_0xbecf('0x10')][_0xbecf('0x12')]);}else{logger[_0xbecf('0x13')](_0xbecf('0xb'),_0x4d6612,_0xbecf('0xc'));_0x4f947d(_0x1a889e['result'][_0xbecf('0x12')]);}})['catch'](function(_0x701ba8){logger[_0xbecf('0x10')](_0xbecf('0xb'),_0x4d6612,_0x701ba8);_0x58a907(_0x701ba8);});});}exports[_0xbecf('0x14')]=function(_0x5c28c0){var _0x58f7ec=this;return new Promise(function(_0x46b527,_0x523c96){return db[_0xbecf('0x15')][_0xbecf('0x16')](_0x5c28c0[_0xbecf('0x17')],{'raw':_0x5c28c0[_0xbecf('0x18')]?_0x5c28c0[_0xbecf('0x18')][_0xbecf('0x19')]===undefined?!![]:![]:!![]})[_0xbecf('0xa')](function(_0x431012){logger[_0xbecf('0x13')](_0xbecf('0x14'),_0x5c28c0);logger['debug'](_0xbecf('0x14'),_0x5c28c0,JSON[_0xbecf('0xf')](_0x431012));_0x46b527(_0x431012);})['catch'](function(_0x95d479){logger['error'](_0xbecf('0x14'),_0x95d479[_0xbecf('0x12')],_0x5c28c0);_0x523c96(_0x58f7ec['error'](0x1f4,_0x95d479[_0xbecf('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 3de6739..877ca16 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 _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 +var _0xffcc=['connect-timeout','express','Router','./squareReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer','util'];(function(_0x1f79f8,_0x1ea2fd){var _0x288e6d=function(_0x5c8876){while(--_0x5c8876){_0x1f79f8['push'](_0x1f79f8['shift']());}};_0x288e6d(++_0x1ea2fd);}(_0xffcc,0x142));var _0xcffc=function(_0x45d6a5,_0x128291){_0x45d6a5=_0x45d6a5-0x0;var _0xfd46cb=_0xffcc[_0x45d6a5];return _0xfd46cb;};'use strict';var multer=require(_0xcffc('0x0'));var util=require(_0xcffc('0x1'));var path=require('path');var timeout=require(_0xcffc('0x2'));var express=require(_0xcffc('0x3'));var router=express[_0xcffc('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcffc('0x5'));router[_0xcffc('0x6')]('/',auth['isAuthenticated'](),controller[_0xcffc('0x7')]);router['get'](_0xcffc('0x8'),auth[_0xcffc('0x9')](),controller['describe']);router['get'](_0xcffc('0xa'),auth[_0xcffc('0x9')](),controller[_0xcffc('0xb')]);router[_0xcffc('0xc')]('/',auth[_0xcffc('0x9')](),controller[_0xcffc('0xd')]);router[_0xcffc('0xe')]('/:id',auth[_0xcffc('0x9')](),controller['update']);router[_0xcffc('0xf')](_0xcffc('0xa'),auth['isAuthenticated'](),controller[_0xcffc('0x10')]);module[_0xcffc('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index e9ccc0f..ef926fb 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 _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 +var _0x35a2=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x12084c,_0x25680d){var _0x3c1906=function(_0x48a23b){while(--_0x48a23b){_0x12084c['push'](_0x12084c['shift']());}};_0x3c1906(++_0x25680d);}(_0x35a2,0x1a8));var _0x235a=function(_0x195c9a,_0x16f5f4){_0x195c9a=_0x195c9a-0x0;var _0x46aad4=_0x35a2[_0x195c9a];return _0x46aad4;};'use strict';var Sequelize=require(_0x235a('0x0'));module[_0x235a('0x1')]={'network':{'type':Sequelize[_0x235a('0x2')]},'network_script':{'type':Sequelize[_0x235a('0x2')]},'request':{'type':Sequelize[_0x235a('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x235a('0x2')]},'type':{'type':Sequelize[_0x235a('0x2')]},'uniqueid':{'type':Sequelize[_0x235a('0x2')]},'version':{'type':Sequelize[_0x235a('0x2')]},'callerid':{'type':Sequelize[_0x235a('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x235a('0x2')]},'callingani2':{'type':Sequelize[_0x235a('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x235a('0x2')]},'rdnis':{'type':Sequelize[_0x235a('0x2')]},'context':{'type':Sequelize[_0x235a('0x2')]},'extension':{'type':Sequelize[_0x235a('0x2')]},'priority':{'type':Sequelize[_0x235a('0x2')]},'enhanced':{'type':Sequelize[_0x235a('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x235a('0x2')]},'project_name':{'type':Sequelize[_0x235a('0x2')]},'joinAt':{'type':Sequelize[_0x235a('0x3')]},'leaveAt':{'type':Sequelize[_0x235a('0x3')]},'bot':{'type':Sequelize[_0x235a('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index afb324f..aeb36ce 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 _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 +var _0x2fbc=['status','end','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','catch','params','keys','fields','length','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus'];(function(_0x3d0572,_0x3909e6){var _0x241372=function(_0x205863){while(--_0x205863){_0x3d0572['push'](_0x3d0572['shift']());}};_0x241372(++_0x3909e6);}(_0x2fbc,0x1f3));var _0xc2fb=function(_0x282c7f,_0x460e10){_0x282c7f=_0x282c7f-0x0;var _0x54bc87=_0x2fbc[_0x282c7f];return _0x54bc87;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc2fb('0x0'));var rimraf=require(_0xc2fb('0x1'));var zipdir=require(_0xc2fb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc2fb('0x3'));var moment=require(_0xc2fb('0x4'));var BPromise=require(_0xc2fb('0x5'));var Mustache=require(_0xc2fb('0x6'));var util=require(_0xc2fb('0x7'));var path=require('path');var sox=require(_0xc2fb('0x8'));var csv=require(_0xc2fb('0x9'));var ejs=require(_0xc2fb('0xa'));var fs=require('fs');var _=require(_0xc2fb('0xb'));var squel=require(_0xc2fb('0xc'));var crypto=require(_0xc2fb('0xd'));var jsforce=require(_0xc2fb('0xe'));var deskjs=require(_0xc2fb('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc2fb('0x10'));var Redis=require(_0xc2fb('0x11'));var authService=require(_0xc2fb('0x12'));var qs=require(_0xc2fb('0x13'));var as=require(_0xc2fb('0x14'));var hardwareService=require(_0xc2fb('0x15'));var logger=require(_0xc2fb('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xc2fb('0x17'));var db=require(_0xc2fb('0x18'))['db'];function respondWithStatusCode(_0x2993b5,_0x1c31cf){_0x1c31cf=_0x1c31cf||0xcc;return function(_0x2d447f){if(_0x2d447f){return _0x2993b5[_0xc2fb('0x19')](_0x1c31cf);}return _0x2993b5[_0xc2fb('0x1a')](_0x1c31cf)[_0xc2fb('0x1b')]();};}function respondWithResult(_0x1289a7,_0x2bbd5f){_0x2bbd5f=_0x2bbd5f||0xc8;return function(_0x283146){if(_0x283146){return _0x1289a7[_0xc2fb('0x1a')](_0x2bbd5f)[_0xc2fb('0x1c')](_0x283146);}};}function respondWithFilteredResult(_0x17ee0e,_0x1228df){return function(_0x5d1d19){if(_0x5d1d19){var _0x112e3d=_0x5d1d19[_0xc2fb('0x1d')],_0x12196c=_0x1228df['offset'],_0x9880e6=_0x1228df[_0xc2fb('0x1e')]+_0x1228df['limit'],_0x83b71d;if(_0x9880e6>=_0x112e3d){_0x9880e6=_0x112e3d;_0x83b71d=0xc8;}else{_0x83b71d=0xce;}_0x17ee0e[_0xc2fb('0x1a')](_0x83b71d);return _0x17ee0e['set'](_0xc2fb('0x1f'),_0x12196c+'-'+_0x9880e6+'/'+_0x112e3d)[_0xc2fb('0x1c')](_0x5d1d19);}return null;};}function patchUpdates(_0x264ecd){return function(_0x1910f5){try{jsonpatch[_0xc2fb('0x20')](_0x1910f5,_0x264ecd,!![]);}catch(_0x293c6a){return BPromise[_0xc2fb('0x21')](_0x293c6a);}return _0x1910f5[_0xc2fb('0x22')]();};}function saveUpdates(_0x322e27,_0x2d7da8){return function(_0x1fc069){if(_0x1fc069){return _0x1fc069[_0xc2fb('0x23')](_0x322e27)[_0xc2fb('0x24')](function(_0x10bd63){return _0x10bd63;});}return null;};}function removeEntity(_0x5a0128,_0x44a5f3){return function(_0x27469e){if(_0x27469e){return _0x27469e[_0xc2fb('0x25')]()[_0xc2fb('0x24')](function(){_0x5a0128[_0xc2fb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32615d,_0x304ceb){return function(_0x44b3b0){if(!_0x44b3b0){_0x32615d['sendStatus'](0x194);}return _0x44b3b0;};}function handleError(_0x32e09a,_0x1d75e7){_0x1d75e7=_0x1d75e7||0x1f4;return function(_0x4a4c01){logger[_0xc2fb('0x26')](_0x4a4c01['stack']);if(_0x4a4c01[_0xc2fb('0x27')]){delete _0x4a4c01[_0xc2fb('0x27')];}_0x32e09a[_0xc2fb('0x1a')](_0x1d75e7)[_0xc2fb('0x28')](_0x4a4c01);};}exports[_0xc2fb('0x29')]=function(_0x59f053,_0x5ab418){var _0x23a3b6={},_0xcc8a3c={},_0x9e8954={'count':0x0,'rows':[]};var _0x46fc4b=_[_0xc2fb('0x2a')](db[_0xc2fb('0x2b')][_0xc2fb('0x2c')],function(_0x491b51){return{'name':_0x491b51[_0xc2fb('0x2d')],'type':_0x491b51[_0xc2fb('0x2e')][_0xc2fb('0x2f')]};});_0xcc8a3c[_0xc2fb('0x30')]=_[_0xc2fb('0x2a')](_0x46fc4b,_0xc2fb('0x27'));_0xcc8a3c[_0xc2fb('0x31')]=_['keys'](_0x59f053[_0xc2fb('0x31')]);_0xcc8a3c['filters']=_[_0xc2fb('0x32')](_0xcc8a3c[_0xc2fb('0x30')],_0xcc8a3c[_0xc2fb('0x31')]);_0x23a3b6[_0xc2fb('0x33')]=_[_0xc2fb('0x32')](_0xcc8a3c[_0xc2fb('0x30')],qs['fields'](_0x59f053['query']['fields']));_0x23a3b6['attributes']=_0x23a3b6[_0xc2fb('0x33')]['length']?_0x23a3b6[_0xc2fb('0x33')]:_0xcc8a3c[_0xc2fb('0x30')];if(!_0x59f053[_0xc2fb('0x31')][_0xc2fb('0x34')](_0xc2fb('0x35'))){_0x23a3b6[_0xc2fb('0x36')]=qs['limit'](_0x59f053[_0xc2fb('0x31')][_0xc2fb('0x36')]);_0x23a3b6[_0xc2fb('0x1e')]=qs[_0xc2fb('0x1e')](_0x59f053['query'][_0xc2fb('0x1e')]);}_0x23a3b6[_0xc2fb('0x37')]=qs['sort'](_0x59f053['query'][_0xc2fb('0x38')]);_0x23a3b6[_0xc2fb('0x39')]=qs['filters'](_[_0xc2fb('0x3a')](_0x59f053[_0xc2fb('0x31')],_0xcc8a3c['filters']),_0x46fc4b);if(_0x59f053[_0xc2fb('0x31')]['filter']){_0x23a3b6[_0xc2fb('0x39')]=_[_0xc2fb('0x3b')](_0x23a3b6['where'],{'$or':_[_0xc2fb('0x2a')](_0x46fc4b,function(_0x3426d3){if(_0x3426d3['type']!==_0xc2fb('0x3c')){var _0x21eaf5={};_0x21eaf5[_0x3426d3['name']]={'$like':'%'+_0x59f053['query'][_0xc2fb('0x3d')]+'%'};return _0x21eaf5;}})});}_0x23a3b6=_[_0xc2fb('0x3b')]({},_0x23a3b6,_0x59f053[_0xc2fb('0x3e')]);var _0x4c7506={'where':_0x23a3b6[_0xc2fb('0x39')]};return db['SquareReport']['count'](_0x4c7506)[_0xc2fb('0x24')](function(_0x1e1f8f){_0x9e8954[_0xc2fb('0x1d')]=_0x1e1f8f;if(_0x59f053['query'][_0xc2fb('0x3f')]){_0x23a3b6['include']=[{'all':!![]}];}return db[_0xc2fb('0x2b')]['findAll'](_0x23a3b6);})['then'](function(_0x1d2ad0){_0x9e8954[_0xc2fb('0x40')]=_0x1d2ad0;return _0x9e8954;})[_0xc2fb('0x24')](respondWithFilteredResult(_0x5ab418,_0x23a3b6))[_0xc2fb('0x41')](handleError(_0x5ab418,null));};exports['show']=function(_0x381661,_0x201335){var _0x20fa32={'raw':!![],'where':{'id':_0x381661[_0xc2fb('0x42')]['id']}},_0x5a4bf6={};_0x5a4bf6['model']=_[_0xc2fb('0x43')](db[_0xc2fb('0x2b')][_0xc2fb('0x2c')]);_0x5a4bf6[_0xc2fb('0x31')]=_[_0xc2fb('0x43')](_0x381661[_0xc2fb('0x31')]);_0x5a4bf6['filters']=_['intersection'](_0x5a4bf6['model'],_0x5a4bf6['query']);_0x20fa32[_0xc2fb('0x33')]=_[_0xc2fb('0x32')](_0x5a4bf6[_0xc2fb('0x30')],qs[_0xc2fb('0x44')](_0x381661['query'][_0xc2fb('0x44')]));_0x20fa32['attributes']=_0x20fa32[_0xc2fb('0x33')][_0xc2fb('0x45')]?_0x20fa32[_0xc2fb('0x33')]:_0x5a4bf6[_0xc2fb('0x30')];if(_0x381661[_0xc2fb('0x31')][_0xc2fb('0x3f')]){_0x20fa32[_0xc2fb('0x46')]=[{'all':!![]}];}_0x20fa32=_[_0xc2fb('0x3b')]({},_0x20fa32,_0x381661[_0xc2fb('0x3e')]);return db['SquareReport'][_0xc2fb('0x47')](_0x20fa32)[_0xc2fb('0x24')](handleEntityNotFound(_0x201335,null))[_0xc2fb('0x24')](respondWithResult(_0x201335,null))[_0xc2fb('0x41')](handleError(_0x201335,null));};exports[_0xc2fb('0x48')]=function(_0x3cd36b,_0xd28d06){return db[_0xc2fb('0x2b')][_0xc2fb('0x48')](_0x3cd36b[_0xc2fb('0x49')],{})['then'](respondWithResult(_0xd28d06,0xc9))[_0xc2fb('0x41')](handleError(_0xd28d06,null));};exports[_0xc2fb('0x23')]=function(_0x2debd0,_0x5271ab){if(_0x2debd0[_0xc2fb('0x49')]['id']){delete _0x2debd0[_0xc2fb('0x49')]['id'];}return db[_0xc2fb('0x2b')][_0xc2fb('0x47')]({'where':{'id':_0x2debd0['params']['id']}})[_0xc2fb('0x24')](handleEntityNotFound(_0x5271ab,null))[_0xc2fb('0x24')](saveUpdates(_0x2debd0[_0xc2fb('0x49')],null))[_0xc2fb('0x24')](respondWithResult(_0x5271ab,null))['catch'](handleError(_0x5271ab,null));};exports[_0xc2fb('0x25')]=function(_0x2c9312,_0x15eeac){return db[_0xc2fb('0x2b')][_0xc2fb('0x47')]({'where':{'id':_0x2c9312[_0xc2fb('0x42')]['id']}})[_0xc2fb('0x24')](handleEntityNotFound(_0x15eeac,null))[_0xc2fb('0x24')](removeEntity(_0x15eeac,null))['catch'](handleError(_0x15eeac,null));};exports[_0xc2fb('0x4a')]=function(_0x497da4,_0x15bc3f){return db[_0xc2fb('0x2b')][_0xc2fb('0x4a')]()[_0xc2fb('0x24')](respondWithResult(_0x15bc3f,null))[_0xc2fb('0x41')](handleError(_0x15bc3f,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 36dad3a..0b0ca8e 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 _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 +var _0x851d=['../../config/environment','./squareReport.attributes','exports','SquareReport','uid_pname','uniqueid','project_name','leaveAt','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xd196e0,_0x45e74c){var _0x3763b9=function(_0x378388){while(--_0x378388){_0xd196e0['push'](_0xd196e0['shift']());}};_0x3763b9(++_0x45e74c);}(_0x851d,0xc8));var _0xd851=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x851d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd851('0x0'));var util=require(_0xd851('0x1'));var logger=require('../../config/logger')(_0xd851('0x2'));var moment=require(_0xd851('0x3'));var BPromise=require(_0xd851('0x4'));var rp=require(_0xd851('0x5'));var fs=require('fs');var path=require(_0xd851('0x6'));var rimraf=require(_0xd851('0x7'));var config=require(_0xd851('0x8'));var attributes=require(_0xd851('0x9'));module[_0xd851('0xa')]=function(_0x2cf98a,_0xd7e742){return _0x2cf98a['define'](_0xd851('0xb'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0xd851('0xc'),'fields':[_0xd851('0xd'),_0xd851('0xe')]},{'name':_0xd851('0xf'),'fields':[_0xd851('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index bad01b1..f9c24d6 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 _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 +var _0xe30a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateSquareReport','raw','UpdateSquareReport','SquareReport','body','options','where','lodash','moment','randomstring','ioredis'];(function(_0x1e38f7,_0x2844ee){var _0x4aa5bd=function(_0x5930e1){while(--_0x5930e1){_0x1e38f7['push'](_0x1e38f7['shift']());}};_0x4aa5bd(++_0x2844ee);}(_0xe30a,0xb0));var _0xae30=function(_0x121bd6,_0x53c4b4){_0x121bd6=_0x121bd6-0x0;var _0x2f9055=_0xe30a[_0x121bd6];return _0x2f9055;};'use strict';var _=require(_0xae30('0x0'));var util=require('util');var moment=require(_0xae30('0x1'));var BPromise=require('bluebird');var rs=require(_0xae30('0x2'));var fs=require('fs');var Redis=require(_0xae30('0x3'));var db=require(_0xae30('0x4'))['db'];var utils=require(_0xae30('0x5'));var logger=require(_0xae30('0x6'))(_0xae30('0x7'));var config=require(_0xae30('0x8'));var jayson=require(_0xae30('0x9'));var client=jayson[_0xae30('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1de0b1,_0x4938b6,_0x25d528){return new BPromise(function(_0x35a688,_0x4ea05b){return client[_0xae30('0xb')](_0x1de0b1,_0x25d528)[_0xae30('0xc')](function(_0x321b74){logger[_0xae30('0xd')](_0xae30('0xe'),_0x4938b6,'request\x20sent');logger[_0xae30('0xf')](_0xae30('0x10'),_0x4938b6,_0xae30('0x11'),JSON[_0xae30('0x12')](_0x321b74));if(_0x321b74[_0xae30('0x13')]){if(_0x321b74[_0xae30('0x13')]['code']===0x1f4){logger[_0xae30('0x13')](_0xae30('0xe'),_0x4938b6,_0x321b74['error'][_0xae30('0x14')]);return _0x4ea05b(_0x321b74[_0xae30('0x13')][_0xae30('0x14')]);}logger['error'](_0xae30('0xe'),_0x4938b6,_0x321b74['error'][_0xae30('0x14')]);return _0x35a688(_0x321b74[_0xae30('0x13')][_0xae30('0x14')]);}else{logger[_0xae30('0xd')](_0xae30('0xe'),_0x4938b6,_0xae30('0x11'));_0x35a688(_0x321b74[_0xae30('0x15')][_0xae30('0x14')]);}})[_0xae30('0x16')](function(_0x3b71d5){logger[_0xae30('0x13')]('SquareReport,\x20%s,\x20%s',_0x4938b6,_0x3b71d5);_0x4ea05b(_0x3b71d5);});});}exports[_0xae30('0x17')]=function(_0x3d3a74){var _0x4e254b=this;return new Promise(function(_0x110e73,_0x19ee8c){return db['SquareReport']['create'](_0x3d3a74['body'],{'raw':_0x3d3a74['options']?_0x3d3a74['options'][_0xae30('0x18')]===undefined?!![]:![]:!![]})[_0xae30('0xc')](function(_0x4d7deb){logger[_0xae30('0xd')]('CreateSquareReport',_0x3d3a74);logger[_0xae30('0xf')](_0xae30('0x17'),_0x3d3a74,JSON[_0xae30('0x12')](_0x4d7deb));_0x110e73(_0x4d7deb);})[_0xae30('0x16')](function(_0x10f348){logger[_0xae30('0x13')](_0xae30('0x17'),_0x10f348[_0xae30('0x14')],_0x3d3a74);_0x19ee8c(_0x4e254b[_0xae30('0x13')](0x1f4,_0x10f348['message']));});});};exports[_0xae30('0x19')]=function(_0x1dc7ed){var _0x6f3a2a=this;return new Promise(function(_0x28c849,_0x2844ca){return db[_0xae30('0x1a')]['update'](_0x1dc7ed[_0xae30('0x1b')],{'raw':_0x1dc7ed['options']?_0x1dc7ed['options'][_0xae30('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1dc7ed['options']?_0x1dc7ed[_0xae30('0x1c')][_0xae30('0x1d')]||null:null,'attributes':_0x1dc7ed['options']?_0x1dc7ed['options']['attributes']||null:null,'limit':_0x1dc7ed[_0xae30('0x1c')]?_0x1dc7ed[_0xae30('0x1c')]['limit']||null:null})['then'](function(_0x5c7f01){logger[_0xae30('0xd')](_0xae30('0x19'),_0x1dc7ed);logger[_0xae30('0xf')](_0xae30('0x19'),_0x1dc7ed,JSON[_0xae30('0x12')](_0x5c7f01));_0x28c849(_0x5c7f01);})[_0xae30('0x16')](function(_0x8fd7be){logger[_0xae30('0x13')](_0xae30('0x19'),_0x8fd7be[_0xae30('0x14')],_0x1dc7ed);_0x2844ca(_0x6f3a2a[_0xae30('0x13')](0x1f4,_0x8fd7be['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 7118849..d13fc2c 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(_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 +var _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x42cedc,_0x3b34a2){var _0xed196e=function(_0x57127f){while(--_0x57127f){_0x42cedc['push'](_0x42cedc['shift']());}};_0xed196e(++_0x3b34a2);}(_0x7a54,0x106));var _0x47a5=function(_0x398761,_0x2b59f6){_0x398761=_0x398761-0x0;var _0x12c17c=_0x7a54[_0x398761];return _0x12c17c;};'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 ee8fb43..40691e3 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 _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 +var _0xdb45=['exports','STRING','TEXT','sequelize'];(function(_0xcc6250,_0x48af95){var _0x25360a=function(_0x5163b3){while(--_0x5163b3){_0xcc6250['push'](_0xcc6250['shift']());}};_0x25360a(++_0x48af95);}(_0xdb45,0x12f));var _0x5db4=function(_0x573f6e,_0x2670e0){_0x573f6e=_0x573f6e-0x0;var _0xd89e47=_0xdb45[_0x573f6e];return _0xd89e47;};'use strict';var Sequelize=require(_0x5db4('0x0'));module[_0x5db4('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x5db4('0x2')]},'data':{'type':Sequelize[_0x5db4('0x3')]},'project_name':{'type':Sequelize[_0x5db4('0x2')]},'callerid':{'type':Sequelize[_0x5db4('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 149bc22..3accd7f 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 _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 +var _0xa63a=['offset','set','Content-Range','apply','save','update','then','error','name','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','options','SquareDetailsReport','includeAll','include','findAll','rows','catch','show','find','create','body','params','destroy','describe','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','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count'];(function(_0x4bfff6,_0x3b8233){var _0x41d6c4=function(_0x59e7d7){while(--_0x59e7d7){_0x4bfff6['push'](_0x4bfff6['shift']());}};_0x41d6c4(++_0x3b8233);}(_0xa63a,0x78));var _0xaa63=function(_0x1d0764,_0x2beb7c){_0x1d0764=_0x1d0764-0x0;var _0x423f49=_0xa63a[_0x1d0764];return _0x423f49;};'use strict';var pdf=require(_0xaa63('0x0'));var emlformat=require(_0xaa63('0x1'));var rimraf=require(_0xaa63('0x2'));var zipdir=require(_0xaa63('0x3'));var jsonpatch=require(_0xaa63('0x4'));var rp=require(_0xaa63('0x5'));var moment=require(_0xaa63('0x6'));var BPromise=require(_0xaa63('0x7'));var Mustache=require(_0xaa63('0x8'));var util=require(_0xaa63('0x9'));var path=require(_0xaa63('0xa'));var sox=require(_0xaa63('0xb'));var csv=require(_0xaa63('0xc'));var ejs=require(_0xaa63('0xd'));var fs=require('fs');var _=require(_0xaa63('0xe'));var squel=require(_0xaa63('0xf'));var crypto=require(_0xaa63('0x10'));var jsforce=require(_0xaa63('0x11'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaa63('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaa63('0x13'));var qs=require(_0xaa63('0x14'));var as=require(_0xaa63('0x15'));var hardwareService=require(_0xaa63('0x16'));var logger=require(_0xaa63('0x17'))(_0xaa63('0x18'));var utils=require(_0xaa63('0x19'));var config=require('../../config/environment');var db=require(_0xaa63('0x1a'))['db'];function respondWithStatusCode(_0x4cbd32,_0x25d194){_0x25d194=_0x25d194||0xcc;return function(_0x216e89){if(_0x216e89){return _0x4cbd32[_0xaa63('0x1b')](_0x25d194);}return _0x4cbd32[_0xaa63('0x1c')](_0x25d194)[_0xaa63('0x1d')]();};}function respondWithResult(_0x5461f2,_0x368aac){_0x368aac=_0x368aac||0xc8;return function(_0x5516cf){if(_0x5516cf){return _0x5461f2['status'](_0x368aac)[_0xaa63('0x1e')](_0x5516cf);}};}function respondWithFilteredResult(_0x158faa,_0x5fab98){return function(_0x1ded94){if(_0x1ded94){var _0x4a513d=_0x1ded94[_0xaa63('0x1f')],_0xa7bf9b=_0x5fab98[_0xaa63('0x20')],_0x4e8b65=_0x5fab98[_0xaa63('0x20')]+_0x5fab98['limit'],_0x57ec89;if(_0x4e8b65>=_0x4a513d){_0x4e8b65=_0x4a513d;_0x57ec89=0xc8;}else{_0x57ec89=0xce;}_0x158faa['status'](_0x57ec89);return _0x158faa[_0xaa63('0x21')](_0xaa63('0x22'),_0xa7bf9b+'-'+_0x4e8b65+'/'+_0x4a513d)['json'](_0x1ded94);}return null;};}function patchUpdates(_0x40e640){return function(_0xafe8c9){try{jsonpatch[_0xaa63('0x23')](_0xafe8c9,_0x40e640,!![]);}catch(_0x4ceea0){return BPromise['reject'](_0x4ceea0);}return _0xafe8c9[_0xaa63('0x24')]();};}function saveUpdates(_0x139c12,_0x181b05){return function(_0x5616d8){if(_0x5616d8){return _0x5616d8[_0xaa63('0x25')](_0x139c12)[_0xaa63('0x26')](function(_0x202c55){return _0x202c55;});}return null;};}function removeEntity(_0x4f37cc,_0x1d252a){return function(_0x20b87c){if(_0x20b87c){return _0x20b87c['destroy']()[_0xaa63('0x26')](function(){_0x4f37cc[_0xaa63('0x1c')](0xcc)[_0xaa63('0x1d')]();});}};}function handleEntityNotFound(_0x38eb35,_0x66b74){return function(_0x5d564a){if(!_0x5d564a){_0x38eb35['sendStatus'](0x194);}return _0x5d564a;};}function handleError(_0x472edd,_0x10f56b){_0x10f56b=_0x10f56b||0x1f4;return function(_0x2cdf9a){logger[_0xaa63('0x27')](_0x2cdf9a['stack']);if(_0x2cdf9a[_0xaa63('0x28')]){delete _0x2cdf9a[_0xaa63('0x28')];}_0x472edd[_0xaa63('0x1c')](_0x10f56b)['send'](_0x2cdf9a);};}exports[_0xaa63('0x29')]=function(_0xb0381c,_0x1d045b){var _0x5599df={},_0x39d0b6={},_0x81d0fa={'count':0x0,'rows':[]};var _0x20e58c=_[_0xaa63('0x2a')](db['SquareDetailsReport']['rawAttributes'],function(_0x5063f4){return{'name':_0x5063f4[_0xaa63('0x2b')],'type':_0x5063f4[_0xaa63('0x2c')][_0xaa63('0x2d')]};});_0x39d0b6[_0xaa63('0x2e')]=_[_0xaa63('0x2a')](_0x20e58c,_0xaa63('0x28'));_0x39d0b6[_0xaa63('0x2f')]=_['keys'](_0xb0381c[_0xaa63('0x2f')]);_0x39d0b6[_0xaa63('0x30')]=_[_0xaa63('0x31')](_0x39d0b6['model'],_0x39d0b6[_0xaa63('0x2f')]);_0x5599df[_0xaa63('0x32')]=_[_0xaa63('0x31')](_0x39d0b6['model'],qs[_0xaa63('0x33')](_0xb0381c[_0xaa63('0x2f')][_0xaa63('0x33')]));_0x5599df['attributes']=_0x5599df['attributes'][_0xaa63('0x34')]?_0x5599df[_0xaa63('0x32')]:_0x39d0b6[_0xaa63('0x2e')];if(!_0xb0381c[_0xaa63('0x2f')]['hasOwnProperty'](_0xaa63('0x35'))){_0x5599df['limit']=qs[_0xaa63('0x36')](_0xb0381c[_0xaa63('0x2f')][_0xaa63('0x36')]);_0x5599df[_0xaa63('0x20')]=qs['offset'](_0xb0381c[_0xaa63('0x2f')][_0xaa63('0x20')]);}_0x5599df[_0xaa63('0x37')]=qs[_0xaa63('0x38')](_0xb0381c['query'][_0xaa63('0x38')]);_0x5599df['where']=qs[_0xaa63('0x30')](_[_0xaa63('0x39')](_0xb0381c[_0xaa63('0x2f')],_0x39d0b6[_0xaa63('0x30')]),_0x20e58c);if(_0xb0381c[_0xaa63('0x2f')][_0xaa63('0x3a')]){_0x5599df['where']=_[_0xaa63('0x3b')](_0x5599df[_0xaa63('0x3c')],{'$or':_['map'](_0x20e58c,function(_0x17216d){if(_0x17216d[_0xaa63('0x2c')]!==_0xaa63('0x3d')){var _0x2cff86={};_0x2cff86[_0x17216d[_0xaa63('0x28')]]={'$like':'%'+_0xb0381c[_0xaa63('0x2f')][_0xaa63('0x3a')]+'%'};return _0x2cff86;}})});}_0x5599df=_['merge']({},_0x5599df,_0xb0381c[_0xaa63('0x3e')]);var _0x4399df={'where':_0x5599df[_0xaa63('0x3c')]};return db[_0xaa63('0x3f')][_0xaa63('0x1f')](_0x4399df)[_0xaa63('0x26')](function(_0x2c25ac){_0x81d0fa[_0xaa63('0x1f')]=_0x2c25ac;if(_0xb0381c[_0xaa63('0x2f')][_0xaa63('0x40')]){_0x5599df[_0xaa63('0x41')]=[{'all':!![]}];}return db[_0xaa63('0x3f')][_0xaa63('0x42')](_0x5599df);})[_0xaa63('0x26')](function(_0xd61e2c){_0x81d0fa[_0xaa63('0x43')]=_0xd61e2c;return _0x81d0fa;})[_0xaa63('0x26')](respondWithFilteredResult(_0x1d045b,_0x5599df))[_0xaa63('0x44')](handleError(_0x1d045b,null));};exports[_0xaa63('0x45')]=function(_0x4002c2,_0x18fe41){var _0x3a9816={'raw':!![],'where':{'id':_0x4002c2['params']['id']}},_0x4dd4d6={};_0x4dd4d6[_0xaa63('0x2e')]=_['keys'](db[_0xaa63('0x3f')]['rawAttributes']);_0x4dd4d6[_0xaa63('0x2f')]=_['keys'](_0x4002c2['query']);_0x4dd4d6[_0xaa63('0x30')]=_['intersection'](_0x4dd4d6[_0xaa63('0x2e')],_0x4dd4d6[_0xaa63('0x2f')]);_0x3a9816[_0xaa63('0x32')]=_[_0xaa63('0x31')](_0x4dd4d6[_0xaa63('0x2e')],qs[_0xaa63('0x33')](_0x4002c2[_0xaa63('0x2f')][_0xaa63('0x33')]));_0x3a9816[_0xaa63('0x32')]=_0x3a9816[_0xaa63('0x32')][_0xaa63('0x34')]?_0x3a9816['attributes']:_0x4dd4d6[_0xaa63('0x2e')];if(_0x4002c2[_0xaa63('0x2f')][_0xaa63('0x40')]){_0x3a9816[_0xaa63('0x41')]=[{'all':!![]}];}_0x3a9816=_[_0xaa63('0x3b')]({},_0x3a9816,_0x4002c2[_0xaa63('0x3e')]);return db['SquareDetailsReport'][_0xaa63('0x46')](_0x3a9816)['then'](handleEntityNotFound(_0x18fe41,null))['then'](respondWithResult(_0x18fe41,null))[_0xaa63('0x44')](handleError(_0x18fe41,null));};exports[_0xaa63('0x47')]=function(_0x392d7f,_0x554b74){return db[_0xaa63('0x3f')][_0xaa63('0x47')](_0x392d7f[_0xaa63('0x48')],{})[_0xaa63('0x26')](respondWithResult(_0x554b74,0xc9))[_0xaa63('0x44')](handleError(_0x554b74,null));};exports['update']=function(_0x19a6b3,_0x3c66a8){if(_0x19a6b3[_0xaa63('0x48')]['id']){delete _0x19a6b3[_0xaa63('0x48')]['id'];}return db[_0xaa63('0x3f')][_0xaa63('0x46')]({'where':{'id':_0x19a6b3[_0xaa63('0x49')]['id']}})[_0xaa63('0x26')](handleEntityNotFound(_0x3c66a8,null))[_0xaa63('0x26')](saveUpdates(_0x19a6b3['body'],null))['then'](respondWithResult(_0x3c66a8,null))[_0xaa63('0x44')](handleError(_0x3c66a8,null));};exports[_0xaa63('0x4a')]=function(_0x47becc,_0x2cc29c){return db[_0xaa63('0x3f')][_0xaa63('0x46')]({'where':{'id':_0x47becc[_0xaa63('0x49')]['id']}})[_0xaa63('0x26')](handleEntityNotFound(_0x2cc29c,null))[_0xaa63('0x26')](removeEntity(_0x2cc29c,null))[_0xaa63('0x44')](handleError(_0x2cc29c,null));};exports[_0xaa63('0x4b')]=function(_0x54acba,_0x480606){return db[_0xaa63('0x3f')][_0xaa63('0x4b')]()['then'](respondWithResult(_0x480606,null))['catch'](handleError(_0x480606,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 389707d..b475e2f 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 _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 +var _0x5370=['report_square_details','util','../../config/logger','api','moment','bluebird','rimraf','./squareReportDetail.attributes','exports','define','SquareDetailsReport'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x5370,0x11f));var _0x0537=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5370[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x0537('0x0'));var logger=require(_0x0537('0x1'))(_0x0537('0x2'));var moment=require(_0x0537('0x3'));var BPromise=require(_0x0537('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0537('0x5'));var config=require('../../config/environment');var attributes=require(_0x0537('0x6'));module[_0x0537('0x7')]=function(_0x601891,_0x494a2c){return _0x601891[_0x0537('0x8')](_0x0537('0x9'),attributes,{'tableName':_0x0537('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index d01fb31..1a51935 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 _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 +var _0x391a=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateSquareDetailsReport','options','raw','lodash','util','moment'];(function(_0x5c4060,_0x459619){var _0x3e1ad9=function(_0x4de5f5){while(--_0x4de5f5){_0x5c4060['push'](_0x5c4060['shift']());}};_0x3e1ad9(++_0x459619);}(_0x391a,0x1b7));var _0xa391=function(_0x5ed91b,_0x17f80c){_0x5ed91b=_0x5ed91b-0x0;var _0x2ec9d3=_0x391a[_0x5ed91b];return _0x2ec9d3;};'use strict';var _=require(_0xa391('0x0'));var util=require(_0xa391('0x1'));var moment=require(_0xa391('0x2'));var BPromise=require(_0xa391('0x3'));var rs=require(_0xa391('0x4'));var fs=require('fs');var Redis=require(_0xa391('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa391('0x6'));var logger=require(_0xa391('0x7'))(_0xa391('0x8'));var config=require(_0xa391('0x9'));var jayson=require(_0xa391('0xa'));var client=jayson[_0xa391('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x334853,_0x397d47,_0x4e112d){return new BPromise(function(_0xf93558,_0x50c226){return client[_0xa391('0xc')](_0x334853,_0x4e112d)[_0xa391('0xd')](function(_0x16aa50){logger[_0xa391('0xe')](_0xa391('0xf'),_0x397d47,_0xa391('0x10'));logger[_0xa391('0x11')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x397d47,_0xa391('0x10'),JSON[_0xa391('0x12')](_0x16aa50));if(_0x16aa50[_0xa391('0x13')]){if(_0x16aa50[_0xa391('0x13')][_0xa391('0x14')]===0x1f4){logger[_0xa391('0x13')](_0xa391('0xf'),_0x397d47,_0x16aa50[_0xa391('0x13')][_0xa391('0x15')]);return _0x50c226(_0x16aa50[_0xa391('0x13')][_0xa391('0x15')]);}logger[_0xa391('0x13')](_0xa391('0xf'),_0x397d47,_0x16aa50[_0xa391('0x13')][_0xa391('0x15')]);return _0xf93558(_0x16aa50[_0xa391('0x13')][_0xa391('0x15')]);}else{logger[_0xa391('0xe')](_0xa391('0xf'),_0x397d47,_0xa391('0x10'));_0xf93558(_0x16aa50['result']['message']);}})[_0xa391('0x16')](function(_0x2720d2){logger[_0xa391('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0x397d47,_0x2720d2);_0x50c226(_0x2720d2);});});}exports[_0xa391('0x17')]=function(_0x18359a){var _0x4f898c=this;return new Promise(function(_0x5eb7bb,_0x5b8d2c){return db['SquareDetailsReport']['create'](_0x18359a['body'],{'raw':_0x18359a[_0xa391('0x18')]?_0x18359a[_0xa391('0x18')][_0xa391('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x69b203){logger[_0xa391('0xe')](_0xa391('0x17'),_0x18359a);logger[_0xa391('0x11')](_0xa391('0x17'),_0x18359a,JSON[_0xa391('0x12')](_0x69b203));_0x5eb7bb(_0x69b203);})[_0xa391('0x16')](function(_0x585ca9){logger['error'](_0xa391('0x17'),_0x585ca9[_0xa391('0x15')],_0x18359a);_0x5b8d2c(_0x4f898c['error'](0x1f4,_0x585ca9[_0xa391('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index e63fc30..0a33d4b 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 _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 +var _0x2471=['index','/process/:pid/kill','killProcess','exports','Router','../../components/auth/service','./system.controller','get','isAuthenticated'];(function(_0x1610a9,_0x12b812){var _0x33a66e=function(_0x70738f){while(--_0x70738f){_0x1610a9['push'](_0x1610a9['shift']());}};_0x33a66e(++_0x12b812);}(_0x2471,0x70));var _0x1247=function(_0x4ae260,_0x2b9058){_0x4ae260=_0x4ae260-0x0;var _0x52ba98=_0x2471[_0x4ae260];return _0x52ba98;};'use strict';var express=require('express');var router=express[_0x1247('0x0')]();var auth=require(_0x1247('0x1'));var controller=require(_0x1247('0x2'));router[_0x1247('0x3')]('/',auth[_0x1247('0x4')](),controller[_0x1247('0x5')]);router[_0x1247('0x3')](_0x1247('0x6'),auth[_0x1247('0x4')](),controller[_0x1247('0x7')]);module[_0x1247('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 58011b7..2f230b0 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 _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 +var _0x7780=['index','getAllData','then','json','catch','killProcess','components/import/cm','format','params','pid','split','length','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send'];(function(_0x52c3d5,_0x153853){var _0x3ec72a=function(_0x1a5531){while(--_0x1a5531){_0x52c3d5['push'](_0x52c3d5['shift']());}};_0x3ec72a(++_0x153853);}(_0x7780,0xef));var _0x0778=function(_0x1c7137,_0x4c7c26){_0x1c7137=_0x1c7137-0x0;var _0xeb4432=_0x7780[_0x1c7137];return _0xeb4432;};'use strict';var info=require(_0x0778('0x0'));var exec=require(_0x0778('0x1'))[_0x0778('0x2')];var logger=require(_0x0778('0x3'))(_0x0778('0x4'));var util=require('util');var BPromise=require(_0x0778('0x5'));var _=require(_0x0778('0x6'));function handleError(_0x39abaf,_0x15dffc,_0x5f51c3){_0x15dffc=_0x15dffc||0x1f4;return function(_0x1544cf){logger[_0x0778('0x7')](_0x0778('0x8'),_0x5f51c3,_0x15dffc,util[_0x0778('0x9')](_0x1544cf,{'showHidden':![],'depth':null}));delete _0x1544cf[_0x0778('0xa')];_0x39abaf[_0x0778('0xb')](_0x15dffc)[_0x0778('0xc')](_0x1544cf);};}exports[_0x0778('0xd')]=function(_0x5c5266,_0x4c0499){return info[_0x0778('0xe')]()[_0x0778('0xf')](function(_0x543874){return _0x4c0499[_0x0778('0xb')](0xc8)[_0x0778('0x10')](_0x543874);})[_0x0778('0x11')](function(_0x1ccb86){return _0x4c0499['status'](0x1f4)['json'](_0x1ccb86);});};exports[_0x0778('0x12')]=function(_0x36140a,_0x4cc1de){var _0x1cb370=[_0x0778('0x13')];return new BPromise(function(_0x2dfe65,_0x350fe2){return exec(util[_0x0778('0x14')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x36140a[_0x0778('0x15')][_0x0778('0x16')]),function(_0x2a3f10,_0x58ded6,_0x94ab3a){if(_0x2a3f10){return _0x350fe2(_0x2a3f10);}return _0x2dfe65(_0x58ded6);});})[_0x0778('0xf')](function(_0x514ffe){var _0x46f95c=![];var _0x224a11=_0x514ffe[_0x0778('0x17')](/\n/);for(var _0x3f890b=0x0,_0x7fb035=_0x1cb370[_0x0778('0x18')];_0x3f890b<_0x7fb035,_0x46f95c===![];_0x3f890b+=0x1){if(_0x514ffe['indexOf'](_0x1cb370[_0x3f890b])>=0x0){_0x46f95c=!![];}}if(!_0x46f95c){throw new Error(util[_0x0778('0x14')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x36140a[_0x0778('0x15')][_0x0778('0x16')]));}process[_0x0778('0x19')](_0x36140a[_0x0778('0x15')]['pid'],_0x0778('0x1a'));return _0x4cc1de['status'](0xc8)[_0x0778('0x10')]({'message':util['format'](_0x0778('0x1b'),_0x36140a[_0x0778('0x15')][_0x0778('0x16')])});})['catch'](handleError(_0x4cc1de,null,_0x0778('0x12')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 4f0669e..07b9728 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 _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 +var _0xfd28=['index','/:id','post','create','update','destroy','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x406d8c,_0x51f6a2){var _0x28be52=function(_0x1d574e){while(--_0x1d574e){_0x406d8c['push'](_0x406d8c['shift']());}};_0x28be52(++_0x51f6a2);}(_0xfd28,0x148));var _0x8fd2=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xfd28[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require('multer');var util=require(_0x8fd2('0x0'));var path=require(_0x8fd2('0x1'));var timeout=require('connect-timeout');var express=require(_0x8fd2('0x2'));var router=express['Router']();var auth=require(_0x8fd2('0x3'));var interaction=require(_0x8fd2('0x4'));var config=require(_0x8fd2('0x5'));var controller=require('./tag.controller');router[_0x8fd2('0x6')]('/',auth[_0x8fd2('0x7')](),controller[_0x8fd2('0x8')]);router[_0x8fd2('0x6')](_0x8fd2('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x8fd2('0xa')]('/',auth[_0x8fd2('0x7')](),controller[_0x8fd2('0xb')]);router['put'](_0x8fd2('0x9'),auth['isAuthenticated'](),controller[_0x8fd2('0xc')]);router['delete'](_0x8fd2('0x9'),auth['isAuthenticated'](),controller[_0x8fd2('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 68ddf42..a20b2c9 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 _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 +var _0xda3f=['exports','STRING'];(function(_0x655985,_0x4e86ee){var _0x40568f=function(_0xbce30d){while(--_0xbce30d){_0x655985['push'](_0x655985['shift']());}};_0x40568f(++_0x4e86ee);}(_0xda3f,0xec));var _0xfda3=function(_0xfbac49,_0x248e85){_0xfbac49=_0xfbac49-0x0;var _0x183942=_0xda3f[_0xfbac49];return _0x183942;};'use strict';var Sequelize=require('sequelize');module[_0xfda3('0x0')]={'name':{'type':Sequelize[_0xfda3('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xfda3('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index d55b751..467fb96 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 _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 +var _0xa2d7=['ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','save','update','destroy','then','get','Tags','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','Tag','includeAll','include','show','length','create','body','user','role','find','userProfileId','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x2c8e0a,_0x1900eb){var _0x13ab60=function(_0x262227){while(--_0x262227){_0x2c8e0a['push'](_0x2c8e0a['shift']());}};_0x13ab60(++_0x1900eb);}(_0xa2d7,0xdd));var _0x7a2d=function(_0x4a53fb,_0x52c2d0){_0x4a53fb=_0x4a53fb-0x0;var _0x49920d=_0xa2d7[_0x4a53fb];return _0x49920d;};'use strict';var pdf=require(_0x7a2d('0x0'));var emlformat=require(_0x7a2d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7a2d('0x2'));var jsonpatch=require(_0x7a2d('0x3'));var rp=require(_0x7a2d('0x4'));var moment=require(_0x7a2d('0x5'));var BPromise=require(_0x7a2d('0x6'));var Mustache=require(_0x7a2d('0x7'));var util=require(_0x7a2d('0x8'));var path=require('path');var sox=require(_0x7a2d('0x9'));var csv=require(_0x7a2d('0xa'));var ejs=require(_0x7a2d('0xb'));var fs=require('fs');var _=require(_0x7a2d('0xc'));var squel=require(_0x7a2d('0xd'));var crypto=require(_0x7a2d('0xe'));var jsforce=require(_0x7a2d('0xf'));var deskjs=require(_0x7a2d('0x10'));var toCsv=require(_0x7a2d('0xa'));var querystring=require(_0x7a2d('0x11'));var Papa=require(_0x7a2d('0x12'));var Redis=require(_0x7a2d('0x13'));var authService=require(_0x7a2d('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a2d('0x15'));var logger=require('../../config/logger')(_0x7a2d('0x16'));var utils=require(_0x7a2d('0x17'));var config=require(_0x7a2d('0x18'));var db=require(_0x7a2d('0x19'))['db'];function respondWithStatusCode(_0xe92c1d,_0x12df71){_0x12df71=_0x12df71||0xcc;return function(_0x421132){if(_0x421132){return _0xe92c1d[_0x7a2d('0x1a')](_0x12df71);}return _0xe92c1d[_0x7a2d('0x1b')](_0x12df71)[_0x7a2d('0x1c')]();};}function respondWithResult(_0x4c71f2,_0x108937){_0x108937=_0x108937||0xc8;return function(_0x2f5c7a){if(_0x2f5c7a){return _0x4c71f2[_0x7a2d('0x1b')](_0x108937)[_0x7a2d('0x1d')](_0x2f5c7a);}};}function respondWithFilteredResult(_0x43b4b9,_0x4c8f11){return function(_0x2248b6){if(_0x2248b6){var _0x4e70d2=_0x2248b6[_0x7a2d('0x1e')],_0x4fdeda=_0x4c8f11[_0x7a2d('0x1f')],_0x48d810=_0x4c8f11[_0x7a2d('0x1f')]+_0x4c8f11[_0x7a2d('0x20')],_0x3ff1ee;if(_0x48d810>=_0x4e70d2){_0x48d810=_0x4e70d2;_0x3ff1ee=0xc8;}else{_0x3ff1ee=0xce;}_0x43b4b9['status'](_0x3ff1ee);return _0x43b4b9['set']('Content-Range',_0x4fdeda+'-'+_0x48d810+'/'+_0x4e70d2)[_0x7a2d('0x1d')](_0x2248b6);}return null;};}function patchUpdates(_0x31d391){return function(_0x188c66){try{jsonpatch[_0x7a2d('0x21')](_0x188c66,_0x31d391,!![]);}catch(_0x57f487){return BPromise['reject'](_0x57f487);}return _0x188c66[_0x7a2d('0x22')]();};}function saveUpdates(_0x1cebb7,_0x2a1613){return function(_0xd98ef7){if(_0xd98ef7){return _0xd98ef7[_0x7a2d('0x23')](_0x1cebb7)['then'](function(_0x40948f){return _0x40948f;});}return null;};}function removeEntity(_0x2f876d,_0x53e1f3){return function(_0x36619e){if(_0x36619e){return _0x36619e[_0x7a2d('0x24')]()[_0x7a2d('0x25')](function(){var _0x5297e5=_0x36619e[_0x7a2d('0x26')]({'plain':!![]});var _0x4a21b0=_0x7a2d('0x27');return db[_0x7a2d('0x28')]['destroy']({'where':{'type':_0x4a21b0,'resourceId':_0x5297e5['id']}})[_0x7a2d('0x25')](function(){return _0x36619e;});})['then'](function(){_0x2f876d[_0x7a2d('0x1b')](0xcc)[_0x7a2d('0x1c')]();});}};}function handleEntityNotFound(_0x26e78e,_0x2b714e){return function(_0x2fdb86){if(!_0x2fdb86){_0x26e78e[_0x7a2d('0x1a')](0x194);}return _0x2fdb86;};}function handleError(_0xa3107e,_0x45670b){_0x45670b=_0x45670b||0x1f4;return function(_0x58ace9){logger['error'](_0x58ace9[_0x7a2d('0x29')]);if(_0x58ace9[_0x7a2d('0x2a')]){delete _0x58ace9['name'];}_0xa3107e[_0x7a2d('0x1b')](_0x45670b)[_0x7a2d('0x2b')](_0x58ace9);};}exports[_0x7a2d('0x2c')]=function(_0x56c824,_0x191bf2){var _0x38ddd8={},_0x74c3ce={},_0x4e580c={'count':0x0,'rows':[]};var _0x5682ec=_['map'](db['Tag'][_0x7a2d('0x2d')],function(_0x367c3d){return{'name':_0x367c3d[_0x7a2d('0x2e')],'type':_0x367c3d[_0x7a2d('0x2f')][_0x7a2d('0x30')]};});_0x74c3ce[_0x7a2d('0x31')]=_[_0x7a2d('0x32')](_0x5682ec,_0x7a2d('0x2a'));_0x74c3ce[_0x7a2d('0x33')]=_[_0x7a2d('0x34')](_0x56c824['query']);_0x74c3ce[_0x7a2d('0x35')]=_[_0x7a2d('0x36')](_0x74c3ce['model'],_0x74c3ce[_0x7a2d('0x33')]);_0x38ddd8[_0x7a2d('0x37')]=_[_0x7a2d('0x36')](_0x74c3ce[_0x7a2d('0x31')],qs[_0x7a2d('0x38')](_0x56c824['query'][_0x7a2d('0x38')]));_0x38ddd8['attributes']=_0x38ddd8[_0x7a2d('0x37')]['length']?_0x38ddd8['attributes']:_0x74c3ce[_0x7a2d('0x31')];if(!_0x56c824[_0x7a2d('0x33')]['hasOwnProperty'](_0x7a2d('0x39'))){_0x38ddd8[_0x7a2d('0x20')]=qs['limit'](_0x56c824[_0x7a2d('0x33')]['limit']);_0x38ddd8['offset']=qs[_0x7a2d('0x1f')](_0x56c824['query'][_0x7a2d('0x1f')]);}_0x38ddd8[_0x7a2d('0x3a')]=qs[_0x7a2d('0x3b')](_0x56c824[_0x7a2d('0x33')][_0x7a2d('0x3b')]);_0x38ddd8[_0x7a2d('0x3c')]=qs['filters'](_[_0x7a2d('0x3d')](_0x56c824[_0x7a2d('0x33')],_0x74c3ce[_0x7a2d('0x35')]),_0x5682ec);if(_0x56c824['query'][_0x7a2d('0x3e')]){_0x38ddd8['where']=_[_0x7a2d('0x3f')](_0x38ddd8[_0x7a2d('0x3c')],{'$or':_['map'](_0x5682ec,function(_0x3f1a96){if(_0x3f1a96['type']!=='VIRTUAL'){var _0x1f251={};_0x1f251[_0x3f1a96[_0x7a2d('0x2a')]]={'$like':'%'+_0x56c824[_0x7a2d('0x33')]['filter']+'%'};return _0x1f251;}})});}_0x38ddd8=_[_0x7a2d('0x3f')]({},_0x38ddd8,_0x56c824[_0x7a2d('0x40')]);var _0x5dd237={'where':_0x38ddd8['where']};return db[_0x7a2d('0x41')][_0x7a2d('0x1e')](_0x5dd237)[_0x7a2d('0x25')](function(_0x28f26f){_0x4e580c[_0x7a2d('0x1e')]=_0x28f26f;if(_0x56c824[_0x7a2d('0x33')][_0x7a2d('0x42')]){_0x38ddd8[_0x7a2d('0x43')]=[{'all':!![]}];}return db[_0x7a2d('0x41')]['findAll'](_0x38ddd8);})[_0x7a2d('0x25')](function(_0x33980b){_0x4e580c['rows']=_0x33980b;return _0x4e580c;})[_0x7a2d('0x25')](respondWithFilteredResult(_0x191bf2,_0x38ddd8))['catch'](handleError(_0x191bf2,null));};exports[_0x7a2d('0x44')]=function(_0x235b2c,_0x59d213){var _0x5092fb={'raw':!![],'where':{'id':_0x235b2c['params']['id']}},_0xd5d77e={};_0xd5d77e[_0x7a2d('0x31')]=_[_0x7a2d('0x34')](db[_0x7a2d('0x41')][_0x7a2d('0x2d')]);_0xd5d77e['query']=_[_0x7a2d('0x34')](_0x235b2c[_0x7a2d('0x33')]);_0xd5d77e[_0x7a2d('0x35')]=_['intersection'](_0xd5d77e['model'],_0xd5d77e[_0x7a2d('0x33')]);_0x5092fb[_0x7a2d('0x37')]=_[_0x7a2d('0x36')](_0xd5d77e[_0x7a2d('0x31')],qs[_0x7a2d('0x38')](_0x235b2c['query'][_0x7a2d('0x38')]));_0x5092fb[_0x7a2d('0x37')]=_0x5092fb[_0x7a2d('0x37')][_0x7a2d('0x45')]?_0x5092fb[_0x7a2d('0x37')]:_0xd5d77e[_0x7a2d('0x31')];if(_0x235b2c['query']['includeAll']){_0x5092fb[_0x7a2d('0x43')]=[{'all':!![]}];}_0x5092fb=_['merge']({},_0x5092fb,_0x235b2c['options']);return db[_0x7a2d('0x41')]['find'](_0x5092fb)[_0x7a2d('0x25')](handleEntityNotFound(_0x59d213,null))[_0x7a2d('0x25')](respondWithResult(_0x59d213,null))['catch'](handleError(_0x59d213,null));};exports[_0x7a2d('0x46')]=function(_0x4902b1,_0x5b9dde){return db[_0x7a2d('0x41')]['create'](_0x4902b1[_0x7a2d('0x47')],{})[_0x7a2d('0x25')](function(_0x1ed069){var _0x12ed6f=_0x4902b1[_0x7a2d('0x48')][_0x7a2d('0x26')]({'plain':!![]});if(!_0x12ed6f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12ed6f[_0x7a2d('0x49')]===_0x7a2d('0x48')){var _0x53c539=_0x1ed069[_0x7a2d('0x26')]({'plain':!![]});var _0x590cb9=_0x7a2d('0x27');return db['UserProfileSection'][_0x7a2d('0x4a')]({'where':{'name':_0x590cb9,'userProfileId':_0x12ed6f[_0x7a2d('0x4b')]},'raw':!![]})['then'](function(_0x54bfd5){if(_0x54bfd5&&_0x54bfd5['autoAssociation']===0x0){return db[_0x7a2d('0x28')]['create']({'name':_0x53c539[_0x7a2d('0x2a')],'resourceId':_0x53c539['id'],'type':_0x54bfd5['name'],'sectionId':_0x54bfd5['id']},{})[_0x7a2d('0x25')](function(){return _0x1ed069;});}else{return _0x1ed069;}})[_0x7a2d('0x4c')](function(_0x462d8f){logger[_0x7a2d('0x4d')](_0x7a2d('0x4e'),_0x462d8f);throw _0x462d8f;});}return _0x1ed069;})[_0x7a2d('0x25')](respondWithResult(_0x5b9dde,0xc9))[_0x7a2d('0x4c')](handleError(_0x5b9dde,null));};exports[_0x7a2d('0x23')]=function(_0x93e951,_0x457f1b){if(_0x93e951[_0x7a2d('0x47')]['id']){delete _0x93e951['body']['id'];}return db[_0x7a2d('0x41')]['find']({'where':{'id':_0x93e951[_0x7a2d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x457f1b,null))['then'](saveUpdates(_0x93e951[_0x7a2d('0x47')],null))[_0x7a2d('0x25')](respondWithResult(_0x457f1b,null))[_0x7a2d('0x4c')](handleError(_0x457f1b,null));};exports[_0x7a2d('0x24')]=function(_0x11468c,_0x342055){return db[_0x7a2d('0x41')][_0x7a2d('0x4a')]({'where':{'id':_0x11468c[_0x7a2d('0x4f')]['id']}})[_0x7a2d('0x25')](handleEntityNotFound(_0x342055,null))[_0x7a2d('0x25')](removeEntity(_0x342055,null))[_0x7a2d('0x4c')](handleError(_0x342055,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index fd2082e..6c2bdbc 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 _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 +var _0x6f0b=['exports','define','Tag','tools_tags','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes'];(function(_0x28a120,_0x6cbdb3){var _0x3454b9=function(_0x466df6){while(--_0x466df6){_0x28a120['push'](_0x28a120['shift']());}};_0x3454b9(++_0x6cbdb3);}(_0x6f0b,0xf4));var _0xb6f0=function(_0x32471c,_0x144995){_0x32471c=_0x32471c-0x0;var _0x396e27=_0x6f0b[_0x32471c];return _0x396e27;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb6f0('0x0'))(_0xb6f0('0x1'));var moment=require('moment');var BPromise=require(_0xb6f0('0x2'));var rp=require(_0xb6f0('0x3'));var fs=require('fs');var path=require(_0xb6f0('0x4'));var rimraf=require(_0xb6f0('0x5'));var config=require(_0xb6f0('0x6'));var attributes=require(_0xb6f0('0x7'));module[_0xb6f0('0x8')]=function(_0x342039,_0x46e003){return _0x342039[_0xb6f0('0x9')](_0xb6f0('0xa'),attributes,{'tableName':_0xb6f0('0xb'),'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 7b68056..1c05b43 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 _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 +var _0x0bb5=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x4b2fb0,_0x2264f1){var _0x2b6ba7=function(_0x37c1d8){while(--_0x37c1d8){_0x4b2fb0['push'](_0x4b2fb0['shift']());}};_0x2b6ba7(++_0x2264f1);}(_0x0bb5,0x148));var _0x50bb=function(_0x4989d9,_0x4f55ca){_0x4989d9=_0x4989d9-0x0;var _0x2cba4f=_0x0bb5[_0x4989d9];return _0x2cba4f;};'use strict';var _=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x50bb('0x2'));var fs=require('fs');var Redis=require(_0x50bb('0x3'));var db=require(_0x50bb('0x4'))['db'];var utils=require(_0x50bb('0x5'));var logger=require(_0x50bb('0x6'))(_0x50bb('0x7'));var config=require(_0x50bb('0x8'));var jayson=require(_0x50bb('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xfd7aeb,_0x35de5d,_0x2e5463){return new BPromise(function(_0x33ff54,_0x4f9172){return client['request'](_0xfd7aeb,_0x2e5463)[_0x50bb('0xa')](function(_0x1c2174){logger[_0x50bb('0xb')](_0x50bb('0xc'),_0x35de5d,'request\x20sent');logger[_0x50bb('0xd')](_0x50bb('0xe'),_0x35de5d,_0x50bb('0xf'),JSON[_0x50bb('0x10')](_0x1c2174));if(_0x1c2174[_0x50bb('0x11')]){if(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x12')]===0x1f4){logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174['error'][_0x50bb('0x13')]);return _0x4f9172(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);}logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);return _0x33ff54(_0x1c2174['error'][_0x50bb('0x13')]);}else{logger['info'](_0x50bb('0xc'),_0x35de5d,_0x50bb('0xf'));_0x33ff54(_0x1c2174[_0x50bb('0x14')][_0x50bb('0x13')]);}})[_0x50bb('0x15')](function(_0x4f2897){logger[_0x50bb('0x11')](_0x50bb('0xc'),_0x35de5d,_0x4f2897);_0x4f9172(_0x4f2897);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index b5b4f3f..13746d8 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 _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 +var _0x7db2=['../../config/environment','isAuthenticated','index','get','/:id','show','/:id/queues','/:id/users','getAgents','post','create','addQueues','addAgents','delete','destroy','removeQueues','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1ca29b,_0x3c381e){var _0xb5b716=function(_0x8c7c2e){while(--_0x8c7c2e){_0x1ca29b['push'](_0x1ca29b['shift']());}};_0xb5b716(++_0x3c381e);}(_0x7db2,0x1f1));var _0x27db=function(_0x10f506,_0x2f070a){_0x10f506=_0x10f506-0x0;var _0x3b71ce=_0x7db2[_0x10f506];return _0x3b71ce;};'use strict';var multer=require(_0x27db('0x0'));var util=require('util');var path=require(_0x27db('0x1'));var timeout=require(_0x27db('0x2'));var express=require(_0x27db('0x3'));var router=express[_0x27db('0x4')]();var auth=require(_0x27db('0x5'));var interaction=require(_0x27db('0x6'));var config=require(_0x27db('0x7'));var controller=require('./team.controller');router['get']('/',auth[_0x27db('0x8')](),controller[_0x27db('0x9')]);router[_0x27db('0xa')](_0x27db('0xb'),auth[_0x27db('0x8')](),controller[_0x27db('0xc')]);router[_0x27db('0xa')](_0x27db('0xd'),auth[_0x27db('0x8')](),controller['getQueues']);router[_0x27db('0xa')](_0x27db('0xe'),auth[_0x27db('0x8')](),controller[_0x27db('0xf')]);router[_0x27db('0x10')]('/',auth[_0x27db('0x8')](),controller[_0x27db('0x11')]);router[_0x27db('0x10')]('/:id/queues',auth[_0x27db('0x8')](),controller[_0x27db('0x12')]);router['post'](_0x27db('0xe'),auth[_0x27db('0x8')](),controller[_0x27db('0x13')]);router['put'](_0x27db('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x27db('0x14')](_0x27db('0xb'),auth[_0x27db('0x8')](),controller[_0x27db('0x15')]);router[_0x27db('0x14')](_0x27db('0xd'),auth['isAuthenticated'](),controller[_0x27db('0x16')]);router[_0x27db('0x14')](_0x27db('0xe'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x27db('0x17')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 0814f49..4c6b176 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 _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 +var _0x11c2=['name','STRING','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x11c2,0x92));var _0x211c=function(_0x3ec901,_0x145af1){_0x3ec901=_0x3ec901-0x0;var _0x4ef1b1=_0x11c2[_0x3ec901];return _0x4ef1b1;};'use strict';var Sequelize=require(_0x211c('0x0'));module[_0x211c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x211c('0x2')},'description':{'type':Sequelize[_0x211c('0x3')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 8e5afab..e8393e1 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 _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 +var _0xaf92=['whatsapp','removeAgents','userTeam:remove','getAgents','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./team.socket','register','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','update','then','destroy','get','Teams','UserProfileResource','stack','name','send','index','map','Team','rawAttributes','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','getQueues','channel','Sequelize','ValidationError','toLowerCase','Queue','pick','capitalize','addQueues','findOne','isValidChannel','Unknown\x20channel','ids','removeQueues','remove','Queues','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','each','User','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','voicePause','addAgents','omit','emit','voice','sms','fax','openchannel'];(function(_0x2a9a62,_0x219c66){var _0x2f7c75=function(_0x74bb92){while(--_0x74bb92){_0x2a9a62['push'](_0x2a9a62['shift']());}};_0x2f7c75(++_0x219c66);}(_0xaf92,0x185));var _0x2af9=function(_0x8acacc,_0x508a1b){_0x8acacc=_0x8acacc-0x0;var _0x1e6e5d=_0xaf92[_0x8acacc];return _0x1e6e5d;};'use strict';var pdf=require(_0x2af9('0x0'));var emlformat=require(_0x2af9('0x1'));var rimraf=require(_0x2af9('0x2'));var zipdir=require(_0x2af9('0x3'));var jsonpatch=require(_0x2af9('0x4'));var rp=require(_0x2af9('0x5'));var moment=require(_0x2af9('0x6'));var BPromise=require(_0x2af9('0x7'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2af9('0x8'));var csv=require(_0x2af9('0x9'));var ejs=require(_0x2af9('0xa'));var fs=require('fs');var _=require(_0x2af9('0xb'));var squel=require(_0x2af9('0xc'));var crypto=require(_0x2af9('0xd'));var jsforce=require(_0x2af9('0xe'));var deskjs=require(_0x2af9('0xf'));var toCsv=require(_0x2af9('0x9'));var querystring=require(_0x2af9('0x10'));var Papa=require(_0x2af9('0x11'));var Redis=require(_0x2af9('0x12'));var authService=require(_0x2af9('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2af9('0x14'));var utils=require(_0x2af9('0x15'));var config=require(_0x2af9('0x16'));var db=require(_0x2af9('0x17'))['db'];config[_0x2af9('0x18')]=_[_0x2af9('0x19')](config[_0x2af9('0x18')],{'host':_0x2af9('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2af9('0x1b'))[_0x2af9('0x1c')](socket);function respondWithStatusCode(_0xd1bd3a,_0x4a6c9b){_0x4a6c9b=_0x4a6c9b||0xcc;return function(_0x347f21){if(_0x347f21){return _0xd1bd3a[_0x2af9('0x1d')](_0x4a6c9b);}return _0xd1bd3a[_0x2af9('0x1e')](_0x4a6c9b)[_0x2af9('0x1f')]();};}function respondWithResult(_0x1bf60b,_0x4531b0){_0x4531b0=_0x4531b0||0xc8;return function(_0x8c5061){if(_0x8c5061){return _0x1bf60b[_0x2af9('0x1e')](_0x4531b0)[_0x2af9('0x20')](_0x8c5061);}};}function respondWithFilteredResult(_0x27afcc,_0xe60455){return function(_0x382083){if(_0x382083){var _0x42dca5=_0x382083['count'],_0x20d0dc=_0xe60455[_0x2af9('0x21')],_0x5b9f2d=_0xe60455['offset']+_0xe60455[_0x2af9('0x22')],_0x241bb1;if(_0x5b9f2d>=_0x42dca5){_0x5b9f2d=_0x42dca5;_0x241bb1=0xc8;}else{_0x241bb1=0xce;}_0x27afcc['status'](_0x241bb1);return _0x27afcc['set'](_0x2af9('0x23'),_0x20d0dc+'-'+_0x5b9f2d+'/'+_0x42dca5)['json'](_0x382083);}return null;};}function patchUpdates(_0x57d167){return function(_0x416d6f){try{jsonpatch[_0x2af9('0x24')](_0x416d6f,_0x57d167,!![]);}catch(_0x42de70){return BPromise[_0x2af9('0x25')](_0x42de70);}return _0x416d6f['save']();};}function saveUpdates(_0x35b473,_0x290a7c){return function(_0x3f4db3){if(_0x3f4db3){return _0x3f4db3[_0x2af9('0x26')](_0x35b473)[_0x2af9('0x27')](function(_0x40506e){return _0x40506e;});}return null;};}function removeEntity(_0x1bfcf5,_0x58170e){return function(_0x54b119){if(_0x54b119){return _0x54b119[_0x2af9('0x28')]()[_0x2af9('0x27')](function(){var _0x6bbf68=_0x54b119[_0x2af9('0x29')]({'plain':!![]});var _0x43dd38=_0x2af9('0x2a');return db[_0x2af9('0x2b')][_0x2af9('0x28')]({'where':{'type':_0x43dd38,'resourceId':_0x6bbf68['id']}})[_0x2af9('0x27')](function(){return _0x54b119;});})[_0x2af9('0x27')](function(){_0x1bfcf5[_0x2af9('0x1e')](0xcc)[_0x2af9('0x1f')]();});}};}function handleEntityNotFound(_0x414a63,_0x2669ea){return function(_0x514a11){if(!_0x514a11){_0x414a63[_0x2af9('0x1d')](0x194);}return _0x514a11;};}function handleError(_0x425097,_0x2ca2f5){_0x2ca2f5=_0x2ca2f5||0x1f4;return function(_0x3b76e6){logger['error'](_0x3b76e6[_0x2af9('0x2c')]);if(_0x3b76e6[_0x2af9('0x2d')]){delete _0x3b76e6[_0x2af9('0x2d')];}_0x425097[_0x2af9('0x1e')](_0x2ca2f5)[_0x2af9('0x2e')](_0x3b76e6);};}exports[_0x2af9('0x2f')]=function(_0x314f1b,_0x1f72bd){var _0x46beee={},_0x184adf={},_0x2a2de7={'count':0x0,'rows':[]};var _0x13c97f=_[_0x2af9('0x30')](db[_0x2af9('0x31')][_0x2af9('0x32')],function(_0x28cca5){return{'name':_0x28cca5['fieldName'],'type':_0x28cca5[_0x2af9('0x33')][_0x2af9('0x34')]};});_0x184adf[_0x2af9('0x35')]=_[_0x2af9('0x30')](_0x13c97f,_0x2af9('0x2d'));_0x184adf['query']=_['keys'](_0x314f1b[_0x2af9('0x36')]);_0x184adf['filters']=_[_0x2af9('0x37')](_0x184adf[_0x2af9('0x35')],_0x184adf[_0x2af9('0x36')]);_0x46beee[_0x2af9('0x38')]=_[_0x2af9('0x37')](_0x184adf[_0x2af9('0x35')],qs[_0x2af9('0x39')](_0x314f1b[_0x2af9('0x36')]['fields']));_0x46beee['attributes']=_0x46beee[_0x2af9('0x38')][_0x2af9('0x3a')]?_0x46beee['attributes']:_0x184adf['model'];if(!_0x314f1b[_0x2af9('0x36')]['hasOwnProperty'](_0x2af9('0x3b'))){_0x46beee['limit']=qs[_0x2af9('0x22')](_0x314f1b[_0x2af9('0x36')]['limit']);_0x46beee['offset']=qs[_0x2af9('0x21')](_0x314f1b['query']['offset']);}_0x46beee[_0x2af9('0x3c')]=qs[_0x2af9('0x3d')](_0x314f1b[_0x2af9('0x36')][_0x2af9('0x3d')]);_0x46beee['where']=qs['filters'](_['pick'](_0x314f1b[_0x2af9('0x36')],_0x184adf[_0x2af9('0x3e')]),_0x13c97f);if(_0x314f1b[_0x2af9('0x36')][_0x2af9('0x3f')]){_0x46beee[_0x2af9('0x40')]=_[_0x2af9('0x41')](_0x46beee['where'],{'$or':_[_0x2af9('0x30')](_0x13c97f,function(_0x31264f){if(_0x31264f['type']!==_0x2af9('0x42')){var _0x1d5453={};_0x1d5453[_0x31264f[_0x2af9('0x2d')]]={'$like':'%'+_0x314f1b[_0x2af9('0x36')][_0x2af9('0x3f')]+'%'};return _0x1d5453;}})});}_0x46beee=_['merge']({},_0x46beee,_0x314f1b[_0x2af9('0x43')]);var _0x253aa4={'where':_0x46beee[_0x2af9('0x40')]};return db[_0x2af9('0x31')][_0x2af9('0x44')](_0x253aa4)[_0x2af9('0x27')](function(_0x24b848){_0x2a2de7[_0x2af9('0x44')]=_0x24b848;if(_0x314f1b['query'][_0x2af9('0x45')]){_0x46beee['include']=[{'all':!![]}];}return db[_0x2af9('0x31')][_0x2af9('0x46')](_0x46beee);})[_0x2af9('0x27')](function(_0x5a4653){_0x2a2de7[_0x2af9('0x47')]=_0x5a4653;return _0x2a2de7;})[_0x2af9('0x27')](respondWithFilteredResult(_0x1f72bd,_0x46beee))[_0x2af9('0x48')](handleError(_0x1f72bd,null));};exports['show']=function(_0x12a4bc,_0x33a78b){var _0x5a27e6={'raw':![],'where':{'id':_0x12a4bc[_0x2af9('0x49')]['id']}},_0x40d839={};_0x40d839[_0x2af9('0x35')]=_[_0x2af9('0x4a')](db[_0x2af9('0x31')][_0x2af9('0x32')]);_0x40d839['query']=_[_0x2af9('0x4a')](_0x12a4bc[_0x2af9('0x36')]);_0x40d839[_0x2af9('0x3e')]=_['intersection'](_0x40d839['model'],_0x40d839[_0x2af9('0x36')]);_0x5a27e6[_0x2af9('0x38')]=_['intersection'](_0x40d839[_0x2af9('0x35')],qs['fields'](_0x12a4bc[_0x2af9('0x36')][_0x2af9('0x39')]));_0x5a27e6[_0x2af9('0x38')]=_0x5a27e6['attributes'][_0x2af9('0x3a')]?_0x5a27e6['attributes']:_0x40d839[_0x2af9('0x35')];if(_0x12a4bc[_0x2af9('0x36')][_0x2af9('0x45')]){_0x5a27e6['include']=[{'all':!![]}];}_0x5a27e6=_['merge']({},_0x5a27e6,_0x12a4bc[_0x2af9('0x43')]);return db[_0x2af9('0x31')][_0x2af9('0x4b')](_0x5a27e6)[_0x2af9('0x27')](handleEntityNotFound(_0x33a78b,null))[_0x2af9('0x27')](respondWithResult(_0x33a78b,null))['catch'](handleError(_0x33a78b,null));};exports[_0x2af9('0x4c')]=function(_0x6b2b89,_0x843986){return db[_0x2af9('0x31')]['create'](_0x6b2b89[_0x2af9('0x4d')],{})['then'](function(_0x4916ae){var _0x3f49d9=_0x6b2b89[_0x2af9('0x4e')][_0x2af9('0x29')]({'plain':!![]});if(!_0x3f49d9)throw new Error(_0x2af9('0x4f'));if(_0x3f49d9[_0x2af9('0x50')]===_0x2af9('0x4e')){var _0x1a2f2e=_0x4916ae[_0x2af9('0x29')]({'plain':!![]});var _0x3d795e='Teams';return db['UserProfileSection'][_0x2af9('0x4b')]({'where':{'name':_0x3d795e,'userProfileId':_0x3f49d9[_0x2af9('0x51')]},'raw':!![]})[_0x2af9('0x27')](function(_0x5e184f){if(_0x5e184f&&_0x5e184f[_0x2af9('0x52')]===0x0){return db[_0x2af9('0x2b')][_0x2af9('0x4c')]({'name':_0x1a2f2e[_0x2af9('0x2d')],'resourceId':_0x1a2f2e['id'],'type':_0x5e184f['name'],'sectionId':_0x5e184f['id']},{})['then'](function(){return _0x4916ae;});}else{return _0x4916ae;}})[_0x2af9('0x48')](function(_0x239110){logger[_0x2af9('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x239110);throw _0x239110;});}return _0x4916ae;})[_0x2af9('0x27')](respondWithResult(_0x843986,0xc9))[_0x2af9('0x48')](handleError(_0x843986,null));};exports[_0x2af9('0x26')]=function(_0x33c9f7,_0x159a21){if(_0x33c9f7['body']['id']){delete _0x33c9f7[_0x2af9('0x4d')]['id'];}return db[_0x2af9('0x31')]['find']({'where':{'id':_0x33c9f7[_0x2af9('0x49')]['id']}})['then'](handleEntityNotFound(_0x159a21,null))[_0x2af9('0x27')](saveUpdates(_0x33c9f7[_0x2af9('0x4d')],null))[_0x2af9('0x27')](respondWithResult(_0x159a21,null))['catch'](handleError(_0x159a21,null));};exports[_0x2af9('0x28')]=function(_0x455f3a,_0x14e002){return db[_0x2af9('0x31')][_0x2af9('0x4b')]({'where':{'id':_0x455f3a[_0x2af9('0x49')]['id']}})[_0x2af9('0x27')](handleEntityNotFound(_0x14e002,null))['then'](removeEntity(_0x14e002,null))[_0x2af9('0x48')](handleError(_0x14e002,null));};exports[_0x2af9('0x54')]=function(_0x5a84fb,_0x18c28a,_0x59d349){return db['Team']['findOne']({'where':{'id':_0x5a84fb[_0x2af9('0x49')]['id']}})['then'](handleEntityNotFound(_0x18c28a,null))[_0x2af9('0x27')](function(_0x268798){if(!_0x5a84fb[_0x2af9('0x36')][_0x2af9('0x55')]||!utils['isValidChannel'](_0x5a84fb[_0x2af9('0x36')][_0x2af9('0x55')])){throw new db[(_0x2af9('0x56'))][(_0x2af9('0x57'))]('Unknown\x20channel');}var _0x2ce39d={};var _0x1bf149={};_0x1bf149[_0x2af9('0x35')]=_[_0x2af9('0x4a')](db[_['capitalize'](_0x5a84fb[_0x2af9('0x36')][_0x2af9('0x55')][_0x2af9('0x58')]())+_0x2af9('0x59')][_0x2af9('0x32')]);_0x1bf149['query']=_[_0x2af9('0x4a')](_0x5a84fb[_0x2af9('0x36')]);_0x1bf149['filters']=_['intersection'](_0x1bf149['model'],_0x1bf149[_0x2af9('0x36')]);_0x2ce39d['attributes']=_['intersection'](_0x1bf149[_0x2af9('0x35')],qs['fields'](_0x5a84fb[_0x2af9('0x36')][_0x2af9('0x39')]));_0x2ce39d[_0x2af9('0x38')]=_0x2ce39d[_0x2af9('0x38')][_0x2af9('0x3a')]?_0x2ce39d[_0x2af9('0x38')]:_0x1bf149[_0x2af9('0x35')];_0x2ce39d[_0x2af9('0x22')]=qs[_0x2af9('0x22')](_0x5a84fb[_0x2af9('0x36')][_0x2af9('0x22')]);_0x2ce39d[_0x2af9('0x21')]=qs['offset'](_0x5a84fb[_0x2af9('0x36')][_0x2af9('0x21')]);_0x2ce39d['order']=qs[_0x2af9('0x3d')](_0x5a84fb['query'][_0x2af9('0x3d')]);_0x2ce39d[_0x2af9('0x40')]=qs[_0x2af9('0x3e')](_[_0x2af9('0x5a')](_0x5a84fb[_0x2af9('0x36')],_0x1bf149[_0x2af9('0x3e')]));_0x2ce39d=_['merge']({},_0x2ce39d,_0x5a84fb[_0x2af9('0x43')]);return _0x268798[_0x2af9('0x29')+_[_0x2af9('0x5b')](_0x5a84fb['query'][_0x2af9('0x55')][_0x2af9('0x58')]())+'Queues'](_0x2ce39d);})[_0x2af9('0x27')](respondWithResult(_0x18c28a,null))[_0x2af9('0x48')](handleError(_0x18c28a,null));};exports[_0x2af9('0x5c')]=function(_0x49d427,_0x339d62,_0x654d7a){return db[_0x2af9('0x31')][_0x2af9('0x5d')]({'where':{'id':_0x49d427[_0x2af9('0x49')]['id']}})[_0x2af9('0x27')](function(_0x459887){if(_0x459887){if(!_0x49d427[_0x2af9('0x4d')][_0x2af9('0x55')]||!utils[_0x2af9('0x5e')](_0x49d427[_0x2af9('0x4d')][_0x2af9('0x55')])){throw new db[(_0x2af9('0x56'))][(_0x2af9('0x57'))](_0x2af9('0x5f'));}return _0x459887['add'+_[_0x2af9('0x5b')](_0x49d427['body'][_0x2af9('0x55')][_0x2af9('0x58')]())+'Queues'](_0x49d427['body'][_0x2af9('0x60')]);}return null;})[_0x2af9('0x27')](handleEntityNotFound(_0x339d62,null))['then'](respondWithStatusCode(_0x339d62,null))[_0x2af9('0x48')](handleError(_0x339d62,null));};exports[_0x2af9('0x61')]=function(_0x19e38e,_0x4602a8,_0x208e5a){return db['Team']['findOne']({'where':{'id':_0x19e38e[_0x2af9('0x49')]['id']}})[_0x2af9('0x27')](function(_0xb5648d){if(_0xb5648d){if(!_0x19e38e[_0x2af9('0x36')][_0x2af9('0x55')]||!utils['isValidChannel'](_0x19e38e[_0x2af9('0x36')][_0x2af9('0x55')])){throw new db['Sequelize'][(_0x2af9('0x57'))]('Unknown\x20channel');}return _0xb5648d[_0x2af9('0x62')+_[_0x2af9('0x5b')](_0x19e38e[_0x2af9('0x36')][_0x2af9('0x55')][_0x2af9('0x58')]())+_0x2af9('0x63')](_0x19e38e['query'][_0x2af9('0x60')]);}return null;})['then'](handleEntityNotFound(_0x4602a8,null))[_0x2af9('0x27')](respondWithStatusCode(_0x4602a8,null))[_0x2af9('0x48')](handleError(_0x4602a8,null));};exports['addAgents']=function(_0xa7ba2f,_0x3d9c64,_0x15eb20){return db[_0x2af9('0x31')][_0x2af9('0x4b')]({'where':{'id':_0xa7ba2f['params']['id']}})['then'](handleEntityNotFound(_0x3d9c64,null))[_0x2af9('0x27')](function(_0x11d936){if(_0x11d936){var _0x3e9964=[_0x2af9('0x64'),_0x2af9('0x65'),_0x2af9('0x66'),_0x2af9('0x67'),_0x2af9('0x68'),_0x2af9('0x69'),_0x2af9('0x6a')];return BPromise['each'](_0x3e9964,function(_0x21f7fb){return _0x11d936[_0x2af9('0x29')+_0x21f7fb+_0x2af9('0x63')]({'attributes':['id',_0x2af9('0x2d')]})['then'](function(_0x4f1a9f){return BPromise[_0x2af9('0x6b')](_0x4f1a9f,function(_0x37b58d){return _0x37b58d['addAgents'](_0xa7ba2f[_0x2af9('0x4d')]['ids'])[_0x2af9('0x27')](function(){if(_0x21f7fb==='Voice'){return db[_0x2af9('0x6c')][_0x2af9('0x46')]({'where':{'id':_0xa7ba2f['body'][_0x2af9('0x60')]},'attributes':['id',_0x2af9('0x2d'),'online','voicePause',_0x2af9('0x6d')],'raw':!![]})[_0x2af9('0x27')](function(_0x975acb){return BPromise[_0x2af9('0x6b')](_['filter'](_0x975acb,{'online':0x1}),function(_0x4f8ed1){return db[_0x2af9('0x6e')][_0x2af9('0x6f')]({'membername':_0x4f8ed1[_0x2af9('0x2d')],'UserId':_0x4f8ed1['id'],'queue_name':_0x37b58d['name'],'VoiceQueueId':_0x37b58d['id'],'interface':_[_0x2af9('0x70')](_0x4f8ed1[_0x2af9('0x6d')])?util[_0x2af9('0x71')](_0x2af9('0x72'),_0x4f8ed1['name']):_0x4f8ed1[_0x2af9('0x6d')],'paused':_0x4f8ed1[_0x2af9('0x73')]||![],'penalty':0x0});});});}});});})[_0x2af9('0x27')](function(){return _0x11d936;});})['then'](function(){return _0x11d936;});}})['then'](function(_0x599796){if(_0x599796){return _0x599796[_0x2af9('0x74')](_0xa7ba2f['body'][_0x2af9('0x60')],_[_0x2af9('0x75')](_0xa7ba2f[_0x2af9('0x4d')],[_0x2af9('0x60'),'id'])||{})['spread'](function(_0x828d56){for(var _0xbd4d02=0x0;_0xbd4d02<_0xa7ba2f[_0x2af9('0x4d')][_0x2af9('0x60')]['length'];_0xbd4d02+=0x1){socket[_0x2af9('0x76')]('userTeam:save',{'UserId':_0xa7ba2f[_0x2af9('0x4d')][_0x2af9('0x60')][_0xbd4d02],'TeamId':_0xa7ba2f[_0x2af9('0x49')]['id']});}return _0x828d56;});}})[_0x2af9('0x27')](respondWithResult(_0x3d9c64,null))[_0x2af9('0x48')](handleError(_0x3d9c64,null));};exports['removeAgents']=function(_0x422c21,_0x3c5ef4,_0x17a731){return db[_0x2af9('0x31')][_0x2af9('0x4b')]({'where':{'id':_0x422c21['params']['id']}})['then'](handleEntityNotFound(_0x3c5ef4,null))[_0x2af9('0x27')](function(_0x1d63b4){if(_0x1d63b4){return BPromise[_0x2af9('0x6b')]([_0x2af9('0x77'),'chat','mail',_0x2af9('0x78'),_0x2af9('0x79'),_0x2af9('0x7a'),_0x2af9('0x7b')],function(_0x2f1589){return _0x1d63b4['get'+_[_0x2af9('0x5b')](_0x2f1589)+_0x2af9('0x63')]({'attributes':['id',_0x2af9('0x2d')]})[_0x2af9('0x27')](function(_0x3b73a0){return BPromise[_0x2af9('0x6b')](_0x3b73a0,function(_0x59f8d3){return _0x59f8d3[_0x2af9('0x7c')](_0x422c21[_0x2af9('0x36')][_0x2af9('0x60')])[_0x2af9('0x27')](function(){if(_0x2f1589==='voice'){return db['UserVoiceQueueRt'][_0x2af9('0x28')]({'where':{'VoiceQueueId':_0x59f8d3['id'],'UserId':_0x422c21[_0x2af9('0x36')][_0x2af9('0x60')]}});}});});})[_0x2af9('0x27')](function(){return _0x1d63b4;});})['then'](function(){return _0x1d63b4;});}})[_0x2af9('0x27')](function(_0x4fb7d6){if(_0x4fb7d6){return _0x4fb7d6[_0x2af9('0x7c')](_0x422c21[_0x2af9('0x36')][_0x2af9('0x60')])[_0x2af9('0x27')](function(){if(_['isArray'](_0x422c21['query'][_0x2af9('0x60')])){for(var _0x57c5cc=0x0;_0x57c5cc<_0x422c21['query'][_0x2af9('0x60')][_0x2af9('0x3a')];_0x57c5cc+=0x1){socket['emit'](_0x2af9('0x7d'),{'UserId':Number(_0x422c21[_0x2af9('0x36')]['ids'][_0x57c5cc]),'TeamId':Number(_0x422c21[_0x2af9('0x49')]['id'])});}}else{socket[_0x2af9('0x76')](_0x2af9('0x7d'),{'UserId':Number(_0x422c21[_0x2af9('0x36')]['ids']),'TeamId':Number(_0x422c21['params']['id'])});}});}})[_0x2af9('0x27')](respondWithStatusCode(_0x3c5ef4,null))[_0x2af9('0x48')](handleError(_0x3c5ef4,null));};exports['getAgents']=function(_0x567d7d,_0xb84da8,_0x327f6d){var _0x24ad48={};var _0x56a763={};var _0x346fd6;var _0x346a07;return db['Team'][_0x2af9('0x5d')]({'where':{'id':_0x567d7d[_0x2af9('0x49')]['id']}})[_0x2af9('0x27')](handleEntityNotFound(_0xb84da8,null))[_0x2af9('0x27')](function(_0x41ead7){if(_0x41ead7){_0x346fd6=_0x41ead7;_0x56a763[_0x2af9('0x35')]=_['keys'](db[_0x2af9('0x6c')][_0x2af9('0x32')]);_0x56a763[_0x2af9('0x36')]=_[_0x2af9('0x4a')](_0x567d7d[_0x2af9('0x36')]);_0x56a763[_0x2af9('0x3e')]=_[_0x2af9('0x37')](_0x56a763['model'],_0x56a763[_0x2af9('0x36')]);_0x24ad48['attributes']=_[_0x2af9('0x37')](_0x56a763[_0x2af9('0x35')],qs['fields'](_0x567d7d['query'][_0x2af9('0x39')]));_0x24ad48['attributes']=_0x24ad48['attributes'][_0x2af9('0x3a')]?_0x24ad48[_0x2af9('0x38')]:_0x56a763[_0x2af9('0x35')];_0x24ad48[_0x2af9('0x3c')]=qs[_0x2af9('0x3d')](_0x567d7d[_0x2af9('0x36')]['sort']);_0x24ad48[_0x2af9('0x40')]=qs['filters'](_['pick'](_0x567d7d[_0x2af9('0x36')],_0x56a763[_0x2af9('0x3e')]));if(_0x567d7d[_0x2af9('0x36')]['filter']){_0x24ad48['where']=_['merge'](_0x24ad48['where'],{'$or':_[_0x2af9('0x30')](_0x24ad48['attributes'],function(_0x243368){var _0x100294={};_0x100294[_0x243368]={'$like':'%'+_0x567d7d[_0x2af9('0x36')][_0x2af9('0x3f')]+'%'};return _0x100294;})});}_0x24ad48=_[_0x2af9('0x41')]({},_0x24ad48,_0x567d7d[_0x2af9('0x43')]);return _0x346fd6[_0x2af9('0x7e')](_0x24ad48);}})['then'](function(_0x2a15dc){if(_0x2a15dc){_0x346a07=_0x2a15dc['length'];if(!_0x567d7d[_0x2af9('0x36')][_0x2af9('0x7f')](_0x2af9('0x3b'))){_0x24ad48[_0x2af9('0x22')]=qs[_0x2af9('0x22')](_0x567d7d[_0x2af9('0x36')][_0x2af9('0x22')]);_0x24ad48[_0x2af9('0x21')]=qs[_0x2af9('0x21')](_0x567d7d['query'][_0x2af9('0x21')]);}return _0x346fd6[_0x2af9('0x7e')](_0x24ad48);}})[_0x2af9('0x27')](function(_0xcb5d19){if(_0xcb5d19){return _0xcb5d19?{'count':_0x346a07,'rows':_0xcb5d19}:null;}})[_0x2af9('0x27')](respondWithResult(_0xb84da8,null))[_0x2af9('0x48')](handleError(_0xb84da8,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 7bf6864..1fa41d6 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 _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 +var _0xb534=['Team','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x466af7,_0x2f7551){var _0x348c96=function(_0x2d7477){while(--_0x2d7477){_0x466af7['push'](_0x466af7['shift']());}};_0x348c96(++_0x2f7551);}(_0xb534,0x1de));var _0x4b53=function(_0x5319f9,_0x23e160){_0x5319f9=_0x5319f9-0x0;var _0x2437df=_0xb534[_0x5319f9];return _0x2437df;};'use strict';var EventEmitter=require(_0x4b53('0x0'));var Team=require(_0x4b53('0x1'))['db'][_0x4b53('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x4b53('0x3')](0x0);var events={'afterCreate':_0x4b53('0x4'),'afterUpdate':_0x4b53('0x5'),'afterDestroy':_0x4b53('0x6')};function emitEvent(_0xa41122){return function(_0x1e6fc7,_0x2d623c,_0x47c065){TeamEvents[_0x4b53('0x7')](_0xa41122+':'+_0x1e6fc7['id'],_0x1e6fc7);TeamEvents[_0x4b53('0x7')](_0xa41122,_0x1e6fc7);_0x47c065(null);};}for(var e in events){if(events[_0x4b53('0x8')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x4b53('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index c33fc56..3ad4982 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 _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 +var _0xac3f=['Team','teams','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./team.attributes','exports','define'];(function(_0x57d209,_0x37dc1a){var _0x182ced=function(_0x54d873){while(--_0x54d873){_0x57d209['push'](_0x57d209['shift']());}};_0x182ced(++_0x37dc1a);}(_0xac3f,0x161));var _0xfac3=function(_0x2bc2a2,_0x51e95f){_0x2bc2a2=_0x2bc2a2-0x0;var _0x20de67=_0xac3f[_0x2bc2a2];return _0x20de67;};'use strict';var _=require(_0xfac3('0x0'));var util=require(_0xfac3('0x1'));var logger=require(_0xfac3('0x2'))(_0xfac3('0x3'));var moment=require(_0xfac3('0x4'));var BPromise=require(_0xfac3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfac3('0x6'));var rimraf=require(_0xfac3('0x7'));var config=require('../../config/environment');var attributes=require(_0xfac3('0x8'));module[_0xfac3('0x9')]=function(_0x4fec17,_0x459c23){return _0x4fec17[_0xfac3('0xa')](_0xfac3('0xb'),attributes,{'tableName':_0xfac3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index e7cc194..7e705ed 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 _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 +var _0xc5ca=['http','redis','defaults','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','stringify','error','message','Team,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xc5ca,0xcc));var _0xac5c=function(_0x43682e,_0x45a02d){_0x43682e=_0x43682e-0x0;var _0x4d1e02=_0xc5ca[_0x43682e];return _0x4d1e02;};'use strict';var _=require(_0xac5c('0x0'));var util=require(_0xac5c('0x1'));var moment=require(_0xac5c('0x2'));var BPromise=require(_0xac5c('0x3'));var rs=require(_0xac5c('0x4'));var fs=require('fs');var Redis=require(_0xac5c('0x5'));var db=require(_0xac5c('0x6'))['db'];var utils=require(_0xac5c('0x7'));var logger=require(_0xac5c('0x8'))('rpc');var config=require(_0xac5c('0x9'));var jayson=require(_0xac5c('0xa'));var client=jayson[_0xac5c('0xb')][_0xac5c('0xc')]({'port':0x232a});config[_0xac5c('0xd')]=_[_0xac5c('0xe')](config[_0xac5c('0xd')],{'host':_0xac5c('0xf'),'port':0x18eb});var socket=require(_0xac5c('0x10'))(new Redis(config[_0xac5c('0xd')]));require('./team.socket')[_0xac5c('0x11')](socket);function respondWithRpcPromise(_0x2664a6,_0x5dbc9b,_0x257eb0){return new BPromise(function(_0x27126f,_0x382879){return client[_0xac5c('0x12')](_0x2664a6,_0x257eb0)['then'](function(_0x433c62){logger[_0xac5c('0x13')]('Team,\x20%s,\x20%s',_0x5dbc9b,_0xac5c('0x14'));logger[_0xac5c('0x15')]('Team,\x20%s,\x20%s,\x20%s',_0x5dbc9b,_0xac5c('0x14'),JSON[_0xac5c('0x16')](_0x433c62));if(_0x433c62[_0xac5c('0x17')]){if(_0x433c62[_0xac5c('0x17')]['code']===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x5dbc9b,_0x433c62[_0xac5c('0x17')][_0xac5c('0x18')]);return _0x382879(_0x433c62[_0xac5c('0x17')][_0xac5c('0x18')]);}logger[_0xac5c('0x17')](_0xac5c('0x19'),_0x5dbc9b,_0x433c62[_0xac5c('0x17')][_0xac5c('0x18')]);return _0x27126f(_0x433c62['error']['message']);}else{logger['info']('Team,\x20%s,\x20%s',_0x5dbc9b,_0xac5c('0x14'));_0x27126f(_0x433c62[_0xac5c('0x1a')]['message']);}})['catch'](function(_0x417638){logger[_0xac5c('0x17')](_0xac5c('0x19'),_0x5dbc9b,_0x417638);_0x382879(_0x417638);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index faebbe1..0faec13 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 _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 +var _0x5f71=['team:','./team.events','remove','register','length'];(function(_0x1cd1bf,_0x5c03e6){var _0x1e22d4=function(_0x5cc916){while(--_0x5cc916){_0x1cd1bf['push'](_0x1cd1bf['shift']());}};_0x1e22d4(++_0x5c03e6);}(_0x5f71,0xc9));var _0x15f7=function(_0x7f8e19,_0x46eec6){_0x7f8e19=_0x7f8e19-0x0;var _0x423e23=_0x5f71[_0x7f8e19];return _0x423e23;};'use strict';var TeamEvents=require(_0x15f7('0x0'));var events=['save',_0x15f7('0x1'),'update'];function createListener(_0x472e37,_0x4cb523){return function(_0x575fdb){_0x4cb523['emit'](_0x472e37,_0x575fdb);};}function removeListener(_0x3a9fe1,_0x3fa535){return function(){TeamEvents['removeListener'](_0x3a9fe1,_0x3fa535);};}exports[_0x15f7('0x2')]=function(_0x421c41){for(var _0x81b047=0x0,_0x1de7b3=events[_0x15f7('0x3')];_0x81b047<_0x1de7b3;_0x81b047++){var _0x30d083=events[_0x81b047];var _0x1c9509=createListener(_0x15f7('0x4')+_0x30d083,_0x421c41);TeamEvents['on'](_0x30d083,_0x1c9509);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index f93d857..275e8e8 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 _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 +var _0x8a0c=['show','post','create','put','update','delete','/:id','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index'];(function(_0xe73fc1,_0x40c909){var _0x354258=function(_0x5a7cb0){while(--_0x5a7cb0){_0xe73fc1['push'](_0xe73fc1['shift']());}};_0x354258(++_0x40c909);}(_0x8a0c,0x196));var _0xc8a0=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8a0c[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xc8a0('0x0'));var util=require(_0xc8a0('0x1'));var path=require(_0xc8a0('0x2'));var timeout=require(_0xc8a0('0x3'));var express=require(_0xc8a0('0x4'));var router=express[_0xc8a0('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc8a0('0x6'));var config=require(_0xc8a0('0x7'));var controller=require(_0xc8a0('0x8'));router[_0xc8a0('0x9')]('/',auth[_0xc8a0('0xa')](),controller[_0xc8a0('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xc8a0('0xc')]);router[_0xc8a0('0xd')]('/',auth['isAuthenticated'](),controller[_0xc8a0('0xe')]);router[_0xc8a0('0xf')]('/:id',auth[_0xc8a0('0xa')](),controller[_0xc8a0('0x10')]);router[_0xc8a0('0x11')](_0xc8a0('0x12'),auth[_0xc8a0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 79a09c8..bc5271c 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 _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 +var _0x9a26=['sequelize','exports','STRING'];(function(_0x5d0aa5,_0x26901c){var _0x4c8f6e=function(_0x994f48){while(--_0x994f48){_0x5d0aa5['push'](_0x5d0aa5['shift']());}};_0x4c8f6e(++_0x26901c);}(_0x9a26,0xdb));var _0x69a2=function(_0x579b4c,_0x418ec0){_0x579b4c=_0x579b4c-0x0;var _0x598027=_0x9a26[_0x579b4c];return _0x598027;};'use strict';var Sequelize=require(_0x69a2('0x0'));module[_0x69a2('0x1')]={'name':{'type':Sequelize[_0x69a2('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index c818581..a4b827c 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 _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 +var _0x2add=['limit','set','Content-Range','apply','reject','save','destroy','then','get','Templates','UserProfileResource','end','error','stack','name','send','Template','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','rows','show','keys','include','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset'];(function(_0x451d0c,_0x241e73){var _0x1aae50=function(_0x481316){while(--_0x481316){_0x451d0c['push'](_0x451d0c['shift']());}};_0x1aae50(++_0x241e73);}(_0x2add,0xd9));var _0xd2ad=function(_0x4b4e36,_0x2e4433){_0x4b4e36=_0x4b4e36-0x0;var _0x4fbfe4=_0x2add[_0x4b4e36];return _0x4fbfe4;};'use strict';var pdf=require(_0xd2ad('0x0'));var emlformat=require(_0xd2ad('0x1'));var rimraf=require(_0xd2ad('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd2ad('0x3'));var moment=require(_0xd2ad('0x4'));var BPromise=require(_0xd2ad('0x5'));var Mustache=require('mustache');var util=require(_0xd2ad('0x6'));var path=require('path');var sox=require(_0xd2ad('0x7'));var csv=require(_0xd2ad('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd2ad('0x9'));var crypto=require(_0xd2ad('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd2ad('0xb'));var toCsv=require(_0xd2ad('0x8'));var querystring=require(_0xd2ad('0xc'));var Papa=require(_0xd2ad('0xd'));var Redis=require(_0xd2ad('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd2ad('0xf'));var as=require(_0xd2ad('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd2ad('0x11'))(_0xd2ad('0x12'));var utils=require(_0xd2ad('0x13'));var config=require('../../config/environment');var db=require(_0xd2ad('0x14'))['db'];function respondWithStatusCode(_0xda42d1,_0x271a37){_0x271a37=_0x271a37||0xcc;return function(_0x2fa7cf){if(_0x2fa7cf){return _0xda42d1[_0xd2ad('0x15')](_0x271a37);}return _0xda42d1[_0xd2ad('0x16')](_0x271a37)['end']();};}function respondWithResult(_0x2c5736,_0x2d79ff){_0x2d79ff=_0x2d79ff||0xc8;return function(_0x23c83c){if(_0x23c83c){return _0x2c5736[_0xd2ad('0x16')](_0x2d79ff)[_0xd2ad('0x17')](_0x23c83c);}};}function respondWithFilteredResult(_0x5e9411,_0x53d3c0){return function(_0x475ba6){if(_0x475ba6){var _0x445752=_0x475ba6[_0xd2ad('0x18')],_0x1a0b7b=_0x53d3c0[_0xd2ad('0x19')],_0x3889f3=_0x53d3c0[_0xd2ad('0x19')]+_0x53d3c0[_0xd2ad('0x1a')],_0x27de6a;if(_0x3889f3>=_0x445752){_0x3889f3=_0x445752;_0x27de6a=0xc8;}else{_0x27de6a=0xce;}_0x5e9411[_0xd2ad('0x16')](_0x27de6a);return _0x5e9411[_0xd2ad('0x1b')](_0xd2ad('0x1c'),_0x1a0b7b+'-'+_0x3889f3+'/'+_0x445752)[_0xd2ad('0x17')](_0x475ba6);}return null;};}function patchUpdates(_0x26ed72){return function(_0x489c3a){try{jsonpatch[_0xd2ad('0x1d')](_0x489c3a,_0x26ed72,!![]);}catch(_0x5331bf){return BPromise[_0xd2ad('0x1e')](_0x5331bf);}return _0x489c3a[_0xd2ad('0x1f')]();};}function saveUpdates(_0x385e08,_0x230234){return function(_0x24f0a9){if(_0x24f0a9){return _0x24f0a9['update'](_0x385e08)['then'](function(_0x4fc67a){return _0x4fc67a;});}return null;};}function removeEntity(_0x3891f5,_0x45be8b){return function(_0x215236){if(_0x215236){return _0x215236[_0xd2ad('0x20')]()[_0xd2ad('0x21')](function(){var _0x573e97=_0x215236[_0xd2ad('0x22')]({'plain':!![]});var _0x28e8b3=_0xd2ad('0x23');return db[_0xd2ad('0x24')][_0xd2ad('0x20')]({'where':{'type':_0x28e8b3,'resourceId':_0x573e97['id']}})['then'](function(){return _0x215236;});})[_0xd2ad('0x21')](function(){_0x3891f5['status'](0xcc)[_0xd2ad('0x25')]();});}};}function handleEntityNotFound(_0x3c7294,_0x13ab0f){return function(_0x14349c){if(!_0x14349c){_0x3c7294[_0xd2ad('0x15')](0x194);}return _0x14349c;};}function handleError(_0x3d3d2d,_0x6c1825){_0x6c1825=_0x6c1825||0x1f4;return function(_0x505c30){logger[_0xd2ad('0x26')](_0x505c30[_0xd2ad('0x27')]);if(_0x505c30[_0xd2ad('0x28')]){delete _0x505c30['name'];}_0x3d3d2d['status'](_0x6c1825)[_0xd2ad('0x29')](_0x505c30);};}exports['index']=function(_0x570277,_0xcfc034){var _0x3d7acf={},_0x52e13f={},_0x5268ed={'count':0x0,'rows':[]};var _0xc917ff=_['map'](db[_0xd2ad('0x2a')][_0xd2ad('0x2b')],function(_0x4f0611){return{'name':_0x4f0611[_0xd2ad('0x2c')],'type':_0x4f0611[_0xd2ad('0x2d')][_0xd2ad('0x2e')]};});_0x52e13f[_0xd2ad('0x2f')]=_[_0xd2ad('0x30')](_0xc917ff,_0xd2ad('0x28'));_0x52e13f[_0xd2ad('0x31')]=_['keys'](_0x570277['query']);_0x52e13f[_0xd2ad('0x32')]=_['intersection'](_0x52e13f[_0xd2ad('0x2f')],_0x52e13f[_0xd2ad('0x31')]);_0x3d7acf[_0xd2ad('0x33')]=_[_0xd2ad('0x34')](_0x52e13f[_0xd2ad('0x2f')],qs['fields'](_0x570277[_0xd2ad('0x31')][_0xd2ad('0x35')]));_0x3d7acf[_0xd2ad('0x33')]=_0x3d7acf['attributes'][_0xd2ad('0x36')]?_0x3d7acf[_0xd2ad('0x33')]:_0x52e13f['model'];if(!_0x570277[_0xd2ad('0x31')][_0xd2ad('0x37')](_0xd2ad('0x38'))){_0x3d7acf[_0xd2ad('0x1a')]=qs[_0xd2ad('0x1a')](_0x570277[_0xd2ad('0x31')][_0xd2ad('0x1a')]);_0x3d7acf[_0xd2ad('0x19')]=qs[_0xd2ad('0x19')](_0x570277[_0xd2ad('0x31')][_0xd2ad('0x19')]);}_0x3d7acf['order']=qs[_0xd2ad('0x39')](_0x570277[_0xd2ad('0x31')][_0xd2ad('0x39')]);_0x3d7acf['where']=qs['filters'](_[_0xd2ad('0x3a')](_0x570277[_0xd2ad('0x31')],_0x52e13f['filters']),_0xc917ff);if(_0x570277[_0xd2ad('0x31')]['filter']){_0x3d7acf['where']=_[_0xd2ad('0x3b')](_0x3d7acf[_0xd2ad('0x3c')],{'$or':_[_0xd2ad('0x30')](_0xc917ff,function(_0x5cc36e){if(_0x5cc36e[_0xd2ad('0x2d')]!==_0xd2ad('0x3d')){var _0xfcc884={};_0xfcc884[_0x5cc36e[_0xd2ad('0x28')]]={'$like':'%'+_0x570277['query'][_0xd2ad('0x3e')]+'%'};return _0xfcc884;}})});}_0x3d7acf=_['merge']({},_0x3d7acf,_0x570277[_0xd2ad('0x3f')]);var _0x4eb787={'where':_0x3d7acf['where']};return db[_0xd2ad('0x2a')][_0xd2ad('0x18')](_0x4eb787)[_0xd2ad('0x21')](function(_0x515a58){_0x5268ed[_0xd2ad('0x18')]=_0x515a58;if(_0x570277[_0xd2ad('0x31')][_0xd2ad('0x40')]){_0x3d7acf['include']=[{'all':!![]}];}return db[_0xd2ad('0x2a')]['findAll'](_0x3d7acf);})['then'](function(_0x35e008){_0x5268ed[_0xd2ad('0x41')]=_0x35e008;return _0x5268ed;})[_0xd2ad('0x21')](respondWithFilteredResult(_0xcfc034,_0x3d7acf))['catch'](handleError(_0xcfc034,null));};exports[_0xd2ad('0x42')]=function(_0x2e765a,_0xca520f){var _0x4abaa9={'raw':!![],'where':{'id':_0x2e765a['params']['id']}},_0x184977={};_0x184977[_0xd2ad('0x2f')]=_[_0xd2ad('0x43')](db[_0xd2ad('0x2a')][_0xd2ad('0x2b')]);_0x184977['query']=_['keys'](_0x2e765a[_0xd2ad('0x31')]);_0x184977['filters']=_[_0xd2ad('0x34')](_0x184977[_0xd2ad('0x2f')],_0x184977[_0xd2ad('0x31')]);_0x4abaa9[_0xd2ad('0x33')]=_['intersection'](_0x184977[_0xd2ad('0x2f')],qs['fields'](_0x2e765a['query'][_0xd2ad('0x35')]));_0x4abaa9['attributes']=_0x4abaa9['attributes'][_0xd2ad('0x36')]?_0x4abaa9[_0xd2ad('0x33')]:_0x184977[_0xd2ad('0x2f')];if(_0x2e765a['query']['includeAll']){_0x4abaa9[_0xd2ad('0x44')]=[{'all':!![]}];}_0x4abaa9=_[_0xd2ad('0x3b')]({},_0x4abaa9,_0x2e765a[_0xd2ad('0x3f')]);return db[_0xd2ad('0x2a')][_0xd2ad('0x45')](_0x4abaa9)[_0xd2ad('0x21')](handleEntityNotFound(_0xca520f,null))[_0xd2ad('0x21')](respondWithResult(_0xca520f,null))[_0xd2ad('0x46')](handleError(_0xca520f,null));};exports['create']=function(_0x1af97d,_0x45536f){return db[_0xd2ad('0x2a')]['create'](_0x1af97d[_0xd2ad('0x47')],{})['then'](function(_0x592b1f){var _0x435b79=_0x1af97d[_0xd2ad('0x48')][_0xd2ad('0x22')]({'plain':!![]});if(!_0x435b79)throw new Error(_0xd2ad('0x49'));if(_0x435b79[_0xd2ad('0x4a')]===_0xd2ad('0x48')){var _0x5eef30=_0x592b1f[_0xd2ad('0x22')]({'plain':!![]});var _0x5c500f=_0xd2ad('0x23');return db[_0xd2ad('0x4b')][_0xd2ad('0x45')]({'where':{'name':_0x5c500f,'userProfileId':_0x435b79[_0xd2ad('0x4c')]},'raw':!![]})[_0xd2ad('0x21')](function(_0x32e496){if(_0x32e496&&_0x32e496['autoAssociation']===0x0){return db[_0xd2ad('0x24')][_0xd2ad('0x4d')]({'name':_0x5eef30[_0xd2ad('0x28')],'resourceId':_0x5eef30['id'],'type':_0x32e496[_0xd2ad('0x28')],'sectionId':_0x32e496['id']},{})[_0xd2ad('0x21')](function(){return _0x592b1f;});}else{return _0x592b1f;}})[_0xd2ad('0x46')](function(_0x4effa1){logger[_0xd2ad('0x26')](_0xd2ad('0x4e'),_0x4effa1);throw _0x4effa1;});}return _0x592b1f;})[_0xd2ad('0x21')](respondWithResult(_0x45536f,0xc9))[_0xd2ad('0x46')](handleError(_0x45536f,null));};exports[_0xd2ad('0x4f')]=function(_0x40ac6c,_0x277a22){if(_0x40ac6c['body']['id']){delete _0x40ac6c['body']['id'];}return db[_0xd2ad('0x2a')][_0xd2ad('0x45')]({'where':{'id':_0x40ac6c['params']['id']}})[_0xd2ad('0x21')](handleEntityNotFound(_0x277a22,null))['then'](saveUpdates(_0x40ac6c['body'],null))[_0xd2ad('0x21')](respondWithResult(_0x277a22,null))[_0xd2ad('0x46')](handleError(_0x277a22,null));};exports[_0xd2ad('0x20')]=function(_0x34f125,_0x32fdac){return db[_0xd2ad('0x2a')][_0xd2ad('0x45')]({'where':{'id':_0x34f125[_0xd2ad('0x50')]['id']}})[_0xd2ad('0x21')](handleEntityNotFound(_0x32fdac,null))[_0xd2ad('0x21')](removeEntity(_0x32fdac,null))[_0xd2ad('0x46')](handleError(_0x32fdac,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 8afb12e..625f8ef 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 _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 +var _0x9e24=['exports','define','Template','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./template.attributes'];(function(_0x29df9a,_0x42aff3){var _0x3a8e96=function(_0x70fbe7){while(--_0x70fbe7){_0x29df9a['push'](_0x29df9a['shift']());}};_0x3a8e96(++_0x42aff3);}(_0x9e24,0x6f));var _0x49e2=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x9e24[_0xfa634c];return _0x73e478;};'use strict';var _=require(_0x49e2('0x0'));var util=require(_0x49e2('0x1'));var logger=require(_0x49e2('0x2'))('api');var moment=require(_0x49e2('0x3'));var BPromise=require(_0x49e2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x49e2('0x5'));var rimraf=require(_0x49e2('0x6'));var config=require(_0x49e2('0x7'));var attributes=require(_0x49e2('0x8'));module[_0x49e2('0x9')]=function(_0x29b3f6,_0x1efb31){return _0x29b3f6[_0x49e2('0xa')](_0x49e2('0xb'),attributes,{'tableName':'tools_templates','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 31a6043..9b3181f 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 _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 +var _0x8a6c=['moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetTemplate','findAll','options','raw','where','attributes','limit','include','map','model','catch','util'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x8a6c,0x15f));var _0xc8a6=function(_0x3c3603,_0xb16e87){_0x3c3603=_0x3c3603-0x0;var _0x588811=_0x8a6c[_0x3c3603];return _0x588811;};'use strict';var _=require('lodash');var util=require(_0xc8a6('0x0'));var moment=require(_0xc8a6('0x1'));var BPromise=require(_0xc8a6('0x2'));var rs=require(_0xc8a6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc8a6('0x4'))(_0xc8a6('0x5'));var config=require(_0xc8a6('0x6'));var jayson=require(_0xc8a6('0x7'));var client=jayson[_0xc8a6('0x8')][_0xc8a6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30712e,_0x2be42c,_0x436c39){return new BPromise(function(_0x170e54,_0x3730de){return client[_0xc8a6('0xa')](_0x30712e,_0x436c39)[_0xc8a6('0xb')](function(_0x598f2a){logger[_0xc8a6('0xc')](_0xc8a6('0xd'),_0x2be42c,_0xc8a6('0xe'));logger[_0xc8a6('0xf')](_0xc8a6('0x10'),_0x2be42c,_0xc8a6('0xe'),JSON[_0xc8a6('0x11')](_0x598f2a));if(_0x598f2a[_0xc8a6('0x12')]){if(_0x598f2a[_0xc8a6('0x12')][_0xc8a6('0x13')]===0x1f4){logger[_0xc8a6('0x12')]('Template,\x20%s,\x20%s',_0x2be42c,_0x598f2a[_0xc8a6('0x12')][_0xc8a6('0x14')]);return _0x3730de(_0x598f2a[_0xc8a6('0x12')][_0xc8a6('0x14')]);}logger['error']('Template,\x20%s,\x20%s',_0x2be42c,_0x598f2a[_0xc8a6('0x12')][_0xc8a6('0x14')]);return _0x170e54(_0x598f2a[_0xc8a6('0x12')][_0xc8a6('0x14')]);}else{logger[_0xc8a6('0xc')](_0xc8a6('0xd'),_0x2be42c,'request\x20sent');_0x170e54(_0x598f2a['result']['message']);}})['catch'](function(_0x367faa){logger['error'](_0xc8a6('0xd'),_0x2be42c,_0x367faa);_0x3730de(_0x367faa);});});}exports[_0xc8a6('0x15')]=function(_0x54f8ea){var _0x5ea175=this;return new Promise(function(_0x16f61e,_0x123527){return db['Template'][_0xc8a6('0x16')]({'raw':_0x54f8ea[_0xc8a6('0x17')]?_0x54f8ea[_0xc8a6('0x17')][_0xc8a6('0x18')]===undefined?!![]:![]:!![],'where':_0x54f8ea[_0xc8a6('0x17')]?_0x54f8ea[_0xc8a6('0x17')][_0xc8a6('0x19')]||null:null,'attributes':_0x54f8ea[_0xc8a6('0x17')]?_0x54f8ea[_0xc8a6('0x17')][_0xc8a6('0x1a')]||null:null,'limit':_0x54f8ea['options']?_0x54f8ea['options'][_0xc8a6('0x1b')]||null:null,'include':_0x54f8ea[_0xc8a6('0x17')]?_0x54f8ea[_0xc8a6('0x17')][_0xc8a6('0x1c')]?_[_0xc8a6('0x1d')](_0x54f8ea['options'][_0xc8a6('0x1c')],function(_0x58a9a5){return{'model':db[_0x58a9a5[_0xc8a6('0x1e')]],'as':_0x58a9a5['as'],'attributes':_0x58a9a5[_0xc8a6('0x1a')],'include':_0x58a9a5[_0xc8a6('0x1c')]?_['map'](_0x58a9a5[_0xc8a6('0x1c')],function(_0x352409){return{'model':db[_0x352409['model']],'as':_0x352409['as'],'attributes':_0x352409[_0xc8a6('0x1a')],'include':_0x352409[_0xc8a6('0x1c')]?_[_0xc8a6('0x1d')](_0x352409[_0xc8a6('0x1c')],function(_0x3b6b20){return{'model':db[_0x3b6b20[_0xc8a6('0x1e')]],'as':_0x3b6b20['as'],'attributes':_0x3b6b20[_0xc8a6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc8a6('0xb')](function(_0x1c423f){logger[_0xc8a6('0xc')](_0xc8a6('0x15'),_0x54f8ea);logger[_0xc8a6('0xf')](_0xc8a6('0x15'),_0x54f8ea,JSON[_0xc8a6('0x11')](_0x1c423f));_0x16f61e(_0x1c423f);})[_0xc8a6('0x1f')](function(_0x4c7c78){logger['error'](_0xc8a6('0x15'),_0x4c7c78[_0xc8a6('0x14')],_0x54f8ea);_0x123527(_0x5ea175[_0xc8a6('0x12')](0x1f4,_0x4c7c78[_0xc8a6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 0fc3590..e7d9a88 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 _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 +var _0x2101=['getActions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','addAction','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./trigger.controller','get','/:id','isAuthenticated','show','/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions'];(function(_0x9be28f,_0x231334){var _0xa9f52d=function(_0x239dad){while(--_0x239dad){_0x9be28f['push'](_0x9be28f['shift']());}};_0xa9f52d(++_0x231334);}(_0x2101,0x16a));var _0x1210=function(_0x52c6e6,_0x19befc){_0x52c6e6=_0x52c6e6-0x0;var _0x12cc9b=_0x2101[_0x52c6e6];return _0x12cc9b;};'use strict';var multer=require(_0x1210('0x0'));var util=require(_0x1210('0x1'));var path=require(_0x1210('0x2'));var timeout=require(_0x1210('0x3'));var express=require('express');var router=express[_0x1210('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1210('0x5'));var config=require(_0x1210('0x6'));var controller=require(_0x1210('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1210('0x8')](_0x1210('0x9'),auth[_0x1210('0xa')](),controller[_0x1210('0xb')]);router['get'](_0x1210('0xc'),auth['isAuthenticated'](),controller[_0x1210('0xd')]);router[_0x1210('0x8')]('/:id/any_conditions',auth[_0x1210('0xa')](),controller[_0x1210('0xe')]);router['get'](_0x1210('0xf'),auth[_0x1210('0xa')](),controller[_0x1210('0x10')]);router[_0x1210('0x11')]('/',auth['isAuthenticated'](),controller[_0x1210('0x12')]);router[_0x1210('0x11')](_0x1210('0xc'),auth['isAuthenticated'](),controller[_0x1210('0x13')]);router[_0x1210('0x11')](_0x1210('0x14'),auth[_0x1210('0xa')](),controller[_0x1210('0x15')]);router[_0x1210('0x11')](_0x1210('0xf'),auth[_0x1210('0xa')](),controller[_0x1210('0x16')]);router[_0x1210('0x17')](_0x1210('0x9'),auth[_0x1210('0xa')](),controller[_0x1210('0x18')]);router['delete'](_0x1210('0x9'),auth[_0x1210('0xa')](),controller[_0x1210('0x19')]);module[_0x1210('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 19bd763..8af8091 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 _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 +var _0xf42d=['STRING','exports'];(function(_0x34d346,_0x4c6502){var _0x122d76=function(_0x22a5fd){while(--_0x22a5fd){_0x34d346['push'](_0x34d346['shift']());}};_0x122d76(++_0x4c6502);}(_0xf42d,0xf5));var _0xdf42=function(_0x41c54a,_0xe7fe5a){_0x41c54a=_0x41c54a-0x0;var _0x5ae8d9=_0xf42d[_0x41c54a];return _0x5ae8d9;};'use strict';var Sequelize=require('sequelize');module[_0xdf42('0x0')]={'name':{'type':Sequelize[_0xdf42('0x1')]},'channel':{'type':Sequelize[_0xdf42('0x1')]},'description':{'type':Sequelize[_0xdf42('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 031e76e..fe627dc 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 _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 +var _0xbe46=['stack','name','index','map','rawAttributes','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Trigger','includeAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','getAnyConditions','addAction','TriggerId','Action','getActions','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','json','apply','then','destroy','get','Triggers','UserProfileResource','error'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0xbe46,0xeb));var _0x6be4=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xbe46[_0x2d8fc2];return _0x3a9e53;};'use strict';var pdf=require(_0x6be4('0x0'));var emlformat=require(_0x6be4('0x1'));var rimraf=require(_0x6be4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6be4('0x3'));var rp=require('request-promise');var moment=require(_0x6be4('0x4'));var BPromise=require(_0x6be4('0x5'));var Mustache=require(_0x6be4('0x6'));var util=require('util');var path=require(_0x6be4('0x7'));var sox=require(_0x6be4('0x8'));var csv=require(_0x6be4('0x9'));var ejs=require(_0x6be4('0xa'));var fs=require('fs');var _=require(_0x6be4('0xb'));var squel=require(_0x6be4('0xc'));var crypto=require(_0x6be4('0xd'));var jsforce=require(_0x6be4('0xe'));var deskjs=require(_0x6be4('0xf'));var toCsv=require(_0x6be4('0x9'));var querystring=require(_0x6be4('0x10'));var Papa=require(_0x6be4('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6be4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6be4('0x13'))(_0x6be4('0x14'));var utils=require(_0x6be4('0x15'));var config=require(_0x6be4('0x16'));var db=require(_0x6be4('0x17'))['db'];function respondWithStatusCode(_0xc6f3cd,_0x584bde){_0x584bde=_0x584bde||0xcc;return function(_0x2f2001){if(_0x2f2001){return _0xc6f3cd[_0x6be4('0x18')](_0x584bde);}return _0xc6f3cd[_0x6be4('0x19')](_0x584bde)[_0x6be4('0x1a')]();};}function respondWithResult(_0x112ac7,_0x49c8d0){_0x49c8d0=_0x49c8d0||0xc8;return function(_0x36809d){if(_0x36809d){return _0x112ac7[_0x6be4('0x19')](_0x49c8d0)['json'](_0x36809d);}};}function respondWithFilteredResult(_0x41bc3d,_0x3bcbec){return function(_0x3add51){if(_0x3add51){var _0x51754e=_0x3add51['count'],_0x3ccf1c=_0x3bcbec[_0x6be4('0x1b')],_0x321ea4=_0x3bcbec[_0x6be4('0x1b')]+_0x3bcbec[_0x6be4('0x1c')],_0x2230c0;if(_0x321ea4>=_0x51754e){_0x321ea4=_0x51754e;_0x2230c0=0xc8;}else{_0x2230c0=0xce;}_0x41bc3d['status'](_0x2230c0);return _0x41bc3d[_0x6be4('0x1d')]('Content-Range',_0x3ccf1c+'-'+_0x321ea4+'/'+_0x51754e)[_0x6be4('0x1e')](_0x3add51);}return null;};}function patchUpdates(_0x42addf){return function(_0xc290c6){try{jsonpatch[_0x6be4('0x1f')](_0xc290c6,_0x42addf,!![]);}catch(_0x55d963){return BPromise['reject'](_0x55d963);}return _0xc290c6['save']();};}function saveUpdates(_0x28b0ae,_0x4aa4cc){return function(_0x447c5e){if(_0x447c5e){return _0x447c5e['update'](_0x28b0ae)[_0x6be4('0x20')](function(_0x74e736){return _0x74e736;});}return null;};}function removeEntity(_0xfb62f,_0x24b33e){return function(_0x4dc1d1){if(_0x4dc1d1){return _0x4dc1d1[_0x6be4('0x21')]()[_0x6be4('0x20')](function(){var _0x16642d=_0x4dc1d1[_0x6be4('0x22')]({'plain':!![]});var _0x2081a5=_0x6be4('0x23');return db[_0x6be4('0x24')][_0x6be4('0x21')]({'where':{'type':_0x2081a5,'resourceId':_0x16642d['id']}})['then'](function(){return _0x4dc1d1;});})[_0x6be4('0x20')](function(){_0xfb62f['status'](0xcc)[_0x6be4('0x1a')]();});}};}function handleEntityNotFound(_0x314ec1,_0x19c1b7){return function(_0x29fb41){if(!_0x29fb41){_0x314ec1[_0x6be4('0x18')](0x194);}return _0x29fb41;};}function handleError(_0xc04729,_0x419b7a){_0x419b7a=_0x419b7a||0x1f4;return function(_0x33c5ae){logger[_0x6be4('0x25')](_0x33c5ae[_0x6be4('0x26')]);if(_0x33c5ae[_0x6be4('0x27')]){delete _0x33c5ae[_0x6be4('0x27')];}_0xc04729['status'](_0x419b7a)['send'](_0x33c5ae);};}exports[_0x6be4('0x28')]=function(_0x72b30e,_0x4c612f){var _0x5a8ffc={},_0x20e416={},_0x4f8354={'count':0x0,'rows':[]};var _0x2dca31=_[_0x6be4('0x29')](db['Trigger'][_0x6be4('0x2a')],function(_0x2acf60){return{'name':_0x2acf60['fieldName'],'type':_0x2acf60['type'][_0x6be4('0x2b')]};});_0x20e416[_0x6be4('0x2c')]=_[_0x6be4('0x29')](_0x2dca31,_0x6be4('0x27'));_0x20e416['query']=_[_0x6be4('0x2d')](_0x72b30e['query']);_0x20e416[_0x6be4('0x2e')]=_[_0x6be4('0x2f')](_0x20e416['model'],_0x20e416[_0x6be4('0x30')]);_0x5a8ffc[_0x6be4('0x31')]=_[_0x6be4('0x2f')](_0x20e416[_0x6be4('0x2c')],qs[_0x6be4('0x32')](_0x72b30e['query'][_0x6be4('0x32')]));_0x5a8ffc['attributes']=_0x5a8ffc[_0x6be4('0x31')][_0x6be4('0x33')]?_0x5a8ffc['attributes']:_0x20e416[_0x6be4('0x2c')];if(!_0x72b30e['query'][_0x6be4('0x34')](_0x6be4('0x35'))){_0x5a8ffc[_0x6be4('0x1c')]=qs[_0x6be4('0x1c')](_0x72b30e[_0x6be4('0x30')]['limit']);_0x5a8ffc[_0x6be4('0x1b')]=qs[_0x6be4('0x1b')](_0x72b30e[_0x6be4('0x30')][_0x6be4('0x1b')]);}_0x5a8ffc[_0x6be4('0x36')]=qs['sort'](_0x72b30e[_0x6be4('0x30')][_0x6be4('0x37')]);_0x5a8ffc[_0x6be4('0x38')]=qs[_0x6be4('0x2e')](_[_0x6be4('0x39')](_0x72b30e[_0x6be4('0x30')],_0x20e416[_0x6be4('0x2e')]),_0x2dca31);if(_0x72b30e['query'][_0x6be4('0x3a')]){_0x5a8ffc[_0x6be4('0x38')]=_[_0x6be4('0x3b')](_0x5a8ffc[_0x6be4('0x38')],{'$or':_[_0x6be4('0x29')](_0x2dca31,function(_0x5636a0){if(_0x5636a0['type']!==_0x6be4('0x3c')){var _0x155c71={};_0x155c71[_0x5636a0[_0x6be4('0x27')]]={'$like':'%'+_0x72b30e[_0x6be4('0x30')][_0x6be4('0x3a')]+'%'};return _0x155c71;}})});}_0x5a8ffc=_[_0x6be4('0x3b')]({},_0x5a8ffc,_0x72b30e[_0x6be4('0x3d')]);var _0x29e50c={'where':_0x5a8ffc[_0x6be4('0x38')]};return db[_0x6be4('0x3e')]['count'](_0x29e50c)[_0x6be4('0x20')](function(_0x5577f9){_0x4f8354['count']=_0x5577f9;if(_0x72b30e[_0x6be4('0x30')][_0x6be4('0x3f')]){_0x5a8ffc['include']=[{'all':!![]}];}return db['Trigger']['findAll'](_0x5a8ffc);})['then'](function(_0x1f5a92){_0x4f8354[_0x6be4('0x40')]=_0x1f5a92;return _0x4f8354;})['then'](respondWithFilteredResult(_0x4c612f,_0x5a8ffc))[_0x6be4('0x41')](handleError(_0x4c612f,null));};exports[_0x6be4('0x42')]=function(_0x586451,_0x201650){var _0x37f3bb={'raw':![],'where':{'id':_0x586451[_0x6be4('0x43')]['id']}},_0x40aa36={};_0x40aa36[_0x6be4('0x2c')]=_[_0x6be4('0x2d')](db['Trigger'][_0x6be4('0x2a')]);_0x40aa36[_0x6be4('0x30')]=_['keys'](_0x586451[_0x6be4('0x30')]);_0x40aa36['filters']=_[_0x6be4('0x2f')](_0x40aa36[_0x6be4('0x2c')],_0x40aa36[_0x6be4('0x30')]);_0x37f3bb['attributes']=_[_0x6be4('0x2f')](_0x40aa36[_0x6be4('0x2c')],qs[_0x6be4('0x32')](_0x586451['query'][_0x6be4('0x32')]));_0x37f3bb[_0x6be4('0x31')]=_0x37f3bb[_0x6be4('0x31')]['length']?_0x37f3bb['attributes']:_0x40aa36[_0x6be4('0x2c')];if(_0x586451[_0x6be4('0x30')]['includeAll']){_0x37f3bb[_0x6be4('0x44')]=[{'all':!![]}];}_0x37f3bb=_['merge']({},_0x37f3bb,_0x586451[_0x6be4('0x3d')]);return db[_0x6be4('0x3e')][_0x6be4('0x45')](_0x37f3bb)[_0x6be4('0x20')](handleEntityNotFound(_0x201650,null))[_0x6be4('0x20')](respondWithResult(_0x201650,null))[_0x6be4('0x41')](handleError(_0x201650,null));};exports[_0x6be4('0x46')]=function(_0x1a24c1,_0x20f5bf){return db['Trigger']['create'](_0x1a24c1[_0x6be4('0x47')],{})[_0x6be4('0x20')](function(_0x45e3c3){var _0x5b9170=_0x1a24c1[_0x6be4('0x48')][_0x6be4('0x22')]({'plain':!![]});if(!_0x5b9170)throw new Error(_0x6be4('0x49'));if(_0x5b9170[_0x6be4('0x4a')]==='user'){var _0x4c23e0=_0x45e3c3['get']({'plain':!![]});var _0x4cb0a9='Triggers';return db[_0x6be4('0x4b')][_0x6be4('0x45')]({'where':{'name':_0x4cb0a9,'userProfileId':_0x5b9170[_0x6be4('0x4c')]},'raw':!![]})[_0x6be4('0x20')](function(_0x418fd3){if(_0x418fd3&&_0x418fd3[_0x6be4('0x4d')]===0x0){return db[_0x6be4('0x24')][_0x6be4('0x46')]({'name':_0x4c23e0[_0x6be4('0x27')],'resourceId':_0x4c23e0['id'],'type':_0x418fd3[_0x6be4('0x27')],'sectionId':_0x418fd3['id']},{})[_0x6be4('0x20')](function(){return _0x45e3c3;});}else{return _0x45e3c3;}})[_0x6be4('0x41')](function(_0x5b1740){logger[_0x6be4('0x25')](_0x6be4('0x4e'),_0x5b1740);throw _0x5b1740;});}return _0x45e3c3;})[_0x6be4('0x20')](respondWithResult(_0x20f5bf,0xc9))[_0x6be4('0x41')](handleError(_0x20f5bf,null));};exports[_0x6be4('0x4f')]=function(_0x1ac4c2,_0xbbfdc){if(_0x1ac4c2[_0x6be4('0x47')]['id']){delete _0x1ac4c2['body']['id'];}return db[_0x6be4('0x3e')][_0x6be4('0x45')]({'where':{'id':_0x1ac4c2[_0x6be4('0x43')]['id']}})[_0x6be4('0x20')](handleEntityNotFound(_0xbbfdc,null))[_0x6be4('0x20')](saveUpdates(_0x1ac4c2['body'],null))[_0x6be4('0x20')](respondWithResult(_0xbbfdc,null))[_0x6be4('0x41')](handleError(_0xbbfdc,null));};exports[_0x6be4('0x21')]=function(_0x3bf2c2,_0x1d5371){return db['Trigger'][_0x6be4('0x45')]({'where':{'id':_0x3bf2c2[_0x6be4('0x43')]['id']}})[_0x6be4('0x20')](handleEntityNotFound(_0x1d5371,null))['then'](removeEntity(_0x1d5371,null))[_0x6be4('0x41')](handleError(_0x1d5371,null));};exports[_0x6be4('0x50')]=function(_0x333cd3,_0x11087f,_0x4c059d){if(_0x333cd3[_0x6be4('0x47')]['id']){delete _0x333cd3[_0x6be4('0x47')]['id'];}return db['Trigger'][_0x6be4('0x45')]({'where':{'id':_0x333cd3[_0x6be4('0x43')]['id']}})[_0x6be4('0x20')](handleEntityNotFound(_0x11087f,null))['then'](function(_0x1f4c30){if(_0x1f4c30){_0x333cd3[_0x6be4('0x47')][_0x6be4('0x51')]=_0x1f4c30['id'];return db[_0x6be4('0x52')][_0x6be4('0x46')](_0x333cd3[_0x6be4('0x47')]);}})[_0x6be4('0x20')](respondWithResult(_0x11087f,null))['catch'](handleError(_0x11087f,null));};exports[_0x6be4('0x53')]=function(_0x4e9076,_0x4e13e0,_0xe35b45){if(_0x4e9076[_0x6be4('0x47')]['id']){delete _0x4e9076[_0x6be4('0x47')]['id'];}return db[_0x6be4('0x3e')][_0x6be4('0x45')]({'where':{'id':_0x4e9076[_0x6be4('0x43')]['id']}})[_0x6be4('0x20')](handleEntityNotFound(_0x4e13e0,null))[_0x6be4('0x20')](function(_0x28e3a5){if(_0x28e3a5){_0x4e9076[_0x6be4('0x47')][_0x6be4('0x54')]=_0x28e3a5['id'];return db['Condition'][_0x6be4('0x46')](_0x4e9076[_0x6be4('0x47')]);}})[_0x6be4('0x20')](respondWithResult(_0x4e13e0,null))[_0x6be4('0x41')](handleError(_0x4e13e0,null));};exports[_0x6be4('0x55')]=function(_0x4f5b65,_0x1cddd5,_0x25e6fb){var _0x4e9ded={};var _0x205b87={};var _0x5a40f2;var _0x44631e;return db['Trigger']['findOne']({'where':{'id':_0x4f5b65[_0x6be4('0x43')]['id']}})[_0x6be4('0x20')](handleEntityNotFound(_0x1cddd5,null))[_0x6be4('0x20')](function(_0x51aae0){if(_0x51aae0){_0x5a40f2=_0x51aae0;_0x205b87['model']=_[_0x6be4('0x2d')](db[_0x6be4('0x52')]['rawAttributes']);_0x205b87[_0x6be4('0x30')]=_[_0x6be4('0x2d')](_0x4f5b65[_0x6be4('0x30')]);_0x205b87['filters']=_[_0x6be4('0x2f')](_0x205b87[_0x6be4('0x2c')],_0x205b87[_0x6be4('0x30')]);_0x4e9ded[_0x6be4('0x31')]=_[_0x6be4('0x2f')](_0x205b87[_0x6be4('0x2c')],qs[_0x6be4('0x32')](_0x4f5b65[_0x6be4('0x30')][_0x6be4('0x32')]));_0x4e9ded['attributes']=_0x4e9ded['attributes'][_0x6be4('0x33')]?_0x4e9ded[_0x6be4('0x31')]:_0x205b87[_0x6be4('0x2c')];_0x4e9ded[_0x6be4('0x36')]=qs['sort'](_0x4f5b65[_0x6be4('0x30')][_0x6be4('0x37')]);_0x4e9ded[_0x6be4('0x38')]=qs[_0x6be4('0x2e')](_[_0x6be4('0x39')](_0x4f5b65[_0x6be4('0x30')],_0x205b87['filters']));if(_0x4f5b65[_0x6be4('0x30')][_0x6be4('0x3a')]){_0x4e9ded[_0x6be4('0x38')]=_[_0x6be4('0x3b')](_0x4e9ded[_0x6be4('0x38')],{'$or':_['map'](_0x4e9ded['attributes'],function(_0x1505f8){var _0x4ceda8={};_0x4ceda8[_0x1505f8]={'$like':'%'+_0x4f5b65['query'][_0x6be4('0x3a')]+'%'};return _0x4ceda8;})});}_0x4e9ded=_[_0x6be4('0x3b')]({},_0x4e9ded,_0x4f5b65['options']);return _0x5a40f2[_0x6be4('0x55')](_0x4e9ded);}})['then'](function(_0x1ec395){if(_0x1ec395){_0x44631e=_0x1ec395[_0x6be4('0x33')];if(!_0x4f5b65[_0x6be4('0x30')][_0x6be4('0x34')](_0x6be4('0x35'))){_0x4e9ded[_0x6be4('0x1c')]=qs[_0x6be4('0x1c')](_0x4f5b65[_0x6be4('0x30')]['limit']);_0x4e9ded[_0x6be4('0x1b')]=qs[_0x6be4('0x1b')](_0x4f5b65['query'][_0x6be4('0x1b')]);}return _0x5a40f2['getAllConditions'](_0x4e9ded);}})[_0x6be4('0x20')](function(_0x4536fa){if(_0x4536fa){return _0x4536fa?{'count':_0x44631e,'rows':_0x4536fa}:null;}})['then'](respondWithResult(_0x1cddd5,null))[_0x6be4('0x41')](handleError(_0x1cddd5,null));};exports[_0x6be4('0x56')]=function(_0x57e030,_0x6b489,_0x57ab96){var _0x2cf392={};var _0x22878f={};var _0x299f1d;var _0xdbda4;return db['Trigger']['findOne']({'where':{'id':_0x57e030[_0x6be4('0x43')]['id']}})[_0x6be4('0x20')](handleEntityNotFound(_0x6b489,null))[_0x6be4('0x20')](function(_0x5c022c){if(_0x5c022c){_0x299f1d=_0x5c022c;_0x22878f['model']=_[_0x6be4('0x2d')](db['Condition'][_0x6be4('0x2a')]);_0x22878f[_0x6be4('0x30')]=_[_0x6be4('0x2d')](_0x57e030[_0x6be4('0x30')]);_0x22878f[_0x6be4('0x2e')]=_[_0x6be4('0x2f')](_0x22878f[_0x6be4('0x2c')],_0x22878f['query']);_0x2cf392['attributes']=_['intersection'](_0x22878f[_0x6be4('0x2c')],qs['fields'](_0x57e030[_0x6be4('0x30')][_0x6be4('0x32')]));_0x2cf392['attributes']=_0x2cf392[_0x6be4('0x31')][_0x6be4('0x33')]?_0x2cf392[_0x6be4('0x31')]:_0x22878f[_0x6be4('0x2c')];_0x2cf392[_0x6be4('0x36')]=qs['sort'](_0x57e030[_0x6be4('0x30')][_0x6be4('0x37')]);_0x2cf392['where']=qs[_0x6be4('0x2e')](_[_0x6be4('0x39')](_0x57e030[_0x6be4('0x30')],_0x22878f[_0x6be4('0x2e')]));if(_0x57e030[_0x6be4('0x30')][_0x6be4('0x3a')]){_0x2cf392[_0x6be4('0x38')]=_[_0x6be4('0x3b')](_0x2cf392[_0x6be4('0x38')],{'$or':_[_0x6be4('0x29')](_0x2cf392['attributes'],function(_0x106793){var _0x31e042={};_0x31e042[_0x106793]={'$like':'%'+_0x57e030[_0x6be4('0x30')][_0x6be4('0x3a')]+'%'};return _0x31e042;})});}_0x2cf392=_['merge']({},_0x2cf392,_0x57e030[_0x6be4('0x3d')]);return _0x299f1d[_0x6be4('0x56')](_0x2cf392);}})[_0x6be4('0x20')](function(_0x4d1f8e){if(_0x4d1f8e){_0xdbda4=_0x4d1f8e[_0x6be4('0x33')];if(!_0x57e030[_0x6be4('0x30')]['hasOwnProperty']('nolimit')){_0x2cf392[_0x6be4('0x1c')]=qs[_0x6be4('0x1c')](_0x57e030[_0x6be4('0x30')][_0x6be4('0x1c')]);_0x2cf392['offset']=qs[_0x6be4('0x1b')](_0x57e030[_0x6be4('0x30')][_0x6be4('0x1b')]);}return _0x299f1d[_0x6be4('0x56')](_0x2cf392);}})[_0x6be4('0x20')](function(_0x5b8cb6){if(_0x5b8cb6){return _0x5b8cb6?{'count':_0xdbda4,'rows':_0x5b8cb6}:null;}})[_0x6be4('0x20')](respondWithResult(_0x6b489,null))['catch'](handleError(_0x6b489,null));};exports[_0x6be4('0x57')]=function(_0xd05fa5,_0x4ce9f2,_0x250a41){if(_0xd05fa5[_0x6be4('0x47')]['id']){delete _0xd05fa5['body']['id'];}return db['Trigger'][_0x6be4('0x45')]({'where':{'id':_0xd05fa5['params']['id']}})[_0x6be4('0x20')](handleEntityNotFound(_0x4ce9f2,null))[_0x6be4('0x20')](function(_0x569077){if(_0x569077){_0xd05fa5[_0x6be4('0x47')][_0x6be4('0x58')]=_0x569077['id'];return db[_0x6be4('0x59')][_0x6be4('0x46')](_0xd05fa5[_0x6be4('0x47')]);}})[_0x6be4('0x20')](respondWithResult(_0x4ce9f2,null))['catch'](handleError(_0x4ce9f2,null));};exports[_0x6be4('0x5a')]=function(_0x3453dc,_0x49fde9,_0xd1ff0a){var _0x18d6c5={};var _0x4c9b38={};var _0x25d90c;var _0x2b4d50;return db[_0x6be4('0x3e')]['findOne']({'where':{'id':_0x3453dc[_0x6be4('0x43')]['id']}})['then'](handleEntityNotFound(_0x49fde9,null))[_0x6be4('0x20')](function(_0x36fd4c){if(_0x36fd4c){_0x25d90c=_0x36fd4c;_0x4c9b38[_0x6be4('0x2c')]=_[_0x6be4('0x2d')](db['Action']['rawAttributes']);_0x4c9b38[_0x6be4('0x30')]=_[_0x6be4('0x2d')](_0x3453dc[_0x6be4('0x30')]);_0x4c9b38[_0x6be4('0x2e')]=_[_0x6be4('0x2f')](_0x4c9b38[_0x6be4('0x2c')],_0x4c9b38[_0x6be4('0x30')]);_0x18d6c5[_0x6be4('0x31')]=_[_0x6be4('0x2f')](_0x4c9b38['model'],qs[_0x6be4('0x32')](_0x3453dc[_0x6be4('0x30')][_0x6be4('0x32')]));_0x18d6c5[_0x6be4('0x31')]=_0x18d6c5[_0x6be4('0x31')][_0x6be4('0x33')]?_0x18d6c5[_0x6be4('0x31')]:_0x4c9b38[_0x6be4('0x2c')];_0x18d6c5['order']=qs[_0x6be4('0x37')](_0x3453dc[_0x6be4('0x30')][_0x6be4('0x37')]);_0x18d6c5[_0x6be4('0x38')]=qs[_0x6be4('0x2e')](_[_0x6be4('0x39')](_0x3453dc[_0x6be4('0x30')],_0x4c9b38[_0x6be4('0x2e')]));if(_0x3453dc[_0x6be4('0x30')][_0x6be4('0x3a')]){_0x18d6c5[_0x6be4('0x38')]=_[_0x6be4('0x3b')](_0x18d6c5[_0x6be4('0x38')],{'$or':_[_0x6be4('0x29')](_0x18d6c5['attributes'],function(_0x41152e){var _0x2156dd={};_0x2156dd[_0x41152e]={'$like':'%'+_0x3453dc['query'][_0x6be4('0x3a')]+'%'};return _0x2156dd;})});}_0x18d6c5=_['merge']({},_0x18d6c5,_0x3453dc['options']);return _0x25d90c[_0x6be4('0x5a')](_0x18d6c5);}})[_0x6be4('0x20')](function(_0x467dbc){if(_0x467dbc){_0x2b4d50=_0x467dbc['length'];if(!_0x3453dc[_0x6be4('0x30')]['hasOwnProperty'](_0x6be4('0x35'))){_0x18d6c5[_0x6be4('0x1c')]=qs[_0x6be4('0x1c')](_0x3453dc[_0x6be4('0x30')]['limit']);_0x18d6c5['offset']=qs[_0x6be4('0x1b')](_0x3453dc[_0x6be4('0x30')][_0x6be4('0x1b')]);}return _0x25d90c[_0x6be4('0x5a')](_0x18d6c5);}})['then'](function(_0x208447){if(_0x208447){return _0x208447?{'count':_0x2b4d50,'rows':_0x208447}:null;}})['then'](respondWithResult(_0x49fde9,null))['catch'](handleError(_0x49fde9,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index dd079fc..2631cf9 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 _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 +var _0x7849=['../../config/logger','api','bluebird','request-promise','path','rimraf','./trigger.attributes','exports','tools_triggers','util'];(function(_0x4a42f0,_0x2da65d){var _0x3dc532=function(_0xb60cdf){while(--_0xb60cdf){_0x4a42f0['push'](_0x4a42f0['shift']());}};_0x3dc532(++_0x2da65d);}(_0x7849,0x1f3));var _0x9784=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7849[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x9784('0x0'));var logger=require(_0x9784('0x1'))(_0x9784('0x2'));var moment=require('moment');var BPromise=require(_0x9784('0x3'));var rp=require(_0x9784('0x4'));var fs=require('fs');var path=require(_0x9784('0x5'));var rimraf=require(_0x9784('0x6'));var config=require('../../config/environment');var attributes=require(_0x9784('0x7'));module[_0x9784('0x8')]=function(_0x59f8ed,_0x48691c){return _0x59f8ed['define']('Trigger',attributes,{'tableName':_0x9784('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index b11a83a..bea2799 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 _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 +var _0xe820=['findAll','options','raw','where','attributes','limit','include','map','model','info','catch','ShowTrigger','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetTrigger','Trigger'];(function(_0x5b978c,_0x3c81f6){var _0x544967=function(_0x4b7719){while(--_0x4b7719){_0x5b978c['push'](_0x5b978c['shift']());}};_0x544967(++_0x3c81f6);}(_0xe820,0xd2));var _0x0e82=function(_0x412a6d,_0x5e824b){_0x412a6d=_0x412a6d-0x0;var _0x1006d2=_0xe820[_0x412a6d];return _0x1006d2;};'use strict';var _=require(_0x0e82('0x0'));var util=require('util');var moment=require(_0x0e82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0e82('0x2'));var db=require(_0x0e82('0x3'))['db'];var utils=require(_0x0e82('0x4'));var logger=require('../../config/logger')(_0x0e82('0x5'));var config=require('../../config/environment');var jayson=require(_0x0e82('0x6'));var client=jayson[_0x0e82('0x7')][_0x0e82('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x328b32,_0x2a0f9b,_0x55f277){return new BPromise(function(_0x10013b,_0x33c8a2){return client[_0x0e82('0x9')](_0x328b32,_0x55f277)[_0x0e82('0xa')](function(_0x3b7792){logger['info'](_0x0e82('0xb'),_0x2a0f9b,_0x0e82('0xc'));logger[_0x0e82('0xd')](_0x0e82('0xe'),_0x2a0f9b,_0x0e82('0xc'),JSON[_0x0e82('0xf')](_0x3b7792));if(_0x3b7792[_0x0e82('0x10')]){if(_0x3b7792['error'][_0x0e82('0x11')]===0x1f4){logger[_0x0e82('0x10')](_0x0e82('0xb'),_0x2a0f9b,_0x3b7792[_0x0e82('0x10')][_0x0e82('0x12')]);return _0x33c8a2(_0x3b7792[_0x0e82('0x10')]['message']);}logger[_0x0e82('0x10')]('Trigger,\x20%s,\x20%s',_0x2a0f9b,_0x3b7792['error'][_0x0e82('0x12')]);return _0x10013b(_0x3b7792['error']['message']);}else{logger['info'](_0x0e82('0xb'),_0x2a0f9b,'request\x20sent');_0x10013b(_0x3b7792['result'][_0x0e82('0x12')]);}})['catch'](function(_0x319303){logger[_0x0e82('0x10')](_0x0e82('0xb'),_0x2a0f9b,_0x319303);_0x33c8a2(_0x319303);});});}exports[_0x0e82('0x13')]=function(_0x53622b){var _0x25ac21=this;return new Promise(function(_0x310aac,_0x3a3ddf){return db[_0x0e82('0x14')][_0x0e82('0x15')]({'raw':_0x53622b[_0x0e82('0x16')]?_0x53622b[_0x0e82('0x16')][_0x0e82('0x17')]===undefined?!![]:![]:!![],'where':_0x53622b[_0x0e82('0x16')]?_0x53622b[_0x0e82('0x16')][_0x0e82('0x18')]||null:null,'attributes':_0x53622b['options']?_0x53622b['options'][_0x0e82('0x19')]||null:null,'limit':_0x53622b[_0x0e82('0x16')]?_0x53622b[_0x0e82('0x16')][_0x0e82('0x1a')]||null:null,'include':_0x53622b[_0x0e82('0x16')]?_0x53622b[_0x0e82('0x16')][_0x0e82('0x1b')]?_[_0x0e82('0x1c')](_0x53622b['options'][_0x0e82('0x1b')],function(_0x13f023){return{'model':db[_0x13f023[_0x0e82('0x1d')]],'as':_0x13f023['as'],'attributes':_0x13f023[_0x0e82('0x19')],'include':_0x13f023['include']?_[_0x0e82('0x1c')](_0x13f023[_0x0e82('0x1b')],function(_0x7a9399){return{'model':db[_0x7a9399[_0x0e82('0x1d')]],'as':_0x7a9399['as'],'attributes':_0x7a9399['attributes'],'include':_0x7a9399[_0x0e82('0x1b')]?_['map'](_0x7a9399['include'],function(_0x384f88){return{'model':db[_0x384f88[_0x0e82('0x1d')]],'as':_0x384f88['as'],'attributes':_0x384f88['attributes']};}):[]};}):[]};}):[]:[]})[_0x0e82('0xa')](function(_0xe3c530){logger[_0x0e82('0x1e')]('GetTrigger',_0x53622b);logger[_0x0e82('0xd')](_0x0e82('0x13'),_0x53622b,JSON['stringify'](_0xe3c530));_0x310aac(_0xe3c530);})[_0x0e82('0x1f')](function(_0x59a5b6){logger[_0x0e82('0x10')](_0x0e82('0x13'),_0x59a5b6['message'],_0x53622b);_0x3a3ddf(_0x25ac21[_0x0e82('0x10')](0x1f4,_0x59a5b6[_0x0e82('0x12')]));});});};exports[_0x0e82('0x20')]=function(_0x4d74d0){var _0x50adb7=this;return new Promise(function(_0x2dc021,_0x4a8c43){return db[_0x0e82('0x14')]['find']({'raw':_0x4d74d0[_0x0e82('0x16')]?_0x4d74d0[_0x0e82('0x16')][_0x0e82('0x17')]===undefined?!![]:![]:!![],'where':_0x4d74d0['options']?_0x4d74d0[_0x0e82('0x16')]['where']||null:null,'attributes':_0x4d74d0[_0x0e82('0x16')]?_0x4d74d0[_0x0e82('0x16')][_0x0e82('0x19')]||null:null,'include':_0x4d74d0[_0x0e82('0x16')]?_0x4d74d0[_0x0e82('0x16')][_0x0e82('0x1b')]?_['map'](_0x4d74d0[_0x0e82('0x16')][_0x0e82('0x1b')],function(_0x34c914){return{'model':db[_0x34c914[_0x0e82('0x1d')]],'as':_0x34c914['as'],'attributes':_0x34c914[_0x0e82('0x19')],'include':_0x34c914[_0x0e82('0x1b')]?_[_0x0e82('0x1c')](_0x34c914[_0x0e82('0x1b')],function(_0xfd7924){return{'model':db[_0xfd7924[_0x0e82('0x1d')]],'as':_0xfd7924['as'],'attributes':_0xfd7924[_0x0e82('0x19')],'include':_0xfd7924[_0x0e82('0x1b')]?_[_0x0e82('0x1c')](_0xfd7924[_0x0e82('0x1b')],function(_0x21dd97){return{'model':db[_0x21dd97['model']],'as':_0x21dd97['as'],'attributes':_0x21dd97[_0x0e82('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0e82('0xa')](function(_0x3be8e8){logger[_0x0e82('0x1e')]('ShowTrigger',_0x4d74d0);logger[_0x0e82('0xd')](_0x0e82('0x20'),_0x4d74d0,JSON['stringify'](_0x3be8e8));_0x2dc021(_0x3be8e8);})[_0x0e82('0x1f')](function(_0x57e505){logger['error'](_0x0e82('0x20'),_0x57e505[_0x0e82('0x12')],_0x4d74d0);_0x4a8c43(_0x50adb7[_0x0e82('0x10')](0x1f4,_0x57e505[_0x0e82('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 9562f88..12dc79f 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 _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 +var _0x9957=['/:id/clone','clone','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post'];(function(_0x5c3fff,_0x413d8f){var _0x2cb058=function(_0x41ae3e){while(--_0x41ae3e){_0x5c3fff['push'](_0x5c3fff['shift']());}};_0x2cb058(++_0x413d8f);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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('./trunk.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['show']);router[_0x7995('0xc')](_0x7995('0xd'),auth['isAuthenticated'](),controller[_0x7995('0xe')]);router[_0x7995('0xc')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['update']);router[_0x7995('0x11')](_0x7995('0xb'),auth['isAuthenticated'](),controller[_0x7995('0x12')]);module[_0x7995('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 420cb4f..bcac3fb 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 _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 +var _0x8098=['originate','uac','pai','fingerprint','passive','actpass','update,nonat','BOOLEAN','exports','STRING','name','ENUM','user','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','auto','yes','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER','accept'];(function(_0x1493aa,_0x577979){var _0x9230bb=function(_0x3ba658){while(--_0x3ba658){_0x1493aa['push'](_0x1493aa['shift']());}};_0x9230bb(++_0x577979);}(_0x8098,0x1b8));var _0x8809=function(_0x37a014,_0x14315d){_0x37a014=_0x37a014-0x0;var _0x47f358=_0x8098[_0x37a014];return _0x47f358;};'use strict';var Sequelize=require('sequelize');module[_0x8809('0x0')]={'name':{'type':Sequelize[_0x8809('0x1')],'allowNull':![],'unique':_0x8809('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8809('0x3')]('friend',_0x8809('0x4'),'peer'),'allowNull':![],'defaultValue':_0x8809('0x5')},'context':{'type':Sequelize[_0x8809('0x1')],'allowNull':![],'defaultValue':_0x8809('0x6')},'callingpres':{'type':Sequelize[_0x8809('0x3')](_0x8809('0x7'),_0x8809('0x8'),_0x8809('0x9'),_0x8809('0xa'),_0x8809('0xb'),_0x8809('0xc'),_0x8809('0xd'),_0x8809('0xe'))},'deny':{'type':Sequelize[_0x8809('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x8809('0x1')]},'md5secret':{'type':Sequelize[_0x8809('0x1')]},'remotesecret':{'type':Sequelize[_0x8809('0x1')]},'transport':{'type':Sequelize[_0x8809('0x1')],'defaultValue':_0x8809('0xf'),'set':function(_0x10d8d5){this[_0x8809('0x10')]('transport',_0x10d8d5?_0x10d8d5[_0x8809('0x11')](','):null);},'get':function(){return this[_0x8809('0x12')](_0x8809('0x13'))?this[_0x8809('0x12')](_0x8809('0x13'))[_0x8809('0x14')](','):null;},'comment':_0x8809('0x15')},'dtmfmode':{'type':Sequelize[_0x8809('0x3')](_0x8809('0x16'),_0x8809('0x17'),'shortinfo','inband',_0x8809('0x18')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x8809('0x19'),'no','nonat',_0x8809('0x1a'),_0x8809('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x8809('0x3')](_0x8809('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x8809('0x1')],'defaultValue':_0x8809('0x1c'),'set':function(_0x56ccfc){this[_0x8809('0x10')](_0x8809('0x1d'),_0x56ccfc?_0x56ccfc[_0x8809('0x11')](','):null);},'get':function(){return this[_0x8809('0x12')](_0x8809('0x1d'))?this[_0x8809('0x12')](_0x8809('0x1d'))['split'](','):null;},'comment':_0x8809('0x1e')},'callgroup':{'type':Sequelize[_0x8809('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x8809('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x8809('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x8809('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x8809('0x1')],'defaultValue':_0x8809('0x1f')},'allow':{'type':Sequelize[_0x8809('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x41276b){this['setDataValue']('allow',_0x41276b?_0x41276b[_0x8809('0x11')](';'):_0x8809('0x20'));},'get':function(){return this[_0x8809('0x12')](_0x8809('0x21'))?this['getDataValue'](_0x8809('0x21'))[_0x8809('0x14')](';'):null;},'comment':_0x8809('0x22')},'autoframing':{'type':Sequelize[_0x8809('0x3')]('yes','no')},'insecure':{'type':Sequelize[_0x8809('0x1')],'defaultValue':_0x8809('0x23'),'set':function(_0x59e173){this['setDataValue'](_0x8809('0x24'),_0x59e173?_0x59e173['join'](','):null);},'get':function(){return this[_0x8809('0x12')](_0x8809('0x24'))?this[_0x8809('0x12')](_0x8809('0x24'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x8809('0x3')](_0x8809('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x8809('0x3')]('yes','no',_0x8809('0x25'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0x8809('0x19'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x8809('0x1')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x8809('0x3')]('yes','no'),'defaultValue':_0x8809('0x19')},'busylevel':{'type':Sequelize[_0x8809('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0x8809('0x3')](_0x8809('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x8809('0x3')](_0x8809('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x8809('0x3')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x8809('0x3')](_0x8809('0x19'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x8809('0x1')]},'videosupport':{'type':Sequelize['ENUM'](_0x8809('0x19'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x8809('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x8809('0x3')](_0x8809('0x19'),'no')},'mailbox':{'type':Sequelize[_0x8809('0x1')]},'session_timers':{'type':Sequelize['ENUM'](_0x8809('0x27'),'refuse',_0x8809('0x28'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x8809('0x3')](_0x8809('0x29'),'uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x8809('0x1')]},'fromdomain':{'type':Sequelize[_0x8809('0x1')]},'fromuser':{'type':Sequelize[_0x8809('0x1')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x8809('0x3')]('yes','no'),'defaultValue':_0x8809('0x19')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x8809('0x1')]},'defaultuser':{'type':Sequelize[_0x8809('0x1')]},'rtptimeout':{'type':Sequelize[_0x8809('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x8809('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0x8809('0x3')](_0x8809('0x19'),'no',_0x8809('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x8809('0x1')]},'callbackextension':{'type':Sequelize[_0x8809('0x1')]},'timert1':{'type':Sequelize[_0x8809('0x26')](0xb)},'timerb':{'type':Sequelize[_0x8809('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0x8809('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x8809('0x1')]},'contactdeny':{'type':Sequelize[_0x8809('0x1')]},'contactacl':{'type':Sequelize[_0x8809('0x1')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x8809('0x26')](0xb)},'encryption':{'type':Sequelize[_0x8809('0x3')](_0x8809('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x8809('0x3')](_0x8809('0x19'),'no')},'force_avp':{'type':Sequelize[_0x8809('0x3')]('yes','no')},'icesupport':{'type':Sequelize[_0x8809('0x3')](_0x8809('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0x8809('0x3')](_0x8809('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0x8809('0x3')](_0x8809('0x19'),'no',_0x8809('0x2b'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x8809('0x26')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x8809('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x8809('0x1')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x8809('0x3')]('active',_0x8809('0x2c'),_0x8809('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x8809('0x1')]},'usereqphone':{'type':Sequelize[_0x8809('0x3')](_0x8809('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x8809('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x8809('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x8809('0x3')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x8809('0x3')]('yes','no')},'vmexten':{'type':Sequelize[_0x8809('0x1')]},'mohinterpret':{'type':Sequelize[_0x8809('0x1')]},'mohsuggest':{'type':Sequelize[_0x8809('0x1')]},'parkinglot':{'type':Sequelize[_0x8809('0x1')]},'description':{'type':Sequelize[_0x8809('0x1')]},'host':{'type':Sequelize[_0x8809('0x1')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x8809('0x3')]('yes','no','nonat',_0x8809('0x1a'),_0x8809('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x8809('0x1')]},'otherFields':{'type':Sequelize[_0x8809('0x1')]},'active':{'type':Sequelize[_0x8809('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x8809('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 8fdf9f2..838ce67 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 _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 +var _0xcbe1=['then','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','status','end','count','offset','limit','set','json','apply','reject','update','destroy','Trunks','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','Trunk','rows','show','params','includeAll','include','options','find','clone','get','omit','createdAt','body','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','userProfileId','eml-format','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../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~!@#$%^&-_=+[{]}.','request'];(function(_0x20997e,_0x161121){var _0x198438=function(_0x55561f){while(--_0x55561f){_0x20997e['push'](_0x20997e['shift']());}};_0x198438(++_0x161121);}(_0xcbe1,0x1a2));var _0x1cbe=function(_0x59cdd0,_0x56af37){_0x59cdd0=_0x59cdd0-0x0;var _0x41bf3d=_0xcbe1[_0x59cdd0];return _0x41bf3d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1cbe('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1cbe('0x1'));var BPromise=require(_0x1cbe('0x2'));var Mustache=require('mustache');var util=require(_0x1cbe('0x3'));var path=require('path');var sox=require(_0x1cbe('0x4'));var csv=require(_0x1cbe('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1cbe('0x6'));var squel=require(_0x1cbe('0x7'));var crypto=require(_0x1cbe('0x8'));var jsforce=require(_0x1cbe('0x9'));var deskjs=require(_0x1cbe('0xa'));var toCsv=require(_0x1cbe('0x5'));var querystring=require(_0x1cbe('0xb'));var Papa=require(_0x1cbe('0xc'));var Redis=require('ioredis');var authService=require(_0x1cbe('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x1cbe('0xe'));var hardwareService=require(_0x1cbe('0xf'));var logger=require(_0x1cbe('0x10'))(_0x1cbe('0x11'));var utils=require('../../config/utils');var config=require(_0x1cbe('0x12'));var db=require('../../mysqldb')['db'];var jayson=require(_0x1cbe('0x13'));var client=jayson[_0x1cbe('0x14')]['http']({'port':0x232a});function checkPasswordPattern(_0x42da0e,_0x2cc9a2,_0x3edda6){if(_0x3edda6){var _0x50e749=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x50e749[_0x1cbe('0x15')](_0x2cc9a2)){return _0x42da0e;}else{throw new db[(_0x1cbe('0x16'))][(_0x1cbe('0x17'))](_0x1cbe('0x18'));}}else{return _0x42da0e;}}function respondWithRpcPromise(_0x47303f,_0x14784f,_0x3eb11f,_0x25093a){return new BPromise(function(_0x109cd7,_0x41eec7){var _0x4fd646=_0x25093a||client;return _0x4fd646[_0x1cbe('0x19')](_0x47303f,_0x3eb11f)[_0x1cbe('0x1a')](function(_0x244a1d){logger['info'](_0x1cbe('0x1b'),_0x14784f,_0x1cbe('0x1c'));logger[_0x1cbe('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x14784f,'request\x20sent',JSON[_0x1cbe('0x1e')](_0x244a1d));if(_0x244a1d[_0x1cbe('0x1f')]){if(_0x244a1d[_0x1cbe('0x1f')][_0x1cbe('0x20')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x14784f,_0x244a1d[_0x1cbe('0x1f')][_0x1cbe('0x21')]);return _0x41eec7(_0x244a1d[_0x1cbe('0x1f')]['message']);}logger['error'](_0x1cbe('0x1b'),_0x14784f,_0x244a1d['error'][_0x1cbe('0x21')]);return _0x109cd7(_0x244a1d[_0x1cbe('0x1f')][_0x1cbe('0x21')]);}else{logger[_0x1cbe('0x22')](_0x1cbe('0x1b'),_0x14784f,_0x1cbe('0x1c'));_0x109cd7(_0x244a1d[_0x1cbe('0x23')][_0x1cbe('0x21')]);}})[_0x1cbe('0x24')](function(_0x4c7a82){logger[_0x1cbe('0x1f')]('Trunk,\x20%s,\x20%s',_0x14784f,_0x4c7a82);_0x41eec7(_0x4c7a82);});});}function respondWithStatusCode(_0x1fb6aa,_0x2208bd){_0x2208bd=_0x2208bd||0xcc;return function(_0x384845){if(_0x384845){return _0x1fb6aa['sendStatus'](_0x2208bd);}return _0x1fb6aa[_0x1cbe('0x25')](_0x2208bd)[_0x1cbe('0x26')]();};}function respondWithResult(_0x1b391d,_0x17cc57){_0x17cc57=_0x17cc57||0xc8;return function(_0xd9bb05){if(_0xd9bb05){return _0x1b391d[_0x1cbe('0x25')](_0x17cc57)['json'](_0xd9bb05);}};}function respondWithFilteredResult(_0x1d08b5,_0x367548){return function(_0x26fb19){if(_0x26fb19){var _0x5d781d=_0x26fb19[_0x1cbe('0x27')],_0x4c840e=_0x367548['offset'],_0xa30ec5=_0x367548[_0x1cbe('0x28')]+_0x367548[_0x1cbe('0x29')],_0x52d0d5;if(_0xa30ec5>=_0x5d781d){_0xa30ec5=_0x5d781d;_0x52d0d5=0xc8;}else{_0x52d0d5=0xce;}_0x1d08b5[_0x1cbe('0x25')](_0x52d0d5);return _0x1d08b5[_0x1cbe('0x2a')]('Content-Range',_0x4c840e+'-'+_0xa30ec5+'/'+_0x5d781d)[_0x1cbe('0x2b')](_0x26fb19);}return null;};}function patchUpdates(_0x1fa764){return function(_0x2f0888){try{jsonpatch[_0x1cbe('0x2c')](_0x2f0888,_0x1fa764,!![]);}catch(_0x6ac965){return BPromise[_0x1cbe('0x2d')](_0x6ac965);}return _0x2f0888['save']();};}function saveUpdates(_0x509a42,_0x5dbdd8){return function(_0x594295){if(_0x594295){return _0x594295[_0x1cbe('0x2e')](_0x509a42)[_0x1cbe('0x1a')](function(_0x5c8fed){return _0x5c8fed;});}return null;};}function removeEntity(_0x287e7d,_0x542101){return function(_0x33dfee){if(_0x33dfee){return _0x33dfee[_0x1cbe('0x2f')]()[_0x1cbe('0x1a')](function(){var _0x3217e5=_0x33dfee['get']({'plain':!![]});var _0x54c30e=_0x1cbe('0x30');return db[_0x1cbe('0x31')][_0x1cbe('0x2f')]({'where':{'type':_0x54c30e,'resourceId':_0x3217e5['id']}})[_0x1cbe('0x1a')](function(){return _0x33dfee;});})[_0x1cbe('0x1a')](function(){_0x287e7d['status'](0xcc)[_0x1cbe('0x26')]();});}};}function handleEntityNotFound(_0x1602fd,_0x5aec7f){return function(_0x12ab92){if(!_0x12ab92){_0x1602fd[_0x1cbe('0x32')](0x194);}return _0x12ab92;};}function handleError(_0x38c56d,_0x4c84f0){_0x4c84f0=_0x4c84f0||0x1f4;return function(_0x572189){logger[_0x1cbe('0x1f')](_0x572189[_0x1cbe('0x33')]);if(_0x572189[_0x1cbe('0x34')]){delete _0x572189[_0x1cbe('0x34')];}_0x38c56d[_0x1cbe('0x25')](_0x4c84f0)[_0x1cbe('0x35')](_0x572189);};}exports[_0x1cbe('0x36')]=function(_0x2a065e,_0x4a265c){var _0x9972a4={},_0x5f2f59={},_0x3e1e7c={'count':0x0,'rows':[]};var _0x59b54b=_[_0x1cbe('0x37')](db['Trunk'][_0x1cbe('0x38')],function(_0x57c3ac){return{'name':_0x57c3ac[_0x1cbe('0x39')],'type':_0x57c3ac[_0x1cbe('0x3a')]['key']};});_0x5f2f59[_0x1cbe('0x3b')]=_[_0x1cbe('0x37')](_0x59b54b,_0x1cbe('0x34'));_0x5f2f59[_0x1cbe('0x3c')]=_[_0x1cbe('0x3d')](_0x2a065e[_0x1cbe('0x3c')]);_0x5f2f59[_0x1cbe('0x3e')]=_[_0x1cbe('0x3f')](_0x5f2f59[_0x1cbe('0x3b')],_0x5f2f59[_0x1cbe('0x3c')]);_0x9972a4['attributes']=_[_0x1cbe('0x3f')](_0x5f2f59[_0x1cbe('0x3b')],qs[_0x1cbe('0x40')](_0x2a065e[_0x1cbe('0x3c')][_0x1cbe('0x40')]));_0x9972a4[_0x1cbe('0x41')]=_0x9972a4[_0x1cbe('0x41')][_0x1cbe('0x42')]?_0x9972a4[_0x1cbe('0x41')]:_0x5f2f59['model'];if(!_0x2a065e[_0x1cbe('0x3c')][_0x1cbe('0x43')](_0x1cbe('0x44'))){_0x9972a4[_0x1cbe('0x29')]=qs['limit'](_0x2a065e['query'][_0x1cbe('0x29')]);_0x9972a4['offset']=qs['offset'](_0x2a065e[_0x1cbe('0x3c')][_0x1cbe('0x28')]);}_0x9972a4[_0x1cbe('0x45')]=qs[_0x1cbe('0x46')](_0x2a065e[_0x1cbe('0x3c')][_0x1cbe('0x46')]);_0x9972a4[_0x1cbe('0x47')]=qs[_0x1cbe('0x3e')](_['pick'](_0x2a065e[_0x1cbe('0x3c')],_0x5f2f59['filters']),_0x59b54b);if(_0x2a065e[_0x1cbe('0x3c')][_0x1cbe('0x48')]){_0x9972a4[_0x1cbe('0x47')]=_['merge'](_0x9972a4[_0x1cbe('0x47')],{'$or':_[_0x1cbe('0x37')](_0x59b54b,function(_0xddc7c0){if(_0xddc7c0[_0x1cbe('0x3a')]!==_0x1cbe('0x49')){var _0x150e97={};_0x150e97[_0xddc7c0[_0x1cbe('0x34')]]={'$like':'%'+_0x2a065e[_0x1cbe('0x3c')][_0x1cbe('0x48')]+'%'};return _0x150e97;}})});}_0x9972a4=_[_0x1cbe('0x4a')]({},_0x9972a4,_0x2a065e['options']);var _0x1c18b2={'where':_0x9972a4[_0x1cbe('0x47')]};return db[_0x1cbe('0x4b')][_0x1cbe('0x27')](_0x1c18b2)[_0x1cbe('0x1a')](function(_0x49b406){_0x3e1e7c[_0x1cbe('0x27')]=_0x49b406;if(_0x2a065e[_0x1cbe('0x3c')]['includeAll']){_0x9972a4['include']=[{'all':!![]}];}return db['Trunk']['findAll'](_0x9972a4);})[_0x1cbe('0x1a')](function(_0xa8d499){_0x3e1e7c[_0x1cbe('0x4c')]=_0xa8d499;return _0x3e1e7c;})['then'](respondWithFilteredResult(_0x4a265c,_0x9972a4))['catch'](handleError(_0x4a265c,null));};exports[_0x1cbe('0x4d')]=function(_0x5084e1,_0x5038d3){var _0x279caf={'raw':![],'where':{'id':_0x5084e1[_0x1cbe('0x4e')]['id']}},_0x4c99fd={};_0x4c99fd[_0x1cbe('0x3b')]=_['keys'](db['Trunk']['rawAttributes']);_0x4c99fd['query']=_[_0x1cbe('0x3d')](_0x5084e1[_0x1cbe('0x3c')]);_0x4c99fd[_0x1cbe('0x3e')]=_[_0x1cbe('0x3f')](_0x4c99fd[_0x1cbe('0x3b')],_0x4c99fd[_0x1cbe('0x3c')]);_0x279caf[_0x1cbe('0x41')]=_[_0x1cbe('0x3f')](_0x4c99fd[_0x1cbe('0x3b')],qs['fields'](_0x5084e1[_0x1cbe('0x3c')]['fields']));_0x279caf[_0x1cbe('0x41')]=_0x279caf[_0x1cbe('0x41')][_0x1cbe('0x42')]?_0x279caf[_0x1cbe('0x41')]:_0x4c99fd[_0x1cbe('0x3b')];if(_0x5084e1[_0x1cbe('0x3c')][_0x1cbe('0x4f')]){_0x279caf[_0x1cbe('0x50')]=[{'all':!![]}];}_0x279caf=_[_0x1cbe('0x4a')]({},_0x279caf,_0x5084e1[_0x1cbe('0x51')]);return db[_0x1cbe('0x4b')][_0x1cbe('0x52')](_0x279caf)[_0x1cbe('0x1a')](handleEntityNotFound(_0x5038d3,null))[_0x1cbe('0x1a')](respondWithResult(_0x5038d3,null))['catch'](handleError(_0x5038d3,null));};exports[_0x1cbe('0x53')]=function(_0x545ca8,_0x33b2c0){var _0x503423={'where':{'id':_0x545ca8[_0x1cbe('0x4e')]['id']}},_0x3f0a6e={};_0x3f0a6e[_0x1cbe('0x3b')]=_['keys'](db[_0x1cbe('0x4b')][_0x1cbe('0x38')]);_0x503423['attributes']=_[_0x1cbe('0x3f')](_0x3f0a6e[_0x1cbe('0x3b')],qs[_0x1cbe('0x40')](_0x545ca8['query'][_0x1cbe('0x40')]));_0x503423[_0x1cbe('0x41')]=_0x503423[_0x1cbe('0x41')][_0x1cbe('0x42')]?_0x503423[_0x1cbe('0x41')]:_0x3f0a6e[_0x1cbe('0x3b')];if(_0x545ca8[_0x1cbe('0x3c')]['includeAll']){_0x503423['include']=[{'all':!![]}];}_0x503423=_['merge']({},_0x503423,_0x545ca8[_0x1cbe('0x51')]);return db[_0x1cbe('0x4b')]['find'](_0x503423)[_0x1cbe('0x1a')](handleEntityNotFound(_0x33b2c0,null))[_0x1cbe('0x1a')](function(_0x2a217d){if(_0x2a217d){var _0x52ea2b=_0x2a217d[_0x1cbe('0x54')]({'plain':!![]});_0x52ea2b=qs[_0x1cbe('0x55')](_0x52ea2b,['id',_0x1cbe('0x56'),'updatedAt']);_0x545ca8[_0x1cbe('0x57')]=_[_0x1cbe('0x55')](_0x545ca8[_0x1cbe('0x57')],['id',_0x1cbe('0x56'),_0x1cbe('0x58')]);return db[_0x1cbe('0x4b')]['create'](_[_0x1cbe('0x4a')](_0x52ea2b,_0x545ca8['body']),{'include':_0x545ca8['query'][_0x1cbe('0x4f')]?[{'all':!![]}]:undefined})[_0x1cbe('0x1a')](function(_0x41c809){var _0x579107=_0x545ca8['user']['get']({'plain':!![]});if(!_0x579107)throw new Error(_0x1cbe('0x59'));if(_0x579107[_0x1cbe('0x5a')]===_0x1cbe('0x5b')){var _0x5504a6=_0x41c809['get']({'plain':!![]});var _0xc51fe0=_0x1cbe('0x30');return db[_0x1cbe('0x5c')][_0x1cbe('0x52')]({'where':{'name':_0xc51fe0,'userProfileId':_0x579107['userProfileId']},'raw':!![]})[_0x1cbe('0x1a')](function(_0x4de52b){if(_0x4de52b&&_0x4de52b[_0x1cbe('0x5d')]===0x0){return db[_0x1cbe('0x31')][_0x1cbe('0x5e')]({'name':_0x5504a6[_0x1cbe('0x34')],'resourceId':_0x5504a6['id'],'type':_0x4de52b[_0x1cbe('0x34')],'sectionId':_0x4de52b['id']},{})[_0x1cbe('0x1a')](function(){return _0x41c809;});}else{return _0x41c809;}})[_0x1cbe('0x24')](function(_0x511161){logger[_0x1cbe('0x1f')](_0x1cbe('0x5f'),_0x511161);throw _0x511161;});}return _0x41c809;});}})[_0x1cbe('0x1a')](respondWithResult(_0x33b2c0,0xc9))[_0x1cbe('0x24')](handleError(_0x33b2c0,null));};exports['create']=function(_0x397d10,_0x183f85,_0x552bc6){var _0x5f0933;return db[_0x1cbe('0x4b')][_0x1cbe('0x5e')](_0x397d10[_0x1cbe('0x57')],{'raw':!![]})[_0x1cbe('0x1a')](function(_0x15ec5f){_0x5f0933=_0x15ec5f;return db[_0x1cbe('0x4b')][_0x1cbe('0x60')]({'raw':!![]});})['then'](function(_0x3685d0){var _0x56331e=fs[_0x1cbe('0x61')](path[_0x1cbe('0x62')](config['root'],_0x1cbe('0x63')),_0x1cbe('0x64'));var _0x26a1fc=fs[_0x1cbe('0x61')](path[_0x1cbe('0x62')](config[_0x1cbe('0x65')],_0x1cbe('0x66')),_0x1cbe('0x64'));var _0x2b286b=ejs[_0x1cbe('0x67')](_0x56331e,{'trunks':_0x3685d0||[]});fs[_0x1cbe('0x68')](_0x1cbe('0x69'),_0x2b286b);if(_0x5f0933[_0x1cbe('0x6a')]){var _0x285be9=ejs[_0x1cbe('0x67')](_0x26a1fc,{'trunks':_0x3685d0||[]});fs[_0x1cbe('0x68')](_0x1cbe('0x6b'),_0x285be9);}})[_0x1cbe('0x1a')](function(){return respondWithRpcPromise(_0x1cbe('0x6c'),_0x1cbe('0x5e'),{'module':_0x1cbe('0x6d')});})[_0x1cbe('0x1a')](function(){var _0x5681aa=_0x397d10[_0x1cbe('0x5b')]['get']({'plain':!![]});if(!_0x5681aa)throw new Error(_0x1cbe('0x59'));if(_0x5681aa['role']===_0x1cbe('0x5b')){var _0x4c7633=_0x5f0933['get']({'plain':!![]});return db[_0x1cbe('0x5c')][_0x1cbe('0x52')]({'where':{'name':_0x1cbe('0x30'),'userProfileId':_0x5681aa[_0x1cbe('0x6e')]},'raw':!![]})[_0x1cbe('0x1a')](function(_0x46d160){if(_0x46d160&&_0x46d160[_0x1cbe('0x5d')]===0x0){return db[_0x1cbe('0x31')][_0x1cbe('0x5e')]({'name':_0x4c7633[_0x1cbe('0x34')],'resourceId':_0x4c7633['id'],'type':_0x46d160['name'],'sectionId':_0x46d160['id']},{})[_0x1cbe('0x1a')](function(){return _0x5f0933;});}else{return _0x5f0933;}})[_0x1cbe('0x24')](function(_0x337a5c){logger['error'](_0x1cbe('0x5f'),_0x337a5c);throw _0x337a5c;});}return _0x5f0933;})[_0x1cbe('0x1a')](respondWithResult(_0x183f85,0xc9))['catch'](handleError(_0x183f85,null));};exports[_0x1cbe('0x2e')]=function(_0x1c70a6,_0x57863a,_0x4cbb2d){var _0x487e06;return db[_0x1cbe('0x4b')][_0x1cbe('0x52')]({'where':{'id':_0x1c70a6['params']['id']}})[_0x1cbe('0x1a')](handleEntityNotFound(_0x57863a,null))[_0x1cbe('0x1a')](saveUpdates(_0x1c70a6['body'],null))['then'](function(_0x193f61){if(_0x193f61){_0x487e06=_0x193f61;return db[_0x1cbe('0x4b')][_0x1cbe('0x60')]({'raw':!![]});}})[_0x1cbe('0x1a')](function(_0x17f8c7){if(_0x17f8c7){var _0x348bb5=fs['readFileSync'](path[_0x1cbe('0x62')](config[_0x1cbe('0x65')],'server/files/templates/trunk.ejs'),_0x1cbe('0x64'));var _0x20908e=fs[_0x1cbe('0x61')](path[_0x1cbe('0x62')](config[_0x1cbe('0x65')],_0x1cbe('0x66')),_0x1cbe('0x64'));var _0x43127b=ejs[_0x1cbe('0x67')](_0x348bb5,{'trunks':_0x17f8c7||[]});fs[_0x1cbe('0x68')](_0x1cbe('0x69'),_0x43127b);var _0x4637d9=ejs[_0x1cbe('0x67')](_0x20908e,{'trunks':_0x17f8c7||[]});fs[_0x1cbe('0x68')](_0x1cbe('0x6b'),_0x4637d9);return respondWithRpcPromise(_0x1cbe('0x6c'),_0x1cbe('0x2e'),{'module':_0x1cbe('0x6d')});}return null;})['then'](function(_0x1c94b0){if(_0x1c94b0){return _0x487e06;}})[_0x1cbe('0x1a')](respondWithResult(_0x57863a,null))['catch'](handleError(_0x57863a,null));};exports[_0x1cbe('0x2f')]=function(_0x754d53,_0x404a37,_0x472ee4){var _0x238a74;return db[_0x1cbe('0x4b')][_0x1cbe('0x52')]({'where':{'id':_0x754d53['params']['id']}})[_0x1cbe('0x1a')](handleEntityNotFound(_0x404a37,null))['then'](removeEntity(_0x404a37,null))[_0x1cbe('0x1a')](function(){return db[_0x1cbe('0x4b')][_0x1cbe('0x60')]({'raw':!![]});})[_0x1cbe('0x1a')](function(_0x5e7803){var _0x242d16=fs[_0x1cbe('0x61')](path[_0x1cbe('0x62')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x3dbdec=fs[_0x1cbe('0x61')](path[_0x1cbe('0x62')](config[_0x1cbe('0x65')],'server/files/templates/registry.ejs'),'utf8');var _0x271654=ejs[_0x1cbe('0x67')](_0x242d16,{'trunks':_0x5e7803});var _0x40e11d=ejs[_0x1cbe('0x67')](_0x3dbdec,{'trunks':_0x5e7803});fs[_0x1cbe('0x68')](_0x1cbe('0x69'),_0x271654);fs[_0x1cbe('0x68')]('/etc/asterisk/sip_xcally_registers.conf',_0x40e11d);return respondWithRpcPromise(_0x1cbe('0x6c'),_0x1cbe('0x2f'),{'module':_0x1cbe('0x6d')});})[_0x1cbe('0x24')](handleError(_0x404a37,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 8e05f51..9fd1667 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 _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 +var _0x3a0c=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./trunk.attributes','exports','define','tools_trunks'];(function(_0x2fceb0,_0x1c22db){var _0x4bb89f=function(_0x584e5c){while(--_0x584e5c){_0x2fceb0['push'](_0x2fceb0['shift']());}};_0x4bb89f(++_0x1c22db);}(_0x3a0c,0xf7));var _0xc3a0=function(_0x3848cf,_0x38d178){_0x3848cf=_0x3848cf-0x0;var _0x4ba819=_0x3a0c[_0x3848cf];return _0x4ba819;};'use strict';var _=require(_0xc3a0('0x0'));var util=require(_0xc3a0('0x1'));var logger=require(_0xc3a0('0x2'))(_0xc3a0('0x3'));var moment=require(_0xc3a0('0x4'));var BPromise=require(_0xc3a0('0x5'));var rp=require(_0xc3a0('0x6'));var fs=require('fs');var path=require(_0xc3a0('0x7'));var rimraf=require('rimraf');var config=require(_0xc3a0('0x8'));var attributes=require(_0xc3a0('0x9'));module[_0xc3a0('0xa')]=function(_0x5dfcc9,_0x5b8e9f){return _0x5dfcc9[_0xc3a0('0xb')]('Trunk',attributes,{'tableName':_0xc3a0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index c78b75a..db82fb5 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 _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 +var _0x1a85=['info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrunk','Trunk','options','raw','where','limit','include','model','map','attributes','then','ShowTrunk','find','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x1a85,0x178));var _0x51a8=function(_0x17ee38,_0x5bdff4){_0x17ee38=_0x17ee38-0x0;var _0x439a4e=_0x1a85[_0x17ee38];return _0x439a4e;};'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')]('Trunk,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});}exports[_0x51a8('0x13')]=function(_0x45a433){var _0xd52230=this;return new Promise(function(_0x23539e,_0x3bc1a2){return db[_0x51a8('0x14')]['findAll']({'raw':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x16')]===undefined?!![]:![]:!![],'where':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x17')]||null:null,'attributes':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')]['attributes']||null:null,'limit':_0x45a433[_0x51a8('0x15')]?_0x45a433['options'][_0x51a8('0x18')]||null:null,'include':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x19')]?_['map'](_0x45a433[_0x51a8('0x15')]['include'],function(_0x47f063){return{'model':db[_0x47f063[_0x51a8('0x1a')]],'as':_0x47f063['as'],'attributes':_0x47f063['attributes'],'include':_0x47f063[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x47f063[_0x51a8('0x19')],function(_0x18e2f3){return{'model':db[_0x18e2f3[_0x51a8('0x1a')]],'as':_0x18e2f3['as'],'attributes':_0x18e2f3[_0x51a8('0x1c')],'include':_0x18e2f3[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x18e2f3['include'],function(_0x273ce2){return{'model':db[_0x273ce2[_0x51a8('0x1a')]],'as':_0x273ce2['as'],'attributes':_0x273ce2[_0x51a8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x51a8('0x1d')](function(_0x1c150d){logger[_0x51a8('0x8')](_0x51a8('0x13'),_0x45a433);logger[_0x51a8('0xb')](_0x51a8('0x13'),_0x45a433,JSON[_0x51a8('0xd')](_0x1c150d));_0x23539e(_0x1c150d);})[_0x51a8('0x12')](function(_0x347a02){logger['error'](_0x51a8('0x13'),_0x347a02['message'],_0x45a433);_0x3bc1a2(_0xd52230[_0x51a8('0xe')](0x1f4,_0x347a02[_0x51a8('0x10')]));});});};exports[_0x51a8('0x1e')]=function(_0x41df56){var _0x2136b4=this;return new Promise(function(_0x4ea271,_0x10c19b){return db['Trunk'][_0x51a8('0x1f')]({'raw':_0x41df56[_0x51a8('0x15')]?_0x41df56[_0x51a8('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x41df56[_0x51a8('0x15')]?_0x41df56['options'][_0x51a8('0x17')]||null:null,'attributes':_0x41df56[_0x51a8('0x15')]?_0x41df56[_0x51a8('0x15')][_0x51a8('0x1c')]||null:null,'include':_0x41df56[_0x51a8('0x15')]?_0x41df56['options'][_0x51a8('0x19')]?_['map'](_0x41df56[_0x51a8('0x15')][_0x51a8('0x19')],function(_0x41561a){return{'model':db[_0x41561a['model']],'as':_0x41561a['as'],'attributes':_0x41561a[_0x51a8('0x1c')],'include':_0x41561a[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x41561a[_0x51a8('0x19')],function(_0x41c020){return{'model':db[_0x41c020['model']],'as':_0x41c020['as'],'attributes':_0x41c020['attributes'],'include':_0x41c020['include']?_[_0x51a8('0x1b')](_0x41c020[_0x51a8('0x19')],function(_0x4ec1db){return{'model':db[_0x4ec1db[_0x51a8('0x1a')]],'as':_0x4ec1db['as'],'attributes':_0x4ec1db['attributes']};}):[]};}):[]};}):[]:[]})[_0x51a8('0x1d')](function(_0x38aa25){logger[_0x51a8('0x8')](_0x51a8('0x1e'),_0x41df56);logger[_0x51a8('0xb')](_0x51a8('0x1e'),_0x41df56,JSON['stringify'](_0x38aa25));_0x4ea271(_0x38aa25);})['catch'](function(_0x377b4c){logger['error']('ShowTrunk',_0x377b4c['message'],_0x41df56);_0x10c19b(_0x2136b4[_0x51a8('0xe')](0x1f4,_0x377b4c[_0x51a8('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 9d28f6f..38f9efd 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 _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 +var _0x315a=['/:id/whatsapp_accounts','addWhatsappAccounts','/:id/square_projects','/:id/api_key','createApiKey','put','/:id','update','/:id/password','changePassword','removeQueues','delete','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','/describe','describe','/whoami','whoami','show','/:id/avatar','getAvatar','/:id/contacts','getContacts','/:id/queues','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getLists','/:id/agents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','/create_many','bulkCreate','addContacts','create','addQueues','diskStorage','join','root','format','%s-%s','now','originalname','file','/:id/login','login','/:id/logout','logout','pause','/:id/unpause','unpause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts'];(function(_0x4a07e7,_0x5c4062){var _0x18c27c=function(_0x3f6b15){while(--_0x3f6b15){_0x4a07e7['push'](_0x4a07e7['shift']());}};_0x18c27c(++_0x5c4062);}(_0x315a,0x90));var _0xa315=function(_0x4c94d1,_0x573a4f){_0x4c94d1=_0x4c94d1-0x0;var _0x48c2c3=_0x315a[_0x4c94d1];return _0x48c2c3;};'use strict';var multer=require(_0xa315('0x0'));var util=require(_0xa315('0x1'));var path=require(_0xa315('0x2'));var timeout=require(_0xa315('0x3'));var express=require('express');var router=express[_0xa315('0x4')]();var auth=require(_0xa315('0x5'));var interaction=require(_0xa315('0x6'));var config=require(_0xa315('0x7'));var controller=require(_0xa315('0x8'));router['get']('/',auth[_0xa315('0x9')](),controller[_0xa315('0xa')]);router[_0xa315('0xb')](_0xa315('0xc'),auth[_0xa315('0x9')](),controller[_0xa315('0xd')]);router['get'](_0xa315('0xe'),auth[_0xa315('0x9')](),controller[_0xa315('0xf')]);router[_0xa315('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xa315('0x10')]);router['get'](_0xa315('0x11'),controller[_0xa315('0x12')]);router['get'](_0xa315('0x13'),auth['isAuthenticated'](),controller[_0xa315('0x14')]);router[_0xa315('0xb')](_0xa315('0x15'),auth['isAuthenticated'](),controller['getQueues']);router[_0xa315('0xb')]('/:id/queues_rt',auth[_0xa315('0x9')](),controller['getVoiceQueuesRt']);router['get']('/:id/groups',auth['isAuthenticated'](),controller[_0xa315('0x16')]);router[_0xa315('0xb')](_0xa315('0x17'),auth[_0xa315('0x9')](),controller[_0xa315('0x18')]);router[_0xa315('0xb')](_0xa315('0x19'),auth[_0xa315('0x9')](),controller[_0xa315('0x1a')]);router[_0xa315('0xb')](_0xa315('0x1b'),auth['isAuthenticated'](),controller[_0xa315('0x1c')]);router[_0xa315('0xb')]('/:id/openchannel/interactions',auth[_0xa315('0x9')](),controller[_0xa315('0x1d')]);router['get'](_0xa315('0x1e'),auth['isAuthenticated'](),controller[_0xa315('0x1f')]);router[_0xa315('0xb')](_0xa315('0x20'),auth[_0xa315('0x9')](),controller[_0xa315('0x21')]);router[_0xa315('0xb')](_0xa315('0x22'),auth[_0xa315('0x9')](),controller[_0xa315('0x23')]);router[_0xa315('0xb')](_0xa315('0x24'),auth[_0xa315('0x9')](),controller[_0xa315('0x25')]);router[_0xa315('0xb')](_0xa315('0x26'),auth['isAuthenticated'](),controller['getTeams']);router['get']('/:id/lists',auth[_0xa315('0x9')](),controller[_0xa315('0x27')]);router[_0xa315('0xb')](_0xa315('0x28'),auth[_0xa315('0x9')](),controller['getAgents']);router[_0xa315('0xb')]('/:id/prefixes',auth[_0xa315('0x9')](),controller[_0xa315('0x29')]);router[_0xa315('0xb')](_0xa315('0x2a'),auth[_0xa315('0x9')](),controller[_0xa315('0x2b')]);router[_0xa315('0xb')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0xa315('0x2c')]);router[_0xa315('0xb')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router[_0xa315('0xb')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0xa315('0x2d')]);router[_0xa315('0xb')](_0xa315('0x2e'),auth[_0xa315('0x9')](),controller[_0xa315('0x2f')]);router[_0xa315('0xb')]('/:id/whatsapp_accounts',auth[_0xa315('0x9')](),controller[_0xa315('0x30')]);router[_0xa315('0xb')]('/:id/square_projects',auth[_0xa315('0x9')](),controller[_0xa315('0x31')]);router[_0xa315('0xb')](_0xa315('0x32'),auth[_0xa315('0x9')](),controller[_0xa315('0x33')]);router[_0xa315('0xb')]('/:id/api_key',auth['isAuthenticated'](),controller[_0xa315('0x34')]);router[_0xa315('0x35')](_0xa315('0x36'),auth[_0xa315('0x9')](),controller[_0xa315('0x37')]);router[_0xa315('0x35')]('/:id/contacts',auth[_0xa315('0x9')](),controller[_0xa315('0x38')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa315('0x39')]);router[_0xa315('0x35')](_0xa315('0x15'),auth[_0xa315('0x9')](),controller[_0xa315('0x3a')]);var upload=multer({'storage':multer[_0xa315('0x3b')]({'destination':function(_0x1833c9,_0x1e8aed,_0x1d7bf3){_0x1d7bf3(null,path[_0xa315('0x3c')](config[_0xa315('0x3d')],'server/files/images/'));},'filename':function(_0x33f335,_0x43ff69,_0x59bb23){_0x59bb23(null,util[_0xa315('0x3e')](_0xa315('0x3f'),Date[_0xa315('0x40')](),_0x43ff69[_0xa315('0x41')]));}})});router[_0xa315('0x35')](_0xa315('0x11'),upload['single'](_0xa315('0x42')),controller['addAvatar']);router[_0xa315('0x35')](_0xa315('0x43'),auth[_0xa315('0x9')](),controller[_0xa315('0x44')]);router[_0xa315('0x35')](_0xa315('0x45'),auth['isAuthenticated'](),controller[_0xa315('0x46')]);router['post']('/:id/pause',auth['isAuthenticated'](),controller[_0xa315('0x47')]);router['post'](_0xa315('0x48'),auth[_0xa315('0x9')](),controller[_0xa315('0x49')]);router[_0xa315('0x35')]('/:id/teams',auth[_0xa315('0x9')](),controller[_0xa315('0x4a')]);router[_0xa315('0x35')]('/:id/chat_interactions',auth[_0xa315('0x9')](),controller[_0xa315('0x4b')]);router[_0xa315('0x35')](_0xa315('0x4c'),auth[_0xa315('0x9')](),controller[_0xa315('0x4d')]);router[_0xa315('0x35')](_0xa315('0x4e'),auth[_0xa315('0x9')](),controller[_0xa315('0x4f')]);router[_0xa315('0x35')](_0xa315('0x50'),auth[_0xa315('0x9')](),controller[_0xa315('0x51')]);router[_0xa315('0x35')](_0xa315('0x52'),auth[_0xa315('0x9')](),controller[_0xa315('0x53')]);router[_0xa315('0x35')](_0xa315('0x54'),auth[_0xa315('0x9')](),controller[_0xa315('0x55')]);router[_0xa315('0x35')](_0xa315('0x2a'),auth[_0xa315('0x9')](),controller[_0xa315('0x56')]);router['post'](_0xa315('0x57'),auth[_0xa315('0x9')](),controller['addMailAccounts']);router[_0xa315('0x35')](_0xa315('0x58'),auth[_0xa315('0x9')](),controller[_0xa315('0x59')]);router[_0xa315('0x35')](_0xa315('0x5a'),auth['isAuthenticated'](),controller[_0xa315('0x5b')]);router[_0xa315('0x35')](_0xa315('0x2e'),auth['isAuthenticated'](),controller['addChatWebsites']);router[_0xa315('0x35')](_0xa315('0x5c'),auth['isAuthenticated'](),controller[_0xa315('0x5d')]);router['post'](_0xa315('0x5e'),auth[_0xa315('0x9')](),controller['addSquareProjects']);router['post'](_0xa315('0x5f'),auth[_0xa315('0x9')](),controller[_0xa315('0x60')]);router[_0xa315('0x61')](_0xa315('0x62'),auth['isAuthenticated'](),controller[_0xa315('0x63')]);router[_0xa315('0x61')](_0xa315('0x64'),auth[_0xa315('0x9')](),controller[_0xa315('0x65')]);router['delete'](_0xa315('0x15'),auth[_0xa315('0x9')](),controller[_0xa315('0x66')]);router[_0xa315('0x67')](_0xa315('0x26'),auth[_0xa315('0x9')](),controller[_0xa315('0x68')]);router[_0xa315('0x67')](_0xa315('0x62'),auth[_0xa315('0x9')](),controller[_0xa315('0x69')]);router['delete'](_0xa315('0x6a'),auth[_0xa315('0x9')](),controller[_0xa315('0x6b')]);router[_0xa315('0x67')](_0xa315('0x4c'),auth[_0xa315('0x9')](),controller['removeMailInteractions']);router[_0xa315('0x67')](_0xa315('0x4e'),auth[_0xa315('0x9')](),controller[_0xa315('0x6c')]);router[_0xa315('0x67')](_0xa315('0x50'),auth[_0xa315('0x9')](),controller[_0xa315('0x6d')]);router[_0xa315('0x67')](_0xa315('0x52'),auth['isAuthenticated'](),controller[_0xa315('0x6e')]);router[_0xa315('0x67')](_0xa315('0x54'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router[_0xa315('0x67')](_0xa315('0x2a'),auth[_0xa315('0x9')](),controller[_0xa315('0x6f')]);router[_0xa315('0x67')]('/:id/mail_accounts',auth[_0xa315('0x9')](),controller[_0xa315('0x70')]);router['delete'](_0xa315('0x58'),auth[_0xa315('0x9')](),controller[_0xa315('0x71')]);router[_0xa315('0x67')](_0xa315('0x5a'),auth[_0xa315('0x9')](),controller['removeSmsAccounts']);router['delete']('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xa315('0x72')]);router['delete'](_0xa315('0x5c'),auth[_0xa315('0x9')](),controller['removeWhatsappAccounts']);router['delete'](_0xa315('0x5e'),auth[_0xa315('0x9')](),controller[_0xa315('0x73')]);router[_0xa315('0x67')]('/:id/api_key',auth[_0xa315('0x9')](),controller[_0xa315('0x74')]);module[_0xa315('0x75')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index ef07af1..dbf8276 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 _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 +var _0xffa1=['outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','refuse','originate','uas','fingerprint','actpass','update,nonat','showWebBar','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','TEXT','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','lodash','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','INTEGER','accountcode','fullname','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','nonat','update'];(function(_0x19e696,_0x2055f6){var _0x4f8eb7=function(_0x45d895){while(--_0x45d895){_0x19e696['push'](_0x19e696['shift']());}};_0x4f8eb7(++_0x2055f6);}(_0xffa1,0xde));var _0x1ffa=function(_0x246c54,_0x52c8e6){_0x246c54=_0x246c54-0x0;var _0x5b0011=_0xffa1[_0x246c54];return _0x5b0011;};'use strict';var Sequelize=require(_0x1ffa('0x0'));var moment=require(_0x1ffa('0x1'));var util=require(_0x1ffa('0x2'));var _=require(_0x1ffa('0x3'));module['exports']={'name':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':![],'unique':_0x1ffa('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x7239bb){this[_0x1ffa('0x6')](_0x1ffa('0x5'),_0x7239bb);this['setDataValue'](_0x1ffa('0x7'),_0x7239bb);},'comment':_0x1ffa('0x8')},'fullname':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':![],'set':function(_0x4d2c26){this[_0x1ffa('0x6')]('fullname',_0x4d2c26);this['setDataValue'](_0x1ffa('0x9'),util[_0x1ffa('0xa')](_0x1ffa('0xb'),_0x4d2c26,this['getDataValue'](_0x1ffa('0xc'))));}},'alias':{'type':Sequelize[_0x1ffa('0x4')]},'email':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':![],'unique':_0x1ffa('0xd'),'validate':{'isEmail':!![]},'set':function(_0x3601e2){if(_0x3601e2){this[_0x1ffa('0x6')](_0x1ffa('0xd'),_0x3601e2[_0x1ffa('0xe')]());}}},'role':{'type':Sequelize[_0x1ffa('0xf')](_0x1ffa('0x10'),_0x1ffa('0x11'),_0x1ffa('0x12'),_0x1ffa('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x1ffa('0x4')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x1ffa('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x35ffcb){this[_0x1ffa('0x6')](_0x1ffa('0xc'),_0x35ffcb);this[_0x1ffa('0x6')](_0x1ffa('0x15'),_0x35ffcb);this['setDataValue'](_0x1ffa('0x9'),util[_0x1ffa('0xa')](_0x1ffa('0xb'),this['getDataValue'](_0x1ffa('0x16')),_0x35ffcb));}},'salt':{'type':Sequelize[_0x1ffa('0x4')]},'phone':{'type':Sequelize[_0x1ffa('0x4')]},'mobile':{'type':Sequelize[_0x1ffa('0x4')]},'address':{'type':Sequelize[_0x1ffa('0x4')]},'zipcode':{'type':Sequelize[_0x1ffa('0x4')]},'userpic':{'type':Sequelize[_0x1ffa('0x4')]},'city':{'type':Sequelize[_0x1ffa('0x4')]},'country':{'type':Sequelize[_0x1ffa('0x4')]},'online':{'type':Sequelize[_0x1ffa('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x1ffa('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x1ffa('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x1ffa('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x1ffa('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x1ffa('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x1ffa('0x4')],'defaultValue':_0x1ffa('0x18')},'lastPauseAt':{'type':Sequelize[_0x1ffa('0x19')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x1ffa('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1ffa('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x1ffa('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1ffa('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1ffa('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x1ffa('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x1ffa('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1ffa('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1ffa('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1ffa('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1ffa('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1ffa('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1ffa('0x1a')},'ipaddr':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x1ffa('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x1ffa('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1ffa('0xf')](_0x1ffa('0x1b'),_0x1ffa('0x11'),_0x1ffa('0x1c')),'allowNull':!![],'defaultValue':_0x1ffa('0x1b')},'context':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![],'defaultValue':_0x1ffa('0x1d')},'callingpres':{'type':Sequelize[_0x1ffa('0xf')](_0x1ffa('0x1e'),'ALLOWED_PASSED_SCREEN',_0x1ffa('0x1f'),_0x1ffa('0x20'),_0x1ffa('0x21'),_0x1ffa('0x22'),_0x1ffa('0x23'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![],'defaultValue':_0x1ffa('0x24'),'set':function(_0x1d39e2){this['setDataValue']('transport',_0x1d39e2?_0x1d39e2['join'](','):null);},'get':function(){return this[_0x1ffa('0x25')](_0x1ffa('0x26'))?this[_0x1ffa('0x25')](_0x1ffa('0x26'))[_0x1ffa('0x27')](','):null;},'comment':_0x1ffa('0x28')},'dtmfmode':{'type':Sequelize['ENUM'](_0x1ffa('0x29'),'info',_0x1ffa('0x2a'),_0x1ffa('0x2b'),_0x1ffa('0x2c')),'allowNull':!![],'defaultValue':_0x1ffa('0x29')},'directmedia':{'type':Sequelize['ENUM'](_0x1ffa('0x2d'),'no',_0x1ffa('0x2e'),_0x1ffa('0x2f'),_0x1ffa('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1ffa('0xf')](_0x1ffa('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![],'defaultValue':_0x1ffa('0x31'),'set':function(_0x24836f){this[_0x1ffa('0x6')](_0x1ffa('0x32'),_0x24836f?_0x24836f[_0x1ffa('0x33')](','):null);},'get':function(){return this[_0x1ffa('0x25')](_0x1ffa('0x32'))?this['getDataValue'](_0x1ffa('0x32'))[_0x1ffa('0x27')](','):null;},'comment':_0x1ffa('0x34')},'callgroup':{'type':Sequelize[_0x1ffa('0x4')]},'namedcallgroup':{'type':Sequelize[_0x1ffa('0x4')]},'pickupgroup':{'type':Sequelize[_0x1ffa('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x1ffa('0x4')]},'language':{'type':Sequelize[_0x1ffa('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1ffa('0x4')]},'disallow':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':![],'defaultValue':_0x1ffa('0x35')},'allow':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':![],'defaultValue':_0x1ffa('0x36'),'set':function(_0x340286){this['setDataValue'](_0x1ffa('0x37'),_0x340286?_0x340286[_0x1ffa('0x33')](';'):_0x1ffa('0x36'));},'get':function(){return this[_0x1ffa('0x25')](_0x1ffa('0x37'))?this[_0x1ffa('0x25')]('allow')[_0x1ffa('0x27')](';'):null;},'comment':_0x1ffa('0x38')},'autoframing':{'type':Sequelize[_0x1ffa('0xf')](_0x1ffa('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![],'set':function(_0x535fc1){this[_0x1ffa('0x6')]('insecure',_0x535fc1?_0x535fc1[_0x1ffa('0x33')](','):null);},'get':function(){return this[_0x1ffa('0x25')](_0x1ffa('0x39'))?this[_0x1ffa('0x25')]('insecure')[_0x1ffa('0x27')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x1ffa('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1ffa('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x1ffa('0xf')](_0x1ffa('0x2d'),'no',_0x1ffa('0x3a')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x1ffa('0xf')](_0x1ffa('0x2d'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1ffa('0xf')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x1ffa('0xf')](_0x1ffa('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x1ffa('0x2d')},'busylevel':{'type':Sequelize[_0x1ffa('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1ffa('0xf')](_0x1ffa('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x1ffa('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1ffa('0xf')](_0x1ffa('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1ffa('0xf')](_0x1ffa('0x2d'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1ffa('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x1ffa('0xf')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x1ffa('0xf')]('accept',_0x1ffa('0x3b'),_0x1ffa('0x3c')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x1ffa('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x1ffa('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1ffa('0xf')]('uac',_0x1ffa('0x3d')),'allowNull':!![],'defaultValue':_0x1ffa('0x3d')},'t38pt_usertpsource':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x1ffa('0xf')](_0x1ffa('0x2d'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x1ffa('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x1ffa('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1ffa('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1ffa('0xf')](_0x1ffa('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1ffa('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x1ffa('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x1ffa('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x1ffa('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x1ffa('0xf')](_0x1ffa('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1ffa('0xf')](_0x1ffa('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1ffa('0xf')](_0x1ffa('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x1ffa('0xf')](_0x1ffa('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x1ffa('0x2d'),'no',_0x1ffa('0x3e'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1ffa('0xf')]('active','passive',_0x1ffa('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1ffa('0xf')](_0x1ffa('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x1ffa('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x1ffa('0xf')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1ffa('0xf')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x1ffa('0xf')](_0x1ffa('0x2d'),'no',_0x1ffa('0x2e'),_0x1ffa('0x2f'),_0x1ffa('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x1ffa('0x19')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x566b55){this['setDataValue'](_0x1ffa('0x41'),_0x566b55);var _0x19c59d=this[_0x1ffa('0x42')]({'plain':!![]});switch(_0x566b55){case 0x0:case 0x1:var _0x24cb1c=_0x19c59d['transport']?_[_0x1ffa('0x43')](_0x19c59d[_0x1ffa('0x26')])?_0x19c59d['transport'][_0x1ffa('0x33')]():_0x19c59d[_0x1ffa('0x26')]:_0x1ffa('0x24');if(_0x24cb1c===_0x1ffa('0x44')){_0x24cb1c=_0x1ffa('0x24');}this['setDataValue']('transport',_0x24cb1c);this[_0x1ffa('0x6')](_0x1ffa('0x45'),'no');this[_0x1ffa('0x6')](_0x1ffa('0x46'),null);this[_0x1ffa('0x6')](_0x1ffa('0x47'),null);this[_0x1ffa('0x6')](_0x1ffa('0x48'),null);this[_0x1ffa('0x6')](_0x1ffa('0x49'),null);this['setDataValue'](_0x1ffa('0x4a'),null);this['setDataValue'](_0x1ffa('0x4b'),null);this['setDataValue'](_0x1ffa('0x4c'),null);this['setDataValue']('dtlsprivatekey',null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this[_0x1ffa('0x6')](_0x1ffa('0x26'),_0x1ffa('0x44'));this[_0x1ffa('0x6')](_0x1ffa('0x45'),_0x1ffa('0x2d'));this[_0x1ffa('0x6')](_0x1ffa('0x46'),'yes');this[_0x1ffa('0x6')]('force_avp',_0x1ffa('0x2d'));this['setDataValue']('icesupport',_0x1ffa('0x2d'));this[_0x1ffa('0x6')]('dtlsenable',_0x1ffa('0x2d'));this[_0x1ffa('0x6')]('dtlsverify','no');this[_0x1ffa('0x6')]('dtlssetup',_0x1ffa('0x3f'));this['setDataValue']('dtlscertfile',_0x19c59d[_0x1ffa('0x4c')]||_0x1ffa('0x4d'));this['setDataValue'](_0x1ffa('0x4e'),_0x19c59d['dtlsprivatekey']||_0x1ffa('0x4f'));this[_0x1ffa('0x6')]('rtcp_mux',_0x1ffa('0x2d'));break;default:}}},'permissions':{'type':Sequelize[_0x1ffa('0x50')],'set':function(_0x246e17){this[_0x1ffa('0x6')](_0x1ffa('0x51'),_0x246e17?_0x246e17[_0x1ffa('0x33')](','):[]);},'get':function(){return this['getDataValue'](_0x1ffa('0x51'))?_[_0x1ffa('0x52')](this[_0x1ffa('0x25')](_0x1ffa('0x51'))[_0x1ffa('0x27')](','),function(_0x27dd12){return parseInt(_0x27dd12,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x1ffa('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1ffa('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x1ffa('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1ffa('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1ffa('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x1ffa('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x1ffa('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x1ffa('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1ffa('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x1ffa('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1ffa('0xf')](_0x1ffa('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1ffa('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'passwordResetAt':{'type':Sequelize[_0x1ffa('0x19')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x1ffa('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x1ffa('0x25')](_0x1ffa('0x53'))?this['getDataValue'](_0x1ffa('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x1ffa('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x1ffa('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x1ffa('0x17')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1ffa('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x1ffa('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1ffa('0x17')],'defaultValue':![],'set':function(_0x1acedf){if(typeof _0x1acedf===_0x1ffa('0x54')){var _0x5eec0e=_0x1acedf==='1'?!![]:_0x1acedf==='0'?![]:_0x1acedf===_0x1ffa('0x55')?!![]:_0x1acedf==='false'?![]:![];this[_0x1ffa('0x6')](_0x1ffa('0x56'),_0x5eec0e);}else{this[_0x1ffa('0x6')](_0x1ffa('0x56'),_0x1acedf);}}},'blocked':{'type':Sequelize[_0x1ffa('0x17')],'defaultValue':![],'set':function(_0x146a54){this[_0x1ffa('0x6')](_0x1ffa('0x57'),_0x146a54);if(_0x146a54===!![]){this[_0x1ffa('0x6')](_0x1ffa('0x58'),moment());this[_0x1ffa('0x6')](_0x1ffa('0x59'),0x0);}else{this[_0x1ffa('0x6')](_0x1ffa('0x58'),null);}}},'blockedAt':{'type':Sequelize[_0x1ffa('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x1ffa('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1ffa('0x17')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 82913de..3dd8802 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 _0x9d68=['findOne','CmContact','CmList','List','Tag','tag','nolimit','getContacts','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','include','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','WhatsappInteraction','getWhatsappInteractions','login','phone','intrf','SIP/%s','user:%s','user:forcelogout','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','upsert','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','device','PAUSE','LOGININPAUSE','isMiddleware','resolve','logout','all','pause','QueuePause','DEFAULT\x20PAUSE','chatPause','faxPause','openchannelPause','whatsapppause','pauseType','lastPauseAt','unpause','manual','mail','sms','openchannel','%s%s','Pause','getTeams','Team','addTeams','getVoiceQueues','setDataValue','Voice','Chat','getMailQueues','Mail','Sms','getWhatsappQueues','Whatsapp','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','online','getDataValue','removeTeams','getSmsQueues','getFaxQueues','removeAgent','getLists','Agents','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','isArray','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','concat','$and','$or','$gt','$lt','$lte','$between','$notBetween','$in','$notIn','$like','$iLike','$notILike','$overlap','$contains','$contained','$any','lastName','Contact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyIat','API\x20key\x20not\x20available','whoami','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','register','client','http','test','Sequelize','ValidationError','request','then','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','save','update','destroy','Users','user','agent','Telephones','telephone','filter','map','value','find','name','UserProfileResource','stack','send','index','User','rawAttributes','fieldName','type','differenceBy','password','salt','keys','query','intersection','model','fields','attributes','hasOwnProperty','order','sort','filters','pick','merge','where','VIRTUAL','sequelize','lower','col','options','includeAll','findAll','rows','show','length','bulkCreate','body','role','describe','addContacts','params','ids','omit','admin','../../config/license/util','getLicense','telephones','isNil','License\x20limit\x20reached','format','count\x20%s:\x20%s','create','internal','findById','securePassword','min_internal','max','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','102','103','113','110','105','106','107','109','114','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','changePassword','oldPassword','newPassword','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','addQueues','channel','loginInPause','interface','isValidChannel','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','emit','Queue:save','VoiceQueue','push','voicePause','each','UserVoiceQueueRt','Unknown\x20channel','Queue:remove','voice','userpic','filename','getAvatar','root','server/files/images/logos/default_profile.png','download','existsSync','join','server/files/images/'];(function(_0x26d69e,_0x464484){var _0x54b3e9=function(_0x43bf15){while(--_0x43bf15){_0x26d69e['push'](_0x26d69e['shift']());}};_0x54b3e9(++_0x464484);}(_0x9d68,0xaf));var _0x89d6=function(_0x245545,_0x4983b3){_0x245545=_0x245545-0x0;var _0x106a5f=_0x9d68[_0x245545];return _0x106a5f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x89d6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x89d6('0x1'));var jsonpatch=require(_0x89d6('0x2'));var rp=require('request-promise');var moment=require(_0x89d6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x89d6('0x4'));var util=require(_0x89d6('0x5'));var path=require(_0x89d6('0x6'));var sox=require(_0x89d6('0x7'));var csv=require(_0x89d6('0x8'));var ejs=require(_0x89d6('0x9'));var fs=require('fs');var _=require(_0x89d6('0xa'));var squel=require(_0x89d6('0xb'));var crypto=require('crypto');var jsforce=require(_0x89d6('0xc'));var deskjs=require(_0x89d6('0xd'));var toCsv=require(_0x89d6('0x8'));var querystring=require(_0x89d6('0xe'));var Papa=require('papaparse');var Redis=require(_0x89d6('0xf'));var authService=require(_0x89d6('0x10'));var qs=require(_0x89d6('0x11'));var as=require(_0x89d6('0x12'));var hardwareService=require(_0x89d6('0x13'));var logger=require(_0x89d6('0x14'))(_0x89d6('0x15'));var utils=require(_0x89d6('0x16'));var config=require('../../config/environment');var db=require(_0x89d6('0x17'))['db'];config[_0x89d6('0x18')]=_[_0x89d6('0x19')](config[_0x89d6('0x18')],{'host':_0x89d6('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./user.socket')[_0x89d6('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x89d6('0x1c')][_0x89d6('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x13dd32,_0x15ad5b,_0x24beaf){if(_0x24beaf){var _0xd6bfcf=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xd6bfcf[_0x89d6('0x1e')](_0x15ad5b)){return _0x13dd32;}else{throw new db[(_0x89d6('0x1f'))][(_0x89d6('0x20'))]('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 _0x13dd32;}}function respondWithRpcPromise(_0x499e66,_0x285af4,_0x2a3e43,_0x549e2a){return new BPromise(function(_0x4f9039,_0x298ed6){var _0x18b999=_0x549e2a||client;return _0x18b999[_0x89d6('0x21')](_0x499e66,_0x2a3e43)[_0x89d6('0x22')](function(_0x3fc3fa){logger['info'](_0x89d6('0x23'),_0x285af4,_0x89d6('0x24'));logger['debug'](_0x89d6('0x25'),_0x285af4,_0x89d6('0x24'),JSON[_0x89d6('0x26')](_0x3fc3fa));if(_0x3fc3fa['error']){if(_0x3fc3fa[_0x89d6('0x27')][_0x89d6('0x28')]===0x1f4){logger[_0x89d6('0x27')](_0x89d6('0x23'),_0x285af4,_0x3fc3fa['error']['message']);return _0x298ed6(_0x3fc3fa[_0x89d6('0x27')][_0x89d6('0x29')]);}logger[_0x89d6('0x27')](_0x89d6('0x23'),_0x285af4,_0x3fc3fa['error'][_0x89d6('0x29')]);return _0x4f9039(_0x3fc3fa['error'][_0x89d6('0x29')]);}else{logger[_0x89d6('0x2a')](_0x89d6('0x23'),_0x285af4,'request\x20sent');_0x4f9039(_0x3fc3fa[_0x89d6('0x2b')]['message']);}})[_0x89d6('0x2c')](function(_0x5580ac){logger[_0x89d6('0x27')](_0x89d6('0x23'),_0x285af4,_0x5580ac);_0x298ed6(_0x5580ac);});});}function respondWithStatusCode(_0x22bb30,_0x416894){_0x416894=_0x416894||0xcc;return function(_0x3c07ad){if(_0x3c07ad){return _0x22bb30[_0x89d6('0x2d')](_0x416894);}return _0x22bb30[_0x89d6('0x2e')](_0x416894)[_0x89d6('0x2f')]();};}function respondWithResult(_0x5ac8b8,_0x42c5c5){_0x42c5c5=_0x42c5c5||0xc8;return function(_0x37ea21){if(_0x37ea21){return _0x5ac8b8[_0x89d6('0x2e')](_0x42c5c5)['json'](_0x37ea21);}};}function respondWithFilteredResult(_0x5a3e5a,_0x230f6b){return function(_0x787ec1){if(_0x787ec1){var _0x50fdcb=_0x787ec1[_0x89d6('0x30')],_0x2af3d8=_0x230f6b[_0x89d6('0x31')],_0x331f4d=_0x230f6b[_0x89d6('0x31')]+_0x230f6b[_0x89d6('0x32')],_0x347e8e;if(_0x331f4d>=_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')]=_0x272935){_0x155bc2=_0x272935;_0x2d7c22=0xc8;}else{_0x2d7c22=0xce;}_0x331ed1[_0x19bc('0x2e')](_0x2d7c22);return _0x331ed1[_0x19bc('0x32')](_0x19bc('0x33'),_0x8a3d24+'-'+_0x155bc2+'/'+_0x272935)[_0x19bc('0x34')](_0xc70408);}return null;};}function patchUpdates(_0x3860f0){return function(_0x11c501){try{jsonpatch[_0x19bc('0x35')](_0x11c501,_0x3860f0,!![]);}catch(_0x573b57){return BPromise['reject'](_0x573b57);}return _0x11c501[_0x19bc('0x36')]();};}function saveUpdates(_0x1451c1,_0x2373c8){return function(_0x374ead){if(_0x374ead){return _0x374ead[_0x19bc('0x37')](_0x1451c1)[_0x19bc('0x23')](function(_0x1accbc){return _0x1accbc;});}return null;};}function removeEntity(_0x43a937,_0x17cf20){return function(_0x400ae2){if(_0x400ae2){return _0x400ae2[_0x19bc('0x38')]()['then'](function(){var _0x501074=_0x400ae2[_0x19bc('0x39')]({'plain':!![]});var _0x2080af=[{'name':_0x19bc('0x3a'),'value':_0x19bc('0x3b'),'ignore':!![]},{'name':_0x19bc('0x3c'),'value':_0x19bc('0x3d'),'ignore':![]},{'name':_0x19bc('0x3e'),'value':_0x19bc('0x3f'),'ignore':![]}];var _0x472ed5=_(_0x2080af)[_0x19bc('0x40')](_0x19bc('0x41'))[_0x19bc('0x42')]('value')['value']();if(_[_0x19bc('0x43')](_0x472ed5,_0x501074[_0x19bc('0x44')])){return;}var _0x15eb18=_[_0x19bc('0x45')](_0x2080af,[_0x19bc('0x46'),_0x501074[_0x19bc('0x44')]])[_0x19bc('0x47')];return db[_0x19bc('0x48')][_0x19bc('0x38')]({'where':{'type':_0x15eb18,'resourceId':_0x501074['id']}})[_0x19bc('0x23')](function(){return _0x400ae2;});})[_0x19bc('0x23')](function(){_0x43a937['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46f51e,_0x44c991){return function(_0x1996d5){if(!_0x1996d5){_0x46f51e[_0x19bc('0x2d')](0x194);}return _0x1996d5;};}function handleError(_0xaa389,_0x61dd52){_0x61dd52=_0x61dd52||0x1f4;return function(_0x4f74fd){logger[_0x19bc('0x29')](_0x4f74fd[_0x19bc('0x49')]);if(_0x4f74fd[_0x19bc('0x47')]){delete _0x4f74fd[_0x19bc('0x47')];}_0xaa389[_0x19bc('0x2e')](_0x61dd52)[_0x19bc('0x4a')](_0x4f74fd);};}exports[_0x19bc('0x4b')]=function(_0x14cc76,_0x1781c0){var _0x25738e={},_0x56caa9={},_0x1adee4={'count':0x0,'rows':[]};var _0x33ed07=_['map'](db[_0x19bc('0x4c')][_0x19bc('0x4d')],function(_0x37677d){return{'name':_0x37677d[_0x19bc('0x4e')],'type':_0x37677d['type']['key']};});_0x56caa9[_0x19bc('0x4f')]=_['differenceBy'](_[_0x19bc('0x42')](_0x33ed07,_0x19bc('0x47')),['password',_0x19bc('0x50')]);_0x56caa9[_0x19bc('0x51')]=_[_0x19bc('0x52')](_0x14cc76[_0x19bc('0x51')]);_0x56caa9[_0x19bc('0x53')]=_['intersection'](_0x56caa9[_0x19bc('0x4f')],_0x56caa9[_0x19bc('0x51')]);_0x25738e[_0x19bc('0x54')]=_[_0x19bc('0x55')](_0x56caa9[_0x19bc('0x4f')],qs[_0x19bc('0x56')](_0x14cc76[_0x19bc('0x51')][_0x19bc('0x56')]));_0x25738e[_0x19bc('0x54')]=_0x25738e[_0x19bc('0x54')][_0x19bc('0x57')]?_0x25738e[_0x19bc('0x54')]:_0x56caa9['model'];if(!_0x14cc76[_0x19bc('0x51')][_0x19bc('0x58')](_0x19bc('0x59'))){_0x25738e[_0x19bc('0x31')]=qs['limit'](_0x14cc76['query'][_0x19bc('0x31')]);_0x25738e[_0x19bc('0x30')]=qs[_0x19bc('0x30')](_0x14cc76[_0x19bc('0x51')][_0x19bc('0x30')]);}_0x25738e[_0x19bc('0x5a')]=qs[_0x19bc('0x5b')](_0x14cc76[_0x19bc('0x51')]['sort']);_0x25738e[_0x19bc('0x5c')]=qs['filters'](_[_0x19bc('0x5d')](_0x14cc76[_0x19bc('0x51')],_0x56caa9[_0x19bc('0x53')]),_0x33ed07);if(_0x14cc76[_0x19bc('0x51')][_0x19bc('0x40')]){_0x25738e[_0x19bc('0x5c')]=_['merge'](_0x25738e[_0x19bc('0x5c')],{'$or':_[_0x19bc('0x42')](_0x33ed07,function(_0x597eb7){if(_0x597eb7['type']!==_0x19bc('0x5e')){return db[_0x19bc('0x5f')][_0x19bc('0x5c')](db[_0x19bc('0x5f')]['fn'](_0x19bc('0x60'),db['sequelize'][_0x19bc('0x61')](_0x597eb7[_0x19bc('0x47')])),{'$like':db[_0x19bc('0x5f')]['fn']('lower','%'+_0x14cc76[_0x19bc('0x51')][_0x19bc('0x40')]+'%')});}})});}_0x25738e=_['merge']({},_0x25738e,_0x14cc76[_0x19bc('0x62')]);var _0xb15d5f={'where':_0x25738e[_0x19bc('0x5c')]};return db[_0x19bc('0x4c')]['count'](_0xb15d5f)[_0x19bc('0x23')](function(_0x3cb8bb){_0x1adee4[_0x19bc('0x2f')]=_0x3cb8bb;if(_0x14cc76[_0x19bc('0x51')]['includeAll']){_0x25738e[_0x19bc('0x63')]=[{'all':!![]}];}return db[_0x19bc('0x4c')][_0x19bc('0x64')](_0x25738e);})[_0x19bc('0x23')](function(_0x4f294a){_0x1adee4[_0x19bc('0x65')]=_0x4f294a;return _0x1adee4;})[_0x19bc('0x23')](respondWithFilteredResult(_0x1781c0,_0x25738e))[_0x19bc('0x66')](handleError(_0x1781c0,null));};exports[_0x19bc('0x67')]=function(_0x566f97,_0x2e5a75){var _0x474208={'raw':![],'where':{'id':_0x566f97['params']['id']}},_0x5615a4={};_0x5615a4[_0x19bc('0x4f')]=_[_0x19bc('0x68')](_[_0x19bc('0x52')](db[_0x19bc('0x4c')][_0x19bc('0x4d')]),[_0x19bc('0x69'),_0x19bc('0x50')]);_0x5615a4[_0x19bc('0x51')]=_['keys'](_0x566f97[_0x19bc('0x51')]);_0x5615a4[_0x19bc('0x53')]=_[_0x19bc('0x55')](_0x5615a4['model'],_0x5615a4[_0x19bc('0x51')]);_0x474208['attributes']=_['intersection'](_0x5615a4[_0x19bc('0x4f')],qs['fields'](_0x566f97[_0x19bc('0x51')]['fields']));_0x474208[_0x19bc('0x54')]=_0x474208[_0x19bc('0x54')][_0x19bc('0x57')]?_0x474208[_0x19bc('0x54')]:_0x5615a4[_0x19bc('0x4f')];if(_0x566f97[_0x19bc('0x51')][_0x19bc('0x6a')]){_0x474208[_0x19bc('0x63')]=[{'all':!![]}];}_0x474208=_[_0x19bc('0x6b')]({},_0x474208,_0x566f97[_0x19bc('0x62')]);return db['User'][_0x19bc('0x45')](_0x474208)['then'](handleEntityNotFound(_0x2e5a75,null))[_0x19bc('0x23')](respondWithResult(_0x2e5a75,null))[_0x19bc('0x66')](handleError(_0x2e5a75,null));};exports[_0x19bc('0x6c')]=function(_0xb0f831,_0x3ca917){return db[_0x19bc('0x4c')]['bulkCreate'](_0xb0f831[_0x19bc('0x6d')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x3ca917,0xc9))[_0x19bc('0x66')](handleError(_0x3ca917,null));};exports[_0x19bc('0x37')]=function(_0x951f62,_0x593322){if(_0x951f62[_0x19bc('0x6d')]['id']){delete _0x951f62[_0x19bc('0x6d')]['id'];}delete _0x951f62[_0x19bc('0x6d')][_0x19bc('0x44')];return db[_0x19bc('0x4c')][_0x19bc('0x45')]({'where':{'id':_0x951f62['params']['id']}})[_0x19bc('0x23')](handleEntityNotFound(_0x593322,null))['then'](saveUpdates(_0x951f62[_0x19bc('0x6d')],null))[_0x19bc('0x23')](respondWithResult(_0x593322,null))[_0x19bc('0x66')](handleError(_0x593322,null));};exports[_0x19bc('0x6e')]=function(_0x686daf,_0x2e1eca){return db[_0x19bc('0x4c')][_0x19bc('0x6e')]()[_0x19bc('0x23')](respondWithResult(_0x2e1eca,null))[_0x19bc('0x66')](handleError(_0x2e1eca,null));};exports['addContacts']=function(_0x237488,_0x3c11c8,_0x33707d){return db[_0x19bc('0x4c')][_0x19bc('0x45')]({'where':{'id':_0x237488[_0x19bc('0x6f')]['id']}})[_0x19bc('0x23')](handleEntityNotFound(_0x3c11c8,null))[_0x19bc('0x23')](function(_0x68a933){if(_0x68a933){return _0x68a933[_0x19bc('0x70')](_0x237488[_0x19bc('0x6d')]['ids'],_['omit'](_0x237488['body'],[_0x19bc('0x71'),'id'])||{});}})[_0x19bc('0x23')](respondWithResult(_0x3c11c8,null))['catch'](handleError(_0x3c11c8,null));};var getLicense=function(_0x1a1fa7){return new BPromise(function(_0x25f5d2,_0x31bb42){var _0x1b4179=0x0;_0x1a1fa7['body']['role']==='agent'&&_0x25f5d2(_0x19bc('0x72'));return db[_0x19bc('0x4c')][_0x19bc('0x2f')]({'where':{'$or':[{'role':_0x1a1fa7[_0x19bc('0x6d')][_0x19bc('0x44')]===_0x19bc('0x3f')?_0x19bc('0x3f'):[_0x19bc('0x73'),_0x19bc('0x3b')]}]}})['then'](function(_0x3d6456){_0x1b4179=_0x3d6456;return require(_0x19bc('0x74'))['getLicense']();})['then'](function(_0x400356){var _0x5b6db0=_0x1a1fa7['body']['role']===_0x19bc('0x3f')?_0x19bc('0x75'):_0x19bc('0x76');if(!_[_0x19bc('0x77')](_0x400356[_0x5b6db0])&&_0x1b4179>=_0x400356[_0x5b6db0]){return _0x31bb42({'message':'License\x20limit\x20reached'});}return _0x25f5d2(util[_0x19bc('0x78')](_0x19bc('0x79'),_0x5b6db0,_0x1b4179));})['catch'](function(_0x23a53c){return _0x31bb42(_0x23a53c);});});};exports[_0x19bc('0x7a')]=function(_0x13dfcd,_0x193ccf){return getLicense(_0x13dfcd)[_0x19bc('0x23')](function(_0x17e65a){if(!_0x13dfcd[_0x19bc('0x6d')][_0x19bc('0x7b')]){var _0x11495b;return db[_0x19bc('0x7c')][_0x19bc('0x7d')](0x1)[_0x19bc('0x23')](function(_0x12dd84){return checkPasswordPattern(_0x12dd84,_0x13dfcd[_0x19bc('0x6d')]['password'],_0x12dd84[_0x19bc('0x7e')]);})['then'](function(_0x19086e){_0x11495b=_0x19086e[_0x19bc('0x7f')];return db[_0x19bc('0x4c')][_0x19bc('0x80')]('internal');})[_0x19bc('0x23')](function(_0x234735){if(_['isNil'](_0x234735)){if(_0x11495b){_0x13dfcd['body']['internal']=_0x11495b;}else{_0x13dfcd[_0x19bc('0x6d')]['internal']=0x1;}}else{if(_[_0x19bc('0x77')](_0x11495b)||_0x11495b==_0x234735){_0x13dfcd[_0x19bc('0x6d')]['internal']=_0x234735+0x1;}else if(_0x11495b>_0x234735){_0x13dfcd['body'][_0x19bc('0x7b')]=_0x11495b;}else{return db[_0x19bc('0x5f')][_0x19bc('0x51')](_0x19bc('0x81'),{'type':db[_0x19bc('0x5f')]['QueryTypes']['SELECT']})[_0x19bc('0x23')](function(_0x12ca92){if(_0x12ca92&&_0x12ca92[_0x19bc('0x57')]){for(var _0x3feb53=0x0,_0x13d751=_0x12ca92['length'];_0x3feb53<_0x13d751&&_[_0x19bc('0x77')](_0x13dfcd[_0x19bc('0x6d')][_0x19bc('0x7b')]);_0x3feb53++){if(_0x11495b<=_0x12ca92[_0x3feb53][_0x19bc('0x82')]){_0x13dfcd[_0x19bc('0x6d')][_0x19bc('0x7b')]=_0x12ca92[_0x3feb53][_0x19bc('0x82')];}else if(_0x11495b>_0x12ca92[_0x3feb53][_0x19bc('0x82')]&&_0x11495b<=_0x12ca92[_0x3feb53]['to']){_0x13dfcd['body']['internal']=_0x11495b;}}}if(_[_0x19bc('0x77')](_0x13dfcd[_0x19bc('0x6d')][_0x19bc('0x7b')])){_0x13dfcd['body']['internal']=_0x234735+0x1;}});}}});}})[_0x19bc('0x23')](function(){if(_0x13dfcd[_0x19bc('0x6d')][_0x19bc('0x83')]){_0x13dfcd[_0x19bc('0x6d')]['mailbox']=_0x13dfcd[_0x19bc('0x6d')][_0x19bc('0x7b')];_0x13dfcd['body'][_0x19bc('0x84')]={'mailbox':_0x13dfcd[_0x19bc('0x6d')]['internal'],'password':_0x13dfcd['body']['password'],'fullname':_0x13dfcd['body'][_0x19bc('0x85')],'email':_0x13dfcd[_0x19bc('0x6d')][_0x19bc('0x86')]};}if(_0x13dfcd[_0x19bc('0x6d')]&&_0x13dfcd[_0x19bc('0x6d')][_0x19bc('0x44')]===_0x19bc('0x3d')){if(!_0x13dfcd[_0x19bc('0x6d')][_0x19bc('0x87')]){_0x13dfcd[_0x19bc('0x6d')][_0x19bc('0x87')]=[_0x19bc('0x88'),_0x19bc('0x89'),_0x19bc('0x8a'),_0x19bc('0x8b'),_0x19bc('0x8c'),'104','105',_0x19bc('0x8d'),'107',_0x19bc('0x8e'),'109',_0x19bc('0x8f'),'111',_0x19bc('0x90')];}}return db[_0x19bc('0x4c')]['create'](_0x13dfcd[_0x19bc('0x6d')],{'include':[{'model':db[_0x19bc('0x84')],'as':_0x19bc('0x84')}]});})['then'](function(_0x2a2931){if(_0x13dfcd[_0x19bc('0x6d')][_0x19bc('0x44')]===_0x19bc('0x3b'))return _0x2a2931;var _0x542661=_0x13dfcd[_0x19bc('0x3b')][_0x19bc('0x39')]({'plain':!![]});if(!_0x542661)throw new Error(_0x19bc('0x91'));if(_0x542661['role']===_0x19bc('0x3b')){var _0xc7b45a=_0x2a2931['get']({'plain':!![]});var _0x52cc00=[{'name':_0x19bc('0x3c'),'value':'agent'},{'name':_0x19bc('0x3e'),'value':'telephone'}];var _0x4e20b4=_[_0x19bc('0x45')](_0x52cc00,[_0x19bc('0x46'),_0xc7b45a[_0x19bc('0x44')]])['name'];return db[_0x19bc('0x92')][_0x19bc('0x45')]({'where':{'name':_0x4e20b4,'userProfileId':_0x542661['userProfileId']},'raw':!![]})[_0x19bc('0x23')](function(_0x30ed9a){if(_0x30ed9a&&_0x30ed9a[_0x19bc('0x93')]===0x0){return db['UserProfileResource'][_0x19bc('0x7a')]({'name':_0xc7b45a['name'],'resourceId':_0xc7b45a['id'],'type':_0x30ed9a[_0x19bc('0x47')],'sectionId':_0x30ed9a['id']},{})['then'](function(){return _0x2a2931;});}else{return _0x2a2931;}})['catch'](function(_0x43fb3c){logger[_0x19bc('0x29')](_0x19bc('0x94'),_0x43fb3c);throw _0x43fb3c;});}return _0x2a2931;})['then'](respondWithResult(_0x193ccf,0xc9))[_0x19bc('0x66')](handleError(_0x193ccf,null));};exports['changePassword']=function(_0xc0a0d0,_0x3e77ac,_0x2db380){var _0x369348=![];if(_0xc0a0d0['body']['id']){delete _0xc0a0d0[_0x19bc('0x6d')]['id'];}return db[_0x19bc('0x7c')]['findOne']({'attributes':['id',_0x19bc('0x7e')]})[_0x19bc('0x23')](function(_0x103935){_0x369348=_0x103935[_0x19bc('0x7e')];return db[_0x19bc('0x4c')][_0x19bc('0x45')]({'where':{'id':_0xc0a0d0[_0x19bc('0x6f')]['id']}});})[_0x19bc('0x23')](function(_0x2454d4){if(_0x2454d4){if(_0x2454d4['id']==_0xc0a0d0[_0x19bc('0x3b')]['id']){if(!_0xc0a0d0['body']['oldPassword']||!_0xc0a0d0[_0x19bc('0x6d')][_0x19bc('0x95')]){throw new db['Sequelize'][(_0x19bc('0x96'))](_0x19bc('0x97'));}if(!_0x2454d4[_0x19bc('0x98')](_0xc0a0d0[_0x19bc('0x6d')]['oldPassword'])){throw new db[(_0x19bc('0x21'))][(_0x19bc('0x96'))](_0x19bc('0x99'));}if(_0xc0a0d0[_0x19bc('0x6d')][_0x19bc('0x9a')]==_0xc0a0d0['body']['newPassword']){throw new db['Sequelize'][(_0x19bc('0x96'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}return _0x2454d4;}else if(_0xc0a0d0[_0x19bc('0x3b')]['role']=='admin'){if(!_0xc0a0d0['body'][_0x19bc('0x95')]){throw new db[(_0x19bc('0x21'))][(_0x19bc('0x96'))](_0x19bc('0x9b'));}return _0x2454d4;}else if(_0xc0a0d0[_0x19bc('0x3b')][_0x19bc('0x44')]==_0x19bc('0x3b')){if(!_0xc0a0d0[_0x19bc('0x6d')]['newPassword']){throw new db[(_0x19bc('0x21'))][(_0x19bc('0x96'))](_0x19bc('0x9b'));}if(_0x2454d4[_0x19bc('0x44')]!='agent'){throw new db[(_0x19bc('0x21'))][(_0x19bc('0x96'))]('Unauthorized');}return _0x2454d4;}else{throw new db[(_0x19bc('0x21'))][(_0x19bc('0x96'))](_0x19bc('0x9c'));}}return null;})[_0x19bc('0x23')](handleEntityNotFound(_0x3e77ac,null))[_0x19bc('0x23')](function(_0x4865a4){return checkPasswordPattern(_0x4865a4,_0xc0a0d0['body'][_0x19bc('0x95')],_0x369348);})[_0x19bc('0x23')](saveUpdates({'password':_0xc0a0d0[_0x19bc('0x6d')][_0x19bc('0x95')],'passwordResetAt':_0xc0a0d0[_0x19bc('0x3b')]['id']==_0xc0a0d0[_0x19bc('0x6f')]['id']?moment():null},null))['then'](respondWithResult(_0x3e77ac,null))[_0x19bc('0x66')](handleError(_0x3e77ac,null));};exports[_0x19bc('0x9d')]=function(_0x4c847f,_0x3a4b46,_0x353a5a){var _0x5eea5a=_0x4c847f[_0x19bc('0x6d')]['channel'];return db['User'][_0x19bc('0x45')]({'where':{'id':_0x4c847f['params']['id']},'attributes':['id','name',_0x19bc('0x44'),_0x19bc('0x9e'),_0x19bc('0x9f'),_0x19bc('0xa0'),_0x19bc('0xa1')]})[_0x19bc('0x23')](handleEntityNotFound(_0x3a4b46,null))[_0x19bc('0x23')](function(_0x4795b6){if(_0x4795b6){if(!utils[_0x19bc('0xa2')](_0x5eea5a)){throw new db['Sequelize'][(_0x19bc('0x96'))]('Unknown\x20channel');}return _0x4795b6[_0x19bc('0xa3')+_['capitalize'](_0x5eea5a[_0x19bc('0xa4')]())+'Queues'](_0x4c847f[_0x19bc('0x6d')][_0x19bc('0x71')],{'penalty':_0x4c847f['body'][_0x19bc('0xa5')]||0x0})['spread'](function(_0x3b6e8d){for(var _0x22cd5b=0x0;_0x22cd5b<_0x4c847f[_0x19bc('0x6d')]['ids'][_0x19bc('0x57')];_0x22cd5b+=0x1){var _0x24e259={'UserId':_0x4c847f[_0x19bc('0x6f')]['id']};_0x24e259[_[_0x19bc('0xa6')](_0x5eea5a[_0x19bc('0xa4')]())+'QueueId']=_0x4c847f[_0x19bc('0x6d')][_0x19bc('0x71')][_0x22cd5b];socket[_0x19bc('0xa7')](_0x19bc('0x3b')+_[_0x19bc('0xa6')](_0x5eea5a[_0x19bc('0xa4')]())+_0x19bc('0xa8'),_0x24e259);}return _0x3b6e8d;})[_0x19bc('0x23')](function(){if(_0x5eea5a===_0x19bc('0xa9')){return db[_0x19bc('0xaa')]['findAll']({'where':{'id':_0x4c847f['body']['ids']||[]},'raw':!![],'attributes':['id',_0x19bc('0x47')]});}})[_0x19bc('0x23')](function(_0x4c9170){var _0x2251db=_0x4795b6['get']({'plain':!![]});var _0x319a8d=[];if(_0x5eea5a===_0x19bc('0xa9')&&_0x2251db[_0x19bc('0x44')]===_0x19bc('0x3d')&&_0x2251db[_0x19bc('0x9e')]){for(var _0xf9d241=0x0;_0xf9d241<_0x4c9170[_0x19bc('0x57')];_0xf9d241+=0x1){_0x319a8d[_0x19bc('0xab')]({'membername':_0x2251db[_0x19bc('0x47')],'UserId':_0x2251db['id'],'queue_name':_0x4c9170[_0xf9d241][_0x19bc('0x47')],'VoiceQueueId':_0x4c9170[_0xf9d241]['id'],'interface':_[_0x19bc('0x77')](_0x2251db[_0x19bc('0xa1')])?util['format']('SIP/%s',_0x2251db[_0x19bc('0x47')]):_0x2251db[_0x19bc('0xa1')],'paused':_0x2251db[_0x19bc('0xa0')]||![],'penalty':_0x4c847f[_0x19bc('0x6d')][_0x19bc('0xa5')]||0x0});}return BPromise[_0x19bc('0xac')](_0x319a8d,function(_0x477020){return db['UserVoiceQueueRt'][_0x19bc('0xad')](_0x477020);});}return _0x4795b6;});}})[_0x19bc('0x23')](respondWithStatusCode(_0x3a4b46,null))[_0x19bc('0x66')](handleError(_0x3a4b46,null));};exports[_0x19bc('0xae')]=function(_0x5bbb06,_0x268ab5,_0x31771c){var _0x3c8342;return db[_0x19bc('0x4c')][_0x19bc('0x45')]({'where':{'id':_0x5bbb06[_0x19bc('0x6f')]['id']},'attributes':['id',_0x19bc('0x47'),_0x19bc('0x44')]})['then'](handleEntityNotFound(_0x268ab5,null))[_0x19bc('0x23')](function(_0x2b3ae0){if(_0x2b3ae0){_0x3c8342=_0x2b3ae0;if(!_0x5bbb06['query'][_0x19bc('0xaf')]||!utils['isValidChannel'](_0x5bbb06[_0x19bc('0x51')][_0x19bc('0xaf')])){throw new db[(_0x19bc('0x21'))][(_0x19bc('0x96'))](_0x19bc('0xb0'));}return _0x2b3ae0[_0x19bc('0xb1')+_[_0x19bc('0xa6')](_0x5bbb06[_0x19bc('0x51')]['channel']['toLowerCase']())+_0x19bc('0xb2')](_0x5bbb06[_0x19bc('0x51')]['ids']);}})[_0x19bc('0x23')](function(_0x40b6ac){for(var _0x2fc823=0x0;_0x2fc823<_0x5bbb06[_0x19bc('0x51')][_0x19bc('0x71')][_0x19bc('0x57')];_0x2fc823+=0x1){var _0x387b43={'UserId':_0x5bbb06['params']['id']};_0x387b43[_[_0x19bc('0xa6')](_0x5bbb06[_0x19bc('0x51')]['channel']['toLowerCase']())+_0x19bc('0xb3')]=_0x5bbb06[_0x19bc('0x51')][_0x19bc('0x71')][_0x2fc823];socket[_0x19bc('0xa7')]('user'+_[_0x19bc('0xa6')](_0x5bbb06['query'][_0x19bc('0xaf')][_0x19bc('0xa4')]())+'Queue:remove',_0x387b43);}return _0x40b6ac;})[_0x19bc('0x23')](function(){if(_0x5bbb06[_0x19bc('0x51')][_0x19bc('0xaf')]===_0x19bc('0xa9')){return db[_0x19bc('0xb4')]['destroy']({'where':{'UserId':_0x5bbb06[_0x19bc('0x6f')]['id'],'VoiceQueueId':_0x5bbb06['query'][_0x19bc('0x71')]},'individualHooks':!![]})[_0x19bc('0x23')](function(){return _0x3c8342;});}return _0x3c8342;})[_0x19bc('0x23')](respondWithStatusCode(_0x268ab5,null))[_0x19bc('0x66')](handleError(_0x268ab5,null));};exports[_0x19bc('0xb5')]=function(_0x18c65b,_0x123aa9,_0x2122a9){_0x18c65b[_0x19bc('0x6d')][_0x19bc('0xb6')]=_0x18c65b[_0x19bc('0xb7')][_0x19bc('0xb8')];return db['User']['find']({'where':{'id':_0x18c65b[_0x19bc('0x6f')]['id']}})[_0x19bc('0x23')](handleEntityNotFound(_0x123aa9,null))[_0x19bc('0x23')](saveUpdates(_0x18c65b[_0x19bc('0x6d')],null))[_0x19bc('0x23')](respondWithResult(_0x123aa9,null))[_0x19bc('0x66')](handleError(_0x123aa9,null));};exports['getAvatar']=function(_0x135c1b,_0x45340a,_0x852144){var _0x4a0eaf=path[_0x19bc('0xb9')](config[_0x19bc('0xba')],_0x19bc('0xbb'));return db[_0x19bc('0x4c')][_0x19bc('0x45')]({'where':{'id':_0x135c1b[_0x19bc('0x6f')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x19bc('0x23')](handleEntityNotFound(_0x45340a,null))[_0x19bc('0x23')](function(_0x1b6370){if(_0x1b6370){if(_[_0x19bc('0x77')](_0x1b6370['userpic'])){return _0x45340a[_0x19bc('0xbc')](_0x4a0eaf);}else{if(!fs[_0x19bc('0xbd')](path[_0x19bc('0xb9')](config['root'],_0x19bc('0xbe'),_0x1b6370[_0x19bc('0xb6')]))){return _0x45340a[_0x19bc('0xbc')](_0x4a0eaf);}return _0x45340a[_0x19bc('0xbc')](path['join'](config[_0x19bc('0xba')],_0x19bc('0xbe'),_0x1b6370[_0x19bc('0xb6')]));}}})['catch'](handleError(_0x45340a,null));};exports['getContacts']=function(_0x5e3b51,_0x35c463,_0x37b4ca){var _0x202704={};var _0x28efcb={};var _0x475b43;var _0x181361;return db[_0x19bc('0x4c')][_0x19bc('0xbf')]({'where':{'id':_0x5e3b51[_0x19bc('0x6f')]['id']}})['then'](handleEntityNotFound(_0x35c463,null))[_0x19bc('0x23')](function(_0x307604){if(_0x307604){_0x475b43=_0x307604;_0x28efcb[_0x19bc('0x4f')]=_[_0x19bc('0x52')](db['CmContact'][_0x19bc('0x4d')]);_0x28efcb[_0x19bc('0x51')]=_[_0x19bc('0x52')](_0x5e3b51[_0x19bc('0x51')]);_0x28efcb[_0x19bc('0x53')]=_['intersection'](_0x28efcb[_0x19bc('0x4f')],_0x28efcb[_0x19bc('0x51')]);_0x202704[_0x19bc('0x54')]=_[_0x19bc('0x55')](_0x28efcb['model'],qs['fields'](_0x5e3b51[_0x19bc('0x51')][_0x19bc('0x56')]));_0x202704[_0x19bc('0x54')]=_0x202704[_0x19bc('0x54')][_0x19bc('0x57')]?_0x202704[_0x19bc('0x54')]:_0x28efcb[_0x19bc('0x4f')];_0x202704[_0x19bc('0x5a')]=qs[_0x19bc('0x5b')](_0x5e3b51[_0x19bc('0x51')]['sort']);_0x202704[_0x19bc('0x5c')]=qs[_0x19bc('0x53')](_['pick'](_0x5e3b51[_0x19bc('0x51')],_0x28efcb[_0x19bc('0x53')]));if(_0x5e3b51[_0x19bc('0x51')]['filter']){_0x202704[_0x19bc('0x5c')]=_[_0x19bc('0x6b')](_0x202704[_0x19bc('0x5c')],{'$or':_['map'](_0x202704[_0x19bc('0x54')],function(_0x4d0eec){var _0x6ada92={};_0x6ada92[_0x4d0eec]={'$like':'%'+_0x5e3b51[_0x19bc('0x51')][_0x19bc('0x40')]+'%'};return _0x6ada92;})});}_0x202704=_[_0x19bc('0x6b')]({},_0x202704,_0x5e3b51[_0x19bc('0x62')]);return _0x475b43[_0x19bc('0xc0')](_0x202704);}})[_0x19bc('0x23')](function(_0x2e2889){if(_0x2e2889){_0x181361=_0x2e2889[_0x19bc('0x57')];if(_0x5e3b51[_0x19bc('0x51')][_0x19bc('0x58')]('includeAll')){_0x202704[_0x19bc('0x63')]=[{'model':db[_0x19bc('0xc1')],'as':_0x19bc('0xc2'),'required':![]},{'model':db[_0x19bc('0xc3')],'as':_0x19bc('0xc4'),'attributes':['id',_0x19bc('0x47'),'color'],'where':_0x5e3b51[_0x19bc('0x51')][_0x19bc('0xc5')]?{'id':_0x5e3b51['query']['tag']}:undefined,'required':_0x5e3b51['query'][_0x19bc('0xc5')]?!![]:![]}];}if(!_0x5e3b51[_0x19bc('0x51')][_0x19bc('0x58')](_0x19bc('0x59'))){_0x202704[_0x19bc('0x31')]=qs['limit'](_0x5e3b51[_0x19bc('0x51')]['limit']);_0x202704[_0x19bc('0x30')]=qs[_0x19bc('0x30')](_0x5e3b51[_0x19bc('0x51')][_0x19bc('0x30')]);}return _0x475b43[_0x19bc('0xc0')](_0x202704);}})['then'](function(_0x828803){if(_0x828803){return _0x828803?{'count':_0x181361,'rows':_0x828803}:null;}})[_0x19bc('0x23')](respondWithResult(_0x35c463,null))[_0x19bc('0x66')](handleError(_0x35c463,null));};exports[_0x19bc('0xc6')]=function(_0xba8380,_0x588b48,_0x1fc042){var _0x414d84;var _0x366c41;var _0x2cc89f={};var _0x3484f6;return db[_0x19bc('0x4c')][_0x19bc('0xbf')]({'where':{'id':_0xba8380[_0x19bc('0x6f')]['id']},'attributes':['id',_0x19bc('0x47'),_0x19bc('0x44')]})[_0x19bc('0x23')](handleEntityNotFound(_0x588b48,null))[_0x19bc('0x23')](function(_0x56d148){if(!utils[_0x19bc('0xa2')](_0xba8380['query'][_0x19bc('0xaf')])){throw new db[(_0x19bc('0x21'))]['ValidationError'](_0x19bc('0xb0'));}_0x414d84=_0x56d148;var _0x396823={};_0x396823['model']=_[_0x19bc('0x52')](db[_[_0x19bc('0xa6')](_0xba8380[_0x19bc('0x51')][_0x19bc('0xaf')])+'Queue'][_0x19bc('0x4d')]);_0x396823[_0x19bc('0x51')]=_[_0x19bc('0x52')](_0xba8380[_0x19bc('0x51')]);_0x396823['filters']=_[_0x19bc('0x55')](_0x396823[_0x19bc('0x4f')],_0x396823['query']);_0x2cc89f[_0x19bc('0x54')]=_[_0x19bc('0x55')](_0x396823['model'],qs['fields'](_0xba8380['query'][_0x19bc('0x56')]));_0x2cc89f['attributes']=_0x2cc89f['attributes'][_0x19bc('0x57')]?_0x2cc89f[_0x19bc('0x54')]:_0x396823['model'];_0x2cc89f[_0x19bc('0x5a')]=qs[_0x19bc('0x5b')](_0xba8380['query'][_0x19bc('0x5b')]);_0x2cc89f[_0x19bc('0x5c')]=qs['filters'](_[_0x19bc('0x5d')](_0xba8380[_0x19bc('0x51')],_0x396823[_0x19bc('0x53')]));if(_0xba8380['query'][_0x19bc('0x40')]){_0x2cc89f[_0x19bc('0x5c')]=_[_0x19bc('0x6b')](_0x2cc89f[_0x19bc('0x5c')],{'$or':_[_0x19bc('0x42')](_0x2cc89f[_0x19bc('0x54')],function(_0x187181){var _0x3b8e8c={};_0x3b8e8c[_0x187181]={'$like':'%'+_0xba8380[_0x19bc('0x51')]['filter']+'%'};return _0x3b8e8c;})});}_0x2cc89f=_['merge']({},_0x2cc89f,_0xba8380[_0x19bc('0x62')]);switch(_0x414d84[_0x19bc('0x44')]){case'admin':return db[_['capitalize'](_0xba8380[_0x19bc('0x51')]['channel'])+_0x19bc('0xc7')][_0x19bc('0x64')](_0x2cc89f);case _0x19bc('0x3b'):case _0x19bc('0x3d'):return _0x414d84[_0x19bc('0x39')+_[_0x19bc('0xa6')](_0xba8380[_0x19bc('0x51')]['channel'])+_0x19bc('0xb2')](_0x2cc89f);default:throw new db[(_0x19bc('0x21'))]['ValidationError'](_0x19bc('0xc8'));}})[_0x19bc('0x23')](function(_0x46d315){_0x3484f6=_0x46d315[_0x19bc('0x57')];if(!_0xba8380[_0x19bc('0x51')][_0x19bc('0x58')](_0x19bc('0x59'))){_0x2cc89f[_0x19bc('0x31')]=qs[_0x19bc('0x31')](_0xba8380[_0x19bc('0x51')][_0x19bc('0x31')]);_0x2cc89f['offset']=qs[_0x19bc('0x30')](_0xba8380[_0x19bc('0x51')][_0x19bc('0x30')]);}switch(_0x414d84[_0x19bc('0x44')]){case _0x19bc('0x73'):return db[_[_0x19bc('0xa6')](_0xba8380['query']['channel'])+'Queue'][_0x19bc('0x64')](_0x2cc89f);case _0x19bc('0x3b'):case _0x19bc('0x3d'):return _0x414d84[_0x19bc('0x39')+_[_0x19bc('0xa6')](_0xba8380[_0x19bc('0x51')][_0x19bc('0xaf')])+_0x19bc('0xb2')](_0x2cc89f);}})['then'](function(_0x254f2c){return{'count':_0x3484f6,'rows':_0x254f2c};})[_0x19bc('0x23')](respondWithResult(_0x588b48,null))[_0x19bc('0x66')](handleError(_0x588b48,null));};exports['getVoiceQueuesRt']=function(_0x5979cf,_0x138f37,_0x3d7802){var _0x216697={};var _0x4daffd={};var _0x880a9e;var _0x1ab877;return db[_0x19bc('0x4c')][_0x19bc('0xbf')]({'where':{'id':_0x5979cf[_0x19bc('0x6f')]['id']}})[_0x19bc('0x23')](handleEntityNotFound(_0x138f37,null))[_0x19bc('0x23')](function(_0x2d3803){if(_0x2d3803){_0x880a9e=_0x2d3803;_0x4daffd[_0x19bc('0x4f')]=_[_0x19bc('0x52')](db[_0x19bc('0xb4')][_0x19bc('0x4d')]);_0x4daffd[_0x19bc('0x51')]=_[_0x19bc('0x52')](_0x5979cf[_0x19bc('0x51')]);_0x4daffd[_0x19bc('0x53')]=_[_0x19bc('0x55')](_0x4daffd[_0x19bc('0x4f')],_0x4daffd[_0x19bc('0x51')]);_0x216697[_0x19bc('0x54')]=_[_0x19bc('0x55')](_0x4daffd[_0x19bc('0x4f')],qs[_0x19bc('0x56')](_0x5979cf[_0x19bc('0x51')][_0x19bc('0x56')]));_0x216697[_0x19bc('0x54')]=_0x216697[_0x19bc('0x54')]['length']?_0x216697[_0x19bc('0x54')]:_0x4daffd['model'];_0x216697['order']=qs['sort'](_0x5979cf[_0x19bc('0x51')][_0x19bc('0x5b')]);_0x216697['where']=qs[_0x19bc('0x53')](_[_0x19bc('0x5d')](_0x5979cf[_0x19bc('0x51')],_0x4daffd[_0x19bc('0x53')]));if(_0x5979cf['query'][_0x19bc('0x40')]){_0x216697[_0x19bc('0x5c')]=_[_0x19bc('0x6b')](_0x216697[_0x19bc('0x5c')],{'$or':_[_0x19bc('0x42')](_0x216697[_0x19bc('0x54')],function(_0x59deab){var _0x191106={};_0x191106[_0x59deab]={'$like':'%'+_0x5979cf[_0x19bc('0x51')][_0x19bc('0x40')]+'%'};return _0x191106;})});}_0x216697=_[_0x19bc('0x6b')]({},_0x216697,_0x5979cf[_0x19bc('0x62')]);return _0x880a9e['getVoiceQueuesRt'](_0x216697);}})[_0x19bc('0x23')](function(_0x466d9d){if(_0x466d9d){_0x1ab877=_0x466d9d[_0x19bc('0x57')];if(!_0x5979cf[_0x19bc('0x51')][_0x19bc('0x58')]('nolimit')){_0x216697[_0x19bc('0x31')]=qs[_0x19bc('0x31')](_0x5979cf[_0x19bc('0x51')][_0x19bc('0x31')]);_0x216697['offset']=qs['offset'](_0x5979cf[_0x19bc('0x51')]['offset']);}return _0x880a9e[_0x19bc('0xc9')](_0x216697);}})[_0x19bc('0x23')](function(_0x3c8773){if(_0x3c8773){return _0x3c8773?{'count':_0x1ab877,'rows':_0x3c8773}:null;}})[_0x19bc('0x23')](respondWithResult(_0x138f37,null))[_0x19bc('0x66')](handleError(_0x138f37,null));};exports[_0x19bc('0xca')]=function(_0x3d0bd9,_0x25d1c7,_0x4d75ff){var _0x4af036={};var _0x4b80fe={};var _0x204b60;var _0x4ce2b7;return db[_0x19bc('0x4c')][_0x19bc('0xbf')]({'where':{'id':_0x3d0bd9['params']['id']}})[_0x19bc('0x23')](handleEntityNotFound(_0x25d1c7,null))[_0x19bc('0x23')](function(_0x285e03){if(_0x285e03){_0x204b60=_0x285e03;_0x4b80fe[_0x19bc('0x4f')]=_[_0x19bc('0x52')](db[_0x19bc('0xcb')][_0x19bc('0x4d')]);_0x4b80fe[_0x19bc('0x51')]=_['keys'](_0x3d0bd9['query']);_0x4b80fe['filters']=_[_0x19bc('0x55')](_0x4b80fe[_0x19bc('0x4f')],_0x4b80fe[_0x19bc('0x51')]);_0x4af036['attributes']=_['intersection'](_0x4b80fe[_0x19bc('0x4f')],qs[_0x19bc('0x56')](_0x3d0bd9[_0x19bc('0x51')][_0x19bc('0x56')]));_0x4af036[_0x19bc('0x54')]=_0x4af036['attributes'][_0x19bc('0x57')]?_0x4af036[_0x19bc('0x54')]:_0x4b80fe[_0x19bc('0x4f')];_0x4af036[_0x19bc('0x5a')]=qs[_0x19bc('0x5b')](_0x3d0bd9['query'][_0x19bc('0x5b')]);_0x4af036[_0x19bc('0x5c')]=qs[_0x19bc('0x53')](_[_0x19bc('0x5d')](_0x3d0bd9[_0x19bc('0x51')],_0x4b80fe['filters']));if(_0x3d0bd9[_0x19bc('0x51')][_0x19bc('0x40')]){_0x4af036[_0x19bc('0x5c')]=_[_0x19bc('0x6b')](_0x4af036[_0x19bc('0x5c')],{'$or':_['map'](_0x4af036[_0x19bc('0x54')],function(_0x246ca7){var _0x5f35f5={};_0x5f35f5[_0x246ca7]={'$like':'%'+_0x3d0bd9[_0x19bc('0x51')][_0x19bc('0x40')]+'%'};return _0x5f35f5;})});}_0x4af036=_[_0x19bc('0x6b')]({},_0x4af036,_0x3d0bd9[_0x19bc('0x62')]);return _0x204b60[_0x19bc('0xca')](_0x4af036);}})[_0x19bc('0x23')](function(_0x145378){if(_0x145378){_0x4ce2b7=_0x145378['length'];if(!_0x3d0bd9[_0x19bc('0x51')][_0x19bc('0x58')](_0x19bc('0x59'))){_0x4af036[_0x19bc('0x31')]=qs[_0x19bc('0x31')](_0x3d0bd9['query']['limit']);_0x4af036['offset']=qs['offset'](_0x3d0bd9['query'][_0x19bc('0x30')]);}return _0x204b60['getGroups'](_0x4af036);}})[_0x19bc('0x23')](function(_0xcb0074){if(_0xcb0074){return _0xcb0074?{'count':_0x4ce2b7,'rows':_0xcb0074}:null;}})[_0x19bc('0x23')](respondWithResult(_0x25d1c7,null))[_0x19bc('0x66')](handleError(_0x25d1c7,null));};exports[_0x19bc('0xcc')]=function(_0x1232ba,_0x5e4537,_0x1ffddc){var _0x1528c1={'raw':!![],'where':{}};var _0x5a2667={};var _0x36d65e={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x1232ba[_0x19bc('0x6f')]['id']}})['then'](handleEntityNotFound(_0x5e4537,null))['then'](function(_0x483051){if(_0x483051){_0x5a2667[_0x19bc('0x4f')]=_[_0x19bc('0x52')](db[_0x19bc('0xcd')][_0x19bc('0x4d')]);_0x5a2667[_0x19bc('0x51')]=_[_0x19bc('0x52')](_0x1232ba[_0x19bc('0x51')]);_0x5a2667[_0x19bc('0x53')]=_[_0x19bc('0x55')](_0x5a2667['model'],_0x5a2667[_0x19bc('0x51')]);_0x1528c1[_0x19bc('0x54')]=_[_0x19bc('0x55')](_0x5a2667[_0x19bc('0x4f')],qs[_0x19bc('0x56')](_0x1232ba[_0x19bc('0x51')][_0x19bc('0x56')]));_0x1528c1[_0x19bc('0x54')]=_0x1528c1[_0x19bc('0x54')]['length']?_0x1528c1[_0x19bc('0x54')]:_0x5a2667[_0x19bc('0x4f')];if(!_0x1232ba[_0x19bc('0x51')][_0x19bc('0x58')](_0x19bc('0x59'))){_0x1528c1[_0x19bc('0x31')]=qs[_0x19bc('0x31')](_0x1232ba[_0x19bc('0x51')]['limit']);_0x1528c1[_0x19bc('0x30')]=qs[_0x19bc('0x30')](_0x1232ba['query']['offset']);}_0x1528c1['order']=qs[_0x19bc('0x5b')](_0x1232ba[_0x19bc('0x51')]['sort']);_0x1528c1[_0x19bc('0x5c')]=qs[_0x19bc('0x53')](_[_0x19bc('0x5d')](_0x1232ba[_0x19bc('0x51')],_0x5a2667[_0x19bc('0x53')]));_0x1528c1[_0x19bc('0x5c')][_0x19bc('0xce')]=_0x483051['id'];if(_0x1232ba[_0x19bc('0x51')][_0x19bc('0x40')]){_0x1528c1['where']=_[_0x19bc('0x6b')](_0x1528c1[_0x19bc('0x5c')],{'$or':_[_0x19bc('0x42')](_0x1528c1[_0x19bc('0x54')],function(_0x5351e1){var _0x5010a0={};_0x5010a0[_0x5351e1]={'$like':'%'+_0x1232ba[_0x19bc('0x51')][_0x19bc('0x40')]+'%'};return _0x5010a0;})});}_0x1528c1=_[_0x19bc('0x6b')]({},_0x1528c1,_0x1232ba[_0x19bc('0x62')]);return db[_0x19bc('0xcd')][_0x19bc('0x2f')]({'where':_0x1528c1[_0x19bc('0x5c')]})[_0x19bc('0x23')](function(_0x30ad26){_0x36d65e[_0x19bc('0x2f')]=_0x30ad26;if(_0x1232ba[_0x19bc('0x51')]['includeAll']){_0x1528c1[_0x19bc('0x63')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x1528c1);})[_0x19bc('0x23')](function(_0x374dba){_0x36d65e[_0x19bc('0x65')]=_0x374dba;return _0x36d65e;});}})[_0x19bc('0x23')](respondWithFilteredResult(_0x5e4537,_0x1528c1))[_0x19bc('0x66')](handleError(_0x5e4537,null));};exports[_0x19bc('0xcf')]=function(_0x107402,_0x11d46c,_0x49bad5){var _0x1c2efd={'raw':!![],'where':{}};var _0x5af8a9={};var _0x126a32={'count':0x0,'rows':[]};return db['User'][_0x19bc('0xbf')]({'where':{'id':_0x107402[_0x19bc('0x6f')]['id']}})['then'](handleEntityNotFound(_0x11d46c,null))[_0x19bc('0x23')](function(_0xd83246){if(_0xd83246){_0x5af8a9[_0x19bc('0x4f')]=_['keys'](db[_0x19bc('0xd0')][_0x19bc('0x4d')]);_0x5af8a9['query']=_[_0x19bc('0x52')](_0x107402[_0x19bc('0x51')]);_0x5af8a9[_0x19bc('0x53')]=_[_0x19bc('0x55')](_0x5af8a9['model'],_0x5af8a9[_0x19bc('0x51')]);_0x1c2efd[_0x19bc('0x54')]=_[_0x19bc('0x55')](_0x5af8a9[_0x19bc('0x4f')],qs[_0x19bc('0x56')](_0x107402[_0x19bc('0x51')][_0x19bc('0x56')]));_0x1c2efd[_0x19bc('0x54')]=_0x1c2efd[_0x19bc('0x54')][_0x19bc('0x57')]?_0x1c2efd[_0x19bc('0x54')]:_0x5af8a9[_0x19bc('0x4f')];if(!_0x107402['query'][_0x19bc('0x58')](_0x19bc('0x59'))){_0x1c2efd[_0x19bc('0x31')]=qs['limit'](_0x107402['query'][_0x19bc('0x31')]);_0x1c2efd['offset']=qs[_0x19bc('0x30')](_0x107402[_0x19bc('0x51')][_0x19bc('0x30')]);}_0x1c2efd[_0x19bc('0x5a')]=qs[_0x19bc('0x5b')](_0x107402[_0x19bc('0x51')]['sort']);_0x1c2efd[_0x19bc('0x5c')]=qs[_0x19bc('0x53')](_[_0x19bc('0x5d')](_0x107402[_0x19bc('0x51')],_0x5af8a9[_0x19bc('0x53')]));_0x1c2efd[_0x19bc('0x5c')][_0x19bc('0xce')]=_0xd83246['id'];if(_0x107402[_0x19bc('0x51')][_0x19bc('0x40')]){_0x1c2efd[_0x19bc('0x5c')]=_[_0x19bc('0x6b')](_0x1c2efd[_0x19bc('0x5c')],{'$or':_[_0x19bc('0x42')](_0x1c2efd[_0x19bc('0x54')],function(_0x39d578){var _0x69f53f={};_0x69f53f[_0x39d578]={'$like':'%'+_0x107402[_0x19bc('0x51')]['filter']+'%'};return _0x69f53f;})});}_0x1c2efd=_[_0x19bc('0x6b')]({},_0x1c2efd,_0x107402[_0x19bc('0x62')]);return db[_0x19bc('0xd0')][_0x19bc('0x2f')]({'where':_0x1c2efd['where']})[_0x19bc('0x23')](function(_0x37f3b7){_0x126a32['count']=_0x37f3b7;if(_0x107402['query'][_0x19bc('0x6a')]){_0x1c2efd['include']=[{'all':!![]}];}return db[_0x19bc('0xd0')][_0x19bc('0x64')](_0x1c2efd);})[_0x19bc('0x23')](function(_0x50111b){_0x126a32[_0x19bc('0x65')]=_0x50111b;return _0x126a32;});}})[_0x19bc('0x23')](respondWithFilteredResult(_0x11d46c,_0x1c2efd))[_0x19bc('0x66')](handleError(_0x11d46c,null));};exports[_0x19bc('0xd1')]=function(_0x52a52e,_0x41200f,_0x33eaea){var _0x59f1a8={};var _0x46f6f6={};var _0x292970;var _0x3ec598;return db['User']['findOne']({'where':{'id':_0x52a52e[_0x19bc('0x6f')]['id']}})['then'](handleEntityNotFound(_0x41200f,null))[_0x19bc('0x23')](function(_0x359095){if(_0x359095){_0x292970=_0x359095;_0x46f6f6[_0x19bc('0x4f')]=_[_0x19bc('0x52')](db[_0x19bc('0xd2')][_0x19bc('0x4d')]);_0x46f6f6[_0x19bc('0x51')]=_[_0x19bc('0x52')](_0x52a52e['query']);_0x46f6f6[_0x19bc('0x53')]=_[_0x19bc('0x55')](_0x46f6f6[_0x19bc('0x4f')],_0x46f6f6['query']);_0x59f1a8[_0x19bc('0x54')]=_['intersection'](_0x46f6f6[_0x19bc('0x4f')],qs[_0x19bc('0x56')](_0x52a52e[_0x19bc('0x51')][_0x19bc('0x56')]));_0x59f1a8[_0x19bc('0x54')]=_0x59f1a8['attributes']['length']?_0x59f1a8[_0x19bc('0x54')]:_0x46f6f6[_0x19bc('0x4f')];_0x59f1a8[_0x19bc('0x5a')]=qs[_0x19bc('0x5b')](_0x52a52e[_0x19bc('0x51')][_0x19bc('0x5b')]);_0x59f1a8['where']=qs[_0x19bc('0x53')](_[_0x19bc('0x5d')](_0x52a52e[_0x19bc('0x51')],_0x46f6f6[_0x19bc('0x53')]));if(_0x52a52e[_0x19bc('0x51')][_0x19bc('0x40')]){_0x59f1a8[_0x19bc('0x5c')]=_[_0x19bc('0x6b')](_0x59f1a8[_0x19bc('0x5c')],{'$or':_[_0x19bc('0x42')](_0x59f1a8['attributes'],function(_0x309957){var _0x35dbcc={};_0x35dbcc[_0x309957]={'$like':'%'+_0x52a52e[_0x19bc('0x51')][_0x19bc('0x40')]+'%'};return _0x35dbcc;})});}_0x59f1a8=_['merge']({},_0x59f1a8,_0x52a52e[_0x19bc('0x62')]);return _0x292970[_0x19bc('0xd1')](_0x59f1a8);}})[_0x19bc('0x23')](function(_0x702f49){if(_0x702f49){_0x3ec598=_0x702f49['length'];if(!_0x52a52e[_0x19bc('0x51')][_0x19bc('0x58')]('nolimit')){_0x59f1a8[_0x19bc('0x31')]=qs['limit'](_0x52a52e[_0x19bc('0x51')][_0x19bc('0x31')]);_0x59f1a8[_0x19bc('0x30')]=qs[_0x19bc('0x30')](_0x52a52e[_0x19bc('0x51')][_0x19bc('0x30')]);}return _0x292970['getChatInteractions'](_0x59f1a8);}})[_0x19bc('0x23')](function(_0x501c71){if(_0x501c71){return _0x501c71?{'count':_0x3ec598,'rows':_0x501c71}:null;}})[_0x19bc('0x23')](respondWithResult(_0x41200f,null))[_0x19bc('0x66')](handleError(_0x41200f,null));};exports[_0x19bc('0xd3')]=function(_0x21415e,_0x2ac481,_0x3282a1){var _0x53b133={};var _0x542b03={};var _0x4b405d;var _0x36623b;return db[_0x19bc('0x4c')][_0x19bc('0xbf')]({'where':{'id':_0x21415e[_0x19bc('0x6f')]['id']}})[_0x19bc('0x23')](handleEntityNotFound(_0x2ac481,null))['then'](function(_0xb7bf25){if(_0xb7bf25){_0x4b405d=_0xb7bf25;_0x542b03['model']=_[_0x19bc('0x52')](db[_0x19bc('0xd4')][_0x19bc('0x4d')]);_0x542b03[_0x19bc('0x51')]=_[_0x19bc('0x52')](_0x21415e['query']);_0x542b03[_0x19bc('0x53')]=_[_0x19bc('0x55')](_0x542b03[_0x19bc('0x4f')],_0x542b03['query']);_0x53b133[_0x19bc('0x54')]=_[_0x19bc('0x55')](_0x542b03[_0x19bc('0x4f')],qs['fields'](_0x21415e[_0x19bc('0x51')][_0x19bc('0x56')]));_0x53b133[_0x19bc('0x54')]=_0x53b133[_0x19bc('0x54')]['length']?_0x53b133[_0x19bc('0x54')]:_0x542b03['model'];_0x53b133[_0x19bc('0x5a')]=qs[_0x19bc('0x5b')](_0x21415e[_0x19bc('0x51')][_0x19bc('0x5b')]);_0x53b133['where']=qs['filters'](_[_0x19bc('0x5d')](_0x21415e[_0x19bc('0x51')],_0x542b03[_0x19bc('0x53')]));if(_0x21415e[_0x19bc('0x51')][_0x19bc('0x40')]){_0x53b133[_0x19bc('0x5c')]=_[_0x19bc('0x6b')](_0x53b133[_0x19bc('0x5c')],{'$or':_['map'](_0x53b133['attributes'],function(_0x14c089){var _0x10cf05={};_0x10cf05[_0x14c089]={'$like':'%'+_0x21415e[_0x19bc('0x51')]['filter']+'%'};return _0x10cf05;})});}_0x53b133=_[_0x19bc('0x6b')]({},_0x53b133,_0x21415e[_0x19bc('0x62')]);return _0x4b405d[_0x19bc('0xd3')](_0x53b133);}})['then'](function(_0x20d1df){if(_0x20d1df){_0x36623b=_0x20d1df[_0x19bc('0x57')];if(!_0x21415e[_0x19bc('0x51')][_0x19bc('0x58')](_0x19bc('0x59'))){_0x53b133['limit']=qs[_0x19bc('0x31')](_0x21415e[_0x19bc('0x51')]['limit']);_0x53b133[_0x19bc('0x30')]=qs[_0x19bc('0x30')](_0x21415e['query'][_0x19bc('0x30')]);}return _0x4b405d[_0x19bc('0xd3')](_0x53b133);}})[_0x19bc('0x23')](function(_0x57daa4){if(_0x57daa4){return _0x57daa4?{'count':_0x36623b,'rows':_0x57daa4}:null;}})['then'](respondWithResult(_0x2ac481,null))[_0x19bc('0x66')](handleError(_0x2ac481,null));};exports['getMailInteractions']=function(_0x24bad0,_0x385c10,_0x2ac6cc){var _0x199320={'raw':!![],'where':{}};var _0x59fe2f={};var _0x3eca2e={'count':0x0,'rows':[]};return db[_0x19bc('0x4c')]['findOne']({'where':{'id':_0x24bad0['params']['id']}})[_0x19bc('0x23')](handleEntityNotFound(_0x385c10,null))[_0x19bc('0x23')](function(_0x567d3f){if(_0x567d3f){_0x59fe2f[_0x19bc('0x4f')]=_[_0x19bc('0x52')](db['MailInteraction']['rawAttributes']);_0x59fe2f['query']=_['keys'](_0x24bad0[_0x19bc('0x51')]);_0x59fe2f[_0x19bc('0x53')]=_[_0x19bc('0x55')](_0x59fe2f[_0x19bc('0x4f')],_0x59fe2f[_0x19bc('0x51')]);_0x199320[_0x19bc('0x54')]=_['intersection'](_0x59fe2f[_0x19bc('0x4f')],qs['fields'](_0x24bad0[_0x19bc('0x51')][_0x19bc('0x56')]));_0x199320[_0x19bc('0x54')]=_0x199320[_0x19bc('0x54')]['length']?_0x199320[_0x19bc('0x54')]:_0x59fe2f['model'];if(!_0x24bad0[_0x19bc('0x51')][_0x19bc('0x58')](_0x19bc('0x59'))){_0x199320[_0x19bc('0x31')]=qs[_0x19bc('0x31')](_0x24bad0[_0x19bc('0x51')][_0x19bc('0x31')]);_0x199320[_0x19bc('0x30')]=qs['offset'](_0x24bad0['query'][_0x19bc('0x30')]);}_0x199320[_0x19bc('0x5a')]=qs[_0x19bc('0x5b')](_0x24bad0[_0x19bc('0x51')][_0x19bc('0x5b')]);_0x199320['where']=qs[_0x19bc('0x53')](_['pick'](_0x24bad0[_0x19bc('0x51')],_0x59fe2f[_0x19bc('0x53')]));_0x199320[_0x19bc('0x5c')][_0x19bc('0xce')]=_0x567d3f['id'];if(_0x24bad0[_0x19bc('0x51')]['filter']){_0x199320[_0x19bc('0x5c')]=_[_0x19bc('0x6b')](_0x199320[_0x19bc('0x5c')],{'$or':_[_0x19bc('0x42')](_0x199320[_0x19bc('0x54')],function(_0x411353){var _0x57dee3={};_0x57dee3[_0x411353]={'$like':'%'+_0x24bad0[_0x19bc('0x51')][_0x19bc('0x40')]+'%'};return _0x57dee3;})});}_0x199320=_[_0x19bc('0x6b')]({},_0x199320,_0x24bad0[_0x19bc('0x62')]);return db[_0x19bc('0xd5')][_0x19bc('0x2f')]({'where':_0x199320[_0x19bc('0x5c')]})['then'](function(_0xaa569d){_0x3eca2e[_0x19bc('0x2f')]=_0xaa569d;if(_0x24bad0[_0x19bc('0x51')][_0x19bc('0x6a')]){_0x199320[_0x19bc('0x63')]=[{'all':!![]}];}return db[_0x19bc('0xd5')][_0x19bc('0x64')](_0x199320);})[_0x19bc('0x23')](function(_0xb93e1f){_0x3eca2e['rows']=_0xb93e1f;return _0x3eca2e;});}})[_0x19bc('0x23')](respondWithFilteredResult(_0x385c10,_0x199320))['catch'](handleError(_0x385c10,null));};exports[_0x19bc('0xd6')]=function(_0x4ce295,_0x5a95ec,_0x190d50){var _0xc2820d={};var _0x54b7b8={};var _0x31cc5f;var _0x5974fc;return db[_0x19bc('0x4c')][_0x19bc('0xbf')]({'where':{'id':_0x4ce295['params']['id']}})[_0x19bc('0x23')](handleEntityNotFound(_0x5a95ec,null))[_0x19bc('0x23')](function(_0x160583){if(_0x160583){_0x31cc5f=_0x160583;_0x54b7b8[_0x19bc('0x4f')]=_[_0x19bc('0x52')](db['SmsInteraction'][_0x19bc('0x4d')]);_0x54b7b8[_0x19bc('0x51')]=_['keys'](_0x4ce295['query']);_0x54b7b8[_0x19bc('0x53')]=_['intersection'](_0x54b7b8[_0x19bc('0x4f')],_0x54b7b8[_0x19bc('0x51')]);_0xc2820d[_0x19bc('0x54')]=_[_0x19bc('0x55')](_0x54b7b8[_0x19bc('0x4f')],qs[_0x19bc('0x56')](_0x4ce295[_0x19bc('0x51')]['fields']));_0xc2820d['attributes']=_0xc2820d[_0x19bc('0x54')][_0x19bc('0x57')]?_0xc2820d['attributes']:_0x54b7b8[_0x19bc('0x4f')];_0xc2820d[_0x19bc('0x5a')]=qs[_0x19bc('0x5b')](_0x4ce295['query']['sort']);_0xc2820d[_0x19bc('0x5c')]=qs[_0x19bc('0x53')](_['pick'](_0x4ce295[_0x19bc('0x51')],_0x54b7b8[_0x19bc('0x53')]));if(_0x4ce295[_0x19bc('0x51')][_0x19bc('0x40')]){_0xc2820d[_0x19bc('0x5c')]=_[_0x19bc('0x6b')](_0xc2820d[_0x19bc('0x5c')],{'$or':_[_0x19bc('0x42')](_0xc2820d[_0x19bc('0x54')],function(_0x41ad9e){var _0x85a716={};_0x85a716[_0x41ad9e]={'$like':'%'+_0x4ce295[_0x19bc('0x51')][_0x19bc('0x40')]+'%'};return _0x85a716;})});}_0xc2820d=_[_0x19bc('0x6b')]({},_0xc2820d,_0x4ce295[_0x19bc('0x62')]);return _0x31cc5f['getSmsInteractions'](_0xc2820d);}})[_0x19bc('0x23')](function(_0x250df3){if(_0x250df3){_0x5974fc=_0x250df3[_0x19bc('0x57')];if(!_0x4ce295[_0x19bc('0x51')][_0x19bc('0x58')]('nolimit')){_0xc2820d['limit']=qs[_0x19bc('0x31')](_0x4ce295['query'][_0x19bc('0x31')]);_0xc2820d['offset']=qs[_0x19bc('0x30')](_0x4ce295[_0x19bc('0x51')][_0x19bc('0x30')]);}return _0x31cc5f['getSmsInteractions'](_0xc2820d);}})[_0x19bc('0x23')](function(_0x1f14bf){if(_0x1f14bf){return _0x1f14bf?{'count':_0x5974fc,'rows':_0x1f14bf}:null;}})['then'](respondWithResult(_0x5a95ec,null))[_0x19bc('0x66')](handleError(_0x5a95ec,null));};exports[_0x19bc('0xd7')]=function(_0x2d2f80,_0x111239,_0x5b1aa3){var _0x4b66cb={};var _0x5eec99={};var _0x99aee2;var _0x13f315;return db[_0x19bc('0x4c')][_0x19bc('0xbf')]({'where':{'id':_0x2d2f80[_0x19bc('0x6f')]['id']}})[_0x19bc('0x23')](handleEntityNotFound(_0x111239,null))[_0x19bc('0x23')](function(_0x2c8b61){if(_0x2c8b61){_0x99aee2=_0x2c8b61;_0x5eec99[_0x19bc('0x4f')]=_[_0x19bc('0x52')](db['FaxInteraction']['rawAttributes']);_0x5eec99[_0x19bc('0x51')]=_['keys'](_0x2d2f80[_0x19bc('0x51')]);_0x5eec99['filters']=_[_0x19bc('0x55')](_0x5eec99['model'],_0x5eec99[_0x19bc('0x51')]);_0x4b66cb[_0x19bc('0x54')]=_[_0x19bc('0x55')](_0x5eec99[_0x19bc('0x4f')],qs[_0x19bc('0x56')](_0x2d2f80[_0x19bc('0x51')][_0x19bc('0x56')]));_0x4b66cb[_0x19bc('0x54')]=_0x4b66cb['attributes']['length']?_0x4b66cb[_0x19bc('0x54')]:_0x5eec99[_0x19bc('0x4f')];_0x4b66cb[_0x19bc('0x5a')]=qs['sort'](_0x2d2f80[_0x19bc('0x51')]['sort']);_0x4b66cb[_0x19bc('0x5c')]=qs[_0x19bc('0x53')](_[_0x19bc('0x5d')](_0x2d2f80[_0x19bc('0x51')],_0x5eec99[_0x19bc('0x53')]));if(_0x2d2f80[_0x19bc('0x51')][_0x19bc('0x40')]){_0x4b66cb[_0x19bc('0x5c')]=_[_0x19bc('0x6b')](_0x4b66cb['where'],{'$or':_['map'](_0x4b66cb[_0x19bc('0x54')],function(_0x3dbe9c){var _0x510f82={};_0x510f82[_0x3dbe9c]={'$like':'%'+_0x2d2f80[_0x19bc('0x51')][_0x19bc('0x40')]+'%'};return _0x510f82;})});}_0x4b66cb=_[_0x19bc('0x6b')]({},_0x4b66cb,_0x2d2f80[_0x19bc('0x62')]);return _0x99aee2[_0x19bc('0xd7')](_0x4b66cb);}})[_0x19bc('0x23')](function(_0x53c72c){if(_0x53c72c){_0x13f315=_0x53c72c[_0x19bc('0x57')];if(!_0x2d2f80['query']['hasOwnProperty']('nolimit')){_0x4b66cb[_0x19bc('0x31')]=qs[_0x19bc('0x31')](_0x2d2f80[_0x19bc('0x51')]['limit']);_0x4b66cb[_0x19bc('0x30')]=qs[_0x19bc('0x30')](_0x2d2f80[_0x19bc('0x51')]['offset']);}return _0x99aee2[_0x19bc('0xd7')](_0x4b66cb);}})[_0x19bc('0x23')](function(_0x5c7582){if(_0x5c7582){return _0x5c7582?{'count':_0x13f315,'rows':_0x5c7582}:null;}})[_0x19bc('0x23')](respondWithResult(_0x111239,null))[_0x19bc('0x66')](handleError(_0x111239,null));};exports[_0x19bc('0xd8')]=function(_0x653f2e,_0x545277,_0x3926d0){var _0x364abb={};var _0x225875={};var _0x4dcb60;var _0x5a9d6b;return db[_0x19bc('0x4c')]['findOne']({'where':{'id':_0x653f2e[_0x19bc('0x6f')]['id']}})['then'](handleEntityNotFound(_0x545277,null))['then'](function(_0x2bc40d){if(_0x2bc40d){_0x4dcb60=_0x2bc40d;_0x225875[_0x19bc('0x4f')]=_[_0x19bc('0x52')](db['WhatsappInteraction']['rawAttributes']);_0x225875[_0x19bc('0x51')]=_[_0x19bc('0x52')](_0x653f2e[_0x19bc('0x51')]);_0x225875[_0x19bc('0x53')]=_[_0x19bc('0x55')](_0x225875[_0x19bc('0x4f')],_0x225875['query']);_0x364abb[_0x19bc('0x54')]=_[_0x19bc('0x55')](_0x225875['model'],qs['fields'](_0x653f2e['query'][_0x19bc('0x56')]));_0x364abb['attributes']=_0x364abb[_0x19bc('0x54')]['length']?_0x364abb['attributes']:_0x225875[_0x19bc('0x4f')];_0x364abb['order']=qs[_0x19bc('0x5b')](_0x653f2e[_0x19bc('0x51')][_0x19bc('0x5b')]);_0x364abb[_0x19bc('0x5c')]=qs[_0x19bc('0x53')](_['pick'](_0x653f2e['query'],_0x225875['filters']));if(_0x653f2e[_0x19bc('0x51')]['filter']){_0x364abb[_0x19bc('0x5c')]=_[_0x19bc('0x6b')](_0x364abb[_0x19bc('0x5c')],{'$or':_[_0x19bc('0x42')](_0x364abb[_0x19bc('0x54')],function(_0x261343){var _0x14ec74={};_0x14ec74[_0x261343]={'$like':'%'+_0x653f2e[_0x19bc('0x51')][_0x19bc('0x40')]+'%'};return _0x14ec74;})});}_0x364abb=_['merge']({},_0x364abb,_0x653f2e[_0x19bc('0x62')]);return _0x4dcb60[_0x19bc('0xd8')](_0x364abb);}})[_0x19bc('0x23')](function(_0x53c3d7){if(_0x53c3d7){_0x5a9d6b=_0x53c3d7[_0x19bc('0x57')];if(!_0x653f2e[_0x19bc('0x51')][_0x19bc('0x58')]('nolimit')){_0x364abb[_0x19bc('0x31')]=qs[_0x19bc('0x31')](_0x653f2e[_0x19bc('0x51')][_0x19bc('0x31')]);_0x364abb[_0x19bc('0x30')]=qs[_0x19bc('0x30')](_0x653f2e[_0x19bc('0x51')]['offset']);}return _0x4dcb60[_0x19bc('0xd8')](_0x364abb);}})[_0x19bc('0x23')](function(_0x494db1){if(_0x494db1){return _0x494db1?{'count':_0x5a9d6b,'rows':_0x494db1}:null;}})[_0x19bc('0x23')](respondWithResult(_0x545277,null))[_0x19bc('0x66')](handleError(_0x545277,null));};exports[_0x19bc('0xd9')]=function(_0x532e35,_0x4167ce,_0x2ac7d4){var _0x39795e;var _0x55d95b;var _0x1e3542;var _0x1f3ebd=!_['isNil'](_0x532e35[_0x19bc('0x6f')]['id'])?_0x532e35[_0x19bc('0x6f')]['id']:!_['isNil'](_0x532e35['user']['id'])?_0x532e35[_0x19bc('0x3b')]['id']:null;return db[_0x19bc('0x4c')][_0x19bc('0x45')]({'where':{'id':_0x1f3ebd,'role':{'$or':['admin',_0x19bc('0x3b'),_0x19bc('0x3d')]}},'attributes':['id',_0x19bc('0x47'),_0x19bc('0xda'),_0x19bc('0xdb'),_0x19bc('0x44'),_0x19bc('0x7b'),'loginInPause']})[_0x19bc('0x23')](function(_0x33a45c){if(_0x33a45c){if(_0x33a45c[_0x19bc('0x44')]===_0x19bc('0x3d')){_0x39795e=_0x33a45c;if(_0x532e35[_0x19bc('0x6d')]['interface']){_0x1e3542=util[_0x19bc('0x78')](_0x19bc('0xdc'),_0x39795e[_0x532e35[_0x19bc('0x6d')][_0x19bc('0xa1')]]);}else if(_0x532e35['body'][_0x19bc('0xdd')]){_0x1e3542=util[_0x19bc('0x78')](_0x19bc('0xde'),_0x532e35[_0x19bc('0x6d')]['intrf']);}else{_0x1e3542=util['format'](_0x19bc('0xde'),_0x39795e[_0x19bc('0x47')]);}socket['to'](util[_0x19bc('0x78')]('user:%s',_0x39795e[_0x19bc('0x47')]))['emit']('user:forcelogout',{'ip':_0x532e35['headers'][_0x19bc('0xdf')]||_0x532e35[_0x19bc('0xe0')][_0x19bc('0xe1')]||_0x532e35[_0x19bc('0xe2')]['remoteAddress']||_0x532e35[_0x19bc('0xe0')][_0x19bc('0xe2')][_0x19bc('0xe1')]});return db[_0x19bc('0xb4')][_0x19bc('0x38')]({'where':{'membername':_0x39795e[_0x19bc('0x47')]},'individualHooks':!![]});}}else{throw new db[(_0x19bc('0x21'))][(_0x19bc('0x96'))](_0x19bc('0xe3'));}})[_0x19bc('0x23')](function(){if(_0x39795e){return _0x39795e[_0x19bc('0xe4')]({'raw':!![]});}})[_0x19bc('0x23')](function(_0x39de08){if(_0x39795e){var _0x3fd8be=[];if(_0x39de08){_0x55d95b=_0x39de08;if(_0x55d95b['length']){for(var _0x5acb96=0x0;_0x5acb96<_0x55d95b[_0x19bc('0x57')];_0x5acb96++){_0x3fd8be[_0x19bc('0xab')]({'membername':_0x39795e[_0x19bc('0x47')],'UserId':_0x39795e['id'],'queue_name':_0x55d95b[_0x5acb96][_0x19bc('0x47')],'VoiceQueueId':_0x55d95b[_0x5acb96]['id'],'interface':_0x1e3542,'paused':_0x39795e[_0x19bc('0x9f')]||![],'penalty':_0x55d95b[_0x5acb96][_0x19bc('0xe5')]||0x0});}return BPromise['each'](_0x3fd8be,function(_0x65ef05){return db[_0x19bc('0xb4')][_0x19bc('0xad')](_0x65ef05);});}}}})[_0x19bc('0x23')](function(){if(_0x39795e){return db['MemberReport']['findAll']({'where':{'membername':_0x39795e[_0x19bc('0x47')],'exitAt':null}});}})[_0x19bc('0x23')](function(_0x48d354){if(_0x39795e){var _0x1d37bf=[];_0x48d354['forEach'](function(_0x577c66){_0x1d37bf[_0x19bc('0xab')](_0x577c66['update']({'exitAt':moment()[_0x19bc('0x78')](_0x19bc('0xe6'))}));});return BPromise[_0x19bc('0xe7')](_0x1d37bf);}})[_0x19bc('0x23')](function(){if(_0x39795e){var _0x20665e=[];var _0x21b206=[];var _0x1f396e=utils[_0x19bc('0xe8')]();var _0x28f6c3={'membername':_0x39795e[_0x19bc('0x47')],'interface':_0x1e3542,'enterAt':moment()['format'](_0x19bc('0xe6')),'role':_0x39795e[_0x19bc('0x44')],'internal':_0x39795e['internal']};_0x1f396e[_0x19bc('0xe9')](function(_0x3a6915){_0x20665e['push'](_['merge']({'channel':_0x3a6915,'type':_0x19bc('0xea'),'data1':_0x532e35['body'][_0x19bc('0xeb')],'data2':_0x1e3542},_0x28f6c3));if(_0x39795e[_0x19bc('0x9f')]){_0x21b206[_0x19bc('0xab')](_[_0x19bc('0x6b')]({'channel':_0x3a6915,'type':_0x19bc('0xec'),'data1':_0x19bc('0xed')},_0x28f6c3));}});return db[_0x19bc('0xee')][_0x19bc('0x6c')](_0x20665e['concat'](_0x21b206),{'individualHooks':!![]});}})[_0x19bc('0x23')](function(){if(_0x39795e){return _0x39795e[_0x19bc('0x37')]({'online':!![],'lastLoginAt':moment()[_0x19bc('0x78')](_0x19bc('0xe6')),'voicePause':_0x39795e[_0x19bc('0x9f')]||![],'mailPause':_0x39795e[_0x19bc('0x9f')]||![],'chatPause':_0x39795e['loginInPause']||![],'faxPause':_0x39795e[_0x19bc('0x9f')]||![],'smsPause':_0x39795e['loginInPause']||![],'openchannelPause':_0x39795e[_0x19bc('0x9f')]||![],'whatsappPause':_0x39795e['loginInPause']||![],'pauseType':_0x39795e['loginInPause']?_0x19bc('0xed'):null,'interface':_0x1e3542,'lastPauseAt':moment()[_0x19bc('0x78')](_0x19bc('0xe6'))});}})[_0x19bc('0x23')](function(_0x146f2d){if(_0x532e35['isMiddleware']){return _0x2ac7d4();}else{return BPromise['resolve'](_0x146f2d)[_0x19bc('0x23')](respondWithResult(_0x4167ce,null));}})[_0x19bc('0x66')](handleError(_0x4167ce,null));};exports['logout']=function(_0x1d3faa,_0x5eeee4,_0x3cc805){var _0x4fd078;return db['User'][_0x19bc('0x45')]({'where':{'id':_0x1d3faa[_0x19bc('0x6f')]['id'],'role':'agent'},'attributes':['id',_0x19bc('0x47'),_0x19bc('0x44')]})[_0x19bc('0x23')](handleEntityNotFound(_0x5eeee4,null))[_0x19bc('0x23')](function(_0xe7daf2){if(_0xe7daf2){_0x4fd078=_0xe7daf2;return db[_0x19bc('0xb4')][_0x19bc('0x38')]({'where':{'membername':_0x4fd078[_0x19bc('0x47')]},'individualHooks':!![]});}})[_0x19bc('0x23')](function(){return db[_0x19bc('0xee')][_0x19bc('0x64')]({'where':{'membername':_0x4fd078['name'],'exitAt':null}});})[_0x19bc('0x23')](function(_0x2859e9){var _0x248e3e=[];_0x2859e9[_0x19bc('0xe9')](function(_0x14817e){_0x248e3e[_0x19bc('0xab')](_0x14817e[_0x19bc('0x37')]({'exitAt':moment()[_0x19bc('0x78')](_0x19bc('0xe6'))}));});return BPromise[_0x19bc('0xe7')](_0x248e3e);})[_0x19bc('0x23')](function(){return _0x4fd078[_0x19bc('0x37')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x19bc('0x23')](respondWithResult(_0x5eeee4,null))[_0x19bc('0x66')](handleError(_0x5eeee4,null));};exports[_0x19bc('0xef')]=function(_0x5e00fe,_0x476503,_0x9719ea){var _0xb2bc6;return db[_0x19bc('0xb4')][_0x19bc('0x37')]({'paused':0x1},{'where':{'UserId':_0x5e00fe['params']['id']},'individualHooks':!![]})['then'](function(){return db[_0x19bc('0x4c')]['find']({'where':{'id':_0x5e00fe[_0x19bc('0x6f')]['id'],'role':'agent'},'attributes':['id',_0x19bc('0x47'),_0x19bc('0x44'),_0x19bc('0x7b'),_0x19bc('0xa1')]});})['then'](handleEntityNotFound(_0x476503,null))[_0x19bc('0x23')](function(_0x3ce614){if(_0x3ce614){_0xb2bc6=_0x3ce614;return respondWithRpcPromise(_0x19bc('0xf0'),_0x19bc('0xef'),{'id':_0xb2bc6['id'],'name':_0xb2bc6[_0x19bc('0x47')],'pause':!![]});}})[_0x19bc('0x23')](function(){if(_0xb2bc6){return db[_0x19bc('0xee')][_0x19bc('0x64')]({'where':{'membername':_0xb2bc6['name'],'type':_0x19bc('0xec'),'exitAt':null}});}})[_0x19bc('0x23')](function(_0x4c292b){if(_0x4c292b[_0x19bc('0x57')]){var _0x52fbe9=moment()[_0x19bc('0x78')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x12aae1=0x0,_0x3a0aa9=_0x4c292b[_0x19bc('0x57')];_0x12aae1<_0x3a0aa9;_0x12aae1++){_0x4c292b[_0x12aae1][_0x19bc('0xf1')]({'exitAt':_0x52fbe9});}}})[_0x19bc('0x23')](function(){var _0x353f1f=[];var _0x3d44a5=utils['getChannels']();_0x3d44a5['forEach'](function(_0x14e089){_0x353f1f[_0x19bc('0xab')]({'channel':_0x14e089,'membername':_0xb2bc6[_0x19bc('0x47')],'interface':_[_0x19bc('0x77')](_0xb2bc6[_0x19bc('0xa1')])?util[_0x19bc('0x78')](_0x19bc('0xde'),_0xb2bc6[_0x19bc('0x47')]):_0xb2bc6[_0x19bc('0xa1')],'type':_0x19bc('0xec'),'enterAt':moment()[_0x19bc('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x5e00fe[_0x19bc('0x6d')]['type']||_0x19bc('0xf2'),'role':_0xb2bc6[_0x19bc('0x44')],'internal':_0xb2bc6[_0x19bc('0x7b')]});});return db[_0x19bc('0xee')][_0x19bc('0x6c')](_0x353f1f,{'individualHooks':!![]});})[_0x19bc('0x23')](function(){return _0xb2bc6[_0x19bc('0x37')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x5e00fe['body'][_0x19bc('0xf3')]||_0x19bc('0xf2'),'lastPauseAt':moment()[_0x19bc('0x78')](_0x19bc('0xe6'))});})[_0x19bc('0x23')](respondWithResult(_0x476503,null))['catch'](handleError(_0x476503,null));};exports['unpause']=function(_0x9be0a8,_0x500a99,_0x5413ed){var _0x4d21d9;return db[_0x19bc('0x4c')][_0x19bc('0x45')]({'where':{'id':_0x9be0a8[_0x19bc('0x6f')]['id']},'attributes':['id','name',_0x19bc('0x44'),_0x19bc('0xa0'),'mailPause','chatPause',_0x19bc('0xf4'),_0x19bc('0xf5'),_0x19bc('0xf6'),_0x19bc('0xf7'),_0x19bc('0xf8'),'lastPauseAt']})['then'](handleEntityNotFound(_0x500a99,null))['then'](function(_0x49e5e1){if(_0x49e5e1){_0x4d21d9=_0x49e5e1;if(_0x9be0a8[_0x19bc('0x6d')][_0x19bc('0xaf')]&&!utils[_0x19bc('0xa2')](_0x9be0a8[_0x19bc('0x6d')][_0x19bc('0xaf')])){throw new db[(_0x19bc('0x21'))][(_0x19bc('0x96'))]('Unknown\x20channel');}switch(_0x9be0a8[_0x19bc('0x6d')][_0x19bc('0xaf')]){case'voice':return respondWithRpcPromise(_0x19bc('0xf0'),_0x19bc('0xf9'),{'id':_0x4d21d9['id'],'name':_0x4d21d9[_0x19bc('0x47')],'pause':![]})[_0x19bc('0x23')](function(){return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x4d21d9['id']},'individualHooks':!![]});})[_0x19bc('0x23')](function(){return db['MemberReport'][_0x19bc('0x45')]({'where':{'channel':_0x9be0a8['body'][_0x19bc('0xaf')],'membername':_0x4d21d9[_0x19bc('0x47')],'type':_0x19bc('0xec'),'exitAt':null}});})[_0x19bc('0x23')](function(_0x13d0bb){if(_0x13d0bb){return _0x13d0bb[_0x19bc('0x37')]({'exitAt':moment()['format'](_0x19bc('0xe6')),'data2':_0x19bc('0xfa')},{'individualHooks':!![]});}return null;})[_0x19bc('0x23')](function(){return _0x4d21d9[_0x19bc('0x37')]({'voicePause':![]});});case _0x19bc('0xfb'):case _0x19bc('0xfc'):case _0x19bc('0xfd'):case _0x19bc('0xfe'):case _0x19bc('0xff'):case _0x19bc('0x100'):return db[_0x19bc('0xee')][_0x19bc('0x45')]({'where':{'channel':_0x9be0a8[_0x19bc('0x6d')]['channel'],'membername':_0x4d21d9['name'],'type':_0x19bc('0xec'),'exitAt':null}})[_0x19bc('0x23')](function(_0x39e05b){if(_0x39e05b){return _0x39e05b['update']({'exitAt':moment()['format'](_0x19bc('0xe6')),'data2':_0x19bc('0xfa')},{'individualHooks':!![]});}return null;})[_0x19bc('0x23')](function(){var _0x597470={};_['set'](_0x597470,util[_0x19bc('0x78')]('%s%s',_0x9be0a8[_0x19bc('0x6d')][_0x19bc('0xaf')],_0x19bc('0x101')),![]);return _0x4d21d9[_0x19bc('0x37')](_0x597470);});default:return respondWithRpcPromise('QueuePause','unpause',{'id':_0x4d21d9['id'],'name':_0x4d21d9[_0x19bc('0x47')],'pause':![]})['then'](function(){return db[_0x19bc('0xb4')][_0x19bc('0x37')]({'paused':0x0},{'where':{'UserId':_0x4d21d9['id']}});})['then'](function(){return db[_0x19bc('0xee')][_0x19bc('0x64')]({'where':{'membername':_0x4d21d9[_0x19bc('0x47')],'type':_0x19bc('0xec'),'exitAt':null}});})['then'](function(_0x24451f){var _0x36aec8=[];_0x24451f[_0x19bc('0xe9')](function(_0x43053a){_0x36aec8['push'](_0x43053a[_0x19bc('0x37')]({'exitAt':moment()[_0x19bc('0x78')](_0x19bc('0xe6')),'data2':'manual'}));});return BPromise[_0x19bc('0xe7')](_0x36aec8);})[_0x19bc('0x23')](function(){return _0x4d21d9[_0x19bc('0x37')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x19bc('0x23')](respondWithResult(_0x500a99,null))[_0x19bc('0x66')](handleError(_0x500a99,null));};exports[_0x19bc('0x102')]=function(_0x1cb17a,_0x275a90,_0x5bf891){var _0x31f9a5={};var _0x55b123={};var _0x39b2b8;var _0x20d79a;return db[_0x19bc('0x4c')][_0x19bc('0xbf')]({'where':{'id':_0x1cb17a['params']['id']}})['then'](handleEntityNotFound(_0x275a90,null))['then'](function(_0x427120){if(_0x427120){_0x39b2b8=_0x427120;_0x55b123[_0x19bc('0x4f')]=_[_0x19bc('0x52')](db[_0x19bc('0x103')][_0x19bc('0x4d')]);_0x55b123[_0x19bc('0x51')]=_[_0x19bc('0x52')](_0x1cb17a[_0x19bc('0x51')]);_0x55b123[_0x19bc('0x53')]=_[_0x19bc('0x55')](_0x55b123[_0x19bc('0x4f')],_0x55b123[_0x19bc('0x51')]);_0x31f9a5[_0x19bc('0x54')]=_[_0x19bc('0x55')](_0x55b123['model'],qs['fields'](_0x1cb17a[_0x19bc('0x51')][_0x19bc('0x56')]));_0x31f9a5['attributes']=_0x31f9a5[_0x19bc('0x54')][_0x19bc('0x57')]?_0x31f9a5[_0x19bc('0x54')]:_0x55b123[_0x19bc('0x4f')];_0x31f9a5[_0x19bc('0x5a')]=qs[_0x19bc('0x5b')](_0x1cb17a[_0x19bc('0x51')]['sort']);_0x31f9a5[_0x19bc('0x5c')]=qs[_0x19bc('0x53')](_[_0x19bc('0x5d')](_0x1cb17a[_0x19bc('0x51')],_0x55b123[_0x19bc('0x53')]));if(_0x1cb17a[_0x19bc('0x51')][_0x19bc('0x40')]){_0x31f9a5['where']=_[_0x19bc('0x6b')](_0x31f9a5['where'],{'$or':_[_0x19bc('0x42')](_0x31f9a5[_0x19bc('0x54')],function(_0x4eb77c){var _0x22e0fe={};_0x22e0fe[_0x4eb77c]={'$like':'%'+_0x1cb17a[_0x19bc('0x51')][_0x19bc('0x40')]+'%'};return _0x22e0fe;})});}_0x31f9a5=_['merge']({},_0x31f9a5,_0x1cb17a[_0x19bc('0x62')]);return _0x39b2b8[_0x19bc('0x102')](_0x31f9a5);}})[_0x19bc('0x23')](function(_0x503970){if(_0x503970){_0x20d79a=_0x503970[_0x19bc('0x57')];if(!_0x1cb17a[_0x19bc('0x51')]['hasOwnProperty'](_0x19bc('0x59'))){_0x31f9a5[_0x19bc('0x31')]=qs[_0x19bc('0x31')](_0x1cb17a[_0x19bc('0x51')][_0x19bc('0x31')]);_0x31f9a5[_0x19bc('0x30')]=qs[_0x19bc('0x30')](_0x1cb17a[_0x19bc('0x51')][_0x19bc('0x30')]);}return _0x39b2b8[_0x19bc('0x102')](_0x31f9a5);}})[_0x19bc('0x23')](function(_0x5956ff){if(_0x5956ff){return _0x5956ff?{'count':_0x20d79a,'rows':_0x5956ff}:null;}})[_0x19bc('0x23')](respondWithResult(_0x275a90,null))[_0x19bc('0x66')](handleError(_0x275a90,null));};exports[_0x19bc('0x104')]=function(_0x213624,_0x528398){return db[_0x19bc('0x4c')]['find']({'where':{'id':_0x213624[_0x19bc('0x6f')]['id']}})[_0x19bc('0x23')](handleEntityNotFound(_0x528398,null))['then'](function(_0x513215){if(_0x513215){var _0x1e37f1=_0x513215['get']({'plain':!![]});return _0x513215[_0x19bc('0x104')](_0x213624[_0x19bc('0x6d')][_0x19bc('0x71')],_[_0x19bc('0x105')](_0x213624[_0x19bc('0x6d')],[_0x19bc('0x71'),'id'])||{})[_0x19bc('0x23')](function(){for(var _0x4689f7=0x0;_0x4689f7<_0x213624[_0x19bc('0x6d')][_0x19bc('0x71')]['length'];_0x4689f7++){var _0x5190da=[];db['Team'][_0x19bc('0xbf')]({'where':{'id':_0x213624[_0x19bc('0x6d')][_0x19bc('0x71')][_0x4689f7]}})[_0x19bc('0x23')](function(_0xe7673e){_0x5190da['push'](_0xe7673e[_0x19bc('0xe4')]()[_0x19bc('0x23')](function(_0x1334cb){for(var _0x458f29=0x0;_0x458f29<_0x1334cb[_0x19bc('0x57')];_0x458f29++){_0x1334cb[_0x458f29][_0x19bc('0x106')]('channel',_0x19bc('0x107'));}return _0x1334cb;}));_0x5190da[_0x19bc('0xab')](_0xe7673e[_0x19bc('0x108')]()[_0x19bc('0x23')](function(_0x4bf805){for(var _0x2cc8f1=0x0;_0x2cc8f1<_0x4bf805['length'];_0x2cc8f1++){_0x4bf805[_0x2cc8f1][_0x19bc('0x106')](_0x19bc('0xaf'),_0x19bc('0x109'));}return _0x4bf805;}));_0x5190da[_0x19bc('0xab')](_0xe7673e[_0x19bc('0x10a')]()[_0x19bc('0x23')](function(_0x174829){for(var _0x17c1ea=0x0;_0x17c1ea<_0x174829[_0x19bc('0x57')];_0x17c1ea++){_0x174829[_0x17c1ea][_0x19bc('0x106')]('channel',_0x19bc('0x10b'));}return _0x174829;}));_0x5190da['push'](_0xe7673e[_0x19bc('0x10c')]()[_0x19bc('0x23')](function(_0x3e64fc){for(var _0x5b4d1f=0x0;_0x5b4d1f<_0x3e64fc[_0x19bc('0x57')];_0x5b4d1f++){_0x3e64fc[_0x5b4d1f][_0x19bc('0x106')]('channel',_0x19bc('0x10d'));}return _0x3e64fc;}));_0x5190da[_0x19bc('0xab')](_0xe7673e[_0x19bc('0x10e')]()[_0x19bc('0x23')](function(_0x3fe72e){for(var _0x3d5b99=0x0;_0x3d5b99<_0x3fe72e[_0x19bc('0x57')];_0x3d5b99++){_0x3fe72e[_0x3d5b99][_0x19bc('0x106')]('channel',_0x19bc('0x10f'));}return _0x3fe72e;}));_0x5190da[_0x19bc('0xab')](_0xe7673e[_0x19bc('0x110')]()[_0x19bc('0x23')](function(_0x425fe9){for(var _0x3c4a76=0x0;_0x3c4a76<_0x425fe9['length'];_0x3c4a76++){_0x425fe9[_0x3c4a76][_0x19bc('0x106')](_0x19bc('0xaf'),'Fax');}return _0x425fe9;}));_0x5190da['push'](_0xe7673e[_0x19bc('0x111')]()['then'](function(_0x14566f){for(var _0x38ec63=0x0;_0x38ec63<_0x14566f[_0x19bc('0x57')];_0x38ec63++){_0x14566f[_0x38ec63]['setDataValue']('channel',_0x19bc('0x112'));}return _0x14566f;}));return BPromise['all'](_0x5190da);})[_0x19bc('0x23')](function(_0x4c53bb){var _0x5f1c79=_['flatten'](_0x4c53bb);_0x5190da=[];return db['sequelize'][_0x19bc('0x113')](function(_0x4f09c0){for(var _0x29445d=0x0;_0x29445d<_0x5f1c79['length'];_0x29445d++){_0x5190da[_0x19bc('0xab')](_0x5f1c79[_0x29445d]['addAgent'](_0x1e37f1['id']),{'transaction':_0x4f09c0});}return BPromise[_0x19bc('0xe7')](_0x5190da)[_0x19bc('0x23')](function(){if(_0x1e37f1[_0x19bc('0x9e')]){return BPromise[_0x19bc('0xac')](_[_0x19bc('0x40')](_0x5f1c79,function(_0x2cdca5){return _0x2cdca5[_0x19bc('0x114')](_0x19bc('0xaf'))===_0x19bc('0x107');}),function(_0x5ec1a7){return db[_0x19bc('0xb4')][_0x19bc('0xad')]({'membername':_0x1e37f1[_0x19bc('0x47')],'UserId':_0x1e37f1['id'],'queue_name':_0x5ec1a7[_0x19bc('0x47')],'VoiceQueueId':_0x5ec1a7['id'],'interface':_[_0x19bc('0x77')](_0x1e37f1['interface'])?util[_0x19bc('0x78')](_0x19bc('0xde'),_0x1e37f1[_0x19bc('0x47')]):_0x1e37f1['interface'],'paused':_0x1e37f1[_0x19bc('0xa0')]||![],'penalty':_0x1e37f1['penalty']},{'transaction':_0x4f09c0});});}else{return;}})[_0x19bc('0x23')](function(){for(var _0x21e40f=0x0;_0x21e40f<_0x5f1c79[_0x19bc('0x57')];_0x21e40f++){var _0x582d05=_0x5f1c79[_0x21e40f]['getDataValue']('channel');var _0x3550f1=_0x582d05+_0x19bc('0xb3');socket['emit'](_0x19bc('0x3b')+_0x582d05+'Queue:save',{'UserId':_0x1e37f1['id'],['queueField']:_0x5f1c79[_0x21e40f]['id']});}});});});}});}})[_0x19bc('0x23')](respondWithStatusCode(_0x528398,null))[_0x19bc('0x66')](handleError(_0x528398,null));};exports[_0x19bc('0x115')]=function(_0x189bdf,_0x5d6b0a){return db[_0x19bc('0x4c')][_0x19bc('0xbf')]({'where':{'id':_0x189bdf[_0x19bc('0x6f')]['id']}})[_0x19bc('0x23')](handleEntityNotFound(_0x5d6b0a,null))[_0x19bc('0x23')](function(_0x2f5f58){if(_0x2f5f58){var _0xb6262c=_0x2f5f58[_0x19bc('0x39')]({'plain':!![]});var _0x4a62c7=_0x189bdf[_0x19bc('0x51')]['ids'];return _0x2f5f58[_0x19bc('0x115')](_0x4a62c7)['then'](function(){for(var _0x39ac1d=0x0;_0x39ac1d<_0x4a62c7[_0x19bc('0x57')];_0x39ac1d++){var _0x4582d7=[];db[_0x19bc('0x103')][_0x19bc('0xbf')]({'where':{'id':_0x4a62c7[_0x39ac1d]}})[_0x19bc('0x23')](function(_0x1d247b){_0x4582d7[_0x19bc('0xab')](_0x1d247b[_0x19bc('0xe4')]()[_0x19bc('0x23')](function(_0x1e9f00){for(var _0x9fac4b=0x0;_0x9fac4b<_0x1e9f00[_0x19bc('0x57')];_0x9fac4b++){_0x1e9f00[_0x9fac4b][_0x19bc('0x106')](_0x19bc('0xaf'),_0x19bc('0x107'));}return _0x1e9f00;}));_0x4582d7[_0x19bc('0xab')](_0x1d247b[_0x19bc('0x108')]()[_0x19bc('0x23')](function(_0x5d13e1){for(var _0x5cdf48=0x0;_0x5cdf48<_0x5d13e1[_0x19bc('0x57')];_0x5cdf48++){_0x5d13e1[_0x5cdf48]['setDataValue']('channel','Chat');}return _0x5d13e1;}));_0x4582d7[_0x19bc('0xab')](_0x1d247b[_0x19bc('0x10a')]()[_0x19bc('0x23')](function(_0x3eaf4b){for(var _0x58b73e=0x0;_0x58b73e<_0x3eaf4b['length'];_0x58b73e++){_0x3eaf4b[_0x58b73e]['setDataValue']('channel',_0x19bc('0x10b'));}return _0x3eaf4b;}));_0x4582d7[_0x19bc('0xab')](_0x1d247b['getSmsQueues']()[_0x19bc('0x23')](function(_0x54d40e){for(var _0x267b2a=0x0;_0x267b2a<_0x54d40e[_0x19bc('0x57')];_0x267b2a++){_0x54d40e[_0x267b2a][_0x19bc('0x106')](_0x19bc('0xaf'),_0x19bc('0x10d'));}return _0x54d40e;}));_0x4582d7[_0x19bc('0xab')](_0x1d247b[_0x19bc('0x10e')]()[_0x19bc('0x23')](function(_0x532bb6){for(var _0x47f85b=0x0;_0x47f85b<_0x532bb6[_0x19bc('0x57')];_0x47f85b++){_0x532bb6[_0x47f85b][_0x19bc('0x106')]('channel','Whatsapp');}return _0x532bb6;}));_0x4582d7[_0x19bc('0xab')](_0x1d247b[_0x19bc('0x110')]()['then'](function(_0x47e46e){for(var _0x38d6b1=0x0;_0x38d6b1<_0x47e46e['length'];_0x38d6b1++){_0x47e46e[_0x38d6b1][_0x19bc('0x106')]('channel',_0x19bc('0x116'));}return _0x47e46e;}));_0x4582d7[_0x19bc('0xab')](_0x1d247b['getOpenchannelQueues']()[_0x19bc('0x23')](function(_0x5b0f92){for(var _0x10278c=0x0;_0x10278c<_0x5b0f92[_0x19bc('0x57')];_0x10278c++){_0x5b0f92[_0x10278c][_0x19bc('0x106')]('channel',_0x19bc('0x112'));}return _0x5b0f92;}));return BPromise[_0x19bc('0xe7')](_0x4582d7);})['then'](function(_0x30c341){var _0x1d0744=_['flatten'](_0x30c341);_0x4582d7=[];return db['sequelize'][_0x19bc('0x113')](function(_0xed2282){for(var _0x42ede9=0x0;_0x42ede9<_0x1d0744[_0x19bc('0x57')];_0x42ede9++){_0x4582d7[_0x19bc('0xab')](_0x1d0744[_0x42ede9]['removeAgent'](_0xb6262c['id']),{'transaction':_0xed2282});}return BPromise[_0x19bc('0xe7')](_0x4582d7)[_0x19bc('0x23')](function(){if(_0xb6262c[_0x19bc('0x9e')]){return BPromise[_0x19bc('0xac')](_['filter'](_0x1d0744,function(_0x315f46){return _0x315f46[_0x19bc('0x114')](_0x19bc('0xaf'))==='Voice';}),function(_0xf8d37){return db[_0x19bc('0xb4')][_0x19bc('0x38')]({'where':{'VoiceQueueId':_0xf8d37['id'],'UserId':_0xb6262c['id']},'transaction':_0xed2282});});}else{return;}})['then'](function(){for(var _0x12a58f=0x0;_0x12a58f<_0x1d0744[_0x19bc('0x57')];_0x12a58f++){var _0x2045c3=_0x1d0744[_0x12a58f]['getDataValue'](_0x19bc('0xaf'));var _0x3a9abc=_0x2045c3+_0x19bc('0xb3');socket[_0x19bc('0xa7')](_0x19bc('0x3b')+_0x2045c3+_0x19bc('0x117'),{'UserId':_0xb6262c['id'],['queueField']:_0x1d0744[_0x12a58f]['id']});}});});});}});}})[_0x19bc('0x23')](respondWithStatusCode(_0x5d6b0a,null))[_0x19bc('0x66')](handleError(_0x5d6b0a,null));};exports[_0x19bc('0x118')]=function(_0x50c8e2,_0x3718e3,_0x21cd6c){var _0x2c33b1={};var _0xb14f06={};var _0x35a1da;var _0x116fd4;return db[_0x19bc('0x4c')]['findOne']({'where':{'id':_0x50c8e2[_0x19bc('0x6f')]['id']}})['then'](handleEntityNotFound(_0x3718e3,null))[_0x19bc('0x23')](function(_0x4b88b5){if(_0x4b88b5){_0x35a1da=_0x4b88b5;_0xb14f06[_0x19bc('0x4f')]=_[_0x19bc('0x52')](db[_0x19bc('0xc1')][_0x19bc('0x4d')]);_0xb14f06[_0x19bc('0x51')]=_['keys'](_0x50c8e2['query']);_0xb14f06[_0x19bc('0x53')]=_[_0x19bc('0x55')](_0xb14f06[_0x19bc('0x4f')],_0xb14f06[_0x19bc('0x51')]);_0x2c33b1['attributes']=_[_0x19bc('0x55')](_0xb14f06[_0x19bc('0x4f')],qs[_0x19bc('0x56')](_0x50c8e2[_0x19bc('0x51')][_0x19bc('0x56')]));_0x2c33b1[_0x19bc('0x54')]=_0x2c33b1[_0x19bc('0x54')]['length']?_0x2c33b1[_0x19bc('0x54')]:_0xb14f06[_0x19bc('0x4f')];_0x2c33b1['order']=qs[_0x19bc('0x5b')](_0x50c8e2[_0x19bc('0x51')]['sort']);_0x2c33b1[_0x19bc('0x5c')]=qs[_0x19bc('0x53')](_[_0x19bc('0x5d')](_0x50c8e2['query'],_0xb14f06[_0x19bc('0x53')]));if(_0x50c8e2[_0x19bc('0x51')][_0x19bc('0x40')]){_0x2c33b1['where']=_[_0x19bc('0x6b')](_0x2c33b1[_0x19bc('0x5c')],{'$or':_['map'](_0x2c33b1[_0x19bc('0x54')],function(_0x314065){var _0x136d9c={};_0x136d9c[_0x314065]={'$like':'%'+_0x50c8e2[_0x19bc('0x51')][_0x19bc('0x40')]+'%'};return _0x136d9c;})});}_0x2c33b1=_[_0x19bc('0x6b')]({},_0x2c33b1,_0x50c8e2[_0x19bc('0x62')]);return _0x35a1da[_0x19bc('0x118')](_0x2c33b1);}})['then'](function(_0x5ea594){if(_0x5ea594){_0x116fd4=_0x5ea594[_0x19bc('0x57')];if(!_0x50c8e2[_0x19bc('0x51')]['hasOwnProperty'](_0x19bc('0x59'))){_0x2c33b1[_0x19bc('0x31')]=qs[_0x19bc('0x31')](_0x50c8e2[_0x19bc('0x51')]['limit']);_0x2c33b1[_0x19bc('0x30')]=qs[_0x19bc('0x30')](_0x50c8e2[_0x19bc('0x51')][_0x19bc('0x30')]);}return _0x35a1da[_0x19bc('0x118')](_0x2c33b1);}})['then'](function(_0x1ebeaa){if(_0x1ebeaa){return _0x1ebeaa?{'count':_0x116fd4,'rows':_0x1ebeaa}:null;}})['then'](respondWithResult(_0x3718e3,null))[_0x19bc('0x66')](handleError(_0x3718e3,null));};exports[_0x19bc('0x119')]=function(_0x45e363,_0x3802aa,_0x3e0bfb){var _0x3e5161={};var _0x23391d={};var _0x2778b7;var _0x485eff;return db[_0x19bc('0x4c')][_0x19bc('0xbf')]({'where':{'id':_0x45e363[_0x19bc('0x6f')]['id']}})['then'](handleEntityNotFound(_0x3802aa,null))[_0x19bc('0x23')](function(_0x5018f4){if(_0x5018f4){_0x2778b7=_0x5018f4;_0x23391d[_0x19bc('0x4f')]=_[_0x19bc('0x52')](db[_0x19bc('0x4c')][_0x19bc('0x4d')]);_0x23391d[_0x19bc('0x51')]=_[_0x19bc('0x52')](_0x45e363[_0x19bc('0x51')]);_0x23391d['filters']=_[_0x19bc('0x55')](_0x23391d['model'],_0x23391d[_0x19bc('0x51')]);_0x3e5161[_0x19bc('0x54')]=_['intersection'](_0x23391d['model'],qs['fields'](_0x45e363['query'][_0x19bc('0x56')]));_0x3e5161[_0x19bc('0x54')]=_0x3e5161[_0x19bc('0x54')][_0x19bc('0x57')]?_0x3e5161[_0x19bc('0x54')]:_0x23391d[_0x19bc('0x4f')];_0x3e5161[_0x19bc('0x5a')]=qs[_0x19bc('0x5b')](_0x45e363[_0x19bc('0x51')][_0x19bc('0x5b')]);_0x3e5161[_0x19bc('0x5c')]=qs['filters'](_['pick'](_0x45e363['query'],_0x23391d['filters']));if(_0x45e363[_0x19bc('0x51')][_0x19bc('0x40')]){_0x3e5161[_0x19bc('0x5c')]=_[_0x19bc('0x6b')](_0x3e5161[_0x19bc('0x5c')],{'$or':_['map'](_0x3e5161[_0x19bc('0x54')],function(_0x47ab22){var _0x1a90e6={};_0x1a90e6[_0x47ab22]={'$like':'%'+_0x45e363['query']['filter']+'%'};return _0x1a90e6;})});}_0x3e5161[_0x19bc('0x4f')]=db[_0x19bc('0x4c')];_0x3e5161['as']='Agents';_0x3e5161=_[_0x19bc('0x6b')]({},_0x3e5161,_0x45e363[_0x19bc('0x62')]);return _0x2778b7['getVoiceQueues']({'include':[_0x3e5161]});}})['then'](function(_0x4632e6){if(_0x4632e6){var _0x3b656c={},_0xaa2817=[],_0x49d264=0x0;for(var _0x4690e5=0x0;_0x4690e5<_0x4632e6['length'];_0x4690e5+=0x1){for(var _0x1983fb=0x0,_0x344c3d;_0x1983fb<_0x4632e6[_0x4690e5][_0x19bc('0x3c')]['length'];_0x1983fb+=0x1){_0x344c3d=_0x4632e6[_0x4690e5]['Agents'][_0x1983fb][_0x19bc('0x39')]({'plain':!![]});_0x3b656c[_0x344c3d['id']]=_0x344c3d;}}_0x3b656c=_[_0x19bc('0x11a')](_0x3b656c);for(var _0xaba81f=qs[_0x19bc('0x30')](_0x45e363[_0x19bc('0x51')][_0x19bc('0x30')]);_0xaba81f<_0x3b656c[_0x19bc('0x57')]&&_0xaa2817[_0x19bc('0x57')]=_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 +var _0x4c2f=['catch','ShowUser','User','PauseUser','name','role','interface','update','MemberReport','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','SIP/%s','body','internal','uniqueid','bulkCreate','type','DEFAULT\x20PAUSE','findOne','isValidChannel','channel','voice','UserVoiceQueueRt','find','mail','chat','fax','sms','system','%s%s','forEach','push','all','LogoutUser','destroy','LoginUser','mobile','phone','count','agent','../../config/license/util','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','loginInPause','merge','LOGININPAUSE','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./user.socket','register','request','then','User,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','result','findAll','options','raw','where','attributes','limit','include','map','model','GetUser'];(function(_0x2b1aae,_0x242c11){var _0x90613c=function(_0x3af711){while(--_0x3af711){_0x2b1aae['push'](_0x2b1aae['shift']());}};_0x90613c(++_0x242c11);}(_0x4c2f,0x19b));var _0xf4c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4c2f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xf4c2('0x0'));var moment=require(_0xf4c2('0x1'));var BPromise=require(_0xf4c2('0x2'));var rs=require(_0xf4c2('0x3'));var fs=require('fs');var Redis=require(_0xf4c2('0x4'));var db=require(_0xf4c2('0x5'))['db'];var utils=require(_0xf4c2('0x6'));var logger=require(_0xf4c2('0x7'))(_0xf4c2('0x8'));var config=require(_0xf4c2('0x9'));var jayson=require(_0xf4c2('0xa'));var client=jayson[_0xf4c2('0xb')][_0xf4c2('0xc')]({'port':0x232a});config['redis']=_[_0xf4c2('0xd')](config[_0xf4c2('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xf4c2('0xf'))(new Redis(config[_0xf4c2('0xe')]));require(_0xf4c2('0x10'))[_0xf4c2('0x11')](socket);function respondWithRpcPromise(_0x535928,_0x2e1d7c,_0x23eb63){return new BPromise(function(_0x1fa399,_0x3026c1){return client[_0xf4c2('0x12')](_0x535928,_0x23eb63)[_0xf4c2('0x13')](function(_0x5d78d6){logger['info'](_0xf4c2('0x14'),_0x2e1d7c,_0xf4c2('0x15'));logger[_0xf4c2('0x16')]('User,\x20%s,\x20%s,\x20%s',_0x2e1d7c,_0xf4c2('0x15'),JSON[_0xf4c2('0x17')](_0x5d78d6));if(_0x5d78d6['error']){if(_0x5d78d6['error'][_0xf4c2('0x18')]===0x1f4){logger[_0xf4c2('0x19')](_0xf4c2('0x14'),_0x2e1d7c,_0x5d78d6[_0xf4c2('0x19')][_0xf4c2('0x1a')]);return _0x3026c1(_0x5d78d6['error'][_0xf4c2('0x1a')]);}logger[_0xf4c2('0x19')](_0xf4c2('0x14'),_0x2e1d7c,_0x5d78d6[_0xf4c2('0x19')][_0xf4c2('0x1a')]);return _0x1fa399(_0x5d78d6[_0xf4c2('0x19')][_0xf4c2('0x1a')]);}else{logger[_0xf4c2('0x1b')]('User,\x20%s,\x20%s',_0x2e1d7c,'request\x20sent');_0x1fa399(_0x5d78d6[_0xf4c2('0x1c')][_0xf4c2('0x1a')]);}})['catch'](function(_0x40ca13){logger[_0xf4c2('0x19')]('User,\x20%s,\x20%s',_0x2e1d7c,_0x40ca13);_0x3026c1(_0x40ca13);});});}exports['GetUser']=function(_0x430ad3){var _0x21f12a=this;return new Promise(function(_0x104f44,_0xda236a){return db['User'][_0xf4c2('0x1d')]({'raw':_0x430ad3[_0xf4c2('0x1e')]?_0x430ad3[_0xf4c2('0x1e')][_0xf4c2('0x1f')]===undefined?!![]:![]:!![],'where':_0x430ad3['options']?_0x430ad3[_0xf4c2('0x1e')][_0xf4c2('0x20')]||null:null,'attributes':_0x430ad3[_0xf4c2('0x1e')]?_0x430ad3[_0xf4c2('0x1e')][_0xf4c2('0x21')]||null:null,'limit':_0x430ad3[_0xf4c2('0x1e')]?_0x430ad3['options'][_0xf4c2('0x22')]||null:null,'include':_0x430ad3[_0xf4c2('0x1e')]?_0x430ad3[_0xf4c2('0x1e')][_0xf4c2('0x23')]?_[_0xf4c2('0x24')](_0x430ad3['options']['include'],function(_0x55546b){return{'model':db[_0x55546b[_0xf4c2('0x25')]],'as':_0x55546b['as'],'attributes':_0x55546b[_0xf4c2('0x21')],'include':_0x55546b[_0xf4c2('0x23')]?_[_0xf4c2('0x24')](_0x55546b[_0xf4c2('0x23')],function(_0x10fdd0){return{'model':db[_0x10fdd0['model']],'as':_0x10fdd0['as'],'attributes':_0x10fdd0[_0xf4c2('0x21')],'include':_0x10fdd0[_0xf4c2('0x23')]?_[_0xf4c2('0x24')](_0x10fdd0['include'],function(_0x4e9a88){return{'model':db[_0x4e9a88[_0xf4c2('0x25')]],'as':_0x4e9a88['as'],'attributes':_0x4e9a88[_0xf4c2('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf4c2('0x13')](function(_0x11d2f9){logger[_0xf4c2('0x1b')](_0xf4c2('0x26'),_0x430ad3);logger[_0xf4c2('0x16')](_0xf4c2('0x26'),_0x430ad3,JSON[_0xf4c2('0x17')](_0x11d2f9));_0x104f44(_0x11d2f9);})[_0xf4c2('0x27')](function(_0x43a6f8){logger['error']('GetUser',_0x43a6f8[_0xf4c2('0x1a')],_0x430ad3);_0xda236a(_0x21f12a['error'](0x1f4,_0x43a6f8[_0xf4c2('0x1a')]));});});};exports[_0xf4c2('0x28')]=function(_0xfa0e91){var _0x223331=this;return new Promise(function(_0x4d4097,_0x518622){return db[_0xf4c2('0x29')]['find']({'raw':_0xfa0e91[_0xf4c2('0x1e')]?_0xfa0e91['options'][_0xf4c2('0x1f')]===undefined?!![]:![]:!![],'where':_0xfa0e91['options']?_0xfa0e91[_0xf4c2('0x1e')][_0xf4c2('0x20')]||null:null,'attributes':_0xfa0e91[_0xf4c2('0x1e')]?_0xfa0e91['options'][_0xf4c2('0x21')]||null:null,'include':_0xfa0e91[_0xf4c2('0x1e')]?_0xfa0e91['options'][_0xf4c2('0x23')]?_[_0xf4c2('0x24')](_0xfa0e91[_0xf4c2('0x1e')][_0xf4c2('0x23')],function(_0x416c95){return{'model':db[_0x416c95[_0xf4c2('0x25')]],'as':_0x416c95['as'],'attributes':_0x416c95[_0xf4c2('0x21')],'include':_0x416c95['include']?_[_0xf4c2('0x24')](_0x416c95['include'],function(_0xa85250){return{'model':db[_0xa85250[_0xf4c2('0x25')]],'as':_0xa85250['as'],'attributes':_0xa85250['attributes'],'include':_0xa85250[_0xf4c2('0x23')]?_[_0xf4c2('0x24')](_0xa85250[_0xf4c2('0x23')],function(_0x2ec6bd){return{'model':db[_0x2ec6bd[_0xf4c2('0x25')]],'as':_0x2ec6bd['as'],'attributes':_0x2ec6bd['attributes']};}):[]};}):[]};}):[]:[]})[_0xf4c2('0x13')](function(_0x35ca9b){logger[_0xf4c2('0x1b')]('ShowUser',_0xfa0e91);logger[_0xf4c2('0x16')](_0xf4c2('0x28'),_0xfa0e91,JSON[_0xf4c2('0x17')](_0x35ca9b));_0x4d4097(_0x35ca9b);})[_0xf4c2('0x27')](function(_0x28f641){logger[_0xf4c2('0x19')]('ShowUser',_0x28f641['message'],_0xfa0e91);_0x518622(_0x223331[_0xf4c2('0x19')](0x1f4,_0x28f641[_0xf4c2('0x1a')]));});});};exports[_0xf4c2('0x2a')]=function(_0x5b00c2){var _0x3354e5=this;return new Promise(function(_0x428c6b,_0x409074){var _0x313a35;return db['User']['find']({'where':_0x5b00c2[_0xf4c2('0x1e')][_0xf4c2('0x20')]||{},'attributes':['id',_0xf4c2('0x2b'),_0xf4c2('0x2c'),'internal',_0xf4c2('0x2d')]})[_0xf4c2('0x13')](function(_0x276d38){if(_0x276d38){_0x313a35=_0x276d38;return db['UserVoiceQueueRt'][_0xf4c2('0x2e')]({'paused':0x1},{'where':{'UserId':_0x313a35['id']},'individualHooks':!![]});}})[_0xf4c2('0x13')](function(){if(_0x313a35){return db[_0xf4c2('0x2f')][_0xf4c2('0x1d')]({'where':{'membername':_0x313a35['name'],'type':_0xf4c2('0x30'),'exitAt':null}});}})[_0xf4c2('0x13')](function(_0x8186e9){if(_0x313a35){if(_0x8186e9&&_0x8186e9[_0xf4c2('0x31')]){var _0x267a6f=moment()[_0xf4c2('0x32')](_0xf4c2('0x33'));for(var _0x49df24=0x0,_0x383865=_0x8186e9[_0xf4c2('0x31')];_0x49df24<_0x383865;_0x49df24++){_0x8186e9[_0x49df24][_0xf4c2('0x34')]({'exitAt':_0x267a6f});}}}})[_0xf4c2('0x13')](function(){if(_0x313a35){var _0x3185fa=[];var _0x41d753=utils[_0xf4c2('0x35')]();_0x41d753['forEach'](function(_0x2ad7ff){_0x3185fa['push']({'channel':_0x2ad7ff,'membername':_0x313a35[_0xf4c2('0x2b')],'interface':_['isNil'](_0x313a35[_0xf4c2('0x2d')])?util[_0xf4c2('0x32')](_0xf4c2('0x36'),_0x313a35['name']):_0x313a35[_0xf4c2('0x2d')],'type':_0xf4c2('0x30'),'enterAt':moment()[_0xf4c2('0x32')](_0xf4c2('0x33')),'data1':_0x5b00c2[_0xf4c2('0x37')]['type']||'DEFAULT\x20PAUSE','role':_0x313a35[_0xf4c2('0x2c')],'internal':_0x313a35[_0xf4c2('0x38')],'uniqueid':_0x5b00c2[_0xf4c2('0x37')][_0xf4c2('0x39')]||null});});return db[_0xf4c2('0x2f')][_0xf4c2('0x3a')](_0x3185fa,{'individualHooks':!![]});}})[_0xf4c2('0x13')](function(){if(_0x313a35){return _0x313a35[_0xf4c2('0x2e')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x5b00c2[_0xf4c2('0x37')][_0xf4c2('0x3b')]||_0xf4c2('0x3c'),'lastPauseAt':moment()[_0xf4c2('0x32')](_0xf4c2('0x33'))});}})[_0xf4c2('0x13')](function(_0x4abc3d){_0x428c6b(_0x4abc3d);})[_0xf4c2('0x27')](function(_0x150686){_0x409074(_0x3354e5['error'](0x1f4,_0x150686['message']));});});};exports['UnpauseUser']=function(_0x3b972f){var _0x3a7f39=this;return new Promise(function(_0x397229,_0x3a5674){var _0x2de5fd;return db['User'][_0xf4c2('0x3d')]({'where':_0x3b972f[_0xf4c2('0x1e')]['where']||{},'attributes':['id',_0xf4c2('0x2b')]})[_0xf4c2('0x13')](function(_0x3ba149){if(_0x3ba149){_0x2de5fd=_0x3ba149;if(_0x3b972f[_0xf4c2('0x37')]['channel']&&!utils[_0xf4c2('0x3e')](_0x3b972f[_0xf4c2('0x37')][_0xf4c2('0x3f')])){throw new Error('Unknown\x20channel');}switch(_0x3b972f[_0xf4c2('0x37')][_0xf4c2('0x3f')]){case _0xf4c2('0x40'):return db[_0xf4c2('0x41')][_0xf4c2('0x2e')]({'paused':0x0},{'where':{'UserId':_0x2de5fd['id']}})[_0xf4c2('0x13')](function(){return db[_0xf4c2('0x2f')][_0xf4c2('0x42')]({'where':{'channel':_0x3b972f['body'][_0xf4c2('0x3f')],'membername':_0x2de5fd['name'],'type':_0xf4c2('0x30'),'exitAt':null}});})['then'](function(_0x4df54f){if(_0x4df54f){return _0x4df54f[_0xf4c2('0x2e')]({'exitAt':moment()[_0xf4c2('0x32')](_0xf4c2('0x33')),'data2':'system'},{'individualHooks':!![]});}return null;})[_0xf4c2('0x13')](function(){return _0x2de5fd[_0xf4c2('0x2e')]({'voicePause':![]});});case _0xf4c2('0x43'):case _0xf4c2('0x44'):case _0xf4c2('0x45'):case _0xf4c2('0x46'):case'openchannel':return db[_0xf4c2('0x2f')][_0xf4c2('0x42')]({'where':{'channel':_0x3b972f[_0xf4c2('0x37')]['channel'],'membername':_0x2de5fd[_0xf4c2('0x2b')],'type':_0xf4c2('0x30'),'exitAt':null}})['then'](function(_0x3b6aa0){return _0x3b6aa0['update']({'exitAt':moment()['format'](_0xf4c2('0x33')),'data2':_0xf4c2('0x47')},{'individualHooks':!![]});})['then'](function(){var _0x5244a5={};_['set'](_0x5244a5,util[_0xf4c2('0x32')](_0xf4c2('0x48'),_0x3b972f[_0xf4c2('0x37')][_0xf4c2('0x3f')],'Pause'),![]);return _0x2de5fd[_0xf4c2('0x2e')](_0x5244a5);});default:return db[_0xf4c2('0x41')][_0xf4c2('0x2e')]({'paused':0x0},{'where':{'UserId':_0x2de5fd['id']}})[_0xf4c2('0x13')](function(){return db[_0xf4c2('0x2f')][_0xf4c2('0x1d')]({'where':{'membername':_0x2de5fd[_0xf4c2('0x2b')],'type':_0xf4c2('0x30'),'exitAt':null}});})[_0xf4c2('0x13')](function(_0x2af27d){var _0x3386ac=[];_0x2af27d[_0xf4c2('0x49')](function(_0x5b3f49){_0x3386ac[_0xf4c2('0x4a')](_0x5b3f49['update']({'exitAt':moment()['format'](_0xf4c2('0x33')),'data2':'system'}));});return BPromise[_0xf4c2('0x4b')](_0x3386ac);})[_0xf4c2('0x13')](function(){return _0x2de5fd[_0xf4c2('0x2e')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xf4c2('0x13')](function(_0x4b7b4f){_0x397229(_0x4b7b4f);})[_0xf4c2('0x27')](function(_0x58e511){_0x3a5674(_0x3a7f39[_0xf4c2('0x19')](0x1f4,_0x58e511[_0xf4c2('0x1a')]));});});};exports[_0xf4c2('0x4c')]=function(_0xfeb578){var _0x537b28=this;return new Promise(function(_0x462cb3,_0x443c19){var _0x3a2322;return db['User'][_0xf4c2('0x3d')]({'where':_0xfeb578[_0xf4c2('0x1e')][_0xf4c2('0x20')]||{},'attributes':['id',_0xf4c2('0x2b')]})['then'](function(_0x79cdb0){if(_0x79cdb0){_0x3a2322=_0x79cdb0;return db[_0xf4c2('0x41')][_0xf4c2('0x4d')]({'where':{'membername':_0x3a2322['name']},'individualHooks':!![]});}})[_0xf4c2('0x13')](function(){if(_0x3a2322){return db[_0xf4c2('0x2f')][_0xf4c2('0x1d')]({'where':{'membername':_0x3a2322[_0xf4c2('0x2b')],'exitAt':null}});}})[_0xf4c2('0x13')](function(_0x3dcaef){if(_0x3a2322){if(_0x3dcaef&&_0x3dcaef[_0xf4c2('0x31')]){var _0x14ce39=[];_0x3dcaef[_0xf4c2('0x49')](function(_0x60a3be){_0x14ce39[_0xf4c2('0x4a')](_0x60a3be[_0xf4c2('0x2e')]({'exitAt':moment()[_0xf4c2('0x32')](_0xf4c2('0x33'))}));});return BPromise['all'](_0x14ce39);}}})[_0xf4c2('0x13')](function(){if(_0x3a2322){return _0x3a2322[_0xf4c2('0x2e')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xf4c2('0x13')](function(_0x4370cf){_0x462cb3(_0x4370cf);})[_0xf4c2('0x27')](function(_0x372442){_0x443c19(_0x537b28[_0xf4c2('0x19')](0x1f4,_0x372442[_0xf4c2('0x1a')]));});});};exports[_0xf4c2('0x4e')]=function(_0x53943e){var _0x20ce05=this;return new Promise(function(_0x464649,_0x133062){var _0x5277a4;var _0x48eda8;var _0x1b73cb;var _0x426ae1;return db[_0xf4c2('0x29')][_0xf4c2('0x3d')]({'where':_0x53943e[_0xf4c2('0x1e')][_0xf4c2('0x20')]||{},'attributes':['id',_0xf4c2('0x2b'),_0xf4c2('0x2c'),_0xf4c2('0x4f'),_0xf4c2('0x50'),'internal','loginInPause',_0xf4c2('0x2d')]})[_0xf4c2('0x13')](function(_0x348dfb){if(_0x348dfb){_0x5277a4=_0x348dfb;_0x426ae1=_0x53943e[_0xf4c2('0x37')]['interface']?_0x53943e['body']['interface']:util[_0xf4c2('0x32')](_0xf4c2('0x36'),_0x5277a4['name']);return db['User'][_0xf4c2('0x51')]({'where':{'role':_0xf4c2('0x52'),'online':!![],'id':{'$ne':_0x5277a4['id']}}});}})[_0xf4c2('0x13')](function(_0x560ec2){if(_0x560ec2){_0x1b73cb=_0x560ec2;return require(_0xf4c2('0x53'))['getLicense']();}})[_0xf4c2('0x13')](function(_0x25440a){if(_0x25440a&&_0x25440a[_0xf4c2('0x54')]&&_0x1b73cb>=_0x25440a[_0xf4c2('0x54')]){throw new Error(_0xf4c2('0x55'));}})['then'](function(){if(_0x5277a4){return db[_0xf4c2('0x41')][_0xf4c2('0x4d')]({'where':{'membername':_0x5277a4[_0xf4c2('0x2b')]},'individualHooks':!![]});}})[_0xf4c2('0x13')](function(){if(_0x5277a4){return _0x5277a4['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x36c9be){if(_0x5277a4){if(_0x36c9be){var _0x2f8a25=[];_0x48eda8=_0x36c9be;if(_0x48eda8[_0xf4c2('0x31')]){for(var _0x46b50a=0x0;_0x46b50a<_0x48eda8[_0xf4c2('0x31')];_0x46b50a++){_0x2f8a25[_0xf4c2('0x4a')](db[_0xf4c2('0x41')][_0xf4c2('0x56')]({'membername':_0x5277a4[_0xf4c2('0x2b')],'UserId':_0x5277a4['id'],'queue_name':_0x48eda8[_0x46b50a][_0xf4c2('0x2b')],'VoiceQueueId':_0x48eda8[_0x46b50a]['id'],'interface':_0x426ae1,'paused':_0x5277a4[_0xf4c2('0x57')]||![],'penalty':_0x48eda8[_0x46b50a]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xf4c2('0x4b')](_0x2f8a25);}}}})[_0xf4c2('0x13')](function(){if(_0x5277a4){return db[_0xf4c2('0x2f')][_0xf4c2('0x1d')]({'where':{'membername':_0x5277a4[_0xf4c2('0x2b')],'exitAt':null}});}})[_0xf4c2('0x13')](function(_0x2c0f3d){if(_0x5277a4){if(_0x2c0f3d&&_0x2c0f3d[_0xf4c2('0x31')]){var _0x996a99=[];_0x2c0f3d['forEach'](function(_0x5b0246){_0x996a99[_0xf4c2('0x4a')](_0x5b0246['update']({'exitAt':moment()[_0xf4c2('0x32')](_0xf4c2('0x33'))}));});return BPromise['all'](_0x996a99);}}})[_0xf4c2('0x13')](function(_0x575dba){if(_0x5277a4){var _0x3fb926=[];var _0x1726ce=[];var _0x21017d=utils[_0xf4c2('0x35')]();var _0x23ba77={'membername':_0x5277a4['name'],'interface':_0x426ae1,'enterAt':moment()[_0xf4c2('0x32')](_0xf4c2('0x33')),'role':_0x5277a4[_0xf4c2('0x2c')],'internal':_0x5277a4[_0xf4c2('0x38')]};_0x21017d[_0xf4c2('0x49')](function(_0x16777d){_0x3fb926[_0xf4c2('0x4a')](_['merge']({'channel':_0x16777d,'type':'LOGIN','data1':'callysquare','data2':_0x426ae1},_0x23ba77));if(_0x5277a4[_0xf4c2('0x57')]){_0x1726ce[_0xf4c2('0x4a')](_[_0xf4c2('0x58')]({'channel':_0x16777d,'type':_0xf4c2('0x30'),'data1':_0xf4c2('0x59')},_0x23ba77));}});return db[_0xf4c2('0x2f')]['bulkCreate'](_0x3fb926['concat'](_0x1726ce),{'individualHooks':!![]});}})[_0xf4c2('0x13')](function(){if(_0x5277a4){return _0x5277a4[_0xf4c2('0x2e')]({'online':!![],'lastLoginAt':moment()[_0xf4c2('0x32')](_0xf4c2('0x33')),'voicePause':_0x5277a4['loginInPause']||![],'mailPause':_0x5277a4['loginInPause']||![],'chatPause':_0x5277a4[_0xf4c2('0x57')]||![],'faxPause':_0x5277a4[_0xf4c2('0x57')]||![],'smsPause':_0x5277a4[_0xf4c2('0x57')]||![],'openchannelPause':_0x5277a4[_0xf4c2('0x57')]||![],'pauseType':_0x5277a4[_0xf4c2('0x57')]?_0xf4c2('0x59'):null,'lastPauseAt':moment()[_0xf4c2('0x32')](_0xf4c2('0x33')),'interface':_0x426ae1});}})['then'](function(_0x2d0322){_0x464649(_0x2d0322);})['catch'](function(_0x95252c){_0x133062(_0x20ce05[_0xf4c2('0x19')](0x1f4,_0x95252c['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index d588a0c..722d186 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 _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 +var _0xe8fd=['user:','save','remove','update','emit','removeListener','register','length'];(function(_0x5cca9f,_0x154684){var _0x55edda=function(_0x115aa2){while(--_0x115aa2){_0x5cca9f['push'](_0x5cca9f['shift']());}};_0x55edda(++_0x154684);}(_0xe8fd,0xe9));var _0xde8f=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0xe8fd[_0x2f45ea];return _0x485a84;};'use strict';var UserEvents=require('./user.events');var events=[_0xde8f('0x0'),_0xde8f('0x1'),_0xde8f('0x2')];function createListener(_0x2c8099,_0x278302){return function(_0x513cae){_0x278302[_0xde8f('0x3')](_0x2c8099,_0x513cae);};}function removeListener(_0xa1c7fa,_0x525b58){return function(){UserEvents[_0xde8f('0x4')](_0xa1c7fa,_0x525b58);};}exports[_0xde8f('0x5')]=function(_0x252019){for(var _0x4f2579=0x0,_0x1f24a2=events[_0xde8f('0x6')];_0x4f2579<_0x1f24a2;_0x4f2579++){var _0x47cece=events[_0x4f2579];var _0x32e683=createListener(_0xde8f('0x7')+_0x47cece,_0x252019);UserEvents['on'](_0x47cece,_0x32e683);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index d2a5ea8..1e93f7b 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 _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 +var _0x0d65=['util','path','connect-timeout','../../components/auth/service','../../config/environment','multer'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x0d65,0xbf));var _0x50d6=function(_0x205c02,_0xb01941){_0x205c02=_0x205c02-0x0;var _0x380619=_0x0d65[_0x205c02];return _0x380619;};'use strict';var multer=require(_0x50d6('0x0'));var util=require(_0x50d6('0x1'));var path=require(_0x50d6('0x2'));var timeout=require(_0x50d6('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x50d6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x50d6('0x5'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 0e61840..77da947 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 _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 +var _0xd8b0=['exports','sequelize'];(function(_0x395b58,_0x23518d){var _0x43c80a=function(_0x4f5687){while(--_0x4f5687){_0x395b58['push'](_0x395b58['shift']());}};_0x43c80a(++_0x23518d);}(_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/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index d7430fb..7e42bd8 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 _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 +var _0x935e=['exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x935e,0x17e));var _0xe935=function(_0x1b7459,_0x33d46c){_0x1b7459=_0x1b7459-0x0;var _0x5d3b2d=_0x935e[_0x1b7459];return _0x5d3b2d;};'use strict';var _=require(_0xe935('0x0'));var util=require(_0xe935('0x1'));var logger=require(_0xe935('0x2'))(_0xe935('0x3'));var moment=require(_0xe935('0x4'));var BPromise=require('bluebird');var rp=require(_0xe935('0x5'));var fs=require('fs');var path=require(_0xe935('0x6'));var rimraf=require(_0xe935('0x7'));var config=require(_0xe935('0x8'));var attributes=require(_0xe935('0x9'));module[_0xe935('0xa')]=function(_0x1c99e3,_0x3da394){return _0x1c99e3[_0xe935('0xb')](_0xe935('0xc'),attributes,{'tableName':_0xe935('0xd'),'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 dd6caf8..f80164e 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 _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 +var _0xad53=['catch','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x2864b3,_0x1e5771){var _0x2c2049=function(_0x1c18a8){while(--_0x1c18a8){_0x2864b3['push'](_0x2864b3['shift']());}};_0x2c2049(++_0x1e5771);}(_0xad53,0x151));var _0x3ad5=function(_0x33c6cd,_0x447095){_0x33c6cd=_0x33c6cd-0x0;var _0x53f83c=_0xad53[_0x33c6cd];return _0x53f83c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3ad5('0x0'));var fs=require('fs');var Redis=require(_0x3ad5('0x1'));var db=require(_0x3ad5('0x2'))['db'];var utils=require(_0x3ad5('0x3'));var logger=require('../../config/logger')(_0x3ad5('0x4'));var config=require(_0x3ad5('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x3ad5('0x6')][_0x3ad5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4e91f0,_0xaffc90,_0x223665){return new BPromise(function(_0xe6d463,_0x279828){return client[_0x3ad5('0x8')](_0x4e91f0,_0x223665)[_0x3ad5('0x9')](function(_0x31cd8b){logger[_0x3ad5('0xa')](_0x3ad5('0xb'),_0xaffc90,_0x3ad5('0xc'));logger[_0x3ad5('0xd')](_0x3ad5('0xe'),_0xaffc90,_0x3ad5('0xc'),JSON[_0x3ad5('0xf')](_0x31cd8b));if(_0x31cd8b[_0x3ad5('0x10')]){if(_0x31cd8b[_0x3ad5('0x10')][_0x3ad5('0x11')]===0x1f4){logger[_0x3ad5('0x10')](_0x3ad5('0xb'),_0xaffc90,_0x31cd8b[_0x3ad5('0x10')][_0x3ad5('0x12')]);return _0x279828(_0x31cd8b[_0x3ad5('0x10')][_0x3ad5('0x12')]);}logger[_0x3ad5('0x10')](_0x3ad5('0xb'),_0xaffc90,_0x31cd8b['error'][_0x3ad5('0x12')]);return _0xe6d463(_0x31cd8b[_0x3ad5('0x10')][_0x3ad5('0x12')]);}else{logger[_0x3ad5('0xa')](_0x3ad5('0xb'),_0xaffc90,_0x3ad5('0xc'));_0xe6d463(_0x31cd8b[_0x3ad5('0x13')]['message']);}})[_0x3ad5('0x14')](function(_0x23b45e){logger[_0x3ad5('0x10')](_0x3ad5('0xb'),_0xaffc90,_0x23b45e);_0x279828(_0x23b45e);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 7816af9..edd3e13 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 _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 +var _0x3303=['exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x44ef29,_0x28b043){var _0x4a3ae6=function(_0x5b61eb){while(--_0x5b61eb){_0x44ef29['push'](_0x44ef29['shift']());}};_0x4a3ae6(++_0x28b043);}(_0x3303,0xb9));var _0x3330=function(_0x3bd935,_0x5bf0f6){_0x3bd935=_0x3bd935-0x0;var _0x1b03a2=_0x3303[_0x3bd935];return _0x1b03a2;};'use strict';var multer=require(_0x3330('0x0'));var util=require(_0x3330('0x1'));var path=require('path');var timeout=require(_0x3330('0x2'));var express=require(_0x3330('0x3'));var router=express[_0x3330('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3330('0x5'));var config=require(_0x3330('0x6'));module[_0x3330('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 99d772e..42978f0 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 _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 +var _0xdd4f=['sequelize','STRING'];(function(_0x5f23dd,_0x14156a){var _0x5d6ab8=function(_0x452286){while(--_0x452286){_0x5f23dd['push'](_0x5f23dd['shift']());}};_0x5d6ab8(++_0x14156a);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x5a2a20,_0x5682f6){_0x5a2a20=_0x5a2a20-0x0;var _0x16b967=_0xdd4f[_0x5a2a20];return _0x16b967;};'use strict';var Sequelize=require(_0xfdd4('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xfdd4('0x1')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 5b6770f..c4bacd0 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 _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 +var _0xe860=['UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define'];(function(_0x5d2d44,_0x2ee5ed){var _0xb82cd4=function(_0x2ab5d7){while(--_0x2ab5d7){_0x5d2d44['push'](_0x5d2d44['shift']());}};_0xb82cd4(++_0x2ee5ed);}(_0xe860,0x188));var _0x0e86=function(_0x351d56,_0x2c720a){_0x351d56=_0x351d56-0x0;var _0x26f405=_0xe860[_0x351d56];return _0x26f405;};'use strict';var _=require(_0x0e86('0x0'));var util=require(_0x0e86('0x1'));var logger=require(_0x0e86('0x2'))(_0x0e86('0x3'));var moment=require('moment');var BPromise=require(_0x0e86('0x4'));var rp=require(_0x0e86('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e86('0x6'));var config=require(_0x0e86('0x7'));var attributes=require(_0x0e86('0x8'));module[_0x0e86('0x9')]=function(_0xbc6b0f,_0x1dd265){return _0xbc6b0f[_0x0e86('0xa')](_0x0e86('0xb'),attributes,{'tableName':_0x0e86('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index aecd549..1fbd4df 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 _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 +var _0x677c=['client','http','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x9f48f6,_0x36c115){var _0x263acf=function(_0x16e474){while(--_0x16e474){_0x9f48f6['push'](_0x9f48f6['shift']());}};_0x263acf(++_0x36c115);}(_0x677c,0x187));var _0xc677=function(_0x12b929,_0xe53e68){_0x12b929=_0x12b929-0x0;var _0x2a67dd=_0x677c[_0x12b929];return _0x2a67dd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc677('0x0'));var BPromise=require(_0xc677('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc677('0x2'));var db=require(_0xc677('0x3'))['db'];var utils=require(_0xc677('0x4'));var logger=require(_0xc677('0x5'))('rpc');var config=require(_0xc677('0x6'));var jayson=require(_0xc677('0x7'));var client=jayson[_0xc677('0x8')][_0xc677('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f1f34,_0x59aced,_0x3a6e1b){return new BPromise(function(_0x1f430a,_0x5d99a3){return client['request'](_0x3f1f34,_0x3a6e1b)[_0xc677('0xa')](function(_0x2886b4){logger[_0xc677('0xb')](_0xc677('0xc'),_0x59aced,_0xc677('0xd'));logger[_0xc677('0xe')](_0xc677('0xf'),_0x59aced,_0xc677('0xd'),JSON[_0xc677('0x10')](_0x2886b4));if(_0x2886b4[_0xc677('0x11')]){if(_0x2886b4[_0xc677('0x11')][_0xc677('0x12')]===0x1f4){logger['error'](_0xc677('0xc'),_0x59aced,_0x2886b4[_0xc677('0x11')]['message']);return _0x5d99a3(_0x2886b4['error']['message']);}logger[_0xc677('0x11')](_0xc677('0xc'),_0x59aced,_0x2886b4[_0xc677('0x11')][_0xc677('0x13')]);return _0x1f430a(_0x2886b4[_0xc677('0x11')][_0xc677('0x13')]);}else{logger['info'](_0xc677('0xc'),_0x59aced,'request\x20sent');_0x1f430a(_0x2886b4[_0xc677('0x14')]['message']);}})['catch'](function(_0x32a2e7){logger[_0xc677('0x11')](_0xc677('0xc'),_0x59aced,_0x32a2e7);_0x5d99a3(_0x32a2e7);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 571b207..b5122d6 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 _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 +var _0x70c4=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2a1a31,_0x1b8b1a){var _0xe175e8=function(_0xa6f2c2){while(--_0xa6f2c2){_0x2a1a31['push'](_0x2a1a31['shift']());}};_0xe175e8(++_0x1b8b1a);}(_0x70c4,0x184));var _0x470c=function(_0x17071c,_0x406dd6){_0x17071c=_0x17071c-0x0;var _0x14440b=_0x70c4[_0x17071c];return _0x14440b;};'use strict';var multer=require(_0x470c('0x0'));var util=require(_0x470c('0x1'));var path=require(_0x470c('0x2'));var timeout=require(_0x470c('0x3'));var express=require(_0x470c('0x4'));var router=express[_0x470c('0x5')]();var auth=require(_0x470c('0x6'));var interaction=require(_0x470c('0x7'));var config=require('../../config/environment');module[_0x470c('0x8')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 0b672eb..7b1b370 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_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 +var _0xbaf0=['exports','INTEGER'];(function(_0x2b93a5,_0x31934c){var _0x4111dc=function(_0x3d4f71){while(--_0x3d4f71){_0x2b93a5['push'](_0x2b93a5['shift']());}};_0x4111dc(++_0x31934c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index e36fb7e..034999e 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 _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 +var _0xe706=['request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4f1fa6,_0x51e822){var _0x1573dc=function(_0x454adb){while(--_0x454adb){_0x4f1fa6['push'](_0x4f1fa6['shift']());}};_0x1573dc(++_0x51e822);}(_0xe706,0xa3));var _0x6e70=function(_0x3dc9bc,_0x77bc87){_0x3dc9bc=_0x3dc9bc-0x0;var _0x23a813=_0xe706[_0x3dc9bc];return _0x23a813;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index ad57437..e5ca611 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 _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 +var _0x2d06=['debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent'];(function(_0xafb8e6,_0x4b3a6b){var _0x36eec3=function(_0x30af02){while(--_0x30af02){_0xafb8e6['push'](_0xafb8e6['shift']());}};_0x36eec3(++_0x4b3a6b);}(_0x2d06,0x157));var _0x62d0=function(_0x1d5b3d,_0x5c7145){_0x1d5b3d=_0x1d5b3d-0x0;var _0xc810b9=_0x2d06[_0x1d5b3d];return _0xc810b9;};'use strict';var _=require('lodash');var util=require(_0x62d0('0x0'));var moment=require(_0x62d0('0x1'));var BPromise=require(_0x62d0('0x2'));var rs=require(_0x62d0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x62d0('0x4'))['db'];var utils=require(_0x62d0('0x5'));var logger=require(_0x62d0('0x6'))(_0x62d0('0x7'));var config=require('../../config/environment');var jayson=require(_0x62d0('0x8'));var client=jayson[_0x62d0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x377f3d,_0x43fd82,_0x508d82){return new BPromise(function(_0x264cd4,_0xc4dacc){return client[_0x62d0('0xa')](_0x377f3d,_0x508d82)[_0x62d0('0xb')](function(_0x482d16){logger['info'](_0x62d0('0xc'),_0x43fd82,_0x62d0('0xd'));logger[_0x62d0('0xe')](_0x62d0('0xf'),_0x43fd82,_0x62d0('0xd'),JSON[_0x62d0('0x10')](_0x482d16));if(_0x482d16[_0x62d0('0x11')]){if(_0x482d16[_0x62d0('0x11')][_0x62d0('0x12')]===0x1f4){logger[_0x62d0('0x11')](_0x62d0('0xc'),_0x43fd82,_0x482d16[_0x62d0('0x11')][_0x62d0('0x13')]);return _0xc4dacc(_0x482d16[_0x62d0('0x11')]['message']);}logger[_0x62d0('0x11')](_0x62d0('0xc'),_0x43fd82,_0x482d16[_0x62d0('0x11')]['message']);return _0x264cd4(_0x482d16[_0x62d0('0x11')][_0x62d0('0x13')]);}else{logger['info'](_0x62d0('0xc'),_0x43fd82,_0x62d0('0xd'));_0x264cd4(_0x482d16[_0x62d0('0x14')][_0x62d0('0x13')]);}})['catch'](function(_0x5a803c){logger[_0x62d0('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x43fd82,_0x5a803c);_0xc4dacc(_0x5a803c);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index f5ed1ae..2a860e8 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 _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 +var _0xeb58=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5b827f,_0x339f5f){var _0xf0672c=function(_0x1b8db1){while(--_0x1b8db1){_0x5b827f['push'](_0x5b827f['shift']());}};_0xf0672c(++_0x339f5f);}(_0xeb58,0x101));var _0x8eb5=function(_0x3902c1,_0x1c9eb2){_0x3902c1=_0x3902c1-0x0;var _0x1266cc=_0xeb58[_0x3902c1];return _0x1266cc;};'use strict';var multer=require(_0x8eb5('0x0'));var util=require(_0x8eb5('0x1'));var path=require(_0x8eb5('0x2'));var timeout=require(_0x8eb5('0x3'));var express=require(_0x8eb5('0x4'));var router=express[_0x8eb5('0x5')]();var auth=require(_0x8eb5('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x8eb5('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 56ffbc0..f8f0fe5 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(_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 +var _0xbaf0=['exports','INTEGER'];(function(_0x1e7701,_0x13fd0f){var _0x3ab707=function(_0x3c5242){while(--_0x3c5242){_0x1e7701['push'](_0x1e7701['shift']());}};_0x3ab707(++_0x13fd0f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index add84b2..28e0fac 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 _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 +var _0x9cad=['request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','api','moment','bluebird'];(function(_0x1cb73e,_0xce62f4){var _0x5c1e4c=function(_0x5cf8e3){while(--_0x5cf8e3){_0x1cb73e['push'](_0x1cb73e['shift']());}};_0x5c1e4c(++_0xce62f4);}(_0x9cad,0x12f));var _0xd9ca=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0x9cad[_0x16629d];return _0x56ccee;};'use strict';var _=require(_0xd9ca('0x0'));var util=require(_0xd9ca('0x1'));var logger=require('../../config/logger')(_0xd9ca('0x2'));var moment=require(_0xd9ca('0x3'));var BPromise=require(_0xd9ca('0x4'));var rp=require(_0xd9ca('0x5'));var fs=require('fs');var path=require(_0xd9ca('0x6'));var rimraf=require(_0xd9ca('0x7'));var config=require(_0xd9ca('0x8'));var attributes=require(_0xd9ca('0x9'));module[_0xd9ca('0xa')]=function(_0x3e02a4,_0xd8a0f3){return _0x3e02a4[_0xd9ca('0xb')](_0xd9ca('0xc'),attributes,{'tableName':_0xd9ca('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 680c145..aa6824f 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 _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 +var _0x510b=['randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','message','error','info','lodash','util','bluebird'];(function(_0x4e61a9,_0x42a30e){var _0x124703=function(_0x28ce23){while(--_0x28ce23){_0x4e61a9['push'](_0x4e61a9['shift']());}};_0x124703(++_0x42a30e);}(_0x510b,0x140));var _0xb510=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x510b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb510('0x0'));var util=require(_0xb510('0x1'));var moment=require('moment');var BPromise=require(_0xb510('0x2'));var rs=require(_0xb510('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb510('0x4'));var logger=require('../../config/logger')(_0xb510('0x5'));var config=require(_0xb510('0x6'));var jayson=require(_0xb510('0x7'));var client=jayson[_0xb510('0x8')][_0xb510('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14fb82,_0x55b393,_0x2e1e77){return new BPromise(function(_0x1d733a,_0xbc127a){return client['request'](_0x14fb82,_0x2e1e77)[_0xb510('0xa')](function(_0x54622e){logger['info'](_0xb510('0xb'),_0x55b393,_0xb510('0xc'));logger['debug'](_0xb510('0xd'),_0x55b393,'request\x20sent',JSON['stringify'](_0x54622e));if(_0x54622e['error']){if(_0x54622e['error']['code']===0x1f4){logger['error'](_0xb510('0xb'),_0x55b393,_0x54622e['error'][_0xb510('0xe')]);return _0xbc127a(_0x54622e[_0xb510('0xf')][_0xb510('0xe')]);}logger[_0xb510('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x55b393,_0x54622e[_0xb510('0xf')][_0xb510('0xe')]);return _0x1d733a(_0x54622e[_0xb510('0xf')][_0xb510('0xe')]);}else{logger[_0xb510('0x10')](_0xb510('0xb'),_0x55b393,_0xb510('0xc'));_0x1d733a(_0x54622e['result'][_0xb510('0xe')]);}})['catch'](function(_0x4c252a){logger[_0xb510('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x55b393,_0x4c252a);_0xbc127a(_0x4c252a);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index f9f5023..909c10d 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 _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 +var _0x61b9=['delete','destroy','removeSections','removeResources','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./userProfile.controller','isAuthenticated','index','get','/describe','describe','/:id','show','getSections','create','clone','post','addSections','put','update'];(function(_0x15c21d,_0x32c628){var _0x294b0b=function(_0x35b90f){while(--_0x35b90f){_0x15c21d['push'](_0x15c21d['shift']());}};_0x294b0b(++_0x32c628);}(_0x61b9,0x1f3));var _0x961b=function(_0x49a57c,_0x2eb02c){_0x49a57c=_0x49a57c-0x0;var _0x4e0316=_0x61b9[_0x49a57c];return _0x4e0316;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x961b('0x0'));var timeout=require(_0x961b('0x1'));var express=require(_0x961b('0x2'));var router=express[_0x961b('0x3')]();var auth=require(_0x961b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x961b('0x5'));var controller=require(_0x961b('0x6'));router['get']('/',auth[_0x961b('0x7')](),controller[_0x961b('0x8')]);router[_0x961b('0x9')](_0x961b('0xa'),auth[_0x961b('0x7')](),controller[_0x961b('0xb')]);router[_0x961b('0x9')](_0x961b('0xc'),auth[_0x961b('0x7')](),controller[_0x961b('0xd')]);router[_0x961b('0x9')]('/:id/sections',auth[_0x961b('0x7')](),controller[_0x961b('0xe')]);router[_0x961b('0x9')]('/:id/resources',auth['isAuthenticated'](),controller['getResources']);router['post']('/',auth[_0x961b('0x7')](),controller[_0x961b('0xf')]);router['post']('/:id/clone',auth[_0x961b('0x7')](),controller[_0x961b('0x10')]);router[_0x961b('0x11')]('/:id/sections',auth['isAuthenticated'](),controller[_0x961b('0x12')]);router[_0x961b('0x11')]('/:id/resources',auth[_0x961b('0x7')](),controller['addResources']);router[_0x961b('0x13')]('/:id',auth[_0x961b('0x7')](),controller[_0x961b('0x14')]);router[_0x961b('0x15')](_0x961b('0xc'),auth[_0x961b('0x7')](),controller[_0x961b('0x16')]);router[_0x961b('0x15')]('/:id/sections',auth[_0x961b('0x7')](),controller[_0x961b('0x17')]);router[_0x961b('0x15')]('/:id/resources',auth[_0x961b('0x7')](),controller[_0x961b('0x18')]);module[_0x961b('0x19')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 8e66ab6..f971561 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 _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 +var _0x7c80=['join','getDataValue','crudPermissions','sequelize','exports','STRING','setDataValue'];(function(_0x10a212,_0x579d85){var _0x23c82b=function(_0x412ea9){while(--_0x412ea9){_0x10a212['push'](_0x10a212['shift']());}};_0x23c82b(++_0x579d85);}(_0x7c80,0xa4));var _0x07c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c80[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x07c8('0x0'));module[_0x07c8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x07c8('0x2')],'set':function(_0x17fa86){this[_0x07c8('0x3')]('crudPermissions',_0x17fa86?_0x17fa86[_0x07c8('0x4')](''):[]);},'get':function(){return this[_0x07c8('0x5')](_0x07c8('0x6'))?this['getDataValue'](_0x07c8('0x6'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 5a218a9..80f3d68 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 _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 +var _0xf4a5=['autoAssociation','UserProfileResource','userProfileId','Resources','describe','addSections','sequelize','UserProfileSection','sectionId','ids','getSections','enabled','includes','isEmpty','subsections','push','findOne','forEach','resourceId','addResources','bulkCreate','removeResources','getResources','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','Invalid\x20section\x20\x27','parentSections','all','ignore','order','field','AnalyticExtractedReport','associatedResources','foreignKey','reportType','default','custom','CustomReports','CmContact','Tags','color','tag','Tag','ThroughTags','value','toLowerCase','squareprojects','SquareProject','odbc','squarerecordings','SquareProjects','projectName','JscriptyProject','contacts','Lists','ListId','CmList','companies','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','internalroutes','contexts','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','customdashboards','intervals','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','templates','Template','triggers','Trigger','trunks','variables','Plugin','extractedreports','Reports','metrics','AnalyticMetric','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','localhost','socket.io-emitter','register','sendStatus','count','offset','limit','status','set','Content-Range','apply','save','update','destroy','then','end','error','stack','name','send','map','UserProfile','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','clone','get','omit','createdAt','updatedAt','transaction','each'];(function(_0x1b6e23,_0x3b3563){var _0x36205b=function(_0x8621a9){while(--_0x8621a9){_0x1b6e23['push'](_0x1b6e23['shift']());}};_0x36205b(++_0x3b3563);}(_0xf4a5,0x186));var _0x5f4a=function(_0x19fc44,_0x4bca56){_0x19fc44=_0x19fc44-0x0;var _0x3414ec=_0xf4a5[_0x19fc44];return _0x3414ec;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5f4a('0x0'));var rimraf=require(_0x5f4a('0x1'));var zipdir=require(_0x5f4a('0x2'));var jsonpatch=require(_0x5f4a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5f4a('0x4'));var util=require(_0x5f4a('0x5'));var path=require('path');var sox=require(_0x5f4a('0x6'));var csv=require(_0x5f4a('0x7'));var ejs=require(_0x5f4a('0x8'));var fs=require('fs');var _=require(_0x5f4a('0x9'));var squel=require('squel');var crypto=require(_0x5f4a('0xa'));var jsforce=require(_0x5f4a('0xb'));var deskjs=require(_0x5f4a('0xc'));var toCsv=require(_0x5f4a('0x7'));var querystring=require(_0x5f4a('0xd'));var Papa=require(_0x5f4a('0xe'));var Redis=require('ioredis');var authService=require(_0x5f4a('0xf'));var qs=require(_0x5f4a('0x10'));var as=require(_0x5f4a('0x11'));var hardwareService=require(_0x5f4a('0x12'));var logger=require('../../config/logger')(_0x5f4a('0x13'));var utils=require(_0x5f4a('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x5f4a('0x15')]=_['defaults'](config[_0x5f4a('0x15')],{'host':_0x5f4a('0x16'),'port':0x18eb});var socket=require(_0x5f4a('0x17'))(new Redis(config[_0x5f4a('0x15')]));require('./userProfile.socket')[_0x5f4a('0x18')](socket);function respondWithStatusCode(_0x2525b1,_0x5b4134){_0x5b4134=_0x5b4134||0xcc;return function(_0x4e2ef4){if(_0x4e2ef4){return _0x2525b1[_0x5f4a('0x19')](_0x5b4134);}return _0x2525b1['status'](_0x5b4134)['end']();};}function respondWithResult(_0x18781d,_0x530f04){_0x530f04=_0x530f04||0xc8;return function(_0x1c00ea){if(_0x1c00ea){return _0x18781d['status'](_0x530f04)['json'](_0x1c00ea);}};}function respondWithFilteredResult(_0x116a86,_0x2a7c83){return function(_0x38abf9){if(_0x38abf9){var _0x3b46ca=_0x38abf9[_0x5f4a('0x1a')],_0x41e4c8=_0x2a7c83[_0x5f4a('0x1b')],_0x44881b=_0x2a7c83[_0x5f4a('0x1b')]+_0x2a7c83[_0x5f4a('0x1c')],_0xabfe72;if(_0x44881b>=_0x3b46ca){_0x44881b=_0x3b46ca;_0xabfe72=0xc8;}else{_0xabfe72=0xce;}_0x116a86[_0x5f4a('0x1d')](_0xabfe72);return _0x116a86[_0x5f4a('0x1e')](_0x5f4a('0x1f'),_0x41e4c8+'-'+_0x44881b+'/'+_0x3b46ca)['json'](_0x38abf9);}return null;};}function patchUpdates(_0x2fb164){return function(_0x4fce70){try{jsonpatch[_0x5f4a('0x20')](_0x4fce70,_0x2fb164,!![]);}catch(_0x262c62){return BPromise['reject'](_0x262c62);}return _0x4fce70[_0x5f4a('0x21')]();};}function saveUpdates(_0xcd6725,_0x34d8fa){return function(_0xa724ce){if(_0xa724ce){return _0xa724ce[_0x5f4a('0x22')](_0xcd6725)['then'](function(_0x8cbc2d){return _0x8cbc2d;});}return null;};}function removeEntity(_0x18a558,_0x25f4ae){return function(_0x2f8614){if(_0x2f8614){return _0x2f8614[_0x5f4a('0x23')]()[_0x5f4a('0x24')](function(){_0x18a558['status'](0xcc)[_0x5f4a('0x25')]();});}};}function handleEntityNotFound(_0x334967,_0x5f3184){return function(_0x2ab16c){if(!_0x2ab16c){_0x334967['sendStatus'](0x194);}return _0x2ab16c;};}function handleError(_0x4bcd08,_0x46edfb){_0x46edfb=_0x46edfb||0x1f4;return function(_0x34c40e){logger[_0x5f4a('0x26')](_0x34c40e[_0x5f4a('0x27')]);if(_0x34c40e[_0x5f4a('0x28')]){delete _0x34c40e[_0x5f4a('0x28')];}_0x4bcd08[_0x5f4a('0x1d')](_0x46edfb)[_0x5f4a('0x29')](_0x34c40e);};}exports['index']=function(_0x4709aa,_0x459569){var _0x247099={},_0x1aa6fb={},_0x4c28d0={'count':0x0,'rows':[]};var _0x43a97f=_[_0x5f4a('0x2a')](db[_0x5f4a('0x2b')]['rawAttributes'],function(_0x15bc83){return{'name':_0x15bc83[_0x5f4a('0x2c')],'type':_0x15bc83[_0x5f4a('0x2d')][_0x5f4a('0x2e')]};});_0x1aa6fb[_0x5f4a('0x2f')]=_[_0x5f4a('0x2a')](_0x43a97f,_0x5f4a('0x28'));_0x1aa6fb['query']=_['keys'](_0x4709aa[_0x5f4a('0x30')]);_0x1aa6fb[_0x5f4a('0x31')]=_[_0x5f4a('0x32')](_0x1aa6fb[_0x5f4a('0x2f')],_0x1aa6fb[_0x5f4a('0x30')]);_0x247099[_0x5f4a('0x33')]=_[_0x5f4a('0x32')](_0x1aa6fb[_0x5f4a('0x2f')],qs[_0x5f4a('0x34')](_0x4709aa[_0x5f4a('0x30')][_0x5f4a('0x34')]));_0x247099[_0x5f4a('0x33')]=_0x247099['attributes'][_0x5f4a('0x35')]?_0x247099['attributes']:_0x1aa6fb[_0x5f4a('0x2f')];if(!_0x4709aa[_0x5f4a('0x30')][_0x5f4a('0x36')](_0x5f4a('0x37'))){_0x247099[_0x5f4a('0x1c')]=qs[_0x5f4a('0x1c')](_0x4709aa[_0x5f4a('0x30')]['limit']);_0x247099[_0x5f4a('0x1b')]=qs[_0x5f4a('0x1b')](_0x4709aa[_0x5f4a('0x30')][_0x5f4a('0x1b')]);}_0x247099['order']=qs[_0x5f4a('0x38')](_0x4709aa[_0x5f4a('0x30')][_0x5f4a('0x38')]);_0x247099[_0x5f4a('0x39')]=qs[_0x5f4a('0x31')](_[_0x5f4a('0x3a')](_0x4709aa[_0x5f4a('0x30')],_0x1aa6fb['filters']),_0x43a97f);if(_0x4709aa[_0x5f4a('0x30')][_0x5f4a('0x3b')]){_0x247099['where']=_[_0x5f4a('0x3c')](_0x247099['where'],{'$or':_[_0x5f4a('0x2a')](_0x43a97f,function(_0x3151ba){if(_0x3151ba[_0x5f4a('0x2d')]!==_0x5f4a('0x3d')){var _0x21a697={};_0x21a697[_0x3151ba['name']]={'$like':'%'+_0x4709aa[_0x5f4a('0x30')][_0x5f4a('0x3b')]+'%'};return _0x21a697;}})});}_0x247099=_[_0x5f4a('0x3c')]({},_0x247099,_0x4709aa[_0x5f4a('0x3e')]);var _0x38578e={'where':_0x247099[_0x5f4a('0x39')]};return db[_0x5f4a('0x2b')][_0x5f4a('0x1a')](_0x38578e)[_0x5f4a('0x24')](function(_0xdc35c7){_0x4c28d0[_0x5f4a('0x1a')]=_0xdc35c7;if(_0x4709aa[_0x5f4a('0x30')][_0x5f4a('0x3f')]){_0x247099[_0x5f4a('0x40')]=[{'all':!![]}];}return db[_0x5f4a('0x2b')][_0x5f4a('0x41')](_0x247099);})['then'](function(_0x2ae3a2){_0x4c28d0[_0x5f4a('0x42')]=_0x2ae3a2;return _0x4c28d0;})[_0x5f4a('0x24')](respondWithFilteredResult(_0x459569,_0x247099))[_0x5f4a('0x43')](handleError(_0x459569,null));};exports[_0x5f4a('0x44')]=function(_0x446c05,_0x184e75){var _0xe2bfb6={'raw':![],'where':{'id':_0x446c05[_0x5f4a('0x45')]['id']}},_0x288568={};_0x288568[_0x5f4a('0x2f')]=_[_0x5f4a('0x46')](db[_0x5f4a('0x2b')][_0x5f4a('0x47')]);_0x288568[_0x5f4a('0x30')]=_['keys'](_0x446c05[_0x5f4a('0x30')]);_0x288568[_0x5f4a('0x31')]=_[_0x5f4a('0x32')](_0x288568[_0x5f4a('0x2f')],_0x288568[_0x5f4a('0x30')]);_0xe2bfb6[_0x5f4a('0x33')]=_['intersection'](_0x288568[_0x5f4a('0x2f')],qs[_0x5f4a('0x34')](_0x446c05[_0x5f4a('0x30')][_0x5f4a('0x34')]));_0xe2bfb6['attributes']=_0xe2bfb6[_0x5f4a('0x33')]['length']?_0xe2bfb6['attributes']:_0x288568[_0x5f4a('0x2f')];if(_0x446c05[_0x5f4a('0x30')]['includeAll']){_0xe2bfb6[_0x5f4a('0x40')]=[{'all':!![]}];}_0xe2bfb6=_['merge']({},_0xe2bfb6,_0x446c05[_0x5f4a('0x3e')]);return db[_0x5f4a('0x2b')][_0x5f4a('0x48')](_0xe2bfb6)[_0x5f4a('0x24')](handleEntityNotFound(_0x184e75,null))[_0x5f4a('0x24')](respondWithResult(_0x184e75,null))['catch'](handleError(_0x184e75,null));};exports[_0x5f4a('0x49')]=function(_0x52ab64,_0x1e84d7){return db['UserProfile']['create'](_0x52ab64[_0x5f4a('0x4a')],{})[_0x5f4a('0x24')](respondWithResult(_0x1e84d7,0xc9))[_0x5f4a('0x43')](handleError(_0x1e84d7,null));};exports[_0x5f4a('0x4b')]=function(_0x4a2a99,_0x324d5c){var _0x57c870={'where':{'id':_0x4a2a99[_0x5f4a('0x45')]['id']}},_0x20e356={};_0x20e356[_0x5f4a('0x2f')]=_['keys'](db['UserProfile']['rawAttributes']);_0x57c870[_0x5f4a('0x33')]=_['intersection'](_0x20e356[_0x5f4a('0x2f')],qs[_0x5f4a('0x34')](_0x4a2a99[_0x5f4a('0x30')]['fields']));_0x57c870['attributes']=_0x57c870[_0x5f4a('0x33')][_0x5f4a('0x35')]?_0x57c870['attributes']:_0x20e356[_0x5f4a('0x2f')];if(_0x4a2a99[_0x5f4a('0x30')][_0x5f4a('0x3f')]){_0x57c870[_0x5f4a('0x40')]=[{'all':!![]}];}_0x57c870=_[_0x5f4a('0x3c')]({},_0x57c870,_0x4a2a99[_0x5f4a('0x3e')]);return db[_0x5f4a('0x2b')][_0x5f4a('0x48')](_0x57c870)[_0x5f4a('0x24')](handleEntityNotFound(_0x324d5c,null))['then'](function(_0x11b760){if(_0x11b760){var _0x516cbb=_0x11b760[_0x5f4a('0x4c')]({'plain':!![]});_0x516cbb=qs[_0x5f4a('0x4d')](_0x516cbb,['id',_0x5f4a('0x4e'),'updatedAt','crudPermissions']);_0x4a2a99['body']=_[_0x5f4a('0x4d')](_0x4a2a99[_0x5f4a('0x4a')],['id',_0x5f4a('0x4e'),_0x5f4a('0x4f')]);return db['sequelize'][_0x5f4a('0x50')](function(_0x25d3f0){return db['UserProfile'][_0x5f4a('0x49')](_[_0x5f4a('0x3c')](_0x516cbb,_0x4a2a99[_0x5f4a('0x4a')]),{'include':_0x4a2a99[_0x5f4a('0x30')][_0x5f4a('0x3f')]?[{'all':!![]}]:undefined,'transaction':_0x25d3f0})['then'](function(_0x3c5fef){var _0xa619f=_0x3c5fef[_0x5f4a('0x4c')]({'plain':!![]});return db['UserProfileSection'][_0x5f4a('0x41')]({'where':{'userProfileId':_0x4a2a99[_0x5f4a('0x45')]['id']},'raw':!![]})[_0x5f4a('0x24')](function(_0x3a5def){if(_0x3a5def){return BPromise[_0x5f4a('0x51')](_0x3a5def,function(_0x1c19ff){return new BPromise(function(_0x96c915,_0x5612a8){if(_0x1c19ff[_0x5f4a('0x52')]===null||_0x1c19ff[_0x5f4a('0x52')]===0x1)_0x96c915(null);return db[_0x5f4a('0x53')][_0x5f4a('0x41')]({'where':{'sectionId':_0x1c19ff['id']},'raw':!![]})[_0x5f4a('0x24')](function(_0x17be42){var _0x426c01=_[_0x5f4a('0x2a')](_0x17be42,function(_0x431eb7){return qs['omit'](_0x431eb7,['id',_0x5f4a('0x4e'),'updatedAt','sectionId']);});_0x96c915(_0x426c01);})[_0x5f4a('0x43')](function(_0x171422){_0x5612a8(_0x171422);});})[_0x5f4a('0x24')](function(_0x196cbe){var _0x5a8905=qs[_0x5f4a('0x4d')](_0x1c19ff,['id',_0x5f4a('0x4e'),'updatedAt']);_0x5a8905[_0x5f4a('0x54')]=_0xa619f['id'];if(_0x196cbe)_0x5a8905[_0x5f4a('0x55')]=_0x196cbe;return _0x5a8905;})[_0x5f4a('0x24')](function(_0x3f56c5){return db['UserProfileSection']['create'](_0x3f56c5,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x25d3f0});});})[_0x5f4a('0x24')](function(){return _0xa619f;});}});});});}})[_0x5f4a('0x24')](respondWithResult(_0x324d5c,0xc9))[_0x5f4a('0x43')](handleError(_0x324d5c,null));};exports[_0x5f4a('0x22')]=function(_0x12cda3,_0x50cd1f){if(_0x12cda3[_0x5f4a('0x4a')]['id']){delete _0x12cda3[_0x5f4a('0x4a')]['id'];}return db[_0x5f4a('0x2b')][_0x5f4a('0x48')]({'where':{'id':_0x12cda3[_0x5f4a('0x45')]['id']}})[_0x5f4a('0x24')](handleEntityNotFound(_0x50cd1f,null))[_0x5f4a('0x24')](saveUpdates(_0x12cda3[_0x5f4a('0x4a')],null))[_0x5f4a('0x24')](respondWithResult(_0x50cd1f,null))[_0x5f4a('0x43')](handleError(_0x50cd1f,null));};exports['destroy']=function(_0x48e4a1,_0x3dc521){return db['UserProfile'][_0x5f4a('0x48')]({'where':{'id':_0x48e4a1[_0x5f4a('0x45')]['id']}})['then'](handleEntityNotFound(_0x3dc521,null))['then'](removeEntity(_0x3dc521,null))[_0x5f4a('0x43')](handleError(_0x3dc521,null));};exports[_0x5f4a('0x56')]=function(_0x1bdd87,_0x4ba851){return db[_0x5f4a('0x2b')][_0x5f4a('0x56')]()['then'](respondWithResult(_0x4ba851,null))[_0x5f4a('0x43')](handleError(_0x4ba851,null));};exports[_0x5f4a('0x57')]=function(_0x569d76,_0xa4f304){var _0x5b83e4=_0x569d76[_0x5f4a('0x4a')];return db['UserProfile'][_0x5f4a('0x48')]({'where':{'id':_0x569d76['params']['id']}})['then'](handleEntityNotFound(_0xa4f304,null))['then'](function(_0x51f6fd){if(_0x51f6fd){return db[_0x5f4a('0x58')][_0x5f4a('0x50')](function(_0x47a3c8){return db[_0x5f4a('0x59')][_0x5f4a('0x23')]({'where':{'userProfileId':_0x569d76[_0x5f4a('0x45')]['id'],'sectionId':_[_0x5f4a('0x2a')](_0x5b83e4,function(_0x58f77d){return _0x58f77d[_0x5f4a('0x5a')];})},'transaction':_0x47a3c8})[_0x5f4a('0x24')](function(){var _0x4e1f45=_[_0x5f4a('0x2a')](_0x5b83e4,function(_0x2d071f){_0x2d071f[_0x5f4a('0x54')]=_0x569d76[_0x5f4a('0x45')]['id'];return _0x2d071f;});var _0x4e7cef=[];return BPromise[_0x5f4a('0x51')](_0x4e1f45,function(_0x154a81){return db[_0x5f4a('0x59')][_0x5f4a('0x49')](_0x154a81,{'include':[{'model':db['UserProfileResource'],'as':_0x5f4a('0x55')}],'raw':!![],'transaction':_0x47a3c8})[_0x5f4a('0x24')](function(_0x5e0d77){_0x4e7cef['push'](_0x5e0d77[_0x5f4a('0x4c')]({'plain':!![]}));});})[_0x5f4a('0x24')](function(){return _0x4e7cef;});});});}})['then'](function(_0x57bb2d){return _0x57bb2d;})[_0x5f4a('0x24')](respondWithResult(_0xa4f304,null))[_0x5f4a('0x43')](handleError(_0xa4f304,null));};exports['removeSections']=function(_0x30b432,_0x58b132){var _0x245b24;return db[_0x5f4a('0x2b')][_0x5f4a('0x48')]({'where':{'id':_0x30b432[_0x5f4a('0x45')]['id']},'attributes':['id',_0x5f4a('0x28')]})[_0x5f4a('0x24')](handleEntityNotFound(_0x58b132,null))[_0x5f4a('0x24')](function(_0x1889a2){if(_0x1889a2){_0x245b24=_0x1889a2;return db[_0x5f4a('0x59')][_0x5f4a('0x23')]({'where':{'userProfileId':_0x30b432['params']['id'],'sectionId':_0x30b432[_0x5f4a('0x30')][_0x5f4a('0x5b')]}});}})['then'](function(){return _0x245b24;})[_0x5f4a('0x24')](respondWithStatusCode(_0x58b132,null))[_0x5f4a('0x43')](handleError(_0x58b132,null));};exports[_0x5f4a('0x5c')]=function(_0x488b33,_0x55476e){var _0x7a048d=[];var _0xe256f4=[];return db[_0x5f4a('0x59')]['findAll']({'where':{'userProfileId':_0x488b33[_0x5f4a('0x45')]['id']},'raw':!![]})[_0x5f4a('0x24')](function(_0x2f7410){_0x7a048d=_[_0x5f4a('0x3b')](_0x2f7410,function(_0x26436f){return _0x26436f[_0x5f4a('0x5d')]===0x1||_[_0x5f4a('0x5e')]([0x3eb,0x709],_0x26436f[_0x5f4a('0x5a')]);});if(!_[_0x5f4a('0x5f')](_0x7a048d)){return _['map'](_0x7a048d,function(_0x1c5715){return _0x1c5715[_0x5f4a('0x5a')];});}else{return;}})['then'](function(_0x292397){if(_0x292397)_0xe256f4=_0x292397;if(_[_0x5f4a('0x5e')](_0xe256f4,0x64)){var _0x27ca6a=_['find'](_0x7a048d,{'sectionId':0x64});return hasDefaultDashboard(_0x27ca6a)[_0x5f4a('0x24')](function(_0x4593ab){return _[_0x5f4a('0x2a')](_0x7a048d,function(_0x3b7d2d){if(_0x3b7d2d['sectionId']===0x64){_0x3b7d2d[_0x5f4a('0x60')]=_0x4593ab;}return _0x3b7d2d;});});}else{return;}})['then'](function(_0x5e8d47){if(_0x5e8d47)_0x7a048d=_0x5e8d47;if(_[_0x5f4a('0x5e')](_0xe256f4,0x3eb)){var _0x1e8722=_['find'](_0x7a048d,{'sectionId':0x3eb});return getCustomDashboards(_0x1e8722)[_0x5f4a('0x24')](function(_0x16c163){return _[_0x5f4a('0x2a')](_0x7a048d,function(_0x33328a){if(_0x1e8722[_0x5f4a('0x5d')]){if(_0x33328a['sectionId']===0x3eb){_0x33328a['subsections']=_0x16c163;}}else{if(_0x33328a[_0x5f4a('0x5a')]===0x64){_0x33328a['subsections']=_0x16c163;}}return _0x33328a;});});}else{return;}})[_0x5f4a('0x24')](function(_0x24ae2e){if(_0x24ae2e)_0x7a048d=_0x24ae2e;if(_[_0x5f4a('0x5e')](_0xe256f4,0x709)){var _0x52b2fb=_[_0x5f4a('0x48')](_0x7a048d,{'sectionId':0x709});return getPlugins(_0x52b2fb)[_0x5f4a('0x24')](function(_0x343add){if(_0x52b2fb[_0x5f4a('0x5d')]){return _[_0x5f4a('0x2a')](_0x7a048d,function(_0x3d7189){if(_0x3d7189['sectionId']===0x709){_0x3d7189[_0x5f4a('0x60')]=_0x343add;}return _0x3d7189;});}else{var _0x52bb41={'sectionId':0x76c,'enabled':0x1,'subsections':_0x343add};var _0x191e1f=_['map'](_0x7a048d);_0x191e1f[_0x5f4a('0x61')](_0x52bb41);return _0x191e1f;}});}else{return;}})['then'](function(_0x11506b){if(_0x11506b)_0x7a048d=_0x11506b;return _['filter'](_0x7a048d,[_0x5f4a('0x5d'),0x1]);})[_0x5f4a('0x24')](respondWithResult(_0x55476e,null))[_0x5f4a('0x43')](handleError(_0x55476e,null));};function hasDefaultDashboard(_0x11f163){var _0x5bbc15=[0x65];return new BPromise(function(_0x2c9ce3,_0xe94459){try{if(_0x11f163['autoAssociation']){_0x2c9ce3(_0x5bbc15);}else{return db[_0x5f4a('0x53')][_0x5f4a('0x62')]({'where':{'sectionId':_0x11f163['id']},'raw':!![]})[_0x5f4a('0x24')](function(_0x58c4bf){_0x58c4bf?_0x2c9ce3(_0x5bbc15):_0x2c9ce3();});}}catch(_0x3379d2){_0xe94459(_0x3379d2);}});}function getCustomDashboards(_0x584da4){var _0x5df52e=[];return new BPromise(function(_0x3a353d,_0x519e76){try{if(_0x584da4[_0x5f4a('0x52')]){return db['Dashboard'][_0x5f4a('0x41')]({'raw':!![]})[_0x5f4a('0x24')](function(_0x49f902){_0x49f902[_0x5f4a('0x63')](function(_0xdba1ac){_0x5df52e[_0x5f4a('0x61')](_0xdba1ac['id']+0x1869f);});_0x3a353d(_0x5df52e);});}else{return db[_0x5f4a('0x53')]['findAll']({'where':{'sectionId':_0x584da4['id']},'raw':!![]})[_0x5f4a('0x24')](function(_0x128c0f){_0x128c0f[_0x5f4a('0x63')](function(_0x19ffc3){_0x5df52e[_0x5f4a('0x61')](_0x19ffc3[_0x5f4a('0x64')]+0x1869f);});_0x3a353d(_0x5df52e);});}}catch(_0x521219){_0x519e76(_0x521219);}});}function getPlugins(_0x5081d1){var _0x227bd5=[];return new BPromise(function(_0x36aee7,_0x2ef293){try{if(_0x5081d1[_0x5f4a('0x52')]){return db['Plugin'][_0x5f4a('0x41')]({'raw':!![]})['then'](function(_0x840260){_0x840260[_0x5f4a('0x63')](function(_0x18311b){_0x227bd5[_0x5f4a('0x61')](_0x18311b['id']+0x15b38);});_0x36aee7(_0x227bd5);});}else{return db[_0x5f4a('0x53')][_0x5f4a('0x41')]({'where':{'sectionId':_0x5081d1['id']},'raw':!![]})['then'](function(_0x5d3e98){_0x5d3e98[_0x5f4a('0x63')](function(_0x270616){_0x227bd5[_0x5f4a('0x61')](_0x270616[_0x5f4a('0x64')]+0x15b38);});_0x36aee7(_0x227bd5);});}}catch(_0x3bbab4){_0x2ef293(_0x3bbab4);}});}exports[_0x5f4a('0x65')]=function(_0x13a514,_0x3553ec){return db[_0x5f4a('0x2b')][_0x5f4a('0x48')]({'where':{'id':_0x13a514[_0x5f4a('0x45')]['id']}})['then'](handleEntityNotFound(_0x3553ec,null))[_0x5f4a('0x24')](function(_0xddb8a7){if(_0xddb8a7){return db[_0x5f4a('0x58')][_0x5f4a('0x50')](function(_0x3e7c9d){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x13a514[_0x5f4a('0x45')]['id']},'attributes':['id'],'raw':!![]})[_0x5f4a('0x24')](function(_0x136337){if(_0x136337){return db[_0x5f4a('0x59')]['destroy']({'where':{'userProfileId':_0x13a514[_0x5f4a('0x45')]['id'],'id':_['map'](_0x136337,function(_0xe24d60){return _0xe24d60['id'];})},'transaction':_0x3e7c9d});}})['then'](function(_0x1b8f6f){var _0x3cf35f=_[_0x5f4a('0x2a')](_0x13a514[_0x5f4a('0x4a')],function(_0x238c43){_0x238c43['userProfileId']=_0x13a514[_0x5f4a('0x45')]['id'];return _0x238c43;});return db['UserProfileSection'][_0x5f4a('0x66')](_0x3cf35f,{'raw':!![],'transaction':_0x3e7c9d});})[_0x5f4a('0x24')](function(_0x3b613e){var _0x1164af=_['filter'](_['map'](_0x3b613e,function(_0x23715b){return _0x23715b[_0x5f4a('0x4c')]({'plain':!![]});}),{'includeAll':![]});if(_0x1164af){return db[_0x5f4a('0x59')][_0x5f4a('0x41')]({'where':{'userProfileId':_0x13a514[_0x5f4a('0x45')]['id'],'sectionId':_[_0x5f4a('0x2a')](_0x1164af,function(_0x14b527){return _0x14b527[_0x5f4a('0x5a')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x5f4a('0x24')](function(_0x1d45ef){var _0x36dec3=_[_0x5f4a('0x2a')](_0x13a514['body'],function(_0x58a39e){_0x58a39e[_0x5f4a('0x54')]=_0x13a514[_0x5f4a('0x45')]['id'];return _0x58a39e;});return db[_0x5f4a('0x53')][_0x5f4a('0x66')](_0x36dec3,{'raw':!![],'transaction':_0x3e7c9d});});}})[_0x5f4a('0x43')](handleError(_0x3553ec,null));});}})[_0x5f4a('0x24')](function(_0x1bc595){var _0x4e313d=_[_0x5f4a('0x2a')](_0x1bc595,function(_0x5bc685){return _0x5bc685[_0x5f4a('0x4c')]({'plain':!![]});});})[_0x5f4a('0x24')](respondWithResult(_0x3553ec,null))[_0x5f4a('0x43')](handleError(_0x3553ec,null));};exports[_0x5f4a('0x67')]=function(_0x197ece,_0x460d4c,_0x39f783){return db[_0x5f4a('0x2b')][_0x5f4a('0x48')]({'where':{'id':_0x197ece['params']['id']}})[_0x5f4a('0x24')](handleEntityNotFound(_0x460d4c,null))['then'](function(_0x2630ab){if(_0x2630ab){return _0x2630ab['removeResources'](_0x197ece['query']['ids']);}})[_0x5f4a('0x24')](respondWithStatusCode(_0x460d4c,null))[_0x5f4a('0x43')](handleError(_0x460d4c,null));};exports[_0x5f4a('0x68')]=function(_0x1f3b0b,_0x401999){var _0x164db8={'raw':![],'where':{}};var _0x2ac00c={};var _0xffc17a={'count':0x0,'rows':[]};var _0x418192=_0x1f3b0b[_0x5f4a('0x30')]['section'];if(typeof _0x418192===_0x5f4a('0x69')){throw new db[(_0x5f4a('0x6a'))][(_0x5f4a('0x6b'))](_0x5f4a('0x6c'));}var _0x130eef=_0x1f3b0b['query'][_0x5f4a('0x6d')]||![];var _0x409334=getQueryModels(_0x418192,_0x130eef);if(typeof _0x409334[_0x5f4a('0x6e')]===_0x5f4a('0x69')){throw new db[(_0x5f4a('0x6a'))][(_0x5f4a('0x6b'))](_0x5f4a('0x6f')+_0x418192+'\x27');}var _0x565794=[];if(!_[_0x5f4a('0x5f')](_0x409334[_0x5f4a('0x70')])){_0x565794=_0x409334[_0x5f4a('0x70')];}else{_0x565794=[{'name':_0x418192}];}return db['UserProfile'][_0x5f4a('0x62')]({'where':{'id':_0x1f3b0b[_0x5f4a('0x45')]['id']}})[_0x5f4a('0x24')](handleEntityNotFound(_0x401999,null))[_0x5f4a('0x24')](function(_0x4c179a){if(_0x4c179a){var _0x2abbe6=[];for(var _0x3fc8f0=0x0;_0x3fc8f0<_0x565794[_0x5f4a('0x35')];_0x3fc8f0++){_0x2abbe6['push'](db[_0x5f4a('0x59')]['findOne']({'where':{'userProfileId':_0x4c179a['id'],'name':_0x565794[_0x3fc8f0][_0x5f4a('0x28')]},'raw':!![]}));}return BPromise[_0x5f4a('0x71')](_0x2abbe6);}})['then'](function(_0xc4212f){var _0x487a13=_[_0x5f4a('0x3b')](_0xc4212f,function(_0x3e3a38){return _0x3e3a38?_0x3e3a38:undefined;});var _0x59a3bd=_[_0x5f4a('0x3b')](_0x565794,[_0x5f4a('0x72'),!![]]);var _0x1f3781=_[_0x5f4a('0x5f')](_0x487a13)&&_['isEmpty'](_0x59a3bd)?null:_['union'](_0x59a3bd,_0x487a13);if(_0x1f3781){var _0x4f66ee=[];for(var _0x32549d=0x0;_0x32549d<_0x1f3781[_0x5f4a('0x35')];_0x32549d++){var _0x508e2c=_[_0x5f4a('0x48')](_0x565794,function(_0x1e8ce8){return _0x1f3781[_0x32549d]?_0x1e8ce8[_0x5f4a('0x28')]===_0x1f3781[_0x32549d]['name']:null;});if(_0x508e2c){if(_0x1f3781[_0x32549d][_0x5f4a('0x72')]){_0x4f66ee[_0x5f4a('0x61')](getAllResources(_0x409334[_0x5f4a('0x6e')],_0x1f3781[_0x32549d]));}else{if(!_0x1f3781[_0x32549d]['autoAssociation']){_0x4f66ee[_0x5f4a('0x61')](getAllowedResources(_0x508e2c,_0x1f3781[_0x32549d],_0x409334['childModel']));}else{if(_0x508e2c[_0x5f4a('0x2f')]){_0x4f66ee['push'](getAllFilteredResources(_0x508e2c,_0x1f3781[_0x32549d]));}}}}}return BPromise['all'](_0x4f66ee);}else{return null;}})[_0x5f4a('0x24')](function(_0x18d07c){var _0x22b4f0=_0x18d07c;var _0x3d7985=null;if(_0x22b4f0){_0x3d7985=_0x22b4f0[_0x5f4a('0x35')]===0x1?_0x22b4f0[0x0]:null;}if(_0x3d7985||_0x22b4f0){var _0x24fc08=db[_0x409334[_0x5f4a('0x6e')]]['rawAttributes'];_0x2ac00c[_0x5f4a('0x2f')]=_['keys'](_0x24fc08);_0x2ac00c[_0x5f4a('0x30')]=_[_0x5f4a('0x46')](_0x1f3b0b[_0x5f4a('0x30')]);_0x2ac00c[_0x5f4a('0x31')]=_[_0x5f4a('0x32')](_0x2ac00c[_0x5f4a('0x2f')],_0x2ac00c[_0x5f4a('0x30')]);_0x164db8[_0x5f4a('0x33')]=_[_0x5f4a('0x32')](_0x2ac00c['model'],qs[_0x5f4a('0x34')](_0x1f3b0b[_0x5f4a('0x30')]['fields']));_0x164db8[_0x5f4a('0x33')]=_0x164db8[_0x5f4a('0x33')]['length']?_0x164db8[_0x5f4a('0x33')]:_0x2ac00c[_0x5f4a('0x2f')];if(!_0x1f3b0b['query'][_0x5f4a('0x36')](_0x5f4a('0x37'))){_0x164db8[_0x5f4a('0x1c')]=qs[_0x5f4a('0x1c')](_0x1f3b0b[_0x5f4a('0x30')][_0x5f4a('0x1c')]);_0x164db8[_0x5f4a('0x1b')]=qs[_0x5f4a('0x1b')](_0x1f3b0b[_0x5f4a('0x30')][_0x5f4a('0x1b')]);}_0x164db8[_0x5f4a('0x73')]=qs['sort'](_0x1f3b0b[_0x5f4a('0x30')][_0x5f4a('0x38')]);_0x164db8['where']=qs['filters'](_[_0x5f4a('0x3a')](_0x1f3b0b[_0x5f4a('0x30')],_0x2ac00c[_0x5f4a('0x31')]));if(_0x1f3b0b[_0x5f4a('0x30')]['filter']){_0x164db8['where']=_[_0x5f4a('0x3c')](_0x164db8[_0x5f4a('0x39')],{'$or':_[_0x5f4a('0x2a')](_0x24fc08,function(_0xc961e){if(_0xc961e[_0x5f4a('0x2d')]['key']!==_0x5f4a('0x3d')){var _0x1f6dc9={};_0x1f6dc9[_0xc961e[_0x5f4a('0x74')]]={'$like':'%'+_0x1f3b0b[_0x5f4a('0x30')][_0x5f4a('0x3b')]+'%'};return _0x1f6dc9;}})});}var _0x3e7c6d=[];if(_0x3d7985){var _0x424958=_[_0x5f4a('0x48')](_0x565794,[_0x5f4a('0x28'),_0x3d7985[_0x5f4a('0x28')]]);if(_0x424958['field']){var _0x1837ce={};if(_0x409334['childModel']===_0x5f4a('0x75')){_0x1837ce[_0x424958['foreignKey']]=_['map'](_0x3d7985[_0x5f4a('0x76')],'id');}else{_0x1837ce[_0x424958['foreignKey']]=_0x3d7985[_0x5f4a('0x76')];}_0x3e7c6d[_0x5f4a('0x61')](_0x1837ce);}else{_0x164db8['where']['id']=_0x3d7985[_0x5f4a('0x76')];}}else{for(var _0x2eacfc=0x0;_0x2eacfc<_0x22b4f0['length'];_0x2eacfc++){var _0x424958=_[_0x5f4a('0x48')](_0x565794,[_0x5f4a('0x28'),_0x22b4f0[_0x2eacfc]['name']]);if(_0x424958[_0x5f4a('0x74')]){var _0x1837ce={};_0x1837ce[_0x424958[_0x5f4a('0x77')]]=_0x22b4f0[_0x2eacfc][_0x5f4a('0x76')];_0x3e7c6d[_0x5f4a('0x61')](_0x1837ce);}else{if(!_0x164db8['where']['id'])_0x164db8['where']['id']=[];_0x22b4f0[_0x2eacfc][_0x5f4a('0x76')][_0x5f4a('0x63')](function(_0x2d4944){_0x164db8[_0x5f4a('0x39')]['id'][_0x5f4a('0x61')](_0x2d4944);});}}}if(!_[_0x5f4a('0x5f')](_0x3e7c6d)){_0x164db8['where']=_[_0x5f4a('0x3c')](_0x164db8['where'],{'$and':{'$or':_0x3e7c6d}});}_0x164db8=_[_0x5f4a('0x3c')]({},_0x164db8,_0x1f3b0b[_0x5f4a('0x3e')]);if(_0x3d7985&&!_0x3d7985[_0x5f4a('0x52')]&&_0x409334[_0x5f4a('0x6e')]===_0x5f4a('0x75')){if(_0x1f3b0b['query'][_0x5f4a('0x3f')]){_0x164db8[_0x5f4a('0x40')]=[{'all':!![]}];}return db[_0x409334[_0x5f4a('0x6e')]]['findAll'](_0x164db8)['then'](function(_0x4ded52){var _0x3764be=[];_0x4ded52[_0x5f4a('0x63')](function(_0x31d545){var _0x551571;switch(_0x31d545[_0x5f4a('0x78')]){case _0x5f4a('0x79'):_0x551571=_[_0x5f4a('0x48')](_0x3d7985[_0x5f4a('0x76')],function(_0x20c6f6){return _0x20c6f6['id']===_0x31d545['reportId']&&_0x20c6f6[_0x5f4a('0x2d')]==='DefaultReports';});break;case _0x5f4a('0x7a'):_0x551571=_[_0x5f4a('0x48')](_0x3d7985[_0x5f4a('0x76')],function(_0x3f846c){return _0x3f846c['id']===_0x31d545['reportId']&&_0x3f846c['type']===_0x5f4a('0x7b');});break;}if(_0x551571)_0x3764be[_0x5f4a('0x61')](_0x31d545);});_0xffc17a[_0x5f4a('0x1a')]=_0x3764be[_0x5f4a('0x35')];_0xffc17a[_0x5f4a('0x42')]=_0x3764be;return _0xffc17a;});}else{return db[_0x409334[_0x5f4a('0x6e')]]['count']({'where':_0x164db8[_0x5f4a('0x39')]})[_0x5f4a('0x24')](function(_0x51b5ce){_0xffc17a[_0x5f4a('0x1a')]=_0x51b5ce;if(_0x1f3b0b[_0x5f4a('0x30')][_0x5f4a('0x3f')]){if(_0x409334[_0x5f4a('0x6e')]===_0x5f4a('0x7c')){_0x164db8[_0x5f4a('0x40')]=[{'model':db['Tag'],'as':_0x5f4a('0x7d'),'attributes':['id','name',_0x5f4a('0x7e')],'required':_0x1f3b0b[_0x5f4a('0x30')][_0x5f4a('0x7f')]?!![]:![]},{'model':db[_0x5f4a('0x80')],'as':_0x5f4a('0x81'),'attributes':['id',_0x5f4a('0x28'),'color'],'through':_0x1f3b0b[_0x5f4a('0x30')][_0x5f4a('0x7f')]?{'attributes':[],'where':{'TagId':_0x1f3b0b[_0x5f4a('0x30')][_0x5f4a('0x7f')]||undefined}}:{},'required':_0x1f3b0b[_0x5f4a('0x30')]['tag']?!![]:![]}];}else{_0x164db8[_0x5f4a('0x40')]=[{'all':!![]}];}}return db[_0x409334[_0x5f4a('0x6e')]][_0x5f4a('0x41')](_0x164db8);})[_0x5f4a('0x24')](function(_0xba0777){_0xffc17a[_0x5f4a('0x42')]=_0xba0777;return _0xffc17a;});}}else{return _0xffc17a;}})[_0x5f4a('0x24')](respondWithFilteredResult(_0x401999,_0x164db8))[_0x5f4a('0x43')](handleError(_0x401999,null));};function getAllResources(_0x132923,_0x322ae4){return new BPromise(function(_0x38ed43,_0x420241){if(_0x322ae4){var _0x14d829=_0x322ae4[_0x5f4a('0x3b')]?{[_0x322ae4[_0x5f4a('0x3b')][_0x5f4a('0x74')]]:_0x322ae4[_0x5f4a('0x3b')][_0x5f4a('0x82')]}:undefined;return db[_0x132923][_0x5f4a('0x41')]({'where':_0x14d829,'raw':!![]})[_0x5f4a('0x24')](function(_0x3221a1){_0x322ae4[_0x5f4a('0x76')]=_[_0x5f4a('0x2a')](_0x3221a1,'id');_0x38ed43(_0x322ae4);})[_0x5f4a('0x43')](function(_0x5ccc3a){_0x420241(_0x5ccc3a);});}else{_0x38ed43(null);}});}function getAllFilteredResources(_0xe711fd,_0x932c5f){return new BPromise(function(_0x336f7c,_0x4dc0e8){var _0x344950=_0xe711fd[_0x5f4a('0x3b')]?{[_0xe711fd['filter'][_0x5f4a('0x74')]]:_0xe711fd[_0x5f4a('0x3b')][_0x5f4a('0x82')]}:undefined;return db[_0xe711fd[_0x5f4a('0x2f')]][_0x5f4a('0x41')]({'where':_0x344950,'raw':!![]})['then'](function(_0x51930c){_0x932c5f[_0x5f4a('0x76')]=_['map'](_0x51930c,function(_0x5c448b){return _0x5c448b[_0x5f4a('0x28')];});_0x336f7c(_0x932c5f);})[_0x5f4a('0x43')](function(_0x11c699){_0x4dc0e8(_0x11c699);});});}function getAllowedResources(_0x497135,_0x3ef1d7,_0x39dcaa){return new BPromise(function(_0xd1ad52,_0x696cb4){if(_0x3ef1d7){return db[_0x5f4a('0x53')][_0x5f4a('0x41')]({'where':{'sectionId':_0x3ef1d7['id']},'raw':!![]})[_0x5f4a('0x24')](function(_0x3da0da){if(_0x497135[_0x5f4a('0x74')]&&_0x497135[_0x5f4a('0x74')]!=='id'){_0x3ef1d7['associatedResources']=_[_0x5f4a('0x2a')](_0x3da0da,function(_0x3e50ee){return _0x3e50ee[_0x497135['field']];});}else{if(_0x39dcaa===_0x5f4a('0x75')){_0x3ef1d7[_0x5f4a('0x76')]=_[_0x5f4a('0x2a')](_0x3da0da,function(_0xe68749){return{'id':_0xe68749[_0x5f4a('0x64')],'type':_0xe68749[_0x5f4a('0x2d')]};});}else{_0x3ef1d7[_0x5f4a('0x76')]=_[_0x5f4a('0x2a')](_0x3da0da,function(_0x50de82){return _0x50de82['resourceId'];});}}_0xd1ad52(_0x3ef1d7);})[_0x5f4a('0x43')](function(_0x14d4c3){_0x696cb4(_0x14d4c3);});}else{_0xd1ad52(null);}});}function getQueryModels(_0x1481dc,_0x3ceaeb){var _0x8d0052=_0x1481dc[_0x5f4a('0x83')]();var _0x4c9c72={'childModel':undefined,'parentSections':[]};switch(_0x8d0052){case _0x5f4a('0x84'):_0x4c9c72['childModel']=_0x5f4a('0x85');break;case _0x5f4a('0x86'):_0x4c9c72['childModel']='SquareOdbc';break;case _0x5f4a('0x87'):_0x4c9c72['childModel']='SquareRecording';_0x4c9c72[_0x5f4a('0x70')]=[{'name':_0x5f4a('0x88'),'field':_0x5f4a('0x28'),'foreignKey':_0x5f4a('0x89')}];break;case'projects':_0x4c9c72['childModel']=_0x5f4a('0x8a');break;case _0x5f4a('0x8b'):_0x4c9c72[_0x5f4a('0x6e')]=_0x5f4a('0x7c');_0x4c9c72[_0x5f4a('0x70')]=[{'name':_0x5f4a('0x8c'),'field':'id','foreignKey':_0x5f4a('0x8d')}];break;case'lists':_0x4c9c72[_0x5f4a('0x6e')]=_0x5f4a('0x8e');break;case _0x5f4a('0x8f'):_0x4c9c72[_0x5f4a('0x6e')]='CmCompany';break;case _0x5f4a('0x90'):_0x4c9c72[_0x5f4a('0x6e')]=_0x5f4a('0x91');break;case _0x5f4a('0x92'):_0x4c9c72[_0x5f4a('0x6e')]=_0x5f4a('0x93');break;case _0x5f4a('0x94'):_0x4c9c72[_0x5f4a('0x6e')]=_0x5f4a('0x95');break;case _0x5f4a('0x96'):_0x4c9c72[_0x5f4a('0x6e')]=_0x5f4a('0x97');break;case _0x5f4a('0x98'):_0x4c9c72[_0x5f4a('0x6e')]='FaxAccount';break;case'inboundroutes':case _0x5f4a('0x99'):case'outboundroutes':_0x4c9c72['childModel']='VoiceExtension';break;case _0x5f4a('0x9a'):_0x4c9c72['childModel']='VoiceContext';break;case _0x5f4a('0x9b'):_0x4c9c72[_0x5f4a('0x6e')]=_0x5f4a('0x9c');break;case _0x5f4a('0x9d'):_0x4c9c72[_0x5f4a('0x6e')]=_0x5f4a('0x9e');_0x4c9c72[_0x5f4a('0x70')]=[{'name':_0x5f4a('0x9f'),'field':'name','foreignKey':_0x5f4a('0xa0'),'model':_0x5f4a('0xa1'),'filter':{'field':_0x5f4a('0xa2'),'value':[_0x5f4a('0xa3')]}},{'name':'Telephones','field':'name','foreignKey':'membername','model':_0x5f4a('0xa1'),'filter':{'field':_0x5f4a('0xa2'),'value':[_0x5f4a('0xa4')]}},{'name':_0x5f4a('0xa5'),'field':_0x5f4a('0x28'),'foreignKey':_0x5f4a('0xa6'),'model':_0x5f4a('0xa7'),'filter':{'field':'type','value':[_0x5f4a('0xa8')]}},{'name':_0x5f4a('0xa9'),'field':_0x5f4a('0x28'),'foreignKey':_0x5f4a('0xa6'),'model':_0x5f4a('0xa7'),'filter':{'field':'type','value':[_0x5f4a('0xaa')]}}];break;case'musiconholds':_0x4c9c72[_0x5f4a('0x6e')]=_0x5f4a('0xab');break;case _0x5f4a('0xac'):_0x4c9c72[_0x5f4a('0x6e')]=_0x5f4a('0xad');break;case _0x5f4a('0xae'):_0x4c9c72[_0x5f4a('0x6e')]=_0x5f4a('0xaf');break;case _0x5f4a('0xb0'):_0x4c9c72[_0x5f4a('0x6e')]=_0x5f4a('0xb1');break;case _0x5f4a('0xb2'):_0x4c9c72[_0x5f4a('0x6e')]=_0x5f4a('0xb3');break;case'mailaccounts':_0x4c9c72['childModel']=_0x5f4a('0xb4');break;case _0x5f4a('0xb5'):_0x4c9c72[_0x5f4a('0x6e')]='MailSubstatus';break;case _0x5f4a('0xb6'):_0x4c9c72[_0x5f4a('0x6e')]=_0x5f4a('0xb7');break;case _0x5f4a('0xb8'):_0x4c9c72[_0x5f4a('0x6e')]=_0x5f4a('0xb9');break;case _0x5f4a('0xba'):_0x4c9c72[_0x5f4a('0x6e')]='SmsQueue';break;case _0x5f4a('0xbb'):_0x4c9c72[_0x5f4a('0x6e')]='SmsAccount';break;case _0x5f4a('0xbc'):_0x4c9c72[_0x5f4a('0x6e')]=_0x5f4a('0xbd');break;case _0x5f4a('0xbe'):_0x4c9c72['childModel']=_0x5f4a('0xbf');break;case _0x5f4a('0xc0'):_0x4c9c72[_0x5f4a('0x6e')]=_0x5f4a('0xc1');break;case _0x5f4a('0xc2'):case _0x5f4a('0xc3'):_0x4c9c72[_0x5f4a('0x6e')]=_0x5f4a('0xa7');if(_0x3ceaeb){_0x4c9c72[_0x5f4a('0x70')]=[{'name':_0x5f4a('0xa5')},{'name':_0x5f4a('0xa9')}];}break;case _0x5f4a('0xc4'):case _0x5f4a('0xc5'):case _0x5f4a('0xc6'):_0x4c9c72[_0x5f4a('0x6e')]=_0x5f4a('0xa1');if(_0x3ceaeb){_0x4c9c72[_0x5f4a('0x70')]=[{'name':_0x5f4a('0xc7'),'filter':{'field':_0x5f4a('0xa2'),'value':['admin',_0x5f4a('0xc8')]},'ignore':!![]},{'name':_0x5f4a('0x9f')},{'name':'Telephones'}];}break;case _0x5f4a('0xc9'):_0x4c9c72[_0x5f4a('0x6e')]='ZendeskAccount';break;case _0x5f4a('0xca'):_0x4c9c72[_0x5f4a('0x6e')]=_0x5f4a('0xcb');break;case _0x5f4a('0xcc'):_0x4c9c72[_0x5f4a('0x6e')]=_0x5f4a('0xcd');break;case _0x5f4a('0xce'):_0x4c9c72[_0x5f4a('0x6e')]=_0x5f4a('0xcf');break;case _0x5f4a('0xd0'):_0x4c9c72['childModel']=_0x5f4a('0xd1');break;case _0x5f4a('0xd2'):_0x4c9c72['childModel']=_0x5f4a('0xd3');break;case _0x5f4a('0xd4'):_0x4c9c72['childModel']=_0x5f4a('0xa1');break;case _0x5f4a('0xd5'):_0x4c9c72['childModel']=_0x5f4a('0xd6');break;case _0x5f4a('0xd7'):_0x4c9c72[_0x5f4a('0x6e')]='Disposition';break;case _0x5f4a('0xd8'):_0x4c9c72[_0x5f4a('0x6e')]='Dashboard';break;case _0x5f4a('0xd9'):_0x4c9c72['childModel']='Interval';break;case _0x5f4a('0xda'):_0x4c9c72[_0x5f4a('0x6e')]=_0x5f4a('0xdb');break;case _0x5f4a('0xdc'):_0x4c9c72['childModel']=_0x5f4a('0xdd');break;case _0x5f4a('0xde'):_0x4c9c72['childModel']=_0x5f4a('0xdf');break;case _0x5f4a('0xe0'):_0x4c9c72[_0x5f4a('0x6e')]=_0x5f4a('0x80');break;case _0x5f4a('0xe1'):_0x4c9c72[_0x5f4a('0x6e')]=_0x5f4a('0xe2');break;case _0x5f4a('0xe3'):_0x4c9c72[_0x5f4a('0x6e')]=_0x5f4a('0xe4');break;case _0x5f4a('0xe5'):_0x4c9c72[_0x5f4a('0x6e')]='Trunk';break;case _0x5f4a('0xe6'):_0x4c9c72['childModel']='Variable';break;case'plugins':_0x4c9c72[_0x5f4a('0x6e')]=_0x5f4a('0xe7');break;case _0x5f4a('0xe8'):_0x4c9c72[_0x5f4a('0x6e')]=_0x5f4a('0x75');_0x4c9c72[_0x5f4a('0x70')]=[{'name':_0x5f4a('0xe9'),'field':'id','foreignKey':'reportId'}];break;case _0x5f4a('0xea'):_0x4c9c72[_0x5f4a('0x6e')]=_0x5f4a('0xeb');break;case _0x5f4a('0xbe'):_0x4c9c72[_0x5f4a('0x6e')]='WhatsappAccount';break;default:return _0x4c9c72;}return _0x4c9c72;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 38a6e1b..07e7ec9 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 _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 +var _0x6bf4=['../../mysqldb','UserProfile','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x381477,_0x1760e1){var _0x35328d=function(_0x2fa454){while(--_0x2fa454){_0x381477['push'](_0x381477['shift']());}};_0x35328d(++_0x1760e1);}(_0x6bf4,0x9f));var _0x46bf=function(_0x3ce1a1,_0x465127){_0x3ce1a1=_0x3ce1a1-0x0;var _0x32c826=_0x6bf4[_0x3ce1a1];return _0x32c826;};'use strict';var EventEmitter=require(_0x46bf('0x0'));var UserProfile=require(_0x46bf('0x1'))['db'][_0x46bf('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x46bf('0x3'),'afterUpdate':_0x46bf('0x4'),'afterDestroy':_0x46bf('0x5')};function emitEvent(_0x467442){return function(_0x3c4049,_0x1262f2,_0x4eaa00){UserProfileEvents[_0x46bf('0x6')](_0x467442+':'+_0x3c4049['id'],_0x3c4049);UserProfileEvents[_0x46bf('0x6')](_0x467442,_0x3c4049);_0x4eaa00(null);};}for(var e in events){if(events[_0x46bf('0x7')](e)){var event=events[e];UserProfile[_0x46bf('0x8')](e,emitEvent(event));}}module[_0x46bf('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 9f596ba..bd58618 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 _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 +var _0xb9a6=['moment','rimraf','../../config/environment','exports','define','UserProfile','lodash','util','api'];(function(_0xb15db6,_0x388d94){var _0x1db34d=function(_0x309006){while(--_0x309006){_0xb15db6['push'](_0xb15db6['shift']());}};_0x1db34d(++_0x388d94);}(_0xb9a6,0x1ec));var _0x6b9a=function(_0x3818d2,_0xcda7db){_0x3818d2=_0x3818d2-0x0;var _0x5aec98=_0xb9a6[_0x3818d2];return _0x5aec98;};'use strict';var _=require(_0x6b9a('0x0'));var util=require(_0x6b9a('0x1'));var logger=require('../../config/logger')(_0x6b9a('0x2'));var moment=require(_0x6b9a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6b9a('0x4'));var config=require(_0x6b9a('0x5'));var attributes=require('./userProfile.attributes');module[_0x6b9a('0x6')]=function(_0x31e3b7,_0xc6bde4){return _0x31e3b7[_0x6b9a('0x7')](_0x6b9a('0x8'),attributes,{'tableName':'user_profiles','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 9216d61..75c9d96 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 _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 +var _0x814b=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x372263,_0x2f1ee5){var _0x488429=function(_0x24fa43){while(--_0x24fa43){_0x372263['push'](_0x372263['shift']());}};_0x488429(++_0x2f1ee5);}(_0x814b,0x1a2));var _0xb814=function(_0x5ca644,_0x3d2165){_0x5ca644=_0x5ca644-0x0;var _0x5c87a2=_0x814b[_0x5ca644];return _0x5c87a2;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});config[_0xb814('0xc')]=_[_0xb814('0xd')](config['redis'],{'host':_0xb814('0xe'),'port':0x18eb});var socket=require(_0xb814('0xf'))(new Redis(config[_0xb814('0xc')]));require(_0xb814('0x10'))[_0xb814('0x11')](socket);function respondWithRpcPromise(_0x21d4a5,_0x1086f8,_0x19aad8){return new BPromise(function(_0x207dbc,_0x3450f2){return client[_0xb814('0x12')](_0x21d4a5,_0x19aad8)['then'](function(_0x43dfe6){logger['info'](_0xb814('0x13'),_0x1086f8,_0xb814('0x14'));logger[_0xb814('0x15')](_0xb814('0x16'),_0x1086f8,_0xb814('0x14'),JSON[_0xb814('0x17')](_0x43dfe6));if(_0x43dfe6[_0xb814('0x18')]){if(_0x43dfe6[_0xb814('0x18')][_0xb814('0x19')]===0x1f4){logger[_0xb814('0x18')](_0xb814('0x13'),_0x1086f8,_0x43dfe6[_0xb814('0x18')][_0xb814('0x1a')]);return _0x3450f2(_0x43dfe6[_0xb814('0x18')][_0xb814('0x1a')]);}logger[_0xb814('0x18')](_0xb814('0x13'),_0x1086f8,_0x43dfe6[_0xb814('0x18')][_0xb814('0x1a')]);return _0x207dbc(_0x43dfe6[_0xb814('0x18')][_0xb814('0x1a')]);}else{logger['info'](_0xb814('0x13'),_0x1086f8,'request\x20sent');_0x207dbc(_0x43dfe6[_0xb814('0x1b')][_0xb814('0x1a')]);}})['catch'](function(_0x4b55a7){logger['error'](_0xb814('0x13'),_0x1086f8,_0x4b55a7);_0x3450f2(_0x4b55a7);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 9ad12d5..5934d33 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 _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 +var _0x45b5=['emit','removeListener','register','length','userProfile:','./userProfile.events','remove','update'];(function(_0x46fa24,_0x2abf65){var _0x35869b=function(_0x41a744){while(--_0x41a744){_0x46fa24['push'](_0x46fa24['shift']());}};_0x35869b(++_0x2abf65);}(_0x45b5,0x195));var _0x545b=function(_0x2f2654,_0x1572bd){_0x2f2654=_0x2f2654-0x0;var _0x332b2a=_0x45b5[_0x2f2654];return _0x332b2a;};'use strict';var UserProfileEvents=require(_0x545b('0x0'));var events=['save',_0x545b('0x1'),_0x545b('0x2')];function createListener(_0x7e0878,_0x59d79d){return function(_0x4f0e63){_0x59d79d[_0x545b('0x3')](_0x7e0878,_0x4f0e63);};}function removeListener(_0x4b1ce5,_0x5c34ce){return function(){UserProfileEvents[_0x545b('0x4')](_0x4b1ce5,_0x5c34ce);};}exports[_0x545b('0x5')]=function(_0x99c3de){for(var _0x2b69a4=0x0,_0x49018e=events[_0x545b('0x6')];_0x2b69a4<_0x49018e;_0x2b69a4++){var _0x264abc=events[_0x2b69a4];var _0x4d42aa=createListener(_0x545b('0x7')+_0x264abc,_0x99c3de);UserProfileEvents['on'](_0x264abc,_0x4d42aa);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 8fcb11a..1786b2f 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 _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 +var _0xd676=['/:id','post','create','put','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd676,0x1e6));var _0x6d67=function(_0xbb5ed6,_0x5f2644){_0xbb5ed6=_0xbb5ed6-0x0;var _0x3604f5=_0xd676[_0xbb5ed6];return _0x3604f5;};'use strict';var multer=require(_0x6d67('0x0'));var util=require(_0x6d67('0x1'));var path=require('path');var timeout=require(_0x6d67('0x2'));var express=require(_0x6d67('0x3'));var router=express[_0x6d67('0x4')]();var auth=require(_0x6d67('0x5'));var interaction=require(_0x6d67('0x6'));var config=require(_0x6d67('0x7'));var controller=require(_0x6d67('0x8'));router[_0x6d67('0x9')]('/',auth['isAuthenticated'](),controller[_0x6d67('0xa')]);router[_0x6d67('0x9')](_0x6d67('0xb'),auth[_0x6d67('0xc')](),controller[_0x6d67('0xd')]);router[_0x6d67('0x9')](_0x6d67('0xe'),auth[_0x6d67('0xc')](),controller['show']);router[_0x6d67('0xf')]('/',auth['isAuthenticated'](),controller[_0x6d67('0x10')]);router[_0x6d67('0x11')](_0x6d67('0xe'),auth[_0x6d67('0xc')](),controller['update']);router[_0x6d67('0x12')]('/:id',auth[_0x6d67('0xc')](),controller['destroy']);module[_0x6d67('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index fc1da54..b7f8182 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 _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 +var _0x29a5=['exports','INTEGER'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x29a5,0xd2));var _0x529a=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x29a5[_0x22f8ab];return _0x2a70e5;};'use strict';var Sequelize=require('sequelize');module[_0x529a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x529a('0x1')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 276ac57..6b15236 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 _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 +var _0x3937=['offset','limit','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','describe','html-pdf','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count'];(function(_0x314927,_0x28cf9d){var _0x1c85dc=function(_0x28bdeb){while(--_0x28bdeb){_0x314927['push'](_0x314927['shift']());}};_0x1c85dc(++_0x28cf9d);}(_0x3937,0xbf));var _0x7393=function(_0x33ac78,_0x42a5a2){_0x33ac78=_0x33ac78-0x0;var _0x410671=_0x3937[_0x33ac78];return _0x410671;};'use strict';var pdf=require(_0x7393('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7393('0x1'));var zipdir=require(_0x7393('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7393('0x3'));var moment=require('moment');var BPromise=require(_0x7393('0x4'));var Mustache=require('mustache');var util=require(_0x7393('0x5'));var path=require(_0x7393('0x6'));var sox=require(_0x7393('0x7'));var csv=require(_0x7393('0x8'));var ejs=require(_0x7393('0x9'));var fs=require('fs');var _=require(_0x7393('0xa'));var squel=require(_0x7393('0xb'));var crypto=require(_0x7393('0xc'));var jsforce=require(_0x7393('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7393('0xe'));var Papa=require(_0x7393('0xf'));var Redis=require(_0x7393('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7393('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x7393('0x12'));var config=require(_0x7393('0x13'));var db=require(_0x7393('0x14'))['db'];function respondWithStatusCode(_0x4fb764,_0x79fc4e){_0x79fc4e=_0x79fc4e||0xcc;return function(_0x470f09){if(_0x470f09){return _0x4fb764[_0x7393('0x15')](_0x79fc4e);}return _0x4fb764[_0x7393('0x16')](_0x79fc4e)[_0x7393('0x17')]();};}function respondWithResult(_0x1fe171,_0x38eaad){_0x38eaad=_0x38eaad||0xc8;return function(_0x212f44){if(_0x212f44){return _0x1fe171[_0x7393('0x16')](_0x38eaad)['json'](_0x212f44);}};}function respondWithFilteredResult(_0x47b152,_0x414c37){return function(_0x5d0d2b){if(_0x5d0d2b){var _0x5b91a9=_0x5d0d2b[_0x7393('0x18')],_0x4e7ec6=_0x414c37[_0x7393('0x19')],_0x82f5fa=_0x414c37['offset']+_0x414c37[_0x7393('0x1a')],_0x54dc47;if(_0x82f5fa>=_0x5b91a9){_0x82f5fa=_0x5b91a9;_0x54dc47=0xc8;}else{_0x54dc47=0xce;}_0x47b152['status'](_0x54dc47);return _0x47b152['set'](_0x7393('0x1b'),_0x4e7ec6+'-'+_0x82f5fa+'/'+_0x5b91a9)[_0x7393('0x1c')](_0x5d0d2b);}return null;};}function patchUpdates(_0x1b032c){return function(_0x1dc3e3){try{jsonpatch[_0x7393('0x1d')](_0x1dc3e3,_0x1b032c,!![]);}catch(_0x3e2453){return BPromise[_0x7393('0x1e')](_0x3e2453);}return _0x1dc3e3[_0x7393('0x1f')]();};}function saveUpdates(_0x546642,_0x52cd6a){return function(_0x30eae3){if(_0x30eae3){return _0x30eae3[_0x7393('0x20')](_0x546642)[_0x7393('0x21')](function(_0x7fc0ef){return _0x7fc0ef;});}return null;};}function removeEntity(_0x131667,_0x52f716){return function(_0x4d7870){if(_0x4d7870){return _0x4d7870['destroy']()[_0x7393('0x21')](function(){_0x131667['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bf7a9,_0xa8f852){return function(_0x5b4498){if(!_0x5b4498){_0x2bf7a9[_0x7393('0x15')](0x194);}return _0x5b4498;};}function handleError(_0x2b0389,_0x1ac912){_0x1ac912=_0x1ac912||0x1f4;return function(_0x3a0a83){logger[_0x7393('0x22')](_0x3a0a83[_0x7393('0x23')]);if(_0x3a0a83[_0x7393('0x24')]){delete _0x3a0a83[_0x7393('0x24')];}_0x2b0389[_0x7393('0x16')](_0x1ac912)[_0x7393('0x25')](_0x3a0a83);};}exports[_0x7393('0x26')]=function(_0x123ab4,_0x19160c){var _0x4e1fea={},_0x39d95f={},_0x17e350={'count':0x0,'rows':[]};var _0x1fea0a=_[_0x7393('0x27')](db[_0x7393('0x28')][_0x7393('0x29')],function(_0x4a865e){return{'name':_0x4a865e[_0x7393('0x2a')],'type':_0x4a865e['type'][_0x7393('0x2b')]};});_0x39d95f['model']=_[_0x7393('0x27')](_0x1fea0a,_0x7393('0x24'));_0x39d95f[_0x7393('0x2c')]=_[_0x7393('0x2d')](_0x123ab4[_0x7393('0x2c')]);_0x39d95f[_0x7393('0x2e')]=_[_0x7393('0x2f')](_0x39d95f[_0x7393('0x30')],_0x39d95f[_0x7393('0x2c')]);_0x4e1fea[_0x7393('0x31')]=_[_0x7393('0x2f')](_0x39d95f[_0x7393('0x30')],qs['fields'](_0x123ab4['query'][_0x7393('0x32')]));_0x4e1fea['attributes']=_0x4e1fea[_0x7393('0x31')]['length']?_0x4e1fea[_0x7393('0x31')]:_0x39d95f['model'];if(!_0x123ab4[_0x7393('0x2c')][_0x7393('0x33')](_0x7393('0x34'))){_0x4e1fea[_0x7393('0x1a')]=qs[_0x7393('0x1a')](_0x123ab4[_0x7393('0x2c')][_0x7393('0x1a')]);_0x4e1fea[_0x7393('0x19')]=qs[_0x7393('0x19')](_0x123ab4[_0x7393('0x2c')]['offset']);}_0x4e1fea[_0x7393('0x35')]=qs['sort'](_0x123ab4[_0x7393('0x2c')]['sort']);_0x4e1fea[_0x7393('0x36')]=qs[_0x7393('0x2e')](_[_0x7393('0x37')](_0x123ab4[_0x7393('0x2c')],_0x39d95f[_0x7393('0x2e')]),_0x1fea0a);if(_0x123ab4['query'][_0x7393('0x38')]){_0x4e1fea['where']=_[_0x7393('0x39')](_0x4e1fea[_0x7393('0x36')],{'$or':_[_0x7393('0x27')](_0x1fea0a,function(_0x26cb6e){if(_0x26cb6e[_0x7393('0x3a')]!=='VIRTUAL'){var _0x4c82e6={};_0x4c82e6[_0x26cb6e[_0x7393('0x24')]]={'$like':'%'+_0x123ab4[_0x7393('0x2c')][_0x7393('0x38')]+'%'};return _0x4c82e6;}})});}_0x4e1fea=_[_0x7393('0x39')]({},_0x4e1fea,_0x123ab4['options']);var _0x5d746e={'where':_0x4e1fea['where']};return db[_0x7393('0x28')][_0x7393('0x18')](_0x5d746e)[_0x7393('0x21')](function(_0x4aa2ca){_0x17e350[_0x7393('0x18')]=_0x4aa2ca;if(_0x123ab4[_0x7393('0x2c')][_0x7393('0x3b')]){_0x4e1fea[_0x7393('0x3c')]=[{'all':!![]}];}return db[_0x7393('0x28')][_0x7393('0x3d')](_0x4e1fea);})[_0x7393('0x21')](function(_0x2241c8){_0x17e350[_0x7393('0x3e')]=_0x2241c8;return _0x17e350;})[_0x7393('0x21')](respondWithFilteredResult(_0x19160c,_0x4e1fea))[_0x7393('0x3f')](handleError(_0x19160c,null));};exports[_0x7393('0x40')]=function(_0x1644ac,_0x3eefe0){var _0x445b39={'raw':![],'where':{'id':_0x1644ac[_0x7393('0x41')]['id']}},_0x13c476={};_0x13c476[_0x7393('0x30')]=_['keys'](db[_0x7393('0x28')][_0x7393('0x29')]);_0x13c476[_0x7393('0x2c')]=_[_0x7393('0x2d')](_0x1644ac[_0x7393('0x2c')]);_0x13c476[_0x7393('0x2e')]=_[_0x7393('0x2f')](_0x13c476[_0x7393('0x30')],_0x13c476['query']);_0x445b39['attributes']=_[_0x7393('0x2f')](_0x13c476['model'],qs[_0x7393('0x32')](_0x1644ac[_0x7393('0x2c')][_0x7393('0x32')]));_0x445b39[_0x7393('0x31')]=_0x445b39[_0x7393('0x31')][_0x7393('0x42')]?_0x445b39['attributes']:_0x13c476[_0x7393('0x30')];if(_0x1644ac[_0x7393('0x2c')][_0x7393('0x3b')]){_0x445b39[_0x7393('0x3c')]=[{'all':!![]}];}_0x445b39=_[_0x7393('0x39')]({},_0x445b39,_0x1644ac['options']);return db['UserProfileResource'][_0x7393('0x43')](_0x445b39)['then'](handleEntityNotFound(_0x3eefe0,null))[_0x7393('0x21')](respondWithResult(_0x3eefe0,null))[_0x7393('0x3f')](handleError(_0x3eefe0,null));};exports[_0x7393('0x44')]=function(_0xaef517,_0x2348a9){return db[_0x7393('0x28')][_0x7393('0x44')](_0xaef517[_0x7393('0x45')],{})[_0x7393('0x21')](respondWithResult(_0x2348a9,0xc9))[_0x7393('0x3f')](handleError(_0x2348a9,null));};exports[_0x7393('0x20')]=function(_0x26c327,_0x3fdbe2){if(_0x26c327[_0x7393('0x45')]['id']){delete _0x26c327[_0x7393('0x45')]['id'];}return db['UserProfileResource'][_0x7393('0x43')]({'where':{'id':_0x26c327[_0x7393('0x41')]['id']}})[_0x7393('0x21')](handleEntityNotFound(_0x3fdbe2,null))[_0x7393('0x21')](saveUpdates(_0x26c327['body'],null))[_0x7393('0x21')](respondWithResult(_0x3fdbe2,null))[_0x7393('0x3f')](handleError(_0x3fdbe2,null));};exports[_0x7393('0x46')]=function(_0x275192,_0x1deca3){return db[_0x7393('0x28')][_0x7393('0x43')]({'where':{'id':_0x275192[_0x7393('0x41')]['id']}})[_0x7393('0x21')](handleEntityNotFound(_0x1deca3,null))['then'](removeEntity(_0x1deca3,null))[_0x7393('0x3f')](handleError(_0x1deca3,null));};exports[_0x7393('0x47')]=function(_0x306ab7,_0x5b82d4){return db[_0x7393('0x28')][_0x7393('0x47')]()['then'](respondWithResult(_0x5b82d4,null))[_0x7393('0x3f')](handleError(_0x5b82d4,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index edf9d1d..c89758b 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 _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 +var _0x7678=['exports','UserProfileResource','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./userProfileResource.attributes'];(function(_0x5072b6,_0x300d57){var _0x213867=function(_0x10d118){while(--_0x10d118){_0x5072b6['push'](_0x5072b6['shift']());}};_0x213867(++_0x300d57);}(_0x7678,0xd5));var _0x8767=function(_0x41aede,_0x17b0ef){_0x41aede=_0x41aede-0x0;var _0x377444=_0x7678[_0x41aede];return _0x377444;};'use strict';var _=require(_0x8767('0x0'));var util=require(_0x8767('0x1'));var logger=require(_0x8767('0x2'))(_0x8767('0x3'));var moment=require(_0x8767('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8767('0x5'));var config=require(_0x8767('0x6'));var attributes=require(_0x8767('0x7'));module[_0x8767('0x8')]=function(_0x3f7dae,_0x3c82c7){return _0x3f7dae['define'](_0x8767('0x9'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x8767('0xa'),'fields':[_0x8767('0xb'),_0x8767('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 99017ba..b335e6d 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 _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 +var _0xde96=['UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','UserProfileResource,\x20%s,\x20%s'];(function(_0x2de26c,_0x1efb07){var _0x4e3607=function(_0x4646d5){while(--_0x4646d5){_0x2de26c['push'](_0x2de26c['shift']());}};_0x4e3607(++_0x1efb07);}(_0xde96,0x101));var _0x6de9=function(_0xca465b,_0x470663){_0xca465b=_0xca465b-0x0;var _0x3d988d=_0xde96[_0xca465b];return _0x3d988d;};'use strict';var _=require(_0x6de9('0x0'));var util=require('util');var moment=require(_0x6de9('0x1'));var BPromise=require(_0x6de9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6de9('0x3'));var db=require(_0x6de9('0x4'))['db'];var utils=require(_0x6de9('0x5'));var logger=require(_0x6de9('0x6'))(_0x6de9('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6de9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3168cc,_0x1274d5,_0x17029b){return new BPromise(function(_0x44b844,_0x1581fe){return client[_0x6de9('0x9')](_0x3168cc,_0x17029b)[_0x6de9('0xa')](function(_0x5a1b09){logger[_0x6de9('0xb')](_0x6de9('0xc'),_0x1274d5,'request\x20sent');logger['debug'](_0x6de9('0xd'),_0x1274d5,_0x6de9('0xe'),JSON['stringify'](_0x5a1b09));if(_0x5a1b09[_0x6de9('0xf')]){if(_0x5a1b09['error']['code']===0x1f4){logger[_0x6de9('0xf')](_0x6de9('0xc'),_0x1274d5,_0x5a1b09[_0x6de9('0xf')][_0x6de9('0x10')]);return _0x1581fe(_0x5a1b09[_0x6de9('0xf')][_0x6de9('0x10')]);}logger[_0x6de9('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x1274d5,_0x5a1b09[_0x6de9('0xf')][_0x6de9('0x10')]);return _0x44b844(_0x5a1b09[_0x6de9('0xf')][_0x6de9('0x10')]);}else{logger[_0x6de9('0xb')](_0x6de9('0xc'),_0x1274d5,_0x6de9('0xe'));_0x44b844(_0x5a1b09['result'][_0x6de9('0x10')]);}})[_0x6de9('0x11')](function(_0x35e710){logger[_0x6de9('0xf')](_0x6de9('0xc'),_0x1274d5,_0x35e710);_0x1581fe(_0x35e710);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 741c245..c8bd09e 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 _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 +var _0xb4fc=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get'];(function(_0x50fb36,_0x29d64a){var _0x2375e1=function(_0x32737f){while(--_0x32737f){_0x50fb36['push'](_0x50fb36['shift']());}};_0x2375e1(++_0x29d64a);}(_0xb4fc,0xdd));var _0xcb4f=function(_0xe80c36,_0x5afcce){_0xe80c36=_0xe80c36-0x0;var _0x47ff62=_0xb4fc[_0xe80c36];return _0x47ff62;};'use strict';var multer=require('multer');var util=require(_0xcb4f('0x0'));var path=require(_0xcb4f('0x1'));var timeout=require(_0xcb4f('0x2'));var express=require(_0xcb4f('0x3'));var router=express[_0xcb4f('0x4')]();var auth=require(_0xcb4f('0x5'));var interaction=require(_0xcb4f('0x6'));var config=require(_0xcb4f('0x7'));var controller=require(_0xcb4f('0x8'));router[_0xcb4f('0x9')]('/',auth[_0xcb4f('0xa')](),controller[_0xcb4f('0xb')]);router[_0xcb4f('0x9')](_0xcb4f('0xc'),auth['isAuthenticated'](),controller[_0xcb4f('0xd')]);router[_0xcb4f('0x9')](_0xcb4f('0xe'),auth['isAuthenticated'](),controller[_0xcb4f('0xf')]);router[_0xcb4f('0x10')]('/',auth[_0xcb4f('0xa')](),controller[_0xcb4f('0x11')]);router[_0xcb4f('0x12')]('/:id',auth[_0xcb4f('0xa')](),controller['update']);router[_0xcb4f('0x13')](_0xcb4f('0xe'),auth[_0xcb4f('0xa')](),controller['destroy']);module[_0xcb4f('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index a63b735..16eec12 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 _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 +var _0x89c3=['exports','STRING','INTEGER','BOOLEAN','setDataValue','join','getDataValue','sequelize'];(function(_0x31ae7,_0x4579bc){var _0x2b35c2=function(_0x4ab8c8){while(--_0x4ab8c8){_0x31ae7['push'](_0x31ae7['shift']());}};_0x2b35c2(++_0x4579bc);}(_0x89c3,0xff));var _0x389c=function(_0x59d397,_0x1d533a){_0x59d397=_0x59d397-0x0;var _0x51e979=_0x89c3[_0x59d397];return _0x51e979;};'use strict';var Sequelize=require(_0x389c('0x0'));module[_0x389c('0x1')]={'name':{'type':Sequelize[_0x389c('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x389c('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x389c('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x389c('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x389c('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x389c('0x2')],'set':function(_0x5c6c68){this[_0x389c('0x5')]('crudPermissions',_0x5c6c68?_0x5c6c68[_0x389c('0x6')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x389c('0x7')]('crudPermissions')['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index b4f2d5c..e0487b3 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 _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 +var _0x4092=['findAll','rows','catch','show','options','create','update','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','limit','set','Content-Range','json','reject','destroy','then','error','name','send','UserProfileSection','rawAttributes','type','key','map','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','VIRTUAL','count','include'];(function(_0x5bd5fc,_0x57597){var _0x420110=function(_0x3d99d8){while(--_0x3d99d8){_0x5bd5fc['push'](_0x5bd5fc['shift']());}};_0x420110(++_0x57597);}(_0x4092,0x1af));var _0x2409=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0x4092[_0x56f7e2];return _0x36240b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2409('0x0'));var rimraf=require(_0x2409('0x1'));var zipdir=require(_0x2409('0x2'));var jsonpatch=require(_0x2409('0x3'));var rp=require(_0x2409('0x4'));var moment=require(_0x2409('0x5'));var BPromise=require(_0x2409('0x6'));var Mustache=require(_0x2409('0x7'));var util=require(_0x2409('0x8'));var path=require('path');var sox=require(_0x2409('0x9'));var csv=require(_0x2409('0xa'));var ejs=require(_0x2409('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2409('0xc'));var crypto=require(_0x2409('0xd'));var jsforce=require(_0x2409('0xe'));var deskjs=require(_0x2409('0xf'));var toCsv=require(_0x2409('0xa'));var querystring=require(_0x2409('0x10'));var Papa=require(_0x2409('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2409('0x12'));var as=require(_0x2409('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2409('0x14'));var utils=require('../../config/utils');var config=require(_0x2409('0x15'));var db=require(_0x2409('0x16'))['db'];function respondWithStatusCode(_0x149812,_0x5cd1f1){_0x5cd1f1=_0x5cd1f1||0xcc;return function(_0x580f8c){if(_0x580f8c){return _0x149812[_0x2409('0x17')](_0x5cd1f1);}return _0x149812[_0x2409('0x18')](_0x5cd1f1)['end']();};}function respondWithResult(_0x58532f,_0x3d1ad3){_0x3d1ad3=_0x3d1ad3||0xc8;return function(_0x3a6f0e){if(_0x3a6f0e){return _0x58532f['status'](_0x3d1ad3)['json'](_0x3a6f0e);}};}function respondWithFilteredResult(_0x575d51,_0xc24deb){return function(_0x1f9eda){if(_0x1f9eda){var _0x289dcf=_0x1f9eda['count'],_0x449a3d=_0xc24deb['offset'],_0x1937ce=_0xc24deb['offset']+_0xc24deb[_0x2409('0x19')],_0x1557ed;if(_0x1937ce>=_0x289dcf){_0x1937ce=_0x289dcf;_0x1557ed=0xc8;}else{_0x1557ed=0xce;}_0x575d51[_0x2409('0x18')](_0x1557ed);return _0x575d51[_0x2409('0x1a')](_0x2409('0x1b'),_0x449a3d+'-'+_0x1937ce+'/'+_0x289dcf)[_0x2409('0x1c')](_0x1f9eda);}return null;};}function patchUpdates(_0x31e28c){return function(_0x5aa2c1){try{jsonpatch['apply'](_0x5aa2c1,_0x31e28c,!![]);}catch(_0xfd1ea8){return BPromise[_0x2409('0x1d')](_0xfd1ea8);}return _0x5aa2c1['save']();};}function saveUpdates(_0x5daa29,_0x3da4fd){return function(_0x3c78ca){if(_0x3c78ca){return _0x3c78ca['update'](_0x5daa29)['then'](function(_0x21454f){return _0x21454f;});}return null;};}function removeEntity(_0x12c0e0,_0x3a9620){return function(_0x33c6df){if(_0x33c6df){return _0x33c6df[_0x2409('0x1e')]()[_0x2409('0x1f')](function(){_0x12c0e0[_0x2409('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x559c92,_0x17809d){return function(_0x47f7d7){if(!_0x47f7d7){_0x559c92[_0x2409('0x17')](0x194);}return _0x47f7d7;};}function handleError(_0x1eabd1,_0x53f382){_0x53f382=_0x53f382||0x1f4;return function(_0x27e1c9){logger[_0x2409('0x20')](_0x27e1c9['stack']);if(_0x27e1c9[_0x2409('0x21')]){delete _0x27e1c9[_0x2409('0x21')];}_0x1eabd1[_0x2409('0x18')](_0x53f382)[_0x2409('0x22')](_0x27e1c9);};}exports['index']=function(_0x25d2fb,_0x3f7277){var _0x1f5ed2={},_0x592c5d={},_0x97c0cb={'count':0x0,'rows':[]};var _0x411e8d=_['map'](db[_0x2409('0x23')][_0x2409('0x24')],function(_0x1ad2b3){return{'name':_0x1ad2b3['fieldName'],'type':_0x1ad2b3[_0x2409('0x25')][_0x2409('0x26')]};});_0x592c5d['model']=_[_0x2409('0x27')](_0x411e8d,_0x2409('0x21'));_0x592c5d['query']=_[_0x2409('0x28')](_0x25d2fb[_0x2409('0x29')]);_0x592c5d[_0x2409('0x2a')]=_[_0x2409('0x2b')](_0x592c5d['model'],_0x592c5d['query']);_0x1f5ed2[_0x2409('0x2c')]=_[_0x2409('0x2b')](_0x592c5d[_0x2409('0x2d')],qs[_0x2409('0x2e')](_0x25d2fb[_0x2409('0x29')][_0x2409('0x2e')]));_0x1f5ed2[_0x2409('0x2c')]=_0x1f5ed2['attributes'][_0x2409('0x2f')]?_0x1f5ed2[_0x2409('0x2c')]:_0x592c5d[_0x2409('0x2d')];if(!_0x25d2fb[_0x2409('0x29')][_0x2409('0x30')]('nolimit')){_0x1f5ed2[_0x2409('0x19')]=qs[_0x2409('0x19')](_0x25d2fb['query'][_0x2409('0x19')]);_0x1f5ed2[_0x2409('0x31')]=qs['offset'](_0x25d2fb[_0x2409('0x29')][_0x2409('0x31')]);}_0x1f5ed2[_0x2409('0x32')]=qs[_0x2409('0x33')](_0x25d2fb[_0x2409('0x29')]['sort']);_0x1f5ed2[_0x2409('0x34')]=qs[_0x2409('0x2a')](_[_0x2409('0x35')](_0x25d2fb['query'],_0x592c5d[_0x2409('0x2a')]),_0x411e8d);if(_0x25d2fb[_0x2409('0x29')][_0x2409('0x36')]){_0x1f5ed2[_0x2409('0x34')]=_[_0x2409('0x37')](_0x1f5ed2['where'],{'$or':_[_0x2409('0x27')](_0x411e8d,function(_0x2c9a52){if(_0x2c9a52[_0x2409('0x25')]!==_0x2409('0x38')){var _0x26936c={};_0x26936c[_0x2c9a52[_0x2409('0x21')]]={'$like':'%'+_0x25d2fb[_0x2409('0x29')][_0x2409('0x36')]+'%'};return _0x26936c;}})});}_0x1f5ed2=_[_0x2409('0x37')]({},_0x1f5ed2,_0x25d2fb['options']);var _0x33faa2={'where':_0x1f5ed2[_0x2409('0x34')]};return db[_0x2409('0x23')]['count'](_0x33faa2)[_0x2409('0x1f')](function(_0x1f7d0d){_0x97c0cb[_0x2409('0x39')]=_0x1f7d0d;if(_0x25d2fb[_0x2409('0x29')]['includeAll']){_0x1f5ed2[_0x2409('0x3a')]=[{'all':!![]}];}return db[_0x2409('0x23')][_0x2409('0x3b')](_0x1f5ed2);})[_0x2409('0x1f')](function(_0x2aceb6){_0x97c0cb[_0x2409('0x3c')]=_0x2aceb6;return _0x97c0cb;})[_0x2409('0x1f')](respondWithFilteredResult(_0x3f7277,_0x1f5ed2))[_0x2409('0x3d')](handleError(_0x3f7277,null));};exports[_0x2409('0x3e')]=function(_0x6fa16,_0x542254){var _0x57f775={'raw':![],'where':{'id':_0x6fa16['params']['id']}},_0x40ea42={};_0x40ea42[_0x2409('0x2d')]=_[_0x2409('0x28')](db[_0x2409('0x23')][_0x2409('0x24')]);_0x40ea42['query']=_['keys'](_0x6fa16[_0x2409('0x29')]);_0x40ea42[_0x2409('0x2a')]=_['intersection'](_0x40ea42[_0x2409('0x2d')],_0x40ea42[_0x2409('0x29')]);_0x57f775['attributes']=_[_0x2409('0x2b')](_0x40ea42[_0x2409('0x2d')],qs[_0x2409('0x2e')](_0x6fa16[_0x2409('0x29')]['fields']));_0x57f775[_0x2409('0x2c')]=_0x57f775['attributes']['length']?_0x57f775['attributes']:_0x40ea42[_0x2409('0x2d')];if(_0x6fa16['query']['includeAll']){_0x57f775[_0x2409('0x3a')]=[{'all':!![]}];}_0x57f775=_['merge']({},_0x57f775,_0x6fa16[_0x2409('0x3f')]);return db['UserProfileSection']['find'](_0x57f775)[_0x2409('0x1f')](handleEntityNotFound(_0x542254,null))[_0x2409('0x1f')](respondWithResult(_0x542254,null))['catch'](handleError(_0x542254,null));};exports[_0x2409('0x40')]=function(_0x288913,_0x137314){return db[_0x2409('0x23')][_0x2409('0x40')](_0x288913['body'],{})[_0x2409('0x1f')](respondWithResult(_0x137314,0xc9))[_0x2409('0x3d')](handleError(_0x137314,null));};exports[_0x2409('0x41')]=function(_0xfc710,_0x265d73){if(_0xfc710[_0x2409('0x42')]['id']){delete _0xfc710[_0x2409('0x42')]['id'];}return db[_0x2409('0x23')][_0x2409('0x43')]({'where':{'id':_0xfc710[_0x2409('0x44')]['id']}})[_0x2409('0x1f')](handleEntityNotFound(_0x265d73,null))[_0x2409('0x1f')](saveUpdates(_0xfc710[_0x2409('0x42')],null))[_0x2409('0x1f')](respondWithResult(_0x265d73,null))[_0x2409('0x3d')](handleError(_0x265d73,null));};exports[_0x2409('0x1e')]=function(_0x43a219,_0x43aebd){return db[_0x2409('0x23')][_0x2409('0x43')]({'where':{'id':_0x43a219[_0x2409('0x44')]['id']}})[_0x2409('0x1f')](handleEntityNotFound(_0x43aebd,null))[_0x2409('0x1f')](removeEntity(_0x43aebd,null))[_0x2409('0x3d')](handleError(_0x43aebd,null));};exports['describe']=function(_0x4003bc,_0x3ab6d8){return db['UserProfileSection'][_0x2409('0x45')]()[_0x2409('0x1f')](respondWithResult(_0x3ab6d8,null))['catch'](handleError(_0x3ab6d8,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index be41faa..da887f9 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 _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 +var _0xd71f=['../../config/environment','define','UserProfileSection','sectionId','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x14ab31,_0x4dff45){var _0x5458ea=function(_0x4e8ce8){while(--_0x4e8ce8){_0x14ab31['push'](_0x14ab31['shift']());}};_0x5458ea(++_0x4dff45);}(_0xd71f,0x101));var _0xfd71=function(_0x239879,_0x14cc25){_0x239879=_0x239879-0x0;var _0x59d26d=_0xd71f[_0x239879];return _0x59d26d;};'use strict';var _=require(_0xfd71('0x0'));var util=require('util');var logger=require(_0xfd71('0x1'))(_0xfd71('0x2'));var moment=require(_0xfd71('0x3'));var BPromise=require('bluebird');var rp=require(_0xfd71('0x4'));var fs=require('fs');var path=require(_0xfd71('0x5'));var rimraf=require(_0xfd71('0x6'));var config=require(_0xfd71('0x7'));var attributes=require('./userProfileSection.attributes');module['exports']=function(_0x29b202,_0x1917ea){return _0x29b202[_0xfd71('0x8')](_0xfd71('0x9'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xfd71('0xa'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 8c92727..e77bd21 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 _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 +var _0xbebd=['then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x24c134,_0x108719){var _0x18817b=function(_0x10b8fc){while(--_0x10b8fc){_0x24c134['push'](_0x24c134['shift']());}};_0x18817b(++_0x108719);}(_0xbebd,0x1ab));var _0xdbeb=function(_0x2569c5,_0x47f34c){_0x2569c5=_0x2569c5-0x0;var _0xacda67=_0xbebd[_0x2569c5];return _0xacda67;};'use strict';var _=require(_0xdbeb('0x0'));var util=require(_0xdbeb('0x1'));var moment=require('moment');var BPromise=require(_0xdbeb('0x2'));var rs=require(_0xdbeb('0x3'));var fs=require('fs');var Redis=require(_0xdbeb('0x4'));var db=require(_0xdbeb('0x5'))['db'];var utils=require(_0xdbeb('0x6'));var logger=require(_0xdbeb('0x7'))(_0xdbeb('0x8'));var config=require(_0xdbeb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdbeb('0xa')][_0xdbeb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xab6610,_0x985480,_0x494e71){return new BPromise(function(_0x2980ca,_0x149774){return client[_0xdbeb('0xc')](_0xab6610,_0x494e71)[_0xdbeb('0xd')](function(_0x5bbf4a){logger[_0xdbeb('0xe')](_0xdbeb('0xf'),_0x985480,_0xdbeb('0x10'));logger[_0xdbeb('0x11')](_0xdbeb('0x12'),_0x985480,'request\x20sent',JSON['stringify'](_0x5bbf4a));if(_0x5bbf4a[_0xdbeb('0x13')]){if(_0x5bbf4a[_0xdbeb('0x13')][_0xdbeb('0x14')]===0x1f4){logger['error'](_0xdbeb('0xf'),_0x985480,_0x5bbf4a[_0xdbeb('0x13')][_0xdbeb('0x15')]);return _0x149774(_0x5bbf4a['error'][_0xdbeb('0x15')]);}logger['error'](_0xdbeb('0xf'),_0x985480,_0x5bbf4a[_0xdbeb('0x13')][_0xdbeb('0x15')]);return _0x2980ca(_0x5bbf4a['error'][_0xdbeb('0x15')]);}else{logger['info'](_0xdbeb('0xf'),_0x985480,_0xdbeb('0x10'));_0x2980ca(_0x5bbf4a['result'][_0xdbeb('0x15')]);}})['catch'](function(_0x46b13e){logger[_0xdbeb('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x985480,_0x46b13e);_0x149774(_0x46b13e);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 419cbb4..01944e8 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 _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 +var _0x292f=['exports','multer','util','path','express','Router','../../components/interaction/service'];(function(_0x35f5a5,_0x3f8a65){var _0x143dce=function(_0x5c3197){while(--_0x5c3197){_0x35f5a5['push'](_0x35f5a5['shift']());}};_0x143dce(++_0x3f8a65);}(_0x292f,0x1c8));var _0xf292=function(_0x231dda,_0x5b04cc){_0x231dda=_0x231dda-0x0;var _0x3f88cb=_0x292f[_0x231dda];return _0x3f88cb;};'use strict';var multer=require(_0xf292('0x0'));var util=require(_0xf292('0x1'));var path=require(_0xf292('0x2'));var timeout=require('connect-timeout');var express=require(_0xf292('0x3'));var router=express[_0xf292('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xf292('0x5'));var config=require('../../config/environment');module[_0xf292('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 870f252..7520f21 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_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 +var _0xd8b0=['exports','sequelize'];(function(_0x4c5a24,_0x5ef60c){var _0x4b067e=function(_0x33c0da){while(--_0x33c0da){_0x4c5a24['push'](_0x4c5a24['shift']());}};_0x4b067e(++_0x5ef60c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 0eeff06..5a186a3 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 _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 +var _0x5662=['define','UserSmsQueue','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5662,0xf9));var _0x2566=function(_0x37e7da,_0x492b80){_0x37e7da=_0x37e7da-0x0;var _0x391672=_0x5662[_0x37e7da];return _0x391672;};'use strict';var _=require(_0x2566('0x0'));var util=require(_0x2566('0x1'));var logger=require(_0x2566('0x2'))('api');var moment=require(_0x2566('0x3'));var BPromise=require(_0x2566('0x4'));var rp=require(_0x2566('0x5'));var fs=require('fs');var path=require(_0x2566('0x6'));var rimraf=require(_0x2566('0x7'));var config=require(_0x2566('0x8'));var attributes=require(_0x2566('0x9'));module[_0x2566('0xa')]=function(_0xcfca2,_0x481299){return _0xcfca2[_0x2566('0xb')](_0x2566('0xc'),attributes,{'tableName':'user_has_sms_queues','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 374284a..e1a41ec 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 _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 +var _0x1aa5=['UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','info'];(function(_0x3bd6a2,_0x16d1da){var _0x3382f2=function(_0x35d124){while(--_0x35d124){_0x3bd6a2['push'](_0x3bd6a2['shift']());}};_0x3382f2(++_0x16d1da);}(_0x1aa5,0xe1));var _0x51aa=function(_0x3f5dc3,_0x1d07b7){_0x3f5dc3=_0x3f5dc3-0x0;var _0x1edce4=_0x1aa5[_0x3f5dc3];return _0x1edce4;};'use strict';var _=require('lodash');var util=require(_0x51aa('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x51aa('0x1'));var fs=require('fs');var Redis=require(_0x51aa('0x2'));var db=require(_0x51aa('0x3'))['db'];var utils=require(_0x51aa('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x51aa('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x51aa('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f7565,_0x4c4bcf,_0x9a9ceb){return new BPromise(function(_0x3e9a1c,_0x41ca52){return client[_0x51aa('0x7')](_0x3f7565,_0x9a9ceb)['then'](function(_0x18117e){logger[_0x51aa('0x8')](_0x51aa('0x9'),_0x4c4bcf,_0x51aa('0xa'));logger['debug'](_0x51aa('0xb'),_0x4c4bcf,_0x51aa('0xa'),JSON[_0x51aa('0xc')](_0x18117e));if(_0x18117e[_0x51aa('0xd')]){if(_0x18117e['error'][_0x51aa('0xe')]===0x1f4){logger[_0x51aa('0xd')](_0x51aa('0x9'),_0x4c4bcf,_0x18117e[_0x51aa('0xd')][_0x51aa('0xf')]);return _0x41ca52(_0x18117e['error'][_0x51aa('0xf')]);}logger[_0x51aa('0xd')](_0x51aa('0x9'),_0x4c4bcf,_0x18117e[_0x51aa('0xd')]['message']);return _0x3e9a1c(_0x18117e[_0x51aa('0xd')]['message']);}else{logger[_0x51aa('0x8')](_0x51aa('0x9'),_0x4c4bcf,'request\x20sent');_0x3e9a1c(_0x18117e[_0x51aa('0x10')][_0x51aa('0xf')]);}})[_0x51aa('0x11')](function(_0x2f68ae){logger[_0x51aa('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x4c4bcf,_0x2f68ae);_0x41ca52(_0x2f68ae);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index f883b89..4e06f78 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 _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 +var _0x2981=['express','Router','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0xf93b08,_0x2559d7){var _0x12f72e=function(_0x30534b){while(--_0x30534b){_0xf93b08['push'](_0xf93b08['shift']());}};_0x12f72e(++_0x2559d7);}(_0x2981,0x184));var _0x1298=function(_0x30e2b0,_0xd270f6){_0x30e2b0=_0x30e2b0-0x0;var _0x596af9=_0x2981[_0x30e2b0];return _0x596af9;};'use strict';var multer=require(_0x1298('0x0'));var util=require(_0x1298('0x1'));var path=require(_0x1298('0x2'));var timeout=require(_0x1298('0x3'));var express=require(_0x1298('0x4'));var router=express[_0x1298('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1298('0x6'));module[_0x1298('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 34cf373..75947c9 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(_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 +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x21d105,_0x157e99){var _0x2523dc=function(_0x2de3c9){while(--_0x2de3c9){_0x21d105['push'](_0x21d105['shift']());}};_0x2523dc(++_0x157e99);}(_0xe706,0xa3));var _0x6e70=function(_0x455893,_0x909838){_0x455893=_0x455893-0x0;var _0x3851e8=_0xe706[_0x455893];return _0x3851e8;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 6d6f1ee..5d1e79c 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 _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 +var _0xadb8=['UserVoiceQueue','user_has_voice_queues','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','define'];(function(_0x5eb13b,_0x53bbc8){var _0x5b3b0b=function(_0x7259c4){while(--_0x7259c4){_0x5eb13b['push'](_0x5eb13b['shift']());}};_0x5b3b0b(++_0x53bbc8);}(_0xadb8,0x1d0));var _0x8adb=function(_0x381a28,_0x4eb359){_0x381a28=_0x381a28-0x0;var _0x5e572d=_0xadb8[_0x381a28];return _0x5e572d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8adb('0x0'))('api');var moment=require(_0x8adb('0x1'));var BPromise=require(_0x8adb('0x2'));var rp=require(_0x8adb('0x3'));var fs=require('fs');var path=require(_0x8adb('0x4'));var rimraf=require(_0x8adb('0x5'));var config=require(_0x8adb('0x6'));var attributes=require(_0x8adb('0x7'));module['exports']=function(_0x15bc63,_0x1a5f36){return _0x15bc63[_0x8adb('0x8')](_0x8adb('0x9'),attributes,{'tableName':_0x8adb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 3e63a50..189ac8c 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 _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 +var _0x62b6=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','message','info','catch','lodash','util','moment'];(function(_0x580f6e,_0x424c8f){var _0x2c942f=function(_0x21b4be){while(--_0x21b4be){_0x580f6e['push'](_0x580f6e['shift']());}};_0x2c942f(++_0x424c8f);}(_0x62b6,0x123));var _0x662b=function(_0x272404,_0x14f5cd){_0x272404=_0x272404-0x0;var _0x2bfc14=_0x62b6[_0x272404];return _0x2bfc14;};'use strict';var _=require(_0x662b('0x0'));var util=require(_0x662b('0x1'));var moment=require(_0x662b('0x2'));var BPromise=require(_0x662b('0x3'));var rs=require(_0x662b('0x4'));var fs=require('fs');var Redis=require(_0x662b('0x5'));var db=require(_0x662b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x662b('0x7'))('rpc');var config=require(_0x662b('0x8'));var jayson=require(_0x662b('0x9'));var client=jayson[_0x662b('0xa')][_0x662b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x533e1d,_0x9b4e1d,_0x557a0e){return new BPromise(function(_0xdb2c22,_0x57f627){return client[_0x662b('0xc')](_0x533e1d,_0x557a0e)[_0x662b('0xd')](function(_0x14a234){logger['info'](_0x662b('0xe'),_0x9b4e1d,_0x662b('0xf'));logger['debug'](_0x662b('0x10'),_0x9b4e1d,_0x662b('0xf'),JSON['stringify'](_0x14a234));if(_0x14a234['error']){if(_0x14a234['error']['code']===0x1f4){logger[_0x662b('0x11')](_0x662b('0xe'),_0x9b4e1d,_0x14a234['error'][_0x662b('0x12')]);return _0x57f627(_0x14a234[_0x662b('0x11')][_0x662b('0x12')]);}logger['error'](_0x662b('0xe'),_0x9b4e1d,_0x14a234[_0x662b('0x11')][_0x662b('0x12')]);return _0xdb2c22(_0x14a234[_0x662b('0x11')][_0x662b('0x12')]);}else{logger[_0x662b('0x13')](_0x662b('0xe'),_0x9b4e1d,_0x662b('0xf'));_0xdb2c22(_0x14a234['result']['message']);}})[_0x662b('0x14')](function(_0x45a016){logger[_0x662b('0x11')](_0x662b('0xe'),_0x9b4e1d,_0x45a016);_0x57f627(_0x45a016);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 20ba383..55321c4 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 _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 +var _0x4816=['../../components/auth/service','../../components/interaction/service','exports','util','path','express','Router'];(function(_0x403fc7,_0x32931a){var _0x5d0827=function(_0x5ea698){while(--_0x5ea698){_0x403fc7['push'](_0x403fc7['shift']());}};_0x5d0827(++_0x32931a);}(_0x4816,0x1bc));var _0x6481=function(_0x59d546,_0x107f05){_0x59d546=_0x59d546-0x0;var _0x41fbdb=_0x4816[_0x59d546];return _0x41fbdb;};'use strict';var multer=require('multer');var util=require(_0x6481('0x0'));var path=require(_0x6481('0x1'));var timeout=require('connect-timeout');var express=require(_0x6481('0x2'));var router=express[_0x6481('0x3')]();var auth=require(_0x6481('0x4'));var interaction=require(_0x6481('0x5'));var config=require('../../config/environment');module[_0x6481('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index d0b568d..89ac37d 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 _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 +var _0x14d8=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x50b850,_0x797ed2){var _0x348619=function(_0x2b12f5){while(--_0x2b12f5){_0x50b850['push'](_0x50b850['shift']());}};_0x348619(++_0x797ed2);}(_0x14d8,0xb6));var _0x814d=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x14d8[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0x814d('0x0'));module[_0x814d('0x1')]={'uniqueid':{'type':Sequelize[_0x814d('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x814d('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x814d('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x814d('0x4')],'allowNull':![],'unique':_0x814d('0x5'),'comment':_0x814d('0x3')},'VoiceQueueId':{'type':Sequelize[_0x814d('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x814d('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x814d('0x2')](0xb),'defaultValue':0x0,'comment':_0x814d('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index a743c77..bd667ba 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 _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 +var _0x4b4f=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove'];(function(_0x4d869b,_0x2c278d){var _0x306b32=function(_0x38f3e8){while(--_0x38f3e8){_0x4d869b['push'](_0x4d869b['shift']());}};_0x306b32(++_0x2c278d);}(_0x4b4f,0x1c7));var _0xf4b4=function(_0x1c5909,_0x4f9067){_0x1c5909=_0x1c5909-0x0;var _0x34bf11=_0x4b4f[_0x1c5909];return _0x34bf11;};'use strict';var EventEmitter=require(_0xf4b4('0x0'));var UserVoiceQueueRt=require(_0xf4b4('0x1'))['db'][_0xf4b4('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xf4b4('0x3')](0x0);var events={'afterCreate':_0xf4b4('0x4'),'afterUpdate':_0xf4b4('0x5'),'afterDestroy':_0xf4b4('0x6')};function emitEvent(_0x553a9b){return function(_0x54f6a9,_0x701ae6,_0x2cb1ab){UserVoiceQueueRtEvents['emit'](_0x553a9b+':'+_0x54f6a9['id'],_0x54f6a9);UserVoiceQueueRtEvents[_0xf4b4('0x7')](_0x553a9b,_0x54f6a9);_0x2cb1ab(null);};}for(var e in events){if(events[_0xf4b4('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0xf4b4('0x9')](e,emitEvent(event));}}module[_0xf4b4('0xa')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 1c296c5..df63cb5 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 _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 +var _0x423d=['api','moment','bluebird','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','define','user_has_voice_queues_rt','../../config/logger'];(function(_0x2eb9e9,_0x3dfdd7){var _0x3279aa=function(_0x1ef168){while(--_0x1ef168){_0x2eb9e9['push'](_0x2eb9e9['shift']());}};_0x3279aa(++_0x3dfdd7);}(_0x423d,0x199));var _0xd423=function(_0x12c5fe,_0x5587a0){_0x12c5fe=_0x12c5fe-0x0;var _0x2a86a0=_0x423d[_0x12c5fe];return _0x2a86a0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd423('0x0'))(_0xd423('0x1'));var moment=require(_0xd423('0x2'));var BPromise=require(_0xd423('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd423('0x4'));var rimraf=require(_0xd423('0x5'));var config=require(_0xd423('0x6'));var attributes=require(_0xd423('0x7'));module['exports']=function(_0x384ccf,_0x48e1c8){return _0x384ccf[_0xd423('0x8')]('UserVoiceQueueRt',attributes,{'tableName':_0xd423('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 1912a8c..5bc03a4 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 _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 +var _0x36c2=['code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x36c2,0xab));var _0x236c=function(_0x351818,_0x328a3e){_0x351818=_0x351818-0x0;var _0x49aaae=_0x36c2[_0x351818];return _0x49aaae;};'use strict';var _=require(_0x236c('0x0'));var util=require(_0x236c('0x1'));var moment=require(_0x236c('0x2'));var BPromise=require(_0x236c('0x3'));var rs=require(_0x236c('0x4'));var fs=require('fs');var Redis=require(_0x236c('0x5'));var db=require(_0x236c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x236c('0x7'))(_0x236c('0x8'));var config=require(_0x236c('0x9'));var jayson=require(_0x236c('0xa'));var client=jayson[_0x236c('0xb')][_0x236c('0xc')]({'port':0x232a});config[_0x236c('0xd')]=_[_0x236c('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x236c('0xf'))(new Redis(config[_0x236c('0xd')]));require('./userVoiceQueueRt.socket')[_0x236c('0x10')](socket);function respondWithRpcPromise(_0x3fbf5e,_0x4726d8,_0x560dd9){return new BPromise(function(_0x3cec98,_0x48841f){return client['request'](_0x3fbf5e,_0x560dd9)[_0x236c('0x11')](function(_0x2e3e10){logger[_0x236c('0x12')](_0x236c('0x13'),_0x4726d8,_0x236c('0x14'));logger['debug'](_0x236c('0x15'),_0x4726d8,_0x236c('0x14'),JSON[_0x236c('0x16')](_0x2e3e10));if(_0x2e3e10[_0x236c('0x17')]){if(_0x2e3e10[_0x236c('0x17')][_0x236c('0x18')]===0x1f4){logger[_0x236c('0x17')](_0x236c('0x13'),_0x4726d8,_0x2e3e10['error'][_0x236c('0x19')]);return _0x48841f(_0x2e3e10[_0x236c('0x17')][_0x236c('0x19')]);}logger['error'](_0x236c('0x13'),_0x4726d8,_0x2e3e10[_0x236c('0x17')][_0x236c('0x19')]);return _0x3cec98(_0x2e3e10[_0x236c('0x17')][_0x236c('0x19')]);}else{logger[_0x236c('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x4726d8,_0x236c('0x14'));_0x3cec98(_0x2e3e10[_0x236c('0x1a')][_0x236c('0x19')]);}})[_0x236c('0x1b')](function(_0x7c6415){logger[_0x236c('0x17')](_0x236c('0x13'),_0x4726d8,_0x7c6415);_0x48841f(_0x7c6415);});});}exports[_0x236c('0x1c')]=function(_0x1307ad){var _0x56ad37=this;return new Promise(function(_0xb6039,_0x3e2be3){return db[_0x236c('0x1d')][_0x236c('0x1e')]({'raw':_0x1307ad[_0x236c('0x1f')]?_0x1307ad[_0x236c('0x1f')][_0x236c('0x20')]===undefined?!![]:![]:!![],'where':_0x1307ad[_0x236c('0x1f')]?_0x1307ad['options']['where']||null:null,'attributes':[[db[_0x236c('0x21')]['fn'](_0x236c('0x22'),db[_0x236c('0x21')]['fn']('IF',db['sequelize'][_0x236c('0x23')](_0x236c('0x24')))),_0x236c('0x25')]]})['then'](function(_0x44ec61){logger['info'](_0x236c('0x1c'),_0x1307ad);logger[_0x236c('0x26')](_0x236c('0x1c'),_0x1307ad,JSON['stringify'](_0x44ec61));_0xb6039(_0x44ec61);})['catch'](function(_0x17dcf3){logger[_0x236c('0x17')](_0x236c('0x1c'),_0x17dcf3[_0x236c('0x19')],_0x1307ad);_0x3e2be3(_0x56ad37[_0x236c('0x17')](0x1f4,_0x17dcf3[_0x236c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 5f1d71e..8a4675d 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 _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 +var _0x3b84=['register','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','update','emit','removeListener'];(function(_0xef7b42,_0xf9ab01){var _0x5c3893=function(_0xaf24be){while(--_0xaf24be){_0xef7b42['push'](_0xef7b42['shift']());}};_0x5c3893(++_0xf9ab01);}(_0x3b84,0x1a6));var _0x43b8=function(_0x12f74f,_0x2e6653){_0x12f74f=_0x12f74f-0x0;var _0x5f0581=_0x3b84[_0x12f74f];return _0x5f0581;};'use strict';var UserVoiceQueueRtEvents=require(_0x43b8('0x0'));var events=['save',_0x43b8('0x1'),_0x43b8('0x2')];function createListener(_0x45ce26,_0x4e2b48){return function(_0x13642f){_0x4e2b48[_0x43b8('0x3')](_0x45ce26,_0x13642f);};}function removeListener(_0x4663c4,_0xaa5d7){return function(){UserVoiceQueueRtEvents[_0x43b8('0x4')](_0x4663c4,_0xaa5d7);};}exports[_0x43b8('0x5')]=function(_0xfbd591){for(var _0x3aed86=0x0,_0x513075=events['length'];_0x3aed86<_0x513075;_0x3aed86++){var _0x315f38=events[_0x3aed86];var _0x357002=createListener(_0x43b8('0x6')+_0x315f38,_0xfbd591);UserVoiceQueueRtEvents['on'](_0x315f38,_0x357002);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 069f128..d2ef4c5 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 _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 +var _0x3ff2=['../../config/environment','exports','util','connect-timeout','../../components/interaction/service'];(function(_0x46cf7e,_0xe67477){var _0x241ad7=function(_0x2e8aa7){while(--_0x2e8aa7){_0x46cf7e['push'](_0x46cf7e['shift']());}};_0x241ad7(++_0xe67477);}(_0x3ff2,0xc5));var _0x23ff=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3ff2[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x23ff('0x0'));var path=require('path');var timeout=require(_0x23ff('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x23ff('0x2'));var config=require(_0x23ff('0x3'));module[_0x23ff('0x4')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index e37c6f2..f14d435 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(_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 +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x22dca7,_0x535d95){var _0x3d3e7d=function(_0x591bb8){while(--_0x591bb8){_0x22dca7['push'](_0x22dca7['shift']());}};_0x3d3e7d(++_0x535d95);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 60497ab..511c725 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 _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 +var _0x9c00=['path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','moment','bluebird'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x9c00,0x1a0));var _0x09c0=function(_0x5a60ce,_0x48f080){_0x5a60ce=_0x5a60ce-0x0;var _0x393e5e=_0x9c00[_0x5a60ce];return _0x393e5e;};'use strict';var _=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x09c0('0x2'));var BPromise=require(_0x09c0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x09c0('0x4'));var rimraf=require(_0x09c0('0x5'));var config=require(_0x09c0('0x6'));var attributes=require(_0x09c0('0x7'));module[_0x09c0('0x8')]=function(_0x5914eb,_0x4d5fc3){return _0x5914eb[_0x09c0('0x9')](_0x09c0('0xa'),attributes,{'tableName':_0x09c0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index a44c53e..674d0aa 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(_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 +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(_0x515a54,_0x90f4b7){var _0x3f7cae=function(_0x19f68e){while(--_0x19f68e){_0x515a54['push'](_0x515a54['shift']());}};_0x3f7cae(++_0x90f4b7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 1b8cc61..6591123 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 _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 +var _0x5da6=['../../components/interaction/service','../../config/environment','./variable.controller','index','get','/:id','isAuthenticated','show','post','create','delete','exports','multer','util','connect-timeout','Router','../../components/auth/service'];(function(_0x5b801a,_0x30b70c){var _0x1ed93e=function(_0x46d84a){while(--_0x46d84a){_0x5b801a['push'](_0x5b801a['shift']());}};_0x1ed93e(++_0x30b70c);}(_0x5da6,0x83));var _0x65da=function(_0x59d0cc,_0xa7c52b){_0x59d0cc=_0x59d0cc-0x0;var _0x2ae79f=_0x5da6[_0x59d0cc];return _0x2ae79f;};'use strict';var multer=require(_0x65da('0x0'));var util=require(_0x65da('0x1'));var path=require('path');var timeout=require(_0x65da('0x2'));var express=require('express');var router=express[_0x65da('0x3')]();var auth=require(_0x65da('0x4'));var interaction=require(_0x65da('0x5'));var config=require(_0x65da('0x6'));var controller=require(_0x65da('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x65da('0x8')]);router[_0x65da('0x9')](_0x65da('0xa'),auth[_0x65da('0xb')](),controller[_0x65da('0xc')]);router[_0x65da('0xd')]('/',auth[_0x65da('0xb')](),controller[_0x65da('0xe')]);router['put'](_0x65da('0xa'),auth[_0x65da('0xb')](),controller['update']);router[_0x65da('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x65da('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index aefd65c..76ef841 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 _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 +var _0x746a=['exports','STRING','sequelize'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x746a,0xe9));var _0xa746=function(_0x242068,_0x55088f){_0x242068=_0x242068-0x0;var _0x1752d8=_0x746a[_0x242068];return _0x1752d8;};'use strict';var Sequelize=require(_0xa746('0x0'));module[_0xa746('0x1')]={'name':{'type':Sequelize[_0xa746('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa746('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 4346e87..4933127 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 _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 +var _0x20d3=['length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','options','catch','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','Variables','sendStatus','error','name','index','map','Variable','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields'];(function(_0x4b6985,_0x55a17b){var _0x7df500=function(_0x22e369){while(--_0x22e369){_0x4b6985['push'](_0x4b6985['shift']());}};_0x7df500(++_0x55a17b);}(_0x20d3,0xb9));var _0x320d=function(_0x44bafc,_0x733252){_0x44bafc=_0x44bafc-0x0;var _0x4bd177=_0x20d3[_0x44bafc];return _0x4bd177;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x320d('0x0'));var jsonpatch=require(_0x320d('0x1'));var rp=require(_0x320d('0x2'));var moment=require('moment');var BPromise=require(_0x320d('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x320d('0x4'));var sox=require(_0x320d('0x5'));var csv=require(_0x320d('0x6'));var ejs=require(_0x320d('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x320d('0x8'));var crypto=require(_0x320d('0x9'));var jsforce=require(_0x320d('0xa'));var deskjs=require(_0x320d('0xb'));var toCsv=require(_0x320d('0x6'));var querystring=require(_0x320d('0xc'));var Papa=require(_0x320d('0xd'));var Redis=require('ioredis');var authService=require(_0x320d('0xe'));var qs=require(_0x320d('0xf'));var as=require(_0x320d('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x320d('0x11'))(_0x320d('0x12'));var utils=require(_0x320d('0x13'));var config=require(_0x320d('0x14'));var db=require(_0x320d('0x15'))['db'];function respondWithStatusCode(_0x15ecef,_0x3de245){_0x3de245=_0x3de245||0xcc;return function(_0x5ba7f2){if(_0x5ba7f2){return _0x15ecef['sendStatus'](_0x3de245);}return _0x15ecef[_0x320d('0x16')](_0x3de245)['end']();};}function respondWithResult(_0x5121ad,_0x4db6ed){_0x4db6ed=_0x4db6ed||0xc8;return function(_0x571dcb){if(_0x571dcb){return _0x5121ad[_0x320d('0x16')](_0x4db6ed)[_0x320d('0x17')](_0x571dcb);}};}function respondWithFilteredResult(_0x38782f,_0x4104b8){return function(_0xa3b992){if(_0xa3b992){var _0x321589=_0xa3b992[_0x320d('0x18')],_0x107c82=_0x4104b8['offset'],_0x904850=_0x4104b8[_0x320d('0x19')]+_0x4104b8[_0x320d('0x1a')],_0x289b1e;if(_0x904850>=_0x321589){_0x904850=_0x321589;_0x289b1e=0xc8;}else{_0x289b1e=0xce;}_0x38782f[_0x320d('0x16')](_0x289b1e);return _0x38782f['set'](_0x320d('0x1b'),_0x107c82+'-'+_0x904850+'/'+_0x321589)[_0x320d('0x17')](_0xa3b992);}return null;};}function patchUpdates(_0x343bc0){return function(_0xda4c01){try{jsonpatch[_0x320d('0x1c')](_0xda4c01,_0x343bc0,!![]);}catch(_0x868266){return BPromise[_0x320d('0x1d')](_0x868266);}return _0xda4c01[_0x320d('0x1e')]();};}function saveUpdates(_0x23bbff,_0x3c768b){return function(_0x42f8ab){if(_0x42f8ab){return _0x42f8ab[_0x320d('0x1f')](_0x23bbff)[_0x320d('0x20')](function(_0x3ca88f){return _0x3ca88f;});}return null;};}function removeEntity(_0x5ed498,_0x12a38d){return function(_0x59200f){if(_0x59200f){return _0x59200f[_0x320d('0x21')]()[_0x320d('0x20')](function(){var _0x1f708a=_0x59200f[_0x320d('0x22')]({'plain':!![]});var _0x3633c6=_0x320d('0x23');return db['UserProfileResource'][_0x320d('0x21')]({'where':{'type':_0x3633c6,'resourceId':_0x1f708a['id']}})[_0x320d('0x20')](function(){return _0x59200f;});})[_0x320d('0x20')](function(){_0x5ed498['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x433fee,_0x3b4580){return function(_0x4df4dd){if(!_0x4df4dd){_0x433fee[_0x320d('0x24')](0x194);}return _0x4df4dd;};}function handleError(_0x997022,_0xc4f79d){_0xc4f79d=_0xc4f79d||0x1f4;return function(_0x4e9d21){logger[_0x320d('0x25')](_0x4e9d21['stack']);if(_0x4e9d21[_0x320d('0x26')]){delete _0x4e9d21['name'];}_0x997022[_0x320d('0x16')](_0xc4f79d)['send'](_0x4e9d21);};}exports[_0x320d('0x27')]=function(_0x266e05,_0x56bdd4){var _0x5c0cc8={},_0x52ce54={},_0x5d7287={'count':0x0,'rows':[]};var _0x2471c6=_[_0x320d('0x28')](db[_0x320d('0x29')]['rawAttributes'],function(_0x426c4a){return{'name':_0x426c4a[_0x320d('0x2a')],'type':_0x426c4a[_0x320d('0x2b')][_0x320d('0x2c')]};});_0x52ce54[_0x320d('0x2d')]=_[_0x320d('0x28')](_0x2471c6,_0x320d('0x26'));_0x52ce54['query']=_[_0x320d('0x2e')](_0x266e05[_0x320d('0x2f')]);_0x52ce54[_0x320d('0x30')]=_[_0x320d('0x31')](_0x52ce54[_0x320d('0x2d')],_0x52ce54[_0x320d('0x2f')]);_0x5c0cc8[_0x320d('0x32')]=_[_0x320d('0x31')](_0x52ce54[_0x320d('0x2d')],qs[_0x320d('0x33')](_0x266e05[_0x320d('0x2f')][_0x320d('0x33')]));_0x5c0cc8[_0x320d('0x32')]=_0x5c0cc8[_0x320d('0x32')][_0x320d('0x34')]?_0x5c0cc8['attributes']:_0x52ce54[_0x320d('0x2d')];if(!_0x266e05['query']['hasOwnProperty']('nolimit')){_0x5c0cc8[_0x320d('0x1a')]=qs[_0x320d('0x1a')](_0x266e05[_0x320d('0x2f')][_0x320d('0x1a')]);_0x5c0cc8[_0x320d('0x19')]=qs['offset'](_0x266e05[_0x320d('0x2f')][_0x320d('0x19')]);}_0x5c0cc8[_0x320d('0x35')]=qs[_0x320d('0x36')](_0x266e05['query'][_0x320d('0x36')]);_0x5c0cc8[_0x320d('0x37')]=qs[_0x320d('0x30')](_[_0x320d('0x38')](_0x266e05[_0x320d('0x2f')],_0x52ce54[_0x320d('0x30')]),_0x2471c6);if(_0x266e05[_0x320d('0x2f')][_0x320d('0x39')]){_0x5c0cc8['where']=_[_0x320d('0x3a')](_0x5c0cc8[_0x320d('0x37')],{'$or':_[_0x320d('0x28')](_0x2471c6,function(_0x3bc48c){if(_0x3bc48c['type']!==_0x320d('0x3b')){var _0x89127b={};_0x89127b[_0x3bc48c[_0x320d('0x26')]]={'$like':'%'+_0x266e05[_0x320d('0x2f')][_0x320d('0x39')]+'%'};return _0x89127b;}})});}_0x5c0cc8=_[_0x320d('0x3a')]({},_0x5c0cc8,_0x266e05['options']);var _0x1f12a7={'where':_0x5c0cc8[_0x320d('0x37')]};return db['Variable'][_0x320d('0x18')](_0x1f12a7)['then'](function(_0x598d33){_0x5d7287['count']=_0x598d33;if(_0x266e05[_0x320d('0x2f')][_0x320d('0x3c')]){_0x5c0cc8[_0x320d('0x3d')]=[{'all':!![]}];}return db[_0x320d('0x29')][_0x320d('0x3e')](_0x5c0cc8);})[_0x320d('0x20')](function(_0x39cf3e){_0x5d7287[_0x320d('0x3f')]=_0x39cf3e;return _0x5d7287;})['then'](respondWithFilteredResult(_0x56bdd4,_0x5c0cc8))['catch'](handleError(_0x56bdd4,null));};exports[_0x320d('0x40')]=function(_0x43d5fb,_0x206c3d){var _0x568add={'raw':!![],'where':{'id':_0x43d5fb[_0x320d('0x41')]['id']}},_0x37ec5f={};_0x37ec5f['model']=_[_0x320d('0x2e')](db[_0x320d('0x29')][_0x320d('0x42')]);_0x37ec5f['query']=_[_0x320d('0x2e')](_0x43d5fb[_0x320d('0x2f')]);_0x37ec5f[_0x320d('0x30')]=_[_0x320d('0x31')](_0x37ec5f[_0x320d('0x2d')],_0x37ec5f['query']);_0x568add[_0x320d('0x32')]=_[_0x320d('0x31')](_0x37ec5f[_0x320d('0x2d')],qs[_0x320d('0x33')](_0x43d5fb[_0x320d('0x2f')][_0x320d('0x33')]));_0x568add[_0x320d('0x32')]=_0x568add['attributes'][_0x320d('0x34')]?_0x568add[_0x320d('0x32')]:_0x37ec5f[_0x320d('0x2d')];if(_0x43d5fb[_0x320d('0x2f')][_0x320d('0x3c')]){_0x568add['include']=[{'all':!![]}];}_0x568add=_[_0x320d('0x3a')]({},_0x568add,_0x43d5fb[_0x320d('0x43')]);return db[_0x320d('0x29')]['find'](_0x568add)[_0x320d('0x20')](handleEntityNotFound(_0x206c3d,null))[_0x320d('0x20')](respondWithResult(_0x206c3d,null))[_0x320d('0x44')](handleError(_0x206c3d,null));};exports[_0x320d('0x45')]=function(_0x311e63,_0x5ab377){return db['Variable'][_0x320d('0x45')](_0x311e63['body'],{})[_0x320d('0x20')](function(_0x510de3){var _0x12e8ff=_0x311e63[_0x320d('0x46')][_0x320d('0x22')]({'plain':!![]});if(!_0x12e8ff)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12e8ff[_0x320d('0x47')]==='user'){var _0x58a131=_0x510de3['get']({'plain':!![]});var _0x2cecc6=_0x320d('0x23');return db[_0x320d('0x48')][_0x320d('0x49')]({'where':{'name':_0x2cecc6,'userProfileId':_0x12e8ff[_0x320d('0x4a')]},'raw':!![]})[_0x320d('0x20')](function(_0x35f5ec){if(_0x35f5ec&&_0x35f5ec[_0x320d('0x4b')]===0x0){return db[_0x320d('0x4c')][_0x320d('0x45')]({'name':_0x58a131[_0x320d('0x26')],'resourceId':_0x58a131['id'],'type':_0x35f5ec[_0x320d('0x26')],'sectionId':_0x35f5ec['id']},{})[_0x320d('0x20')](function(){return _0x510de3;});}else{return _0x510de3;}})['catch'](function(_0x439936){logger[_0x320d('0x25')](_0x320d('0x4d'),_0x439936);throw _0x439936;});}return _0x510de3;})['then'](respondWithResult(_0x5ab377,0xc9))[_0x320d('0x44')](handleError(_0x5ab377,null));};exports[_0x320d('0x1f')]=function(_0x4da717,_0xb020e5){if(_0x4da717[_0x320d('0x4e')]['id']){delete _0x4da717[_0x320d('0x4e')]['id'];}return db[_0x320d('0x29')]['find']({'where':{'id':_0x4da717[_0x320d('0x41')]['id']}})[_0x320d('0x20')](handleEntityNotFound(_0xb020e5,null))[_0x320d('0x20')](saveUpdates(_0x4da717[_0x320d('0x4e')],null))[_0x320d('0x20')](respondWithResult(_0xb020e5,null))[_0x320d('0x44')](handleError(_0xb020e5,null));};exports[_0x320d('0x21')]=function(_0x3ee2d7,_0xf669b8){return db[_0x320d('0x29')][_0x320d('0x49')]({'where':{'id':_0x3ee2d7[_0x320d('0x41')]['id']}})[_0x320d('0x20')](handleEntityNotFound(_0xf669b8,null))[_0x320d('0x20')](removeEntity(_0xf669b8,null))[_0x320d('0x44')](handleError(_0xf669b8,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index dc39e8a..d094607 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 _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 +var _0x07c3=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash'];(function(_0x133fe4,_0x1f473b){var _0x4c4017=function(_0x3c1fb1){while(--_0x3c1fb1){_0x133fe4['push'](_0x133fe4['shift']());}};_0x4c4017(++_0x1f473b);}(_0x07c3,0x1bf));var _0x307c=function(_0x38d499,_0x1cbb6b){_0x38d499=_0x38d499-0x0;var _0x274b18=_0x07c3[_0x38d499];return _0x274b18;};'use strict';var _=require(_0x307c('0x0'));var util=require(_0x307c('0x1'));var logger=require(_0x307c('0x2'))(_0x307c('0x3'));var moment=require(_0x307c('0x4'));var BPromise=require(_0x307c('0x5'));var rp=require(_0x307c('0x6'));var fs=require('fs');var path=require(_0x307c('0x7'));var rimraf=require('rimraf');var config=require(_0x307c('0x8'));var attributes=require(_0x307c('0x9'));module[_0x307c('0xa')]=function(_0x317066,_0x250f22){return _0x317066[_0x307c('0xb')](_0x307c('0xc'),attributes,{'tableName':_0x307c('0xd'),'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 fa12c08..9957949 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 _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 +var _0x3de5=['Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','find','options','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','Variable,\x20%s,\x20%s','request\x20sent'];(function(_0x2a8b8d,_0x33dc67){var _0x3afac7=function(_0x3a77de){while(--_0x3a77de){_0x2a8b8d['push'](_0x2a8b8d['shift']());}};_0x3afac7(++_0x33dc67);}(_0x3de5,0x14e));var _0x53de=function(_0x4f6ada,_0x35d782){_0x4f6ada=_0x4f6ada-0x0;var _0x521fcb=_0x3de5[_0x4f6ada];return _0x521fcb;};'use strict';var _=require(_0x53de('0x0'));var util=require(_0x53de('0x1'));var moment=require(_0x53de('0x2'));var BPromise=require(_0x53de('0x3'));var rs=require(_0x53de('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x53de('0x5'));var logger=require(_0x53de('0x6'))(_0x53de('0x7'));var config=require(_0x53de('0x8'));var jayson=require(_0x53de('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x932511,_0x2bb6b6,_0x21f13b){return new BPromise(function(_0x358087,_0x37d377){return client['request'](_0x932511,_0x21f13b)[_0x53de('0xa')](function(_0x467233){logger[_0x53de('0xb')](_0x53de('0xc'),_0x2bb6b6,_0x53de('0xd'));logger['debug'](_0x53de('0xe'),_0x2bb6b6,_0x53de('0xd'),JSON[_0x53de('0xf')](_0x467233));if(_0x467233[_0x53de('0x10')]){if(_0x467233[_0x53de('0x10')][_0x53de('0x11')]===0x1f4){logger[_0x53de('0x10')]('Variable,\x20%s,\x20%s',_0x2bb6b6,_0x467233[_0x53de('0x10')]['message']);return _0x37d377(_0x467233['error'][_0x53de('0x12')]);}logger['error']('Variable,\x20%s,\x20%s',_0x2bb6b6,_0x467233['error'][_0x53de('0x12')]);return _0x358087(_0x467233['error'][_0x53de('0x12')]);}else{logger[_0x53de('0xb')](_0x53de('0xc'),_0x2bb6b6,_0x53de('0xd'));_0x358087(_0x467233[_0x53de('0x13')][_0x53de('0x12')]);}})[_0x53de('0x14')](function(_0x36e8ba){logger['error'](_0x53de('0xc'),_0x2bb6b6,_0x36e8ba);_0x37d377(_0x36e8ba);});});}exports[_0x53de('0x15')]=function(_0x5c03d9){var _0x10761b=this;return new Promise(function(_0x1af687,_0x580292){return db['Variable'][_0x53de('0x16')]({'raw':_0x5c03d9[_0x53de('0x17')]?_0x5c03d9['options']['raw']===undefined?!![]:![]:!![],'where':_0x5c03d9[_0x53de('0x17')]?_0x5c03d9[_0x53de('0x17')][_0x53de('0x18')]||null:null,'attributes':_0x5c03d9['options']?_0x5c03d9['options'][_0x53de('0x19')]||null:null,'include':_0x5c03d9['options']?_0x5c03d9[_0x53de('0x17')][_0x53de('0x1a')]?_[_0x53de('0x1b')](_0x5c03d9['options']['include'],function(_0x5e2828){return{'model':db[_0x5e2828[_0x53de('0x1c')]],'as':_0x5e2828['as'],'attributes':_0x5e2828[_0x53de('0x19')],'include':_0x5e2828['include']?_['map'](_0x5e2828['include'],function(_0x2e1c66){return{'model':db[_0x2e1c66[_0x53de('0x1c')]],'as':_0x2e1c66['as'],'attributes':_0x2e1c66['attributes'],'include':_0x2e1c66[_0x53de('0x1a')]?_[_0x53de('0x1b')](_0x2e1c66[_0x53de('0x1a')],function(_0x7cf392){return{'model':db[_0x7cf392['model']],'as':_0x7cf392['as'],'attributes':_0x7cf392['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x33b708){logger['info'](_0x53de('0x15'),_0x5c03d9);logger['debug']('ShowVariable',_0x5c03d9,JSON['stringify'](_0x33b708));_0x1af687(_0x33b708);})[_0x53de('0x14')](function(_0x1781b5){logger[_0x53de('0x10')](_0x53de('0x15'),_0x1781b5[_0x53de('0x12')],_0x5c03d9);_0x580292(_0x10761b[_0x53de('0x10')](0x1f4,_0x1781b5[_0x53de('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 69c8d78..4749ea1 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 _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 +var _0x20c0=['/pull','/restart','restart','/migrations','migrations','Router','../../components/auth/service','get','index','canUpdate','fetch','/reset','reset'];(function(_0x2bd38b,_0x30aa72){var _0x45d925=function(_0xc619db){while(--_0xc619db){_0x2bd38b['push'](_0x2bd38b['shift']());}};_0x45d925(++_0x30aa72);}(_0x20c0,0x13d));var _0x020c=function(_0x14b2bc,_0x52ba26){_0x14b2bc=_0x14b2bc-0x0;var _0x2fefcb=_0x20c0[_0x14b2bc];return _0x2fefcb;};'use strict';var express=require('express');var router=express[_0x020c('0x0')]();var auth=require(_0x020c('0x1'));var controller=require('./version.controller');router[_0x020c('0x2')]('/',controller[_0x020c('0x3')]);router[_0x020c('0x2')]('/fetch',auth['isAuthenticated'](),auth[_0x020c('0x4')](),controller[_0x020c('0x5')]);router[_0x020c('0x2')](_0x020c('0x6'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x020c('0x7')]);router[_0x020c('0x2')](_0x020c('0x8'),auth['isAuthenticated'](),auth[_0x020c('0x4')](),controller['pull']);router[_0x020c('0x2')](_0x020c('0x9'),auth['isAuthenticated'](),controller[_0x020c('0xa')]);router[_0x020c('0x2')](_0x020c('0xb'),controller[_0x020c('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 9a8b1a0..3080a74 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 _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 +var _0x6b19=['info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','server','length','replace','.js','exports','push','sort','sequelize','Migration','getQueryInterface','constructor','join','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','root','index','version','query','latest','fetch','2.0.0','status','json','origin','master','error'];(function(_0x31282b,_0xa476db){var _0x19c632=function(_0x207214){while(--_0x207214){_0x31282b['push'](_0x31282b['shift']());}};_0x19c632(++_0xa476db);}(_0x6b19,0xf4));var _0x96b1=function(_0x2e57c8,_0x42d1fc){_0x2e57c8=_0x2e57c8-0x0;var _0x1287e7=_0x6b19[_0x2e57c8];return _0x1287e7;};'use strict';var Umzug=require(_0x96b1('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x96b1('0x1'));var pkginfo=require(_0x96b1('0x2'))(module,'version');var compareVersions=require(_0x96b1('0x3'));var exec=require(_0x96b1('0x4'))[_0x96b1('0x5')];var db=require(_0x96b1('0x6'))['db'];var config=require('../../config/environment');var pm2=require(_0x96b1('0x7'));var logger=require(_0x96b1('0x8'))('update');var git=require('simple-git')(config[_0x96b1('0x9')]);exports[_0x96b1('0xa')]=function(_0x519fbe,_0x280b00){var _0x2300ad={'current':module['exports'][_0x96b1('0xb')],'phonebar':0x2};if(_0x519fbe[_0x96b1('0xc')]&&_0x519fbe[_0x96b1('0xc')][_0x96b1('0xd')]){return git[_0x96b1('0xe')]()['tags'](function(_0x2a9fa8,_0x4effd5){_0x2300ad['latest']=(_0x2a9fa8?module['exports']['version']:_0x4effd5[_0x96b1('0xd')])||_0x96b1('0xf');return _0x280b00[_0x96b1('0x10')](0xc8)[_0x96b1('0x11')](_0x2300ad);});}else{return _0x280b00[_0x96b1('0x10')](0xc8)['json'](_0x2300ad);}};exports[_0x96b1('0xe')]=function(_0xfa00b9,_0xe809b6){return git[_0x96b1('0xe')]([_0x96b1('0x12'),_0x96b1('0x13')],function(_0x2eddaf){if(_0x2eddaf){logger[_0x96b1('0x14')](_0x2eddaf);return _0xe809b6[_0x96b1('0x10')](0x1f4)['json'](_0x2eddaf);}logger[_0x96b1('0x15')](_0x96b1('0x16'));return _0xe809b6[_0x96b1('0x10')](0xc8)[_0x96b1('0x11')]({'output':_0x96b1('0x17')});});};exports[_0x96b1('0x18')]=function(_0x5653e1,_0x41227b){return git[_0x96b1('0x18')]([_0x96b1('0x19'),_0x96b1('0x1a')],function(_0x56a860){if(_0x56a860){logger['error'](_0x56a860);return _0x41227b[_0x96b1('0x10')](0x1f4)['json'](_0x56a860);}logger['info'](_0x96b1('0x1b'));return _0x41227b[_0x96b1('0x10')](0xc8)[_0x96b1('0x11')]({'output':'git\x20reset\x20--hard'});});};exports[_0x96b1('0x1c')]=function(_0x3954e3,_0x3ad333){exec(_0x96b1('0x1d'),function(_0x1e1436,_0x276919,_0x416022){logger[_0x96b1('0x15')](_0x276919);logger[_0x96b1('0x15')](_0x416022);if(_0x1e1436){logger[_0x96b1('0x14')](_0x1e1436);return _0x3ad333[_0x96b1('0x10')](0x1f4)[_0x96b1('0x11')](_0x1e1436);}return _0x3ad333[_0x96b1('0x10')](0xc8)[_0x96b1('0x11')]({'output':_0x276919});});};exports[_0x96b1('0x1e')]=function(_0x232d49,_0x1db6ba){return pm2[_0x96b1('0x1e')](_0x96b1('0x1f'))[_0x96b1('0x20')](function(_0x1bc6d3){logger[_0x96b1('0x15')](_0x96b1('0x21'),_0x1bc6d3);return _0x1db6ba[_0x96b1('0x10')](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x96b1('0x22')](function(_0x4bc715){logger[_0x96b1('0x14')](_0x4bc715);return _0x1db6ba[_0x96b1('0x10')](0x1f4)[_0x96b1('0x11')](_0x4bc715);});};exports[_0x96b1('0x23')]=function(_0x4e4426,_0x59fc7c){var _0x45c20e=fs[_0x96b1('0x24')](path['join'](config[_0x96b1('0x9')],_0x96b1('0x25'),_0x96b1('0x23')));var _0x2262ad=[];for(var _0x378e04=0x0;_0x378e04<_0x45c20e[_0x96b1('0x26')];_0x378e04++){var _0x5ac63c=_0x45c20e[_0x378e04][_0x96b1('0x27')](_0x96b1('0x28'),'');if(compareVersions(module[_0x96b1('0x29')][_0x96b1('0xb')],_0x5ac63c)===-0x1){_0x2262ad[_0x96b1('0x2a')](_0x5ac63c);}}if(_0x2262ad[_0x96b1('0x26')]){var _0x24fcbc=_0x2262ad[_0x96b1('0x2b')](compareVersions);var _0x4e84dd=new Umzug({'storage':_0x96b1('0x2c'),'storageOptions':{'model':db[_0x96b1('0x2d')],'modelName':_0x96b1('0x2d'),'columnName':_0x96b1('0xb')},'migrations':{'params':[db[_0x96b1('0x2c')][_0x96b1('0x2e')](),db[_0x96b1('0x2c')][_0x96b1('0x2f')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x96b1('0x30')](config[_0x96b1('0x9')],_0x96b1('0x25'),'migrations'),'pattern':/\.js$/}});_0x4e84dd['up']({'migrations':_['map'](_0x24fcbc,function(_0x2592ac){return _0x2592ac+_0x96b1('0x28');})})['then'](function(){return _0x59fc7c['status'](0xc8)['json']({'output':_0x96b1('0x31')+module[_0x96b1('0x29')][_0x96b1('0xb')]+_0x96b1('0x32')+_[_0x96b1('0x33')](_0x24fcbc),'migrations':_[_0x96b1('0x30')](_0x24fcbc)});})[_0x96b1('0x22')](function(_0x5c5c54){if(_0x5c5c54 instanceof db[_0x96b1('0x2c')]['UniqueConstraintError']){return _0x59fc7c['status'](0xc8)[_0x96b1('0x11')]({'output':_0x96b1('0x34')});}else{return _0x59fc7c['status'](0x1f4)[_0x96b1('0x11')](_0x5c5c54);}});}else{return _0x59fc7c[_0x96b1('0x10')](0xc8)[_0x96b1('0x11')]({'output':_0x96b1('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index cca637f..d87565d 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 _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 +var _0x2e27=['get','isAuthenticated','index','/describe','describe','/:id','show','post','update','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceAgentReport.controller'];(function(_0x2227b2,_0x4bd4db){var _0x1fb3ac=function(_0x1c5011){while(--_0x1c5011){_0x2227b2['push'](_0x2227b2['shift']());}};_0x1fb3ac(++_0x4bd4db);}(_0x2e27,0x1e6));var _0x72e2=function(_0x59eefb,_0x2151ce){_0x59eefb=_0x59eefb-0x0;var _0x1a49e8=_0x2e27[_0x59eefb];return _0x1a49e8;};'use strict';var multer=require(_0x72e2('0x0'));var util=require(_0x72e2('0x1'));var path=require('path');var timeout=require(_0x72e2('0x2'));var express=require('express');var router=express[_0x72e2('0x3')]();var auth=require(_0x72e2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x72e2('0x5'));var controller=require(_0x72e2('0x6'));router[_0x72e2('0x7')]('/',auth[_0x72e2('0x8')](),controller[_0x72e2('0x9')]);router[_0x72e2('0x7')](_0x72e2('0xa'),auth[_0x72e2('0x8')](),controller[_0x72e2('0xb')]);router['get'](_0x72e2('0xc'),auth[_0x72e2('0x8')](),controller[_0x72e2('0xd')]);router[_0x72e2('0xe')]('/',auth[_0x72e2('0x8')](),controller['create']);router['put']('/:id',auth[_0x72e2('0x8')](),controller[_0x72e2('0xf')]);router['delete'](_0x72e2('0xc'),auth['isAuthenticated'](),controller[_0x72e2('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index d439ed8..d5f405e 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 _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 +var _0x7217=['sequelize','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7217,0x19e));var _0x7721=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x7217[_0x1b828b];return _0x98da1a;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'type':{'type':Sequelize[_0x7721('0x1')]},'uniqueid':{'type':Sequelize[_0x7721('0x1')]},'calleridnum':{'type':Sequelize[_0x7721('0x1')]},'calleridname':{'type':Sequelize[_0x7721('0x1')]},'queue':{'type':Sequelize[_0x7721('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x7721('0x2')]},'agentconnectAt':{'type':Sequelize[_0x7721('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x7721('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x7721('0x2')]},'agentdumpAt':{'type':Sequelize[_0x7721('0x2')]},'holdtime':{'type':Sequelize[_0x7721('0x3')]},'agentcomplete':{'type':Sequelize[_0x7721('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x7721('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x7721('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x7721('0x3')]},'agentacw':{'type':Sequelize[_0x7721('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7721('0x3')]},'reason':{'type':Sequelize[_0x7721('0x1')]},'lastevent':{'type':Sequelize[_0x7721('0x1')]},'channel':{'type':Sequelize[_0x7721('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x7721('0x1')]},'connectedlinenum':{'type':Sequelize[_0x7721('0x1')]},'connectedlinename':{'type':Sequelize[_0x7721('0x1')]},'language':{'type':Sequelize[_0x7721('0x1')]},'accountcode':{'type':Sequelize[_0x7721('0x1')]},'context':{'type':Sequelize[_0x7721('0x1')]},'exten':{'type':Sequelize[_0x7721('0x1')]},'priority':{'type':Sequelize[_0x7721('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x7721('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x7721('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x7721('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x7721('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x7721('0x1')]},'destlanguage':{'type':Sequelize[_0x7721('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x7721('0x1')]},'destexten':{'type':Sequelize[_0x7721('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x7721('0x1')]},'transfer':{'type':Sequelize[_0x7721('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7721('0x1')],'comment':_0x7721('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x7721('0x1')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 2890823..05f514f 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 _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 +var _0x73f1=['find','create','body','update','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','jsforce','papaparse','../../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','destroy','then','end','error','name','send','index','map','VoiceAgentReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','show','params','intersection','merge'];(function(_0x12e97f,_0x5c50fc){var _0x2479e9=function(_0x496734){while(--_0x496734){_0x12e97f['push'](_0x12e97f['shift']());}};_0x2479e9(++_0x5c50fc);}(_0x73f1,0x9b));var _0x173f=function(_0x21ca53,_0x1351cd){_0x21ca53=_0x21ca53-0x0;var _0x1d63fd=_0x73f1[_0x21ca53];return _0x1d63fd;};'use strict';var pdf=require(_0x173f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x173f('0x1'));var zipdir=require(_0x173f('0x2'));var jsonpatch=require(_0x173f('0x3'));var rp=require(_0x173f('0x4'));var moment=require(_0x173f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x173f('0x6'));var util=require(_0x173f('0x7'));var path=require(_0x173f('0x8'));var sox=require(_0x173f('0x9'));var csv=require(_0x173f('0xa'));var ejs=require(_0x173f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x173f('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x173f('0xd'));var Redis=require('ioredis');var authService=require(_0x173f('0xe'));var qs=require(_0x173f('0xf'));var as=require(_0x173f('0x10'));var hardwareService=require(_0x173f('0x11'));var logger=require(_0x173f('0x12'))(_0x173f('0x13'));var utils=require(_0x173f('0x14'));var config=require(_0x173f('0x15'));var db=require(_0x173f('0x16'))['db'];function respondWithStatusCode(_0x5ba520,_0x2e512b){_0x2e512b=_0x2e512b||0xcc;return function(_0x4a7ba8){if(_0x4a7ba8){return _0x5ba520[_0x173f('0x17')](_0x2e512b);}return _0x5ba520[_0x173f('0x18')](_0x2e512b)['end']();};}function respondWithResult(_0x17ded5,_0x3d45f1){_0x3d45f1=_0x3d45f1||0xc8;return function(_0x1ef68e){if(_0x1ef68e){return _0x17ded5[_0x173f('0x18')](_0x3d45f1)[_0x173f('0x19')](_0x1ef68e);}};}function respondWithFilteredResult(_0x1b6615,_0x46793e){return function(_0x581867){if(_0x581867){var _0x248451=_0x581867[_0x173f('0x1a')],_0x738676=_0x46793e[_0x173f('0x1b')],_0x2417cd=_0x46793e['offset']+_0x46793e[_0x173f('0x1c')],_0xdf708;if(_0x2417cd>=_0x248451){_0x2417cd=_0x248451;_0xdf708=0xc8;}else{_0xdf708=0xce;}_0x1b6615[_0x173f('0x18')](_0xdf708);return _0x1b6615[_0x173f('0x1d')](_0x173f('0x1e'),_0x738676+'-'+_0x2417cd+'/'+_0x248451)['json'](_0x581867);}return null;};}function patchUpdates(_0x1f7355){return function(_0x505ca6){try{jsonpatch[_0x173f('0x1f')](_0x505ca6,_0x1f7355,!![]);}catch(_0x1ca859){return BPromise[_0x173f('0x20')](_0x1ca859);}return _0x505ca6['save']();};}function saveUpdates(_0x3b5b64,_0x39b98a){return function(_0x330724){if(_0x330724){return _0x330724['update'](_0x3b5b64)['then'](function(_0x41696e){return _0x41696e;});}return null;};}function removeEntity(_0x574351,_0x1b3f4c){return function(_0x35d0ad){if(_0x35d0ad){return _0x35d0ad[_0x173f('0x21')]()[_0x173f('0x22')](function(){_0x574351[_0x173f('0x18')](0xcc)[_0x173f('0x23')]();});}};}function handleEntityNotFound(_0x49c74d,_0x957163){return function(_0x12d2b3){if(!_0x12d2b3){_0x49c74d[_0x173f('0x17')](0x194);}return _0x12d2b3;};}function handleError(_0x7c7e12,_0x43119a){_0x43119a=_0x43119a||0x1f4;return function(_0x4d8574){logger[_0x173f('0x24')](_0x4d8574['stack']);if(_0x4d8574[_0x173f('0x25')]){delete _0x4d8574[_0x173f('0x25')];}_0x7c7e12[_0x173f('0x18')](_0x43119a)[_0x173f('0x26')](_0x4d8574);};}exports[_0x173f('0x27')]=function(_0x17cb66,_0x1fee3c){var _0x2cc7b7={},_0x3dfd5b={},_0x2ef190={'count':0x0,'rows':[]};var _0x52accb=_[_0x173f('0x28')](db[_0x173f('0x29')][_0x173f('0x2a')],function(_0x951d72){return{'name':_0x951d72[_0x173f('0x2b')],'type':_0x951d72[_0x173f('0x2c')][_0x173f('0x2d')]};});_0x3dfd5b[_0x173f('0x2e')]=_[_0x173f('0x28')](_0x52accb,_0x173f('0x25'));_0x3dfd5b[_0x173f('0x2f')]=_[_0x173f('0x30')](_0x17cb66['query']);_0x3dfd5b[_0x173f('0x31')]=_['intersection'](_0x3dfd5b[_0x173f('0x2e')],_0x3dfd5b[_0x173f('0x2f')]);_0x2cc7b7[_0x173f('0x32')]=_['intersection'](_0x3dfd5b[_0x173f('0x2e')],qs['fields'](_0x17cb66[_0x173f('0x2f')][_0x173f('0x33')]));_0x2cc7b7['attributes']=_0x2cc7b7[_0x173f('0x32')][_0x173f('0x34')]?_0x2cc7b7['attributes']:_0x3dfd5b[_0x173f('0x2e')];if(!_0x17cb66[_0x173f('0x2f')][_0x173f('0x35')](_0x173f('0x36'))){_0x2cc7b7['limit']=qs['limit'](_0x17cb66['query']['limit']);_0x2cc7b7['offset']=qs['offset'](_0x17cb66[_0x173f('0x2f')][_0x173f('0x1b')]);}_0x2cc7b7[_0x173f('0x37')]=qs['sort'](_0x17cb66[_0x173f('0x2f')][_0x173f('0x38')]);_0x2cc7b7[_0x173f('0x39')]=qs['filters'](_[_0x173f('0x3a')](_0x17cb66[_0x173f('0x2f')],_0x3dfd5b['filters']),_0x52accb);if(_0x17cb66[_0x173f('0x2f')][_0x173f('0x3b')]){_0x2cc7b7['where']=_['merge'](_0x2cc7b7[_0x173f('0x39')],{'$or':_['map'](_0x52accb,function(_0x1165d2){if(_0x1165d2['type']!==_0x173f('0x3c')){var _0x856f49={};_0x856f49[_0x1165d2[_0x173f('0x25')]]={'$like':'%'+_0x17cb66['query'][_0x173f('0x3b')]+'%'};return _0x856f49;}})});}_0x2cc7b7=_['merge']({},_0x2cc7b7,_0x17cb66[_0x173f('0x3d')]);var _0x4d322c={'where':_0x2cc7b7[_0x173f('0x39')]};return db['VoiceAgentReport']['count'](_0x4d322c)[_0x173f('0x22')](function(_0x5be5ab){_0x2ef190[_0x173f('0x1a')]=_0x5be5ab;if(_0x17cb66[_0x173f('0x2f')][_0x173f('0x3e')]){_0x2cc7b7[_0x173f('0x3f')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x173f('0x40')](_0x2cc7b7);})[_0x173f('0x22')](function(_0x5ddbfe){_0x2ef190['rows']=_0x5ddbfe;return _0x2ef190;})['then'](respondWithFilteredResult(_0x1fee3c,_0x2cc7b7))[_0x173f('0x41')](handleError(_0x1fee3c,null));};exports[_0x173f('0x42')]=function(_0x20a426,_0x114f5a){var _0x85e28={'raw':![],'where':{'id':_0x20a426[_0x173f('0x43')]['id']}},_0x170fb1={};_0x170fb1['model']=_[_0x173f('0x30')](db['VoiceAgentReport'][_0x173f('0x2a')]);_0x170fb1[_0x173f('0x2f')]=_[_0x173f('0x30')](_0x20a426['query']);_0x170fb1[_0x173f('0x31')]=_[_0x173f('0x44')](_0x170fb1[_0x173f('0x2e')],_0x170fb1[_0x173f('0x2f')]);_0x85e28[_0x173f('0x32')]=_[_0x173f('0x44')](_0x170fb1[_0x173f('0x2e')],qs[_0x173f('0x33')](_0x20a426[_0x173f('0x2f')][_0x173f('0x33')]));_0x85e28[_0x173f('0x32')]=_0x85e28['attributes'][_0x173f('0x34')]?_0x85e28[_0x173f('0x32')]:_0x170fb1[_0x173f('0x2e')];if(_0x20a426[_0x173f('0x2f')][_0x173f('0x3e')]){_0x85e28[_0x173f('0x3f')]=[{'all':!![]}];}_0x85e28=_[_0x173f('0x45')]({},_0x85e28,_0x20a426[_0x173f('0x3d')]);return db[_0x173f('0x29')][_0x173f('0x46')](_0x85e28)[_0x173f('0x22')](handleEntityNotFound(_0x114f5a,null))[_0x173f('0x22')](respondWithResult(_0x114f5a,null))[_0x173f('0x41')](handleError(_0x114f5a,null));};exports['create']=function(_0x24414a,_0x400cc9){return db[_0x173f('0x29')][_0x173f('0x47')](_0x24414a[_0x173f('0x48')],{})[_0x173f('0x22')](respondWithResult(_0x400cc9,0xc9))[_0x173f('0x41')](handleError(_0x400cc9,null));};exports[_0x173f('0x49')]=function(_0xed8a3,_0x2a4a3c){if(_0xed8a3['body']['id']){delete _0xed8a3[_0x173f('0x48')]['id'];}return db['VoiceAgentReport'][_0x173f('0x46')]({'where':{'id':_0xed8a3[_0x173f('0x43')]['id']}})[_0x173f('0x22')](handleEntityNotFound(_0x2a4a3c,null))[_0x173f('0x22')](saveUpdates(_0xed8a3[_0x173f('0x48')],null))[_0x173f('0x22')](respondWithResult(_0x2a4a3c,null))[_0x173f('0x41')](handleError(_0x2a4a3c,null));};exports[_0x173f('0x21')]=function(_0x11a7eb,_0x779036){return db['VoiceAgentReport'][_0x173f('0x46')]({'where':{'id':_0x11a7eb[_0x173f('0x43')]['id']}})['then'](handleEntityNotFound(_0x779036,null))[_0x173f('0x22')](removeEntity(_0x779036,null))['catch'](handleError(_0x779036,null));};exports[_0x173f('0x4a')]=function(_0x223b75,_0x377fad){return db['VoiceAgentReport'][_0x173f('0x4a')]()[_0x173f('0x22')](respondWithResult(_0x377fad,null))['catch'](handleError(_0x377fad,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index a2e6f5a..26fae9a 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 _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 +var _0x5b94=['rimraf','exports','define','VoiceAgentReport','uniqueid','destuniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0xb33f93,_0x74da85){var _0x51473f=function(_0xe224ad){while(--_0xe224ad){_0xb33f93['push'](_0xb33f93['shift']());}};_0x51473f(++_0x74da85);}(_0x5b94,0x117));var _0x45b9=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5b94[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x45b9('0x0'));var util=require(_0x45b9('0x1'));var logger=require(_0x45b9('0x2'))('api');var moment=require(_0x45b9('0x3'));var BPromise=require(_0x45b9('0x4'));var rp=require(_0x45b9('0x5'));var fs=require('fs');var path=require(_0x45b9('0x6'));var rimraf=require(_0x45b9('0x7'));var config=require('../../config/environment');var attributes=require('./voiceAgentReport.attributes');module[_0x45b9('0x8')]=function(_0x470291,_0x10b5b2){return _0x470291[_0x45b9('0x9')](_0x45b9('0xa'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x45b9('0xb'),_0x45b9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 986b07e..8df313a 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 _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 +var _0xd94d=['VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','catch','VoiceAgentReport','create','body','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','attributes','limit','lodash','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd94d,0x10a));var _0xdd94=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd94d[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xdd94('0x0'));var util=require('util');var moment=require(_0xdd94('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdd94('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xdd94('0x3'));var logger=require('../../config/logger')(_0xdd94('0x4'));var config=require(_0xdd94('0x5'));var jayson=require(_0xdd94('0x6'));var client=jayson[_0xdd94('0x7')][_0xdd94('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1cdce0,_0x49d696,_0x26ec17){return new BPromise(function(_0x573ea3,_0x2eb6b0){return client['request'](_0x1cdce0,_0x26ec17)[_0xdd94('0x9')](function(_0x520d55){logger[_0xdd94('0xa')]('VoiceAgentReport,\x20%s,\x20%s',_0x49d696,_0xdd94('0xb'));logger[_0xdd94('0xc')](_0xdd94('0xd'),_0x49d696,_0xdd94('0xb'),JSON[_0xdd94('0xe')](_0x520d55));if(_0x520d55[_0xdd94('0xf')]){if(_0x520d55['error'][_0xdd94('0x10')]===0x1f4){logger['error'](_0xdd94('0x11'),_0x49d696,_0x520d55[_0xdd94('0xf')][_0xdd94('0x12')]);return _0x2eb6b0(_0x520d55[_0xdd94('0xf')][_0xdd94('0x12')]);}logger[_0xdd94('0xf')](_0xdd94('0x11'),_0x49d696,_0x520d55[_0xdd94('0xf')][_0xdd94('0x12')]);return _0x573ea3(_0x520d55[_0xdd94('0xf')][_0xdd94('0x12')]);}else{logger[_0xdd94('0xa')]('VoiceAgentReport,\x20%s,\x20%s',_0x49d696,_0xdd94('0xb'));_0x573ea3(_0x520d55[_0xdd94('0x13')]['message']);}})[_0xdd94('0x14')](function(_0x5aa125){logger['error'](_0xdd94('0x11'),_0x49d696,_0x5aa125);_0x2eb6b0(_0x5aa125);});});}exports['CreateVoiceAgentReport']=function(_0x2f6767){var _0xc7ae70=this;return new Promise(function(_0x1f3b8b,_0x5a0b39){return db[_0xdd94('0x15')][_0xdd94('0x16')](_0x2f6767[_0xdd94('0x17')],{'raw':_0x2f6767[_0xdd94('0x18')]?_0x2f6767[_0xdd94('0x18')][_0xdd94('0x19')]===undefined?!![]:![]:!![]})[_0xdd94('0x9')](function(_0x24cf2b){logger['info'](_0xdd94('0x1a'),_0x2f6767);logger[_0xdd94('0xc')]('CreateVoiceAgentReport',_0x2f6767,JSON['stringify'](_0x24cf2b));_0x1f3b8b(_0x24cf2b);})[_0xdd94('0x14')](function(_0x1d971a){logger['error'](_0xdd94('0x1a'),_0x1d971a[_0xdd94('0x12')],_0x2f6767);_0x5a0b39(_0xc7ae70[_0xdd94('0xf')](0x1f4,_0x1d971a[_0xdd94('0x12')]));});});};exports[_0xdd94('0x1b')]=function(_0x12b209){var _0x3f8e30=this;return new Promise(function(_0x1d4f99,_0x598f6c){return db[_0xdd94('0x15')][_0xdd94('0x1c')](_0x12b209[_0xdd94('0x17')],{'raw':_0x12b209['options']?_0x12b209[_0xdd94('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12b209['options']?_0x12b209[_0xdd94('0x18')]['where']||null:null,'attributes':_0x12b209['options']?_0x12b209[_0xdd94('0x18')][_0xdd94('0x1d')]||null:null,'limit':_0x12b209[_0xdd94('0x18')]?_0x12b209[_0xdd94('0x18')][_0xdd94('0x1e')]||null:null})[_0xdd94('0x9')](function(_0x5ad29f){logger[_0xdd94('0xa')]('UpdateVoiceAgentReport',_0x12b209);logger['debug'](_0xdd94('0x1b'),_0x12b209,JSON['stringify'](_0x5ad29f));_0x1d4f99(_0x5ad29f);})[_0xdd94('0x14')](function(_0x20d61b){logger[_0xdd94('0xf')]('UpdateVoiceAgentReport',_0x20d61b['message'],_0x12b209);_0x598f6c(_0x3f8e30['error'](0x1f4,_0x20d61b[_0xdd94('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 0a1edb3..23b6c0a 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 _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 +var _0x4832=['get','isAuthenticated','index','/describe','describe','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./voiceCallReport.controller'];(function(_0x369534,_0x5557c4){var _0x524bf9=function(_0x24c6fb){while(--_0x24c6fb){_0x369534['push'](_0x369534['shift']());}};_0x524bf9(++_0x5557c4);}(_0x4832,0x12b));var _0x2483=function(_0x531e48,_0x4bb96b){_0x531e48=_0x531e48-0x0;var _0x202971=_0x4832[_0x531e48];return _0x202971;};'use strict';var multer=require(_0x2483('0x0'));var util=require(_0x2483('0x1'));var path=require(_0x2483('0x2'));var timeout=require(_0x2483('0x3'));var express=require(_0x2483('0x4'));var router=express['Router']();var auth=require(_0x2483('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2483('0x6'));router[_0x2483('0x7')]('/',auth[_0x2483('0x8')](),controller[_0x2483('0x9')]);router[_0x2483('0x7')](_0x2483('0xa'),auth['isAuthenticated'](),controller[_0x2483('0xb')]);router[_0x2483('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2483('0xc')]('/',auth[_0x2483('0x8')](),controller[_0x2483('0xd')]);router['put'](_0x2483('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x2483('0xf')](_0x2483('0xe'),auth['isAuthenticated'](),controller[_0x2483('0x10')]);module[_0x2483('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 41f0105..e463da4 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(_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 +var _0x9957=['ENUM','internal','outbound','inbound-fax','outbound-fax','DATE','INTEGER','sequelize','exports','STRING'];(function(_0xfe30d5,_0x44cb68){var _0x80272c=function(_0x241d09){while(--_0x241d09){_0xfe30d5['push'](_0xfe30d5['shift']());}};_0x80272c(++_0x44cb68);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'type':{'type':Sequelize[_0x7995('0x3')]('inbound',_0x7995('0x4'),_0x7995('0x5'),_0x7995('0x6'),_0x7995('0x7'),'dialer')},'tag':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'source':{'type':Sequelize[_0x7995('0x2')]},'destination':{'type':Sequelize[_0x7995('0x2')]},'destinationcontext':{'type':Sequelize[_0x7995('0x2')]},'callerid':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x7995('0x2')]},'lastapplication':{'type':Sequelize[_0x7995('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x7995('0x8')]},'systemanswertime':{'type':Sequelize[_0x7995('0x8')]},'answertime':{'type':Sequelize[_0x7995('0x8')]},'endtime':{'type':Sequelize[_0x7995('0x8')]},'duration':{'type':Sequelize[_0x7995('0x9')]},'billableseconds':{'type':Sequelize[_0x7995('0x9')]},'mohtime':{'type':Sequelize[_0x7995('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7995('0x2')]},'userfield':{'type':Sequelize[_0x7995('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7995('0x2')]},'prefix':{'type':Sequelize[_0x7995('0x2')]},'routeid':{'type':Sequelize[_0x7995('0x9')]},'sipcallid':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index a1a7ac3..ba3dd72 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 _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 +var _0x374b=['query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','fullname','alias','User','VoiceCallReport','findAll','rows','catch','params','keys','length','include','find','create','body','describe','uniqueid','user','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','key','model','map'];(function(_0x32e6ce,_0xf2adef){var _0x553af2=function(_0x246891){while(--_0x246891){_0x32e6ce['push'](_0x32e6ce['shift']());}};_0x553af2(++_0xf2adef);}(_0x374b,0x1b1));var _0xb374=function(_0x2e532c,_0x4be1f3){_0x2e532c=_0x2e532c-0x0;var _0x5a2d5e=_0x374b[_0x2e532c];return _0x5a2d5e;};'use strict';var pdf=require(_0xb374('0x0'));var emlformat=require(_0xb374('0x1'));var rimraf=require(_0xb374('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb374('0x3'));var rp=require(_0xb374('0x4'));var moment=require(_0xb374('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb374('0x6'));var util=require(_0xb374('0x7'));var path=require('path');var sox=require(_0xb374('0x8'));var csv=require(_0xb374('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb374('0xa'));var squel=require(_0xb374('0xb'));var crypto=require(_0xb374('0xc'));var jsforce=require(_0xb374('0xd'));var deskjs=require(_0xb374('0xe'));var toCsv=require(_0xb374('0x9'));var querystring=require(_0xb374('0xf'));var Papa=require('papaparse');var Redis=require(_0xb374('0x10'));var authService=require(_0xb374('0x11'));var qs=require(_0xb374('0x12'));var as=require(_0xb374('0x13'));var hardwareService=require(_0xb374('0x14'));var logger=require('../../config/logger')(_0xb374('0x15'));var utils=require(_0xb374('0x16'));var config=require(_0xb374('0x17'));var db=require(_0xb374('0x18'))['db'];function respondWithStatusCode(_0x1b277e,_0x2e1dbc){_0x2e1dbc=_0x2e1dbc||0xcc;return function(_0x5602a6){if(_0x5602a6){return _0x1b277e[_0xb374('0x19')](_0x2e1dbc);}return _0x1b277e[_0xb374('0x1a')](_0x2e1dbc)[_0xb374('0x1b')]();};}function respondWithResult(_0x2ef3bb,_0x5ecad7){_0x5ecad7=_0x5ecad7||0xc8;return function(_0x3d2788){if(_0x3d2788){return _0x2ef3bb[_0xb374('0x1a')](_0x5ecad7)['json'](_0x3d2788);}};}function respondWithFilteredResult(_0x4b4db2,_0x487c40){return function(_0x36f0a5){if(_0x36f0a5){var _0x3c508c=_0x36f0a5[_0xb374('0x1c')],_0x5d21e4=_0x487c40[_0xb374('0x1d')],_0x1345b6=_0x487c40[_0xb374('0x1d')]+_0x487c40[_0xb374('0x1e')],_0x5e050f;if(_0x1345b6>=_0x3c508c){_0x1345b6=_0x3c508c;_0x5e050f=0xc8;}else{_0x5e050f=0xce;}_0x4b4db2[_0xb374('0x1a')](_0x5e050f);return _0x4b4db2['set'](_0xb374('0x1f'),_0x5d21e4+'-'+_0x1345b6+'/'+_0x3c508c)[_0xb374('0x20')](_0x36f0a5);}return null;};}function patchUpdates(_0x216eb7){return function(_0x49b4f5){try{jsonpatch[_0xb374('0x21')](_0x49b4f5,_0x216eb7,!![]);}catch(_0x2efd94){return BPromise[_0xb374('0x22')](_0x2efd94);}return _0x49b4f5[_0xb374('0x23')]();};}function saveUpdates(_0x3aa60d,_0x2baab2){return function(_0x277d25){if(_0x277d25){return _0x277d25[_0xb374('0x24')](_0x3aa60d)[_0xb374('0x25')](function(_0xae6557){return _0xae6557;});}return null;};}function removeEntity(_0x222e64,_0x134a6b){return function(_0x10cc2c){if(_0x10cc2c){return _0x10cc2c[_0xb374('0x26')]()['then'](function(){_0x222e64[_0xb374('0x1a')](0xcc)[_0xb374('0x1b')]();});}};}function handleEntityNotFound(_0x139733,_0x3dc80d){return function(_0x29fef7){if(!_0x29fef7){_0x139733[_0xb374('0x19')](0x194);}return _0x29fef7;};}function handleError(_0x4b5622,_0x317e28){_0x317e28=_0x317e28||0x1f4;return function(_0x49bc4d){logger['error'](_0x49bc4d[_0xb374('0x27')]);if(_0x49bc4d[_0xb374('0x28')]){delete _0x49bc4d[_0xb374('0x28')];}_0x4b5622[_0xb374('0x1a')](_0x317e28)[_0xb374('0x29')](_0x49bc4d);};}exports[_0xb374('0x2a')]=function(_0x35053d,_0xeee271){var _0x25a168={},_0x36cc56={},_0x10a05c={'count':0x0,'rows':[]};var _0x3c5e0a=_['map'](db['VoiceCallReport'][_0xb374('0x2b')],function(_0x463634){return{'name':_0x463634['fieldName'],'type':_0x463634['type'][_0xb374('0x2c')]};});_0x36cc56[_0xb374('0x2d')]=_[_0xb374('0x2e')](_0x3c5e0a,'name');_0x36cc56[_0xb374('0x2f')]=_['keys'](_0x35053d[_0xb374('0x2f')]);_0x36cc56[_0xb374('0x30')]=_['intersection'](_0x36cc56[_0xb374('0x2d')],_0x36cc56[_0xb374('0x2f')]);_0x25a168[_0xb374('0x31')]=_[_0xb374('0x32')](_0x36cc56[_0xb374('0x2d')],qs[_0xb374('0x33')](_0x35053d['query']['fields']));_0x25a168[_0xb374('0x31')]=_0x25a168[_0xb374('0x31')]['length']?_0x25a168[_0xb374('0x31')]:_0x36cc56[_0xb374('0x2d')];if(!_0x35053d['query'][_0xb374('0x34')](_0xb374('0x35'))){_0x25a168[_0xb374('0x1e')]=qs[_0xb374('0x1e')](_0x35053d[_0xb374('0x2f')]['limit']);_0x25a168[_0xb374('0x1d')]=qs['offset'](_0x35053d[_0xb374('0x2f')][_0xb374('0x1d')]);}_0x25a168[_0xb374('0x36')]=qs[_0xb374('0x37')](_0x35053d[_0xb374('0x2f')]['sort']);_0x25a168[_0xb374('0x38')]=qs[_0xb374('0x30')](_[_0xb374('0x39')](_0x35053d[_0xb374('0x2f')],_0x36cc56[_0xb374('0x30')]),_0x3c5e0a);if(_0x35053d[_0xb374('0x2f')][_0xb374('0x3a')]){_0x25a168[_0xb374('0x38')]=_[_0xb374('0x3b')](_0x25a168['where'],{'$or':_['map'](_0x3c5e0a,function(_0x4d9edf){if(_0x4d9edf[_0xb374('0x3c')]!=='VIRTUAL'){var _0x3cc5f2={};_0x3cc5f2[_0x4d9edf[_0xb374('0x28')]]={'$like':'%'+_0x35053d[_0xb374('0x2f')]['filter']+'%'};return _0x3cc5f2;}})});}_0x25a168=_['merge']({},_0x25a168,_0x35053d[_0xb374('0x3d')]);var _0x372f98={'where':_0x25a168[_0xb374('0x38')]};return db['VoiceCallReport'][_0xb374('0x1c')](_0x372f98)[_0xb374('0x25')](function(_0x4a6e6e){_0x10a05c['count']=_0x4a6e6e;if(_0x35053d[_0xb374('0x2f')][_0xb374('0x3e')]){_0x25a168['include']=[{'attributes':['id','name',_0xb374('0x3f'),_0xb374('0x40')],'model':db[_0xb374('0x41')],'as':_0xb374('0x41')}];}return db[_0xb374('0x42')][_0xb374('0x43')](_0x25a168);})[_0xb374('0x25')](function(_0x9cb576){_0x10a05c[_0xb374('0x44')]=_0x9cb576;return _0x10a05c;})[_0xb374('0x25')](respondWithFilteredResult(_0xeee271,_0x25a168))[_0xb374('0x45')](handleError(_0xeee271,null));};exports['show']=function(_0x16b93f,_0x349e6f){var _0x97b971={'raw':!![],'where':{'id':_0x16b93f[_0xb374('0x46')]['id']}},_0x8b63ef={};_0x8b63ef[_0xb374('0x2d')]=_[_0xb374('0x47')](db[_0xb374('0x42')][_0xb374('0x2b')]);_0x8b63ef['query']=_[_0xb374('0x47')](_0x16b93f[_0xb374('0x2f')]);_0x8b63ef[_0xb374('0x30')]=_['intersection'](_0x8b63ef[_0xb374('0x2d')],_0x8b63ef[_0xb374('0x2f')]);_0x97b971[_0xb374('0x31')]=_[_0xb374('0x32')](_0x8b63ef[_0xb374('0x2d')],qs['fields'](_0x16b93f[_0xb374('0x2f')]['fields']));_0x97b971['attributes']=_0x97b971[_0xb374('0x31')][_0xb374('0x48')]?_0x97b971[_0xb374('0x31')]:_0x8b63ef[_0xb374('0x2d')];if(_0x16b93f['query'][_0xb374('0x3e')]){_0x97b971[_0xb374('0x49')]=[{'all':!![]}];}_0x97b971=_[_0xb374('0x3b')]({},_0x97b971,_0x16b93f['options']);return db[_0xb374('0x42')][_0xb374('0x4a')](_0x97b971)['then'](handleEntityNotFound(_0x349e6f,null))[_0xb374('0x25')](respondWithResult(_0x349e6f,null))['catch'](handleError(_0x349e6f,null));};exports[_0xb374('0x4b')]=function(_0x258b5d,_0x4389f4){return db[_0xb374('0x42')][_0xb374('0x4b')](_0x258b5d[_0xb374('0x4c')],{})[_0xb374('0x25')](respondWithResult(_0x4389f4,0xc9))[_0xb374('0x45')](handleError(_0x4389f4,null));};exports[_0xb374('0x26')]=function(_0x7dbf88,_0x1f05e3){return db['VoiceCallReport']['find']({'where':{'id':_0x7dbf88[_0xb374('0x46')]['id']}})[_0xb374('0x25')](handleEntityNotFound(_0x1f05e3,null))['then'](removeEntity(_0x1f05e3,null))[_0xb374('0x45')](handleError(_0x1f05e3,null));};exports[_0xb374('0x4d')]=function(_0x230841,_0x56986a){return db[_0xb374('0x42')][_0xb374('0x4d')]()[_0xb374('0x25')](respondWithResult(_0x56986a,null))['catch'](handleError(_0x56986a,null));};exports[_0xb374('0x24')]=function(_0x392da9,_0x4a4a91){if(_0x392da9['body'][_0xb374('0x4e')]){delete _0x392da9[_0xb374('0x4c')][_0xb374('0x4e')];}return db['VoiceCallReport'][_0xb374('0x4a')]({'where':{'uniqueid':_0x392da9[_0xb374('0x46')]['id'],'UserId':{'$or':[null,_0x392da9[_0xb374('0x4f')]['id']]}}})[_0xb374('0x25')](handleEntityNotFound(_0x4a4a91,null))[_0xb374('0x25')](saveUpdates(_0x392da9[_0xb374('0x4c')],null))[_0xb374('0x25')](respondWithResult(_0x4a4a91,null))[_0xb374('0x45')](handleError(_0x4a4a91,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index b1612b9..2b6b99f 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 _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 +var _0x669c=['api','bluebird','request-promise','path','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','util','../../config/logger'];(function(_0x308a1d,_0x3d379d){var _0x5eb875=function(_0x464dbe){while(--_0x464dbe){_0x308a1d['push'](_0x308a1d['shift']());}};_0x5eb875(++_0x3d379d);}(_0x669c,0x153));var _0xc669=function(_0x5d5b4b,_0x5a810e){_0x5d5b4b=_0x5d5b4b-0x0;var _0x5707a5=_0x669c[_0x5d5b4b];return _0x5707a5;};'use strict';var _=require('lodash');var util=require(_0xc669('0x0'));var logger=require(_0xc669('0x1'))(_0xc669('0x2'));var moment=require('moment');var BPromise=require(_0xc669('0x3'));var rp=require(_0xc669('0x4'));var fs=require('fs');var path=require(_0xc669('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc669('0x6'));module[_0xc669('0x7')]=function(_0x49736d,_0x4780e4){return _0x49736d[_0xc669('0x8')](_0xc669('0x9'),attributes,{'tableName':_0xc669('0xa'),'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 a638d47..2bf80cf 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 _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 +var _0xd873=['attributes','limit','include','map','model','GetVoiceCallReport','CreateVoiceCallReport','create','UpdateVoiceCallReport','update','body','debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','VoiceCallReport','findAll','options','raw','where'];(function(_0x1b87b8,_0x359b39){var _0x57c35a=function(_0x5d5522){while(--_0x5d5522){_0x1b87b8['push'](_0x1b87b8['shift']());}};_0x57c35a(++_0x359b39);}(_0xd873,0xd9));var _0x3d87=function(_0x544ebc,_0x2900fe){_0x544ebc=_0x544ebc-0x0;var _0x5a3615=_0xd873[_0x544ebc];return _0x5a3615;};'use strict';var _=require(_0x3d87('0x0'));var util=require('util');var moment=require(_0x3d87('0x1'));var BPromise=require('bluebird');var rs=require(_0x3d87('0x2'));var fs=require('fs');var Redis=require(_0x3d87('0x3'));var db=require(_0x3d87('0x4'))['db'];var utils=require(_0x3d87('0x5'));var logger=require(_0x3d87('0x6'))(_0x3d87('0x7'));var config=require(_0x3d87('0x8'));var jayson=require(_0x3d87('0x9'));var client=jayson[_0x3d87('0xa')][_0x3d87('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3600dd,_0x18540b,_0x536e19){return new BPromise(function(_0x43aedc,_0x13d0b7){return client[_0x3d87('0xc')](_0x3600dd,_0x536e19)[_0x3d87('0xd')](function(_0x8ac17c){logger['info'](_0x3d87('0xe'),_0x18540b,_0x3d87('0xf'));logger['debug'](_0x3d87('0x10'),_0x18540b,_0x3d87('0xf'),JSON[_0x3d87('0x11')](_0x8ac17c));if(_0x8ac17c['error']){if(_0x8ac17c[_0x3d87('0x12')][_0x3d87('0x13')]===0x1f4){logger[_0x3d87('0x12')](_0x3d87('0xe'),_0x18540b,_0x8ac17c[_0x3d87('0x12')][_0x3d87('0x14')]);return _0x13d0b7(_0x8ac17c[_0x3d87('0x12')][_0x3d87('0x14')]);}logger[_0x3d87('0x12')](_0x3d87('0xe'),_0x18540b,_0x8ac17c['error'][_0x3d87('0x14')]);return _0x43aedc(_0x8ac17c['error']['message']);}else{logger[_0x3d87('0x15')](_0x3d87('0xe'),_0x18540b,_0x3d87('0xf'));_0x43aedc(_0x8ac17c[_0x3d87('0x16')]['message']);}})[_0x3d87('0x17')](function(_0x105345){logger[_0x3d87('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x18540b,_0x105345);_0x13d0b7(_0x105345);});});}exports['GetVoiceCallReport']=function(_0x176f9f){var _0x2e8780=this;return new Promise(function(_0x4c1246,_0x5b254c){return db[_0x3d87('0x18')][_0x3d87('0x19')]({'raw':_0x176f9f['options']?_0x176f9f[_0x3d87('0x1a')][_0x3d87('0x1b')]===undefined?!![]:![]:!![],'where':_0x176f9f[_0x3d87('0x1a')]?_0x176f9f[_0x3d87('0x1a')][_0x3d87('0x1c')]||null:null,'attributes':_0x176f9f['options']?_0x176f9f['options'][_0x3d87('0x1d')]||null:null,'limit':_0x176f9f[_0x3d87('0x1a')]?_0x176f9f[_0x3d87('0x1a')][_0x3d87('0x1e')]||null:null,'include':_0x176f9f[_0x3d87('0x1a')]?_0x176f9f[_0x3d87('0x1a')][_0x3d87('0x1f')]?_['map'](_0x176f9f[_0x3d87('0x1a')][_0x3d87('0x1f')],function(_0x4d050c){return{'model':db[_0x4d050c['model']],'as':_0x4d050c['as'],'attributes':_0x4d050c['attributes'],'include':_0x4d050c[_0x3d87('0x1f')]?_[_0x3d87('0x20')](_0x4d050c[_0x3d87('0x1f')],function(_0x372388){return{'model':db[_0x372388['model']],'as':_0x372388['as'],'attributes':_0x372388[_0x3d87('0x1d')],'include':_0x372388[_0x3d87('0x1f')]?_['map'](_0x372388[_0x3d87('0x1f')],function(_0xb6a6b6){return{'model':db[_0xb6a6b6[_0x3d87('0x21')]],'as':_0xb6a6b6['as'],'attributes':_0xb6a6b6['attributes']};}):[]};}):[]};}):[]:[]})[_0x3d87('0xd')](function(_0x2d4e81){logger['info'](_0x3d87('0x22'),_0x176f9f);logger['debug'](_0x3d87('0x22'),_0x176f9f,JSON[_0x3d87('0x11')](_0x2d4e81));_0x4c1246(_0x2d4e81);})[_0x3d87('0x17')](function(_0x5db5c4){logger['error'](_0x3d87('0x22'),_0x5db5c4['message'],_0x176f9f);_0x5b254c(_0x2e8780[_0x3d87('0x12')](0x1f4,_0x5db5c4['message']));});});};exports[_0x3d87('0x23')]=function(_0x435ca2){var _0x3494cf=this;return new Promise(function(_0x3b5373,_0x52c367){return db[_0x3d87('0x18')][_0x3d87('0x24')](_0x435ca2['body'],{'raw':_0x435ca2[_0x3d87('0x1a')]?_0x435ca2[_0x3d87('0x1a')][_0x3d87('0x1b')]===undefined?!![]:![]:!![]})[_0x3d87('0xd')](function(_0x268527){logger['info']('CreateVoiceCallReport',_0x435ca2);logger['debug'](_0x3d87('0x23'),_0x435ca2,JSON[_0x3d87('0x11')](_0x268527));_0x3b5373(_0x268527);})[_0x3d87('0x17')](function(_0x361e07){logger[_0x3d87('0x12')]('CreateVoiceCallReport',_0x361e07[_0x3d87('0x14')],_0x435ca2);_0x52c367(_0x3494cf[_0x3d87('0x12')](0x1f4,_0x361e07[_0x3d87('0x14')]));});});};exports[_0x3d87('0x25')]=function(_0x540071){var _0x2796cf=this;return new Promise(function(_0x4dccca,_0x1f733f){return db[_0x3d87('0x18')][_0x3d87('0x26')](_0x540071[_0x3d87('0x27')],{'raw':_0x540071['options']?_0x540071[_0x3d87('0x1a')][_0x3d87('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x540071[_0x3d87('0x1a')]?_0x540071[_0x3d87('0x1a')]['where']||null:null,'attributes':_0x540071['options']?_0x540071[_0x3d87('0x1a')][_0x3d87('0x1d')]||null:null,'limit':_0x540071[_0x3d87('0x1a')]?_0x540071[_0x3d87('0x1a')][_0x3d87('0x1e')]||null:null})[_0x3d87('0xd')](function(_0x1d7936){logger[_0x3d87('0x15')](_0x3d87('0x25'),_0x540071);logger[_0x3d87('0x28')](_0x3d87('0x25'),_0x540071,JSON[_0x3d87('0x11')](_0x1d7936));_0x4dccca(_0x1d7936);})[_0x3d87('0x17')](function(_0xf98f4e){logger[_0x3d87('0x12')](_0x3d87('0x25'),_0xf98f4e[_0x3d87('0x14')],_0x540071);_0x1f733f(_0x2796cf[_0x3d87('0x12')](0x1f4,_0xf98f4e[_0x3d87('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index d0d4afc..c1328f8 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 _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 +var _0xfeef=['show','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xfeef,0x10b));var _0xffee=function(_0x4595ac,_0x4a6c83){_0x4595ac=_0x4595ac-0x0;var _0x13c73c=_0xfeef[_0x4595ac];return _0x13c73c;};'use strict';var multer=require(_0xffee('0x0'));var util=require('util');var path=require(_0xffee('0x1'));var timeout=require(_0xffee('0x2'));var express=require(_0xffee('0x3'));var router=express[_0xffee('0x4')]();var auth=require(_0xffee('0x5'));var interaction=require(_0xffee('0x6'));var config=require(_0xffee('0x7'));var controller=require(_0xffee('0x8'));router[_0xffee('0x9')]('/',auth[_0xffee('0xa')](),controller[_0xffee('0xb')]);router['get'](_0xffee('0xc'),auth[_0xffee('0xa')](),controller[_0xffee('0xd')]);router[_0xffee('0xe')]('/',auth['isAuthenticated'](),controller[_0xffee('0xf')]);router[_0xffee('0x10')](_0xffee('0xc'),auth['isAuthenticated'](),controller[_0xffee('0x11')]);router[_0xffee('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xffee('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 9dcbfa4..cb96d1c 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 _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 +var _0x62cd=['options','join','getDataValue','split','BOOLEAN','exports','name','STRING','setDataValue'];(function(_0x17a718,_0x1a65cc){var _0xb19710=function(_0x478a88){while(--_0x478a88){_0x17a718['push'](_0x17a718['shift']());}};_0xb19710(++_0x1a65cc);}(_0x62cd,0x95));var _0xd62c=function(_0x1e3be4,_0x98455f){_0x1e3be4=_0x1e3be4-0x0;var _0x3e5c87=_0x62cd[_0x1e3be4];return _0x3e5c87;};'use strict';var Sequelize=require('sequelize');module[_0xd62c('0x0')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0xd62c('0x1'),'allowNull':![]},'options':{'type':Sequelize[_0xd62c('0x2')],'set':function(_0x1a6bd8){this[_0xd62c('0x3')](_0xd62c('0x4'),_0x1a6bd8?_0x1a6bd8[_0xd62c('0x5')](''):[]);},'get':function(){return this[_0xd62c('0x6')](_0xd62c('0x4'))?this[_0xd62c('0x6')](_0xd62c('0x4'))[_0xd62c('0x7')](''):[];}},'auth':{'type':Sequelize[_0xd62c('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xd62c('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xd62c('0x2')]},'description':{'type':Sequelize[_0xd62c('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 1fc17dd..e2b171d 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 _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 +var _0x17be=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','moment','bluebird','mustache','util','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','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','set','Content-Range','apply','reject','save','update','then','destroy','ChanSpies','UserProfileResource','error','index','map','VoiceChanSpy','type','key','model','name','query','keys','filters','intersection','attributes','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','length','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x57d9a6,_0x2120ec){var _0x2ad98f=function(_0x18684c){while(--_0x18684c){_0x57d9a6['push'](_0x57d9a6['shift']());}};_0x2ad98f(++_0x2120ec);}(_0x17be,0xa5));var _0xe17b=function(_0x52ae62,_0x3dbdff){_0x52ae62=_0x52ae62-0x0;var _0x28f3f8=_0x17be[_0x52ae62];return _0x28f3f8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe17b('0x0'));var zipdir=require(_0xe17b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe17b('0x2'));var BPromise=require(_0xe17b('0x3'));var Mustache=require(_0xe17b('0x4'));var util=require(_0xe17b('0x5'));var path=require('path');var sox=require(_0xe17b('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xe17b('0x7'));var crypto=require(_0xe17b('0x8'));var jsforce=require(_0xe17b('0x9'));var deskjs=require(_0xe17b('0xa'));var toCsv=require(_0xe17b('0xb'));var querystring=require(_0xe17b('0xc'));var Papa=require(_0xe17b('0xd'));var Redis=require(_0xe17b('0xe'));var authService=require(_0xe17b('0xf'));var qs=require(_0xe17b('0x10'));var as=require(_0xe17b('0x11'));var hardwareService=require(_0xe17b('0x12'));var logger=require(_0xe17b('0x13'))('api');var utils=require(_0xe17b('0x14'));var config=require('../../config/environment');var db=require(_0xe17b('0x15'))['db'];function respondWithStatusCode(_0x354224,_0x448390){_0x448390=_0x448390||0xcc;return function(_0xcf9ff6){if(_0xcf9ff6){return _0x354224[_0xe17b('0x16')](_0x448390);}return _0x354224[_0xe17b('0x17')](_0x448390)[_0xe17b('0x18')]();};}function respondWithResult(_0x2083a9,_0x4b3972){_0x4b3972=_0x4b3972||0xc8;return function(_0x43f0e7){if(_0x43f0e7){return _0x2083a9[_0xe17b('0x17')](_0x4b3972)[_0xe17b('0x19')](_0x43f0e7);}};}function respondWithFilteredResult(_0x1c3db8,_0x1ca5c0){return function(_0x33bee4){if(_0x33bee4){var _0x3fe026=_0x33bee4[_0xe17b('0x1a')],_0x59fc41=_0x1ca5c0[_0xe17b('0x1b')],_0x116d92=_0x1ca5c0[_0xe17b('0x1b')]+_0x1ca5c0[_0xe17b('0x1c')],_0x565cc7;if(_0x116d92>=_0x3fe026){_0x116d92=_0x3fe026;_0x565cc7=0xc8;}else{_0x565cc7=0xce;}_0x1c3db8['status'](_0x565cc7);return _0x1c3db8[_0xe17b('0x1d')](_0xe17b('0x1e'),_0x59fc41+'-'+_0x116d92+'/'+_0x3fe026)[_0xe17b('0x19')](_0x33bee4);}return null;};}function patchUpdates(_0x130367){return function(_0x202be9){try{jsonpatch[_0xe17b('0x1f')](_0x202be9,_0x130367,!![]);}catch(_0x1c8fac){return BPromise[_0xe17b('0x20')](_0x1c8fac);}return _0x202be9[_0xe17b('0x21')]();};}function saveUpdates(_0x4f8dea,_0x20f692){return function(_0x457390){if(_0x457390){return _0x457390[_0xe17b('0x22')](_0x4f8dea)[_0xe17b('0x23')](function(_0x10133d){return _0x10133d;});}return null;};}function removeEntity(_0x4a540f,_0x59682b){return function(_0x19435e){if(_0x19435e){return _0x19435e[_0xe17b('0x24')]()['then'](function(){var _0x18bae1=_0x19435e['get']({'plain':!![]});var _0x4890e0=_0xe17b('0x25');return db[_0xe17b('0x26')][_0xe17b('0x24')]({'where':{'type':_0x4890e0,'resourceId':_0x18bae1['id']}})[_0xe17b('0x23')](function(){return _0x19435e;});})[_0xe17b('0x23')](function(){_0x4a540f[_0xe17b('0x17')](0xcc)[_0xe17b('0x18')]();});}};}function handleEntityNotFound(_0x490e3b,_0x279a20){return function(_0x2d5a85){if(!_0x2d5a85){_0x490e3b['sendStatus'](0x194);}return _0x2d5a85;};}function handleError(_0x3bf925,_0x4030bb){_0x4030bb=_0x4030bb||0x1f4;return function(_0x10c7ee){logger[_0xe17b('0x27')](_0x10c7ee['stack']);if(_0x10c7ee['name']){delete _0x10c7ee['name'];}_0x3bf925[_0xe17b('0x17')](_0x4030bb)['send'](_0x10c7ee);};}exports[_0xe17b('0x28')]=function(_0x328370,_0x19f416){var _0x48cb9c={},_0x24188a={},_0x257dad={'count':0x0,'rows':[]};var _0x337900=_[_0xe17b('0x29')](db[_0xe17b('0x2a')]['rawAttributes'],function(_0x45c1b9){return{'name':_0x45c1b9['fieldName'],'type':_0x45c1b9[_0xe17b('0x2b')][_0xe17b('0x2c')]};});_0x24188a[_0xe17b('0x2d')]=_[_0xe17b('0x29')](_0x337900,_0xe17b('0x2e'));_0x24188a[_0xe17b('0x2f')]=_[_0xe17b('0x30')](_0x328370[_0xe17b('0x2f')]);_0x24188a[_0xe17b('0x31')]=_[_0xe17b('0x32')](_0x24188a[_0xe17b('0x2d')],_0x24188a[_0xe17b('0x2f')]);_0x48cb9c[_0xe17b('0x33')]=_['intersection'](_0x24188a[_0xe17b('0x2d')],qs['fields'](_0x328370[_0xe17b('0x2f')]['fields']));_0x48cb9c[_0xe17b('0x33')]=_0x48cb9c['attributes']['length']?_0x48cb9c[_0xe17b('0x33')]:_0x24188a['model'];if(!_0x328370[_0xe17b('0x2f')]['hasOwnProperty']('nolimit')){_0x48cb9c[_0xe17b('0x1c')]=qs['limit'](_0x328370[_0xe17b('0x2f')][_0xe17b('0x1c')]);_0x48cb9c['offset']=qs[_0xe17b('0x1b')](_0x328370[_0xe17b('0x2f')][_0xe17b('0x1b')]);}_0x48cb9c[_0xe17b('0x34')]=qs[_0xe17b('0x35')](_0x328370[_0xe17b('0x2f')][_0xe17b('0x35')]);_0x48cb9c[_0xe17b('0x36')]=qs[_0xe17b('0x31')](_[_0xe17b('0x37')](_0x328370[_0xe17b('0x2f')],_0x24188a[_0xe17b('0x31')]),_0x337900);if(_0x328370[_0xe17b('0x2f')]['filter']){_0x48cb9c['where']=_[_0xe17b('0x38')](_0x48cb9c['where'],{'$or':_[_0xe17b('0x29')](_0x337900,function(_0xd96295){if(_0xd96295[_0xe17b('0x2b')]!==_0xe17b('0x39')){var _0x54aa55={};_0x54aa55[_0xd96295[_0xe17b('0x2e')]]={'$like':'%'+_0x328370[_0xe17b('0x2f')][_0xe17b('0x3a')]+'%'};return _0x54aa55;}})});}_0x48cb9c=_['merge']({},_0x48cb9c,_0x328370[_0xe17b('0x3b')]);var _0xacd2f6={'where':_0x48cb9c[_0xe17b('0x36')]};return db['VoiceChanSpy'][_0xe17b('0x1a')](_0xacd2f6)[_0xe17b('0x23')](function(_0x460885){_0x257dad['count']=_0x460885;if(_0x328370[_0xe17b('0x2f')][_0xe17b('0x3c')]){_0x48cb9c[_0xe17b('0x3d')]=[{'all':!![]}];}return db[_0xe17b('0x2a')][_0xe17b('0x3e')](_0x48cb9c);})['then'](function(_0x5eaadb){_0x257dad[_0xe17b('0x3f')]=_0x5eaadb;return _0x257dad;})[_0xe17b('0x23')](respondWithFilteredResult(_0x19f416,_0x48cb9c))[_0xe17b('0x40')](handleError(_0x19f416,null));};exports[_0xe17b('0x41')]=function(_0xa1ae98,_0x26bcd3){var _0xe5bb8f={'raw':![],'where':{'id':_0xa1ae98[_0xe17b('0x42')]['id']}},_0x569020={};_0x569020[_0xe17b('0x2d')]=_[_0xe17b('0x30')](db[_0xe17b('0x2a')][_0xe17b('0x43')]);_0x569020[_0xe17b('0x2f')]=_[_0xe17b('0x30')](_0xa1ae98[_0xe17b('0x2f')]);_0x569020[_0xe17b('0x31')]=_[_0xe17b('0x32')](_0x569020[_0xe17b('0x2d')],_0x569020['query']);_0xe5bb8f[_0xe17b('0x33')]=_['intersection'](_0x569020[_0xe17b('0x2d')],qs['fields'](_0xa1ae98[_0xe17b('0x2f')][_0xe17b('0x44')]));_0xe5bb8f[_0xe17b('0x33')]=_0xe5bb8f[_0xe17b('0x33')][_0xe17b('0x45')]?_0xe5bb8f[_0xe17b('0x33')]:_0x569020['model'];if(_0xa1ae98[_0xe17b('0x2f')]['includeAll']){_0xe5bb8f[_0xe17b('0x3d')]=[{'all':!![]}];}_0xe5bb8f=_[_0xe17b('0x38')]({},_0xe5bb8f,_0xa1ae98[_0xe17b('0x3b')]);return db[_0xe17b('0x2a')][_0xe17b('0x46')](_0xe5bb8f)['then'](handleEntityNotFound(_0x26bcd3,null))[_0xe17b('0x23')](respondWithResult(_0x26bcd3,null))[_0xe17b('0x40')](handleError(_0x26bcd3,null));};exports[_0xe17b('0x47')]=function(_0x350c98,_0x5cbb08){return db['VoiceChanSpy']['create'](_0x350c98['body'],{})['then'](function(_0x454953){var _0x2ac144=_0x350c98[_0xe17b('0x48')][_0xe17b('0x49')]({'plain':!![]});if(!_0x2ac144)throw new Error(_0xe17b('0x4a'));if(_0x2ac144[_0xe17b('0x4b')]===_0xe17b('0x48')){var _0xabee00=_0x454953[_0xe17b('0x49')]({'plain':!![]});var _0x182212=_0xe17b('0x25');return db[_0xe17b('0x4c')]['find']({'where':{'name':_0x182212,'userProfileId':_0x2ac144[_0xe17b('0x4d')]},'raw':!![]})[_0xe17b('0x23')](function(_0x516a8f){if(_0x516a8f&&_0x516a8f[_0xe17b('0x4e')]===0x0){return db[_0xe17b('0x26')][_0xe17b('0x47')]({'name':_0xabee00['name'],'resourceId':_0xabee00['id'],'type':_0x516a8f[_0xe17b('0x2e')],'sectionId':_0x516a8f['id']},{})['then'](function(){return _0x454953;});}else{return _0x454953;}})[_0xe17b('0x40')](function(_0x4be481){logger[_0xe17b('0x27')](_0xe17b('0x4f'),_0x4be481);throw _0x4be481;});}return _0x454953;})['then'](respondWithResult(_0x5cbb08,0xc9))['catch'](handleError(_0x5cbb08,null));};exports[_0xe17b('0x22')]=function(_0x5bbdcd,_0x3d56ac){if(_0x5bbdcd[_0xe17b('0x50')]['id']){delete _0x5bbdcd[_0xe17b('0x50')]['id'];}return db[_0xe17b('0x2a')]['find']({'where':{'id':_0x5bbdcd['params']['id']}})[_0xe17b('0x23')](handleEntityNotFound(_0x3d56ac,null))['then'](saveUpdates(_0x5bbdcd[_0xe17b('0x50')],null))[_0xe17b('0x23')](respondWithResult(_0x3d56ac,null))[_0xe17b('0x40')](handleError(_0x3d56ac,null));};exports[_0xe17b('0x24')]=function(_0x2118d5,_0x4a0e56){return db[_0xe17b('0x2a')][_0xe17b('0x46')]({'where':{'id':_0x2118d5[_0xe17b('0x42')]['id']}})[_0xe17b('0x23')](handleEntityNotFound(_0x4a0e56,null))['then'](removeEntity(_0x4a0e56,null))[_0xe17b('0x40')](handleError(_0x4a0e56,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 438f2ea..99e9716 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 _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 +var _0x2a4b=['VoiceExtension','destroy','util','./voiceChanSpy.attributes','format','%s%s','prefix','system','push','merge','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','internal','concat','User','findAll','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','bulkCreate'];(function(_0xc7c7aa,_0x2b5b02){var _0x499731=function(_0xbccca5){while(--_0xbccca5){_0xc7c7aa['push'](_0xc7c7aa['shift']());}};_0x499731(++_0x2b5b02);}(_0x2a4b,0xbb));var _0xb2a4=function(_0x4ff1e3,_0x52cf02){_0x4ff1e3=_0x4ff1e3-0x0;var _0x43deba=_0x2a4b[_0x4ff1e3];return _0x43deba;};'use strict';var _=require('lodash');var util=require(_0xb2a4('0x0'));var BPromise=require('bluebird');var attributes=require(_0xb2a4('0x1'));var getUserApplications=function(_0x186b93,_0x477f1c,_0x23414c){var _0x3b976e=0x1;var _0x139e1f=[];var _0x50b6a7={'context':_0x477f1c['context']||'from-sip','exten':util[_0xb2a4('0x2')](_0xb2a4('0x3'),_0x186b93[_0xb2a4('0x4')],_0x23414c),'type':_0xb2a4('0x5'),'isApp':![],'ChanSpyId':_0x186b93['id'],'UserId':_0x477f1c['id']};_0x139e1f[_0xb2a4('0x6')](_[_0xb2a4('0x7')]({'app':'Set','appdata':util[_0xb2a4('0x2')](_0xb2a4('0x8'),_0xb2a4('0x9')),'priority':_0x3b976e++},_0x50b6a7));if(_0x186b93[_0xb2a4('0xa')]){_0x139e1f[_0xb2a4('0x6')](_[_0xb2a4('0x7')]({'app':'MixMonitor','appdata':util[_0xb2a4('0x2')](_0xb2a4('0xb'),_0x186b93[_0xb2a4('0xc')]),'priority':_0x3b976e++},_0x50b6a7));}if(_0x186b93[_0xb2a4('0xd')]){_0x139e1f[_0xb2a4('0x6')](_['merge']({'app':_0xb2a4('0xe'),'appdata':_0x186b93[_0xb2a4('0xf')],'priority':_0x3b976e++},_0x50b6a7));}_0x139e1f[_0xb2a4('0x6')](_[_0xb2a4('0x7')]({'app':_0xb2a4('0x10'),'appdata':util[_0xb2a4('0x2')](_0xb2a4('0x11'),_0x477f1c[_0xb2a4('0x12')],_0x186b93[_0xb2a4('0x13')]?_0x186b93[_0xb2a4('0x13')][_0xb2a4('0x14')](''):''),'priority':_0x3b976e++},_0x50b6a7));if(_0x186b93[_0xb2a4('0xa')]){_0x139e1f[_0xb2a4('0x6')](_['merge']({'app':_0xb2a4('0x15'),'priority':_0x3b976e++},_0x50b6a7));}return _0x139e1f;};var getChanSpyApplications=function(_0x1045f8,_0x2d51f8){var _0x33ff61=[];for(var _0xc2d810=0x0,_0x59c8b3=0x1;_0xc2d810<_0x2d51f8[_0xb2a4('0x16')];_0xc2d810++,_0x59c8b3=0x1){_0x33ff61=_0x33ff61['concat'](getUserApplications(_0x1045f8,_0x2d51f8[_0xc2d810],_0x2d51f8[_0xc2d810][_0xb2a4('0x17')]));if(_0x2d51f8[_0xc2d810][_0xb2a4('0x17')]!=_0x2d51f8[_0xc2d810][_0xb2a4('0x12')]){_0x33ff61=_0x33ff61[_0xb2a4('0x18')](getUserApplications(_0x1045f8,_0x2d51f8[_0xc2d810],_0x2d51f8[_0xc2d810]['name']));}}return _0x33ff61;};var getChanSpyPromise=function(_0x4b44ad,_0x21a0e6){return new BPromise(function(_0x5aa87e,_0x4c9f98){return _0x4b44ad[_0xb2a4('0x19')][_0xb2a4('0x1a')]({'attributes':['id',_0xb2a4('0x12'),_0xb2a4('0x17')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xb2a4('0x1b')](function(_0x5430f8){if(_0x5430f8){return _0x5aa87e(getChanSpyApplications(_0x21a0e6,_0x5430f8));}return _0x5aa87e([]);})[_0xb2a4('0x1c')](function(_0x1b69c7){_0x4c9f98(_0x1b69c7);});});};module[_0xb2a4('0x1d')]=function(_0x5969b5,_0x3eb005){var _0x4a45b4=_0x5969b5[_0xb2a4('0x1e')];return _0x5969b5[_0xb2a4('0x1f')](_0xb2a4('0x20'),attributes,{'tableName':_0xb2a4('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f433d,_0x13a95c,_0x4c7f45){return getChanSpyPromise(_0x4a45b4,_0x1f433d)[_0xb2a4('0x1b')](function(_0xfe0c01){if(_0xfe0c01&&_0xfe0c01['length']){return _0x4a45b4['VoiceExtension'][_0xb2a4('0x22')](_0xfe0c01);}})[_0xb2a4('0x1b')](function(){_0x4c7f45();})[_0xb2a4('0x1c')](function(_0x59d105){_0x4c7f45(_0x59d105);});},'afterUpdate':function(_0x2cd63c,_0x562c83,_0x156c73){return _0x4a45b4[_0xb2a4('0x23')][_0xb2a4('0x24')]({'where':{'ChanSpyId':_0x2cd63c['id']}})[_0xb2a4('0x1b')](function(){return getChanSpyPromise(_0x4a45b4,_0x2cd63c);})[_0xb2a4('0x1b')](function(_0x31d446){if(_0x31d446&&_0x31d446['length']){return _0x4a45b4['VoiceExtension'][_0xb2a4('0x22')](_0x31d446);}})['then'](function(){_0x156c73();})[_0xb2a4('0x1c')](function(_0x119258){_0x156c73(_0x119258);});},'afterDestroy':function(_0x22f753,_0x28c4aa,_0x4664e7){return _0x4a45b4[_0xb2a4('0x23')][_0xb2a4('0x24')]({'where':{'ChanSpyId':_0x22f753['id']}})[_0xb2a4('0x1b')](function(){_0x4664e7();})[_0xb2a4('0x1c')](function(_0x5d4f82){_0x4664e7(_0x5d4f82);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 0719cf3..d5f8130 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 _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 +var _0xf758=['request\x20sent','catch','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceChanSpy,\x20%s,\x20%s','debug','stringify','error','code','message'];(function(_0x1e5bac,_0x2c5987){var _0x341bef=function(_0x3b08ef){while(--_0x3b08ef){_0x1e5bac['push'](_0x1e5bac['shift']());}};_0x341bef(++_0x2c5987);}(_0xf758,0x16a));var _0x8f75=function(_0x45310c,_0x106a46){_0x45310c=_0x45310c-0x0;var _0x5e941f=_0xf758[_0x45310c];return _0x5e941f;};'use strict';var _=require(_0x8f75('0x0'));var util=require(_0x8f75('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f75('0x2'));var db=require(_0x8f75('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8f75('0x4'))(_0x8f75('0x5'));var config=require(_0x8f75('0x6'));var jayson=require(_0x8f75('0x7'));var client=jayson[_0x8f75('0x8')][_0x8f75('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43c6cb,_0x5eb836,_0x281fdf){return new BPromise(function(_0x4d770a,_0x115d58){return client[_0x8f75('0xa')](_0x43c6cb,_0x281fdf)['then'](function(_0x8b25d5){logger[_0x8f75('0xb')](_0x8f75('0xc'),_0x5eb836,'request\x20sent');logger[_0x8f75('0xd')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x5eb836,'request\x20sent',JSON[_0x8f75('0xe')](_0x8b25d5));if(_0x8b25d5[_0x8f75('0xf')]){if(_0x8b25d5[_0x8f75('0xf')][_0x8f75('0x10')]===0x1f4){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x5eb836,_0x8b25d5[_0x8f75('0xf')]['message']);return _0x115d58(_0x8b25d5[_0x8f75('0xf')]['message']);}logger[_0x8f75('0xf')](_0x8f75('0xc'),_0x5eb836,_0x8b25d5[_0x8f75('0xf')]['message']);return _0x4d770a(_0x8b25d5['error'][_0x8f75('0x11')]);}else{logger[_0x8f75('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0x5eb836,_0x8f75('0x12'));_0x4d770a(_0x8b25d5['result']['message']);}})[_0x8f75('0x13')](function(_0xe114ad){logger['error'](_0x8f75('0xc'),_0x5eb836,_0xe114ad);_0x115d58(_0xe114ad);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 426b018..f759628 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 _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 +var _0xdfd6=['../../config/environment','./voiceContext.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x56e4e7,_0x1db098){var _0x383618=function(_0xb088c6){while(--_0xb088c6){_0x56e4e7['push'](_0x56e4e7['shift']());}};_0x383618(++_0x1db098);}(_0xdfd6,0x1c6));var _0x6dfd=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdfd6[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x6dfd('0x0'));var util=require(_0x6dfd('0x1'));var path=require(_0x6dfd('0x2'));var timeout=require(_0x6dfd('0x3'));var express=require(_0x6dfd('0x4'));var router=express[_0x6dfd('0x5')]();var auth=require(_0x6dfd('0x6'));var interaction=require(_0x6dfd('0x7'));var config=require(_0x6dfd('0x8'));var controller=require(_0x6dfd('0x9'));router['get']('/',auth[_0x6dfd('0xa')](),controller[_0x6dfd('0xb')]);router[_0x6dfd('0xc')](_0x6dfd('0xd'),auth['isAuthenticated'](),controller[_0x6dfd('0xe')]);router[_0x6dfd('0xf')]('/',auth[_0x6dfd('0xa')](),controller[_0x6dfd('0x10')]);router[_0x6dfd('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x6dfd('0x12')]);router['delete']('/:id',auth[_0x6dfd('0xa')](),controller[_0x6dfd('0x13')]);module[_0x6dfd('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 73f311c..492f8a2 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(_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 +var _0x3e74=['name','sequelize','STRING'];(function(_0x37ef38,_0x2cfe4e){var _0x499daa=function(_0x18d0f5){while(--_0x18d0f5){_0x37ef38['push'](_0x37ef38['shift']());}};_0x499daa(++_0x2cfe4e);}(_0x3e74,0x175));var _0x43e7=function(_0xef49e7,_0x2106e7){_0xef49e7=_0xef49e7-0x0;var _0x4d74e3=_0x3e74[_0xef49e7];return _0x4d74e3;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'unique':_0x43e7('0x2')},'description':{'type':Sequelize[_0x43e7('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index cc46fb6..aa258e3 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 _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 +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(_0x3a3e2f,_0x41df79){var _0x665942=function(_0x45176d){while(--_0x45176d){_0x3a3e2f['push'](_0x3a3e2f['shift']());}};_0x665942(++_0x41df79);}(_0x3e74,0x175));var _0x43e7=function(_0x41f793,_0x345ea5){_0x41f793=_0x41f793-0x0;var _0x403385=_0x3e74[_0x41f793];return _0x403385;};'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 diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 0844e02..3e46edd 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 _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 +var _0x4c72=['util','../../config/logger','bluebird','request-promise','path','../../config/environment','./voiceContext.attributes','exports','VoiceContext','voice_contexts','lodash'];(function(_0x140332,_0x102a44){var _0x2d14f=function(_0x201b35){while(--_0x201b35){_0x140332['push'](_0x140332['shift']());}};_0x2d14f(++_0x102a44);}(_0x4c72,0x180));var _0x24c7=function(_0x13be78,_0x4f457d){_0x13be78=_0x13be78-0x0;var _0x4bd076=_0x4c72[_0x13be78];return _0x4bd076;};'use strict';var _=require(_0x24c7('0x0'));var util=require(_0x24c7('0x1'));var logger=require(_0x24c7('0x2'))('api');var moment=require('moment');var BPromise=require(_0x24c7('0x3'));var rp=require(_0x24c7('0x4'));var fs=require('fs');var path=require(_0x24c7('0x5'));var rimraf=require('rimraf');var config=require(_0x24c7('0x6'));var attributes=require(_0x24c7('0x7'));module[_0x24c7('0x8')]=function(_0x35157e,_0x5b316d){return _0x35157e['define'](_0x24c7('0x9'),attributes,{'tableName':_0x24c7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 76876f7..76d1b0c 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 _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 +var _0x1db9=['code','message','VoiceContext,\x20%s,\x20%s','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1f50b8,_0x516324){var _0x895388=function(_0x4796dd){while(--_0x4796dd){_0x1f50b8['push'](_0x1f50b8['shift']());}};_0x895388(++_0x516324);}(_0x1db9,0x1e9));var _0x91db=function(_0x180ec6,_0x58ab07){_0x180ec6=_0x180ec6-0x0;var _0xd8c906=_0x1db9[_0x180ec6];return _0xd8c906;};'use strict';var _=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var moment=require(_0x91db('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x91db('0x3'));var db=require(_0x91db('0x4'))['db'];var utils=require(_0x91db('0x5'));var logger=require(_0x91db('0x6'))(_0x91db('0x7'));var config=require(_0x91db('0x8'));var jayson=require(_0x91db('0x9'));var client=jayson[_0x91db('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x376b7b,_0x16d05c,_0x4c27c7){return new BPromise(function(_0x24dfac,_0x25e291){return client[_0x91db('0xb')](_0x376b7b,_0x4c27c7)['then'](function(_0x3a1572){logger['info']('VoiceContext,\x20%s,\x20%s',_0x16d05c,_0x91db('0xc'));logger[_0x91db('0xd')](_0x91db('0xe'),_0x16d05c,'request\x20sent',JSON[_0x91db('0xf')](_0x3a1572));if(_0x3a1572[_0x91db('0x10')]){if(_0x3a1572['error'][_0x91db('0x11')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x16d05c,_0x3a1572[_0x91db('0x10')][_0x91db('0x12')]);return _0x25e291(_0x3a1572[_0x91db('0x10')][_0x91db('0x12')]);}logger[_0x91db('0x10')]('VoiceContext,\x20%s,\x20%s',_0x16d05c,_0x3a1572[_0x91db('0x10')]['message']);return _0x24dfac(_0x3a1572[_0x91db('0x10')]['message']);}else{logger['info'](_0x91db('0x13'),_0x16d05c,_0x91db('0xc'));_0x24dfac(_0x3a1572[_0x91db('0x14')][_0x91db('0x12')]);}})[_0x91db('0x15')](function(_0x37e441){logger[_0x91db('0x10')](_0x91db('0x13'),_0x16d05c,_0x37e441);_0x25e291(_0x37e441);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 58b2025..01d8a07 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 _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 +var _0xece6=['/:id','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x3b4d1b,_0x12517b){var _0x5a2ffd=function(_0x241fe6){while(--_0x241fe6){_0x3b4d1b['push'](_0x3b4d1b['shift']());}};_0x5a2ffd(++_0x12517b);}(_0xece6,0xd7));var _0x6ece=function(_0x198b7b,_0x5f5bae){_0x198b7b=_0x198b7b-0x0;var _0x16c056=_0xece6[_0x198b7b];return _0x16c056;};'use strict';var multer=require(_0x6ece('0x0'));var util=require(_0x6ece('0x1'));var path=require(_0x6ece('0x2'));var timeout=require('connect-timeout');var express=require(_0x6ece('0x3'));var router=express[_0x6ece('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6ece('0x5'));var config=require(_0x6ece('0x6'));var controller=require(_0x6ece('0x7'));router[_0x6ece('0x8')]('/',auth[_0x6ece('0x9')](),controller[_0x6ece('0xa')]);router[_0x6ece('0x8')](_0x6ece('0xb'),auth[_0x6ece('0x9')](),controller[_0x6ece('0xc')]);router['get'](_0x6ece('0xd'),auth[_0x6ece('0x9')](),controller['show']);router['post']('/',auth[_0x6ece('0x9')](),controller['create']);router[_0x6ece('0xe')](_0x6ece('0xd'),auth[_0x6ece('0x9')](),controller[_0x6ece('0xf')]);router[_0x6ece('0x10')](_0x6ece('0xd'),auth[_0x6ece('0x9')](),controller[_0x6ece('0x11')]);module[_0x6ece('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index fdc0511..a7b402a 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 _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 +var _0xb04b=['STRING','INTEGER','DATE','exports'];(function(_0x20cf8a,_0x44cd6b){var _0x54e165=function(_0xcce1d0){while(--_0xcce1d0){_0x20cf8a['push'](_0x20cf8a['shift']());}};_0x54e165(++_0x44cd6b);}(_0xb04b,0xcb));var _0xbb04=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb04b[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0xbb04('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xbb04('0x1')]},'channelstate':{'type':Sequelize[_0xbb04('0x2')]},'channelstatedesc':{'type':Sequelize[_0xbb04('0x1')]},'calleridnum':{'type':Sequelize[_0xbb04('0x1')]},'calleridname':{'type':Sequelize[_0xbb04('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xbb04('0x1')]},'language':{'type':Sequelize[_0xbb04('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xbb04('0x1')]},'exten':{'type':Sequelize[_0xbb04('0x1')]},'priority':{'type':Sequelize[_0xbb04('0x2')]},'uniqueid':{'type':Sequelize[_0xbb04('0x1')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xbb04('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xbb04('0x1')]},'destcalleridnum':{'type':Sequelize[_0xbb04('0x1')]},'destcalleridname':{'type':Sequelize[_0xbb04('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xbb04('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xbb04('0x1')]},'destlanguage':{'type':Sequelize[_0xbb04('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xbb04('0x1')]},'destexten':{'type':Sequelize[_0xbb04('0x1')]},'destpriority':{'type':Sequelize[_0xbb04('0x2')]},'destuniqueid':{'type':Sequelize[_0xbb04('0x1')]},'destlinkedid':{'type':Sequelize[_0xbb04('0x1')]},'dialstring':{'type':Sequelize[_0xbb04('0x1')]},'dialstatus':{'type':Sequelize[_0xbb04('0x1')]},'starttime':{'type':Sequelize[_0xbb04('0x3')]},'answertime':{'type':Sequelize[_0xbb04('0x3')]},'endtime':{'type':Sequelize[_0xbb04('0x3')]},'lastevent':{'type':Sequelize[_0xbb04('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xbb04('0x2')]},'holdtime':{'type':Sequelize[_0xbb04('0x2')]},'billableseconds':{'type':Sequelize[_0xbb04('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 6a83f22..5e5e38a 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 _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 +var _0x3a5e=['filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','fields','find','create','catch','update','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','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','reject','save','destroy','then','sendStatus','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x114486,_0x48c6e1){var _0x5afe9b=function(_0xcc08bf){while(--_0xcc08bf){_0x114486['push'](_0x114486['shift']());}};_0x5afe9b(++_0x48c6e1);}(_0x3a5e,0x14c));var _0xe3a5=function(_0x41abe6,_0x4648bd){_0x41abe6=_0x41abe6-0x0;var _0xf5ddaa=_0x3a5e[_0x41abe6];return _0xf5ddaa;};'use strict';var pdf=require(_0xe3a5('0x0'));var emlformat=require(_0xe3a5('0x1'));var rimraf=require(_0xe3a5('0x2'));var zipdir=require(_0xe3a5('0x3'));var jsonpatch=require(_0xe3a5('0x4'));var rp=require(_0xe3a5('0x5'));var moment=require('moment');var BPromise=require(_0xe3a5('0x6'));var Mustache=require(_0xe3a5('0x7'));var util=require(_0xe3a5('0x8'));var path=require(_0xe3a5('0x9'));var sox=require(_0xe3a5('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe3a5('0xb'));var squel=require('squel');var crypto=require(_0xe3a5('0xc'));var jsforce=require(_0xe3a5('0xd'));var deskjs=require(_0xe3a5('0xe'));var toCsv=require(_0xe3a5('0xf'));var querystring=require(_0xe3a5('0x10'));var Papa=require(_0xe3a5('0x11'));var Redis=require(_0xe3a5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe3a5('0x13'));var as=require(_0xe3a5('0x14'));var hardwareService=require(_0xe3a5('0x15'));var logger=require(_0xe3a5('0x16'))('api');var utils=require(_0xe3a5('0x17'));var config=require(_0xe3a5('0x18'));var db=require(_0xe3a5('0x19'))['db'];function respondWithStatusCode(_0xed6d6a,_0x21df1a){_0x21df1a=_0x21df1a||0xcc;return function(_0x11c871){if(_0x11c871){return _0xed6d6a['sendStatus'](_0x21df1a);}return _0xed6d6a[_0xe3a5('0x1a')](_0x21df1a)[_0xe3a5('0x1b')]();};}function respondWithResult(_0x35097b,_0x69a1c){_0x69a1c=_0x69a1c||0xc8;return function(_0x33d5de){if(_0x33d5de){return _0x35097b[_0xe3a5('0x1a')](_0x69a1c)[_0xe3a5('0x1c')](_0x33d5de);}};}function respondWithFilteredResult(_0x45aad6,_0x28645a){return function(_0x539af2){if(_0x539af2){var _0x59bc87=_0x539af2[_0xe3a5('0x1d')],_0x132932=_0x28645a[_0xe3a5('0x1e')],_0x3994f0=_0x28645a[_0xe3a5('0x1e')]+_0x28645a[_0xe3a5('0x1f')],_0x55e709;if(_0x3994f0>=_0x59bc87){_0x3994f0=_0x59bc87;_0x55e709=0xc8;}else{_0x55e709=0xce;}_0x45aad6[_0xe3a5('0x1a')](_0x55e709);return _0x45aad6[_0xe3a5('0x20')](_0xe3a5('0x21'),_0x132932+'-'+_0x3994f0+'/'+_0x59bc87)[_0xe3a5('0x1c')](_0x539af2);}return null;};}function patchUpdates(_0x5e421c){return function(_0x53091a){try{jsonpatch['apply'](_0x53091a,_0x5e421c,!![]);}catch(_0x1ab537){return BPromise[_0xe3a5('0x22')](_0x1ab537);}return _0x53091a[_0xe3a5('0x23')]();};}function saveUpdates(_0x3eea83,_0x2a07e6){return function(_0x5a2a0c){if(_0x5a2a0c){return _0x5a2a0c['update'](_0x3eea83)['then'](function(_0x453e95){return _0x453e95;});}return null;};}function removeEntity(_0xd5f03b,_0x2920e7){return function(_0x1758db){if(_0x1758db){return _0x1758db[_0xe3a5('0x24')]()[_0xe3a5('0x25')](function(){_0xd5f03b[_0xe3a5('0x1a')](0xcc)[_0xe3a5('0x1b')]();});}};}function handleEntityNotFound(_0x10759c,_0xb8ab4f){return function(_0x182622){if(!_0x182622){_0x10759c[_0xe3a5('0x26')](0x194);}return _0x182622;};}function handleError(_0x3fcedb,_0x551e78){_0x551e78=_0x551e78||0x1f4;return function(_0xe49210){logger[_0xe3a5('0x27')](_0xe49210[_0xe3a5('0x28')]);if(_0xe49210[_0xe3a5('0x29')]){delete _0xe49210['name'];}_0x3fcedb[_0xe3a5('0x1a')](_0x551e78)[_0xe3a5('0x2a')](_0xe49210);};}exports[_0xe3a5('0x2b')]=function(_0x4d709d,_0x3b9f7d){var _0x51acf8={},_0x952936={},_0x3989f6={'count':0x0,'rows':[]};var _0x5a6b20=_[_0xe3a5('0x2c')](db[_0xe3a5('0x2d')][_0xe3a5('0x2e')],function(_0x1c1f79){return{'name':_0x1c1f79[_0xe3a5('0x2f')],'type':_0x1c1f79[_0xe3a5('0x30')][_0xe3a5('0x31')]};});_0x952936[_0xe3a5('0x32')]=_[_0xe3a5('0x2c')](_0x5a6b20,_0xe3a5('0x29'));_0x952936[_0xe3a5('0x33')]=_[_0xe3a5('0x34')](_0x4d709d[_0xe3a5('0x33')]);_0x952936[_0xe3a5('0x35')]=_[_0xe3a5('0x36')](_0x952936[_0xe3a5('0x32')],_0x952936[_0xe3a5('0x33')]);_0x51acf8[_0xe3a5('0x37')]=_['intersection'](_0x952936['model'],qs['fields'](_0x4d709d[_0xe3a5('0x33')]['fields']));_0x51acf8[_0xe3a5('0x37')]=_0x51acf8[_0xe3a5('0x37')][_0xe3a5('0x38')]?_0x51acf8[_0xe3a5('0x37')]:_0x952936[_0xe3a5('0x32')];if(!_0x4d709d[_0xe3a5('0x33')][_0xe3a5('0x39')](_0xe3a5('0x3a'))){_0x51acf8[_0xe3a5('0x1f')]=qs[_0xe3a5('0x1f')](_0x4d709d['query'][_0xe3a5('0x1f')]);_0x51acf8[_0xe3a5('0x1e')]=qs[_0xe3a5('0x1e')](_0x4d709d[_0xe3a5('0x33')][_0xe3a5('0x1e')]);}_0x51acf8['order']=qs[_0xe3a5('0x3b')](_0x4d709d[_0xe3a5('0x33')]['sort']);_0x51acf8[_0xe3a5('0x3c')]=qs[_0xe3a5('0x35')](_[_0xe3a5('0x3d')](_0x4d709d[_0xe3a5('0x33')],_0x952936['filters']),_0x5a6b20);if(_0x4d709d[_0xe3a5('0x33')][_0xe3a5('0x3e')]){_0x51acf8[_0xe3a5('0x3c')]=_[_0xe3a5('0x3f')](_0x51acf8[_0xe3a5('0x3c')],{'$or':_[_0xe3a5('0x2c')](_0x5a6b20,function(_0x32e6fa){if(_0x32e6fa[_0xe3a5('0x30')]!=='VIRTUAL'){var _0x5ac1a3={};_0x5ac1a3[_0x32e6fa[_0xe3a5('0x29')]]={'$like':'%'+_0x4d709d[_0xe3a5('0x33')][_0xe3a5('0x3e')]+'%'};return _0x5ac1a3;}})});}_0x51acf8=_[_0xe3a5('0x3f')]({},_0x51acf8,_0x4d709d[_0xe3a5('0x40')]);var _0x5cb5e4={'where':_0x51acf8[_0xe3a5('0x3c')]};return db[_0xe3a5('0x2d')][_0xe3a5('0x1d')](_0x5cb5e4)[_0xe3a5('0x25')](function(_0x3f3dcf){_0x3989f6[_0xe3a5('0x1d')]=_0x3f3dcf;if(_0x4d709d[_0xe3a5('0x33')][_0xe3a5('0x41')]){_0x51acf8[_0xe3a5('0x42')]=[{'all':!![]}];}return db[_0xe3a5('0x2d')][_0xe3a5('0x43')](_0x51acf8);})[_0xe3a5('0x25')](function(_0x37229f){_0x3989f6[_0xe3a5('0x44')]=_0x37229f;return _0x3989f6;})['then'](respondWithFilteredResult(_0x3b9f7d,_0x51acf8))['catch'](handleError(_0x3b9f7d,null));};exports[_0xe3a5('0x45')]=function(_0x29947a,_0x19370d){var _0xaacd4c={'raw':!![],'where':{'id':_0x29947a['params']['id']}},_0x2a524c={};_0x2a524c[_0xe3a5('0x32')]=_[_0xe3a5('0x34')](db[_0xe3a5('0x2d')][_0xe3a5('0x2e')]);_0x2a524c[_0xe3a5('0x33')]=_[_0xe3a5('0x34')](_0x29947a[_0xe3a5('0x33')]);_0x2a524c[_0xe3a5('0x35')]=_['intersection'](_0x2a524c[_0xe3a5('0x32')],_0x2a524c[_0xe3a5('0x33')]);_0xaacd4c['attributes']=_[_0xe3a5('0x36')](_0x2a524c[_0xe3a5('0x32')],qs[_0xe3a5('0x46')](_0x29947a['query'][_0xe3a5('0x46')]));_0xaacd4c[_0xe3a5('0x37')]=_0xaacd4c[_0xe3a5('0x37')]['length']?_0xaacd4c[_0xe3a5('0x37')]:_0x2a524c[_0xe3a5('0x32')];if(_0x29947a[_0xe3a5('0x33')][_0xe3a5('0x41')]){_0xaacd4c['include']=[{'all':!![]}];}_0xaacd4c=_[_0xe3a5('0x3f')]({},_0xaacd4c,_0x29947a[_0xe3a5('0x40')]);return db[_0xe3a5('0x2d')][_0xe3a5('0x47')](_0xaacd4c)[_0xe3a5('0x25')](handleEntityNotFound(_0x19370d,null))['then'](respondWithResult(_0x19370d,null))['catch'](handleError(_0x19370d,null));};exports[_0xe3a5('0x48')]=function(_0x33d361,_0x4d6684){return db[_0xe3a5('0x2d')]['create'](_0x33d361['body'],{})[_0xe3a5('0x25')](respondWithResult(_0x4d6684,0xc9))[_0xe3a5('0x49')](handleError(_0x4d6684,null));};exports[_0xe3a5('0x4a')]=function(_0x1714f8,_0x424e85){if(_0x1714f8[_0xe3a5('0x4b')]['id']){delete _0x1714f8[_0xe3a5('0x4b')]['id'];}return db[_0xe3a5('0x2d')][_0xe3a5('0x47')]({'where':{'id':_0x1714f8['params']['id']}})['then'](handleEntityNotFound(_0x424e85,null))[_0xe3a5('0x25')](saveUpdates(_0x1714f8[_0xe3a5('0x4b')],null))[_0xe3a5('0x25')](respondWithResult(_0x424e85,null))[_0xe3a5('0x49')](handleError(_0x424e85,null));};exports[_0xe3a5('0x24')]=function(_0xb39ebf,_0x4005c1){return db[_0xe3a5('0x2d')][_0xe3a5('0x47')]({'where':{'id':_0xb39ebf['params']['id']}})[_0xe3a5('0x25')](handleEntityNotFound(_0x4005c1,null))[_0xe3a5('0x25')](removeEntity(_0x4005c1,null))[_0xe3a5('0x49')](handleError(_0x4005c1,null));};exports[_0xe3a5('0x4c')]=function(_0x40b271,_0x356a05){return db[_0xe3a5('0x2d')][_0xe3a5('0x4c')]()[_0xe3a5('0x25')](respondWithResult(_0x356a05,null))[_0xe3a5('0x49')](handleError(_0x356a05,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 117291f..6fcd46d 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 _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 +var _0x4374=['rimraf','../../config/environment','./voiceDialReport.attributes','exports','VoiceDialReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x51a6ab,_0x2a2424){var _0x219de8=function(_0x13e706){while(--_0x13e706){_0x51a6ab['push'](_0x51a6ab['shift']());}};_0x219de8(++_0x2a2424);}(_0x4374,0xef));var _0x4437=function(_0xb661df,_0x34952a){_0xb661df=_0xb661df-0x0;var _0x447ed1=_0x4374[_0xb661df];return _0x447ed1;};'use strict';var _=require(_0x4437('0x0'));var util=require(_0x4437('0x1'));var logger=require(_0x4437('0x2'))(_0x4437('0x3'));var moment=require(_0x4437('0x4'));var BPromise=require(_0x4437('0x5'));var rp=require(_0x4437('0x6'));var fs=require('fs');var path=require(_0x4437('0x7'));var rimraf=require(_0x4437('0x8'));var config=require(_0x4437('0x9'));var attributes=require(_0x4437('0xa'));module[_0x4437('0xb')]=function(_0x4db0bc,_0x474723){return _0x4db0bc['define'](_0x4437('0xc'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 7841e4b..a636342 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 _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 +var _0xbf5c=['jayson/promise','client','http','request','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','update','attributes','info','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x27a5bb,_0x3f4cfb){var _0x2e17ea=function(_0x22912d){while(--_0x22912d){_0x27a5bb['push'](_0x27a5bb['shift']());}};_0x2e17ea(++_0x3f4cfb);}(_0xbf5c,0xb8));var _0xcbf5=function(_0x49ab20,_0x204482){_0x49ab20=_0x49ab20-0x0;var _0x3c10b4=_0xbf5c[_0x49ab20];return _0x3c10b4;};'use strict';var _=require(_0xcbf5('0x0'));var util=require(_0xcbf5('0x1'));var moment=require(_0xcbf5('0x2'));var BPromise=require('bluebird');var rs=require(_0xcbf5('0x3'));var fs=require('fs');var Redis=require(_0xcbf5('0x4'));var db=require(_0xcbf5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbf5('0x6'))(_0xcbf5('0x7'));var config=require('../../config/environment');var jayson=require(_0xcbf5('0x8'));var client=jayson[_0xcbf5('0x9')][_0xcbf5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x522014,_0x4504dd,_0x31b6d1){return new BPromise(function(_0x54d2d4,_0x52f784){return client[_0xcbf5('0xb')](_0x522014,_0x31b6d1)[_0xcbf5('0xc')](function(_0x230a6c){logger['info'](_0xcbf5('0xd'),_0x4504dd,_0xcbf5('0xe'));logger[_0xcbf5('0xf')](_0xcbf5('0x10'),_0x4504dd,_0xcbf5('0xe'),JSON[_0xcbf5('0x11')](_0x230a6c));if(_0x230a6c['error']){if(_0x230a6c[_0xcbf5('0x12')][_0xcbf5('0x13')]===0x1f4){logger[_0xcbf5('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x4504dd,_0x230a6c['error'][_0xcbf5('0x14')]);return _0x52f784(_0x230a6c['error'][_0xcbf5('0x14')]);}logger[_0xcbf5('0x12')](_0xcbf5('0xd'),_0x4504dd,_0x230a6c[_0xcbf5('0x12')]['message']);return _0x54d2d4(_0x230a6c['error'][_0xcbf5('0x14')]);}else{logger['info'](_0xcbf5('0xd'),_0x4504dd,'request\x20sent');_0x54d2d4(_0x230a6c['result'][_0xcbf5('0x14')]);}})[_0xcbf5('0x15')](function(_0x18753e){logger[_0xcbf5('0x12')](_0xcbf5('0xd'),_0x4504dd,_0x18753e);_0x52f784(_0x18753e);});});}exports[_0xcbf5('0x16')]=function(_0x462d46){var _0x53939d=this;return new Promise(function(_0xcf3d18,_0x10d573){return db[_0xcbf5('0x17')][_0xcbf5('0x18')](_0x462d46[_0xcbf5('0x19')],{'raw':_0x462d46[_0xcbf5('0x1a')]?_0x462d46[_0xcbf5('0x1a')][_0xcbf5('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x155147){logger['info'](_0xcbf5('0x16'),_0x462d46);logger['debug'](_0xcbf5('0x16'),_0x462d46,JSON[_0xcbf5('0x11')](_0x155147));_0xcf3d18(_0x155147);})[_0xcbf5('0x15')](function(_0xf2360){logger[_0xcbf5('0x12')](_0xcbf5('0x16'),_0xf2360['message'],_0x462d46);_0x10d573(_0x53939d[_0xcbf5('0x12')](0x1f4,_0xf2360['message']));});});};exports[_0xcbf5('0x1c')]=function(_0x1b59d4){var _0x26477c=this;return new Promise(function(_0x27558a,_0x4c8d12){return db[_0xcbf5('0x17')][_0xcbf5('0x1d')](_0x1b59d4[_0xcbf5('0x19')],{'raw':_0x1b59d4[_0xcbf5('0x1a')]?_0x1b59d4[_0xcbf5('0x1a')][_0xcbf5('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b59d4[_0xcbf5('0x1a')]?_0x1b59d4[_0xcbf5('0x1a')]['where']||null:null,'attributes':_0x1b59d4[_0xcbf5('0x1a')]?_0x1b59d4[_0xcbf5('0x1a')][_0xcbf5('0x1e')]||null:null,'limit':_0x1b59d4[_0xcbf5('0x1a')]?_0x1b59d4[_0xcbf5('0x1a')]['limit']||null:null})[_0xcbf5('0xc')](function(_0x367eb0){logger[_0xcbf5('0x1f')](_0xcbf5('0x1c'),_0x1b59d4);logger[_0xcbf5('0xf')](_0xcbf5('0x1c'),_0x1b59d4,JSON['stringify'](_0x367eb0));_0x27558a(_0x367eb0);})[_0xcbf5('0x15')](function(_0x399f50){logger[_0xcbf5('0x12')](_0xcbf5('0x1c'),_0x399f50[_0xcbf5('0x14')],_0x1b59d4);_0x4c8d12(_0x26477c[_0xcbf5('0x12')](0x1f4,_0x399f50[_0xcbf5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index d3c5a24..47c0d6d 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 _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 +var _0x5ea9=['isAuthenticated','create','addApplications','put','update','delete','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','/:id','post'];(function(_0x217222,_0x38c7e2){var _0x353358=function(_0x2373fa){while(--_0x2373fa){_0x217222['push'](_0x217222['shift']());}};_0x353358(++_0x38c7e2);}(_0x5ea9,0xe7));var _0x95ea=function(_0x51ab33,_0x71a8a8){_0x51ab33=_0x51ab33-0x0;var _0x5e1298=_0x5ea9[_0x51ab33];return _0x5e1298;};'use strict';var multer=require(_0x95ea('0x0'));var util=require(_0x95ea('0x1'));var path=require(_0x95ea('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x95ea('0x3')]();var auth=require(_0x95ea('0x4'));var interaction=require(_0x95ea('0x5'));var config=require('../../config/environment');var controller=require(_0x95ea('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x95ea('0x7'),auth['isAuthenticated'](),controller['show']);router[_0x95ea('0x8')]('/',auth[_0x95ea('0x9')](),controller[_0x95ea('0xa')]);router['post']('/:id/applications',auth[_0x95ea('0x9')](),controller[_0x95ea('0xb')]);router[_0x95ea('0xc')]('/:id',auth[_0x95ea('0x9')](),controller[_0x95ea('0xd')]);router[_0x95ea('0xe')]('/:id',auth[_0x95ea('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index e8bae7f..b9ba76d 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(_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 +var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x298a31,_0x29f9ed){var _0x1f254f=function(_0xe20666){while(--_0xe20666){_0x298a31['push'](_0x298a31['shift']());}};_0x1f254f(++_0x29f9ed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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 675f747..d02b06f 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 _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 +var _0x4975=['rows','catch','show','body','startsWith','exten','concat','user','get','role','userProfileId','autoAssociation','error','context','description','recordingFormat','mandatoryDisposition','addApplications','findOne','params','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','includes','find','value','type','stack','name','send','index','VoiceExtension','rawAttributes','fieldName','key','model','map','keys','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x4975,0x86));var _0x5497=function(_0x391f03,_0x5d316a){_0x391f03=_0x391f03-0x0;var _0x202484=_0x4975[_0x391f03];return _0x202484;};'use strict';var pdf=require(_0x5497('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5497('0x1'));var zipdir=require(_0x5497('0x2'));var jsonpatch=require(_0x5497('0x3'));var rp=require(_0x5497('0x4'));var moment=require(_0x5497('0x5'));var BPromise=require(_0x5497('0x6'));var Mustache=require(_0x5497('0x7'));var util=require(_0x5497('0x8'));var path=require(_0x5497('0x9'));var sox=require(_0x5497('0xa'));var csv=require('to-csv');var ejs=require(_0x5497('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xf'));var querystring=require('querystring');var Papa=require(_0x5497('0x10'));var Redis=require(_0x5497('0x11'));var authService=require(_0x5497('0x12'));var qs=require(_0x5497('0x13'));var as=require(_0x5497('0x14'));var hardwareService=require(_0x5497('0x15'));var logger=require(_0x5497('0x16'))(_0x5497('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x5497('0x18')]=_[_0x5497('0x19')](config[_0x5497('0x18')],{'host':_0x5497('0x1a'),'port':0x18eb});var socket=require(_0x5497('0x1b'))(new Redis(config[_0x5497('0x18')]));require(_0x5497('0x1c'))[_0x5497('0x1d')](socket);function respondWithStatusCode(_0x363a5b,_0x1a4c74){_0x1a4c74=_0x1a4c74||0xcc;return function(_0x55f590){if(_0x55f590){return _0x363a5b[_0x5497('0x1e')](_0x1a4c74);}return _0x363a5b['status'](_0x1a4c74)[_0x5497('0x1f')]();};}function respondWithResult(_0x2bfd8a,_0x19e5f3){_0x19e5f3=_0x19e5f3||0xc8;return function(_0x3ce50b){if(_0x3ce50b){return _0x2bfd8a[_0x5497('0x20')](_0x19e5f3)[_0x5497('0x21')](_0x3ce50b);}};}function respondWithFilteredResult(_0x2f2997,_0x575f6b){return function(_0x56a788){if(_0x56a788){var _0x3f4d20=_0x56a788[_0x5497('0x22')],_0x1bf442=_0x575f6b[_0x5497('0x23')],_0x3a47fd=_0x575f6b[_0x5497('0x23')]+_0x575f6b[_0x5497('0x24')],_0x5d9e24;if(_0x3a47fd>=_0x3f4d20){_0x3a47fd=_0x3f4d20;_0x5d9e24=0xc8;}else{_0x5d9e24=0xce;}_0x2f2997[_0x5497('0x20')](_0x5d9e24);return _0x2f2997[_0x5497('0x25')](_0x5497('0x26'),_0x1bf442+'-'+_0x3a47fd+'/'+_0x3f4d20)[_0x5497('0x21')](_0x56a788);}return null;};}function patchUpdates(_0x2e3960){return function(_0x3f54ef){try{jsonpatch[_0x5497('0x27')](_0x3f54ef,_0x2e3960,!![]);}catch(_0x52c049){return BPromise[_0x5497('0x28')](_0x52c049);}return _0x3f54ef['save']();};}function saveUpdates(_0x19200a,_0xd0868d){return function(_0x44265c){if(_0x44265c){return _0x44265c[_0x5497('0x29')](_0x19200a)[_0x5497('0x2a')](function(_0x3b2fbc){return _0x3b2fbc;});}return null;};}function removeEntity(_0x5018fa,_0x54043a){return function(_0x1eefce){if(_0x1eefce){return _0x1eefce[_0x5497('0x2b')]()[_0x5497('0x2a')](function(){var _0x281155=_0x1eefce['get']({'plain':!![]});var _0x13b7a4=[{'name':'InboundRoutes','value':_0x5497('0x2c'),'ignore':![]},{'name':_0x5497('0x2d'),'value':_0x5497('0x2e'),'ignore':![]},{'name':_0x5497('0x2f'),'value':_0x5497('0x30'),'ignore':![]}];var _0x31cd01=_(_0x13b7a4)['filter'](_0x5497('0x31'))['map']('value')['value']();if(_[_0x5497('0x32')](_0x31cd01,_0x281155['type'])){return;}var _0x5e9356=_[_0x5497('0x33')](_0x13b7a4,[_0x5497('0x34'),_0x281155[_0x5497('0x35')]])['name'];return db['UserProfileResource']['destroy']({'where':{'type':_0x5e9356,'resourceId':_0x281155['id']}})[_0x5497('0x2a')](function(){return _0x1eefce;});})[_0x5497('0x2a')](function(){_0x5018fa[_0x5497('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x489f71,_0x594866){return function(_0xa28dd8){if(!_0xa28dd8){_0x489f71['sendStatus'](0x194);}return _0xa28dd8;};}function handleError(_0x438ee4,_0x258c2d){_0x258c2d=_0x258c2d||0x1f4;return function(_0x77c575){logger['error'](_0x77c575[_0x5497('0x36')]);if(_0x77c575[_0x5497('0x37')]){delete _0x77c575['name'];}_0x438ee4[_0x5497('0x20')](_0x258c2d)[_0x5497('0x38')](_0x77c575);};}exports[_0x5497('0x39')]=function(_0x489fbd,_0x3395f6){var _0x2fe1f2={},_0x125d51={},_0x362b96={'count':0x0,'rows':[]};var _0x412f5b=_['map'](db[_0x5497('0x3a')][_0x5497('0x3b')],function(_0x558a70){return{'name':_0x558a70[_0x5497('0x3c')],'type':_0x558a70[_0x5497('0x35')][_0x5497('0x3d')]};});_0x125d51[_0x5497('0x3e')]=_[_0x5497('0x3f')](_0x412f5b,_0x5497('0x37'));_0x125d51['query']=_[_0x5497('0x40')](_0x489fbd['query']);_0x125d51[_0x5497('0x41')]=_[_0x5497('0x42')](_0x125d51[_0x5497('0x3e')],_0x125d51['query']);_0x2fe1f2['attributes']=_[_0x5497('0x42')](_0x125d51[_0x5497('0x3e')],qs[_0x5497('0x43')](_0x489fbd[_0x5497('0x44')][_0x5497('0x43')]));_0x2fe1f2[_0x5497('0x45')]=_0x2fe1f2['attributes'][_0x5497('0x46')]?_0x2fe1f2[_0x5497('0x45')]:_0x125d51[_0x5497('0x3e')];if(!_0x489fbd[_0x5497('0x44')][_0x5497('0x47')](_0x5497('0x48'))){_0x2fe1f2[_0x5497('0x24')]=qs[_0x5497('0x24')](_0x489fbd[_0x5497('0x44')]['limit']);_0x2fe1f2[_0x5497('0x23')]=qs[_0x5497('0x23')](_0x489fbd[_0x5497('0x44')][_0x5497('0x23')]);}_0x2fe1f2[_0x5497('0x49')]=qs[_0x5497('0x4a')](_0x489fbd[_0x5497('0x44')]['sort']);_0x2fe1f2[_0x5497('0x4b')]=qs[_0x5497('0x41')](_[_0x5497('0x4c')](_0x489fbd[_0x5497('0x44')],_0x125d51[_0x5497('0x41')]),_0x412f5b);if(_0x489fbd[_0x5497('0x44')][_0x5497('0x4d')]){_0x2fe1f2['where']=_[_0x5497('0x4e')](_0x2fe1f2[_0x5497('0x4b')],{'$or':_[_0x5497('0x3f')](_0x412f5b,function(_0x1e6389){if(_0x1e6389[_0x5497('0x35')]!==_0x5497('0x4f')){var _0xc1a999={};_0xc1a999[_0x1e6389[_0x5497('0x37')]]={'$like':'%'+_0x489fbd[_0x5497('0x44')][_0x5497('0x4d')]+'%'};return _0xc1a999;}})});}_0x2fe1f2=_['merge']({},_0x2fe1f2,_0x489fbd[_0x5497('0x50')]);var _0x4a9fd7={'where':_0x2fe1f2[_0x5497('0x4b')]};return db[_0x5497('0x3a')][_0x5497('0x22')](_0x4a9fd7)[_0x5497('0x2a')](function(_0x133746){_0x362b96['count']=_0x133746;if(_0x489fbd[_0x5497('0x44')][_0x5497('0x51')]){_0x2fe1f2['include']=[{'all':!![]}];}return db[_0x5497('0x3a')]['findAll'](_0x2fe1f2);})[_0x5497('0x2a')](function(_0x4aa6b8){_0x362b96[_0x5497('0x52')]=_0x4aa6b8;return _0x362b96;})[_0x5497('0x2a')](respondWithFilteredResult(_0x3395f6,_0x2fe1f2))[_0x5497('0x53')](handleError(_0x3395f6,null));};exports[_0x5497('0x54')]=function(_0xbf2f0,_0x5bf06d){var _0x495068={'raw':![],'where':{'id':_0xbf2f0['params']['id']}},_0x498de5={};_0x498de5[_0x5497('0x3e')]=_[_0x5497('0x40')](db[_0x5497('0x3a')][_0x5497('0x3b')]);_0x498de5[_0x5497('0x44')]=_[_0x5497('0x40')](_0xbf2f0[_0x5497('0x44')]);_0x498de5[_0x5497('0x41')]=_[_0x5497('0x42')](_0x498de5['model'],_0x498de5[_0x5497('0x44')]);_0x495068[_0x5497('0x45')]=_[_0x5497('0x42')](_0x498de5['model'],qs[_0x5497('0x43')](_0xbf2f0['query'][_0x5497('0x43')]));_0x495068[_0x5497('0x45')]=_0x495068[_0x5497('0x45')]['length']?_0x495068[_0x5497('0x45')]:_0x498de5[_0x5497('0x3e')];if(_0xbf2f0['query'][_0x5497('0x51')]){_0x495068['include']=[{'all':!![]}];}_0x495068=_[_0x5497('0x4e')]({},_0x495068,_0xbf2f0['options']);return db[_0x5497('0x3a')][_0x5497('0x33')](_0x495068)[_0x5497('0x2a')](handleEntityNotFound(_0x5bf06d,null))[_0x5497('0x2a')](respondWithResult(_0x5bf06d,null))[_0x5497('0x53')](handleError(_0x5bf06d,null));};exports[_0x5497('0x2b')]=function(_0x6583f1,_0x2a6e4d){return db['VoiceExtension'][_0x5497('0x33')]({'where':{'id':_0x6583f1['params']['id']}})['then'](handleEntityNotFound(_0x2a6e4d,null))[_0x5497('0x2a')](removeEntity(_0x2a6e4d,null))[_0x5497('0x53')](handleError(_0x2a6e4d,null));};exports['create']=function(_0x2ddccd,_0x3df816){if(_0x2ddccd[_0x5497('0x55')][_0x5497('0x35')]==='outbound'&&!_[_0x5497('0x56')](_0x2ddccd['body']['exten'],'_')){_0x2ddccd[_0x5497('0x55')][_0x5497('0x57')]='_'[_0x5497('0x58')](_0x2ddccd['body']['exten']);}return db[_0x5497('0x3a')]['create'](_0x2ddccd[_0x5497('0x55')],{'raw':![]})['then'](function(_0x3f50ae){var _0x5b9e57=_0x2ddccd[_0x5497('0x59')][_0x5497('0x5a')]({'plain':!![]});if(!_0x5b9e57)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b9e57[_0x5497('0x5b')]==='user'){var _0x506d69=_0x3f50ae[_0x5497('0x5a')]({'plain':!![]});var _0x5541b4=[{'name':'InboundRoutes','value':_0x5497('0x2c')},{'name':_0x5497('0x2d'),'value':_0x5497('0x2e')},{'name':_0x5497('0x2f'),'value':_0x5497('0x30')}];var _0x25c75e=_['find'](_0x5541b4,[_0x5497('0x34'),_0x506d69['type']])['name'];return db['UserProfileSection'][_0x5497('0x33')]({'where':{'name':_0x25c75e,'userProfileId':_0x5b9e57[_0x5497('0x5c')]},'raw':!![]})[_0x5497('0x2a')](function(_0x544085){if(_0x544085&&_0x544085[_0x5497('0x5d')]===0x0){return db['UserProfileResource']['create']({'name':_0x506d69[_0x5497('0x37')],'resourceId':_0x506d69['id'],'type':_0x544085[_0x5497('0x37')],'sectionId':_0x544085['id']},{})[_0x5497('0x2a')](function(){return _0x3f50ae;});}else{return _0x3f50ae;}})[_0x5497('0x53')](function(_0x3afcf8){logger[_0x5497('0x5e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3afcf8);throw _0x3afcf8;});}return _0x3f50ae;})[_0x5497('0x2a')](respondWithResult(_0x3df816,0xc9))[_0x5497('0x53')](handleError(_0x3df816,null));};exports[_0x5497('0x29')]=function(_0xc783ce,_0x4b86a8){if(_0xc783ce[_0x5497('0x55')]['id']){delete _0xc783ce[_0x5497('0x55')]['id'];}return db[_0x5497('0x3a')][_0x5497('0x33')]({'where':{'id':_0xc783ce['params']['id']}})[_0x5497('0x2a')](handleEntityNotFound(_0x4b86a8,null))[_0x5497('0x2a')](function(_0x1516c8){if(_0x1516c8){return db['VoiceExtension'][_0x5497('0x29')](_['pick'](_0xc783ce['body'],['exten',_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61'),'cutdigits',_0x5497('0x62')]),{'where':{'context':_0x1516c8[_0x5497('0x5f')],'exten':_0x1516c8[_0x5497('0x57')]},'individualHooks':!![]})[_0x5497('0x2a')](function(_0x4fec68){return _0x4fec68;});}return null;})[_0x5497('0x2a')](respondWithStatusCode(_0x4b86a8,null))[_0x5497('0x53')](handleError(_0x4b86a8,null));};exports[_0x5497('0x63')]=function(_0x49617c,_0x164de1,_0x465bed){return db[_0x5497('0x3a')][_0x5497('0x64')]({'where':{'id':_0x49617c[_0x5497('0x65')]['id']}})[_0x5497('0x2a')](handleEntityNotFound(_0x164de1,null))[_0x5497('0x2a')](function(_0x4b4cfe){if(_0x4b4cfe){return db[_0x5497('0x66')][_0x5497('0x67')](function(_0x32a5bf){return db[_0x5497('0x3a')]['destroy']({'where':{'VoiceExtensionId':_0x49617c['params']['id']},'transaction':_0x32a5bf})['then'](function(_0x305d5b){var _0x1d1405=_[_0x5497('0x3f')](_0x49617c['body'],function(_0xc7fa29){_0xc7fa29[_0x5497('0x68')]=_0x49617c[_0x5497('0x65')]['id'];return _0xc7fa29;});return db[_0x5497('0x3a')][_0x5497('0x69')](_0x1d1405,{'transaction':_0x32a5bf});});})[_0x5497('0x2a')](function(){return db[_0x5497('0x3a')][_0x5497('0x6a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x49617c[_0x5497('0x65')]['id']},'order':_0x5497('0x6b')});});}})[_0x5497('0x2a')](respondWithResult(_0x164de1,null))['catch'](handleError(_0x164de1,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 935c660..b326630 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 _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 +var _0x396a=['events','VoiceExtension','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x3ac721,_0x10551c){var _0x3027b4=function(_0x4dd9c2){while(--_0x4dd9c2){_0x3ac721['push'](_0x3ac721['shift']());}};_0x3027b4(++_0x10551c);}(_0x396a,0x129));var _0xa396=function(_0x4a9bdd,_0x5098f5){_0x4a9bdd=_0x4a9bdd-0x0;var _0x1ba3a4=_0x396a[_0x4a9bdd];return _0x1ba3a4;};'use strict';var EventEmitter=require(_0xa396('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0xa396('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xa396('0x2')](0x0);var events={'afterCreate':_0xa396('0x3'),'afterUpdate':_0xa396('0x4'),'afterDestroy':_0xa396('0x5')};function emitEvent(_0x2245cb){return function(_0x11001f,_0x204e24,_0x2becb2){VoiceExtensionEvents['emit'](_0x2245cb+':'+_0x11001f['id'],_0x11001f);VoiceExtensionEvents[_0xa396('0x6')](_0x2245cb,_0x11001f);_0x2becb2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xa396('0x7')](e,emitEvent(event));}}module[_0xa396('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 228b775..01449e6 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 _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 +var _0x1203=['moment','bluebird','request-promise','path','../../config/environment','./voiceExtension.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0x1b9cd5,_0x103dc4){var _0x4c74ca=function(_0x460b5e){while(--_0x460b5e){_0x1b9cd5['push'](_0x1b9cd5['shift']());}};_0x4c74ca(++_0x103dc4);}(_0x1203,0x11c));var _0x3120=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1203[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3120('0x0'));var util=require(_0x3120('0x1'));var logger=require(_0x3120('0x2'))(_0x3120('0x3'));var moment=require(_0x3120('0x4'));var BPromise=require(_0x3120('0x5'));var rp=require(_0x3120('0x6'));var fs=require('fs');var path=require(_0x3120('0x7'));var rimraf=require('rimraf');var config=require(_0x3120('0x8'));var attributes=require(_0x3120('0x9'));module[_0x3120('0xa')]=function(_0x5583a8,_0x3e7ee8){return _0x5583a8[_0x3120('0xb')]('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 9a920b8..351dad8 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 _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 +var _0x5003=['info','result','catch','GetVoiceExtension','findAll','options','attributes','map','include','model','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x2dd74c,_0x4a1cd0){var _0x455608=function(_0x3b1877){while(--_0x3b1877){_0x2dd74c['push'](_0x2dd74c['shift']());}};_0x455608(++_0x4a1cd0);}(_0x5003,0x8e));var _0x3500=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5003[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3500('0x0'));var BPromise=require(_0x3500('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3500('0x2'));var db=require(_0x3500('0x3'))['db'];var utils=require(_0x3500('0x4'));var logger=require(_0x3500('0x5'))(_0x3500('0x6'));var config=require(_0x3500('0x7'));var jayson=require(_0x3500('0x8'));var client=jayson[_0x3500('0x9')][_0x3500('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3500('0xb')],{'host':_0x3500('0xc'),'port':0x18eb});var socket=require(_0x3500('0xd'))(new Redis(config[_0x3500('0xb')]));require(_0x3500('0xe'))['register'](socket);function respondWithRpcPromise(_0x134387,_0x18d1bb,_0x4c9c9a){return new BPromise(function(_0x3fb716,_0x4bfbf4){return client[_0x3500('0xf')](_0x134387,_0x4c9c9a)[_0x3500('0x10')](function(_0x32450d){logger['info'](_0x3500('0x11'),_0x18d1bb,'request\x20sent');logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x18d1bb,_0x3500('0x12'),JSON[_0x3500('0x13')](_0x32450d));if(_0x32450d[_0x3500('0x14')]){if(_0x32450d['error'][_0x3500('0x15')]===0x1f4){logger[_0x3500('0x14')](_0x3500('0x11'),_0x18d1bb,_0x32450d[_0x3500('0x14')][_0x3500('0x16')]);return _0x4bfbf4(_0x32450d[_0x3500('0x14')]['message']);}logger['error'](_0x3500('0x11'),_0x18d1bb,_0x32450d['error'][_0x3500('0x16')]);return _0x3fb716(_0x32450d[_0x3500('0x14')][_0x3500('0x16')]);}else{logger[_0x3500('0x17')](_0x3500('0x11'),_0x18d1bb,_0x3500('0x12'));_0x3fb716(_0x32450d[_0x3500('0x18')][_0x3500('0x16')]);}})[_0x3500('0x19')](function(_0x104e20){logger[_0x3500('0x14')](_0x3500('0x11'),_0x18d1bb,_0x104e20);_0x4bfbf4(_0x104e20);});});}exports[_0x3500('0x1a')]=function(_0x3b7988){var _0x16b145=this;return new Promise(function(_0x54a217,_0x5e4d54){return db['VoiceExtension'][_0x3500('0x1b')]({'raw':_0x3b7988[_0x3500('0x1c')]?_0x3b7988[_0x3500('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3b7988[_0x3500('0x1c')]?_0x3b7988[_0x3500('0x1c')]['where']||null:null,'attributes':_0x3b7988[_0x3500('0x1c')]?_0x3b7988[_0x3500('0x1c')][_0x3500('0x1d')]||null:null,'limit':_0x3b7988['options']?_0x3b7988['options']['limit']||null:null,'include':_0x3b7988[_0x3500('0x1c')]?_0x3b7988[_0x3500('0x1c')]['include']?_[_0x3500('0x1e')](_0x3b7988['options'][_0x3500('0x1f')],function(_0x1c15a8){return{'model':db[_0x1c15a8[_0x3500('0x20')]],'as':_0x1c15a8['as'],'attributes':_0x1c15a8['attributes'],'include':_0x1c15a8[_0x3500('0x1f')]?_[_0x3500('0x1e')](_0x1c15a8[_0x3500('0x1f')],function(_0x353763){return{'model':db[_0x353763[_0x3500('0x20')]],'as':_0x353763['as'],'attributes':_0x353763[_0x3500('0x1d')],'include':_0x353763['include']?_[_0x3500('0x1e')](_0x353763[_0x3500('0x1f')],function(_0x2cd721){return{'model':db[_0x2cd721[_0x3500('0x20')]],'as':_0x2cd721['as'],'attributes':_0x2cd721[_0x3500('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3500('0x10')](function(_0x1c7fb5){logger[_0x3500('0x17')](_0x3500('0x1a'),_0x3b7988);logger['debug'](_0x3500('0x1a'),_0x3b7988,JSON['stringify'](_0x1c7fb5));_0x54a217(_0x1c7fb5);})['catch'](function(_0x5c4a05){logger[_0x3500('0x14')]('GetVoiceExtension',_0x5c4a05['message'],_0x3b7988);_0x5e4d54(_0x16b145['error'](0x1f4,_0x5c4a05[_0x3500('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 6cd7957..e7f19b8 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 _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 +var _0x6863=['voiceExtension:','./voiceExtension.events','save','update','emit','register','length'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6863,0x190));var _0x3686=function(_0x48a73e,_0x39f1ac){_0x48a73e=_0x48a73e-0x0;var _0x390c0b=_0x6863[_0x48a73e];return _0x390c0b;};'use strict';var VoiceExtensionEvents=require(_0x3686('0x0'));var events=[_0x3686('0x1'),'remove',_0x3686('0x2')];function createListener(_0x3e6a37,_0x56c519){return function(_0x2a0ba7){_0x56c519[_0x3686('0x3')](_0x3e6a37,_0x2a0ba7);};}function removeListener(_0x3ea7fa,_0x361904){return function(){VoiceExtensionEvents['removeListener'](_0x3ea7fa,_0x361904);};}exports[_0x3686('0x4')]=function(_0x306f7a){for(var _0x18b21c=0x0,_0x37fabe=events[_0x3686('0x5')];_0x18b21c<_0x37fabe;_0x18b21c++){var _0x665951=events[_0x18b21c];var _0x27d9e4=createListener(_0x3686('0x6')+_0x665951,_0x306f7a);VoiceExtensionEvents['on'](_0x665951,_0x27d9e4);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index cb53aed..52e60af 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 _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 +var _0x4554=['get','isAuthenticated','index','/:id','/:id/messages','getMessages','post','create','put','update','delete','destroy','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./voiceMail.controller'];(function(_0x166ce3,_0x1b334e){var _0x5dd2ad=function(_0x340ce8){while(--_0x340ce8){_0x166ce3['push'](_0x166ce3['shift']());}};_0x5dd2ad(++_0x1b334e);}(_0x4554,0x160));var _0x4455=function(_0x30d3d5,_0x33c0be){_0x30d3d5=_0x30d3d5-0x0;var _0x277fb6=_0x4554[_0x30d3d5];return _0x277fb6;};'use strict';var multer=require(_0x4455('0x0'));var util=require(_0x4455('0x1'));var path=require(_0x4455('0x2'));var timeout=require('connect-timeout');var express=require(_0x4455('0x3'));var router=express[_0x4455('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4455('0x5'));var config=require(_0x4455('0x6'));var controller=require(_0x4455('0x7'));router[_0x4455('0x8')]('/',auth[_0x4455('0x9')](),controller[_0x4455('0xa')]);router['get'](_0x4455('0xb'),auth[_0x4455('0x9')](),controller['show']);router[_0x4455('0x8')](_0x4455('0xc'),auth['isAuthenticated'](),controller[_0x4455('0xd')]);router[_0x4455('0xe')]('/',auth[_0x4455('0x9')](),controller[_0x4455('0xf')]);router[_0x4455('0x10')](_0x4455('0xb'),auth['isAuthenticated'](),controller[_0x4455('0x11')]);router[_0x4455('0x12')]('/:id',auth[_0x4455('0x9')](),controller[_0x4455('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 099f075..a12dc4d 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 _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 +var _0xf4f4=['string','trim','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email'];(function(_0x1758e7,_0x514db1){var _0x5f46c0=function(_0x4b15a7){while(--_0x4b15a7){_0x1758e7['push'](_0x1758e7['shift']());}};_0x5f46c0(++_0x514db1);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x55189a,_0x35d0d0){_0x55189a=_0x55189a-0x0;var _0x3731f6=_0xf4f4[_0x55189a];return _0x3731f6;};'use strict';var Sequelize=require(_0x4f4f('0x0'));module[_0x4f4f('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4f4f('0x2')],'defaultValue':_0x4f4f('0x3'),'unique':_0x4f4f('0x4')},'mailbox':{'type':Sequelize[_0x4f4f('0x2')],'defaultValue':'','allowNull':![],'unique':_0x4f4f('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x4f4f('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x3f274d){this[_0x4f4f('0x5')](_0x4f4f('0x6'),typeof _0x3f274d===_0x4f4f('0x7')&&_0x3f274d[_0x4f4f('0x8')]()?_0x3f274d[_0x4f4f('0x8')]():null);}},'pager':{'type':Sequelize[_0x4f4f('0x2')]},'tz':{'type':Sequelize[_0x4f4f('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x4f4f('0x9')](_0x4f4f('0xa'),'no'),'defaultValue':_0x4f4f('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x4f4f('0x9')](_0x4f4f('0xa'),'no'),'defaultValue':_0x4f4f('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x4f4f('0x2')]},'callback':{'type':Sequelize[_0x4f4f('0x2')]},'review':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x4f4f('0x9')](_0x4f4f('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x4f4f('0x9')](_0x4f4f('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x4f4f('0x9')](_0x4f4f('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x4f4f('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x4f4f('0x9')](_0x4f4f('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x4f4f('0x9')](_0x4f4f('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x4f4f('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x4f4f('0x9')](_0x4f4f('0xa'),'no'),'defaultValue':_0x4f4f('0xa'),'allowNull':![]},'stamp':{'type':_0x4f4f('0xb')},'emailsubject':{'type':Sequelize[_0x4f4f('0x2')]},'emailbody':{'type':Sequelize[_0x4f4f('0x2')]},'maxsecs':{'type':Sequelize[_0x4f4f('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x4f4f('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x4f4f('0xd')],'get':function(){return this[_0x4f4f('0xe')](_0x4f4f('0xf'))+_0x4f4f('0x10')+this['getDataValue'](_0x4f4f('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 3d434ed..13d15bc 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 _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 +var _0xcbde=['VoiceMailMessage','rimraf','zip-dir','request-promise','moment','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','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','index','map','VoiceMail','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','find','create','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','mailbox'];(function(_0x136ff2,_0x4d1028){var _0x576e2d=function(_0x3e9787){while(--_0x3e9787){_0x136ff2['push'](_0x136ff2['shift']());}};_0x576e2d(++_0x4d1028);}(_0xcbde,0x19b));var _0xecbd=function(_0xb257b2,_0x48f11e){_0xb257b2=_0xb257b2-0x0;var _0xc4010b=_0xcbde[_0xb257b2];return _0xc4010b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xecbd('0x0'));var zipdir=require(_0xecbd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xecbd('0x2'));var moment=require(_0xecbd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xecbd('0x4'));var util=require(_0xecbd('0x5'));var path=require(_0xecbd('0x6'));var sox=require(_0xecbd('0x7'));var csv=require('to-csv');var ejs=require(_0xecbd('0x8'));var fs=require('fs');var _=require(_0xecbd('0x9'));var squel=require(_0xecbd('0xa'));var crypto=require(_0xecbd('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xecbd('0xc'));var toCsv=require(_0xecbd('0xd'));var querystring=require(_0xecbd('0xe'));var Papa=require(_0xecbd('0xf'));var Redis=require(_0xecbd('0x10'));var authService=require(_0xecbd('0x11'));var qs=require(_0xecbd('0x12'));var as=require(_0xecbd('0x13'));var hardwareService=require(_0xecbd('0x14'));var logger=require(_0xecbd('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xecbd('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12719f,_0x25f684){_0x25f684=_0x25f684||0xcc;return function(_0x4a9c6f){if(_0x4a9c6f){return _0x12719f[_0xecbd('0x17')](_0x25f684);}return _0x12719f[_0xecbd('0x18')](_0x25f684)[_0xecbd('0x19')]();};}function respondWithResult(_0x313090,_0x591164){_0x591164=_0x591164||0xc8;return function(_0x394687){if(_0x394687){return _0x313090[_0xecbd('0x18')](_0x591164)[_0xecbd('0x1a')](_0x394687);}};}function respondWithFilteredResult(_0x508ae3,_0x72e315){return function(_0x568f07){if(_0x568f07){var _0x35f32f=_0x568f07[_0xecbd('0x1b')],_0x5cde5a=_0x72e315['offset'],_0x23f79c=_0x72e315[_0xecbd('0x1c')]+_0x72e315[_0xecbd('0x1d')],_0x184e64;if(_0x23f79c>=_0x35f32f){_0x23f79c=_0x35f32f;_0x184e64=0xc8;}else{_0x184e64=0xce;}_0x508ae3[_0xecbd('0x18')](_0x184e64);return _0x508ae3[_0xecbd('0x1e')](_0xecbd('0x1f'),_0x5cde5a+'-'+_0x23f79c+'/'+_0x35f32f)['json'](_0x568f07);}return null;};}function patchUpdates(_0x569a0b){return function(_0x489b8a){try{jsonpatch[_0xecbd('0x20')](_0x489b8a,_0x569a0b,!![]);}catch(_0x24d601){return BPromise[_0xecbd('0x21')](_0x24d601);}return _0x489b8a[_0xecbd('0x22')]();};}function saveUpdates(_0x16e3c3,_0xb915bc){return function(_0x453c38){if(_0x453c38){return _0x453c38[_0xecbd('0x23')](_0x16e3c3)[_0xecbd('0x24')](function(_0x1ad028){return _0x1ad028;});}return null;};}function removeEntity(_0x2b78df,_0x39bee9){return function(_0x59b7b5){if(_0x59b7b5){return _0x59b7b5[_0xecbd('0x25')]()[_0xecbd('0x24')](function(){var _0x482c75=_0x59b7b5[_0xecbd('0x26')]({'plain':!![]});var _0x28c253=_0xecbd('0x27');return db[_0xecbd('0x28')][_0xecbd('0x25')]({'where':{'type':_0x28c253,'resourceId':_0x482c75['id']}})[_0xecbd('0x24')](function(){return _0x59b7b5;});})['then'](function(){_0x2b78df['status'](0xcc)[_0xecbd('0x19')]();});}};}function handleEntityNotFound(_0x5ed70e,_0x243f17){return function(_0x5b37d2){if(!_0x5b37d2){_0x5ed70e[_0xecbd('0x17')](0x194);}return _0x5b37d2;};}function handleError(_0x1fa81b,_0x238c5f){_0x238c5f=_0x238c5f||0x1f4;return function(_0x3abaee){logger[_0xecbd('0x29')](_0x3abaee[_0xecbd('0x2a')]);if(_0x3abaee[_0xecbd('0x2b')]){delete _0x3abaee[_0xecbd('0x2b')];}_0x1fa81b[_0xecbd('0x18')](_0x238c5f)['send'](_0x3abaee);};}exports[_0xecbd('0x2c')]=function(_0x5bc752,_0x50e850){var _0x7c0e8e={},_0x2d31fe={},_0x5534e7={'count':0x0,'rows':[]};var _0x3ace8e=_[_0xecbd('0x2d')](db[_0xecbd('0x2e')][_0xecbd('0x2f')],function(_0x3a4e97){return{'name':_0x3a4e97['fieldName'],'type':_0x3a4e97[_0xecbd('0x30')]['key']};});_0x2d31fe[_0xecbd('0x31')]=_['map'](_0x3ace8e,_0xecbd('0x2b'));_0x2d31fe['query']=_[_0xecbd('0x32')](_0x5bc752[_0xecbd('0x33')]);_0x2d31fe[_0xecbd('0x34')]=_[_0xecbd('0x35')](_0x2d31fe[_0xecbd('0x31')],_0x2d31fe[_0xecbd('0x33')]);_0x7c0e8e[_0xecbd('0x36')]=_[_0xecbd('0x35')](_0x2d31fe[_0xecbd('0x31')],qs[_0xecbd('0x37')](_0x5bc752[_0xecbd('0x33')][_0xecbd('0x37')]));_0x7c0e8e[_0xecbd('0x36')]=_0x7c0e8e['attributes'][_0xecbd('0x38')]?_0x7c0e8e['attributes']:_0x2d31fe['model'];if(!_0x5bc752[_0xecbd('0x33')][_0xecbd('0x39')](_0xecbd('0x3a'))){_0x7c0e8e[_0xecbd('0x1d')]=qs[_0xecbd('0x1d')](_0x5bc752[_0xecbd('0x33')][_0xecbd('0x1d')]);_0x7c0e8e[_0xecbd('0x1c')]=qs[_0xecbd('0x1c')](_0x5bc752[_0xecbd('0x33')][_0xecbd('0x1c')]);}_0x7c0e8e[_0xecbd('0x3b')]=qs['sort'](_0x5bc752['query'][_0xecbd('0x3c')]);_0x7c0e8e[_0xecbd('0x3d')]=qs[_0xecbd('0x34')](_[_0xecbd('0x3e')](_0x5bc752[_0xecbd('0x33')],_0x2d31fe[_0xecbd('0x34')]),_0x3ace8e);if(_0x5bc752[_0xecbd('0x33')][_0xecbd('0x3f')]){_0x7c0e8e['where']=_[_0xecbd('0x40')](_0x7c0e8e[_0xecbd('0x3d')],{'$or':_[_0xecbd('0x2d')](_0x3ace8e,function(_0xc40755){if(_0xc40755['type']!==_0xecbd('0x41')){var _0x3914d9={};_0x3914d9[_0xc40755[_0xecbd('0x2b')]]={'$like':'%'+_0x5bc752[_0xecbd('0x33')]['filter']+'%'};return _0x3914d9;}})});}_0x7c0e8e=_['merge']({},_0x7c0e8e,_0x5bc752[_0xecbd('0x42')]);var _0x3d7290={'where':_0x7c0e8e['where']};return db[_0xecbd('0x2e')][_0xecbd('0x1b')](_0x3d7290)[_0xecbd('0x24')](function(_0x1b3d69){_0x5534e7['count']=_0x1b3d69;if(_0x5bc752[_0xecbd('0x33')][_0xecbd('0x43')]){_0x7c0e8e[_0xecbd('0x44')]=[{'all':!![]}];}return db['VoiceMail'][_0xecbd('0x45')](_0x7c0e8e);})['then'](function(_0x10f2bd){_0x5534e7['rows']=_0x10f2bd;return _0x5534e7;})[_0xecbd('0x24')](respondWithFilteredResult(_0x50e850,_0x7c0e8e))[_0xecbd('0x46')](handleError(_0x50e850,null));};exports['show']=function(_0x41ee26,_0x3970df){var _0xbe656c={'raw':!![],'where':{'id':_0x41ee26['params']['id']}},_0x41b1fc={};_0x41b1fc[_0xecbd('0x31')]=_[_0xecbd('0x32')](db[_0xecbd('0x2e')]['rawAttributes']);_0x41b1fc[_0xecbd('0x33')]=_[_0xecbd('0x32')](_0x41ee26[_0xecbd('0x33')]);_0x41b1fc['filters']=_['intersection'](_0x41b1fc[_0xecbd('0x31')],_0x41b1fc[_0xecbd('0x33')]);_0xbe656c[_0xecbd('0x36')]=_[_0xecbd('0x35')](_0x41b1fc[_0xecbd('0x31')],qs[_0xecbd('0x37')](_0x41ee26['query'][_0xecbd('0x37')]));_0xbe656c['attributes']=_0xbe656c[_0xecbd('0x36')][_0xecbd('0x38')]?_0xbe656c['attributes']:_0x41b1fc[_0xecbd('0x31')];if(_0x41ee26[_0xecbd('0x33')]['includeAll']){_0xbe656c[_0xecbd('0x44')]=[{'all':!![]}];}_0xbe656c=_[_0xecbd('0x40')]({},_0xbe656c,_0x41ee26[_0xecbd('0x42')]);return db['VoiceMail'][_0xecbd('0x47')](_0xbe656c)[_0xecbd('0x24')](handleEntityNotFound(_0x3970df,null))['then'](respondWithResult(_0x3970df,null))[_0xecbd('0x46')](handleError(_0x3970df,null));};exports[_0xecbd('0x48')]=function(_0x5256cc,_0x415867){return db[_0xecbd('0x2e')]['create'](_0x5256cc['body'],{})[_0xecbd('0x24')](function(_0x411574){var _0x2f801c=_0x5256cc[_0xecbd('0x49')][_0xecbd('0x26')]({'plain':!![]});if(!_0x2f801c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f801c[_0xecbd('0x4a')]===_0xecbd('0x49')){var _0xf75049=_0x411574[_0xecbd('0x26')]({'plain':!![]});var _0x3d2e9e=_0xecbd('0x27');return db['UserProfileSection'][_0xecbd('0x47')]({'where':{'name':_0x3d2e9e,'userProfileId':_0x2f801c[_0xecbd('0x4b')]},'raw':!![]})['then'](function(_0x10102e){if(_0x10102e&&_0x10102e[_0xecbd('0x4c')]===0x0){return db[_0xecbd('0x28')][_0xecbd('0x48')]({'name':_0xf75049[_0xecbd('0x2b')],'resourceId':_0xf75049['id'],'type':_0x10102e['name'],'sectionId':_0x10102e['id']},{})[_0xecbd('0x24')](function(){return _0x411574;});}else{return _0x411574;}})[_0xecbd('0x46')](function(_0x1ca8cc){logger[_0xecbd('0x29')](_0xecbd('0x4d'),_0x1ca8cc);throw _0x1ca8cc;});}return _0x411574;})['then'](respondWithResult(_0x415867,0xc9))['catch'](handleError(_0x415867,null));};exports['update']=function(_0x4ca47f,_0x3e3802){if(_0x4ca47f[_0xecbd('0x4e')]['id']){delete _0x4ca47f['body']['id'];}return db[_0xecbd('0x2e')]['find']({'where':{'id':_0x4ca47f[_0xecbd('0x4f')]['id']}})[_0xecbd('0x24')](handleEntityNotFound(_0x3e3802,null))[_0xecbd('0x24')](saveUpdates(_0x4ca47f[_0xecbd('0x4e')],null))[_0xecbd('0x24')](respondWithResult(_0x3e3802,null))['catch'](handleError(_0x3e3802,null));};exports[_0xecbd('0x25')]=function(_0x6e87c3,_0x553c1c){return db['VoiceMail'][_0xecbd('0x47')]({'where':{'id':_0x6e87c3[_0xecbd('0x4f')]['id']}})[_0xecbd('0x24')](handleEntityNotFound(_0x553c1c,null))[_0xecbd('0x24')](removeEntity(_0x553c1c,null))[_0xecbd('0x46')](handleError(_0x553c1c,null));};exports['getMessages']=function(_0xa65d6,_0x1a3c11,_0x41291b){return db[_0xecbd('0x2e')]['findOne']({'where':{'id':_0xa65d6[_0xecbd('0x4f')]['id']}})[_0xecbd('0x24')](handleEntityNotFound(_0x1a3c11,null))[_0xecbd('0x24')](function(_0x821494){var _0x467519;var _0x393d12={},_0x21405e={};_0x21405e[_0xecbd('0x31')]=_[_0xecbd('0x32')](db['VoiceMailMessage'][_0xecbd('0x2f')]);_0x21405e[_0xecbd('0x33')]=_[_0xecbd('0x32')](_0xa65d6['query']);_0x21405e[_0xecbd('0x34')]=_[_0xecbd('0x35')](_0x21405e[_0xecbd('0x31')],_0x21405e[_0xecbd('0x33')]);_0x393d12[_0xecbd('0x36')]=_[_0xecbd('0x35')](_0x21405e[_0xecbd('0x31')],qs[_0xecbd('0x37')](_0xa65d6[_0xecbd('0x33')][_0xecbd('0x37')]));_0x393d12[_0xecbd('0x36')]=_0x393d12['attributes'][_0xecbd('0x38')]?_0x393d12['attributes']:_0x21405e[_0xecbd('0x31')];if(!_0xa65d6['query'][_0xecbd('0x39')](_0xecbd('0x3a'))){_0x393d12['limit']=qs[_0xecbd('0x1d')](_0xa65d6[_0xecbd('0x33')][_0xecbd('0x1d')]);_0x393d12[_0xecbd('0x1c')]=qs[_0xecbd('0x1c')](_0xa65d6[_0xecbd('0x33')][_0xecbd('0x1c')]);}_0x393d12['order']=qs[_0xecbd('0x3c')](_0xa65d6['query'][_0xecbd('0x3c')]);_0x393d12[_0xecbd('0x3d')]=qs[_0xecbd('0x34')](_[_0xecbd('0x3e')](_0xa65d6[_0xecbd('0x33')],_0x21405e['filters']));if(_0xa65d6[_0xecbd('0x33')]['filter']){_0x393d12[_0xecbd('0x3d')]=_[_0xecbd('0x40')](_0x393d12[_0xecbd('0x3d')],{'$or':_['map'](_0x393d12[_0xecbd('0x36')],function(_0x177bf4){var _0x5c3c8b={};_0x5c3c8b[_0x177bf4]={'$like':'%'+_0xa65d6[_0xecbd('0x33')]['filter']+'%'};return _0x5c3c8b;})});}_0x393d12[_0xecbd('0x3d')]=_[_0xecbd('0x40')](_0x393d12[_0xecbd('0x3d')],{'mailboxuser':_0x821494[_0xecbd('0x50')]});_0x393d12=_['merge']({},_0x393d12,_0xa65d6[_0xecbd('0x42')]);return db[_0xecbd('0x51')]['findAndCountAll'](_0x393d12)[_0xecbd('0x24')](respondWithFilteredResult(_0x1a3c11,_0x393d12));})['catch'](handleError(_0x1a3c11,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index c7ebe6a..3a77fea 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 _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 +var _0x68a9=['../../config/logger','api','../../config/environment','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox_context','context','lodash','util'];(function(_0x1910da,_0x23ee1d){var _0x276f1b=function(_0x344858){while(--_0x344858){_0x1910da['push'](_0x1910da['shift']());}};_0x276f1b(++_0x23ee1d);}(_0x68a9,0x106));var _0x968a=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x68a9[_0x43d11d];return _0x38cd08;};'use strict';var _=require(_0x968a('0x0'));var util=require(_0x968a('0x1'));var logger=require(_0x968a('0x2'))(_0x968a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x968a('0x4'));var attributes=require(_0x968a('0x5'));module[_0x968a('0x6')]=function(_0x1d2b24,_0x4e7307){return _0x1d2b24['define'](_0x968a('0x7'),attributes,{'tableName':_0x968a('0x8'),'paranoid':![],'indexes':[{'name':_0x968a('0x9'),'fields':['mailbox',_0x968a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index c139cef..53517dd 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 _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 +var _0xa56e=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xa56e,0xc7));var _0xea56=function(_0x29d4ac,_0x5c4e0f){_0x29d4ac=_0x29d4ac-0x0;var _0x2a99b0=_0xa56e[_0x29d4ac];return _0x2a99b0;};'use strict';var _=require(_0xea56('0x0'));var util=require(_0xea56('0x1'));var moment=require('moment');var BPromise=require(_0xea56('0x2'));var rs=require(_0xea56('0x3'));var fs=require('fs');var Redis=require(_0xea56('0x4'));var db=require(_0xea56('0x5'))['db'];var utils=require(_0xea56('0x6'));var logger=require(_0xea56('0x7'))(_0xea56('0x8'));var config=require(_0xea56('0x9'));var jayson=require(_0xea56('0xa'));var client=jayson[_0xea56('0xb')][_0xea56('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x33c351,_0x59b6dd,_0x4adbe5){return new BPromise(function(_0x4587fd,_0x506409){return client[_0xea56('0xd')](_0x33c351,_0x4adbe5)[_0xea56('0xe')](function(_0x230b8d){logger[_0xea56('0xf')](_0xea56('0x10'),_0x59b6dd,_0xea56('0x11'));logger[_0xea56('0x12')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x59b6dd,'request\x20sent',JSON[_0xea56('0x13')](_0x230b8d));if(_0x230b8d[_0xea56('0x14')]){if(_0x230b8d[_0xea56('0x14')][_0xea56('0x15')]===0x1f4){logger[_0xea56('0x14')](_0xea56('0x10'),_0x59b6dd,_0x230b8d[_0xea56('0x14')][_0xea56('0x16')]);return _0x506409(_0x230b8d[_0xea56('0x14')][_0xea56('0x16')]);}logger[_0xea56('0x14')](_0xea56('0x10'),_0x59b6dd,_0x230b8d[_0xea56('0x14')][_0xea56('0x16')]);return _0x4587fd(_0x230b8d[_0xea56('0x14')][_0xea56('0x16')]);}else{logger['info'](_0xea56('0x10'),_0x59b6dd,_0xea56('0x11'));_0x4587fd(_0x230b8d[_0xea56('0x17')]['message']);}})[_0xea56('0x18')](function(_0x240e09){logger[_0xea56('0x14')](_0xea56('0x10'),_0x59b6dd,_0x240e09);_0x506409(_0x240e09);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 97b41a6..0f88ed8 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 _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 +var _0x1261=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','/:id','show','/:id/download','isAuthenticated','download','create','put','destroy'];(function(_0x87eee5,_0x581852){var _0x17e2dc=function(_0x1122d2){while(--_0x1122d2){_0x87eee5['push'](_0x87eee5['shift']());}};_0x17e2dc(++_0x581852);}(_0x1261,0x144));var _0x1126=function(_0x3d2580,_0x5bcf59){_0x3d2580=_0x3d2580-0x0;var _0x1bed34=_0x1261[_0x3d2580];return _0x1bed34;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var auth=require(_0x1126('0x5'));var interaction=require(_0x1126('0x6'));var config=require(_0x1126('0x7'));var controller=require(_0x1126('0x8'));router[_0x1126('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1126('0x9')](_0x1126('0xa'),auth['isAuthenticated'](),controller[_0x1126('0xb')]);router[_0x1126('0x9')](_0x1126('0xc'),auth[_0x1126('0xd')](),controller[_0x1126('0xe')]);router['post']('/',auth[_0x1126('0xd')](),controller[_0x1126('0xf')]);router[_0x1126('0x10')]('/:id',auth[_0x1126('0xd')](),controller['update']);router['delete'](_0x1126('0xa'),auth['isAuthenticated'](),controller[_0x1126('0x11')]);module[_0x1126('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index b494787..4194e05 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 _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 +var _0xfd3e=['BLOB','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING'];(function(_0x3d78d7,_0x44acea){var _0x4b6784=function(_0x284157){while(--_0x284157){_0x3d78d7['push'](_0x3d78d7['shift']());}};_0x4b6784(++_0x44acea);}(_0xfd3e,0x104));var _0xefd3=function(_0x1dc4d2,_0x25df78){_0x1dc4d2=_0x1dc4d2-0x0;var _0x46443f=_0xfd3e[_0x1dc4d2];return _0x46443f;};'use strict';var Sequelize=require(_0xefd3('0x0'));module[_0xefd3('0x1')]={'name':{'type':Sequelize[_0xefd3('0x2')],'get':function(_0x11352e){return this[_0xefd3('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xefd3('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xefd3('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xefd3('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xefd3('0x5')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xefd3('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xefd3('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xefd3('0x6')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xefd3('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 2246754..b7a4421 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 _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 +var _0x235a=['audio/wav','attachment','Content-Disposition','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','rawAttributes','differenceBy','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filters','filter','where','merge','type','VIRTUAL','options','VoiceMailMessage','includeAll','include','findAll','rows','catch','show','params','find','create','body','download','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x235a,0x1ef));var _0xa235=function(_0x50916b,_0x56fe5f){_0x50916b=_0x50916b-0x0;var _0x56a75e=_0x235a[_0x50916b];return _0x56a75e;};'use strict';var pdf=require(_0xa235('0x0'));var emlformat=require(_0xa235('0x1'));var rimraf=require(_0xa235('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa235('0x3'));var rp=require('request-promise');var moment=require(_0xa235('0x4'));var BPromise=require(_0xa235('0x5'));var Mustache=require(_0xa235('0x6'));var util=require(_0xa235('0x7'));var path=require(_0xa235('0x8'));var sox=require(_0xa235('0x9'));var csv=require(_0xa235('0xa'));var ejs=require(_0xa235('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa235('0xc'));var crypto=require(_0xa235('0xd'));var jsforce=require(_0xa235('0xe'));var deskjs=require(_0xa235('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa235('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa235('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa235('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa235('0x13'));var config=require(_0xa235('0x14'));var db=require(_0xa235('0x15'))['db'];function respondWithStatusCode(_0x1fe5cf,_0x5330db){_0x5330db=_0x5330db||0xcc;return function(_0x5510ff){if(_0x5510ff){return _0x1fe5cf['sendStatus'](_0x5330db);}return _0x1fe5cf[_0xa235('0x16')](_0x5330db)[_0xa235('0x17')]();};}function respondWithResult(_0xf1b244,_0x3bf6fc){_0x3bf6fc=_0x3bf6fc||0xc8;return function(_0x36b4b1){if(_0x36b4b1){return _0xf1b244[_0xa235('0x16')](_0x3bf6fc)[_0xa235('0x18')](_0x36b4b1);}};}function respondWithFilteredResult(_0x1e03a8,_0x1369de){return function(_0x4aceee){if(_0x4aceee){var _0x352463=_0x4aceee[_0xa235('0x19')],_0x20cd67=_0x1369de[_0xa235('0x1a')],_0x26fd63=_0x1369de['offset']+_0x1369de['limit'],_0x128244;if(_0x26fd63>=_0x352463){_0x26fd63=_0x352463;_0x128244=0xc8;}else{_0x128244=0xce;}_0x1e03a8[_0xa235('0x16')](_0x128244);return _0x1e03a8[_0xa235('0x1b')](_0xa235('0x1c'),_0x20cd67+'-'+_0x26fd63+'/'+_0x352463)['json'](_0x4aceee);}return null;};}function patchUpdates(_0x40b4a9){return function(_0x219e41){try{jsonpatch[_0xa235('0x1d')](_0x219e41,_0x40b4a9,!![]);}catch(_0x3b115){return BPromise[_0xa235('0x1e')](_0x3b115);}return _0x219e41[_0xa235('0x1f')]();};}function saveUpdates(_0x37faca,_0x483771){return function(_0x5a3bea){if(_0x5a3bea){return _0x5a3bea[_0xa235('0x20')](_0x37faca)[_0xa235('0x21')](function(_0x85a3d8){return _0x85a3d8;});}return null;};}function removeEntity(_0x26323c,_0x2e38e){return function(_0x3deeea){if(_0x3deeea){return _0x3deeea[_0xa235('0x22')]()[_0xa235('0x21')](function(){_0x26323c[_0xa235('0x16')](0xcc)[_0xa235('0x17')]();});}};}function handleEntityNotFound(_0x3219f1,_0x20292c){return function(_0xee45e1){if(!_0xee45e1){_0x3219f1[_0xa235('0x23')](0x194);}return _0xee45e1;};}function handleError(_0x3a0def,_0x3364ee){_0x3364ee=_0x3364ee||0x1f4;return function(_0x7a3b5d){logger[_0xa235('0x24')](_0x7a3b5d[_0xa235('0x25')]);if(_0x7a3b5d[_0xa235('0x26')]){delete _0x7a3b5d[_0xa235('0x26')];}_0x3a0def['status'](_0x3364ee)[_0xa235('0x27')](_0x7a3b5d);};}exports['index']=function(_0x19a673,_0x53ec70){var _0x442edf={},_0x3ab925={},_0x7a6f13={'count':0x0,'rows':[]};var _0x2b273a=_[_0xa235('0x28')](db['VoiceMailMessage'][_0xa235('0x29')],function(_0x612f2){return{'name':_0x612f2['fieldName'],'type':_0x612f2['type']['key']};});_0x3ab925['model']=_[_0xa235('0x2a')](_[_0xa235('0x28')](_0x2b273a,_0xa235('0x26')),[_0xa235('0x26')]);_0x3ab925[_0xa235('0x2b')]=_[_0xa235('0x2c')](_0x19a673[_0xa235('0x2b')]);_0x3ab925['filters']=_['intersection'](_0x3ab925[_0xa235('0x2d')],_0x3ab925[_0xa235('0x2b')]);_0x442edf['attributes']=_[_0xa235('0x2e')](_0x3ab925[_0xa235('0x2d')],qs[_0xa235('0x2f')](_0x19a673[_0xa235('0x2b')][_0xa235('0x2f')]));_0x442edf[_0xa235('0x30')]=_0x442edf[_0xa235('0x30')][_0xa235('0x31')]?_0x442edf['attributes']:_0x3ab925[_0xa235('0x2d')];if(!_0x19a673['query'][_0xa235('0x32')](_0xa235('0x33'))){_0x442edf[_0xa235('0x34')]=qs[_0xa235('0x34')](_0x19a673[_0xa235('0x2b')][_0xa235('0x34')]);_0x442edf[_0xa235('0x1a')]=qs[_0xa235('0x1a')](_0x19a673[_0xa235('0x2b')][_0xa235('0x1a')]);}_0x442edf[_0xa235('0x35')]=qs[_0xa235('0x36')](_0x19a673[_0xa235('0x2b')]['sort']);_0x442edf['where']=qs['filters'](_[_0xa235('0x37')](_0x19a673['query'],_0x3ab925[_0xa235('0x38')]),_0x2b273a);if(_0x19a673[_0xa235('0x2b')][_0xa235('0x39')]){_0x442edf[_0xa235('0x3a')]=_[_0xa235('0x3b')](_0x442edf[_0xa235('0x3a')],{'$or':_[_0xa235('0x28')](_0x2b273a,function(_0x5ba3cf){if(_0x5ba3cf[_0xa235('0x3c')]!==_0xa235('0x3d')){var _0x594511={};_0x594511[_0x5ba3cf[_0xa235('0x26')]]={'$like':'%'+_0x19a673[_0xa235('0x2b')][_0xa235('0x39')]+'%'};return _0x594511;}})});}_0x442edf=_[_0xa235('0x3b')]({},_0x442edf,_0x19a673[_0xa235('0x3e')]);var _0x444656={'where':_0x442edf[_0xa235('0x3a')]};return db[_0xa235('0x3f')][_0xa235('0x19')](_0x444656)['then'](function(_0x28c259){_0x7a6f13[_0xa235('0x19')]=_0x28c259;if(_0x19a673[_0xa235('0x2b')][_0xa235('0x40')]){_0x442edf[_0xa235('0x41')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0xa235('0x42')](_0x442edf);})[_0xa235('0x21')](function(_0x2ebe2a){_0x7a6f13[_0xa235('0x43')]=_0x2ebe2a;return _0x7a6f13;})['then'](respondWithFilteredResult(_0x53ec70,_0x442edf))[_0xa235('0x44')](handleError(_0x53ec70,null));};exports[_0xa235('0x45')]=function(_0x47801f,_0x2de451){var _0x32179a={'raw':!![],'where':{'id':_0x47801f[_0xa235('0x46')]['id']}},_0x22caf6={};_0x22caf6['model']=_[_0xa235('0x2c')](db[_0xa235('0x3f')][_0xa235('0x29')]);_0x22caf6[_0xa235('0x2b')]=_[_0xa235('0x2c')](_0x47801f['query']);_0x22caf6[_0xa235('0x38')]=_[_0xa235('0x2e')](_0x22caf6[_0xa235('0x2d')],_0x22caf6[_0xa235('0x2b')]);_0x32179a[_0xa235('0x30')]=_['intersection'](_0x22caf6[_0xa235('0x2d')],qs[_0xa235('0x2f')](_0x47801f[_0xa235('0x2b')][_0xa235('0x2f')]));_0x32179a[_0xa235('0x30')]=_0x32179a[_0xa235('0x30')][_0xa235('0x31')]?_0x32179a[_0xa235('0x30')]:_0x22caf6['model'];if(_0x47801f[_0xa235('0x2b')][_0xa235('0x40')]){_0x32179a[_0xa235('0x41')]=[{'all':!![]}];}_0x32179a=_[_0xa235('0x3b')]({},_0x32179a,_0x47801f[_0xa235('0x3e')]);return db[_0xa235('0x3f')][_0xa235('0x47')](_0x32179a)[_0xa235('0x21')](handleEntityNotFound(_0x2de451,null))[_0xa235('0x21')](respondWithResult(_0x2de451,null))['catch'](handleError(_0x2de451,null));};exports[_0xa235('0x48')]=function(_0x3395e9,_0x116256){return db[_0xa235('0x3f')][_0xa235('0x48')](_0x3395e9['body'],{})[_0xa235('0x21')](respondWithResult(_0x116256,0xc9))[_0xa235('0x44')](handleError(_0x116256,null));};exports['update']=function(_0x2a628f,_0x430196){if(_0x2a628f[_0xa235('0x49')]['id']){delete _0x2a628f[_0xa235('0x49')]['id'];}return db['VoiceMailMessage'][_0xa235('0x47')]({'where':{'id':_0x2a628f['params']['id']}})[_0xa235('0x21')](handleEntityNotFound(_0x430196,null))[_0xa235('0x21')](saveUpdates(_0x2a628f['body'],null))[_0xa235('0x21')](respondWithResult(_0x430196,null))[_0xa235('0x44')](handleError(_0x430196,null));};exports[_0xa235('0x22')]=function(_0x26e8ad,_0x133980){return db[_0xa235('0x3f')][_0xa235('0x47')]({'where':{'id':_0x26e8ad[_0xa235('0x46')]['id']}})['then'](handleEntityNotFound(_0x133980,null))['then'](removeEntity(_0x133980,null))['catch'](handleError(_0x133980,null));};exports[_0xa235('0x4a')]=function(_0x1711a8,_0x476401,_0x3b5255){return db['VoiceMailMessage'][_0xa235('0x47')]({'where':{'id':_0x1711a8['params']['id']},'attributes':['id',_0xa235('0x4b'),_0xa235('0x4c')]})[_0xa235('0x21')](handleEntityNotFound(_0x476401,null))[_0xa235('0x21')](function(_0x54edb0){if(_0x54edb0){if(!_0x54edb0[_0xa235('0x4b')]){throw new db['Sequelize'][(_0xa235('0x4d'))](_0xa235('0x4e'));}var _0x5a119e={'Content-Type':_0xa235('0x4f'),'Content-Disposition':_0xa235('0x50')};if(_0x54edb0[_0xa235('0x4c')]){_0x5a119e[_0xa235('0x51')]='attachment;\x20filename=\x22'+_0x54edb0['msg_id']+'.wav\x22';}_0x476401[_0xa235('0x1b')](_0x5a119e);return _0x476401[_0xa235('0x27')](new Buffer(_0x54edb0['recording']));}})['catch'](handleError(_0x476401,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 983338f..e68f7c2 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 _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 +var _0x537a=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','voice_voicemail_messages','dir'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x537a,0x193));var _0xa537=function(_0x7c5b41,_0x577587){_0x7c5b41=_0x7c5b41-0x0;var _0xa75631=_0x537a[_0x7c5b41];return _0xa75631;};'use strict';var _=require(_0xa537('0x0'));var util=require('util');var logger=require(_0xa537('0x1'))(_0xa537('0x2'));var moment=require(_0xa537('0x3'));var BPromise=require(_0xa537('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa537('0x5'));var rimraf=require(_0xa537('0x6'));var config=require(_0xa537('0x7'));var attributes=require(_0xa537('0x8'));module['exports']=function(_0x449b5a,_0x474ab5){return _0x449b5a[_0xa537('0x9')](_0xa537('0xa'),attributes,{'tableName':_0xa537('0xb'),'paranoid':![],'indexes':[{'name':_0xa537('0xc'),'fields':[_0xa537('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 4650e26..b960da6 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.rpc.js +++ b/server/api/voiceMailMessage/voiceMailMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','stringify'];(function(_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 +var _0x0b0e=['VoiceMailMessage,\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','VoiceMailMessage,\x20%s,\x20%s','debug'];(function(_0x2b5b44,_0x17189c){var _0x32cb66=function(_0x4ce183){while(--_0x4ce183){_0x2b5b44['push'](_0x2b5b44['shift']());}};_0x32cb66(++_0x17189c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2c93e2,_0x4fb5e2){_0x2c93e2=_0x2c93e2-0x0;var _0x57264e=_0x0b0e[_0x2c93e2];return _0x57264e;};'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')]('VoiceMailMessage,\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/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index b2387f5..cffee4a 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 _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 +var _0x8a72=['get','/:id','isAuthenticated','/:id/sounds','getSounds','post','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','path','express','Router','../../components/auth/service','./voiceMusicOnHold.controller'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8a72,0xa6));var _0x28a7=function(_0x1af3ec,_0x3ea005){_0x1af3ec=_0x1af3ec-0x0;var _0x43a8de=_0x8a72[_0x1af3ec];return _0x43a8de;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x28a7('0x0'));var timeout=require('connect-timeout');var express=require(_0x28a7('0x1'));var router=express[_0x28a7('0x2')]();var auth=require(_0x28a7('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x28a7('0x4'));router[_0x28a7('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x28a7('0x6'),auth[_0x28a7('0x7')](),controller['show']);router['get'](_0x28a7('0x8'),auth[_0x28a7('0x7')](),controller[_0x28a7('0x9')]);router[_0x28a7('0xa')]('/',auth[_0x28a7('0x7')](),controller['create']);router[_0x28a7('0xa')]('/:id/sounds',auth[_0x28a7('0x7')](),controller[_0x28a7('0xb')]);router[_0x28a7('0xc')](_0x28a7('0x6'),auth[_0x28a7('0x7')](),controller[_0x28a7('0xd')]);router[_0x28a7('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x28a7('0xf')]);router[_0x28a7('0xe')](_0x28a7('0x10'),auth[_0x28a7('0x7')](),controller[_0x28a7('0x11')]);module[_0x28a7('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 1f5f8a2..5edb8d5 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 _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 +var _0x2ff5=['quietmp3','mp3','TIMESTAMP','sequelize','exports','STRING','name','ENUM','custom','files','quietmp3nb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2ff5,0x100));var _0x52ff=function(_0x53af21,_0x34fc56){_0x53af21=_0x53af21-0x0;var _0x51c66c=_0x2ff5[_0x53af21];return _0x51c66c;};'use strict';var Sequelize=require(_0x52ff('0x0'));module[_0x52ff('0x1')]={'name':{'type':Sequelize[_0x52ff('0x2')],'allowNull':![],'unique':_0x52ff('0x3')},'mode':{'type':Sequelize[_0x52ff('0x4')](_0x52ff('0x5'),_0x52ff('0x6'),'mp3nb',_0x52ff('0x7'),_0x52ff('0x8'),_0x52ff('0x9')),'allowNull':!![],'defaultValue':_0x52ff('0x6')},'directory':{'type':Sequelize[_0x52ff('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x52ff('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x52ff('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x52ff('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x52ff('0xa')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'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 d39d6d3..a1a006c 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(_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 +var _0x5f2f=['getSounds','nolimit','html-pdf','eml-format','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/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','MusicOnHolds','UserProfileResource','then','end','error','stack','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','body','catch','transaction','mode','directory','server/files/moh','create','files','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','sequelize','readdirSync','forEach','unlinkSync','join','rmdirSync','message','addSound','findOne','save_name','converted_format','createdAt','root','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','Sequelize','ValidationError','removeSound','id2','Sound'];(function(_0x5717bf,_0x9d92af){var _0x2a1e0b=function(_0xc763ef){while(--_0xc763ef){_0x5717bf['push'](_0x5717bf['shift']());}};_0x2a1e0b(++_0x9d92af);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2d52aa,_0x4179e9){_0x2d52aa=_0x2d52aa-0x0;var _0xde20c5=_0x5f2f[_0x2d52aa];return _0xde20c5;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0xa'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var db=require(_0xf5f2('0x16'))['db'];function respondWithStatusCode(_0x14b51f,_0x331482){_0x331482=_0x331482||0xcc;return function(_0x3f2997){if(_0x3f2997){return _0x14b51f[_0xf5f2('0x17')](_0x331482);}return _0x14b51f[_0xf5f2('0x18')](_0x331482)['end']();};}function respondWithResult(_0x5850f4,_0xea612c){_0xea612c=_0xea612c||0xc8;return function(_0x269909){if(_0x269909){return _0x5850f4[_0xf5f2('0x18')](_0xea612c)[_0xf5f2('0x19')](_0x269909);}};}function respondWithFilteredResult(_0x4d97fc,_0xafe430){return function(_0x286197){if(_0x286197){var _0x17d656=_0x286197[_0xf5f2('0x1a')],_0x1b6dd2=_0xafe430[_0xf5f2('0x1b')],_0x23e23a=_0xafe430[_0xf5f2('0x1b')]+_0xafe430[_0xf5f2('0x1c')],_0x3a9dbb;if(_0x23e23a>=_0x17d656){_0x23e23a=_0x17d656;_0x3a9dbb=0xc8;}else{_0x3a9dbb=0xce;}_0x4d97fc[_0xf5f2('0x18')](_0x3a9dbb);return _0x4d97fc[_0xf5f2('0x1d')](_0xf5f2('0x1e'),_0x1b6dd2+'-'+_0x23e23a+'/'+_0x17d656)[_0xf5f2('0x19')](_0x286197);}return null;};}function patchUpdates(_0x3cf5ea){return function(_0x626999){try{jsonpatch[_0xf5f2('0x1f')](_0x626999,_0x3cf5ea,!![]);}catch(_0x56acc5){return BPromise[_0xf5f2('0x20')](_0x56acc5);}return _0x626999[_0xf5f2('0x21')]();};}function saveUpdates(_0x49dac2,_0x47acfc){return function(_0x2d2805){if(_0x2d2805){return _0x2d2805[_0xf5f2('0x22')](_0x49dac2)['then'](function(_0x45b74f){return _0x45b74f;});}return null;};}function removeEntity(_0x170042,_0x39e44a){return function(_0x39c024){if(_0x39c024){return _0x39c024[_0xf5f2('0x23')]()['then'](function(){var _0x21cd91=_0x39c024[_0xf5f2('0x24')]({'plain':!![]});var _0x4e8bda=_0xf5f2('0x25');return db[_0xf5f2('0x26')]['destroy']({'where':{'type':_0x4e8bda,'resourceId':_0x21cd91['id']}})['then'](function(){return _0x39c024;});})[_0xf5f2('0x27')](function(){_0x170042[_0xf5f2('0x18')](0xcc)[_0xf5f2('0x28')]();});}};}function handleEntityNotFound(_0x1a5bb3,_0xf6c58d){return function(_0x788a8d){if(!_0x788a8d){_0x1a5bb3[_0xf5f2('0x17')](0x194);}return _0x788a8d;};}function handleError(_0x281ec8,_0x294414){_0x294414=_0x294414||0x1f4;return function(_0x4ab014){logger[_0xf5f2('0x29')](_0x4ab014[_0xf5f2('0x2a')]);if(_0x4ab014[_0xf5f2('0x2b')]){delete _0x4ab014[_0xf5f2('0x2b')];}_0x281ec8[_0xf5f2('0x18')](_0x294414)[_0xf5f2('0x2c')](_0x4ab014);};}exports['index']=function(_0x53cb96,_0x22c826){var _0x14c829={},_0x11c771={},_0x5027ab={'count':0x0,'rows':[]};var _0x5a2c7e=_[_0xf5f2('0x2d')](db[_0xf5f2('0x2e')][_0xf5f2('0x2f')],function(_0x153924){return{'name':_0x153924[_0xf5f2('0x30')],'type':_0x153924['type']['key']};});_0x11c771[_0xf5f2('0x31')]=_['map'](_0x5a2c7e,_0xf5f2('0x2b'));_0x11c771['query']=_[_0xf5f2('0x32')](_0x53cb96[_0xf5f2('0x33')]);_0x11c771[_0xf5f2('0x34')]=_[_0xf5f2('0x35')](_0x11c771[_0xf5f2('0x31')],_0x11c771[_0xf5f2('0x33')]);_0x14c829[_0xf5f2('0x36')]=_[_0xf5f2('0x35')](_0x11c771['model'],qs[_0xf5f2('0x37')](_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x37')]));_0x14c829[_0xf5f2('0x36')]=_0x14c829[_0xf5f2('0x36')][_0xf5f2('0x38')]?_0x14c829[_0xf5f2('0x36')]:_0x11c771['model'];if(!_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x39')]('nolimit')){_0x14c829[_0xf5f2('0x1c')]=qs['limit'](_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x1c')]);_0x14c829[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x53cb96['query']['offset']);}_0x14c829[_0xf5f2('0x3a')]=qs[_0xf5f2('0x3b')](_0x53cb96[_0xf5f2('0x33')]['sort']);_0x14c829[_0xf5f2('0x3c')]=qs['filters'](_[_0xf5f2('0x3d')](_0x53cb96['query'],_0x11c771[_0xf5f2('0x34')]),_0x5a2c7e);if(_0x53cb96[_0xf5f2('0x33')]['filter']){_0x14c829[_0xf5f2('0x3c')]=_[_0xf5f2('0x3e')](_0x14c829[_0xf5f2('0x3c')],{'$or':_[_0xf5f2('0x2d')](_0x5a2c7e,function(_0x542cd6){if(_0x542cd6['type']!==_0xf5f2('0x3f')){var _0x140a11={};_0x140a11[_0x542cd6[_0xf5f2('0x2b')]]={'$like':'%'+_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x40')]+'%'};return _0x140a11;}})});}_0x14c829=_[_0xf5f2('0x3e')]({},_0x14c829,_0x53cb96[_0xf5f2('0x41')]);var _0x4c0ac7={'where':_0x14c829[_0xf5f2('0x3c')]};return db[_0xf5f2('0x2e')]['count'](_0x4c0ac7)[_0xf5f2('0x27')](function(_0x3f3895){_0x5027ab[_0xf5f2('0x1a')]=_0x3f3895;if(_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x42')]){_0x14c829[_0xf5f2('0x43')]=[{'all':!![]}];}return db[_0xf5f2('0x2e')][_0xf5f2('0x44')](_0x14c829);})['then'](function(_0x31c3c){_0x5027ab[_0xf5f2('0x45')]=_0x31c3c;return _0x5027ab;})[_0xf5f2('0x27')](respondWithFilteredResult(_0x22c826,_0x14c829))['catch'](handleError(_0x22c826,null));};exports['show']=function(_0x59eb00,_0x76d21b){var _0x2ad13c={'raw':![],'where':{'id':_0x59eb00[_0xf5f2('0x46')]['id']}},_0x4c8d8e={};_0x4c8d8e[_0xf5f2('0x31')]=_[_0xf5f2('0x32')](db[_0xf5f2('0x2e')][_0xf5f2('0x2f')]);_0x4c8d8e[_0xf5f2('0x33')]=_[_0xf5f2('0x32')](_0x59eb00[_0xf5f2('0x33')]);_0x4c8d8e[_0xf5f2('0x34')]=_[_0xf5f2('0x35')](_0x4c8d8e[_0xf5f2('0x31')],_0x4c8d8e[_0xf5f2('0x33')]);_0x2ad13c[_0xf5f2('0x36')]=_[_0xf5f2('0x35')](_0x4c8d8e['model'],qs[_0xf5f2('0x37')](_0x59eb00['query'][_0xf5f2('0x37')]));_0x2ad13c[_0xf5f2('0x36')]=_0x2ad13c[_0xf5f2('0x36')][_0xf5f2('0x38')]?_0x2ad13c[_0xf5f2('0x36')]:_0x4c8d8e[_0xf5f2('0x31')];if(_0x59eb00['query'][_0xf5f2('0x42')]){_0x2ad13c[_0xf5f2('0x43')]=[{'all':!![]}];}_0x2ad13c=_[_0xf5f2('0x3e')]({},_0x2ad13c,_0x59eb00[_0xf5f2('0x41')]);return db[_0xf5f2('0x2e')][_0xf5f2('0x47')](_0x2ad13c)[_0xf5f2('0x27')](handleEntityNotFound(_0x76d21b,null))[_0xf5f2('0x27')](respondWithResult(_0x76d21b,null))['catch'](handleError(_0x76d21b,null));};exports[_0xf5f2('0x22')]=function(_0x33ec29,_0x45db9a){if(_0x33ec29['body']['id']){delete _0x33ec29[_0xf5f2('0x48')]['id'];}return db[_0xf5f2('0x2e')][_0xf5f2('0x47')]({'where':{'id':_0x33ec29['params']['id']}})['then'](handleEntityNotFound(_0x45db9a,null))[_0xf5f2('0x27')](saveUpdates(_0x33ec29[_0xf5f2('0x48')],null))['then'](respondWithResult(_0x45db9a,null))[_0xf5f2('0x49')](handleError(_0x45db9a,null));};exports['create']=function(_0x740321,_0x497eb8,_0x2cbd9d){return db['sequelize'][_0xf5f2('0x4a')](function(_0xb8ea3a){if(_0x740321[_0xf5f2('0x48')][_0xf5f2('0x4b')]==='files'){_0x740321[_0xf5f2('0x48')][_0xf5f2('0x4c')]=path['join'](config['root'],_0xf5f2('0x4d'),_0x740321[_0xf5f2('0x48')]['name']);}return db[_0xf5f2('0x2e')][_0xf5f2('0x4e')](_0x740321[_0xf5f2('0x48')],{'transaction':_0xb8ea3a})[_0xf5f2('0x27')](function(_0x5d0db0){if(_0x740321['body'][_0xf5f2('0x4b')]===_0xf5f2('0x4f')){fs['mkdirSync'](_0x5d0db0[_0xf5f2('0x4c')],parseInt(_0xf5f2('0x50'),0x8));}var _0x255125=_0x740321[_0xf5f2('0x51')][_0xf5f2('0x24')]({'plain':!![]});if(!_0x255125)throw new Error(_0xf5f2('0x52'));if(_0x255125[_0xf5f2('0x53')]==='user'){var _0x59e8ef=_0x5d0db0[_0xf5f2('0x24')]({'plain':!![]});return db[_0xf5f2('0x54')][_0xf5f2('0x47')]({'where':{'name':_0xf5f2('0x25'),'userProfileId':_0x255125[_0xf5f2('0x55')]},'raw':!![]})['then'](function(_0xdb1106){if(_0xdb1106&&_0xdb1106[_0xf5f2('0x56')]===0x0){return db[_0xf5f2('0x26')]['create']({'name':_0x59e8ef[_0xf5f2('0x2b')],'resourceId':_0x59e8ef['id'],'type':_0xdb1106['name'],'sectionId':_0xdb1106['id']},{})[_0xf5f2('0x27')](function(){return _0x5d0db0;});}else{return _0x5d0db0;}})[_0xf5f2('0x49')](function(_0x28cce5){logger[_0xf5f2('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28cce5);});}return _0x5d0db0;});})['then'](respondWithResult(_0x497eb8,0xc9))[_0xf5f2('0x49')](handleError(_0x497eb8,null));};exports['destroy']=function(_0xa39c65,_0x1f1916,_0x572ec1){var _0x3f0579;return db[_0xf5f2('0x2e')][_0xf5f2('0x47')]({'where':{'id':_0xa39c65['params']['id']}})[_0xf5f2('0x27')](function(_0xcf7a50){if(_0xcf7a50){return db[_0xf5f2('0x57')][_0xf5f2('0x4a')](function(_0x51fa7e){return _0xcf7a50[_0xf5f2('0x23')]({'transaction':_0x51fa7e,'raw':!![]})['then'](function(_0x2cbe1e){if(_0x2cbe1e[_0xf5f2('0x4c')]){fs[_0xf5f2('0x58')](_0x2cbe1e[_0xf5f2('0x4c')])[_0xf5f2('0x59')](function(_0x5583c2){fs[_0xf5f2('0x5a')](path[_0xf5f2('0x5b')](_0x2cbe1e[_0xf5f2('0x4c')],_0x5583c2));});fs[_0xf5f2('0x5c')](_0x2cbe1e[_0xf5f2('0x4c')]);}return _0x2cbe1e;});})['catch'](function(_0x31e16b){throw new db['Sequelize']['ValidationError'](_0x31e16b[_0xf5f2('0x5d')]);});}})['then'](handleEntityNotFound(_0x1f1916,null))[_0xf5f2('0x27')](removeEntity(_0x1f1916,null))[_0xf5f2('0x49')](handleError(_0x1f1916,null));};exports[_0xf5f2('0x5e')]=function(_0x123b93,_0x5767fc,_0x15d0c2){return db[_0xf5f2('0x57')][_0xf5f2('0x4a')](function(_0x18c41f){var _0x15b680;return db[_0xf5f2('0x2e')][_0xf5f2('0x47')]({'where':{'id':_0x123b93['params']['id']}})[_0xf5f2('0x27')](function(_0x2d171d){if(_0x2d171d){_0x15b680=_0x2d171d;return _0x2d171d[_0xf5f2('0x5e')](_0x123b93[_0xf5f2('0x48')]['id'],{'transaction':_0x18c41f});}})['then'](function(_0x1de396){if(_0x1de396){return db['Sound'][_0xf5f2('0x5f')]({'where':{'id':_0x123b93[_0xf5f2('0x48')]['id']},'attributes':['id','name',_0xf5f2('0x60'),_0xf5f2('0x61'),_0xf5f2('0x62')],'raw':!![]});}})[_0xf5f2('0x27')](function(_0x146462){if(_0x146462){var _0x4bd113=path[_0xf5f2('0x5b')](config[_0xf5f2('0x63')],_0xf5f2('0x64'),util[_0xf5f2('0x65')](_0xf5f2('0x66'),path[_0xf5f2('0x67')](_0x146462['save_name'],path[_0xf5f2('0x68')](_0x146462[_0xf5f2('0x60')])),_0x146462['converted_format']));var _0x3f677e=path[_0xf5f2('0x5b')](config[_0xf5f2('0x63')],'server/files/moh',_0x15b680['name'],util['format'](_0xf5f2('0x66'),_0x146462[_0xf5f2('0x2b')],_0x146462[_0xf5f2('0x61')]));fs[_0xf5f2('0x69')](_0x4bd113,_0x3f677e);return _0x146462;}})[_0xf5f2('0x49')](function(_0x4d878e){throw new db[(_0xf5f2('0x6a'))][(_0xf5f2('0x6b'))](_0x4d878e[_0xf5f2('0x5d')]);});})[_0xf5f2('0x27')](handleEntityNotFound(_0x5767fc,null))[_0xf5f2('0x27')](respondWithResult(_0x5767fc,0xc9))[_0xf5f2('0x49')](handleError(_0x5767fc,null));};exports[_0xf5f2('0x6c')]=function(_0x3cce11,_0x155f45,_0x1f35ef){return db[_0xf5f2('0x57')]['transaction'](function(_0x5e4e07){var _0x5a143f;return db[_0xf5f2('0x2e')][_0xf5f2('0x5f')]({'where':{'id':_0x3cce11[_0xf5f2('0x46')]['id']}})[_0xf5f2('0x27')](handleEntityNotFound(_0x155f45,null))[_0xf5f2('0x27')](function(_0x5c6959){if(_0x5c6959){_0x5a143f=_0x5c6959;return _0x5c6959[_0xf5f2('0x6c')](_0x3cce11[_0xf5f2('0x46')][_0xf5f2('0x6d')]);}})[_0xf5f2('0x27')](function(_0x44d119){if(_0x44d119){return db['Sound'][_0xf5f2('0x5f')]({'where':{'id':_0x3cce11[_0xf5f2('0x46')]['id2']},'attributes':['id',_0xf5f2('0x2b'),_0xf5f2('0x60'),_0xf5f2('0x61'),_0xf5f2('0x62')],'raw':!![]});}})['then'](function(_0x40b36e){if(_0x40b36e){fs[_0xf5f2('0x5a')](path[_0xf5f2('0x5b')](_0x5a143f[_0xf5f2('0x4c')],util[_0xf5f2('0x65')]('%s.%s',_0x40b36e['name'],_0x40b36e[_0xf5f2('0x61')])));return _0x40b36e;}})[_0xf5f2('0x49')](function(_0x17eb69){throw new db[(_0xf5f2('0x6a'))]['ValidationError'](_0x17eb69['message']);});})[_0xf5f2('0x27')](handleEntityNotFound(_0x155f45,null))['then'](respondWithStatusCode(_0x155f45,0xcc))['catch'](handleError(_0x155f45,null));};exports['getSounds']=function(_0x57cb18,_0xad4554,_0x543434){var _0x18eb83={};var _0x168092={};var _0x3de508;var _0x9f941e;return db[_0xf5f2('0x2e')][_0xf5f2('0x5f')]({'where':{'id':_0x57cb18[_0xf5f2('0x46')]['id']}})[_0xf5f2('0x27')](handleEntityNotFound(_0xad4554,null))[_0xf5f2('0x27')](function(_0x2afeac){if(_0x2afeac){_0x3de508=_0x2afeac;_0x168092[_0xf5f2('0x31')]=_[_0xf5f2('0x32')](db[_0xf5f2('0x6e')][_0xf5f2('0x2f')]);_0x168092[_0xf5f2('0x33')]=_[_0xf5f2('0x32')](_0x57cb18['query']);_0x168092[_0xf5f2('0x34')]=_[_0xf5f2('0x35')](_0x168092[_0xf5f2('0x31')],_0x168092[_0xf5f2('0x33')]);_0x18eb83[_0xf5f2('0x36')]=_[_0xf5f2('0x35')](_0x168092[_0xf5f2('0x31')],qs[_0xf5f2('0x37')](_0x57cb18['query'][_0xf5f2('0x37')]));_0x18eb83['attributes']=_0x18eb83['attributes']['length']?_0x18eb83['attributes']:_0x168092['model'];_0x18eb83['order']=qs[_0xf5f2('0x3b')](_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x3b')]);_0x18eb83[_0xf5f2('0x3c')]=qs[_0xf5f2('0x34')](_[_0xf5f2('0x3d')](_0x57cb18['query'],_0x168092['filters']));if(_0x57cb18[_0xf5f2('0x33')]['filter']){_0x18eb83[_0xf5f2('0x3c')]=_[_0xf5f2('0x3e')](_0x18eb83['where'],{'$or':_['map'](_0x18eb83[_0xf5f2('0x36')],function(_0x274aa3){var _0x5a23c7={};_0x5a23c7[_0x274aa3]={'$like':'%'+_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x40')]+'%'};return _0x5a23c7;})});}_0x18eb83=_['merge']({},_0x18eb83,_0x57cb18[_0xf5f2('0x41')]);return _0x3de508[_0xf5f2('0x6f')](_0x18eb83);}})[_0xf5f2('0x27')](function(_0x4c1678){if(_0x4c1678){_0x9f941e=_0x4c1678[_0xf5f2('0x38')];if(!_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x39')](_0xf5f2('0x70'))){_0x18eb83[_0xf5f2('0x1c')]=qs[_0xf5f2('0x1c')](_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x1c')]);_0x18eb83[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x1b')]);}return _0x3de508[_0xf5f2('0x6f')](_0x18eb83);}})[_0xf5f2('0x27')](function(_0xe900ea){if(_0xe900ea){return _0xe900ea?{'count':_0x9f941e,'rows':_0xe900ea}:null;}})[_0xf5f2('0x27')](respondWithResult(_0xad4554,null))[_0xf5f2('0x49')](handleError(_0xad4554,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index a3a4b2b..4826af7 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 _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 +var _0xbfe1=['request-promise','path','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x22ed32,_0x37dedf){var _0x1e8eee=function(_0x5469fa){while(--_0x5469fa){_0x22ed32['push'](_0x22ed32['shift']());}};_0x1e8eee(++_0x37dedf);}(_0xbfe1,0xe1));var _0x1bfe=function(_0x2cb2e6,_0x401618){_0x2cb2e6=_0x2cb2e6-0x0;var _0x8c40d9=_0xbfe1[_0x2cb2e6];return _0x8c40d9;};'use strict';var _=require(_0x1bfe('0x0'));var util=require(_0x1bfe('0x1'));var logger=require(_0x1bfe('0x2'))(_0x1bfe('0x3'));var moment=require(_0x1bfe('0x4'));var BPromise=require(_0x1bfe('0x5'));var rp=require(_0x1bfe('0x6'));var fs=require('fs');var path=require(_0x1bfe('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1bfe('0x8'));module[_0x1bfe('0x9')]=function(_0x414c5,_0x2c6848){return _0x414c5['define'](_0x1bfe('0xa'),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 6b03583..9d7fa6a 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 _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 +var _0xeaef=['request','info','VoiceMusicOnHold,\x20%s,\x20%s','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','message','error','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x34c6bd,_0x5af7fc){var _0x2e251a=function(_0x516837){while(--_0x516837){_0x34c6bd['push'](_0x34c6bd['shift']());}};_0x2e251a(++_0x5af7fc);}(_0xeaef,0xe6));var _0xfeae=function(_0x2a3eb3,_0x2c71a6){_0x2a3eb3=_0x2a3eb3-0x0;var _0x51eede=_0xeaef[_0x2a3eb3];return _0x51eede;};'use strict';var _=require(_0xfeae('0x0'));var util=require(_0xfeae('0x1'));var moment=require(_0xfeae('0x2'));var BPromise=require(_0xfeae('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfeae('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfeae('0x5'));var logger=require(_0xfeae('0x6'))(_0xfeae('0x7'));var config=require(_0xfeae('0x8'));var jayson=require(_0xfeae('0x9'));var client=jayson[_0xfeae('0xa')][_0xfeae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2684be,_0x5aca52,_0x588b54){return new BPromise(function(_0x3f3f0b,_0x1b2b19){return client[_0xfeae('0xc')](_0x2684be,_0x588b54)['then'](function(_0xb79d01){logger[_0xfeae('0xd')](_0xfeae('0xe'),_0x5aca52,'request\x20sent');logger[_0xfeae('0xf')](_0xfeae('0x10'),_0x5aca52,'request\x20sent',JSON[_0xfeae('0x11')](_0xb79d01));if(_0xb79d01['error']){if(_0xb79d01['error']['code']===0x1f4){logger['error'](_0xfeae('0xe'),_0x5aca52,_0xb79d01['error'][_0xfeae('0x12')]);return _0x1b2b19(_0xb79d01[_0xfeae('0x13')][_0xfeae('0x12')]);}logger[_0xfeae('0x13')](_0xfeae('0xe'),_0x5aca52,_0xb79d01[_0xfeae('0x13')]['message']);return _0x3f3f0b(_0xb79d01[_0xfeae('0x13')][_0xfeae('0x12')]);}else{logger[_0xfeae('0xd')](_0xfeae('0xe'),_0x5aca52,'request\x20sent');_0x3f3f0b(_0xb79d01[_0xfeae('0x14')][_0xfeae('0x12')]);}})[_0xfeae('0x15')](function(_0x52eb11){logger[_0xfeae('0x13')](_0xfeae('0xe'),_0x5aca52,_0x52eb11);_0x1b2b19(_0x52eb11);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index fb94846..6caf15c 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 _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 +var _0x7166=['getAgents','post','/:id/users','addAgents','put','/:id','update','delete','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0x41ee40,_0x1d020f){var _0x4d0d61=function(_0x59d80d){while(--_0x59d80d){_0x41ee40['push'](_0x41ee40['shift']());}};_0x4d0d61(++_0x1d020f);}(_0x7166,0x127));var _0x6716=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x7166[_0x1da04e];return _0xdd8c41;};'use strict';var multer=require(_0x6716('0x0'));var util=require(_0x6716('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6716('0x2'));var router=express['Router']();var auth=require(_0x6716('0x3'));var interaction=require(_0x6716('0x4'));var config=require(_0x6716('0x5'));var controller=require(_0x6716('0x6'));router[_0x6716('0x7')]('/',auth[_0x6716('0x8')](),controller[_0x6716('0x9')]);router['get'](_0x6716('0xa'),auth[_0x6716('0x8')](),controller[_0x6716('0xb')]);router[_0x6716('0x7')]('/:id',auth[_0x6716('0x8')](),controller[_0x6716('0xc')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x6716('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x6716('0xe')](_0x6716('0xf'),auth[_0x6716('0x8')](),controller[_0x6716('0x10')]);router[_0x6716('0x11')](_0x6716('0x12'),auth[_0x6716('0x8')](),controller[_0x6716('0x13')]);router[_0x6716('0x14')](_0x6716('0x12'),auth[_0x6716('0x8')](),controller['destroy']);router[_0x6716('0x14')](_0x6716('0xf'),auth[_0x6716('0x8')](),controller['removeAgents']);module[_0x6716('0x15')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 863b732..07a5930 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 _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 +var _0xd005=['STRING','VIRTUAL','system-','name','INTEGER','sequelize'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0xd005,0x17f));var _0x5d00=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd005[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x5d00('0x0'));module['exports']={'name':{'type':Sequelize[_0x5d00('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x5d00('0x2')],'get':function(_0x182c67){return _0x5d00('0x3')+this['getDataValue'](_0x5d00('0x4'))+'-';}},'description':{'type':Sequelize[_0x5d00('0x1')]},'callerIdAll':{'type':Sequelize[_0x5d00('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x5d00('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 347edfb..12535b9 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 _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 +var _0x7849=['CDR(prefix)=','callerIdAll','push','NoOp','context','${EXTEN:','charAt','body','findById','addAgents','ids','omit','spread','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','sendStatus','end','status','count','offset','limit','Content-Range','json','apply','save','update','then','destroy','VoicePrefixes','name','send','index','map','VoicePrefix','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','catch','show','rawAttributes','length','find','params','describe','create','sequelize','transaction','get','VoiceExtensionId','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7849,0x89));var _0x9784=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7849[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x9784('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9784('0x1'));var zipdir=require(_0x9784('0x2'));var jsonpatch=require(_0x9784('0x3'));var rp=require(_0x9784('0x4'));var moment=require(_0x9784('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9784('0x6'));var util=require(_0x9784('0x7'));var path=require('path');var sox=require(_0x9784('0x8'));var csv=require(_0x9784('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9784('0xa'));var jsforce=require(_0x9784('0xb'));var deskjs=require(_0x9784('0xc'));var toCsv=require(_0x9784('0x9'));var querystring=require(_0x9784('0xd'));var Papa=require(_0x9784('0xe'));var Redis=require('ioredis');var authService=require(_0x9784('0xf'));var qs=require(_0x9784('0x10'));var as=require(_0x9784('0x11'));var hardwareService=require(_0x9784('0x12'));var logger=require(_0x9784('0x13'))('api');var utils=require(_0x9784('0x14'));var config=require(_0x9784('0x15'));var db=require(_0x9784('0x16'))['db'];config[_0x9784('0x17')]=_[_0x9784('0x18')](config[_0x9784('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x9784('0x19'))(new Redis(config[_0x9784('0x17')]));require(_0x9784('0x1a'))['register'](socket);function respondWithStatusCode(_0x31dc1c,_0x2a2b6e){_0x2a2b6e=_0x2a2b6e||0xcc;return function(_0x25da20){if(_0x25da20){return _0x31dc1c[_0x9784('0x1b')](_0x2a2b6e);}return _0x31dc1c['status'](_0x2a2b6e)[_0x9784('0x1c')]();};}function respondWithResult(_0x1f2ab0,_0x26cf32){_0x26cf32=_0x26cf32||0xc8;return function(_0x1876e0){if(_0x1876e0){return _0x1f2ab0[_0x9784('0x1d')](_0x26cf32)['json'](_0x1876e0);}};}function respondWithFilteredResult(_0x4ff63d,_0x2ccd0d){return function(_0x16d7d4){if(_0x16d7d4){var _0x27f2bc=_0x16d7d4[_0x9784('0x1e')],_0x2a5a4f=_0x2ccd0d[_0x9784('0x1f')],_0x5a5504=_0x2ccd0d[_0x9784('0x1f')]+_0x2ccd0d[_0x9784('0x20')],_0x109141;if(_0x5a5504>=_0x27f2bc){_0x5a5504=_0x27f2bc;_0x109141=0xc8;}else{_0x109141=0xce;}_0x4ff63d[_0x9784('0x1d')](_0x109141);return _0x4ff63d['set'](_0x9784('0x21'),_0x2a5a4f+'-'+_0x5a5504+'/'+_0x27f2bc)[_0x9784('0x22')](_0x16d7d4);}return null;};}function patchUpdates(_0x2949d4){return function(_0x3e18f3){try{jsonpatch[_0x9784('0x23')](_0x3e18f3,_0x2949d4,!![]);}catch(_0x2989a3){return BPromise['reject'](_0x2989a3);}return _0x3e18f3[_0x9784('0x24')]();};}function saveUpdates(_0x3b3225,_0x570034){return function(_0x395158){if(_0x395158){return _0x395158[_0x9784('0x25')](_0x3b3225)[_0x9784('0x26')](function(_0x5da52f){return _0x5da52f;});}return null;};}function removeEntity(_0x273449,_0x305c11){return function(_0x351f5f){if(_0x351f5f){return _0x351f5f[_0x9784('0x27')]()[_0x9784('0x26')](function(){var _0x11b9c5=_0x351f5f['get']({'plain':!![]});var _0x3c6aac=_0x9784('0x28');return db['UserProfileResource'][_0x9784('0x27')]({'where':{'type':_0x3c6aac,'resourceId':_0x11b9c5['id']}})[_0x9784('0x26')](function(){return _0x351f5f;});})['then'](function(){_0x273449[_0x9784('0x1d')](0xcc)[_0x9784('0x1c')]();});}};}function handleEntityNotFound(_0x69ed6a,_0x1842d9){return function(_0x46e05f){if(!_0x46e05f){_0x69ed6a['sendStatus'](0x194);}return _0x46e05f;};}function handleError(_0x150dde,_0x454b39){_0x454b39=_0x454b39||0x1f4;return function(_0x222b19){logger['error'](_0x222b19['stack']);if(_0x222b19[_0x9784('0x29')]){delete _0x222b19['name'];}_0x150dde[_0x9784('0x1d')](_0x454b39)[_0x9784('0x2a')](_0x222b19);};}exports[_0x9784('0x2b')]=function(_0x4267c1,_0x48d8d2){var _0x22f2ae={},_0x4d73b2={},_0x570e2f={'count':0x0,'rows':[]};var _0x13e4e0=_[_0x9784('0x2c')](db[_0x9784('0x2d')]['rawAttributes'],function(_0x51a763){return{'name':_0x51a763[_0x9784('0x2e')],'type':_0x51a763[_0x9784('0x2f')][_0x9784('0x30')]};});_0x4d73b2['model']=_[_0x9784('0x2c')](_0x13e4e0,'name');_0x4d73b2[_0x9784('0x31')]=_[_0x9784('0x32')](_0x4267c1['query']);_0x4d73b2['filters']=_[_0x9784('0x33')](_0x4d73b2[_0x9784('0x34')],_0x4d73b2[_0x9784('0x31')]);_0x22f2ae[_0x9784('0x35')]=_['intersection'](_0x4d73b2[_0x9784('0x34')],qs[_0x9784('0x36')](_0x4267c1[_0x9784('0x31')][_0x9784('0x36')]));_0x22f2ae[_0x9784('0x35')]=_0x22f2ae['attributes']['length']?_0x22f2ae['attributes']:_0x4d73b2[_0x9784('0x34')];if(!_0x4267c1[_0x9784('0x31')][_0x9784('0x37')](_0x9784('0x38'))){_0x22f2ae[_0x9784('0x20')]=qs[_0x9784('0x20')](_0x4267c1[_0x9784('0x31')][_0x9784('0x20')]);_0x22f2ae['offset']=qs[_0x9784('0x1f')](_0x4267c1[_0x9784('0x31')][_0x9784('0x1f')]);}_0x22f2ae[_0x9784('0x39')]=qs['sort'](_0x4267c1['query'][_0x9784('0x3a')]);_0x22f2ae[_0x9784('0x3b')]=qs['filters'](_[_0x9784('0x3c')](_0x4267c1[_0x9784('0x31')],_0x4d73b2[_0x9784('0x3d')]),_0x13e4e0);if(_0x4267c1[_0x9784('0x31')][_0x9784('0x3e')]){_0x22f2ae[_0x9784('0x3b')]=_[_0x9784('0x3f')](_0x22f2ae['where'],{'$or':_[_0x9784('0x2c')](_0x13e4e0,function(_0x23af84){if(_0x23af84[_0x9784('0x2f')]!==_0x9784('0x40')){var _0x3f156f={};_0x3f156f[_0x23af84['name']]={'$like':'%'+_0x4267c1[_0x9784('0x31')][_0x9784('0x3e')]+'%'};return _0x3f156f;}})});}_0x22f2ae=_[_0x9784('0x3f')]({},_0x22f2ae,_0x4267c1[_0x9784('0x41')]);var _0x36c234={'where':_0x22f2ae['where']};return db['VoicePrefix'][_0x9784('0x1e')](_0x36c234)[_0x9784('0x26')](function(_0x1ba928){_0x570e2f[_0x9784('0x1e')]=_0x1ba928;if(_0x4267c1['query'][_0x9784('0x42')]){_0x22f2ae[_0x9784('0x43')]=[{'all':!![]}];}return db[_0x9784('0x2d')]['findAll'](_0x22f2ae);})[_0x9784('0x26')](function(_0x2164d8){_0x570e2f['rows']=_0x2164d8;return _0x570e2f;})['then'](respondWithFilteredResult(_0x48d8d2,_0x22f2ae))[_0x9784('0x44')](handleError(_0x48d8d2,null));};exports[_0x9784('0x45')]=function(_0x2cd34d,_0x1b0274){var _0xf49a47={'raw':![],'where':{'id':_0x2cd34d['params']['id']}},_0x1a5124={};_0x1a5124[_0x9784('0x34')]=_['keys'](db[_0x9784('0x2d')][_0x9784('0x46')]);_0x1a5124[_0x9784('0x31')]=_[_0x9784('0x32')](_0x2cd34d['query']);_0x1a5124[_0x9784('0x3d')]=_['intersection'](_0x1a5124[_0x9784('0x34')],_0x1a5124[_0x9784('0x31')]);_0xf49a47['attributes']=_[_0x9784('0x33')](_0x1a5124['model'],qs[_0x9784('0x36')](_0x2cd34d[_0x9784('0x31')][_0x9784('0x36')]));_0xf49a47['attributes']=_0xf49a47[_0x9784('0x35')][_0x9784('0x47')]?_0xf49a47['attributes']:_0x1a5124[_0x9784('0x34')];if(_0x2cd34d[_0x9784('0x31')]['includeAll']){_0xf49a47['include']=[{'all':!![]}];}_0xf49a47=_['merge']({},_0xf49a47,_0x2cd34d[_0x9784('0x41')]);return db[_0x9784('0x2d')]['find'](_0xf49a47)['then'](handleEntityNotFound(_0x1b0274,null))[_0x9784('0x26')](respondWithResult(_0x1b0274,null))[_0x9784('0x44')](handleError(_0x1b0274,null));};exports['destroy']=function(_0x9bfa97,_0x1d8a2b){return db['VoicePrefix'][_0x9784('0x48')]({'where':{'id':_0x9bfa97[_0x9784('0x49')]['id']}})['then'](handleEntityNotFound(_0x1d8a2b,null))['then'](removeEntity(_0x1d8a2b,null))[_0x9784('0x44')](handleError(_0x1d8a2b,null));};exports[_0x9784('0x4a')]=function(_0x174949,_0x4772c4){return db[_0x9784('0x2d')]['describe']()[_0x9784('0x26')](respondWithResult(_0x4772c4,null))[_0x9784('0x44')](handleError(_0x4772c4,null));};exports[_0x9784('0x4b')]=function(_0x3cf793,_0x3d5be1){var _0x60ece9;return db[_0x9784('0x4c')][_0x9784('0x4d')](function(_0x54ea40){return db[_0x9784('0x2d')][_0x9784('0x4b')](_0x3cf793['body'],{'transaction':_0x54ea40})[_0x9784('0x26')](function(_0xe7fb28){_0x60ece9=_0xe7fb28[_0x9784('0x4e')]({'plain':!![]});return db['VoiceExtension'][_0x9784('0x48')]({'where':{'id':_0x60ece9[_0x9784('0x4f')]},'raw':!![]})[_0x9784('0x26')](function(_0x137fbf){return createVoicePrefixExtensions(_0x60ece9,_0x137fbf,_0x54ea40);});});})[_0x9784('0x26')](function(){var _0x24637a=_0x3cf793[_0x9784('0x50')]['get']({'plain':!![]});if(!_0x24637a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24637a[_0x9784('0x51')]===_0x9784('0x50')){var _0x5ac850=_0x60ece9;return db[_0x9784('0x52')][_0x9784('0x48')]({'where':{'name':_0x9784('0x28'),'userProfileId':_0x24637a[_0x9784('0x53')]},'raw':!![]})['then'](function(_0x3a4d47){if(_0x3a4d47&&_0x3a4d47[_0x9784('0x54')]===0x0){return db[_0x9784('0x55')][_0x9784('0x4b')]({'name':_0x5ac850[_0x9784('0x29')],'resourceId':_0x5ac850['id'],'type':_0x3a4d47['name'],'sectionId':_0x3a4d47['id']},{})[_0x9784('0x26')](function(){return _0x60ece9;});}else{return _0x60ece9;}})['catch'](function(_0x2176b0){logger[_0x9784('0x56')](_0x9784('0x57'),_0x2176b0);throw _0x2176b0;});}return _0x60ece9;})[_0x9784('0x26')](respondWithResult(_0x3d5be1,null))[_0x9784('0x44')](handleError(_0x3d5be1,null));};function Extension(_0x26d731,_0x388db8,_0x412c3f,_0x50d379){this['context']='from-sip';this[_0x9784('0x58')]=_0x26d731;this[_0x9784('0x59')]=_0x412c3f;this[_0x9784('0x2f')]=_0x9784('0x5a');this[_0x9784('0x5b')]=_0x9784('0x5c');this[_0x9784('0x5d')]=_0x388db8;this[_0x9784('0x5e')]=_0x50d379;}function createVoicePrefixExtensions(_0x19c591,_0x2cc26f,_0x52bffc){return new BPromise(function(_0x2216bc,_0x5b8f98){var _0xe03646=new Extension(formatPrefixName(_0x19c591[_0x9784('0x5f')]),0x1,'NoOp',_0x9784('0x60'));_0xe03646['VoicePrefixId']=_0x19c591['id'];return db['VoiceExtension'][_0x9784('0x4b')](_0xe03646,{'transaction':_0x52bffc})[_0x9784('0x26')](function(_0x1c949e){var _0x5956ae=_0x1c949e[_0x9784('0x4e')]({'plain':!![]});var _0x21f38f=_[_0x9784('0x2c')](addVoicePrefixExtensions(_0x19c591,_0x2cc26f),function(_0x20c116){_0x20c116[_0x9784('0x4f')]=_0x5956ae['id'];_0x20c116[_0x9784('0x61')]=_0x19c591['id'];return _0x20c116;});return db[_0x9784('0x62')][_0x9784('0x63')](_0x21f38f,{'transaction':_0x52bffc})[_0x9784('0x26')](function(_0x3c45cd){if(!_0x3c45cd){return _0x5b8f98(_0x9784('0x64'));}else{return _0x2216bc(_0x3c45cd);}})[_0x9784('0x44')](function(_0x4a4779){return _0x5b8f98(_0x4a4779);});});;});};function addVoicePrefixExtensions(_0x19d39f,_0x5a2238){var _0x59c81f=[];var _0x195448=formatPrefixName(_0x19d39f['prefix']);_0x59c81f['push'](new Extension(_0x195448,0x2,'Set',_0x9784('0x65')+_0x19d39f[_0x9784('0x29')]));if(_0x19d39f[_0x9784('0x66')]){_0x59c81f[_0x9784('0x67')](new Extension(_0x195448,0x3,'Set','PREFIX-CALLERIDALL='+_0x19d39f['callerIdAll']));}else{_0x59c81f['push'](new Extension(_0x195448,0x3,_0x9784('0x68'),'No\x20callerid\x20available'));}_0x59c81f[_0x9784('0x67')](new Extension(_0x195448,0x4,'goto',_0x5a2238[_0x9784('0x69')]+','+_0x9784('0x6a')+(0x8+_0x19d39f[_0x9784('0x29')][_0x9784('0x47')])+'}'+','+0x1));return _0x59c81f;}function formatPrefixName(_0x2831ae){var _0xa89157='_';for(var _0x22e075=0x0;_0x22e075<_0x2831ae['length'];_0x22e075++){if(_0x2831ae[_0x9784('0x6b')](_0x22e075)=='-'){_0xa89157+=_0x2831ae[_0x9784('0x6b')](_0x22e075);}else{_0xa89157+='['+_0x2831ae[_0x9784('0x6b')](_0x22e075)+']';}}_0xa89157+='.';return _0xa89157;}exports[_0x9784('0x25')]=function(_0x11866d,_0x47e4ca,_0x41557c){var _0x2d2234=_0x11866d[_0x9784('0x6c')];_0x2d2234[_0x9784('0x5f')]='system-'+_0x2d2234[_0x9784('0x29')]+'-';return db[_0x9784('0x4c')]['transaction'](function(_0x8b6244){return db[_0x9784('0x2d')][_0x9784('0x25')](_0x2d2234,{'where':{'id':_0x2d2234['id']},'transaction':_0x8b6244})['then'](function(){return db[_0x9784('0x62')][_0x9784('0x27')]({'where':{'VoicePrefixId':_0x2d2234['id']},'transaction':_0x8b6244})[_0x9784('0x26')](function(){return db[_0x9784('0x62')][_0x9784('0x48')]({'where':{'id':_0x2d2234['VoiceExtensionId']},'raw':!![]})[_0x9784('0x26')](function(_0xa9350e){return createVoicePrefixExtensions(_0x2d2234,_0xa9350e,_0x8b6244);});});});})[_0x9784('0x26')](function(){return db[_0x9784('0x2d')][_0x9784('0x6d')](_0x2d2234['id']);})[_0x9784('0x26')](respondWithResult(_0x47e4ca,null))[_0x9784('0x44')](handleError(_0x47e4ca,null));};exports[_0x9784('0x6e')]=function(_0x4807c4,_0x2d4806,_0x3e45b5){return db[_0x9784('0x2d')][_0x9784('0x48')]({'where':{'id':_0x4807c4['params']['id']}})[_0x9784('0x26')](handleEntityNotFound(_0x2d4806,null))['then'](function(_0x354ab3){if(_0x354ab3){return _0x354ab3[_0x9784('0x6e')](_0x4807c4[_0x9784('0x6c')][_0x9784('0x6f')],_[_0x9784('0x70')](_0x4807c4[_0x9784('0x6c')],[_0x9784('0x6f'),'id'])||{})[_0x9784('0x71')](function(_0x52b06a){for(var _0x5c282a=0x0;_0x5c282a<_0x4807c4['body'][_0x9784('0x6f')]['length'];_0x5c282a+=0x1){socket[_0x9784('0x72')]('userVoicePrefix:save',{'UserId':_0x4807c4[_0x9784('0x6c')][_0x9784('0x6f')][_0x5c282a],'VoicePrefixId':_0x4807c4['params']['id']});}return _0x52b06a;});}})[_0x9784('0x26')](respondWithResult(_0x2d4806,null))['catch'](handleError(_0x2d4806,null));};exports[_0x9784('0x73')]=function(_0x1883db,_0x42b0e3,_0x4a5309){return db['VoicePrefix'][_0x9784('0x48')]({'where':{'id':_0x1883db['params']['id']}})[_0x9784('0x26')](handleEntityNotFound(_0x42b0e3,null))[_0x9784('0x26')](function(_0x75a195){if(_0x75a195){return _0x75a195[_0x9784('0x73')](_0x1883db['query'][_0x9784('0x6f')])[_0x9784('0x26')](function(){if(_[_0x9784('0x74')](_0x1883db[_0x9784('0x31')][_0x9784('0x6f')])){for(var _0x5571fe=0x0;_0x5571fe<_0x1883db['query'][_0x9784('0x6f')][_0x9784('0x47')];_0x5571fe+=0x1){socket[_0x9784('0x72')](_0x9784('0x75'),{'UserId':Number(_0x1883db['query']['ids'][_0x5571fe]),'VoicePrefixId':Number(_0x1883db[_0x9784('0x49')]['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x1883db['query'][_0x9784('0x6f')]),'VoicePrefixId':Number(_0x1883db[_0x9784('0x49')]['id'])});}});}})[_0x9784('0x26')](respondWithStatusCode(_0x42b0e3,null))['catch'](handleError(_0x42b0e3,null));};exports['getAgents']=function(_0x201c04,_0x48acb8,_0xb04f9d){var _0x551e3b={};var _0x26f5b6={};var _0x1f0203;var _0x5e8340;return db[_0x9784('0x2d')]['findOne']({'where':{'id':_0x201c04['params']['id']}})[_0x9784('0x26')](handleEntityNotFound(_0x48acb8,null))[_0x9784('0x26')](function(_0x5c952f){if(_0x5c952f){_0x1f0203=_0x5c952f;_0x26f5b6['model']=_[_0x9784('0x32')](db['User'][_0x9784('0x46')]);_0x26f5b6[_0x9784('0x31')]=_[_0x9784('0x32')](_0x201c04[_0x9784('0x31')]);_0x26f5b6[_0x9784('0x3d')]=_[_0x9784('0x33')](_0x26f5b6['model'],_0x26f5b6[_0x9784('0x31')]);_0x551e3b[_0x9784('0x35')]=_[_0x9784('0x33')](_0x26f5b6['model'],qs[_0x9784('0x36')](_0x201c04['query'][_0x9784('0x36')]));_0x551e3b['attributes']=_0x551e3b[_0x9784('0x35')][_0x9784('0x47')]?_0x551e3b[_0x9784('0x35')]:_0x26f5b6[_0x9784('0x34')];_0x551e3b[_0x9784('0x39')]=qs[_0x9784('0x3a')](_0x201c04[_0x9784('0x31')][_0x9784('0x3a')]);_0x551e3b['where']=qs[_0x9784('0x3d')](_[_0x9784('0x3c')](_0x201c04[_0x9784('0x31')],_0x26f5b6[_0x9784('0x3d')]));if(_0x201c04[_0x9784('0x31')]['filter']){_0x551e3b[_0x9784('0x3b')]=_[_0x9784('0x3f')](_0x551e3b[_0x9784('0x3b')],{'$or':_[_0x9784('0x2c')](_0x551e3b['attributes'],function(_0x370a06){var _0x26bc6b={};_0x26bc6b[_0x370a06]={'$like':'%'+_0x201c04[_0x9784('0x31')]['filter']+'%'};return _0x26bc6b;})});}_0x551e3b=_[_0x9784('0x3f')]({},_0x551e3b,_0x201c04[_0x9784('0x41')]);return _0x1f0203[_0x9784('0x76')](_0x551e3b);}})[_0x9784('0x26')](function(_0x4aa63c){if(_0x4aa63c){_0x5e8340=_0x4aa63c['length'];if(!_0x201c04[_0x9784('0x31')][_0x9784('0x37')](_0x9784('0x38'))){_0x551e3b['limit']=qs['limit'](_0x201c04['query'][_0x9784('0x20')]);_0x551e3b['offset']=qs[_0x9784('0x1f')](_0x201c04[_0x9784('0x31')][_0x9784('0x1f')]);}return _0x1f0203[_0x9784('0x76')](_0x551e3b);}})[_0x9784('0x26')](function(_0x5e0175){if(_0x5e0175){return _0x5e0175?{'count':_0x5e8340,'rows':_0x5e0175}:null;}})[_0x9784('0x26')](respondWithResult(_0x48acb8,null))[_0x9784('0x44')](handleError(_0x48acb8,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 8f39fc8..78c60ce 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 _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 +var _0x70e0=['emit','events','../../mysqldb','VoicePrefix','update','remove'];(function(_0x16737b,_0x52493f){var _0x4657c5=function(_0x95352c){while(--_0x95352c){_0x16737b['push'](_0x16737b['shift']());}};_0x4657c5(++_0x52493f);}(_0x70e0,0x17b));var _0x070e=function(_0x32e9c3,_0x3eb118){_0x32e9c3=_0x32e9c3-0x0;var _0xb6d703=_0x70e0[_0x32e9c3];return _0xb6d703;};'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 daf9c50..d4a0f7e 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 _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 +var _0x15c5=['moment','bluebird','request-promise','path','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','api'];(function(_0x49a525,_0x13dc6c){var _0x331bbd=function(_0x1df324){while(--_0x1df324){_0x49a525['push'](_0x49a525['shift']());}};_0x331bbd(++_0x13dc6c);}(_0x15c5,0x183));var _0x515c=function(_0x33975c,_0x50d085){_0x33975c=_0x33975c-0x0;var _0x1c15ab=_0x15c5[_0x33975c];return _0x1c15ab;};'use strict';var _=require(_0x515c('0x0'));var util=require(_0x515c('0x1'));var logger=require('../../config/logger')(_0x515c('0x2'));var moment=require(_0x515c('0x3'));var BPromise=require(_0x515c('0x4'));var rp=require(_0x515c('0x5'));var fs=require('fs');var path=require(_0x515c('0x6'));var rimraf=require('rimraf');var config=require(_0x515c('0x7'));var attributes=require(_0x515c('0x8'));module[_0x515c('0x9')]=function(_0x1c5f52,_0x46a4fc){return _0x1c5f52[_0x515c('0xa')](_0x515c('0xb'),attributes,{'tableName':_0x515c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 83ce321..839c606 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 _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 +var _0xbeec=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0x26a09d,_0x21aa2d){var _0x5c4fb4=function(_0x4672d7){while(--_0x4672d7){_0x26a09d['push'](_0x26a09d['shift']());}};_0x5c4fb4(++_0x21aa2d);}(_0xbeec,0xa6));var _0xcbee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbeec[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcbee('0x0'));var util=require(_0xcbee('0x1'));var moment=require(_0xcbee('0x2'));var BPromise=require(_0xcbee('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcbee('0x4'));var db=require(_0xcbee('0x5'))['db'];var utils=require(_0xcbee('0x6'));var logger=require(_0xcbee('0x7'))(_0xcbee('0x8'));var config=require(_0xcbee('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xcbee('0xa')][_0xcbee('0xb')]({'port':0x232a});config[_0xcbee('0xc')]=_[_0xcbee('0xd')](config[_0xcbee('0xc')],{'host':_0xcbee('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcbee('0xc')]));require(_0xcbee('0xf'))[_0xcbee('0x10')](socket);function respondWithRpcPromise(_0xe992fa,_0x1de7b2,_0x54c6f9){return new BPromise(function(_0x5bb960,_0x5bf757){return client[_0xcbee('0x11')](_0xe992fa,_0x54c6f9)[_0xcbee('0x12')](function(_0x222c34){logger['info'](_0xcbee('0x13'),_0x1de7b2,_0xcbee('0x14'));logger[_0xcbee('0x15')](_0xcbee('0x16'),_0x1de7b2,_0xcbee('0x14'),JSON['stringify'](_0x222c34));if(_0x222c34[_0xcbee('0x17')]){if(_0x222c34['error'][_0xcbee('0x18')]===0x1f4){logger[_0xcbee('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x1de7b2,_0x222c34['error'][_0xcbee('0x19')]);return _0x5bf757(_0x222c34[_0xcbee('0x17')][_0xcbee('0x19')]);}logger[_0xcbee('0x17')](_0xcbee('0x13'),_0x1de7b2,_0x222c34[_0xcbee('0x17')]['message']);return _0x5bb960(_0x222c34[_0xcbee('0x17')][_0xcbee('0x19')]);}else{logger['info'](_0xcbee('0x13'),_0x1de7b2,_0xcbee('0x14'));_0x5bb960(_0x222c34[_0xcbee('0x1a')][_0xcbee('0x19')]);}})[_0xcbee('0x1b')](function(_0x1faec8){logger[_0xcbee('0x17')](_0xcbee('0x13'),_0x1de7b2,_0x1faec8);_0x5bf757(_0x1faec8);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 8f3b148..e193678 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 _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 +var _0x36b1=['emit','length','voicePrefix:','./voicePrefix.events','save','remove','update'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x36b1,0xf1));var _0x136b=function(_0x31de53,_0x312fe3){_0x31de53=_0x31de53-0x0;var _0xbcb822=_0x36b1[_0x31de53];return _0xbcb822;};'use strict';var VoicePrefixEvents=require(_0x136b('0x0'));var events=[_0x136b('0x1'),_0x136b('0x2'),_0x136b('0x3')];function createListener(_0x2a1dbe,_0x449b94){return function(_0x135f46){_0x449b94[_0x136b('0x4')](_0x2a1dbe,_0x135f46);};}function removeListener(_0x2a5816,_0x3efc18){return function(){VoicePrefixEvents['removeListener'](_0x2a5816,_0x3efc18);};}exports['register']=function(_0x16e221){for(var _0x3728ff=0x0,_0x26ac2d=events[_0x136b('0x5')];_0x3728ff<_0x26ac2d;_0x3728ff++){var _0x578b68=events[_0x3728ff];var _0x3936e6=createListener(_0x136b('0x6')+_0x578b68,_0x16e221);VoicePrefixEvents['on'](_0x578b68,_0x3936e6);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index afdd897..916d70f 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 _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 +var _0x257d=['post','clone','addTeams','addLists','addBlackLists','put','/:id','update','destroy','delete','removeTeams','/:id/users','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','/:id/hoppers','isAuthenticated','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/members','/:id/lists','getLists','/:id/blacklists'];(function(_0x35d033,_0xf6140c){var _0x257ed1=function(_0x1d9927){while(--_0x1d9927){_0x35d033['push'](_0x35d033['shift']());}};_0x257ed1(++_0xf6140c);}(_0x257d,0x1e3));var _0xd257=function(_0x3bed60,_0x4e259e){_0x3bed60=_0x3bed60-0x0;var _0x179779=_0x257d[_0x3bed60];return _0x179779;};'use strict';var multer=require(_0xd257('0x0'));var util=require(_0xd257('0x1'));var path=require(_0xd257('0x2'));var timeout=require(_0xd257('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xd257('0x4'));var interaction=require(_0xd257('0x5'));var config=require(_0xd257('0x6'));var controller=require('./voiceQueue.controller');router[_0xd257('0x7')]('/',auth['isAuthenticated'](),controller[_0xd257('0x8')]);router[_0xd257('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xd257('0x9')]);router[_0xd257('0x7')](_0xd257('0xa'),auth[_0xd257('0xb')](),controller[_0xd257('0xc')]);router[_0xd257('0x7')](_0xd257('0xd'),auth['isAuthenticated'](),controller[_0xd257('0xe')]);router[_0xd257('0x7')](_0xd257('0xf'),auth[_0xd257('0xb')](),controller['getHopperFinals']);router[_0xd257('0x7')](_0xd257('0x10'),auth['isAuthenticated'](),controller[_0xd257('0x11')]);router[_0xd257('0x7')](_0xd257('0x12'),auth[_0xd257('0xb')](),controller[_0xd257('0x13')]);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xd257('0x7')](_0xd257('0x14'),auth[_0xd257('0xb')](),controller['getMembers']);router[_0xd257('0x7')](_0xd257('0x15'),auth['isAuthenticated'](),controller[_0xd257('0x16')]);router[_0xd257('0x7')](_0xd257('0x17'),auth[_0xd257('0xb')](),controller['getBlackLists']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xd257('0x18')]('/:id/clone',auth[_0xd257('0xb')](),controller[_0xd257('0x19')]);router[_0xd257('0x18')](_0xd257('0x12'),auth['isAuthenticated'](),controller[_0xd257('0x1a')]);router[_0xd257('0x18')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router['post'](_0xd257('0x15'),auth[_0xd257('0xb')](),controller[_0xd257('0x1b')]);router[_0xd257('0x18')]('/:id/blacklists',auth[_0xd257('0xb')](),controller[_0xd257('0x1c')]);router[_0xd257('0x1d')](_0xd257('0x1e'),auth[_0xd257('0xb')](),controller[_0xd257('0x1f')]);router['delete'](_0xd257('0x1e'),auth[_0xd257('0xb')](),controller[_0xd257('0x20')]);router[_0xd257('0x21')](_0xd257('0x12'),auth['isAuthenticated'](),controller[_0xd257('0x22')]);router[_0xd257('0x21')](_0xd257('0x23'),auth[_0xd257('0xb')](),controller['removeAgents']);router[_0xd257('0x21')](_0xd257('0x15'),auth[_0xd257('0xb')](),controller[_0xd257('0x24')]);router['delete'](_0xd257('0x17'),auth[_0xd257('0xb')](),controller[_0xd257('0x25')]);module[_0xd257('0x26')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 30b659b..4eb8f30 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(_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 +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(_0x46b573,_0x388f6d){var _0x3bcf35=function(_0x531d44){while(--_0x531d44){_0x46b573['push'](_0x46b573['shift']());}};_0x3bcf35(++_0x388f6d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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 12a9e1b..9d6cc7b 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 _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 +var _0x59d5=['update','then','destroy','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','UserProfileResource','error','stack','name','send','index','VoiceQueue','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','merge','VIRTUAL','options','where','includeAll','findAll','rows','show','params','keys','include','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','clone','rawAttributes','omit','createdAt','updatedAt','body','user','role','userProfileId','getHoppers','findOne','CmHopper','nolimit','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','VoiceQueueId','getHopperBlacks','CmHopperBlack','getTeams','teams','Team','User','Agents','voicePause','interface','forEach','penalty','sequelize','transaction','addTeams','findOrCreate','each','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','emit','userVoiceQueue:save','ids','select','field','tq.TeamId','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','every','TeamId','union','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','online','all','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','insert','COALESCE(phone,\x27\x27)','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceQueue.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','save'];(function(_0x2b690f,_0x6d53c7){var _0x4414b7=function(_0x2f880b){while(--_0x2f880b){_0x2b690f['push'](_0x2b690f['shift']());}};_0x4414b7(++_0x6d53c7);}(_0x59d5,0x92));var _0x559d=function(_0x12b436,_0x331e1c){_0x12b436=_0x12b436-0x0;var _0x1b56d3=_0x59d5[_0x12b436];return _0x1b56d3;};'use strict';var pdf=require(_0x559d('0x0'));var emlformat=require(_0x559d('0x1'));var rimraf=require(_0x559d('0x2'));var zipdir=require(_0x559d('0x3'));var jsonpatch=require(_0x559d('0x4'));var rp=require(_0x559d('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x559d('0x6'));var util=require(_0x559d('0x7'));var path=require(_0x559d('0x8'));var sox=require('sox');var csv=require(_0x559d('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x559d('0xa'));var squel=require(_0x559d('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x559d('0xc'));var toCsv=require(_0x559d('0x9'));var querystring=require(_0x559d('0xd'));var Papa=require(_0x559d('0xe'));var Redis=require(_0x559d('0xf'));var authService=require(_0x559d('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x559d('0x11'));var logger=require(_0x559d('0x12'))(_0x559d('0x13'));var utils=require(_0x559d('0x14'));var config=require(_0x559d('0x15'));var db=require(_0x559d('0x16'))['db'];config[_0x559d('0x17')]=_[_0x559d('0x18')](config[_0x559d('0x17')],{'host':_0x559d('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x559d('0x17')]));require(_0x559d('0x1a'))[_0x559d('0x1b')](socket);function respondWithStatusCode(_0x4b3a7a,_0x53ac4e){_0x53ac4e=_0x53ac4e||0xcc;return function(_0x13cf14){if(_0x13cf14){return _0x4b3a7a[_0x559d('0x1c')](_0x53ac4e);}return _0x4b3a7a[_0x559d('0x1d')](_0x53ac4e)[_0x559d('0x1e')]();};}function respondWithResult(_0x11504c,_0x8b9341){_0x8b9341=_0x8b9341||0xc8;return function(_0x17d201){if(_0x17d201){return _0x11504c[_0x559d('0x1d')](_0x8b9341)['json'](_0x17d201);}};}function respondWithFilteredResult(_0x5d8869,_0x4d7ca6){return function(_0x2ea660){if(_0x2ea660){var _0x2355db=_0x2ea660[_0x559d('0x1f')],_0x3d2615=_0x4d7ca6[_0x559d('0x20')],_0x5a2a50=_0x4d7ca6[_0x559d('0x20')]+_0x4d7ca6[_0x559d('0x21')],_0x5d22a9;if(_0x5a2a50>=_0x2355db){_0x5a2a50=_0x2355db;_0x5d22a9=0xc8;}else{_0x5d22a9=0xce;}_0x5d8869[_0x559d('0x1d')](_0x5d22a9);return _0x5d8869[_0x559d('0x22')](_0x559d('0x23'),_0x3d2615+'-'+_0x5a2a50+'/'+_0x2355db)['json'](_0x2ea660);}return null;};}function patchUpdates(_0x4233b7){return function(_0xe79795){try{jsonpatch['apply'](_0xe79795,_0x4233b7,!![]);}catch(_0x580222){return BPromise[_0x559d('0x24')](_0x580222);}return _0xe79795[_0x559d('0x25')]();};}function saveUpdates(_0x55a877,_0x1c543e){return function(_0x3bd8f5){if(_0x3bd8f5){return _0x3bd8f5[_0x559d('0x26')](_0x55a877)[_0x559d('0x27')](function(_0x2c3e46){return _0x2c3e46;});}return null;};}function removeEntity(_0xf0b15a,_0x48e913){return function(_0x3b4d99){if(_0x3b4d99){return _0x3b4d99[_0x559d('0x28')]()['then'](function(){var _0x34f464=_0x3b4d99['get']({'plain':!![]});var _0x3ca96a=[{'name':_0x559d('0x29'),'value':_0x559d('0x2a'),'ignore':![]},{'name':_0x559d('0x2b'),'value':_0x559d('0x2c'),'ignore':![]}];var _0x29a941=_(_0x3ca96a)[_0x559d('0x2d')](_0x559d('0x2e'))[_0x559d('0x2f')](_0x559d('0x30'))[_0x559d('0x30')]();if(_[_0x559d('0x31')](_0x29a941,_0x34f464[_0x559d('0x32')])){return;}var _0x497cab=_[_0x559d('0x33')](_0x3ca96a,['value',_0x34f464[_0x559d('0x32')]])['name'];return db[_0x559d('0x34')][_0x559d('0x28')]({'where':{'type':_0x497cab,'resourceId':_0x34f464['id']}})[_0x559d('0x27')](function(){return _0x3b4d99;});})[_0x559d('0x27')](function(){_0xf0b15a['status'](0xcc)[_0x559d('0x1e')]();});}};}function handleEntityNotFound(_0x5be131,_0x1a0f58){return function(_0x29aa2d){if(!_0x29aa2d){_0x5be131[_0x559d('0x1c')](0x194);}return _0x29aa2d;};}function handleError(_0x466c10,_0x3fde1e){_0x3fde1e=_0x3fde1e||0x1f4;return function(_0x1e0f75){logger[_0x559d('0x35')](_0x1e0f75[_0x559d('0x36')]);if(_0x1e0f75['name']){delete _0x1e0f75[_0x559d('0x37')];}_0x466c10['status'](_0x3fde1e)[_0x559d('0x38')](_0x1e0f75);};}exports[_0x559d('0x39')]=function(_0x49582b,_0x4bdf38){var _0x30a59b={},_0x38ee06={},_0x56ecba={'count':0x0,'rows':[]};var _0x19626c=_['map'](db[_0x559d('0x3a')]['rawAttributes'],function(_0x5053a7){return{'name':_0x5053a7[_0x559d('0x3b')],'type':_0x5053a7[_0x559d('0x32')][_0x559d('0x3c')]};});_0x38ee06[_0x559d('0x3d')]=_[_0x559d('0x2f')](_0x19626c,_0x559d('0x37'));_0x38ee06['query']=_['keys'](_0x49582b[_0x559d('0x3e')]);_0x38ee06[_0x559d('0x3f')]=_[_0x559d('0x40')](_0x38ee06['model'],_0x38ee06[_0x559d('0x3e')]);_0x30a59b[_0x559d('0x41')]=_['intersection'](_0x38ee06[_0x559d('0x3d')],qs[_0x559d('0x42')](_0x49582b[_0x559d('0x3e')][_0x559d('0x42')]));_0x30a59b[_0x559d('0x41')]=_0x30a59b[_0x559d('0x41')][_0x559d('0x43')]?_0x30a59b['attributes']:_0x38ee06[_0x559d('0x3d')];if(!_0x49582b[_0x559d('0x3e')][_0x559d('0x44')]('nolimit')){_0x30a59b['limit']=qs[_0x559d('0x21')](_0x49582b['query'][_0x559d('0x21')]);_0x30a59b[_0x559d('0x20')]=qs['offset'](_0x49582b['query'][_0x559d('0x20')]);}_0x30a59b[_0x559d('0x45')]=qs[_0x559d('0x46')](_0x49582b[_0x559d('0x3e')]['sort']);_0x30a59b['where']=qs[_0x559d('0x3f')](_[_0x559d('0x47')](_0x49582b[_0x559d('0x3e')],_0x38ee06[_0x559d('0x3f')]),_0x19626c);if(_0x49582b[_0x559d('0x3e')][_0x559d('0x2d')]){_0x30a59b['where']=_[_0x559d('0x48')](_0x30a59b['where'],{'$or':_[_0x559d('0x2f')](_0x19626c,function(_0xaa121){if(_0xaa121[_0x559d('0x32')]!==_0x559d('0x49')){var _0x106ce5={};_0x106ce5[_0xaa121[_0x559d('0x37')]]={'$like':'%'+_0x49582b['query'][_0x559d('0x2d')]+'%'};return _0x106ce5;}})});}_0x30a59b=_[_0x559d('0x48')]({},_0x30a59b,_0x49582b[_0x559d('0x4a')]);var _0x2d8e9c={'where':_0x30a59b[_0x559d('0x4b')]};return db[_0x559d('0x3a')][_0x559d('0x1f')](_0x2d8e9c)[_0x559d('0x27')](function(_0x25b243){_0x56ecba[_0x559d('0x1f')]=_0x25b243;if(_0x49582b[_0x559d('0x3e')][_0x559d('0x4c')]){_0x30a59b['include']=[{'all':!![]}];}return db[_0x559d('0x3a')][_0x559d('0x4d')](_0x30a59b);})[_0x559d('0x27')](function(_0x474059){_0x56ecba[_0x559d('0x4e')]=_0x474059;return _0x56ecba;})[_0x559d('0x27')](respondWithFilteredResult(_0x4bdf38,_0x30a59b))['catch'](handleError(_0x4bdf38,null));};exports[_0x559d('0x4f')]=function(_0x41c0a5,_0x11b01e){var _0x42f179={'raw':![],'where':{'id':_0x41c0a5[_0x559d('0x50')]['id']}},_0x22cbf7={};_0x22cbf7['model']=_[_0x559d('0x51')](db[_0x559d('0x3a')]['rawAttributes']);_0x22cbf7['query']=_[_0x559d('0x51')](_0x41c0a5['query']);_0x22cbf7['filters']=_[_0x559d('0x40')](_0x22cbf7['model'],_0x22cbf7[_0x559d('0x3e')]);_0x42f179[_0x559d('0x41')]=_[_0x559d('0x40')](_0x22cbf7['model'],qs[_0x559d('0x42')](_0x41c0a5[_0x559d('0x3e')][_0x559d('0x42')]));_0x42f179[_0x559d('0x41')]=_0x42f179[_0x559d('0x41')][_0x559d('0x43')]?_0x42f179[_0x559d('0x41')]:_0x22cbf7['model'];if(_0x41c0a5[_0x559d('0x3e')][_0x559d('0x4c')]){_0x42f179[_0x559d('0x52')]=[{'all':!![]}];}_0x42f179=_[_0x559d('0x48')]({},_0x42f179,_0x41c0a5[_0x559d('0x4a')]);return db[_0x559d('0x3a')]['find'](_0x42f179)[_0x559d('0x27')](handleEntityNotFound(_0x11b01e,null))['then'](respondWithResult(_0x11b01e,null))[_0x559d('0x53')](handleError(_0x11b01e,null));};exports[_0x559d('0x54')]=function(_0x589465,_0x11de13){return db[_0x559d('0x3a')][_0x559d('0x54')](_0x589465['body'],{})['then'](function(_0x140aa9){var _0x5a1b25=_0x589465['user'][_0x559d('0x55')]({'plain':!![]});if(!_0x5a1b25)throw new Error(_0x559d('0x56'));if(_0x5a1b25['role']==='user'){var _0x31a239=_0x140aa9[_0x559d('0x55')]({'plain':!![]});var _0x44b18a=[{'name':_0x559d('0x29'),'value':_0x559d('0x2a')},{'name':_0x559d('0x2b'),'value':'outbound'}];var _0xaabb1c=_[_0x559d('0x33')](_0x44b18a,[_0x559d('0x30'),_0x31a239[_0x559d('0x32')]])['name'];return db[_0x559d('0x57')][_0x559d('0x33')]({'where':{'name':_0xaabb1c,'userProfileId':_0x5a1b25['userProfileId']},'raw':!![]})['then'](function(_0x3056b9){if(_0x3056b9&&_0x3056b9[_0x559d('0x58')]===0x0){return db[_0x559d('0x34')][_0x559d('0x54')]({'name':_0x31a239[_0x559d('0x37')],'resourceId':_0x31a239['id'],'type':_0x3056b9['name'],'sectionId':_0x3056b9['id']},{})[_0x559d('0x27')](function(){return _0x140aa9;});}else{return _0x140aa9;}})[_0x559d('0x53')](function(_0x58a703){logger[_0x559d('0x35')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x58a703);throw _0x58a703;});}return _0x140aa9;})['then'](respondWithResult(_0x11de13,0xc9))[_0x559d('0x53')](handleError(_0x11de13,null));};exports[_0x559d('0x59')]=function(_0x21fd92,_0x2c5dc2){var _0x5c39fc={'where':{'id':_0x21fd92[_0x559d('0x50')]['id']}},_0x2021f6={};_0x2021f6['model']=_['keys'](db['VoiceQueue'][_0x559d('0x5a')]);_0x5c39fc['attributes']=_['intersection'](_0x2021f6[_0x559d('0x3d')],qs[_0x559d('0x42')](_0x21fd92[_0x559d('0x3e')][_0x559d('0x42')]));_0x5c39fc['attributes']=_0x5c39fc['attributes'][_0x559d('0x43')]?_0x5c39fc['attributes']:_0x2021f6['model'];if(_0x21fd92[_0x559d('0x3e')][_0x559d('0x4c')]){_0x5c39fc[_0x559d('0x52')]=[{'all':!![]}];}_0x5c39fc=_['merge']({},_0x5c39fc,_0x21fd92['options']);return db[_0x559d('0x3a')][_0x559d('0x33')](_0x5c39fc)[_0x559d('0x27')](handleEntityNotFound(_0x2c5dc2,null))[_0x559d('0x27')](function(_0x406808){if(_0x406808){var _0x449097=_0x406808[_0x559d('0x55')]({'plain':!![]});_0x449097=qs[_0x559d('0x5b')](_0x449097,['id',_0x559d('0x5c'),_0x559d('0x5d')]);_0x21fd92[_0x559d('0x5e')]=_['omit'](_0x21fd92[_0x559d('0x5e')],['id',_0x559d('0x5c'),_0x559d('0x5d')]);return db[_0x559d('0x3a')]['create'](_[_0x559d('0x48')](_0x449097,_0x21fd92['body']),{'include':_0x21fd92['query']['includeAll']?[{'all':!![]}]:undefined})[_0x559d('0x27')](function(_0x6455ff){var _0x148353=_0x21fd92[_0x559d('0x5f')][_0x559d('0x55')]({'plain':!![]});if(!_0x148353)throw new Error(_0x559d('0x56'));if(_0x148353[_0x559d('0x60')]===_0x559d('0x5f')){var _0x3173a9=_0x6455ff[_0x559d('0x55')]({'plain':!![]});var _0x25fd60=[{'name':_0x559d('0x29'),'value':_0x559d('0x2a')},{'name':_0x559d('0x2b'),'value':'outbound'}];var _0x11797e=_[_0x559d('0x33')](_0x25fd60,[_0x559d('0x30'),_0x3173a9['type']])[_0x559d('0x37')];return db[_0x559d('0x57')][_0x559d('0x33')]({'where':{'name':_0x11797e,'userProfileId':_0x148353[_0x559d('0x61')]},'raw':!![]})[_0x559d('0x27')](function(_0x164133){if(_0x164133&&_0x164133[_0x559d('0x58')]===0x0){return db[_0x559d('0x34')][_0x559d('0x54')]({'name':_0x3173a9['name'],'resourceId':_0x3173a9['id'],'type':_0x164133[_0x559d('0x37')],'sectionId':_0x164133['id']},{})[_0x559d('0x27')](function(){return _0x6455ff;});}else{return _0x6455ff;}})[_0x559d('0x53')](function(_0x2af95e){logger[_0x559d('0x35')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2af95e);throw _0x2af95e;});}return _0x6455ff;});}})['then'](respondWithResult(_0x2c5dc2,0xc9))[_0x559d('0x53')](handleError(_0x2c5dc2,null));};exports[_0x559d('0x26')]=function(_0x5a41a0,_0x4055f9){if(_0x5a41a0[_0x559d('0x5e')]['id']){delete _0x5a41a0[_0x559d('0x5e')]['id'];}return db[_0x559d('0x3a')][_0x559d('0x33')]({'where':{'id':_0x5a41a0[_0x559d('0x50')]['id']}})[_0x559d('0x27')](handleEntityNotFound(_0x4055f9,null))[_0x559d('0x27')](saveUpdates(_0x5a41a0[_0x559d('0x5e')],null))[_0x559d('0x27')](respondWithResult(_0x4055f9,null))[_0x559d('0x53')](handleError(_0x4055f9,null));};exports[_0x559d('0x28')]=function(_0x2dff33,_0x56cacc){return db['VoiceQueue'][_0x559d('0x33')]({'where':{'id':_0x2dff33['params']['id']}})[_0x559d('0x27')](handleEntityNotFound(_0x56cacc,null))['then'](removeEntity(_0x56cacc,null))[_0x559d('0x53')](handleError(_0x56cacc,null));};exports[_0x559d('0x62')]=function(_0x36e1e3,_0x5c59c8,_0x2249f0){var _0x5c5211={'raw':![],'where':{}};var _0x546da0={};var _0x484aed={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x559d('0x63')]({'where':{'id':_0x36e1e3[_0x559d('0x50')]['id']}})[_0x559d('0x27')](handleEntityNotFound(_0x5c59c8,null))[_0x559d('0x27')](function(_0x5886fb){if(_0x5886fb){_0x546da0['model']=_['keys'](db[_0x559d('0x64')][_0x559d('0x5a')]);_0x546da0[_0x559d('0x3e')]=_[_0x559d('0x51')](_0x36e1e3[_0x559d('0x3e')]);_0x546da0[_0x559d('0x3f')]=_[_0x559d('0x40')](_0x546da0[_0x559d('0x3d')],_0x546da0[_0x559d('0x3e')]);_0x5c5211[_0x559d('0x41')]=_[_0x559d('0x40')](_0x546da0[_0x559d('0x3d')],qs[_0x559d('0x42')](_0x36e1e3[_0x559d('0x3e')][_0x559d('0x42')]));_0x5c5211[_0x559d('0x41')]=_0x5c5211[_0x559d('0x41')][_0x559d('0x43')]?_0x5c5211[_0x559d('0x41')]:_0x546da0[_0x559d('0x3d')];if(!_0x36e1e3['query'][_0x559d('0x44')](_0x559d('0x65'))){_0x5c5211[_0x559d('0x21')]=qs[_0x559d('0x21')](_0x36e1e3[_0x559d('0x3e')][_0x559d('0x21')]);_0x5c5211[_0x559d('0x20')]=qs[_0x559d('0x20')](_0x36e1e3[_0x559d('0x3e')]['offset']);}_0x5c5211['order']=qs[_0x559d('0x46')](_0x36e1e3[_0x559d('0x3e')][_0x559d('0x46')]);_0x5c5211[_0x559d('0x4b')]=qs['filters'](_[_0x559d('0x47')](_0x36e1e3[_0x559d('0x3e')],_0x546da0[_0x559d('0x3f')]));_0x5c5211[_0x559d('0x4b')]['VoiceQueueId']=_0x5886fb['id'];if(_0x36e1e3[_0x559d('0x3e')]['filter']){_0x5c5211[_0x559d('0x4b')]=_[_0x559d('0x48')](_0x5c5211[_0x559d('0x4b')],{'$or':_[_0x559d('0x2f')](_0x5c5211[_0x559d('0x41')],function(_0x53c3fc){var _0x3b7b3b={};_0x3b7b3b[_0x53c3fc]={'$like':'%'+_0x36e1e3[_0x559d('0x3e')][_0x559d('0x2d')]+'%'};return _0x3b7b3b;})});}_0x5c5211=_[_0x559d('0x48')]({},_0x5c5211,_0x36e1e3[_0x559d('0x4a')]);return db[_0x559d('0x64')][_0x559d('0x1f')]({'where':_0x5c5211[_0x559d('0x4b')]})[_0x559d('0x27')](function(_0x380411){_0x484aed[_0x559d('0x1f')]=_0x380411;if(_0x36e1e3[_0x559d('0x3e')]['includeAll']){_0x5c5211[_0x559d('0x52')]=[{'all':!![]}];}return db['CmHopper'][_0x559d('0x4d')](_0x5c5211);})['then'](function(_0x52fd3c){_0x484aed['rows']=_0x52fd3c;return _0x484aed;});}})[_0x559d('0x27')](respondWithFilteredResult(_0x5c59c8,_0x5c5211))['catch'](handleError(_0x5c59c8,null));};exports[_0x559d('0x66')]=function(_0x3e43e1,_0x233232,_0x4fab64){var _0x1cc954={'raw':!![],'where':{}};var _0x347dc2={};var _0x5b079b={'count':0x0,'rows':[]};return db[_0x559d('0x3a')][_0x559d('0x63')]({'where':{'id':_0x3e43e1['params']['id']}})[_0x559d('0x27')](handleEntityNotFound(_0x233232,null))['then'](function(_0x5d1bd1){if(_0x5d1bd1){_0x347dc2['model']=_[_0x559d('0x51')](db['CmHopperHistory']['rawAttributes']);_0x347dc2[_0x559d('0x3e')]=_[_0x559d('0x51')](_0x3e43e1['query']);_0x347dc2[_0x559d('0x3f')]=_[_0x559d('0x40')](_0x347dc2[_0x559d('0x3d')],_0x347dc2[_0x559d('0x3e')]);_0x1cc954[_0x559d('0x41')]=_['intersection'](_0x347dc2[_0x559d('0x3d')],qs[_0x559d('0x42')](_0x3e43e1[_0x559d('0x3e')][_0x559d('0x42')]));_0x1cc954['attributes']=_0x1cc954[_0x559d('0x41')][_0x559d('0x43')]?_0x1cc954['attributes']:_0x347dc2[_0x559d('0x3d')];if(!_0x3e43e1[_0x559d('0x3e')][_0x559d('0x44')](_0x559d('0x65'))){_0x1cc954[_0x559d('0x21')]=qs[_0x559d('0x21')](_0x3e43e1['query'][_0x559d('0x21')]);_0x1cc954['offset']=qs[_0x559d('0x20')](_0x3e43e1[_0x559d('0x3e')][_0x559d('0x20')]);}_0x1cc954[_0x559d('0x45')]=qs[_0x559d('0x46')](_0x3e43e1[_0x559d('0x3e')][_0x559d('0x46')]);_0x1cc954[_0x559d('0x4b')]=qs[_0x559d('0x3f')](_['pick'](_0x3e43e1[_0x559d('0x3e')],_0x347dc2['filters']));_0x1cc954[_0x559d('0x4b')]['VoiceQueueId']=_0x5d1bd1['id'];if(_0x3e43e1['query'][_0x559d('0x2d')]){_0x1cc954[_0x559d('0x4b')]=_[_0x559d('0x48')](_0x1cc954['where'],{'$or':_[_0x559d('0x2f')](_0x1cc954['attributes'],function(_0x36ad11){var _0x5973ba={};_0x5973ba[_0x36ad11]={'$like':'%'+_0x3e43e1[_0x559d('0x3e')][_0x559d('0x2d')]+'%'};return _0x5973ba;})});}_0x1cc954=_['merge']({},_0x1cc954,_0x3e43e1[_0x559d('0x4a')]);return db[_0x559d('0x67')][_0x559d('0x1f')]({'where':_0x1cc954['where']})['then'](function(_0x422198){_0x5b079b[_0x559d('0x1f')]=_0x422198;if(_0x3e43e1[_0x559d('0x3e')][_0x559d('0x4c')]){_0x1cc954[_0x559d('0x52')]=[{'all':!![]}];}return db[_0x559d('0x67')][_0x559d('0x4d')](_0x1cc954);})[_0x559d('0x27')](function(_0x1dd24a){_0x5b079b['rows']=_0x1dd24a;return _0x5b079b;});}})['then'](respondWithFilteredResult(_0x233232,_0x1cc954))[_0x559d('0x53')](handleError(_0x233232,null));};exports[_0x559d('0x68')]=function(_0x2b364f,_0x2659cd,_0x39023c){var _0x1ee44a={'raw':!![],'where':{}};var _0x5ad576={};var _0xc9fada={'count':0x0,'rows':[]};return db[_0x559d('0x3a')]['findOne']({'where':{'id':_0x2b364f[_0x559d('0x50')]['id']}})[_0x559d('0x27')](handleEntityNotFound(_0x2659cd,null))['then'](function(_0x15564a){if(_0x15564a){_0x5ad576[_0x559d('0x3d')]=_['keys'](db[_0x559d('0x69')]['rawAttributes']);_0x5ad576[_0x559d('0x3e')]=_[_0x559d('0x51')](_0x2b364f[_0x559d('0x3e')]);_0x5ad576[_0x559d('0x3f')]=_[_0x559d('0x40')](_0x5ad576['model'],_0x5ad576[_0x559d('0x3e')]);_0x1ee44a[_0x559d('0x41')]=_[_0x559d('0x40')](_0x5ad576[_0x559d('0x3d')],qs[_0x559d('0x42')](_0x2b364f['query'][_0x559d('0x42')]));_0x1ee44a[_0x559d('0x41')]=_0x1ee44a[_0x559d('0x41')][_0x559d('0x43')]?_0x1ee44a['attributes']:_0x5ad576['model'];if(!_0x2b364f[_0x559d('0x3e')]['hasOwnProperty'](_0x559d('0x65'))){_0x1ee44a[_0x559d('0x21')]=qs[_0x559d('0x21')](_0x2b364f[_0x559d('0x3e')][_0x559d('0x21')]);_0x1ee44a[_0x559d('0x20')]=qs[_0x559d('0x20')](_0x2b364f[_0x559d('0x3e')]['offset']);}_0x1ee44a[_0x559d('0x45')]=qs[_0x559d('0x46')](_0x2b364f[_0x559d('0x3e')][_0x559d('0x46')]);_0x1ee44a['where']=qs[_0x559d('0x3f')](_['pick'](_0x2b364f[_0x559d('0x3e')],_0x5ad576['filters']));_0x1ee44a['where'][_0x559d('0x6a')]=_0x15564a['id'];if(_0x2b364f[_0x559d('0x3e')][_0x559d('0x2d')]){_0x1ee44a[_0x559d('0x4b')]=_[_0x559d('0x48')](_0x1ee44a[_0x559d('0x4b')],{'$or':_['map'](_0x1ee44a[_0x559d('0x41')],function(_0x3dbf73){var _0x370c1f={};_0x370c1f[_0x3dbf73]={'$like':'%'+_0x2b364f[_0x559d('0x3e')]['filter']+'%'};return _0x370c1f;})});}_0x1ee44a=_[_0x559d('0x48')]({},_0x1ee44a,_0x2b364f[_0x559d('0x4a')]);return db['CmHopperFinal'][_0x559d('0x1f')]({'where':_0x1ee44a[_0x559d('0x4b')]})['then'](function(_0x19cee7){_0xc9fada['count']=_0x19cee7;if(_0x2b364f[_0x559d('0x3e')][_0x559d('0x4c')]){_0x1ee44a[_0x559d('0x52')]=[{'all':!![]}];}return db[_0x559d('0x69')][_0x559d('0x4d')](_0x1ee44a);})[_0x559d('0x27')](function(_0x194b0b){_0xc9fada[_0x559d('0x4e')]=_0x194b0b;return _0xc9fada;});}})[_0x559d('0x27')](respondWithFilteredResult(_0x2659cd,_0x1ee44a))['catch'](handleError(_0x2659cd,null));};exports[_0x559d('0x6b')]=function(_0x337bee,_0x28495e,_0xc63521){var _0x361008={'raw':!![],'where':{}};var _0x3efa91={};var _0x50b0f9={'count':0x0,'rows':[]};return db[_0x559d('0x3a')][_0x559d('0x63')]({'where':{'id':_0x337bee['params']['id']}})[_0x559d('0x27')](handleEntityNotFound(_0x28495e,null))[_0x559d('0x27')](function(_0x54fd2c){if(_0x54fd2c){_0x3efa91['model']=_[_0x559d('0x51')](db[_0x559d('0x6c')][_0x559d('0x5a')]);_0x3efa91['query']=_[_0x559d('0x51')](_0x337bee[_0x559d('0x3e')]);_0x3efa91['filters']=_[_0x559d('0x40')](_0x3efa91[_0x559d('0x3d')],_0x3efa91[_0x559d('0x3e')]);_0x361008[_0x559d('0x41')]=_['intersection'](_0x3efa91[_0x559d('0x3d')],qs[_0x559d('0x42')](_0x337bee[_0x559d('0x3e')][_0x559d('0x42')]));_0x361008[_0x559d('0x41')]=_0x361008['attributes']['length']?_0x361008[_0x559d('0x41')]:_0x3efa91[_0x559d('0x3d')];if(!_0x337bee[_0x559d('0x3e')][_0x559d('0x44')](_0x559d('0x65'))){_0x361008[_0x559d('0x21')]=qs['limit'](_0x337bee[_0x559d('0x3e')]['limit']);_0x361008[_0x559d('0x20')]=qs['offset'](_0x337bee[_0x559d('0x3e')]['offset']);}_0x361008[_0x559d('0x45')]=qs[_0x559d('0x46')](_0x337bee[_0x559d('0x3e')]['sort']);_0x361008['where']=qs[_0x559d('0x3f')](_[_0x559d('0x47')](_0x337bee[_0x559d('0x3e')],_0x3efa91[_0x559d('0x3f')]));_0x361008[_0x559d('0x4b')]['VoiceQueueId']=_0x54fd2c['id'];if(_0x337bee[_0x559d('0x3e')][_0x559d('0x2d')]){_0x361008[_0x559d('0x4b')]=_[_0x559d('0x48')](_0x361008[_0x559d('0x4b')],{'$or':_[_0x559d('0x2f')](_0x361008['attributes'],function(_0x59a1d8){var _0x3cb995={};_0x3cb995[_0x59a1d8]={'$like':'%'+_0x337bee['query']['filter']+'%'};return _0x3cb995;})});}_0x361008=_[_0x559d('0x48')]({},_0x361008,_0x337bee['options']);return db[_0x559d('0x6c')][_0x559d('0x1f')]({'where':_0x361008['where']})[_0x559d('0x27')](function(_0x4d0aa0){_0x50b0f9['count']=_0x4d0aa0;if(_0x337bee[_0x559d('0x3e')][_0x559d('0x4c')]){_0x361008[_0x559d('0x52')]=[{'all':!![]}];}return db[_0x559d('0x6c')][_0x559d('0x4d')](_0x361008);})[_0x559d('0x27')](function(_0xc08a21){_0x50b0f9[_0x559d('0x4e')]=_0xc08a21;return _0x50b0f9;});}})['then'](respondWithFilteredResult(_0x28495e,_0x361008))['catch'](handleError(_0x28495e,null));};exports[_0x559d('0x6d')]=function(_0x40dffc,_0x3d9953,_0x5d6c0b){var _0x1583bc={};var _0x3f2a4d={};var _0xb7f5f3;var _0x22bcf6;return db[_0x559d('0x3a')]['findOne']({'where':{'id':_0x40dffc[_0x559d('0x50')]['id']}})[_0x559d('0x27')](handleEntityNotFound(_0x3d9953,null))['then'](function(_0x346ce9){if(_0x346ce9){_0xb7f5f3=_0x346ce9;_0x3f2a4d[_0x559d('0x3d')]=_['keys'](db['Team'][_0x559d('0x5a')]);_0x3f2a4d['query']=_[_0x559d('0x51')](_0x40dffc['query']);_0x3f2a4d['filters']=_['intersection'](_0x3f2a4d[_0x559d('0x3d')],_0x3f2a4d[_0x559d('0x3e')]);_0x1583bc[_0x559d('0x41')]=_[_0x559d('0x40')](_0x3f2a4d['model'],qs[_0x559d('0x42')](_0x40dffc[_0x559d('0x3e')][_0x559d('0x42')]));_0x1583bc['attributes']=_0x1583bc[_0x559d('0x41')][_0x559d('0x43')]?_0x1583bc[_0x559d('0x41')]:_0x3f2a4d[_0x559d('0x3d')];_0x1583bc[_0x559d('0x45')]=qs['sort'](_0x40dffc[_0x559d('0x3e')][_0x559d('0x46')]);_0x1583bc[_0x559d('0x4b')]=qs['filters'](_['pick'](_0x40dffc['query'],_0x3f2a4d[_0x559d('0x3f')]));if(_0x40dffc[_0x559d('0x3e')][_0x559d('0x2d')]){_0x1583bc[_0x559d('0x4b')]=_[_0x559d('0x48')](_0x1583bc['where'],{'$or':_[_0x559d('0x2f')](_0x1583bc[_0x559d('0x41')],function(_0x5097e7){var _0x30fc0a={};_0x30fc0a[_0x5097e7]={'$like':'%'+_0x40dffc[_0x559d('0x3e')][_0x559d('0x2d')]+'%'};return _0x30fc0a;})});}_0x1583bc=_[_0x559d('0x48')]({},_0x1583bc,_0x40dffc['options']);return _0xb7f5f3[_0x559d('0x6d')](_0x1583bc);}})['then'](function(_0x32f3ed){if(_0x32f3ed){_0x22bcf6=_0x32f3ed[_0x559d('0x43')];if(!_0x40dffc['query'][_0x559d('0x44')](_0x559d('0x65'))){_0x1583bc[_0x559d('0x21')]=qs[_0x559d('0x21')](_0x40dffc[_0x559d('0x3e')][_0x559d('0x21')]);_0x1583bc[_0x559d('0x20')]=qs[_0x559d('0x20')](_0x40dffc[_0x559d('0x3e')][_0x559d('0x20')]);}return _0xb7f5f3['getTeams'](_0x1583bc);}})[_0x559d('0x27')](function(_0x29c353){if(_0x29c353){return _0x29c353?{'count':_0x22bcf6,'rows':_0x29c353}:null;}})[_0x559d('0x27')](respondWithResult(_0x3d9953,null))[_0x559d('0x53')](handleError(_0x3d9953,null));};exports['addTeams']=function(_0xf3d8e6,_0x4d65a0,_0x3ef7d6){var _0x5125c0=_0xf3d8e6['body'][_0x559d('0x6e')];var _0xc7082d=_['map'](_0x5125c0,'id');return db[_0x559d('0x6f')][_0x559d('0x4d')]({'where':{'id':_0xc7082d},'attributes':['id'],'include':[{'model':db[_0x559d('0x70')],'as':_0x559d('0x71'),'attributes':['id',_0x559d('0x37'),'online',_0x559d('0x72'),_0x559d('0x73')],'raw':!![]}]})['then'](function(_0x46d873){if(_0x46d873){var _0x437640=_['flatMap'](_0x46d873,function(_0x49b6f2){var _0x86acf=_0x49b6f2[_0x559d('0x55')]({'plain':!![]});_0x86acf['Agents'][_0x559d('0x74')](function(_0x302444){_0x302444['penalty']=_[_0x559d('0x33')](_0x5125c0,{'id':_0x86acf['id']})[_0x559d('0x75')];});return _0x86acf[_0x559d('0x71')];});return db[_0x559d('0x3a')][_0x559d('0x33')]({'where':{'id':_0xf3d8e6[_0x559d('0x50')]['id']}})['then'](function(_0x2115ba){return db[_0x559d('0x76')][_0x559d('0x77')](function(_0x5ab4b0){return _0x2115ba[_0x559d('0x78')](_0xc7082d,{'transaction':_0x5ab4b0})[_0x559d('0x27')](function(){return BPromise['each'](_0x437640,function(_0x5065d){return db['UserVoiceQueue'][_0x559d('0x79')]({'where':{'UserId':_0x5065d['id'],'VoiceQueueId':_0xf3d8e6[_0x559d('0x50')]['id']},'defaults':{'penalty':_0x5065d[_0x559d('0x75')]},'transaction':_0x5ab4b0});});})[_0x559d('0x27')](function(){return BPromise[_0x559d('0x7a')](_[_0x559d('0x2d')](_0x437640,{'online':!![]}),function(_0xeb697e){return db[_0x559d('0x7b')][_0x559d('0x7c')]({'membername':_0xeb697e['name'],'UserId':_0xeb697e['id'],'queue_name':_0x2115ba[_0x559d('0x37')],'VoiceQueueId':_0x2115ba['id'],'interface':_[_0x559d('0x7d')](_0xeb697e[_0x559d('0x73')])?util[_0x559d('0x7e')](_0x559d('0x7f'),_0xeb697e[_0x559d('0x37')]):_0xeb697e[_0x559d('0x73')],'paused':_0xeb697e[_0x559d('0x72')]||![],'penalty':_0xeb697e[_0x559d('0x75')]},{'transaction':_0x5ab4b0});});})[_0x559d('0x27')](function(){_0x437640['forEach'](function(_0x3d1e0e){socket[_0x559d('0x80')](_0x559d('0x81'),{'UserId':_0x3d1e0e['id'],'VoiceQueueId':_0x2115ba['id']});});});});});}})[_0x559d('0x27')](respondWithStatusCode(_0x4d65a0,null))[_0x559d('0x53')](handleError(_0x4d65a0,null));};exports['removeTeams']=function(_0x4a0c60,_0x118b29,_0x59f76e){return db[_0x559d('0x6f')]['findAll']({'where':{'id':_0x4a0c60[_0x559d('0x3e')][_0x559d('0x82')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x559d('0x71'),'attributes':['id'],'raw':!![]}]})[_0x559d('0x27')](handleEntityNotFound(_0x118b29,null))[_0x559d('0x27')](function(_0x1b62b5){var _0x4342ce=_['map'](_0x1b62b5,'id');var _0x2a03bf=[];var _0x584c7b=[];var _0x5b9c35=squel[_0x559d('0x83')]();_0x5b9c35[_0x559d('0x84')](_0x559d('0x85'))[_0x559d('0x86')](_0x559d('0x87'),'tq')['join'](_0x559d('0x88'),'ut',_0x559d('0x89'))[_0x559d('0x4b')](_0x559d('0x8a'),_0x4a0c60[_0x559d('0x50')]['id']);for(var _0x5c60fc=0x0;_0x5c60fc<_0x1b62b5[_0x559d('0x43')];_0x5c60fc+=0x1){let _0xf42824=_0x1b62b5[_0x5c60fc];for(var _0x22b586=0x0;_0x22b586<_0xf42824[_0x559d('0x71')][_0x559d('0x43')];_0x22b586+=0x1){let _0x593e13=_0xf42824['Agents'][_0x22b586];var _0x2da945=_0x5b9c35[_0x559d('0x59')]();_0x2da945['where'](_0x559d('0x8b'),_0x593e13['id']);_0x584c7b[_0x559d('0x8c')](db[_0x559d('0x76')][_0x559d('0x3e')](_0x2da945[_0x559d('0x8d')](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0x559d('0x27')](function(_0x2f5d48){if(_0x2f5d48[_0x559d('0x43')]===0x1){return _0x593e13['id'];}else{var _0x528a53=_[_0x559d('0x8e')](_[_0x559d('0x2f')](_0x2f5d48,_0x559d('0x8f')),function(_0x25c38f){return _['includes'](_0x4342ce,_0x25c38f);});if(_0x528a53){return _0x593e13['id'];}}}));}}return BPromise['all'](_0x584c7b)[_0x559d('0x27')](function(_0xe547ce){_0x2a03bf=_(_0x2a03bf)[_0x559d('0x90')](_0xe547ce)['compact']()[_0x559d('0x30')]();return db['VoiceQueue'][_0x559d('0x33')]({'where':{'id':_0x4a0c60[_0x559d('0x50')]['id']}})[_0x559d('0x27')](function(_0x40ec9a){return db[_0x559d('0x76')][_0x559d('0x77')](function(_0x608fdc){return _0x40ec9a[_0x559d('0x91')](_0x4a0c60['query'][_0x559d('0x82')],{'transaction':_0x608fdc})[_0x559d('0x27')](function(){if(!_[_0x559d('0x92')](_0x2a03bf)){return _0x40ec9a[_0x559d('0x93')](_0x2a03bf,{'transaction':_0x608fdc})[_0x559d('0x27')](function(){return db[_0x559d('0x7b')][_0x559d('0x28')]({'where':{'VoiceQueueId':_0x4a0c60['params']['id'],'UserId':_0x2a03bf},'transaction':_0x608fdc});});}})[_0x559d('0x27')](function(){_0x2a03bf['forEach'](function(_0x19acc8){socket['emit'](_0x559d('0x94'),{'UserId':_0x19acc8,'VoiceQueueId':_0x40ec9a['id']});});});});});});})[_0x559d('0x27')](respondWithStatusCode(_0x118b29,null))['catch'](handleError(_0x118b29,null));};exports[_0x559d('0x95')]=function(_0x44b1bf,_0x7f6561,_0x8a5b39){var _0x7a1291,_0x25b52b;return db[_0x559d('0x3a')][_0x559d('0x33')]({'where':{'id':_0x44b1bf[_0x559d('0x50')]['id']}})['then'](handleEntityNotFound(_0x7f6561,null))['then'](function(_0x47f609){if(_0x47f609){_0x25b52b=_0x47f609;return _0x47f609[_0x559d('0x95')](_0x44b1bf[_0x559d('0x5e')][_0x559d('0x82')],_[_0x559d('0x5b')](_0x44b1bf[_0x559d('0x5e')],[_0x559d('0x82'),'id'])||{})[_0x559d('0x96')](function(_0x1c46db){for(var _0x2ee90f=0x0;_0x2ee90f<_0x44b1bf['body'][_0x559d('0x82')][_0x559d('0x43')];_0x2ee90f+=0x1){socket['emit'](_0x559d('0x81'),{'UserId':_0x44b1bf[_0x559d('0x5e')][_0x559d('0x82')][_0x2ee90f],'VoiceQueueId':_0x44b1bf[_0x559d('0x50')]['id']});}return _0x1c46db;});}})[_0x559d('0x27')](function(_0x2bc510){_0x7a1291=_0x2bc510||[];if(_0x25b52b){return db[_0x559d('0x70')][_0x559d('0x4d')]({'where':{'id':_0x44b1bf['body'][_0x559d('0x82')]},'attributes':['id',_0x559d('0x37'),_0x559d('0x97'),'voicePause','interface'],'raw':!![]});}})[_0x559d('0x27')](function(_0x308ac7){if(!_[_0x559d('0x92')](_0x308ac7)){var _0x35303c=[];for(var _0x21a494=0x0;_0x21a494<_0x308ac7[_0x559d('0x43')];_0x21a494++){if(_0x308ac7[_0x21a494]['online']){_0x35303c['push'](db[_0x559d('0x7b')]['upsert']({'membername':_0x308ac7[_0x21a494][_0x559d('0x37')],'UserId':_0x308ac7[_0x21a494]['id'],'queue_name':_0x25b52b['name'],'VoiceQueueId':_0x25b52b['id'],'interface':_[_0x559d('0x7d')](_0x308ac7[_0x21a494][_0x559d('0x73')])?util[_0x559d('0x7e')](_0x559d('0x7f'),_0x308ac7[_0x21a494][_0x559d('0x37')]):_0x308ac7[_0x21a494][_0x559d('0x73')],'paused':_0x308ac7[_0x21a494][_0x559d('0x72')]||![],'penalty':_0x44b1bf[_0x559d('0x5e')][_0x559d('0x75')]||0x0}));}}return BPromise[_0x559d('0x98')](_0x35303c);}})[_0x559d('0x27')](function(){return _0x7a1291;})[_0x559d('0x27')](respondWithResult(_0x7f6561,null))[_0x559d('0x53')](handleError(_0x7f6561,null));};exports[_0x559d('0x93')]=function(_0x302347,_0x53ea7c,_0x258e57){return db[_0x559d('0x3a')][_0x559d('0x33')]({'where':{'id':_0x302347[_0x559d('0x50')]['id']}})['then'](handleEntityNotFound(_0x53ea7c,null))['then'](function(_0x5eaed0){if(_0x5eaed0){return _0x5eaed0['removeAgents'](_0x302347['query'][_0x559d('0x82')])['then'](function(){if(_[_0x559d('0x99')](_0x302347[_0x559d('0x3e')][_0x559d('0x82')])){for(var _0x1c2a08=0x0;_0x1c2a08<_0x302347[_0x559d('0x3e')][_0x559d('0x82')]['length'];_0x1c2a08+=0x1){socket[_0x559d('0x80')](_0x559d('0x94'),{'UserId':Number(_0x302347['query'][_0x559d('0x82')][_0x1c2a08]),'VoiceQueueId':Number(_0x302347[_0x559d('0x50')]['id'])});}}else{socket['emit'](_0x559d('0x94'),{'UserId':Number(_0x302347['query'][_0x559d('0x82')]),'VoiceQueueId':Number(_0x302347[_0x559d('0x50')]['id'])});}});}})[_0x559d('0x27')](function(_0xc957e8){return db['UserVoiceQueueRt'][_0x559d('0x28')]({'where':{'VoiceQueueId':_0x302347[_0x559d('0x50')]['id'],'UserId':_0x302347[_0x559d('0x3e')][_0x559d('0x82')]}})[_0x559d('0x27')](function(){return _0xc957e8;});})['then'](respondWithStatusCode(_0x53ea7c,null))[_0x559d('0x53')](handleError(_0x53ea7c,null));};exports[_0x559d('0x9a')]=function(_0x2174c5,_0x2e331c,_0x4cdc25){var _0x240bc8={};var _0x1d2c4d={};var _0x438c70;var _0x2c792d;return db['VoiceQueue'][_0x559d('0x63')]({'where':{'id':_0x2174c5['params']['id']}})[_0x559d('0x27')](handleEntityNotFound(_0x2e331c,null))[_0x559d('0x27')](function(_0x3a09b2){if(_0x3a09b2){_0x438c70=_0x3a09b2;_0x1d2c4d[_0x559d('0x3d')]=_[_0x559d('0x51')](db[_0x559d('0x70')][_0x559d('0x5a')]);_0x1d2c4d[_0x559d('0x3e')]=_[_0x559d('0x51')](_0x2174c5[_0x559d('0x3e')]);_0x1d2c4d[_0x559d('0x3f')]=_[_0x559d('0x40')](_0x1d2c4d[_0x559d('0x3d')],_0x1d2c4d['query']);_0x240bc8['attributes']=_[_0x559d('0x40')](_0x1d2c4d[_0x559d('0x3d')],qs['fields'](_0x2174c5['query'][_0x559d('0x42')]));_0x240bc8[_0x559d('0x41')]=_0x240bc8['attributes'][_0x559d('0x43')]?_0x240bc8[_0x559d('0x41')]:_0x1d2c4d[_0x559d('0x3d')];_0x240bc8[_0x559d('0x45')]=qs[_0x559d('0x46')](_0x2174c5[_0x559d('0x3e')][_0x559d('0x46')]);_0x240bc8['where']=qs[_0x559d('0x3f')](_[_0x559d('0x47')](_0x2174c5['query'],_0x1d2c4d['filters']));if(_0x2174c5['query'][_0x559d('0x2d')]){_0x240bc8['where']=_['merge'](_0x240bc8[_0x559d('0x4b')],{'$or':_[_0x559d('0x2f')](_0x240bc8['attributes'],function(_0x1a61da){var _0xe2e4b1={};_0xe2e4b1[_0x1a61da]={'$like':'%'+_0x2174c5[_0x559d('0x3e')][_0x559d('0x2d')]+'%'};return _0xe2e4b1;})});}_0x240bc8=_[_0x559d('0x48')]({},_0x240bc8,_0x2174c5['options']);return _0x438c70[_0x559d('0x9a')](_0x240bc8);}})[_0x559d('0x27')](function(_0x3e0d4d){if(_0x3e0d4d){_0x2c792d=_0x3e0d4d[_0x559d('0x43')];if(!_0x2174c5['query'][_0x559d('0x44')](_0x559d('0x65'))){_0x240bc8[_0x559d('0x21')]=qs[_0x559d('0x21')](_0x2174c5[_0x559d('0x3e')][_0x559d('0x21')]);_0x240bc8[_0x559d('0x20')]=qs[_0x559d('0x20')](_0x2174c5[_0x559d('0x3e')]['offset']);}return _0x438c70[_0x559d('0x9a')](_0x240bc8);}})[_0x559d('0x27')](function(_0x4db1f3){if(_0x4db1f3){return _0x4db1f3?{'count':_0x2c792d,'rows':_0x4db1f3}:null;}})[_0x559d('0x27')](respondWithResult(_0x2e331c,null))[_0x559d('0x53')](handleError(_0x2e331c,null));};exports[_0x559d('0x9b')]=function(_0x1732e4,_0x288e57,_0x3d2832){var _0x35b632={};var _0x442b00={};var _0xcc0f40;var _0x3283a9;return db[_0x559d('0x3a')][_0x559d('0x63')]({'where':{'id':_0x1732e4['params']['id']}})['then'](handleEntityNotFound(_0x288e57,null))[_0x559d('0x27')](function(_0xb8e4f7){if(_0xb8e4f7){_0xcc0f40=_0xb8e4f7;_0x442b00[_0x559d('0x3d')]=_[_0x559d('0x51')](db[_0x559d('0x7b')][_0x559d('0x5a')]);_0x442b00[_0x559d('0x3e')]=_[_0x559d('0x51')](_0x1732e4[_0x559d('0x3e')]);_0x442b00[_0x559d('0x3f')]=_['intersection'](_0x442b00[_0x559d('0x3d')],_0x442b00[_0x559d('0x3e')]);_0x35b632[_0x559d('0x41')]=_['intersection'](_0x442b00['model'],qs[_0x559d('0x42')](_0x1732e4[_0x559d('0x3e')]['fields']));_0x35b632[_0x559d('0x41')]=_0x35b632[_0x559d('0x41')][_0x559d('0x43')]?_0x35b632[_0x559d('0x41')]:_0x442b00[_0x559d('0x3d')];_0x35b632[_0x559d('0x45')]=qs['sort'](_0x1732e4['query']['sort']);_0x35b632[_0x559d('0x4b')]=qs[_0x559d('0x3f')](_[_0x559d('0x47')](_0x1732e4['query'],_0x442b00[_0x559d('0x3f')]));if(_0x1732e4[_0x559d('0x3e')][_0x559d('0x2d')]){_0x35b632[_0x559d('0x4b')]=_[_0x559d('0x48')](_0x35b632[_0x559d('0x4b')],{'$or':_[_0x559d('0x2f')](_0x35b632['attributes'],function(_0x551082){var _0xe3629a={};_0xe3629a[_0x551082]={'$like':'%'+_0x1732e4[_0x559d('0x3e')][_0x559d('0x2d')]+'%'};return _0xe3629a;})});}_0x35b632=_[_0x559d('0x48')]({},_0x35b632,_0x1732e4[_0x559d('0x4a')]);return _0xcc0f40[_0x559d('0x9b')](_0x35b632);}})['then'](function(_0x52bfa1){if(_0x52bfa1){_0x3283a9=_0x52bfa1[_0x559d('0x43')];if(!_0x1732e4[_0x559d('0x3e')][_0x559d('0x44')](_0x559d('0x65'))){_0x35b632[_0x559d('0x21')]=qs[_0x559d('0x21')](_0x1732e4[_0x559d('0x3e')]['limit']);_0x35b632['offset']=qs['offset'](_0x1732e4[_0x559d('0x3e')][_0x559d('0x20')]);}return _0xcc0f40['getMembers'](_0x35b632);}})[_0x559d('0x27')](function(_0x4228dc){return _0x4228dc?{'count':_0x3283a9,'rows':_0x4228dc}:null;})[_0x559d('0x27')](respondWithResult(_0x288e57,null))[_0x559d('0x53')](handleError(_0x288e57,null));};exports[_0x559d('0x9c')]=function(_0x2b2e32,_0x292b0d,_0x310136){var _0x26de98={};var _0x6fab46={};var _0x16a442;var _0x15b181;return db[_0x559d('0x3a')]['findOne']({'where':{'id':_0x2b2e32[_0x559d('0x50')]['id']}})['then'](handleEntityNotFound(_0x292b0d,null))['then'](function(_0x2094ce){if(_0x2094ce){_0x16a442=_0x2094ce;_0x6fab46[_0x559d('0x3d')]=_[_0x559d('0x51')](db[_0x559d('0x9d')][_0x559d('0x5a')]);_0x6fab46[_0x559d('0x3e')]=_[_0x559d('0x51')](_0x2b2e32[_0x559d('0x3e')]);_0x6fab46[_0x559d('0x3f')]=_['intersection'](_0x6fab46['model'],_0x6fab46['query']);_0x26de98[_0x559d('0x41')]=_['intersection'](_0x6fab46[_0x559d('0x3d')],qs['fields'](_0x2b2e32[_0x559d('0x3e')][_0x559d('0x42')]));_0x26de98[_0x559d('0x41')]=_0x26de98[_0x559d('0x41')][_0x559d('0x43')]?_0x26de98[_0x559d('0x41')]:_0x6fab46['model'];_0x26de98[_0x559d('0x45')]=qs[_0x559d('0x46')](_0x2b2e32[_0x559d('0x3e')][_0x559d('0x46')]);_0x26de98[_0x559d('0x4b')]=qs[_0x559d('0x3f')](_[_0x559d('0x47')](_0x2b2e32['query'],_0x6fab46[_0x559d('0x3f')]));if(_0x2b2e32[_0x559d('0x3e')][_0x559d('0x2d')]){_0x26de98[_0x559d('0x4b')]=_['merge'](_0x26de98[_0x559d('0x4b')],{'$or':_[_0x559d('0x2f')](_0x26de98['attributes'],function(_0x3d1fc5){var _0xcbe026={};_0xcbe026[_0x3d1fc5]={'$like':'%'+_0x2b2e32['query']['filter']+'%'};return _0xcbe026;})});}_0x26de98=_[_0x559d('0x48')]({},_0x26de98,_0x2b2e32[_0x559d('0x4a')]);return _0x16a442[_0x559d('0x9c')](_0x26de98);}})['then'](function(_0x4a2db4){if(_0x4a2db4){_0x15b181=_0x4a2db4[_0x559d('0x43')];if(!_0x2b2e32[_0x559d('0x3e')]['hasOwnProperty'](_0x559d('0x65'))){_0x26de98[_0x559d('0x21')]=qs[_0x559d('0x21')](_0x2b2e32[_0x559d('0x3e')][_0x559d('0x21')]);_0x26de98['offset']=qs[_0x559d('0x20')](_0x2b2e32[_0x559d('0x3e')][_0x559d('0x20')]);}return _0x16a442[_0x559d('0x9c')](_0x26de98);}})[_0x559d('0x27')](function(_0x4a7f0e){if(_0x4a7f0e){return _0x4a7f0e?{'count':_0x15b181,'rows':_0x4a7f0e}:null;}})['then'](respondWithResult(_0x292b0d,null))['catch'](handleError(_0x292b0d,null));};exports['addLists']=function(_0x17812b,_0x2d06e5,_0x21bcde){var _0x7f9ca,_0x594c55;return db['VoiceQueue'][_0x559d('0x33')]({'where':{'id':_0x17812b['params']['id']}})[_0x559d('0x27')](handleEntityNotFound(_0x2d06e5,null))[_0x559d('0x27')](function(_0x57b7ca){if(_0x57b7ca){_0x594c55=_0x57b7ca;return _0x57b7ca[_0x559d('0x9e')](_0x17812b[_0x559d('0x5e')][_0x559d('0x82')],_[_0x559d('0x5b')](_0x17812b[_0x559d('0x5e')],[_0x559d('0x82'),'id'])||{});}return null;})[_0x559d('0x96')](function(_0x3203d2){var _0x1b226a;_0x7f9ca=_0x3203d2||[];var _0xcb113=[];if(_0x3203d2){for(var _0x5c3df7=0x0;_0x5c3df7<_0x3203d2[_0x559d('0x43')];_0x5c3df7+=0x1){var _0x78b9d6=_0x3203d2[_0x5c3df7][_0x559d('0x55')]({'plain':!![]});_0x594c55[_0x559d('0x9f')]=_0x17812b[_0x559d('0x5e')][_0x559d('0x9f')]?_0x17812b[_0x559d('0x5e')]['dialCheckDuplicateType']:_0x594c55['dialCheckDuplicateType'];switch(_0x594c55[_0x559d('0x9f')]){case'always':_0x1b226a=squel['insert']()[_0x559d('0xa0')](_0x559d('0xa1'))[_0x559d('0xa2')](['phone',_0x559d('0xa3'),_0x559d('0xa4'),_0x559d('0xa5'),_0x559d('0x6a'),'createdAt','updatedAt'],squel[_0x559d('0x83')]()[_0x559d('0x84')](_0x559d('0xa6'),_0x559d('0xa6'))[_0x559d('0x84')](_0x559d('0xa7'),_0x559d('0xa3'))[_0x559d('0x84')]('id',_0x559d('0xa4'))[_0x559d('0x84')](_0x78b9d6[_0x559d('0xa8')][_0x559d('0x8d')](),_0x559d('0xa5'))['field'](_0x17812b[_0x559d('0x50')]['id'][_0x559d('0x8d')](),_0x559d('0x6a'))['field'](_0x559d('0xa7'),'createdAt')['field'](_0x559d('0xa7'),'updatedAt')[_0x559d('0x86')](_0x559d('0xa9'))[_0x559d('0x4b')](_0x559d('0xaa'))['where'](_0x559d('0xab'),_0x78b9d6['CmListId'][_0x559d('0x8d')]())[_0x559d('0x4b')](_0x559d('0xac'))[_0x559d('0x4b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x559d('0x83')]()[_0x559d('0x84')](_0x559d('0xad'))['from'](_0x559d('0xae'))['where'](_0x559d('0x8a'),_0x17812b[_0x559d('0x50')]['id']['toString']()))[_0x559d('0x4b')](_0x559d('0xaf'),squel[_0x559d('0x83')]()[_0x559d('0x84')]('COALESCE(phone,\x27\x27)')[_0x559d('0x86')](_0x559d('0xa1'))[_0x559d('0x4b')](_0x559d('0x8a'),_0x17812b[_0x559d('0x50')]['id'][_0x559d('0x8d')]())))[_0x559d('0x8d')]();break;case _0x559d('0xb0'):_0x1b226a=squel[_0x559d('0xb1')]()[_0x559d('0xa0')](_0x559d('0xa1'))[_0x559d('0xa2')]([_0x559d('0xa6'),_0x559d('0xa3'),'ContactId',_0x559d('0xa5'),'VoiceQueueId','createdAt','updatedAt'],squel[_0x559d('0x83')]()[_0x559d('0x84')](_0x559d('0xa6'),_0x559d('0xa6'))[_0x559d('0x84')](_0x559d('0xa7'),_0x559d('0xa3'))['field']('id',_0x559d('0xa4'))[_0x559d('0x84')](_0x78b9d6[_0x559d('0xa8')][_0x559d('0x8d')](),_0x559d('0xa5'))[_0x559d('0x84')](_0x17812b[_0x559d('0x50')]['id'][_0x559d('0x8d')](),'VoiceQueueId')[_0x559d('0x84')](_0x559d('0xa7'),'createdAt')[_0x559d('0x84')](_0x559d('0xa7'),_0x559d('0x5d'))[_0x559d('0x86')](_0x559d('0xa9'))[_0x559d('0x4b')](_0x559d('0xaa'))[_0x559d('0x4b')](_0x559d('0xab'),_0x78b9d6[_0x559d('0xa8')][_0x559d('0x8d')]())['where'](_0x559d('0xac'))[_0x559d('0x4b')](_0x559d('0xaf'),squel['select']()[_0x559d('0x84')](_0x559d('0xb2'))[_0x559d('0x86')](_0x559d('0xa1'))[_0x559d('0x4b')](_0x559d('0x8a'),_0x17812b['params']['id'][_0x559d('0x8d')]())))[_0x559d('0x8d')]();break;default:_0x1b226a=squel[_0x559d('0xb1')]()[_0x559d('0xa0')](_0x559d('0xa1'))[_0x559d('0xa2')]([_0x559d('0xa6'),_0x559d('0xa3'),'ContactId',_0x559d('0xa5'),_0x559d('0x6a'),_0x559d('0x5c'),_0x559d('0x5d')],squel[_0x559d('0x83')]()[_0x559d('0x84')]('phone',_0x559d('0xa6'))[_0x559d('0x84')]('NOW()','scheduledAt')[_0x559d('0x84')]('id','ContactId')[_0x559d('0x84')](_0x78b9d6[_0x559d('0xa8')][_0x559d('0x8d')](),_0x559d('0xa5'))['field'](_0x17812b[_0x559d('0x50')]['id'][_0x559d('0x8d')](),_0x559d('0x6a'))['field'](_0x559d('0xa7'),_0x559d('0x5c'))[_0x559d('0x84')]('NOW()','updatedAt')['from'](_0x559d('0xa9'))[_0x559d('0x4b')]('deletedAt\x20IS\x20NULL')[_0x559d('0x4b')]('ListId\x20=\x20?',_0x78b9d6[_0x559d('0xa8')][_0x559d('0x8d')]())[_0x559d('0x4b')](_0x559d('0xac')))['toString']();}_0xcb113[_0x559d('0x8c')](db[_0x559d('0x76')][_0x559d('0x3e')](_0x1b226a));}return BPromise['all'](_0xcb113);}})['then'](function(){return _0x7f9ca;})[_0x559d('0x27')](respondWithResult(_0x2d06e5,null))[_0x559d('0x53')](handleError(_0x2d06e5,null));};exports[_0x559d('0xb3')]=function(_0x50861d,_0xc1a3dd,_0x4f8109){return db[_0x559d('0x3a')][_0x559d('0x33')]({'where':{'id':_0x50861d[_0x559d('0x50')]['id']}})['then'](handleEntityNotFound(_0xc1a3dd,null))[_0x559d('0x27')](function(_0x3ecdd3){if(_0x3ecdd3){return _0x3ecdd3[_0x559d('0xb3')](_0x50861d['query'][_0x559d('0x82')]);}})[_0x559d('0x27')](function(_0x5b192a){if(_0x5b192a){return db[_0x559d('0x64')][_0x559d('0x28')]({'where':{'ListId':_0x50861d['query'][_0x559d('0x82')],'VoiceQueueId':_0x50861d[_0x559d('0x50')]['id']}})[_0x559d('0x27')](function(){return _0x5b192a;});}})['then'](respondWithStatusCode(_0xc1a3dd,null))[_0x559d('0x53')](handleError(_0xc1a3dd,null));};exports[_0x559d('0xb4')]=function(_0x2c52f9,_0x3194c7,_0x3998a5){var _0x4f42b1={};var _0x119116={};var _0x2e763b;var _0x664706;return db[_0x559d('0x3a')][_0x559d('0x63')]({'where':{'id':_0x2c52f9[_0x559d('0x50')]['id']}})[_0x559d('0x27')](handleEntityNotFound(_0x3194c7,null))[_0x559d('0x27')](function(_0x12b3a7){if(_0x12b3a7){_0x2e763b=_0x12b3a7;_0x119116[_0x559d('0x3d')]=_[_0x559d('0x51')](db[_0x559d('0x9d')][_0x559d('0x5a')]);_0x119116[_0x559d('0x3e')]=_[_0x559d('0x51')](_0x2c52f9[_0x559d('0x3e')]);_0x119116[_0x559d('0x3f')]=_[_0x559d('0x40')](_0x119116['model'],_0x119116[_0x559d('0x3e')]);_0x4f42b1[_0x559d('0x41')]=_[_0x559d('0x40')](_0x119116['model'],qs['fields'](_0x2c52f9[_0x559d('0x3e')][_0x559d('0x42')]));_0x4f42b1[_0x559d('0x41')]=_0x4f42b1[_0x559d('0x41')][_0x559d('0x43')]?_0x4f42b1[_0x559d('0x41')]:_0x119116[_0x559d('0x3d')];_0x4f42b1['order']=qs[_0x559d('0x46')](_0x2c52f9[_0x559d('0x3e')]['sort']);_0x4f42b1[_0x559d('0x4b')]=qs[_0x559d('0x3f')](_['pick'](_0x2c52f9['query'],_0x119116['filters']));if(_0x2c52f9[_0x559d('0x3e')][_0x559d('0x2d')]){_0x4f42b1['where']=_[_0x559d('0x48')](_0x4f42b1[_0x559d('0x4b')],{'$or':_[_0x559d('0x2f')](_0x4f42b1['attributes'],function(_0x52ef25){var _0x2844d1={};_0x2844d1[_0x52ef25]={'$like':'%'+_0x2c52f9['query'][_0x559d('0x2d')]+'%'};return _0x2844d1;})});}_0x4f42b1=_[_0x559d('0x48')]({},_0x4f42b1,_0x2c52f9[_0x559d('0x4a')]);return _0x2e763b[_0x559d('0xb4')](_0x4f42b1);}})[_0x559d('0x27')](function(_0x391126){if(_0x391126){_0x664706=_0x391126['length'];if(!_0x2c52f9[_0x559d('0x3e')][_0x559d('0x44')](_0x559d('0x65'))){_0x4f42b1[_0x559d('0x21')]=qs[_0x559d('0x21')](_0x2c52f9[_0x559d('0x3e')]['limit']);_0x4f42b1['offset']=qs[_0x559d('0x20')](_0x2c52f9[_0x559d('0x3e')][_0x559d('0x20')]);}return _0x2e763b[_0x559d('0xb4')](_0x4f42b1);}})[_0x559d('0x27')](function(_0x4036f9){if(_0x4036f9){return _0x4036f9?{'count':_0x664706,'rows':_0x4036f9}:null;}})[_0x559d('0x27')](respondWithResult(_0x3194c7,null))[_0x559d('0x53')](handleError(_0x3194c7,null));};exports['addBlackLists']=function(_0x23458b,_0x4ff631,_0x12bdb4){var _0x3d6025,_0x315b2e;return db[_0x559d('0x3a')][_0x559d('0x33')]({'where':{'id':_0x23458b[_0x559d('0x50')]['id']}})[_0x559d('0x27')](handleEntityNotFound(_0x4ff631,null))['then'](function(_0x45b6aa){if(_0x45b6aa){_0x315b2e=_0x45b6aa;return _0x45b6aa[_0x559d('0xb5')](_0x23458b[_0x559d('0x5e')][_0x559d('0x82')],_['omit'](_0x23458b[_0x559d('0x5e')],[_0x559d('0x82'),'id'])||{});}return null;})[_0x559d('0x96')](function(_0x2138d7){var _0x2894fa;_0x3d6025=_0x2138d7||[];var _0xcd25d1=[];if(_0x2138d7){for(var _0x42ef36=0x0;_0x42ef36<_0x2138d7[_0x559d('0x43')];_0x42ef36+=0x1){var _0x261b0e=_0x2138d7[_0x42ef36]['get']({'plain':!![]});_0x2894fa=squel[_0x559d('0xb1')]()[_0x559d('0xa0')](_0x559d('0xb6'))['fromQuery'](['phone',_0x559d('0xa4'),'ListId',_0x559d('0x6a'),_0x559d('0x5c'),_0x559d('0x5d')],squel[_0x559d('0x83')]()[_0x559d('0x84')](_0x559d('0xa6'),_0x559d('0xa6'))[_0x559d('0x84')]('id',_0x559d('0xa4'))[_0x559d('0x84')](_0x261b0e['CmListId'][_0x559d('0x8d')](),_0x559d('0xa5'))['field'](_0x23458b[_0x559d('0x50')]['id'][_0x559d('0x8d')](),'VoiceQueueId')[_0x559d('0x84')](_0x559d('0xa7'),_0x559d('0x5c'))['field'](_0x559d('0xa7'),_0x559d('0x5d'))[_0x559d('0x86')]('cm_contacts')[_0x559d('0x4b')]('deletedAt\x20IS\x20NULL')['where'](_0x559d('0xab'),_0x261b0e['CmListId'][_0x559d('0x8d')]())[_0x559d('0x4b')](_0x559d('0xac')))['toString']();_0xcd25d1['push'](db[_0x559d('0x76')][_0x559d('0x3e')](_0x2894fa));}return BPromise[_0x559d('0x98')](_0xcd25d1);}})[_0x559d('0x27')](function(){return _0x3d6025;})['then'](respondWithResult(_0x4ff631,null))[_0x559d('0x53')](handleError(_0x4ff631,null));};exports[_0x559d('0xb7')]=function(_0x481de4,_0x61b48c,_0x432dd8){return db[_0x559d('0x3a')][_0x559d('0x33')]({'where':{'id':_0x481de4['params']['id']}})[_0x559d('0x27')](handleEntityNotFound(_0x61b48c,null))[_0x559d('0x27')](function(_0x2c23c3){if(_0x2c23c3){return _0x2c23c3[_0x559d('0xb7')](_0x481de4['query']['ids']);}})['then'](function(_0x410352){if(_0x410352){return db[_0x559d('0x6c')][_0x559d('0x28')]({'where':{'ListId':_0x481de4[_0x559d('0x3e')][_0x559d('0x82')],'VoiceQueueId':_0x481de4['params']['id']}})[_0x559d('0x27')](function(){return _0x410352;});}})[_0x559d('0x27')](respondWithStatusCode(_0x61b48c,null))['catch'](handleError(_0x61b48c,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index fa4a0d8..859ff2e 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 _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 +var _0xfb5f=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x51eec3,_0x300e47){var _0x47181a=function(_0x3f4850){while(--_0x3f4850){_0x51eec3['push'](_0x51eec3['shift']());}};_0x47181a(++_0x300e47);}(_0xfb5f,0x1be));var _0xffb5=function(_0x1672b3,_0x4d3196){_0x1672b3=_0x1672b3-0x0;var _0x5cf5cd=_0xfb5f[_0x1672b3];return _0x5cf5cd;};'use strict';var EventEmitter=require(_0xffb5('0x0'));var VoiceQueue=require(_0xffb5('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xffb5('0x2')](0x0);var events={'afterCreate':_0xffb5('0x3'),'afterUpdate':_0xffb5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x15ed1a){return function(_0x223387,_0x3b73db,_0x2b8d17){VoiceQueueEvents[_0xffb5('0x5')](_0x15ed1a+':'+_0x223387['id'],_0x223387);VoiceQueueEvents[_0xffb5('0x5')](_0x15ed1a,_0x223387);_0x2b8d17(null);};}for(var e in events){if(events[_0xffb5('0x6')](e)){var event=events[e];VoiceQueue[_0xffb5('0x7')](e,emitEvent(event));}}module[_0xffb5('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 7d6f4ee..5bcb7d8 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 _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 +var _0xc960=['bluebird','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','../../config/logger','api'];(function(_0x44c89b,_0x5bfb9c){var _0x2545f7=function(_0x1deab9){while(--_0x1deab9){_0x44c89b['push'](_0x44c89b['shift']());}};_0x2545f7(++_0x5bfb9c);}(_0xc960,0x1ec));var _0x0c96=function(_0x2488fa,_0x13609c){_0x2488fa=_0x2488fa-0x0;var _0x41694c=_0xc960[_0x2488fa];return _0x41694c;};'use strict';var _=require(_0x0c96('0x0'));var util=require('util');var logger=require(_0x0c96('0x1'))(_0x0c96('0x2'));var moment=require('moment');var BPromise=require(_0x0c96('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c96('0x4'));var rimraf=require(_0x0c96('0x5'));var config=require(_0x0c96('0x6'));var attributes=require(_0x0c96('0x7'));module[_0x0c96('0x8')]=function(_0x284636,_0x246679){return _0x284636[_0x0c96('0x9')](_0x0c96('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 1ad7e98..87e5bd6 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 _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 +var _0x6263=['code','message','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','include','map','model','then','find','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3465e1,_0x2995a6){var _0x563dcb=function(_0xacce59){while(--_0xacce59){_0x3465e1['push'](_0x3465e1['shift']());}};_0x563dcb(++_0x2995a6);}(_0x6263,0x100));var _0x3626=function(_0xac4dd4,_0x41ac92){_0xac4dd4=_0xac4dd4-0x0;var _0x35b182=_0x6263[_0xac4dd4];return _0x35b182;};'use strict';var _=require(_0x3626('0x0'));var util=require(_0x3626('0x1'));var moment=require(_0x3626('0x2'));var BPromise=require(_0x3626('0x3'));var rs=require(_0x3626('0x4'));var fs=require('fs');var Redis=require(_0x3626('0x5'));var db=require(_0x3626('0x6'))['db'];var utils=require(_0x3626('0x7'));var logger=require(_0x3626('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3626('0x9'));var client=jayson[_0x3626('0xa')]['http']({'port':0x232a});config[_0x3626('0xb')]=_[_0x3626('0xc')](config[_0x3626('0xb')],{'host':_0x3626('0xd'),'port':0x18eb});var socket=require(_0x3626('0xe'))(new Redis(config[_0x3626('0xb')]));require(_0x3626('0xf'))['register'](socket);function respondWithRpcPromise(_0x3e2f1e,_0x4534be,_0x2a805c){return new BPromise(function(_0x24035d,_0x5ab006){return client[_0x3626('0x10')](_0x3e2f1e,_0x2a805c)['then'](function(_0x5654b7){logger[_0x3626('0x11')](_0x3626('0x12'),_0x4534be,_0x3626('0x13'));logger[_0x3626('0x14')](_0x3626('0x15'),_0x4534be,_0x3626('0x13'),JSON[_0x3626('0x16')](_0x5654b7));if(_0x5654b7[_0x3626('0x17')]){if(_0x5654b7['error'][_0x3626('0x18')]===0x1f4){logger[_0x3626('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x4534be,_0x5654b7[_0x3626('0x17')]['message']);return _0x5ab006(_0x5654b7['error'][_0x3626('0x19')]);}logger[_0x3626('0x17')](_0x3626('0x12'),_0x4534be,_0x5654b7[_0x3626('0x17')][_0x3626('0x19')]);return _0x24035d(_0x5654b7['error']['message']);}else{logger[_0x3626('0x11')](_0x3626('0x12'),_0x4534be,_0x3626('0x13'));_0x24035d(_0x5654b7['result'][_0x3626('0x19')]);}})[_0x3626('0x1a')](function(_0x185c3d){logger[_0x3626('0x17')](_0x3626('0x12'),_0x4534be,_0x185c3d);_0x5ab006(_0x185c3d);});});}exports[_0x3626('0x1b')]=function(_0x852e6a){var _0x1c31f7=this;return new Promise(function(_0x457b3b,_0x3ebd19){return db[_0x3626('0x1c')][_0x3626('0x1d')]({'raw':_0x852e6a[_0x3626('0x1e')]?_0x852e6a[_0x3626('0x1e')][_0x3626('0x1f')]===undefined?!![]:![]:!![],'where':_0x852e6a[_0x3626('0x1e')]?_0x852e6a[_0x3626('0x1e')][_0x3626('0x20')]||null:null,'attributes':_0x852e6a[_0x3626('0x1e')]?_0x852e6a['options'][_0x3626('0x21')]||null:null,'limit':_0x852e6a[_0x3626('0x1e')]?_0x852e6a[_0x3626('0x1e')]['limit']||null:null,'include':_0x852e6a[_0x3626('0x1e')]?_0x852e6a[_0x3626('0x1e')][_0x3626('0x22')]?_[_0x3626('0x23')](_0x852e6a[_0x3626('0x1e')][_0x3626('0x22')],function(_0x2caef8){return{'model':db[_0x2caef8['model']],'as':_0x2caef8['as'],'attributes':_0x2caef8['attributes'],'include':_0x2caef8[_0x3626('0x22')]?_[_0x3626('0x23')](_0x2caef8[_0x3626('0x22')],function(_0x22ddd8){return{'model':db[_0x22ddd8[_0x3626('0x24')]],'as':_0x22ddd8['as'],'attributes':_0x22ddd8[_0x3626('0x21')],'include':_0x22ddd8['include']?_[_0x3626('0x23')](_0x22ddd8[_0x3626('0x22')],function(_0x199887){return{'model':db[_0x199887['model']],'as':_0x199887['as'],'attributes':_0x199887[_0x3626('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3626('0x25')](function(_0x7d4225){logger[_0x3626('0x11')](_0x3626('0x1b'),_0x852e6a);logger[_0x3626('0x14')](_0x3626('0x1b'),_0x852e6a,JSON[_0x3626('0x16')](_0x7d4225));_0x457b3b(_0x7d4225);})[_0x3626('0x1a')](function(_0x4833a4){logger[_0x3626('0x17')](_0x3626('0x1b'),_0x4833a4[_0x3626('0x19')],_0x852e6a);_0x3ebd19(_0x1c31f7[_0x3626('0x17')](0x1f4,_0x4833a4[_0x3626('0x19')]));});});};exports['ShowVoiceQueue']=function(_0x391c98){var _0x3659d5=this;return new Promise(function(_0x34d0e6,_0x32a248){return db[_0x3626('0x1c')][_0x3626('0x26')]({'raw':_0x391c98[_0x3626('0x1e')]?_0x391c98[_0x3626('0x1e')][_0x3626('0x1f')]===undefined?!![]:![]:!![],'where':_0x391c98[_0x3626('0x1e')]?_0x391c98[_0x3626('0x1e')][_0x3626('0x20')]||null:null,'attributes':_0x391c98['options']?_0x391c98[_0x3626('0x1e')]['attributes']||null:null,'include':_0x391c98[_0x3626('0x1e')]?_0x391c98[_0x3626('0x1e')]['include']?_[_0x3626('0x23')](_0x391c98['options']['include'],function(_0xbb2720){return{'model':db[_0xbb2720[_0x3626('0x24')]],'as':_0xbb2720['as'],'attributes':_0xbb2720[_0x3626('0x21')],'include':_0xbb2720[_0x3626('0x22')]?_['map'](_0xbb2720[_0x3626('0x22')],function(_0x6bad27){return{'model':db[_0x6bad27[_0x3626('0x24')]],'as':_0x6bad27['as'],'attributes':_0x6bad27[_0x3626('0x21')],'include':_0x6bad27[_0x3626('0x22')]?_[_0x3626('0x23')](_0x6bad27[_0x3626('0x22')],function(_0x279641){return{'model':db[_0x279641['model']],'as':_0x279641['as'],'attributes':_0x279641['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a010e){logger[_0x3626('0x11')](_0x3626('0x27'),_0x391c98);logger['debug'](_0x3626('0x27'),_0x391c98,JSON[_0x3626('0x16')](_0x2a010e));_0x34d0e6(_0x2a010e);})[_0x3626('0x1a')](function(_0x28498c){logger['error'](_0x3626('0x27'),_0x28498c['message'],_0x391c98);_0x32a248(_0x3659d5[_0x3626('0x17')](0x1f4,_0x28498c[_0x3626('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 5810aa0..caf0b32 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 _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 +var _0x3d09=['./voiceQueue.events','remove','emit','removeListener','register','length','voiceQueue:'];(function(_0x4bd5a2,_0x3fbefa){var _0x1a86fe=function(_0x56fb30){while(--_0x56fb30){_0x4bd5a2['push'](_0x4bd5a2['shift']());}};_0x1a86fe(++_0x3fbefa);}(_0x3d09,0x8c));var _0x93d0=function(_0x78e79e,_0x4caed2){_0x78e79e=_0x78e79e-0x0;var _0x209be9=_0x3d09[_0x78e79e];return _0x209be9;};'use strict';var VoiceQueueEvents=require(_0x93d0('0x0'));var events=['save',_0x93d0('0x1'),'update'];function createListener(_0x56512a,_0x172b0e){return function(_0x17d1cf){_0x172b0e[_0x93d0('0x2')](_0x56512a,_0x17d1cf);};}function removeListener(_0x296422,_0x14a206){return function(){VoiceQueueEvents[_0x93d0('0x3')](_0x296422,_0x14a206);};}exports[_0x93d0('0x4')]=function(_0x4707bb){for(var _0x562278=0x0,_0x5e68f2=events[_0x93d0('0x5')];_0x562278<_0x5e68f2;_0x562278++){var _0xd9caea=events[_0x562278];var _0x5998e5=createListener(_0x93d0('0x6')+_0xd9caea,_0x4707bb);VoiceQueueEvents['on'](_0xd9caea,_0x5998e5);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 7b9da88..eb6f2b8 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(_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 +var _0x0eeb=['connect-timeout','express','Router','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','create','update','delete','destroy','multer','util','path'];(function(_0x5d0988,_0xef5cb6){var _0x4bd15c=function(_0x1ad73a){while(--_0x1ad73a){_0x5d0988['push'](_0x5d0988['shift']());}};_0x4bd15c(++_0xef5cb6);}(_0x0eeb,0xc5));var _0xb0ee=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x0eeb[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0xb0ee('0x0'));var util=require(_0xb0ee('0x1'));var path=require(_0xb0ee('0x2'));var timeout=require(_0xb0ee('0x3'));var express=require(_0xb0ee('0x4'));var router=express[_0xb0ee('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb0ee('0x6'));var controller=require(_0xb0ee('0x7'));router[_0xb0ee('0x8')]('/',auth[_0xb0ee('0x9')](),controller[_0xb0ee('0xa')]);router[_0xb0ee('0x8')](_0xb0ee('0xb'),auth['isAuthenticated'](),controller[_0xb0ee('0xc')]);router['get'](_0xb0ee('0xd'),auth[_0xb0ee('0x9')](),controller[_0xb0ee('0xe')]);router[_0xb0ee('0x8')](_0xb0ee('0xf'),auth[_0xb0ee('0x9')](),controller['show']);router['post']('/',auth[_0xb0ee('0x9')](),controller[_0xb0ee('0x10')]);router['put']('/:id',auth[_0xb0ee('0x9')](),controller[_0xb0ee('0x11')]);router[_0xb0ee('0x12')](_0xb0ee('0xf'),auth['isAuthenticated'](),controller[_0xb0ee('0x13')]);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 65a2ff3..0a9503e 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 _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 +var _0x5d91=['YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','format'];(function(_0x5af081,_0x566d25){var _0x2dde7b=function(_0x491b43){while(--_0x491b43){_0x5af081['push'](_0x5af081['shift']());}};_0x2dde7b(++_0x566d25);}(_0x5d91,0xf8));var _0x15d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d91[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x15d9('0x0'));var moment=require(_0x15d9('0x1'));module[_0x15d9('0x2')]={'type':{'type':Sequelize[_0x15d9('0x3')]},'uniqueid':{'type':Sequelize[_0x15d9('0x3')]},'calleridnum':{'type':Sequelize[_0x15d9('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x15d9('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x15d9('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x15d9('0x4')],'set':function(_0x125f5a){var _0x494d5c=moment(_0x125f5a);var _0x16c7fe=moment(this[_0x15d9('0x5')]('queuecallerjoinAt'))[_0x15d9('0x6')](_0x15d9('0x7'));var _0xe3f124=_0x494d5c[_0x15d9('0x8')](_0x16c7fe,_0x15d9('0x9'));this[_0x15d9('0xa')](_0x15d9('0xb'),_0x125f5a);this[_0x15d9('0xa')](_0x15d9('0xc'),_0xe3f124||null);}},'position':{'type':Sequelize[_0x15d9('0xd')]},'count':{'type':Sequelize[_0x15d9('0xd')]},'queuecallerabandon':{'type':Sequelize[_0x15d9('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x15d9('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x15d9('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x15d9('0x4')]},'queuecallerexit':{'type':Sequelize[_0x15d9('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x15d9('0x3')],'comment':_0x15d9('0xf')},'originalposition':{'type':Sequelize[_0x15d9('0xd')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x15d9('0x3')]},'connectedlinename':{'type':Sequelize[_0x15d9('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x15d9('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x15d9('0xd')]},'mohtime':{'type':Sequelize[_0x15d9('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x15d9('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x15d9('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x15d9('0x10')},'transferexten':{'type':Sequelize[_0x15d9('0x3')]},'transferuniqueid':{'type':Sequelize[_0x15d9('0x3')]},'disposition':{'type':Sequelize[_0x15d9('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 3e2ac93..b373fe8 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 _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 +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(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 54cffa4..0c0d161 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 _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 +var _0xe8c2=['exports','events','VoiceQueueReport','update','remove','emit','hasOwnProperty','hook'];(function(_0x1ec312,_0x5af072){var _0x2d249f=function(_0x59b1d8){while(--_0x59b1d8){_0x1ec312['push'](_0x1ec312['shift']());}};_0x2d249f(++_0x5af072);}(_0xe8c2,0x81));var _0x2e8c=function(_0x85c1d6,_0x194c2b){_0x85c1d6=_0x85c1d6-0x0;var _0x45afcd=_0xe8c2[_0x85c1d6];return _0x45afcd;};'use strict';var EventEmitter=require(_0x2e8c('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x2e8c('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x2e8c('0x2'),'afterDestroy':_0x2e8c('0x3')};function emitEvent(_0x9fcf92){return function(_0x1da7f4,_0x5dc895,_0x4354c5){VoiceQueueReportEvents[_0x2e8c('0x4')](_0x9fcf92+':'+_0x1da7f4['id'],_0x1da7f4);VoiceQueueReportEvents['emit'](_0x9fcf92,_0x1da7f4);_0x4354c5(null);};}for(var e in events){if(events[_0x2e8c('0x5')](e)){var event=events[e];VoiceQueueReport[_0x2e8c('0x6')](e,emitEvent(event));}}module[_0x2e8c('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 95565b0..49a1c11 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 _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 +var _0x2032=['./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x45096e,_0x17e82d){var _0xba1fa3=function(_0x29f43c){while(--_0x29f43c){_0x45096e['push'](_0x45096e['shift']());}};_0xba1fa3(++_0x17e82d);}(_0x2032,0xd9));var _0x2203=function(_0xb02085,_0x3df377){_0xb02085=_0xb02085-0x0;var _0xb7291d=_0x2032[_0xb02085];return _0xb7291d;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var logger=require(_0x2203('0x1'))(_0x2203('0x2'));var moment=require('moment');var BPromise=require(_0x2203('0x3'));var rp=require(_0x2203('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var attributes=require(_0x2203('0x7'));module[_0x2203('0x8')]=function(_0x3f7ba1,_0x13367a){return _0x3f7ba1[_0x2203('0x9')](_0x2203('0xa'),attributes,{'tableName':_0x2203('0xb'),'paranoid':![],'indexes':[{'fields':[_0x2203('0xc')]},{'fields':[_0x2203('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 85a952e..372619c 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 _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 +var _0x9856=['then','stringify','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','limit','lodash','util','../../mysqldb','../../config/utils','../../config/environment','http','defaults','register','request','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','attributes','include','map','model'];(function(_0x55d070,_0x217865){var _0x1b4b62=function(_0x5ade29){while(--_0x5ade29){_0x55d070['push'](_0x55d070['shift']());}};_0x1b4b62(++_0x217865);}(_0x9856,0x170));var _0x6985=function(_0x1bbaa5,_0x4eadff){_0x1bbaa5=_0x1bbaa5-0x0;var _0x585ef2=_0x9856[_0x1bbaa5];return _0x585ef2;};'use strict';var _=require(_0x6985('0x0'));var util=require(_0x6985('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6985('0x2'))['db'];var utils=require(_0x6985('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x6985('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6985('0x5')]({'port':0x232a});config['redis']=_[_0x6985('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0x6985('0x7')](socket);function respondWithRpcPromise(_0x13cedc,_0x5e9914,_0x42e715){return new BPromise(function(_0x42750e,_0x2e6ea7){return client[_0x6985('0x8')](_0x13cedc,_0x42e715)['then'](function(_0x226a34){logger[_0x6985('0x9')](_0x6985('0xa'),_0x5e9914,'request\x20sent');logger[_0x6985('0xb')](_0x6985('0xc'),_0x5e9914,_0x6985('0xd'),JSON['stringify'](_0x226a34));if(_0x226a34[_0x6985('0xe')]){if(_0x226a34['error'][_0x6985('0xf')]===0x1f4){logger['error'](_0x6985('0xa'),_0x5e9914,_0x226a34['error'][_0x6985('0x10')]);return _0x2e6ea7(_0x226a34[_0x6985('0xe')][_0x6985('0x10')]);}logger[_0x6985('0xe')](_0x6985('0xa'),_0x5e9914,_0x226a34[_0x6985('0xe')][_0x6985('0x10')]);return _0x42750e(_0x226a34['error'][_0x6985('0x10')]);}else{logger[_0x6985('0x9')](_0x6985('0xa'),_0x5e9914,_0x6985('0xd'));_0x42750e(_0x226a34[_0x6985('0x11')]['message']);}})[_0x6985('0x12')](function(_0x5c76c9){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x5e9914,_0x5c76c9);_0x2e6ea7(_0x5c76c9);});});}exports[_0x6985('0x13')]=function(_0x21c63c){var _0x3c5430=this;return new Promise(function(_0x498270,_0x1f0c51){return db[_0x6985('0x14')]['findAll']({'raw':_0x21c63c[_0x6985('0x15')]?_0x21c63c[_0x6985('0x15')][_0x6985('0x16')]===undefined?!![]:![]:!![],'where':_0x21c63c[_0x6985('0x15')]?_0x21c63c[_0x6985('0x15')][_0x6985('0x17')]||null:null,'attributes':_0x21c63c[_0x6985('0x15')]?_0x21c63c[_0x6985('0x15')][_0x6985('0x18')]||null:null,'limit':_0x21c63c['options']?_0x21c63c['options']['limit']||null:null,'include':_0x21c63c[_0x6985('0x15')]?_0x21c63c[_0x6985('0x15')][_0x6985('0x19')]?_[_0x6985('0x1a')](_0x21c63c['options']['include'],function(_0x44d03c){return{'model':db[_0x44d03c['model']],'as':_0x44d03c['as'],'attributes':_0x44d03c['attributes'],'include':_0x44d03c[_0x6985('0x19')]?_['map'](_0x44d03c[_0x6985('0x19')],function(_0x445c12){return{'model':db[_0x445c12['model']],'as':_0x445c12['as'],'attributes':_0x445c12['attributes'],'include':_0x445c12['include']?_[_0x6985('0x1a')](_0x445c12['include'],function(_0x48e163){return{'model':db[_0x48e163[_0x6985('0x1b')]],'as':_0x48e163['as'],'attributes':_0x48e163[_0x6985('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6985('0x1c')](function(_0x399670){logger[_0x6985('0x9')](_0x6985('0x13'),_0x21c63c);logger[_0x6985('0xb')]('GetVoiceQueueReport',_0x21c63c,JSON[_0x6985('0x1d')](_0x399670));_0x498270(_0x399670);})['catch'](function(_0x50a3db){logger[_0x6985('0xe')](_0x6985('0x13'),_0x50a3db[_0x6985('0x10')],_0x21c63c);_0x1f0c51(_0x3c5430[_0x6985('0xe')](0x1f4,_0x50a3db[_0x6985('0x10')]));});});};exports[_0x6985('0x1e')]=function(_0x2f33da){var _0x2a47af=this;return new Promise(function(_0x2e7866,_0x2c17f2){return db[_0x6985('0x14')][_0x6985('0x1f')](_0x2f33da[_0x6985('0x20')],{'raw':_0x2f33da[_0x6985('0x15')]?_0x2f33da[_0x6985('0x15')][_0x6985('0x16')]===undefined?!![]:![]:!![]})[_0x6985('0x1c')](function(_0x3dba6e){logger[_0x6985('0x9')]('CreateVoiceQueueReport',_0x2f33da);logger[_0x6985('0xb')](_0x6985('0x1e'),_0x2f33da,JSON[_0x6985('0x1d')](_0x3dba6e));_0x2e7866(_0x3dba6e);})[_0x6985('0x12')](function(_0x8bd939){logger[_0x6985('0xe')](_0x6985('0x1e'),_0x8bd939[_0x6985('0x10')],_0x2f33da);_0x2c17f2(_0x2a47af[_0x6985('0xe')](0x1f4,_0x8bd939[_0x6985('0x10')]));});});};exports[_0x6985('0x21')]=function(_0x17cb39){var _0x506a06=this;return new Promise(function(_0x3c82d0,_0x58a954){return db[_0x6985('0x14')][_0x6985('0x22')](_0x17cb39['body'],{'raw':_0x17cb39[_0x6985('0x15')]?_0x17cb39['options'][_0x6985('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17cb39[_0x6985('0x15')]?_0x17cb39[_0x6985('0x15')][_0x6985('0x17')]||null:null,'attributes':_0x17cb39['options']?_0x17cb39[_0x6985('0x15')][_0x6985('0x18')]||null:null,'limit':_0x17cb39[_0x6985('0x15')]?_0x17cb39[_0x6985('0x15')][_0x6985('0x23')]||null:null})[_0x6985('0x1c')](function(_0x1e3e13){logger['info'](_0x6985('0x21'),_0x17cb39);logger['debug'](_0x6985('0x21'),_0x17cb39,JSON[_0x6985('0x1d')](_0x1e3e13));_0x3c82d0(_0x1e3e13);})[_0x6985('0x12')](function(_0x5e87df){logger['error'](_0x6985('0x21'),_0x5e87df[_0x6985('0x10')],_0x17cb39);_0x58a954(_0x506a06[_0x6985('0xe')](0x1f4,_0x5e87df[_0x6985('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index a0c40a7..85fec37 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 _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 +var _0x9663=['register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove'];(function(_0x34b6d4,_0x33fd82){var _0x41c44a=function(_0x3f1313){while(--_0x3f1313){_0x34b6d4['push'](_0x34b6d4['shift']());}};_0x41c44a(++_0x33fd82);}(_0x9663,0x1a7));var _0x3966=function(_0x2f2358,_0x4fec00){_0x2f2358=_0x2f2358-0x0;var _0x4d1d8f=_0x9663[_0x2f2358];return _0x4d1d8f;};'use strict';var VoiceQueueReportEvents=require(_0x3966('0x0'));var events=[_0x3966('0x1'),_0x3966('0x2'),'update'];function createListener(_0x2b7088,_0x4148dd){return function(_0x394119){_0x4148dd['emit'](_0x2b7088,_0x394119);};}function removeListener(_0x339467,_0xd5975f){return function(){VoiceQueueReportEvents['removeListener'](_0x339467,_0xd5975f);};}exports[_0x3966('0x3')]=function(_0x32a92c){for(var _0x51392b=0x0,_0x5d6710=events[_0x3966('0x4')];_0x51392b<_0x5d6710;_0x51392b++){var _0x1d042c=events[_0x51392b];var _0x49096e=createListener(_0x3966('0x5')+_0x1d042c,_0x32a92c);VoiceQueueReportEvents['on'](_0x1d042c,_0x49096e);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 57c796b..6ef67d7 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 _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 +var _0x91ac=['delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','show','put','/:id','update'];(function(_0x4fe526,_0x34b040){var _0x1c4ba0=function(_0x4b5736){while(--_0x4b5736){_0x4fe526['push'](_0x4fe526['shift']());}};_0x1c4ba0(++_0x34b040);}(_0x91ac,0x17c));var _0xc91a=function(_0x9f46f5,_0xf4cc8){_0x9f46f5=_0x9f46f5-0x0;var _0x121a01=_0x91ac[_0x9f46f5];return _0x121a01;};'use strict';var multer=require(_0xc91a('0x0'));var util=require(_0xc91a('0x1'));var path=require(_0xc91a('0x2'));var timeout=require(_0xc91a('0x3'));var express=require(_0xc91a('0x4'));var router=express[_0xc91a('0x5')]();var auth=require(_0xc91a('0x6'));var interaction=require(_0xc91a('0x7'));var config=require(_0xc91a('0x8'));var controller=require(_0xc91a('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc91a('0xa')]('/:id',auth[_0xc91a('0xb')](),controller[_0xc91a('0xc')]);router['post']('/',auth[_0xc91a('0xb')](),controller['create']);router[_0xc91a('0xd')](_0xc91a('0xe'),auth[_0xc91a('0xb')](),controller[_0xc91a('0xf')]);router[_0xc91a('0x10')](_0xc91a('0xe'),auth[_0xc91a('0xb')](),controller[_0xc91a('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 6a5d3aa..ed5dbe3 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 _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 +var _0x02c5=['exports','STRING','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment'];(function(_0x3cf350,_0x382aa7){var _0x33ea35=function(_0x1666aa){while(--_0x1666aa){_0x3cf350['push'](_0x3cf350['shift']());}};_0x33ea35(++_0x382aa7);}(_0x02c5,0x76));var _0x502c=function(_0x40d728,_0x190ef2){_0x40d728=_0x40d728-0x0;var _0x207740=_0x02c5[_0x40d728];return _0x207740;};'use strict';var Sequelize=require(_0x502c('0x0'));var moment=require(_0x502c('0x1'));module[_0x502c('0x2')]={'time':{'type':Sequelize[_0x502c('0x3')]},'callid':{'type':Sequelize[_0x502c('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x502c('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x502c('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x502c('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x502c('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x502c('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x502c('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x502c('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x502c('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()['format'](_0x502c('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 783dfe0..be15973 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 _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 +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(_0xf84660,_0x42ee71){var _0x503742=function(_0x3e9a4f){while(--_0x3e9a4f){_0xf84660['push'](_0xf84660['shift']());}};_0x503742(++_0x42ee71);}(_0xb10b,0x12a));var _0xbb10=function(_0x20e882,_0x16185c){_0x20e882=_0x20e882-0x0;var _0x3e0dbe=_0xb10b[_0x20e882];return _0x3e0dbe;};'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 d720aa8..b39e192 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 _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 +var _0xe65f=['define','event_dtm','dtm','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports'];(function(_0x27519d,_0x5eaba9){var _0x535b3e=function(_0x3fd0d8){while(--_0x3fd0d8){_0x27519d['push'](_0x27519d['shift']());}};_0x535b3e(++_0x5eaba9);}(_0xe65f,0x1a7));var _0xfe65=function(_0x87eee5,_0x581852){_0x87eee5=_0x87eee5-0x0;var _0x17e2dc=_0xe65f[_0x87eee5];return _0x17e2dc;};'use strict';var _=require(_0xfe65('0x0'));var util=require(_0xfe65('0x1'));var logger=require(_0xfe65('0x2'))('api');var moment=require(_0xfe65('0x3'));var BPromise=require(_0xfe65('0x4'));var rp=require(_0xfe65('0x5'));var fs=require('fs');var path=require(_0xfe65('0x6'));var rimraf=require(_0xfe65('0x7'));var config=require(_0xfe65('0x8'));var attributes=require(_0xfe65('0x9'));module[_0xfe65('0xa')]=function(_0x4052d3,_0x4d2a4f){return _0x4052d3[_0xfe65('0xb')]('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xfe65('0xc'),'fields':['event',_0xfe65('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 3c8ad9f..50099ed 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 _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 +var _0xc29b=['catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x59ce79,_0x290843){var _0x1de3a8=function(_0x2b2d52){while(--_0x2b2d52){_0x59ce79['push'](_0x59ce79['shift']());}};_0x1de3a8(++_0x290843);}(_0xc29b,0x12d));var _0xbc29=function(_0x5c0be9,_0x44aab7){_0x5c0be9=_0x5c0be9-0x0;var _0x478881=_0xc29b[_0x5c0be9];return _0x478881;};'use strict';var _=require(_0xbc29('0x0'));var util=require(_0xbc29('0x1'));var moment=require(_0xbc29('0x2'));var BPromise=require('bluebird');var rs=require(_0xbc29('0x3'));var fs=require('fs');var Redis=require(_0xbc29('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbc29('0x5'));var logger=require(_0xbc29('0x6'))(_0xbc29('0x7'));var config=require(_0xbc29('0x8'));var jayson=require(_0xbc29('0x9'));var client=jayson[_0xbc29('0xa')][_0xbc29('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40f0c9,_0x463e2b,_0x37d9dd){return new BPromise(function(_0x2e5fb7,_0x29b188){return client[_0xbc29('0xc')](_0x40f0c9,_0x37d9dd)[_0xbc29('0xd')](function(_0x320cb4){logger[_0xbc29('0xe')](_0xbc29('0xf'),_0x463e2b,_0xbc29('0x10'));logger[_0xbc29('0x11')](_0xbc29('0x12'),_0x463e2b,'request\x20sent',JSON[_0xbc29('0x13')](_0x320cb4));if(_0x320cb4[_0xbc29('0x14')]){if(_0x320cb4[_0xbc29('0x14')][_0xbc29('0x15')]===0x1f4){logger[_0xbc29('0x14')](_0xbc29('0xf'),_0x463e2b,_0x320cb4[_0xbc29('0x14')]['message']);return _0x29b188(_0x320cb4[_0xbc29('0x14')][_0xbc29('0x16')]);}logger[_0xbc29('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0x463e2b,_0x320cb4['error'][_0xbc29('0x16')]);return _0x2e5fb7(_0x320cb4['error'][_0xbc29('0x16')]);}else{logger[_0xbc29('0xe')](_0xbc29('0xf'),_0x463e2b,'request\x20sent');_0x2e5fb7(_0x320cb4[_0xbc29('0x17')]['message']);}})[_0xbc29('0x18')](function(_0x3b5bae){logger[_0xbc29('0x14')](_0xbc29('0xf'),_0x463e2b,_0x3b5bae);_0x29b188(_0x3b5bae);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 3e1e962..ec64100 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(_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 +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(_0x1a5fee,_0x2b291d){var _0x4f6e8b=function(_0x5be3a5){while(--_0x5be3a5){_0x1a5fee['push'](_0x1a5fee['shift']());}};_0x4f6e8b(++_0x2b291d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var 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 9662e91..10826ce 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 _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 +var _0x9aa5=['sequelize','moment','exports','VIRTUAL','value','extname','getDataValue','STRING','channel','setDataValue','INTEGER','TEXT','NEW','FLOAT','BOOLEAN','DATE','format','toString','updatedAt'];(function(_0xbbfe59,_0x46067f){var _0x28a2a4=function(_0xfe230){while(--_0xfe230){_0xbbfe59['push'](_0xbbfe59['shift']());}};_0x28a2a4(++_0x46067f);}(_0x9aa5,0x1c8));var _0x59aa=function(_0x5c9dc5,_0x4296b3){_0x5c9dc5=_0x5c9dc5-0x0;var _0x3a6fc7=_0x9aa5[_0x5c9dc5];return _0x3a6fc7;};'use strict';var Sequelize=require(_0x59aa('0x0'));var moment=require(_0x59aa('0x1'));var path=require('path');module[_0x59aa('0x2')]={'format':{'type':Sequelize[_0x59aa('0x3')],'get':function(){return this['getDataValue'](_0x59aa('0x4'))?path[_0x59aa('0x5')](this[_0x59aa('0x6')](_0x59aa('0x4'))):undefined;}},'uniqueid':{'type':Sequelize[_0x59aa('0x7')]},'channel':{'type':Sequelize[_0x59aa('0x7')],'set':function(_0x1d0b22){if(_0x1d0b22){this['setDataValue'](_0x59aa('0x8'),_0x1d0b22);this[_0x59aa('0x9')]('membername',_0x1d0b22['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x59aa('0x7')]},'calleridnum':{'type':Sequelize[_0x59aa('0x7')]},'calleridname':{'type':Sequelize[_0x59aa('0x7')]},'connectedlinenum':{'type':Sequelize[_0x59aa('0x7')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x59aa('0x7')]},'context':{'type':Sequelize[_0x59aa('0x7')]},'exten':{'type':Sequelize[_0x59aa('0x7')]},'value':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0x59aa('0xa')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x59aa('0x7')]},'location':{'type':Sequelize[_0x59aa('0xb')]},'transcribeName':{'type':Sequelize['STRING']},'transcribeStatus':{'type':Sequelize[_0x59aa('0x7')],'defaultValue':_0x59aa('0xc')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x59aa('0xb')]},'failureReason':{'type':Sequelize[_0x59aa('0xb')]},'sentiment':{'type':Sequelize[_0x59aa('0x7')]},'sPositive':{'type':Sequelize[_0x59aa('0xd')]},'sNegative':{'type':Sequelize[_0x59aa('0xd')]},'sNeutral':{'type':Sequelize[_0x59aa('0xd')]},'sMixed':{'type':Sequelize[_0x59aa('0xd')]},'tempSentiment':{'type':Sequelize[_0x59aa('0xe')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x59aa('0xf')],'get':function(){return moment(this[_0x59aa('0x6')]('createdAt'))[_0x59aa('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x59aa('0x11')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x59aa('0x6')](_0x59aa('0x12')))[_0x59aa('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x59aa('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 168bee3..5a30da6 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 _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 +var _0x988e=['TranscribeService','startTranscriptionJob','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','runTranscribe','findOne','ValidationError','transcribe','transcribeAccountId','transcribeRegion','runSentiment','sentiment','sentimentRegion','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','data2','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','json','reject','update','then','destroy','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','differenceBy','format','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','find','catch','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','filename','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','sequelize','MD5','col','token','$and','push','extname','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','.cypher','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket'];(function(_0x73540f,_0x1c0976){var _0x56967a=function(_0xa670d6){while(--_0xa670d6){_0x73540f['push'](_0x73540f['shift']());}};_0x56967a(++_0x1c0976);}(_0x988e,0x154));var _0xe988=function(_0x3f5269,_0x4bcd9d){_0x3f5269=_0x3f5269-0x0;var _0xbeedd0=_0x988e[_0x3f5269];return _0xbeedd0;};'use strict';var pdf=require(_0xe988('0x0'));var emlformat=require(_0xe988('0x1'));var rimraf=require(_0xe988('0x2'));var zipdir=require(_0xe988('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe988('0x4'));var moment=require(_0xe988('0x5'));var BPromise=require(_0xe988('0x6'));var Mustache=require(_0xe988('0x7'));var util=require(_0xe988('0x8'));var path=require(_0xe988('0x9'));var sox=require(_0xe988('0xa'));var csv=require(_0xe988('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe988('0xc'));var squel=require(_0xe988('0xd'));var crypto=require(_0xe988('0xe'));var jsforce=require(_0xe988('0xf'));var deskjs=require(_0xe988('0x10'));var toCsv=require(_0xe988('0xb'));var querystring=require('querystring');var Papa=require(_0xe988('0x11'));var AWS=require(_0xe988('0x12'));var uuidv4=require(_0xe988('0x13'));var Redis=require(_0xe988('0x14'));var authService=require(_0xe988('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xe988('0x16'));var hardwareService=require(_0xe988('0x17'));var logger=require(_0xe988('0x18'))(_0xe988('0x19'));var utils=require(_0xe988('0x1a'));var config=require('../../config/environment');var db=require(_0xe988('0x1b'))['db'];function respondWithStatusCode(_0x39e52b,_0x42f972){_0x42f972=_0x42f972||0xcc;return function(_0x3e0d9a){if(_0x3e0d9a){return _0x39e52b[_0xe988('0x1c')](_0x42f972);}return _0x39e52b[_0xe988('0x1d')](_0x42f972)[_0xe988('0x1e')]();};}function respondWithResult(_0xb215a4,_0x33d8dd){_0x33d8dd=_0x33d8dd||0xc8;return function(_0x5a3a6d){if(_0x5a3a6d){return _0xb215a4[_0xe988('0x1d')](_0x33d8dd)['json'](_0x5a3a6d);}};}function respondWithFilteredResult(_0x31a2ea,_0x13c0a5){return function(_0x499aa4){if(_0x499aa4){var _0x3d2c4c=_0x499aa4[_0xe988('0x1f')],_0x674086=_0x13c0a5['offset'],_0x29d9bd=_0x13c0a5['offset']+_0x13c0a5[_0xe988('0x20')],_0x2b425c;if(_0x29d9bd>=_0x3d2c4c){_0x29d9bd=_0x3d2c4c;_0x2b425c=0xc8;}else{_0x2b425c=0xce;}_0x31a2ea[_0xe988('0x1d')](_0x2b425c);return _0x31a2ea[_0xe988('0x21')](_0xe988('0x22'),_0x674086+'-'+_0x29d9bd+'/'+_0x3d2c4c)[_0xe988('0x23')](_0x499aa4);}return null;};}function patchUpdates(_0x2ee326){return function(_0x39a46d){try{jsonpatch['apply'](_0x39a46d,_0x2ee326,!![]);}catch(_0x275649){return BPromise[_0xe988('0x24')](_0x275649);}return _0x39a46d['save']();};}function saveUpdates(_0x1d7603,_0x993e05){return function(_0x6799ea){if(_0x6799ea){return _0x6799ea[_0xe988('0x25')](_0x1d7603)[_0xe988('0x26')](function(_0xdcc6cc){return _0xdcc6cc;});}return null;};}function removeEntity(_0x35234d,_0x4efce4){return function(_0x5f0a3a){if(_0x5f0a3a){return _0x5f0a3a[_0xe988('0x27')]()['then'](function(){_0x35234d[_0xe988('0x1d')](0xcc)[_0xe988('0x1e')]();});}};}function handleEntityNotFound(_0x368676,_0x1cde4e){return function(_0x30ce19){if(!_0x30ce19){_0x368676['sendStatus'](0x194);}return _0x30ce19;};}function handleError(_0x6592d9,_0x385fd8){_0x385fd8=_0x385fd8||0x1f4;return function(_0x674b9b){logger[_0xe988('0x28')](_0x674b9b[_0xe988('0x29')]);if(_0x674b9b[_0xe988('0x2a')]){delete _0x674b9b[_0xe988('0x2a')];}_0x6592d9['status'](_0x385fd8)[_0xe988('0x2b')](_0x674b9b);};}exports[_0xe988('0x2c')]=function(_0x574720,_0x3522a7){var _0x51b25f={},_0x171a37={},_0x203315={'count':0x0,'rows':[]};var _0x28de53=_[_0xe988('0x2d')](db[_0xe988('0x2e')][_0xe988('0x2f')],function(_0x26e155){return{'name':_0x26e155[_0xe988('0x30')],'type':_0x26e155[_0xe988('0x31')][_0xe988('0x32')]};});_0x171a37['model']=_[_0xe988('0x33')](_[_0xe988('0x2d')](_0x28de53,_0xe988('0x2a')),[_0xe988('0x34')]);_0x171a37['query']=_[_0xe988('0x35')](_0x574720[_0xe988('0x36')]);_0x171a37[_0xe988('0x37')]=_[_0xe988('0x38')](_0x171a37[_0xe988('0x39')],_0x171a37[_0xe988('0x36')]);_0x51b25f[_0xe988('0x3a')]=_['intersection'](_0x171a37['model'],qs[_0xe988('0x3b')](_0x574720[_0xe988('0x36')][_0xe988('0x3b')]));_0x51b25f[_0xe988('0x3a')]=_0x51b25f['attributes'][_0xe988('0x3c')]?_0x51b25f['attributes']:_0x171a37[_0xe988('0x39')];if(!_0x574720[_0xe988('0x36')][_0xe988('0x3d')](_0xe988('0x3e'))){_0x51b25f[_0xe988('0x20')]=qs['limit'](_0x574720[_0xe988('0x36')][_0xe988('0x20')]);_0x51b25f['offset']=qs[_0xe988('0x3f')](_0x574720[_0xe988('0x36')][_0xe988('0x3f')]);}_0x51b25f[_0xe988('0x40')]=qs[_0xe988('0x41')](_0x574720[_0xe988('0x36')][_0xe988('0x41')]);_0x51b25f[_0xe988('0x42')]=qs[_0xe988('0x37')](_[_0xe988('0x43')](_0x574720[_0xe988('0x36')],_0x171a37[_0xe988('0x37')]),_0x28de53);if(_0x574720['query'][_0xe988('0x44')]){_0x51b25f['where']=_[_0xe988('0x45')](_0x51b25f[_0xe988('0x42')],{'$or':_[_0xe988('0x2d')](_0x28de53,function(_0x202f70){if(_0x202f70['type']!=='VIRTUAL'){var _0x3a881e={};_0x3a881e[_0x202f70[_0xe988('0x2a')]]={'$like':'%'+_0x574720[_0xe988('0x36')][_0xe988('0x44')]+'%'};return _0x3a881e;}})});}_0x51b25f=_['merge']({},_0x51b25f,_0x574720[_0xe988('0x46')]);var _0x26117b={'where':_0x51b25f[_0xe988('0x42')]};return db[_0xe988('0x2e')][_0xe988('0x1f')](_0x26117b)[_0xe988('0x26')](function(_0x2b9520){_0x203315[_0xe988('0x1f')]=_0x2b9520;if(_0x574720[_0xe988('0x36')][_0xe988('0x47')]){_0x51b25f[_0xe988('0x48')]=[{'all':!![]}];}return db['VoiceRecording'][_0xe988('0x49')](_0x51b25f);})[_0xe988('0x26')](function(_0x5925c0){_0x203315[_0xe988('0x4a')]=_0x5925c0;return _0x203315;})['then'](respondWithFilteredResult(_0x3522a7,_0x51b25f))['catch'](handleError(_0x3522a7,null));};exports['show']=function(_0x5f484c,_0x533645){var _0x2f1345={'raw':![],'where':{'id':_0x5f484c[_0xe988('0x4b')]['id']}},_0x572416={};_0x572416[_0xe988('0x39')]=_[_0xe988('0x35')](db['VoiceRecording'][_0xe988('0x2f')]);_0x572416[_0xe988('0x36')]=_[_0xe988('0x35')](_0x5f484c['query']);_0x572416[_0xe988('0x37')]=_['intersection'](_0x572416[_0xe988('0x39')],_0x572416[_0xe988('0x36')]);_0x2f1345[_0xe988('0x3a')]=_[_0xe988('0x38')](_0x572416[_0xe988('0x39')],qs[_0xe988('0x3b')](_0x5f484c[_0xe988('0x36')][_0xe988('0x3b')]));_0x2f1345[_0xe988('0x3a')]=_0x2f1345['attributes'][_0xe988('0x3c')]?_0x2f1345[_0xe988('0x3a')]:_0x572416[_0xe988('0x39')];if(_0x5f484c[_0xe988('0x36')][_0xe988('0x47')]){_0x2f1345[_0xe988('0x48')]=[{'all':!![]}];}_0x2f1345=_[_0xe988('0x45')]({},_0x2f1345,_0x5f484c[_0xe988('0x46')]);return db[_0xe988('0x2e')][_0xe988('0x4c')](_0x2f1345)['then'](handleEntityNotFound(_0x533645,null))['then'](respondWithResult(_0x533645,null))[_0xe988('0x4d')](handleError(_0x533645,null));};exports[_0xe988('0x4e')]=function(_0x21b311,_0x2488b6){return db['VoiceRecording'][_0xe988('0x4e')](_0x21b311[_0xe988('0x4f')],{})[_0xe988('0x26')](respondWithResult(_0x2488b6,0xc9))[_0xe988('0x4d')](handleError(_0x2488b6,null));};exports[_0xe988('0x25')]=function(_0x3ab765,_0x5d770f){if(_0x3ab765[_0xe988('0x4f')]['id']){delete _0x3ab765[_0xe988('0x4f')]['id'];}return db['VoiceRecording'][_0xe988('0x4c')]({'where':{'id':_0x3ab765[_0xe988('0x4b')]['id']}})[_0xe988('0x26')](handleEntityNotFound(_0x5d770f,null))['then'](saveUpdates(_0x3ab765[_0xe988('0x4f')],null))[_0xe988('0x26')](respondWithResult(_0x5d770f,null))[_0xe988('0x4d')](handleError(_0x5d770f,null));};exports[_0xe988('0x50')]=function(_0x42a30b,_0x2625c5){return db[_0xe988('0x2e')]['describe']()[_0xe988('0x26')](respondWithResult(_0x2625c5,null))[_0xe988('0x4d')](handleError(_0x2625c5,null));};exports[_0xe988('0x51')]=function(_0x35db71,_0x4dfc37,_0x4d631e){var _0x16422c=require(_0xe988('0x52'));var _0x5ce53b=![];var _0x1bcea1={};if(_0x35db71['query'][_0xe988('0x31')]&&_0x35db71[_0xe988('0x36')][_0xe988('0x31')]===_0xe988('0x53')){_0x1bcea1[_0xe988('0x53')]=_0x35db71[_0xe988('0x4b')]['id'];}else{_0x1bcea1['id']=_0x35db71[_0xe988('0x4b')]['id'];}return db[_0xe988('0x2e')]['find']({'where':_0x1bcea1,'attributes':['id',_0xe988('0x54')],'raw':!![]})[_0xe988('0x26')](handleEntityNotFound(_0x4dfc37,null))[_0xe988('0x26')](function(_0x1a3f87){if(_0x1a3f87){var _0x476c71=_0x1a3f87[_0xe988('0x54')];var _0x841477=util['format'](_0xe988('0x55'),_0x476c71);if(fs[_0xe988('0x56')](_0x841477)){_0x5ce53b=!![];return _0x16422c[_0xe988('0x57')](_0x841477,_0x476c71,config[_0xe988('0x58')][_0xe988('0x59')])[_0xe988('0x26')](function(){return _0x1a3f87;});}return _0x1a3f87;}})[_0xe988('0x26')](function(_0x965715){if(_0x965715){var _0x1cc0aa=_0x965715[_0xe988('0x54')];if(!fs[_0xe988('0x56')](_0x1cc0aa)){throw new db[(_0xe988('0x5a'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x965715[_0xe988('0x5b')]){return _0x4dfc37[_0xe988('0x51')](_0x1cc0aa,_0x965715['filename']+path['extname'](_0x1cc0aa),function(){if(_0x5ce53b){fs[_0xe988('0x5c')](_0x1cc0aa);}});}else{return _0x4dfc37[_0xe988('0x51')](_0x1cc0aa,function(_0x3e574c){if(_0x5ce53b){fs[_0xe988('0x5c')](_0x1cc0aa);}});}}})[_0xe988('0x4d')](function(_0x3f04e7){if(_0x3f04e7[_0xe988('0x5d')]===_0xe988('0x5e')){_0x4dfc37[_0xe988('0x1d')](0x194)[_0xe988('0x2b')](_0xe988('0x5f'));}else{return handleError(_0x4dfc37,null);}});};exports['downloads']=function(_0x172968,_0x55f69c,_0x25591c){var _0x24b72c=require(_0xe988('0x52'));var _0x128510=![];var _0x5a0fa7={'$and':[db[_0xe988('0x60')][_0xe988('0x42')](db[_0xe988('0x60')]['fn'](_0xe988('0x61'),db['sequelize'][_0xe988('0x62')](_0xe988('0x53'))),_0x172968[_0xe988('0x36')][_0xe988('0x63')])]};if(_0x172968[_0xe988('0x36')][_0xe988('0x31')]&&_0x172968[_0xe988('0x36')][_0xe988('0x31')]==='uniqueid'){_0x5a0fa7[_0xe988('0x64')]['push']({'uniqueid':_0x172968[_0xe988('0x4b')]['id']});}else{_0x5a0fa7[_0xe988('0x64')][_0xe988('0x65')]({'id':_0x172968[_0xe988('0x4b')]['id']});}return db['VoiceRecording'][_0xe988('0x4c')]({'where':_0x5a0fa7,'attributes':['id',_0xe988('0x54')],'raw':!![]})[_0xe988('0x26')](handleEntityNotFound(_0x55f69c,null))[_0xe988('0x26')](function(_0xe8caa){if(_0xe8caa){var _0x3c2735=util['format'](_0xe988('0x55'),_0xe8caa['value']);if(fs[_0xe988('0x56')](_0x3c2735)){_0x128510=!![];return _0x24b72c[_0xe988('0x57')](_0x3c2735,_0xe8caa[_0xe988('0x54')],config[_0xe988('0x58')][_0xe988('0x59')])[_0xe988('0x26')](function(){return _0xe8caa;});}return _0xe8caa;}})[_0xe988('0x26')](function(_0xf7bd7a){if(_0xf7bd7a){if(!fs[_0xe988('0x56')](_0xf7bd7a[_0xe988('0x54')])){throw new db['Sequelize']['ValidationError'](_0xe988('0x5e'));}if(_0xf7bd7a[_0xe988('0x5b')]){return _0x55f69c[_0xe988('0x51')](_0xf7bd7a[_0xe988('0x54')],_0xf7bd7a['filename']+path[_0xe988('0x66')](_0xf7bd7a[_0xe988('0x54')]),function(){if(_0x128510){fs[_0xe988('0x5c')](_0xf7bd7a[_0xe988('0x54')]);}});}else{return _0x55f69c[_0xe988('0x51')](_0xf7bd7a[_0xe988('0x54')],function(_0x3984c2){if(_0x128510){fs[_0xe988('0x5c')](_0xf7bd7a[_0xe988('0x54')]);}});}}})['catch'](handleError(_0x55f69c,null));};exports[_0xe988('0x27')]=function(_0x71ede2,_0x4dba18){return db['VoiceRecording'][_0xe988('0x4c')]({'where':{'id':_0x71ede2['params']['id']}})['then'](function(_0x146701){if(!_0x146701)throw new ReferenceError(_0xe988('0x67'));return _0x146701;})['then'](function(_0x1ecd86){var _0x38df2f=_0x1ecd86[_0xe988('0x54')];logger[_0xe988('0x68')](_0xe988('0x69'),_0x38df2f);if(!_[_0xe988('0x6a')](_0x1ecd86[_0xe988('0x54')])&&fs[_0xe988('0x56')](_0x38df2f)){logger[_0xe988('0x68')]('File:\x20\x22'+_0x38df2f+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x38df2f);}_0x38df2f=_0x38df2f+_0xe988('0x6b');if(!_[_0xe988('0x6a')](_0x1ecd86['value'])&&fs[_0xe988('0x56')](_0x38df2f)){logger[_0xe988('0x68')](_0xe988('0x6c')+_0x38df2f+_0xe988('0x6d'));fs[_0xe988('0x6e')](_0x38df2f);}return _0x1ecd86;})[_0xe988('0x26')](function(_0x47e522){if(!_0x47e522)throw new InternalError();return _0x47e522[_0xe988('0x27')]();})['then'](function(){_0x4dba18['status'](0xcc)['end']();})['catch'](handleError(_0x4dba18,null));};function getBucketslist(_0x4e87e5,_0x5a8ebc,_0x469c6f){return new Promise(function(_0x5f4220,_0x1dc37f){var _0x296723=new AWS['S3']({'accessKeyId':_0x5a8ebc,'secretAccessKey':_0x4e87e5,'region':_0x469c6f});_0x296723[_0xe988('0x6f')]({},function(_0x1a27fb,_0x4f1eef){if(_0x1a27fb){return _0x1dc37f(_0x1a27fb);}else{return _0x5f4220(_0x4f1eef);}});});}function createBucket(_0xafb9c1,_0x408eee,_0xe7697,_0x6fd623){return new Promise(function(_0x19bbd5,_0x486425){var _0x5c8e18=new AWS['S3']({'accessKeyId':_0x408eee,'secretAccessKey':_0xafb9c1,'region':_0xe7697});_0x5c8e18[_0xe988('0x70')]({'Bucket':_0x6fd623},function(_0x324299,_0x5c3010){if(_0x324299){return _0x486425(_0x324299);}else{return _0x19bbd5(_0x5c3010);}});});}function uploadFile(_0x1b6ad1,_0x59953d,_0x1c3f80,_0x5e7036,_0x2da593,_0x21d174){return new Promise(function(_0xa80832,_0x4f65e6){var _0x3d5051=new AWS['S3']({'accessKeyId':_0x59953d,'secretAccessKey':_0x1b6ad1,'region':_0x1c3f80});_0x3d5051['upload']({'Bucket':_0x5e7036,'Key':_0x2da593,'Body':_0x21d174},function(_0x5e0e6f,_0x577494){if(_0x5e0e6f){return _0x4f65e6(_0x5e0e6f);}else{return _0xa80832(_0x577494);}});});}function startTranscribe(_0x146f8b,_0x5d24e5,_0x920c2f,_0x305d8a,_0x41d848,_0x2c7089){return new Promise(function(_0x40f370,_0x237198){var _0x394694=new AWS[(_0xe988('0x71'))]({'accessKeyId':_0x5d24e5,'secretAccessKey':_0x146f8b,'region':_0x920c2f});_0x394694[_0xe988('0x72')]({'TranscriptionJobName':_0x305d8a,'LanguageCode':_0x41d848,'Media':{'MediaFileUri':_0x2c7089}},function(_0x5f4482,_0x262333){if(_0x5f4482){return _0x237198(_0x5f4482);}else{return _0x40f370(_0x262333);}});});}function transcribe(_0x425557,_0xeb8396,_0x530af7,_0xfa82af,_0x2159ca,_0x3a6309,_0x6ed0bb){return new Promise(function(_0x1f95bf,_0xa1e109){var _0x102d60={};logger[_0xe988('0x68')](util[_0xe988('0x34')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x425557,_0x2159ca));return uploadFile(_0xeb8396,_0x530af7,_0xfa82af,_0x2159ca,path[_0xe988('0x73')](_0x3a6309),fs['readFileSync'](_0x3a6309))[_0xe988('0x26')](function(_0x1af416){logger[_0xe988('0x68')](util[_0xe988('0x34')](_0xe988('0x74'),_0x425557,_0x2159ca,_0x1af416[_0xe988('0x75')]));_0x102d60[_0xe988('0x76')]=_0x1af416['Bucket'];_0x102d60[_0xe988('0x77')]=_0x1af416[_0xe988('0x75')];logger[_0xe988('0x68')](util['format']('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x425557));return startTranscribe(_0xeb8396,_0x530af7,_0xfa82af,uuidv4(),_0x6ed0bb,_0x1af416['Location']);})[_0xe988('0x26')](function(_0x501db1){logger[_0xe988('0x68')](util['format'](_0xe988('0x78'),_0x425557,_0x501db1[_0xe988('0x79')]['TranscriptionJobName']));_0x102d60[_0xe988('0x7a')]=_0x501db1['TranscriptionJob'][_0xe988('0x7b')];_0x102d60[_0xe988('0x7c')]=_0x501db1[_0xe988('0x79')]['TranscriptionJobStatus'];return _0x1f95bf(_0x102d60);})[_0xe988('0x4d')](function(_0x3bdb1c){return _0xa1e109(_0x3bdb1c);});});}exports[_0xe988('0x7d')]=function(_0x1fcd9c,_0x21651b,_0x54b33a){var _0x2696d0;var _0x38ad71;var _0x215a92;var _0x479e37=require(_0xe988('0x52'));return db[_0xe988('0x2e')][_0xe988('0x7e')]({'where':{'id':_0x1fcd9c[_0xe988('0x4b')]['id']}})['then'](function(_0x501321){if(_0x501321){var _0x3d2bdf=util[_0xe988('0x34')](_0xe988('0x55'),_0x501321[_0xe988('0x54')]);if(fs[_0xe988('0x56')](_0x3d2bdf)){cypher=!![];return _0x479e37['decryptFile'](_0x3d2bdf,_0x501321[_0xe988('0x54')],config[_0xe988('0x58')][_0xe988('0x59')])[_0xe988('0x26')](function(){return _0x501321;});}return _0x501321;}})[_0xe988('0x26')](function(_0x471c82){if(!_0x471c82){throw new db[(_0xe988('0x5a'))][(_0xe988('0x7f'))]('Voice\x20Recording\x20not\x20found');}_0x38ad71=_0x471c82;return db['Setting'][_0xe988('0x7e')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x21651b,null))[_0xe988('0x26')](function(_0x1d8308){if(_0x1d8308){_0x2696d0=_0x1d8308;if(!_0x2696d0[_0xe988('0x80')]||!_0x2696d0[_0xe988('0x81')]||!_0x2696d0[_0xe988('0x82')]||!_0x2696d0['language']||!_0x2696d0[_0xe988('0x76')]){throw new db[(_0xe988('0x5a'))][(_0xe988('0x7f'))]('Transcribe\x20not\x20configured');}if(_0x1fcd9c[_0xe988('0x4f')][_0xe988('0x83')]&&(!_0x2696d0[_0xe988('0x84')]||!_0x2696d0['sentimentAccountId']||!_0x2696d0[_0xe988('0x85')]||!_0x2696d0['language']||!_0x2696d0[_0xe988('0x76')])){throw new db[(_0xe988('0x5a'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db['CloudProvider'][_0xe988('0x7e')]({'where':{'id':_0x2696d0['transcribeAccountId']}});}})[_0xe988('0x26')](function(_0x158276){if(!_0x158276){throw new db['Sequelize'][(_0xe988('0x7f'))](_0xe988('0x86'));}if(!_0x158276[_0xe988('0x87')]||!_0x158276['data2']){throw new db['Sequelize'][(_0xe988('0x7f'))](_0xe988('0x88'));}_0x215a92=_0x158276;return getBucketslist(_0x215a92[_0xe988('0x87')],_0x215a92['data2'],_0x2696d0[_0xe988('0x82')]);})[_0xe988('0x26')](function(_0x4f0d71){if(_0x4f0d71&&_0x4f0d71[_0xe988('0x89')]){var _0x29dc7e=_[_0xe988('0x4c')](_0x4f0d71[_0xe988('0x89')],function(_0x1af53b){return _0x1af53b[_0xe988('0x8a')]===_0x2696d0[_0xe988('0x76')];});if(!_0x29dc7e){logger[_0xe988('0x68')](util[_0xe988('0x34')](_0xe988('0x8b'),_0x1fcd9c[_0xe988('0x4b')]['id'],_0x2696d0['bucket']));return createBucket(_0x215a92['data1'],_0x215a92[_0xe988('0x8c')],_0x2696d0['transcribeRegion'],_0x2696d0[_0xe988('0x76')]);}logger[_0xe988('0x68')](util[_0xe988('0x34')](_0xe988('0x8d'),_0x1fcd9c['params']['id'],_0x2696d0[_0xe988('0x76')]));return;}})[_0xe988('0x26')](function(_0x44bc61){if(_0x38ad71[_0xe988('0x7c')]===_0xe988('0x8e')){return transcribe(_0x1fcd9c['params']['id'],_0x215a92[_0xe988('0x87')],_0x215a92[_0xe988('0x8c')],_0x2696d0[_0xe988('0x82')],_0x2696d0[_0xe988('0x76')],_0x38ad71['value'],_0x2696d0['language']);}else{logger['info'](util['format'](_0xe988('0x8f'),_0x1fcd9c['params']['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xe988('0x26')](function(_0x470cf4){if(_0x470cf4){_0x470cf4['tempSentiment']=_0x1fcd9c[_0xe988('0x4f')][_0xe988('0x83')];return _0x38ad71['updateAttributes'](_0x470cf4);}})[_0xe988('0x26')](respondWithResult(_0x21651b,null))[_0xe988('0x4d')](handleError(_0x21651b,null));};function writeFile(_0x162516,_0x3b3997){return new Promise(function(_0x1e4de6,_0x3a33fb){fs[_0xe988('0x90')](_0x3b3997,_0x162516,function(_0xa66fa,_0x46ccc1){if(_0xa66fa){return _0x3a33fb(_0xa66fa);}else{return _0x1e4de6(_0x46ccc1);}});});}exports[_0xe988('0x91')]=function(_0x267f38,_0x3c4565,_0x3ff5c8){return db[_0xe988('0x2e')][_0xe988('0x7e')]({'where':{'id':_0x267f38[_0xe988('0x4b')]['id']}})[_0xe988('0x26')](handleEntityNotFound(_0x3c4565))[_0xe988('0x26')](function(_0x3f5f54){if(_0x3f5f54&&_0x3f5f54[_0xe988('0x92')]){var _0x55e11c=_0x3f5f54[_0xe988('0x92')];var _0x2708fb=config[_0xe988('0x93')]+_0xe988('0x94')+_0x3f5f54['id']+_0xe988('0x95');if(fs['existsSync'](_0x2708fb)){return _0x2708fb;}return writeFile(_0x55e11c,_0x2708fb)[_0xe988('0x26')](function(){return _0x2708fb;});}else{throw new db[(_0xe988('0x5a'))]['ValidationError'](_0xe988('0x96'));}})[_0xe988('0x26')](function(_0x7534a3){return _0x3c4565[_0xe988('0x51')](_0x7534a3);})['catch'](handleError(_0x3c4565));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 82b39e3..68c4a9d 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 _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 +var _0x2ab3=['../../config/environment','./voiceRecording.attributes','define','VoiceRecording','voice_recordings','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x47298a,_0x1e1946){var _0x4ae29a=function(_0x2e02a9){while(--_0x2e02a9){_0x47298a['push'](_0x47298a['shift']());}};_0x4ae29a(++_0x1e1946);}(_0x2ab3,0xbc));var _0x32ab=function(_0x41d432,_0x20e878){_0x41d432=_0x41d432-0x0;var _0x1650f9=_0x2ab3[_0x41d432];return _0x1650f9;};'use strict';var _=require('lodash');var util=require(_0x32ab('0x0'));var logger=require(_0x32ab('0x1'))('api');var moment=require(_0x32ab('0x2'));var BPromise=require(_0x32ab('0x3'));var rp=require(_0x32ab('0x4'));var fs=require('fs');var path=require(_0x32ab('0x5'));var rimraf=require(_0x32ab('0x6'));var config=require(_0x32ab('0x7'));var attributes=require(_0x32ab('0x8'));module['exports']=function(_0x39908b,_0x42826c){return _0x39908b[_0x32ab('0x9')](_0x32ab('0xa'),attributes,{'tableName':_0x32ab('0xb'),'paranoid':![],'indexes':[{'name':_0x32ab('0xc'),'fields':[_0x32ab('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index f966951..6dee6c3 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(_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 +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(_0x2ecf03,_0x2adccf){var _0x4418ab=function(_0x201f87){while(--_0x201f87){_0x2ecf03['push'](_0x2ecf03['shift']());}};_0x4418ab(++_0x2adccf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 8022542..ab016f0 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 _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 +var _0x46ed=['multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports'];(function(_0x1db0c1,_0x16ff01){var _0x298160=function(_0x35a788){while(--_0x35a788){_0x1db0c1['push'](_0x1db0c1['shift']());}};_0x298160(++_0x16ff01);}(_0x46ed,0x168));var _0xd46e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x46ed[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var path=require('path');var timeout=require(_0xd46e('0x2'));var express=require(_0xd46e('0x3'));var router=express[_0xd46e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd46e('0x5'));var config=require(_0xd46e('0x6'));var controller=require('./voiceTransferReport.controller');router[_0xd46e('0x7')]('/',auth[_0xd46e('0x8')](),controller[_0xd46e('0x9')]);router[_0xd46e('0x7')](_0xd46e('0xa'),auth[_0xd46e('0x8')](),controller[_0xd46e('0xb')]);router[_0xd46e('0xc')]('/',auth[_0xd46e('0x8')](),controller[_0xd46e('0xd')]);router[_0xd46e('0xe')]('/:id',auth[_0xd46e('0x8')](),controller[_0xd46e('0xf')]);router['delete'](_0xd46e('0xa'),auth[_0xd46e('0x8')](),controller[_0xd46e('0x10')]);module[_0xd46e('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 45d9599..d771c17 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 _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 +var _0x7c0d=['moment','ENUM','blind','attended','STRING','Yes','sequelize'];(function(_0x163b98,_0x587d17){var _0x9824cf=function(_0x248347){while(--_0x248347){_0x163b98['push'](_0x163b98['shift']());}};_0x9824cf(++_0x587d17);}(_0x7c0d,0x14f));var _0xd7c0=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x7c0d[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0xd7c0('0x0'));var moment=require(_0xd7c0('0x1'));module['exports']={'type':{'type':Sequelize[_0xd7c0('0x2')](_0xd7c0('0x3'),_0xd7c0('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xd7c0('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xd7c0('0x5')]},'transferercalleridname':{'type':Sequelize[_0xd7c0('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xd7c0('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xd7c0('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xd7c0('0x5')]},'transferercontext':{'type':Sequelize[_0xd7c0('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xd7c0('0x5')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0xd7c0('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xd7c0('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xd7c0('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xd7c0('0x5')]},'transfereecontext':{'type':Sequelize[_0xd7c0('0x5')]},'transfereeexten':{'type':Sequelize[_0xd7c0('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xd7c0('0x5')]},'isexternal':{'type':Sequelize['ENUM'](_0xd7c0('0x6'),'No')},'context':{'type':Sequelize['STRING']},'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 93f95a8..8a90cd1 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 _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 +var _0xab49=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','end','error','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','name','includeAll','include','findAll','rows','catch','options','find','create','body','update','params','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','desk.js','querystring'];(function(_0x4feb7d,_0x2e9487){var _0x382c57=function(_0x42f333){while(--_0x42f333){_0x4feb7d['push'](_0x4feb7d['shift']());}};_0x382c57(++_0x2e9487);}(_0xab49,0x116));var _0x9ab4=function(_0x43b08,_0x15f967){_0x43b08=_0x43b08-0x0;var _0x5e05f4=_0xab49[_0x43b08];return _0x5e05f4;};'use strict';var pdf=require(_0x9ab4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9ab4('0x1'));var zipdir=require(_0x9ab4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ab4('0x3'));var moment=require(_0x9ab4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9ab4('0x5'));var util=require(_0x9ab4('0x6'));var path=require(_0x9ab4('0x7'));var sox=require('sox');var csv=require(_0x9ab4('0x8'));var ejs=require(_0x9ab4('0x9'));var fs=require('fs');var _=require(_0x9ab4('0xa'));var squel=require(_0x9ab4('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9ab4('0xc'));var toCsv=require(_0x9ab4('0x8'));var querystring=require(_0x9ab4('0xd'));var Papa=require(_0x9ab4('0xe'));var Redis=require(_0x9ab4('0xf'));var authService=require(_0x9ab4('0x10'));var qs=require(_0x9ab4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9ab4('0x12'));var logger=require(_0x9ab4('0x13'))('api');var utils=require(_0x9ab4('0x14'));var config=require(_0x9ab4('0x15'));var db=require(_0x9ab4('0x16'))['db'];function respondWithStatusCode(_0x371495,_0x57bd16){_0x57bd16=_0x57bd16||0xcc;return function(_0x19d515){if(_0x19d515){return _0x371495[_0x9ab4('0x17')](_0x57bd16);}return _0x371495[_0x9ab4('0x18')](_0x57bd16)['end']();};}function respondWithResult(_0x368259,_0x1083d0){_0x1083d0=_0x1083d0||0xc8;return function(_0x5675ad){if(_0x5675ad){return _0x368259[_0x9ab4('0x18')](_0x1083d0)[_0x9ab4('0x19')](_0x5675ad);}};}function respondWithFilteredResult(_0x7946c5,_0x53fe88){return function(_0xf3cc35){if(_0xf3cc35){var _0x4149d5=_0xf3cc35[_0x9ab4('0x1a')],_0x3193cb=_0x53fe88[_0x9ab4('0x1b')],_0x21e0ad=_0x53fe88['offset']+_0x53fe88[_0x9ab4('0x1c')],_0x32c8c4;if(_0x21e0ad>=_0x4149d5){_0x21e0ad=_0x4149d5;_0x32c8c4=0xc8;}else{_0x32c8c4=0xce;}_0x7946c5[_0x9ab4('0x18')](_0x32c8c4);return _0x7946c5[_0x9ab4('0x1d')](_0x9ab4('0x1e'),_0x3193cb+'-'+_0x21e0ad+'/'+_0x4149d5)['json'](_0xf3cc35);}return null;};}function patchUpdates(_0xe126fb){return function(_0x1cde7e){try{jsonpatch[_0x9ab4('0x1f')](_0x1cde7e,_0xe126fb,!![]);}catch(_0xaffe7){return BPromise[_0x9ab4('0x20')](_0xaffe7);}return _0x1cde7e['save']();};}function saveUpdates(_0x9230a0,_0x2e1faf){return function(_0x2eb064){if(_0x2eb064){return _0x2eb064['update'](_0x9230a0)[_0x9ab4('0x21')](function(_0x5724f0){return _0x5724f0;});}return null;};}function removeEntity(_0x4f05f8,_0x5679bd){return function(_0x40c39e){if(_0x40c39e){return _0x40c39e[_0x9ab4('0x22')]()[_0x9ab4('0x21')](function(){_0x4f05f8[_0x9ab4('0x18')](0xcc)[_0x9ab4('0x23')]();});}};}function handleEntityNotFound(_0x1ee929,_0x172f22){return function(_0x4025ac){if(!_0x4025ac){_0x1ee929[_0x9ab4('0x17')](0x194);}return _0x4025ac;};}function handleError(_0x3ac87f,_0x24f62f){_0x24f62f=_0x24f62f||0x1f4;return function(_0x55b82f){logger[_0x9ab4('0x24')](_0x55b82f['stack']);if(_0x55b82f['name']){delete _0x55b82f['name'];}_0x3ac87f[_0x9ab4('0x18')](_0x24f62f)[_0x9ab4('0x25')](_0x55b82f);};}exports[_0x9ab4('0x26')]=function(_0x2cde5b,_0x40f26e){var _0x4e7a16={},_0x5e0247={},_0x16fda2={'count':0x0,'rows':[]};var _0x37b228=_[_0x9ab4('0x27')](db[_0x9ab4('0x28')][_0x9ab4('0x29')],function(_0x3ae496){return{'name':_0x3ae496[_0x9ab4('0x2a')],'type':_0x3ae496[_0x9ab4('0x2b')][_0x9ab4('0x2c')]};});_0x5e0247[_0x9ab4('0x2d')]=_[_0x9ab4('0x27')](_0x37b228,'name');_0x5e0247['query']=_[_0x9ab4('0x2e')](_0x2cde5b[_0x9ab4('0x2f')]);_0x5e0247[_0x9ab4('0x30')]=_[_0x9ab4('0x31')](_0x5e0247[_0x9ab4('0x2d')],_0x5e0247[_0x9ab4('0x2f')]);_0x4e7a16[_0x9ab4('0x32')]=_[_0x9ab4('0x31')](_0x5e0247['model'],qs[_0x9ab4('0x33')](_0x2cde5b[_0x9ab4('0x2f')][_0x9ab4('0x33')]));_0x4e7a16[_0x9ab4('0x32')]=_0x4e7a16[_0x9ab4('0x32')][_0x9ab4('0x34')]?_0x4e7a16[_0x9ab4('0x32')]:_0x5e0247['model'];if(!_0x2cde5b[_0x9ab4('0x2f')]['hasOwnProperty'](_0x9ab4('0x35'))){_0x4e7a16['limit']=qs['limit'](_0x2cde5b[_0x9ab4('0x2f')][_0x9ab4('0x1c')]);_0x4e7a16[_0x9ab4('0x1b')]=qs[_0x9ab4('0x1b')](_0x2cde5b[_0x9ab4('0x2f')][_0x9ab4('0x1b')]);}_0x4e7a16[_0x9ab4('0x36')]=qs[_0x9ab4('0x37')](_0x2cde5b[_0x9ab4('0x2f')][_0x9ab4('0x37')]);_0x4e7a16['where']=qs[_0x9ab4('0x30')](_[_0x9ab4('0x38')](_0x2cde5b[_0x9ab4('0x2f')],_0x5e0247[_0x9ab4('0x30')]),_0x37b228);if(_0x2cde5b[_0x9ab4('0x2f')][_0x9ab4('0x39')]){_0x4e7a16[_0x9ab4('0x3a')]=_[_0x9ab4('0x3b')](_0x4e7a16[_0x9ab4('0x3a')],{'$or':_[_0x9ab4('0x27')](_0x37b228,function(_0x54f533){if(_0x54f533[_0x9ab4('0x2b')]!==_0x9ab4('0x3c')){var _0x3227f5={};_0x3227f5[_0x54f533[_0x9ab4('0x3d')]]={'$like':'%'+_0x2cde5b['query'][_0x9ab4('0x39')]+'%'};return _0x3227f5;}})});}_0x4e7a16=_[_0x9ab4('0x3b')]({},_0x4e7a16,_0x2cde5b['options']);var _0x1aa970={'where':_0x4e7a16[_0x9ab4('0x3a')]};return db[_0x9ab4('0x28')][_0x9ab4('0x1a')](_0x1aa970)[_0x9ab4('0x21')](function(_0x46b47b){_0x16fda2['count']=_0x46b47b;if(_0x2cde5b[_0x9ab4('0x2f')][_0x9ab4('0x3e')]){_0x4e7a16[_0x9ab4('0x3f')]=[{'all':!![]}];}return db[_0x9ab4('0x28')][_0x9ab4('0x40')](_0x4e7a16);})[_0x9ab4('0x21')](function(_0x50b12c){_0x16fda2[_0x9ab4('0x41')]=_0x50b12c;return _0x16fda2;})[_0x9ab4('0x21')](respondWithFilteredResult(_0x40f26e,_0x4e7a16))[_0x9ab4('0x42')](handleError(_0x40f26e,null));};exports['show']=function(_0xc13591,_0x2527a3){var _0x37615c={'raw':!![],'where':{'id':_0xc13591['params']['id']}},_0x5cbce5={};_0x5cbce5[_0x9ab4('0x2d')]=_[_0x9ab4('0x2e')](db['VoiceTransferReport']['rawAttributes']);_0x5cbce5[_0x9ab4('0x2f')]=_['keys'](_0xc13591['query']);_0x5cbce5['filters']=_[_0x9ab4('0x31')](_0x5cbce5[_0x9ab4('0x2d')],_0x5cbce5[_0x9ab4('0x2f')]);_0x37615c['attributes']=_['intersection'](_0x5cbce5[_0x9ab4('0x2d')],qs[_0x9ab4('0x33')](_0xc13591[_0x9ab4('0x2f')][_0x9ab4('0x33')]));_0x37615c[_0x9ab4('0x32')]=_0x37615c[_0x9ab4('0x32')][_0x9ab4('0x34')]?_0x37615c['attributes']:_0x5cbce5[_0x9ab4('0x2d')];if(_0xc13591[_0x9ab4('0x2f')][_0x9ab4('0x3e')]){_0x37615c[_0x9ab4('0x3f')]=[{'all':!![]}];}_0x37615c=_[_0x9ab4('0x3b')]({},_0x37615c,_0xc13591[_0x9ab4('0x43')]);return db['VoiceTransferReport'][_0x9ab4('0x44')](_0x37615c)[_0x9ab4('0x21')](handleEntityNotFound(_0x2527a3,null))[_0x9ab4('0x21')](respondWithResult(_0x2527a3,null))['catch'](handleError(_0x2527a3,null));};exports[_0x9ab4('0x45')]=function(_0x17f893,_0x2780c7){return db[_0x9ab4('0x28')][_0x9ab4('0x45')](_0x17f893[_0x9ab4('0x46')],{})[_0x9ab4('0x21')](respondWithResult(_0x2780c7,0xc9))['catch'](handleError(_0x2780c7,null));};exports[_0x9ab4('0x47')]=function(_0x159ef7,_0x56f053){if(_0x159ef7[_0x9ab4('0x46')]['id']){delete _0x159ef7[_0x9ab4('0x46')]['id'];}return db[_0x9ab4('0x28')]['find']({'where':{'id':_0x159ef7[_0x9ab4('0x48')]['id']}})[_0x9ab4('0x21')](handleEntityNotFound(_0x56f053,null))['then'](saveUpdates(_0x159ef7[_0x9ab4('0x46')],null))[_0x9ab4('0x21')](respondWithResult(_0x56f053,null))['catch'](handleError(_0x56f053,null));};exports[_0x9ab4('0x22')]=function(_0x555642,_0x2517e1){return db[_0x9ab4('0x28')]['find']({'where':{'id':_0x555642[_0x9ab4('0x48')]['id']}})['then'](handleEntityNotFound(_0x2517e1,null))[_0x9ab4('0x21')](removeEntity(_0x2517e1,null))[_0x9ab4('0x42')](handleError(_0x2517e1,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 12af82d..e180860 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 _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 +var _0x78c4=['define','VoiceTransferReport','report_call_transfer','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports'];(function(_0x5b9a30,_0x2b3667){var _0x35f722=function(_0xfb962b){while(--_0xfb962b){_0x5b9a30['push'](_0x5b9a30['shift']());}};_0x35f722(++_0x2b3667);}(_0x78c4,0x158));var _0x478c=function(_0x120619,_0x244e19){_0x120619=_0x120619-0x0;var _0x4dcd9b=_0x78c4[_0x120619];return _0x4dcd9b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x478c('0x0'))(_0x478c('0x1'));var moment=require('moment');var BPromise=require(_0x478c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x478c('0x3'));var rimraf=require(_0x478c('0x4'));var config=require(_0x478c('0x5'));var attributes=require(_0x478c('0x6'));module[_0x478c('0x7')]=function(_0x1970f3,_0x3656fb){return _0x1970f3[_0x478c('0x8')](_0x478c('0x9'),attributes,{'tableName':_0x478c('0xa'),'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 e2f54c2..f974098 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 _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 +var _0xda33=['error','code','message','catch','VoiceTransferReport','body','options','raw','CreateVoiceTransferReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3b29ce,_0x13de5f){var _0x57b233=function(_0x5e4248){while(--_0x5e4248){_0x3b29ce['push'](_0x3b29ce['shift']());}};_0x57b233(++_0x13de5f);}(_0xda33,0x1d4));var _0x3da3=function(_0x4dee78,_0x3b517d){_0x4dee78=_0x4dee78-0x0;var _0x5a953a=_0xda33[_0x4dee78];return _0x5a953a;};'use strict';var _=require('lodash');var util=require(_0x3da3('0x0'));var moment=require(_0x3da3('0x1'));var BPromise=require(_0x3da3('0x2'));var rs=require(_0x3da3('0x3'));var fs=require('fs');var Redis=require(_0x3da3('0x4'));var db=require(_0x3da3('0x5'))['db'];var utils=require(_0x3da3('0x6'));var logger=require(_0x3da3('0x7'))(_0x3da3('0x8'));var config=require('../../config/environment');var jayson=require(_0x3da3('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x34bd10,_0x27921f,_0x257648){return new BPromise(function(_0x5a30a9,_0x4ef3b7){return client[_0x3da3('0xa')](_0x34bd10,_0x257648)[_0x3da3('0xb')](function(_0x48a357){logger[_0x3da3('0xc')](_0x3da3('0xd'),_0x27921f,_0x3da3('0xe'));logger[_0x3da3('0xf')](_0x3da3('0x10'),_0x27921f,_0x3da3('0xe'),JSON[_0x3da3('0x11')](_0x48a357));if(_0x48a357[_0x3da3('0x12')]){if(_0x48a357[_0x3da3('0x12')][_0x3da3('0x13')]===0x1f4){logger[_0x3da3('0x12')](_0x3da3('0xd'),_0x27921f,_0x48a357[_0x3da3('0x12')][_0x3da3('0x14')]);return _0x4ef3b7(_0x48a357['error'][_0x3da3('0x14')]);}logger['error'](_0x3da3('0xd'),_0x27921f,_0x48a357[_0x3da3('0x12')][_0x3da3('0x14')]);return _0x5a30a9(_0x48a357[_0x3da3('0x12')]['message']);}else{logger[_0x3da3('0xc')](_0x3da3('0xd'),_0x27921f,_0x3da3('0xe'));_0x5a30a9(_0x48a357['result'][_0x3da3('0x14')]);}})[_0x3da3('0x15')](function(_0x6ae074){logger[_0x3da3('0x12')](_0x3da3('0xd'),_0x27921f,_0x6ae074);_0x4ef3b7(_0x6ae074);});});}exports['CreateVoiceTransferReport']=function(_0xbeb4b4){var _0x3a4571=this;return new Promise(function(_0x59a0af,_0x1a9c11){return db[_0x3da3('0x16')]['create'](_0xbeb4b4[_0x3da3('0x17')],{'raw':_0xbeb4b4[_0x3da3('0x18')]?_0xbeb4b4[_0x3da3('0x18')][_0x3da3('0x19')]===undefined?!![]:![]:!![]})[_0x3da3('0xb')](function(_0x50466e){logger[_0x3da3('0xc')](_0x3da3('0x1a'),_0xbeb4b4);logger[_0x3da3('0xf')](_0x3da3('0x1a'),_0xbeb4b4,JSON['stringify'](_0x50466e));_0x59a0af(_0x50466e);})[_0x3da3('0x15')](function(_0x487c15){logger[_0x3da3('0x12')](_0x3da3('0x1a'),_0x487c15[_0x3da3('0x14')],_0xbeb4b4);_0x1a9c11(_0x3a4571[_0x3da3('0x12')](0x1f4,_0x487c15['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index d31cd73..cd6f4bc 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 _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 +var _0x1e19=['exports','express','Router','../../components/auth/service','./webbar.controller','post','/hangup','isAuthenticated','canUpdate','hangup','/answer','answer','/hold','hold','unhold','/calls','calls','/transfer','transfer'];(function(_0x531e1e,_0x229b12){var _0x16f73a=function(_0x1b6be4){while(--_0x1b6be4){_0x531e1e['push'](_0x531e1e['shift']());}};_0x16f73a(++_0x229b12);}(_0x1e19,0x1c9));var _0x91e1=function(_0xf6c510,_0x38658f){_0xf6c510=_0xf6c510-0x0;var _0x18fa72=_0x1e19[_0xf6c510];return _0x18fa72;};'use strict';var express=require(_0x91e1('0x0'));var router=express[_0x91e1('0x1')]();var auth=require(_0x91e1('0x2'));var controller=require(_0x91e1('0x3'));router[_0x91e1('0x4')]('/originate',auth['isAuthenticated'](),auth['canUpdate'](),controller['originate']);router[_0x91e1('0x4')](_0x91e1('0x5'),auth[_0x91e1('0x6')](),auth[_0x91e1('0x7')](),controller[_0x91e1('0x8')]);router['post'](_0x91e1('0x9'),auth['isAuthenticated'](),auth[_0x91e1('0x7')](),controller[_0x91e1('0xa')]);router[_0x91e1('0x4')](_0x91e1('0xb'),auth[_0x91e1('0x6')](),auth['canUpdate'](),controller[_0x91e1('0xc')]);router[_0x91e1('0x4')]('/unhold',auth[_0x91e1('0x6')](),auth[_0x91e1('0x7')](),controller[_0x91e1('0xd')]);router[_0x91e1('0x4')](_0x91e1('0xe'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x91e1('0xf')]);router[_0x91e1('0x4')](_0x91e1('0x10'),auth[_0x91e1('0x6')](),auth[_0x91e1('0x7')](),controller[_0x91e1('0x11')]);module[_0x91e1('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index b7891cc..99300d5 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 _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 +var _0x3738=['User','findOne','agent','all','filter','rows','UserId','length','sessionId\x20','\x20not\x20found!','info','body','json','userId','callerId','callbackUrl','format','user:%s','webbar:originate','hangup','hangup\x20fired:','sessionId','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','entityFound:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','unhold','unhold\x20fired:','calls\x20fired:','conference','conference\x20fired:','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','error','name','status','send','request','then','code','message','result','catch'];(function(_0x458482,_0x3bc717){var _0x3289c5=function(_0x4b4d15){while(--_0x4b4d15){_0x458482['push'](_0x458482['shift']());}};_0x3289c5(++_0x3bc717);}(_0x3738,0x1e5));var _0x8373=function(_0x345a17,_0x3b9d2a){_0x345a17=_0x345a17-0x0;var _0xd0f947=_0x3738[_0x345a17];return _0xd0f947;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x8373('0x0'));var db=require(_0x8373('0x1'))['db'];var config=require(_0x8373('0x2'));var util=require(_0x8373('0x3'));var BPromise=require(_0x8373('0x4'));var jayson=require(_0x8373('0x5'));var amiClient=jayson[_0x8373('0x6')][_0x8373('0x7')]({'port':0x232a});var logger=require(_0x8373('0x8'))(_0x8373('0x9'));var Redis=require(_0x8373('0xa'));config[_0x8373('0xb')]=_['defaults'](config[_0x8373('0xb')],{'host':_0x8373('0xc'),'port':0x18eb});var io=require(_0x8373('0xd'))(new Redis(config[_0x8373('0xb')]));var Schema=require(_0x8373('0xe'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8373('0xf')]},'callNumber':{'type':_0x8373('0x10'),'required':[!![],_0x8373('0x11')]},'callerId':{'type':_0x8373('0x10')},'callbackUrl':{'type':_0x8373('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0x8373('0x12'),'required':[!![],_0x8373('0xf')]},'sessionId':{'type':_0x8373('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8373('0xf')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x8373('0x12'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x8373('0x10'),'required':[!![],_0x8373('0x13')]},'transferNumber':{'type':'string','required':[!![],_0x8373('0x14')]}});var holdValidation=new Schema({'userId':{'type':_0x8373('0x12'),'required':[!![],_0x8373('0xf')]},'sessionId':{'type':_0x8373('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8373('0xf')]},'sessionId':{'type':_0x8373('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x8373('0x12'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x8373('0x12'),'required':[!![],_0x8373('0xf')]}});function emit(_0x3613ed,_0x276318,_0x192b83){logger['info'](_0x3613ed,_0x276318,JSON[_0x8373('0x15')](_0x192b83));io['to'](_0x3613ed)[_0x8373('0x16')](_0x276318,_0x192b83);}function handleError(_0x3576ac){return function(_0xf27fa7){console['log']('handleError:',_0xf27fa7,_0xf27fa7 instanceof RangeError);logger[_0x8373('0x17')](_0xf27fa7['stack']);if(_0xf27fa7 instanceof RangeError){if(_0xf27fa7[_0x8373('0x18')]){delete _0xf27fa7[_0x8373('0x18')];}_0x3576ac[_0x8373('0x19')](0x194)[_0x8373('0x1a')](_0xf27fa7);}else{if(_0xf27fa7['name']){delete _0xf27fa7[_0x8373('0x18')];}_0x3576ac[_0x8373('0x19')](0x1f4)[_0x8373('0x1a')](_0xf27fa7);}};}function checkError(){return function(_0x398f4a){if(!_0x398f4a){throw new RangeError('NotFound');}return _0x398f4a;};}function respondWithRpcPromise(_0x591e27,_0x250b1a){return new BPromise(function(_0x552a2a,_0x2b8259){var _0x313014=amiClient;return _0x313014[_0x8373('0x1b')](_0x591e27,_0x250b1a)[_0x8373('0x1c')](function(_0x59fa12){if(_0x59fa12[_0x8373('0x17')]){if(_0x59fa12[_0x8373('0x17')][_0x8373('0x1d')]===0x1f4){return _0x2b8259(_0x59fa12[_0x8373('0x17')][_0x8373('0x1e')]);}return _0x552a2a(_0x59fa12[_0x8373('0x17')][_0x8373('0x1e')]);}else{_0x552a2a(_0x59fa12[_0x8373('0x1f')]);}})[_0x8373('0x20')](function(_0x26af56){_0x2b8259(_0x26af56);});});}function getAgent(_0x50ffac){return db[_0x8373('0x21')][_0x8373('0x22')]({'where':{'id':_0x50ffac,'role':_0x8373('0x23')}})[_0x8373('0x1c')](checkError());}function getAgentCheckSession(_0x42c8ca,_0x27858f){return new BPromise(function(_0x4a57e5,_0x14cd4b){var _0x104cdb=respondWithRpcPromise('VoiceChannels');var _0x426d0e=getAgent(_0x42c8ca);Promise[_0x8373('0x24')]([_0x104cdb,_0x426d0e])[_0x8373('0x1c')](function(_0x2ef9c5){var _0xdf741b=_0x2ef9c5[0x0];var _0x1d34c1=_0x2ef9c5[0x1];var _0x1e4de4=_[_0x8373('0x25')](_0xdf741b[_0x8373('0x26')],function(_0x260567){return _0x260567[_0x8373('0x27')]==_0x1d34c1['id']&&_0x260567['sessionId']==_0x27858f;});if(_0x1e4de4[_0x8373('0x28')]==0x1){_0x4a57e5(_0x1d34c1);}else{_0x14cd4b(new RangeError(_0x8373('0x29')+_0x27858f+_0x8373('0x2a')));}});});}exports['originate']=function(_0x3b0565,_0x27c2ac){logger[_0x8373('0x2b')]('originate\x20fired:',_0x3b0565[_0x8373('0x2c')]);var _0x18b26a=originateValidation[_0x8373('0xe')](_0x3b0565[_0x8373('0x2c')]);if(_0x18b26a[_0x8373('0x28')]>0x0){return _0x27c2ac[_0x8373('0x19')](0x190)[_0x8373('0x2d')](_0x18b26a);}var _0x5c11a9=_0x3b0565[_0x8373('0x2c')][_0x8373('0x2e')];var _0x5435d8=_0x3b0565[_0x8373('0x2c')]['callNumber'];var _0x7f8a62=_0x3b0565[_0x8373('0x2c')][_0x8373('0x2f')];var _0x62eaa3=_0x3b0565[_0x8373('0x2c')][_0x8373('0x30')];return getAgent(_0x5c11a9)['then'](function(_0x5cf6a7){logger[_0x8373('0x2b')]('entityFound:',_0x5cf6a7['name']);emit(util[_0x8373('0x31')](_0x8373('0x32'),_0x5cf6a7[_0x8373('0x18')]),_0x8373('0x33'),{'callNumber':_0x5435d8,'callerId':_0x7f8a62,'callbackUrl':_0x62eaa3});return _0x27c2ac[_0x8373('0x19')](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})[_0x8373('0x20')](handleError(_0x27c2ac));};exports[_0x8373('0x34')]=function(_0x3a1783,_0x5e199b){logger[_0x8373('0x2b')](_0x8373('0x35'),_0x3a1783['body']);var _0x50daae=hangupValidation['validate'](_0x3a1783[_0x8373('0x2c')]);if(_0x50daae[_0x8373('0x28')]>0x0){return _0x5e199b[_0x8373('0x19')](0x190)['json'](_0x50daae);}var _0x389382=_0x3a1783[_0x8373('0x2c')][_0x8373('0x2e')];var _0x2b8f8d=_0x3a1783[_0x8373('0x2c')][_0x8373('0x36')];return getAgent(_0x389382)[_0x8373('0x1c')](function(_0x26baa9){logger['info']('entityFound:',_0x26baa9[_0x8373('0x18')]);emit(util[_0x8373('0x31')]('user:%s',_0x26baa9[_0x8373('0x18')]),_0x8373('0x37'),{'sessionId':_0x2b8f8d});return _0x5e199b[_0x8373('0x19')](0xc8)[_0x8373('0x2d')]({'error':![],'message':_0x8373('0x38')});})[_0x8373('0x20')](handleError(_0x5e199b));};exports[_0x8373('0x39')]=function(_0x16e9c2,_0x5b27f6){logger['info'](_0x8373('0x3a'),_0x16e9c2[_0x8373('0x2c')]);var _0x2e7605=answerValidation[_0x8373('0xe')](_0x16e9c2[_0x8373('0x2c')]);if(_0x2e7605[_0x8373('0x28')]>0x0){return _0x5b27f6['status'](0x190)[_0x8373('0x2d')](_0x2e7605);}var _0x4fc8fe=_0x16e9c2['body'][_0x8373('0x2e')];var _0x1b7e0c=_0x16e9c2[_0x8373('0x2c')][_0x8373('0x36')];return getAgent(_0x4fc8fe)['then'](function(_0x36b25b){logger[_0x8373('0x2b')](_0x8373('0x3b'),_0x36b25b['name']);emit(util[_0x8373('0x31')](_0x8373('0x32'),_0x36b25b[_0x8373('0x18')]),_0x8373('0x3c'),{'sessionId':_0x1b7e0c});return _0x5b27f6[_0x8373('0x19')](0xc8)[_0x8373('0x2d')]({'error':![],'message':_0x8373('0x3d')});})[_0x8373('0x20')](handleError(_0x5b27f6));};exports[_0x8373('0x3e')]=function(_0x1f7258,_0x2dd87c){logger[_0x8373('0x2b')](_0x8373('0x3f'),_0x1f7258['body']);var _0x23fe72=holdValidation[_0x8373('0xe')](_0x1f7258[_0x8373('0x2c')]);if(_0x23fe72[_0x8373('0x28')]>0x0){return _0x2dd87c['status'](0x190)[_0x8373('0x2d')](_0x23fe72);}var _0x32ec0b=_0x1f7258[_0x8373('0x2c')][_0x8373('0x2e')];var _0x583535=_0x1f7258[_0x8373('0x2c')][_0x8373('0x36')];return getAgent(_0x32ec0b)[_0x8373('0x1c')](function(_0x2f3e41){logger['info'](_0x8373('0x3b'),_0x2f3e41['name']);emit(util[_0x8373('0x31')](_0x8373('0x32'),_0x2f3e41[_0x8373('0x18')]),_0x8373('0x40'),{'sessionId':_0x583535});return _0x2dd87c[_0x8373('0x19')](0xc8)[_0x8373('0x2d')]({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x2dd87c));};exports[_0x8373('0x41')]=function(_0x4b1894,_0x283d32){logger[_0x8373('0x2b')](_0x8373('0x42'),_0x4b1894[_0x8373('0x2c')]);var _0x1111b8=unholdValidation[_0x8373('0xe')](_0x4b1894[_0x8373('0x2c')]);if(_0x1111b8['length']>0x0){return _0x283d32[_0x8373('0x19')](0x190)['json'](_0x1111b8);}var _0x350a39=_0x4b1894[_0x8373('0x2c')][_0x8373('0x2e')];var _0x46b32a=_0x4b1894['body']['sessionId'];return getAgent(_0x350a39)[_0x8373('0x1c')](function(_0xab34f1){logger['info'](_0x8373('0x3b'),_0xab34f1[_0x8373('0x18')]);emit(util['format'](_0x8373('0x32'),_0xab34f1[_0x8373('0x18')]),'webbar:unhold',{'sessionId':_0x46b32a});return _0x283d32[_0x8373('0x19')](0xc8)[_0x8373('0x2d')]({'error':![],'message':'unhold\x20executed!'});})[_0x8373('0x20')](handleError(_0x283d32));};exports['calls']=function(_0x4894d0,_0x1325dc){logger['info'](_0x8373('0x43'),_0x1325dc['body']);var _0x1650cd=callsValidation[_0x8373('0xe')](_0x4894d0[_0x8373('0x2c')]);if(_0x1650cd[_0x8373('0x28')]>0x0){return _0x1325dc[_0x8373('0x19')](0x190)[_0x8373('0x2d')](_0x1650cd);}var _0x15045f=_0x4894d0[_0x8373('0x2c')][_0x8373('0x2e')];var _0x2322e9=respondWithRpcPromise('VoiceChannels');var _0x3ba184=getAgent(_0x15045f);return Promise[_0x8373('0x24')]([_0x2322e9,_0x3ba184])[_0x8373('0x1c')](function(_0x1db756){var _0x1ec8a7=_0x1db756[0x0];var _0x3c4cab=_0x1db756[0x1];var _0x3909b6=_[_0x8373('0x25')](_0x1ec8a7[_0x8373('0x26')],function(_0x19a540){return _0x19a540[_0x8373('0x27')]==_0x3c4cab['id'];});return _0x1325dc[_0x8373('0x19')](0xc8)[_0x8373('0x2d')]({'count':_0x3909b6[_0x8373('0x28')],'rows':_0x3909b6});})[_0x8373('0x20')](handleError(_0x1325dc));};exports[_0x8373('0x44')]=function(_0x53cde2,_0x2fd646){logger[_0x8373('0x2b')](_0x8373('0x45'),_0x53cde2[_0x8373('0x2c')]);var _0x21a269=conferenceValidation[_0x8373('0xe')](_0x53cde2['body']);if(_0x21a269[_0x8373('0x28')]>0x0){return _0x2fd646[_0x8373('0x19')](0x190)[_0x8373('0x2d')](_0x21a269);}var _0x394234=_0x53cde2[_0x8373('0x2c')][_0x8373('0x2e')];return getAgent(_0x394234)['then'](function(_0x1a739c){logger[_0x8373('0x2b')]('entityFound:',_0x1a739c[_0x8373('0x18')]);emit(util[_0x8373('0x31')]('user:%s',_0x1a739c['name']),'webbar:conference');return _0x2fd646[_0x8373('0x19')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x2fd646));};exports[_0x8373('0x46')]=function(_0x281aec,_0x37d15b){logger[_0x8373('0x2b')](_0x8373('0x47'),_0x281aec[_0x8373('0x2c')]);var _0xa4f9f4=transferValidation[_0x8373('0xe')](_0x281aec[_0x8373('0x2c')]);if(_0xa4f9f4[_0x8373('0x28')]>0x0){return _0x37d15b['status'](0x190)[_0x8373('0x2d')](_0xa4f9f4);}var _0x4e4f1c=_0x281aec[_0x8373('0x2c')]['userId'];var _0x1c096d=_0x281aec[_0x8373('0x2c')][_0x8373('0x36')];var _0x99291b=_0x281aec['body']['transferNumber'];return getAgent(_0x4e4f1c)[_0x8373('0x1c')](function(_0x376e46){logger[_0x8373('0x2b')](_0x8373('0x3b'),_0x376e46[_0x8373('0x18')]);emit(util[_0x8373('0x31')](_0x8373('0x32'),_0x376e46[_0x8373('0x18')]),_0x8373('0x48'),{'sessionId':_0x1c096d,'transferNumber':_0x99291b});return _0x37d15b[_0x8373('0x19')](0xc8)[_0x8373('0x2d')]({'error':![],'message':_0x8373('0x49')});})['catch'](handleError(_0x37d15b));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 4257799..60d3934 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 _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 +var _0x6cc7=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','getApplications','post','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','update','delete','removeDispositions','exports','multer'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6cc7,0xc5));var _0x76cc=function(_0x280ae7,_0x456fb1){_0x280ae7=_0x280ae7-0x0;var _0x418b9e=_0x6cc7[_0x280ae7];return _0x418b9e;};'use strict';var multer=require(_0x76cc('0x0'));var util=require(_0x76cc('0x1'));var path=require(_0x76cc('0x2'));var timeout=require(_0x76cc('0x3'));var express=require(_0x76cc('0x4'));var router=express['Router']();var auth=require(_0x76cc('0x5'));var interaction=require(_0x76cc('0x6'));var config=require('../../config/environment');var controller=require(_0x76cc('0x7'));router[_0x76cc('0x8')]('/',auth[_0x76cc('0x9')](),controller[_0x76cc('0xa')]);router[_0x76cc('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x76cc('0xb')]);router[_0x76cc('0x8')](_0x76cc('0xc'),auth[_0x76cc('0x9')](),controller[_0x76cc('0xd')]);router[_0x76cc('0x8')](_0x76cc('0xe'),auth[_0x76cc('0x9')](),controller[_0x76cc('0xf')]);router[_0x76cc('0x8')](_0x76cc('0x10'),auth[_0x76cc('0x9')](),controller[_0x76cc('0x11')]);router['get'](_0x76cc('0x12'),auth[_0x76cc('0x9')](),controller['getAgents']);router[_0x76cc('0x8')](_0x76cc('0x13'),auth[_0x76cc('0x9')](),controller[_0x76cc('0x14')]);router['post']('/',auth[_0x76cc('0x9')](),controller['create']);router[_0x76cc('0x15')](_0x76cc('0xe'),auth[_0x76cc('0x9')](),controller['addDisposition']);router[_0x76cc('0x15')](_0x76cc('0x10'),auth[_0x76cc('0x9')](),controller[_0x76cc('0x16')]);router[_0x76cc('0x15')](_0x76cc('0x12'),auth[_0x76cc('0x9')](),controller[_0x76cc('0x17')]);router[_0x76cc('0x15')]('/:id/applications',auth[_0x76cc('0x9')](),controller[_0x76cc('0x18')]);router[_0x76cc('0x15')](_0x76cc('0x19'),controller[_0x76cc('0x1a')]);router[_0x76cc('0x15')](_0x76cc('0x1b'),auth['isAuthenticated'](),controller[_0x76cc('0x1c')]);router['put']('/:id',auth[_0x76cc('0x9')](),controller[_0x76cc('0x1d')]);router[_0x76cc('0x1e')]('/:id',auth[_0x76cc('0x9')](),controller['destroy']);router[_0x76cc('0x1e')]('/:id/dispositions',auth[_0x76cc('0x9')](),controller[_0x76cc('0x1f')]);router['delete'](_0x76cc('0x10'),auth[_0x76cc('0x9')](),controller['removeAnswers']);router['delete'](_0x76cc('0x12'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x76cc('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 365937a..9322ce3 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 _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 +var _0x32eb=['randomstring','exports','STRING','name','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x32eb,0xed));var _0xb32e=function(_0x318410,_0x451962){_0x318410=_0x318410-0x0;var _0x2898a3=_0x32eb[_0x318410];return _0x2898a3;};'use strict';var Sequelize=require(_0xb32e('0x0'));var rs=require(_0xb32e('0x1'));module[_0xb32e('0x2')]={'name':{'type':Sequelize[_0xb32e('0x3')],'unique':_0xb32e('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xb32e('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xb32e('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xb32e('0x3')]},'type':{'type':Sequelize[_0xb32e('0x5')](_0xb32e('0x6'))},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xb32e('0x3')]},'notificationTemplate':{'type':Sequelize[_0xb32e('0x7')],'defaultValue':function(){return _0xb32e('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xb32e('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'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[_0xb32e('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb32e('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb32e('0xa')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xb32e('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5ceb04){if(!_0x5ceb04){this['setDataValue'](_0xb32e('0xb'),null);}this[_0xb32e('0xc')](_0xb32e('0xd'),_0x5ceb04);}},'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 a6535f8..72d69c0 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 _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 +var _0xcea2=['../../mysqldb','redis','localhost','./whatsappAccount.socket','register','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','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','get','UserProfileResource','destroy','end','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','params','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','addAnswer','hasOwnProperty','CannedAnswer','removeAnswers','omit','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','applications','orderBy','asc','CmContact','createdAt','difference','updatedAt','ListId','mobile','twilio','replace','whatsapp:','messageId','isNil','from','from\x20is\x20mandatory','mapKey','CmList','Contacts','DESC','list','defaults','interaction','created','autoclose','push','close','unmanaged','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','to\x20is\x20mandatory','List','WhatsappInteraction','out','spread','dataValues','Messages','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x2e7c33,_0x5ab768){var _0x3396cf=function(_0x33c03a){while(--_0x33c03a){_0x2e7c33['push'](_0x2e7c33['shift']());}};_0x3396cf(++_0x5ab768);}(_0xcea2,0x15a));var _0x2cea=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xcea2[_0xbd08b4];return _0x314f1e;};'use strict';var pdf=require(_0x2cea('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2cea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2cea('0x2'));var rp=require(_0x2cea('0x3'));var moment=require(_0x2cea('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2cea('0x5'));var util=require(_0x2cea('0x6'));var path=require(_0x2cea('0x7'));var sox=require('sox');var csv=require(_0x2cea('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2cea('0x9'));var squel=require(_0x2cea('0xa'));var crypto=require(_0x2cea('0xb'));var jsforce=require(_0x2cea('0xc'));var deskjs=require(_0x2cea('0xd'));var toCsv=require(_0x2cea('0x8'));var querystring=require('querystring');var Papa=require(_0x2cea('0xe'));var Redis=require(_0x2cea('0xf'));var authService=require(_0x2cea('0x10'));var qs=require(_0x2cea('0x11'));var as=require(_0x2cea('0x12'));var hardwareService=require(_0x2cea('0x13'));var logger=require(_0x2cea('0x14'))(_0x2cea('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x2cea('0x16'))['db'];config[_0x2cea('0x17')]=_['defaults'](config['redis'],{'host':_0x2cea('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2cea('0x17')]));require(_0x2cea('0x19'))[_0x2cea('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});function checkPasswordPattern(_0x369c72,_0x586ad5,_0x3c7130){if(_0x3c7130){var _0x338669=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x338669[_0x2cea('0x1b')](_0x586ad5)){return _0x369c72;}else{throw new db[(_0x2cea('0x1c'))][(_0x2cea('0x1d'))](_0x2cea('0x1e'));}}else{return _0x369c72;}}function respondWithRpcPromise(_0x3530d7,_0x1ead4c,_0x5eee09,_0x19927a){return new BPromise(function(_0x464f7d,_0x20c46c){var _0x43ae15=_0x19927a||client;return _0x43ae15[_0x2cea('0x1f')](_0x3530d7,_0x5eee09)[_0x2cea('0x20')](function(_0x5d75c4){logger[_0x2cea('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x1ead4c,_0x2cea('0x22'));logger[_0x2cea('0x23')](_0x2cea('0x24'),_0x1ead4c,'request\x20sent',JSON[_0x2cea('0x25')](_0x5d75c4));if(_0x5d75c4[_0x2cea('0x26')]){if(_0x5d75c4[_0x2cea('0x26')][_0x2cea('0x27')]===0x1f4){logger[_0x2cea('0x26')](_0x2cea('0x28'),_0x1ead4c,_0x5d75c4[_0x2cea('0x26')]['message']);return _0x20c46c(_0x5d75c4[_0x2cea('0x26')]['message']);}logger[_0x2cea('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x1ead4c,_0x5d75c4[_0x2cea('0x26')][_0x2cea('0x29')]);return _0x464f7d(_0x5d75c4['error'][_0x2cea('0x29')]);}else{logger[_0x2cea('0x21')](_0x2cea('0x28'),_0x1ead4c,_0x2cea('0x22'));_0x464f7d(_0x5d75c4[_0x2cea('0x2a')][_0x2cea('0x29')]);}})['catch'](function(_0x4ec9b3){logger[_0x2cea('0x26')](_0x2cea('0x28'),_0x1ead4c,_0x4ec9b3);_0x20c46c(_0x4ec9b3);});});}function respondWithStatusCode(_0x32af98,_0x46ef5a){_0x46ef5a=_0x46ef5a||0xcc;return function(_0x3ea40c){if(_0x3ea40c){return _0x32af98[_0x2cea('0x2b')](_0x46ef5a);}return _0x32af98[_0x2cea('0x2c')](_0x46ef5a)['end']();};}function respondWithResult(_0xff69ad,_0x128863){_0x128863=_0x128863||0xc8;return function(_0x5f3fb4){if(_0x5f3fb4){return _0xff69ad[_0x2cea('0x2c')](_0x128863)[_0x2cea('0x2d')](_0x5f3fb4);}};}function respondWithFilteredResult(_0x271b2f,_0x16cf9f){return function(_0x5e0519){if(_0x5e0519){var _0x3c0066=_0x5e0519[_0x2cea('0x2e')],_0x128934=_0x16cf9f[_0x2cea('0x2f')],_0x4a51e5=_0x16cf9f[_0x2cea('0x2f')]+_0x16cf9f[_0x2cea('0x30')],_0x2bf4e9;if(_0x4a51e5>=_0x3c0066){_0x4a51e5=_0x3c0066;_0x2bf4e9=0xc8;}else{_0x2bf4e9=0xce;}_0x271b2f[_0x2cea('0x2c')](_0x2bf4e9);return _0x271b2f[_0x2cea('0x31')](_0x2cea('0x32'),_0x128934+'-'+_0x4a51e5+'/'+_0x3c0066)[_0x2cea('0x2d')](_0x5e0519);}return null;};}function patchUpdates(_0x1e721b){return function(_0x107472){try{jsonpatch['apply'](_0x107472,_0x1e721b,!![]);}catch(_0x260a0f){return BPromise[_0x2cea('0x33')](_0x260a0f);}return _0x107472[_0x2cea('0x34')]();};}function saveUpdates(_0x1bd2a5,_0x5a0061){return function(_0x4dbbcd){if(_0x4dbbcd){return _0x4dbbcd[_0x2cea('0x35')](_0x1bd2a5)[_0x2cea('0x20')](function(_0x5eefbf){return _0x5eefbf;});}return null;};}function removeEntity(_0x381ad7,_0x49d851){return function(_0x3332db){if(_0x3332db){return _0x3332db['destroy']()[_0x2cea('0x20')](function(){var _0x5bd36b=_0x3332db[_0x2cea('0x36')]({'plain':!![]});var _0x4518eb='WhatsappAccounts';return db[_0x2cea('0x37')][_0x2cea('0x38')]({'where':{'type':_0x4518eb,'resourceId':_0x5bd36b['id']}})['then'](function(){return _0x3332db;});})[_0x2cea('0x20')](function(){_0x381ad7[_0x2cea('0x2c')](0xcc)[_0x2cea('0x39')]();});}};}function handleEntityNotFound(_0x3c9f6e,_0x1c6d58){return function(_0x551cc6){if(!_0x551cc6){_0x3c9f6e[_0x2cea('0x2b')](0x194);}return _0x551cc6;};}function handleError(_0x69e6e8,_0x57037f){_0x57037f=_0x57037f||0x1f4;return function(_0x53c088){logger[_0x2cea('0x26')](_0x53c088['stack']);if(_0x53c088['name']){delete _0x53c088['name'];}_0x69e6e8['status'](_0x57037f)[_0x2cea('0x3a')](_0x53c088);};}exports[_0x2cea('0x3b')]=function(_0x53d597,_0x219560){var _0x3e0683={'include':[{'model':db[_0x2cea('0x3c')],'as':_0x2cea('0x3d')}]},_0x249aaa={},_0x51fae6={'count':0x0,'rows':[]};var _0x352f60=_[_0x2cea('0x3e')](db[_0x2cea('0x3f')][_0x2cea('0x40')],function(_0x3afee0){return{'name':_0x3afee0[_0x2cea('0x41')],'type':_0x3afee0[_0x2cea('0x42')][_0x2cea('0x43')]};});_0x249aaa[_0x2cea('0x44')]=_[_0x2cea('0x3e')](_0x352f60,_0x2cea('0x45'));_0x249aaa[_0x2cea('0x46')]=_[_0x2cea('0x47')](_0x53d597[_0x2cea('0x46')]);_0x249aaa[_0x2cea('0x48')]=_[_0x2cea('0x49')](_0x249aaa['model'],_0x249aaa[_0x2cea('0x46')]);_0x3e0683['attributes']=_[_0x2cea('0x49')](_0x249aaa[_0x2cea('0x44')],qs[_0x2cea('0x4a')](_0x53d597[_0x2cea('0x46')][_0x2cea('0x4a')]));_0x3e0683[_0x2cea('0x4b')]=_0x3e0683[_0x2cea('0x4b')][_0x2cea('0x4c')]?_0x3e0683[_0x2cea('0x4b')]:_0x249aaa[_0x2cea('0x44')];if(!_0x53d597['query']['hasOwnProperty'](_0x2cea('0x4d'))){_0x3e0683[_0x2cea('0x30')]=qs['limit'](_0x53d597[_0x2cea('0x46')]['limit']);_0x3e0683[_0x2cea('0x2f')]=qs['offset'](_0x53d597[_0x2cea('0x46')][_0x2cea('0x2f')]);}_0x3e0683[_0x2cea('0x4e')]=qs[_0x2cea('0x4f')](_0x53d597[_0x2cea('0x46')][_0x2cea('0x4f')]);_0x3e0683[_0x2cea('0x50')]=qs[_0x2cea('0x48')](_[_0x2cea('0x51')](_0x53d597[_0x2cea('0x46')],_0x249aaa['filters']),_0x352f60);if(_0x53d597[_0x2cea('0x46')][_0x2cea('0x52')]){_0x3e0683[_0x2cea('0x50')]=_[_0x2cea('0x53')](_0x3e0683['where'],{'$or':_['map'](_0x352f60,function(_0x41f86c){if(_0x41f86c[_0x2cea('0x42')]!==_0x2cea('0x54')){var _0x510e0f={};_0x510e0f[_0x41f86c[_0x2cea('0x45')]]={'$like':'%'+_0x53d597[_0x2cea('0x46')][_0x2cea('0x52')]+'%'};return _0x510e0f;}})});}_0x3e0683=_[_0x2cea('0x53')]({},_0x3e0683,_0x53d597['options']);var _0x3554cb={'where':_0x3e0683['where']};return db['WhatsappAccount'][_0x2cea('0x2e')](_0x3554cb)[_0x2cea('0x20')](function(_0x320396){_0x51fae6[_0x2cea('0x2e')]=_0x320396;if(_0x53d597['query']['includeAll']){_0x3e0683[_0x2cea('0x55')]=[{'all':!![]}];}return db[_0x2cea('0x3f')][_0x2cea('0x56')](_0x3e0683);})[_0x2cea('0x20')](function(_0x4e755c){_0x51fae6['rows']=_0x4e755c;return _0x51fae6;})['then'](respondWithFilteredResult(_0x219560,_0x3e0683))[_0x2cea('0x57')](handleError(_0x219560,null));};exports[_0x2cea('0x58')]=function(_0x127069,_0x25dc12){var _0x1e9937={'raw':![],'where':{'id':_0x127069[_0x2cea('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0x2cea('0x3d')}]},_0x193e0c={};_0x193e0c[_0x2cea('0x44')]=_[_0x2cea('0x47')](db['WhatsappAccount'][_0x2cea('0x40')]);_0x193e0c['query']=_[_0x2cea('0x47')](_0x127069[_0x2cea('0x46')]);_0x193e0c[_0x2cea('0x48')]=_[_0x2cea('0x49')](_0x193e0c[_0x2cea('0x44')],_0x193e0c[_0x2cea('0x46')]);_0x1e9937[_0x2cea('0x4b')]=_[_0x2cea('0x49')](_0x193e0c['model'],qs[_0x2cea('0x4a')](_0x127069['query'][_0x2cea('0x4a')]));_0x1e9937[_0x2cea('0x4b')]=_0x1e9937[_0x2cea('0x4b')]['length']?_0x1e9937[_0x2cea('0x4b')]:_0x193e0c['model'];if(_0x127069['query'][_0x2cea('0x5a')]){_0x1e9937[_0x2cea('0x55')]=[{'all':!![]}];}_0x1e9937=_[_0x2cea('0x53')]({},_0x1e9937,_0x127069[_0x2cea('0x5b')]);return db[_0x2cea('0x3f')]['find'](_0x1e9937)['then'](handleEntityNotFound(_0x25dc12,null))[_0x2cea('0x20')](respondWithResult(_0x25dc12,null))[_0x2cea('0x57')](handleError(_0x25dc12,null));};exports[_0x2cea('0x5c')]=function(_0xacbf7a,_0x526269){return db[_0x2cea('0x3f')]['create'](_0xacbf7a[_0x2cea('0x5d')],{})[_0x2cea('0x20')](function(_0x35d64b){var _0x3f06d1=_0xacbf7a[_0x2cea('0x5e')]['get']({'plain':!![]});if(!_0x3f06d1)throw new Error(_0x2cea('0x5f'));if(_0x3f06d1[_0x2cea('0x60')]===_0x2cea('0x5e')){var _0x16b6ee=_0x35d64b[_0x2cea('0x36')]({'plain':!![]});var _0x4b25e0=_0x2cea('0x61');return db[_0x2cea('0x62')]['find']({'where':{'name':_0x4b25e0,'userProfileId':_0x3f06d1[_0x2cea('0x63')]},'raw':!![]})[_0x2cea('0x20')](function(_0x12b07a){if(_0x12b07a&&_0x12b07a[_0x2cea('0x64')]===0x0){return db['UserProfileResource']['create']({'name':_0x16b6ee[_0x2cea('0x45')],'resourceId':_0x16b6ee['id'],'type':_0x12b07a[_0x2cea('0x45')],'sectionId':_0x12b07a['id']},{})['then'](function(){return _0x35d64b;});}else{return _0x35d64b;}})[_0x2cea('0x57')](function(_0x11178d){logger['error'](_0x2cea('0x65'),_0x11178d);throw _0x11178d;});}return _0x35d64b;})[_0x2cea('0x20')](respondWithResult(_0x526269,0xc9))[_0x2cea('0x57')](handleError(_0x526269,null));};exports[_0x2cea('0x35')]=function(_0x14daae,_0x54ade9){if(_0x14daae[_0x2cea('0x5d')]['id']){delete _0x14daae[_0x2cea('0x5d')]['id'];}return db['WhatsappAccount'][_0x2cea('0x66')]({'where':{'id':_0x14daae[_0x2cea('0x59')]['id']},'include':[{'model':db[_0x2cea('0x3c')],'as':_0x2cea('0x3d')}]})[_0x2cea('0x20')](handleEntityNotFound(_0x54ade9,null))[_0x2cea('0x20')](saveUpdates(_0x14daae[_0x2cea('0x5d')],null))[_0x2cea('0x20')](respondWithResult(_0x54ade9,null))[_0x2cea('0x57')](handleError(_0x54ade9,null));};exports[_0x2cea('0x38')]=function(_0x45e266,_0x175d9a){return db[_0x2cea('0x3f')]['find']({'where':{'id':_0x45e266['params']['id']}})[_0x2cea('0x20')](handleEntityNotFound(_0x175d9a,null))[_0x2cea('0x20')](removeEntity(_0x175d9a,null))[_0x2cea('0x57')](handleError(_0x175d9a,null));};exports[_0x2cea('0x67')]=function(_0x3c51e8,_0x3bb026){return db[_0x2cea('0x3f')]['describe']()['then'](respondWithResult(_0x3bb026,null))[_0x2cea('0x57')](handleError(_0x3bb026,null));};exports[_0x2cea('0x68')]=function(_0x316b28,_0x53ca15,_0x4e00b6){if(_0x316b28['body']['id']){delete _0x316b28[_0x2cea('0x5d')]['id'];}return db[_0x2cea('0x3f')]['find']({'where':{'id':_0x316b28['params']['id']}})[_0x2cea('0x20')](handleEntityNotFound(_0x53ca15,null))[_0x2cea('0x20')](function(_0x77f341){if(_0x77f341){_0x316b28[_0x2cea('0x5d')][_0x2cea('0x69')]=_0x77f341['id'];return db[_0x2cea('0x6a')][_0x2cea('0x5c')](_0x316b28[_0x2cea('0x5d')]);}})['then'](respondWithResult(_0x53ca15,null))[_0x2cea('0x57')](handleError(_0x53ca15,null));};exports[_0x2cea('0x6b')]=function(_0x236bf0,_0x2527e8,_0x2eca29){var _0x554659={'raw':![],'where':{}};var _0x122bc9={};var _0x242d94={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x2cea('0x6c')]({'where':{'id':_0x236bf0[_0x2cea('0x59')]['id']}})[_0x2cea('0x20')](handleEntityNotFound(_0x2527e8,null))[_0x2cea('0x20')](function(_0x5bcd33){if(_0x5bcd33){_0x122bc9[_0x2cea('0x44')]=_[_0x2cea('0x47')](db[_0x2cea('0x6a')]['rawAttributes']);_0x122bc9[_0x2cea('0x46')]=_[_0x2cea('0x47')](_0x236bf0[_0x2cea('0x46')]);_0x122bc9[_0x2cea('0x48')]=_[_0x2cea('0x49')](_0x122bc9[_0x2cea('0x44')],_0x122bc9[_0x2cea('0x46')]);_0x554659[_0x2cea('0x4b')]=_[_0x2cea('0x49')](_0x122bc9['model'],qs[_0x2cea('0x4a')](_0x236bf0[_0x2cea('0x46')][_0x2cea('0x4a')]));_0x554659[_0x2cea('0x4b')]=_0x554659['attributes'][_0x2cea('0x4c')]?_0x554659[_0x2cea('0x4b')]:_0x122bc9[_0x2cea('0x44')];if(!_0x236bf0[_0x2cea('0x46')]['hasOwnProperty'](_0x2cea('0x4d'))){_0x554659[_0x2cea('0x30')]=qs[_0x2cea('0x30')](_0x236bf0[_0x2cea('0x46')][_0x2cea('0x30')]);_0x554659[_0x2cea('0x2f')]=qs[_0x2cea('0x2f')](_0x236bf0[_0x2cea('0x46')][_0x2cea('0x2f')]);}_0x554659[_0x2cea('0x4e')]=qs[_0x2cea('0x4f')](_0x236bf0[_0x2cea('0x46')][_0x2cea('0x4f')]);_0x554659[_0x2cea('0x50')]=qs['filters'](_[_0x2cea('0x51')](_0x236bf0['query'],_0x122bc9[_0x2cea('0x48')]));_0x554659[_0x2cea('0x50')][_0x2cea('0x69')]=_0x5bcd33['id'];if(_0x236bf0[_0x2cea('0x46')][_0x2cea('0x52')]){_0x554659['where']=_[_0x2cea('0x53')](_0x554659['where'],{'$or':_['map'](_0x554659[_0x2cea('0x4b')],function(_0x453474){var _0x1da2f1={};_0x1da2f1[_0x453474]={'$like':'%'+_0x236bf0['query'][_0x2cea('0x52')]+'%'};return _0x1da2f1;})});}_0x554659=_[_0x2cea('0x53')]({},_0x554659,_0x236bf0[_0x2cea('0x5b')]);return db[_0x2cea('0x6a')]['count']({'where':_0x554659[_0x2cea('0x50')]})[_0x2cea('0x20')](function(_0x47e16f){_0x242d94[_0x2cea('0x2e')]=_0x47e16f;if(_0x236bf0[_0x2cea('0x46')][_0x2cea('0x5a')]){_0x554659[_0x2cea('0x55')]=[{'all':!![]}];}return db['Disposition'][_0x2cea('0x56')](_0x554659);})['then'](function(_0x1ab9cd){_0x242d94[_0x2cea('0x6d')]=_0x1ab9cd;return _0x242d94;});}})[_0x2cea('0x20')](respondWithFilteredResult(_0x2527e8,_0x554659))[_0x2cea('0x57')](handleError(_0x2527e8,null));};exports[_0x2cea('0x6e')]=function(_0x3b3905,_0x257b0c,_0x1453fb){return db[_0x2cea('0x3f')][_0x2cea('0x66')]({'where':{'id':_0x3b3905[_0x2cea('0x59')]['id']}})[_0x2cea('0x20')](handleEntityNotFound(_0x257b0c,null))[_0x2cea('0x20')](function(_0x2f3993){if(_0x2f3993){return _0x2f3993[_0x2cea('0x6e')](_0x3b3905[_0x2cea('0x46')][_0x2cea('0x6f')]);}})[_0x2cea('0x20')](respondWithStatusCode(_0x257b0c,null))[_0x2cea('0x57')](handleError(_0x257b0c,null));};exports[_0x2cea('0x70')]=function(_0x3ee973,_0x4a3127,_0x3d94e2){if(_0x3ee973[_0x2cea('0x5d')]['id']){delete _0x3ee973[_0x2cea('0x5d')]['id'];}return db['WhatsappAccount'][_0x2cea('0x66')]({'where':{'id':_0x3ee973[_0x2cea('0x59')]['id']}})[_0x2cea('0x20')](handleEntityNotFound(_0x4a3127,null))[_0x2cea('0x20')](function(_0x1e2b88){if(_0x1e2b88){_0x3ee973['body']['WhatsappAccountId']=_0x1e2b88['id'];return db['CannedAnswer']['create'](_0x3ee973[_0x2cea('0x5d')]);}})['then'](respondWithResult(_0x4a3127,null))[_0x2cea('0x57')](handleError(_0x4a3127,null));};exports['getAnswers']=function(_0x364312,_0x1abeeb,_0x77794){var _0x14d7bb={'raw':![],'where':{}};var _0x5e9c7e={};var _0x40a827={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x2cea('0x6c')]({'where':{'id':_0x364312[_0x2cea('0x59')]['id']}})[_0x2cea('0x20')](handleEntityNotFound(_0x1abeeb,null))[_0x2cea('0x20')](function(_0x3721a0){if(_0x3721a0){_0x5e9c7e['model']=_[_0x2cea('0x47')](db['CannedAnswer'][_0x2cea('0x40')]);_0x5e9c7e['query']=_[_0x2cea('0x47')](_0x364312['query']);_0x5e9c7e[_0x2cea('0x48')]=_[_0x2cea('0x49')](_0x5e9c7e[_0x2cea('0x44')],_0x5e9c7e[_0x2cea('0x46')]);_0x14d7bb[_0x2cea('0x4b')]=_[_0x2cea('0x49')](_0x5e9c7e[_0x2cea('0x44')],qs[_0x2cea('0x4a')](_0x364312['query'][_0x2cea('0x4a')]));_0x14d7bb['attributes']=_0x14d7bb[_0x2cea('0x4b')]['length']?_0x14d7bb[_0x2cea('0x4b')]:_0x5e9c7e[_0x2cea('0x44')];if(!_0x364312['query'][_0x2cea('0x71')](_0x2cea('0x4d'))){_0x14d7bb[_0x2cea('0x30')]=qs[_0x2cea('0x30')](_0x364312[_0x2cea('0x46')][_0x2cea('0x30')]);_0x14d7bb[_0x2cea('0x2f')]=qs[_0x2cea('0x2f')](_0x364312[_0x2cea('0x46')][_0x2cea('0x2f')]);}_0x14d7bb[_0x2cea('0x4e')]=qs[_0x2cea('0x4f')](_0x364312[_0x2cea('0x46')][_0x2cea('0x4f')]);_0x14d7bb['where']=qs['filters'](_[_0x2cea('0x51')](_0x364312[_0x2cea('0x46')],_0x5e9c7e[_0x2cea('0x48')]));_0x14d7bb[_0x2cea('0x50')][_0x2cea('0x69')]=_0x3721a0['id'];if(_0x364312['query']['filter']){_0x14d7bb[_0x2cea('0x50')]=_[_0x2cea('0x53')](_0x14d7bb[_0x2cea('0x50')],{'$or':_[_0x2cea('0x3e')](_0x14d7bb['attributes'],function(_0x1c15e4){var _0x29878a={};_0x29878a[_0x1c15e4]={'$like':'%'+_0x364312[_0x2cea('0x46')]['filter']+'%'};return _0x29878a;})});}_0x14d7bb=_[_0x2cea('0x53')]({},_0x14d7bb,_0x364312[_0x2cea('0x5b')]);return db[_0x2cea('0x72')][_0x2cea('0x2e')]({'where':_0x14d7bb[_0x2cea('0x50')]})[_0x2cea('0x20')](function(_0x5f050c){_0x40a827[_0x2cea('0x2e')]=_0x5f050c;if(_0x364312[_0x2cea('0x46')]['includeAll']){_0x14d7bb[_0x2cea('0x55')]=[{'all':!![]}];}return db[_0x2cea('0x72')][_0x2cea('0x56')](_0x14d7bb);})['then'](function(_0x4abfbe){_0x40a827[_0x2cea('0x6d')]=_0x4abfbe;return _0x40a827;});}})[_0x2cea('0x20')](respondWithFilteredResult(_0x1abeeb,_0x14d7bb))[_0x2cea('0x57')](handleError(_0x1abeeb,null));};exports[_0x2cea('0x73')]=function(_0x44af15,_0x29b46a,_0x3f4f4a){return db[_0x2cea('0x3f')][_0x2cea('0x66')]({'where':{'id':_0x44af15[_0x2cea('0x59')]['id']}})[_0x2cea('0x20')](handleEntityNotFound(_0x29b46a,null))[_0x2cea('0x20')](function(_0x59ce34){if(_0x59ce34){return _0x59ce34[_0x2cea('0x73')](_0x44af15['query'][_0x2cea('0x6f')]);}})[_0x2cea('0x20')](respondWithStatusCode(_0x29b46a,null))[_0x2cea('0x57')](handleError(_0x29b46a,null));};exports['addAgents']=function(_0x672c,_0x542c68,_0x2c865b){return db[_0x2cea('0x3f')][_0x2cea('0x66')]({'where':{'id':_0x672c[_0x2cea('0x59')]['id']}})[_0x2cea('0x20')](handleEntityNotFound(_0x542c68,null))[_0x2cea('0x20')](function(_0x42102c){if(_0x42102c){return _0x42102c['addAgents'](_0x672c[_0x2cea('0x5d')][_0x2cea('0x6f')],_[_0x2cea('0x74')](_0x672c['body'],[_0x2cea('0x6f'),'id'])||{})['spread'](function(_0x4d0eea){for(var _0x274170=0x0;_0x274170<_0x672c[_0x2cea('0x5d')][_0x2cea('0x6f')]['length'];_0x274170+=0x1){socket[_0x2cea('0x75')]('userWhatsappAccount:save',{'UserId':_0x672c['body'][_0x2cea('0x6f')][_0x274170],'WhatsappAccountId':_0x672c['params']['id']});}return _0x4d0eea;});}})[_0x2cea('0x20')](respondWithResult(_0x542c68,null))[_0x2cea('0x57')](handleError(_0x542c68,null));};exports[_0x2cea('0x76')]=function(_0x4d1fab,_0x511109,_0x173359){return db[_0x2cea('0x3f')][_0x2cea('0x66')]({'where':{'id':_0x4d1fab[_0x2cea('0x59')]['id']}})['then'](handleEntityNotFound(_0x511109,null))['then'](function(_0x42130c){if(_0x42130c){return _0x42130c[_0x2cea('0x76')](_0x4d1fab[_0x2cea('0x46')][_0x2cea('0x6f')])[_0x2cea('0x20')](function(){if(_[_0x2cea('0x77')](_0x4d1fab[_0x2cea('0x46')][_0x2cea('0x6f')])){for(var _0x3a6e0c=0x0;_0x3a6e0c<_0x4d1fab['query'][_0x2cea('0x6f')][_0x2cea('0x4c')];_0x3a6e0c+=0x1){socket[_0x2cea('0x75')](_0x2cea('0x78'),{'UserId':Number(_0x4d1fab['query']['ids'][_0x3a6e0c]),'WhatsappAccountId':Number(_0x4d1fab[_0x2cea('0x59')]['id'])});}}else{socket['emit'](_0x2cea('0x78'),{'UserId':Number(_0x4d1fab[_0x2cea('0x46')][_0x2cea('0x6f')]),'WhatsappAccountId':Number(_0x4d1fab[_0x2cea('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x511109,null))[_0x2cea('0x57')](handleError(_0x511109,null));};exports[_0x2cea('0x79')]=function(_0x40d395,_0x1ab80a,_0x1962df){var _0x1a7350={};var _0x416db2={};var _0x56819f;var _0x7d3f87;return db[_0x2cea('0x3f')][_0x2cea('0x6c')]({'where':{'id':_0x40d395[_0x2cea('0x59')]['id']}})[_0x2cea('0x20')](handleEntityNotFound(_0x1ab80a,null))[_0x2cea('0x20')](function(_0x5b8162){if(_0x5b8162){_0x56819f=_0x5b8162;_0x416db2[_0x2cea('0x44')]=_[_0x2cea('0x47')](db[_0x2cea('0x7a')][_0x2cea('0x40')]);_0x416db2['query']=_[_0x2cea('0x47')](_0x40d395[_0x2cea('0x46')]);_0x416db2[_0x2cea('0x48')]=_['intersection'](_0x416db2[_0x2cea('0x44')],_0x416db2['query']);_0x1a7350[_0x2cea('0x4b')]=_[_0x2cea('0x49')](_0x416db2[_0x2cea('0x44')],qs['fields'](_0x40d395[_0x2cea('0x46')][_0x2cea('0x4a')]));_0x1a7350['attributes']=_0x1a7350[_0x2cea('0x4b')]['length']?_0x1a7350[_0x2cea('0x4b')]:_0x416db2[_0x2cea('0x44')];_0x1a7350[_0x2cea('0x4e')]=qs['sort'](_0x40d395['query'][_0x2cea('0x4f')]);_0x1a7350[_0x2cea('0x50')]=qs[_0x2cea('0x48')](_['pick'](_0x40d395[_0x2cea('0x46')],_0x416db2[_0x2cea('0x48')]));if(_0x40d395[_0x2cea('0x46')][_0x2cea('0x52')]){_0x1a7350[_0x2cea('0x50')]=_['merge'](_0x1a7350[_0x2cea('0x50')],{'$or':_['map'](_0x1a7350[_0x2cea('0x4b')],function(_0x50a48e){var _0x4d2aea={};_0x4d2aea[_0x50a48e]={'$like':'%'+_0x40d395[_0x2cea('0x46')][_0x2cea('0x52')]+'%'};return _0x4d2aea;})});}_0x1a7350=_[_0x2cea('0x53')]({},_0x1a7350,_0x40d395['options']);return _0x56819f['getAgents'](_0x1a7350);}})[_0x2cea('0x20')](function(_0x206116){if(_0x206116){_0x7d3f87=_0x206116[_0x2cea('0x4c')];if(!_0x40d395[_0x2cea('0x46')][_0x2cea('0x71')](_0x2cea('0x4d'))){_0x1a7350['limit']=qs[_0x2cea('0x30')](_0x40d395[_0x2cea('0x46')][_0x2cea('0x30')]);_0x1a7350[_0x2cea('0x2f')]=qs[_0x2cea('0x2f')](_0x40d395[_0x2cea('0x46')][_0x2cea('0x2f')]);}return _0x56819f[_0x2cea('0x79')](_0x1a7350);}})[_0x2cea('0x20')](function(_0x53f40c){if(_0x53f40c){return _0x53f40c?{'count':_0x7d3f87,'rows':_0x53f40c}:null;}})[_0x2cea('0x20')](respondWithResult(_0x1ab80a,null))['catch'](handleError(_0x1ab80a,null));};exports[_0x2cea('0x7b')]=function(_0x5a55ba,_0x130dae,_0x3ae10d){return db[_0x2cea('0x3f')][_0x2cea('0x6c')]({'where':{'id':_0x5a55ba[_0x2cea('0x59')]['id']}})[_0x2cea('0x20')](handleEntityNotFound(_0x130dae,null))['then'](function(_0x1cb121){if(_0x1cb121){return db[_0x2cea('0x7c')][_0x2cea('0x7d')](function(_0x341b3a){return db['WhatsappApplication'][_0x2cea('0x38')]({'where':{'WhatsappAccountId':_0x5a55ba['params']['id']},'transaction':_0x341b3a})[_0x2cea('0x20')](function(_0x890180){var _0x2943b7=_[_0x2cea('0x3e')](_0x5a55ba[_0x2cea('0x5d')],function(_0x4559c1){_0x4559c1['WhatsappAccountId']=_0x5a55ba[_0x2cea('0x59')]['id'];return _0x4559c1;});return db[_0x2cea('0x7e')][_0x2cea('0x7f')](_0x2943b7,{'transaction':_0x341b3a});});})['then'](function(){return db[_0x2cea('0x7e')][_0x2cea('0x80')]({'where':{'WhatsappAccountId':_0x5a55ba[_0x2cea('0x59')]['id']},'order':_0x2cea('0x81')});});}})[_0x2cea('0x20')](respondWithResult(_0x130dae,null))[_0x2cea('0x57')](handleError(_0x130dae,null));};exports[_0x2cea('0x82')]=function(_0x58329d,_0x2fc390,_0x3f034e){var _0x4b6511={};var _0x1b5784={};var _0x5d220f;var _0x329cd0;return db[_0x2cea('0x3f')][_0x2cea('0x6c')]({'where':{'id':_0x58329d[_0x2cea('0x59')]['id']}})[_0x2cea('0x20')](handleEntityNotFound(_0x2fc390,null))[_0x2cea('0x20')](function(_0x1d5b52){if(_0x1d5b52){_0x5d220f=_0x1d5b52;_0x1b5784[_0x2cea('0x44')]=_['keys'](db[_0x2cea('0x7e')][_0x2cea('0x40')]);_0x1b5784[_0x2cea('0x46')]=_[_0x2cea('0x47')](_0x58329d[_0x2cea('0x46')]);_0x1b5784[_0x2cea('0x48')]=_[_0x2cea('0x49')](_0x1b5784[_0x2cea('0x44')],_0x1b5784[_0x2cea('0x46')]);_0x4b6511['attributes']=_[_0x2cea('0x49')](_0x1b5784['model'],qs[_0x2cea('0x4a')](_0x58329d['query'][_0x2cea('0x4a')]));_0x4b6511[_0x2cea('0x4b')]=_0x4b6511[_0x2cea('0x4b')][_0x2cea('0x4c')]?_0x4b6511[_0x2cea('0x4b')]:_0x1b5784[_0x2cea('0x44')];_0x4b6511[_0x2cea('0x4e')]=qs[_0x2cea('0x4f')](_0x58329d[_0x2cea('0x46')][_0x2cea('0x4f')]);_0x4b6511[_0x2cea('0x50')]=qs['filters'](_[_0x2cea('0x51')](_0x58329d[_0x2cea('0x46')],_0x1b5784[_0x2cea('0x48')]));if(_0x58329d['query']['filter']){_0x4b6511[_0x2cea('0x50')]=_[_0x2cea('0x53')](_0x4b6511[_0x2cea('0x50')],{'$or':_['map'](_0x4b6511[_0x2cea('0x4b')],function(_0x3a0d50){var _0x1e5f04={};_0x1e5f04[_0x3a0d50]={'$like':'%'+_0x58329d[_0x2cea('0x46')][_0x2cea('0x52')]+'%'};return _0x1e5f04;})});}_0x4b6511=_[_0x2cea('0x53')]({},_0x4b6511,_0x58329d[_0x2cea('0x5b')]);return _0x5d220f[_0x2cea('0x82')](_0x4b6511);}})[_0x2cea('0x20')](function(_0x10a9b9){if(_0x10a9b9){_0x329cd0=_0x10a9b9['length'];if(!_0x58329d[_0x2cea('0x46')]['hasOwnProperty'](_0x2cea('0x4d'))){_0x4b6511[_0x2cea('0x30')]=qs['limit'](_0x58329d[_0x2cea('0x46')][_0x2cea('0x30')]);_0x4b6511[_0x2cea('0x2f')]=qs[_0x2cea('0x2f')](_0x58329d['query'][_0x2cea('0x2f')]);}return _0x5d220f['getApplications'](_0x4b6511);}})[_0x2cea('0x20')](function(_0x485914){if(_0x485914){return _0x485914?{'count':_0x329cd0,'rows':_0x485914}:null;}})[_0x2cea('0x20')](respondWithResult(_0x2fc390,null))[_0x2cea('0x57')](handleError(_0x2fc390,null));};exports[_0x2cea('0x83')]=function(_0x17fe9e,_0x54c153,_0x5fc9d){var _0x458743={'channel':_0x2cea('0x84')};var _0x4c59c4=[];var _0x32bf00=[];var _0x1ea68c={};return db[_0x2cea('0x3f')][_0x2cea('0x66')]({'where':{'id':_0x17fe9e['params']['id']},'include':[{'model':db[_0x2cea('0x7e')],'as':_0x2cea('0x85')}]})[_0x2cea('0x20')](handleEntityNotFound(_0x54c153,null))[_0x2cea('0x20')](function(_0x45ee41){_0x458743[_0x2cea('0x86')]=_0x45ee41;_0x458743[_0x2cea('0x87')]=_[_0x2cea('0x88')](_0x45ee41[_0x2cea('0x85')],[_0x2cea('0x81')],[_0x2cea('0x89')]);if(_0x458743[_0x2cea('0x86')][_0x2cea('0x85')]){delete _0x458743[_0x2cea('0x86')][_0x2cea('0x85')];}return db[_0x2cea('0x8a')][_0x2cea('0x67')]();})[_0x2cea('0x20')](function(_0xc6abe7){if(!_0xc6abe7){throw new db[(_0x2cea('0x1c'))]['ValidationError']('no\x20available\x20attributes');}_0x4c59c4=_['difference'](_[_0x2cea('0x47')](_0xc6abe7),[_0x2cea('0x8b'),'updatedAt']);_0x32bf00=_[_0x2cea('0x8c')](_[_0x2cea('0x47')](_0xc6abe7),['createdAt',_0x2cea('0x8d'),'CompanyId',_0x2cea('0x8e')]);_0x458743[_0x2cea('0x5d')]={'mapKey':_0x2cea('0x8f')};if(_0x458743[_0x2cea('0x86')]['type']&&_0x458743['account']['type']===_0x2cea('0x90')){_0x458743['body']['from']=_0x17fe9e[_0x2cea('0x5d')]['From'][_0x2cea('0x91')](_0x2cea('0x92'),'');_0x458743[_0x2cea('0x5d')][_0x2cea('0x5d')]=_0x17fe9e[_0x2cea('0x5d')]['Body'];_0x458743[_0x2cea('0x5d')][_0x2cea('0x93')]=_0x17fe9e[_0x2cea('0x5d')]['MessageSid'];}if(_0x458743[_0x2cea('0x5d')]['id']){delete _0x458743[_0x2cea('0x5d')]['id'];}if(_[_0x2cea('0x94')](_0x458743[_0x2cea('0x5d')][_0x2cea('0x95')])){throw new db[(_0x2cea('0x1c'))][(_0x2cea('0x1d'))](_0x2cea('0x96'));}if(_['isNil'](_0x458743[_0x2cea('0x5d')][_0x2cea('0x5d')])||_0x458743[_0x2cea('0x5d')][_0x2cea('0x5d')]===''){throw new db[(_0x2cea('0x1c'))][(_0x2cea('0x1d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x2cea('0x94')](_0x458743[_0x2cea('0x5d')][_0x2cea('0x97')])){throw new db[(_0x2cea('0x1c'))][(_0x2cea('0x1d'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x32bf00);}if(!_['includes'](_0x32bf00,_0x458743[_0x2cea('0x5d')]['mapKey'])){throw new db[(_0x2cea('0x1c'))][(_0x2cea('0x1d'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x32bf00);}_0x1ea68c[_0x458743['body'][_0x2cea('0x97')]]=_0x458743[_0x2cea('0x5d')][_0x2cea('0x95')];return db[_0x2cea('0x98')][_0x2cea('0x66')]({'where':{'id':_0x458743[_0x2cea('0x86')]['ListId']},'include':[{'model':db[_0x2cea('0x8a')],'as':_0x2cea('0x99'),'where':_0x1ea68c,'limit':0x1,'order':[[_0x2cea('0x8d'),_0x2cea('0x9a')]]}]});})[_0x2cea('0x20')](handleEntityNotFound(_0x54c153,null))['then'](function(_0x4974db){if(_0x4974db){_0x458743[_0x2cea('0x9b')]=_[_0x2cea('0x74')](_0x4974db,[_0x2cea('0x99')]);if(_0x4974db[_0x2cea('0x99')][_0x2cea('0x4c')]){return _0x4974db[_0x2cea('0x99')][0x0];}var _0x11a46c=_[_0x2cea('0x9c')](_0x458743[_0x2cea('0x5d')],{'firstName':_0x458743[_0x2cea('0x5d')]['from'],'ListId':_0x4974db['id']});_0x11a46c[_0x458743[_0x2cea('0x5d')][_0x2cea('0x97')]]=_0x458743[_0x2cea('0x5d')]['from'];return db[_0x2cea('0x8a')][_0x2cea('0x5c')](_0x11a46c,{'fields':_0x4c59c4,'raw':!![]});}})['then'](handleEntityNotFound(_0x54c153,null))[_0x2cea('0x20')](function(_0x8203fd){if(_0x8203fd){_0x458743['contact']=_0x8203fd;var _0x55c253={'ContactId':_0x8203fd['id'],'phone':_0x458743['body']['from'],'WhatsappAccountId':_0x17fe9e[_0x2cea('0x59')]['id']};var _0x41d753={'ContactId':_0x8203fd['id'],'WhatsappAccountId':_0x17fe9e[_0x2cea('0x59')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x2cea('0x66')]({'where':_0x41d753})[_0x2cea('0x20')](function(_0x38c203){if(_0x38c203){return[_0x38c203,![]];}return db['WhatsappInteraction'][_0x2cea('0x5c')](_0x55c253)[_0x2cea('0x20')](function(_0x4916a7){return[_0x4916a7,!![]];});});}})['spread'](function(_0x21742e,_0x2c902e){_0x458743['interaction']=_0x21742e[_0x2cea('0x36')]({'plain':!![]});_0x458743[_0x2cea('0x9d')][_0x2cea('0x9e')]=![];if(_0x2c902e){if(_0x458743[_0x2cea('0x86')][_0x2cea('0x9f')]){_0x458743[_0x2cea('0x87')][_0x2cea('0xa0')]({'id':0x0,'priority':_0x458743[_0x2cea('0x87')][_0x2cea('0x4c')]+0x1,'app':_0x2cea('0xa1'),'appdata':_0x2cea('0xa2'),'interval':'*,*,*,*'});}_0x458743[_0x2cea('0x9d')]['created']=!![];}return db[_0x2cea('0xa3')]['create']({'phone':_0x458743['body'][_0x2cea('0x95')],'messageId':_0x458743['body']['messageId'],'body':_0x458743[_0x2cea('0x5d')][_0x2cea('0x5d')],'WhatsappAccountId':_0x17fe9e[_0x2cea('0x59')]['id'],'WhatsappInteractionId':_0x21742e['id'],'direction':'in','ContactId':_0x21742e[_0x2cea('0xa4')],'AttachmentId':_0x458743['body'][_0x2cea('0xa5')]});})[_0x2cea('0x20')](function(_0x3fa5ca){_0x458743[_0x2cea('0x29')]=_0x3fa5ca;if(_0x458743['interaction']['UserId']){return db[_0x2cea('0x7a')][_0x2cea('0x66')]({'attributes':['id',_0x2cea('0x45')],'where':{'id':_0x458743[_0x2cea('0x9d')][_0x2cea('0xa6')]}})[_0x2cea('0x20')](function(_0x2f45b3){if(_0x2f45b3){_0x458743[_0x2cea('0x87')][_0x2cea('0xa7')]({'id':0x0,'priority':0x0,'app':_0x2cea('0xa8'),'appdata':_0x2f45b3[_0x2cea('0x45')]+','+(_0x458743[_0x2cea('0x86')]['waitForTheAssignedAgent']||0xa),'interval':_0x2cea('0xa9')});}return respondWithRpcPromise(_0x2cea('0xaa'),_0x2cea('0xab'),_0x458743);});}return respondWithRpcPromise('Start',_0x2cea('0xab'),_0x458743);})['then'](function(_0x200530){if(_0x200530){var _0x5b6c42=0xc8;var _0x466b70=_0x2cea('0xac');logger[_0x2cea('0x21')](_0x2cea('0x24'),_0x466b70,_0x5b6c42,_0x2cea('0xad'));logger[_0x2cea('0x23')](_0x2cea('0xae'),_0x466b70,_0x5b6c42,_0x2cea('0xad'),JSON[_0x2cea('0x25')](_0x200530));if(_0x458743[_0x2cea('0x86')][_0x2cea('0x42')]==='twilio'){return _0x54c153[_0x2cea('0x2c')](_0x5b6c42)[_0x2cea('0x31')](_0x2cea('0xaf'),_0x2cea('0xb0'))[_0x2cea('0x3a')]('\x0a');}else{return _0x54c153[_0x2cea('0x2c')](_0x5b6c42)[_0x2cea('0x2d')](_0x200530);}}})['catch'](handleError(_0x54c153,null));};exports['send']=function(_0x1bd88c,_0x3219c5,_0x550eda){var _0x26d520,_0x25e5eb,_0x150b47;if(_[_0x2cea('0x94')](_0x1bd88c[_0x2cea('0x5d')]['body'])||_0x1bd88c[_0x2cea('0x5d')][_0x2cea('0x5d')]===''){throw new db['Sequelize'][(_0x2cea('0x1d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x2cea('0x94')](_0x1bd88c[_0x2cea('0x5d')]['to'])){throw new db[(_0x2cea('0x1c'))][(_0x2cea('0x1d'))](_0x2cea('0xb1'));}_0x26d520=_0x1bd88c[_0x2cea('0x5d')]['to'];return db[_0x2cea('0x3f')][_0x2cea('0x66')]({'where':{'id':_0x1bd88c[_0x2cea('0x59')]['id']},'include':[{'model':db[_0x2cea('0x98')],'as':_0x2cea('0xb2'),'include':[{'model':db[_0x2cea('0x8a')],'as':_0x2cea('0x99'),'where':{'mobile':_0x26d520},'limit':0x1,'order':[['updatedAt',_0x2cea('0x9a')]]}]}]})[_0x2cea('0x20')](handleEntityNotFound(_0x3219c5,null))[_0x2cea('0x20')](function(_0x438d2b){if(_0x438d2b&&_0x438d2b[_0x2cea('0xb2')]){_0x25e5eb=_0x438d2b[_0x2cea('0x36')]({'plain':!![]});if(_0x25e5eb[_0x2cea('0xb2')]&&_0x25e5eb[_0x2cea('0xb2')][_0x2cea('0x99')][_0x2cea('0x4c')]){return _0x25e5eb[_0x2cea('0xb2')][_0x2cea('0x99')][0x0];}return db['CmContact'][_0x2cea('0x5c')](_[_0x2cea('0x9c')](_0x1bd88c[_0x2cea('0x5d')],{'firstName':_0x26d520,'mobile':_0x26d520,'phone':_0x26d520,'ListId':_0x25e5eb[_0x2cea('0x8e')]}));}})[_0x2cea('0x20')](handleEntityNotFound(_0x3219c5,null))['then'](function(_0x2a0e94){if(_0x2a0e94){_0x150b47=_0x2a0e94;return db[_0x2cea('0xb3')][_0x2cea('0x66')]({'where':{'ContactId':_0x150b47['id'],'closed':![],'WhatsappAccountId':_0x25e5eb['id']}})[_0x2cea('0x20')](function(_0x48b36b){if(_0x48b36b){return[_0x48b36b,![]];}return db[_0x2cea('0xb3')][_0x2cea('0x5c')]({'UserId':_0x1bd88c[_0x2cea('0x5e')]['id'],'ContactId':_0x150b47['id'],'WhatsappAccountId':_0x25e5eb['id'],'phone':_0x26d520,'firstMsgDirection':_0x2cea('0xb4'),'Messages':[_[_0x2cea('0x53')](_0x1bd88c[_0x2cea('0x5d')],{'read':![],'body':_0x1bd88c['body'][_0x2cea('0x5d')],'phone':_0x26d520,'WhatsappAccountId':_0x25e5eb['id'],'UserId':_0x1bd88c[_0x2cea('0x5e')]['id'],'ContactId':_0x150b47['id']})]},{'include':[{'model':db[_0x2cea('0xa3')],'as':'Messages'}]})[_0x2cea('0x20')](function(_0x404241){return[_0x404241,!![]];});});}})[_0x2cea('0xb5')](function(_0x21a68d,_0x2f011f){if(_0x2f011f){return _0x21a68d;}return db['WhatsappMessage'][_0x2cea('0x5c')](_[_0x2cea('0x53')](_0x1bd88c[_0x2cea('0x5d')],{'read':![],'body':_0x1bd88c['body'][_0x2cea('0x5d')],'phone':_0x26d520,'WhatsappAccountId':_0x25e5eb['id'],'WhatsappInteractionId':_0x21a68d['id'],'UserId':_0x1bd88c['user']['id'],'ContactId':_0x150b47['id']}))[_0x2cea('0x20')](function(_0x89e95){_0x21a68d[_0x2cea('0xb6')][_0x2cea('0xb7')]=[];_0x21a68d[_0x2cea('0xb6')][_0x2cea('0xb7')][_0x2cea('0xa0')](_0x89e95[_0x2cea('0xb6')]);return _0x21a68d;});})['then'](respondWithResult(_0x3219c5,null))[_0x2cea('0x57')](handleError(_0x3219c5,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 6bb0ba5..274fdf1 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 _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 +var _0x50a5=['../../mysqldb','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4d58c1,_0x115333){var _0x925f11=function(_0x3aae5d){while(--_0x3aae5d){_0x4d58c1['push'](_0x4d58c1['shift']());}};_0x925f11(++_0x115333);}(_0x50a5,0xd1));var _0x550a=function(_0x253cee,_0x353353){_0x253cee=_0x253cee-0x0;var _0x52202e=_0x50a5[_0x253cee];return _0x52202e;};'use strict';var EventEmitter=require(_0x550a('0x0'));var WhatsappAccount=require(_0x550a('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x550a('0x2')};function emitEvent(_0x4827e0){return function(_0x357485,_0x2038f7,_0x45ca06){WhatsappAccountEvents[_0x550a('0x3')](_0x4827e0+':'+_0x357485['id'],_0x357485);WhatsappAccountEvents[_0x550a('0x3')](_0x4827e0,_0x357485);_0x45ca06(null);};}for(var e in events){if(events[_0x550a('0x4')](e)){var event=events[e];WhatsappAccount[_0x550a('0x5')](e,emitEvent(event));}}module[_0x550a('0x6')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 620bd19..f7c554e 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 _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 +var _0x8151=['bluebird','request-promise','path','rimraf','./whatsappAccount.attributes','exports','WhatsappAccount','../../config/logger'];(function(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0x8151,0x15f));var _0x1815=function(_0xa86f0e,_0x48f50b){_0xa86f0e=_0xa86f0e-0x0;var _0x31815f=_0x8151[_0xa86f0e];return _0x31815f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1815('0x0'))('api');var moment=require('moment');var BPromise=require(_0x1815('0x1'));var rp=require(_0x1815('0x2'));var fs=require('fs');var path=require(_0x1815('0x3'));var rimraf=require(_0x1815('0x4'));var config=require('../../config/environment');var attributes=require(_0x1815('0x5'));module[_0x1815('0x6')]=function(_0x541bb1,_0xc882c2){return _0x541bb1['define'](_0x1815('0x7'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 51d32b4..8ddac10 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 _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 +var _0x2e18=['register','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','map','model','include','attributes','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket'];(function(_0x4f1bb9,_0x4a9b3b){var _0x8101ba=function(_0x5ddede){while(--_0x5ddede){_0x4f1bb9['push'](_0x4f1bb9['shift']());}};_0x8101ba(++_0x4a9b3b);}(_0x2e18,0x19c));var _0x82e1=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x2e18[_0x2080a3];return _0x8d7d17;};'use strict';var _=require(_0x82e1('0x0'));var util=require(_0x82e1('0x1'));var moment=require(_0x82e1('0x2'));var BPromise=require('bluebird');var rs=require(_0x82e1('0x3'));var fs=require('fs');var Redis=require(_0x82e1('0x4'));var db=require(_0x82e1('0x5'))['db'];var utils=require(_0x82e1('0x6'));var logger=require(_0x82e1('0x7'))(_0x82e1('0x8'));var config=require(_0x82e1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x82e1('0xa')][_0x82e1('0xb')]({'port':0x232a});config['redis']=_[_0x82e1('0xc')](config[_0x82e1('0xd')],{'host':_0x82e1('0xe'),'port':0x18eb});var socket=require(_0x82e1('0xf'))(new Redis(config[_0x82e1('0xd')]));require(_0x82e1('0x10'))[_0x82e1('0x11')](socket);function respondWithRpcPromise(_0x3b40af,_0x10f52a,_0x222a52){return new BPromise(function(_0x4f613f,_0x2ab85d){return client[_0x82e1('0x12')](_0x3b40af,_0x222a52)['then'](function(_0x177786){logger[_0x82e1('0x13')](_0x82e1('0x14'),_0x10f52a,_0x82e1('0x15'));logger[_0x82e1('0x16')](_0x82e1('0x17'),_0x10f52a,'request\x20sent',JSON[_0x82e1('0x18')](_0x177786));if(_0x177786['error']){if(_0x177786[_0x82e1('0x19')]['code']===0x1f4){logger[_0x82e1('0x19')](_0x82e1('0x14'),_0x10f52a,_0x177786[_0x82e1('0x19')][_0x82e1('0x1a')]);return _0x2ab85d(_0x177786[_0x82e1('0x19')]['message']);}logger['error'](_0x82e1('0x14'),_0x10f52a,_0x177786[_0x82e1('0x19')]['message']);return _0x4f613f(_0x177786[_0x82e1('0x19')][_0x82e1('0x1a')]);}else{logger['info'](_0x82e1('0x14'),_0x10f52a,_0x82e1('0x15'));_0x4f613f(_0x177786[_0x82e1('0x1b')][_0x82e1('0x1a')]);}})[_0x82e1('0x1c')](function(_0x380cdd){logger['error'](_0x82e1('0x14'),_0x10f52a,_0x380cdd);_0x2ab85d(_0x380cdd);});});}exports[_0x82e1('0x1d')]=function(_0xa7dffb){var _0x2fb033=this;return new Promise(function(_0x137a04,_0x159c9e){return db[_0x82e1('0x1e')][_0x82e1('0x1f')]({'raw':_0xa7dffb[_0x82e1('0x20')]?_0xa7dffb[_0x82e1('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0xa7dffb[_0x82e1('0x20')]?_0xa7dffb[_0x82e1('0x20')][_0x82e1('0x21')]||null:null,'attributes':_0xa7dffb[_0x82e1('0x20')]?_0xa7dffb['options']['attributes']||null:null,'include':_0xa7dffb[_0x82e1('0x20')]?_0xa7dffb[_0x82e1('0x20')]['include']?_[_0x82e1('0x22')](_0xa7dffb[_0x82e1('0x20')]['include'],function(_0x854e33){return{'model':db[_0x854e33[_0x82e1('0x23')]],'as':_0x854e33['as'],'attributes':_0x854e33['attributes'],'include':_0x854e33['include']?_['map'](_0x854e33[_0x82e1('0x24')],function(_0x10c705){return{'model':db[_0x10c705['model']],'as':_0x10c705['as'],'attributes':_0x10c705[_0x82e1('0x25')],'include':_0x10c705[_0x82e1('0x24')]?_[_0x82e1('0x22')](_0x10c705[_0x82e1('0x24')],function(_0x5c9086){return{'model':db[_0x5c9086[_0x82e1('0x23')]],'as':_0x5c9086['as'],'attributes':_0x5c9086[_0x82e1('0x25')]};}):[]};}):[]};}):[]:[]})[_0x82e1('0x26')](function(_0x303606){logger[_0x82e1('0x13')](_0x82e1('0x1d'),_0xa7dffb);logger[_0x82e1('0x16')]('ShowWhatsappAccount',_0xa7dffb,JSON[_0x82e1('0x18')](_0x303606));_0x137a04(_0x303606);})[_0x82e1('0x1c')](function(_0x1e19ce){logger[_0x82e1('0x19')](_0x82e1('0x1d'),_0x1e19ce['message'],_0xa7dffb);_0x159c9e(_0x2fb033[_0x82e1('0x19')](0x1f4,_0x1e19ce[_0x82e1('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 829be18..68f9cc7 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 _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 +var _0x6e6c=['./whatsappAccount.events','save','remove','update','emit','removeListener','whatsappAccount:'];(function(_0x46888a,_0xd99424){var _0x11cd87=function(_0x41ad29){while(--_0x41ad29){_0x46888a['push'](_0x46888a['shift']());}};_0x11cd87(++_0xd99424);}(_0x6e6c,0xa8));var _0xc6e6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6e6c[_0x19e35c];return _0x3e1fe8;};'use strict';var WhatsappAccountEvents=require(_0xc6e6('0x0'));var events=[_0xc6e6('0x1'),_0xc6e6('0x2'),_0xc6e6('0x3')];function createListener(_0x58c54c,_0x29d39f){return function(_0x4f2e76){_0x29d39f[_0xc6e6('0x4')](_0x58c54c,_0x4f2e76);};}function removeListener(_0x458b51,_0x4ca48b){return function(){WhatsappAccountEvents[_0xc6e6('0x5')](_0x458b51,_0x4ca48b);};}exports['register']=function(_0xde67b1){for(var _0xef7561=0x0,_0x505708=events['length'];_0xef7561<_0x505708;_0xef7561++){var _0x3b3760=events[_0xef7561];var _0x300c65=createListener(_0xc6e6('0x6')+_0x3b3760,_0xde67b1);WhatsappAccountEvents['on'](_0x3b3760,_0x300c65);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 0fa8e02..1b969ac 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 _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 +var _0x9e02=['../../components/interaction/service','isAuthenticated','index','get','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x17772e,_0x3d4d93){var _0x21e766=function(_0x474f74){while(--_0x474f74){_0x17772e['push'](_0x17772e['shift']());}};_0x21e766(++_0x3d4d93);}(_0x9e02,0x72));var _0x29e0=function(_0x19a4a7,_0x2fc264){_0x19a4a7=_0x19a4a7-0x0;var _0x134a5c=_0x9e02[_0x19a4a7];return _0x134a5c;};'use strict';var multer=require('multer');var util=require(_0x29e0('0x0'));var path=require(_0x29e0('0x1'));var timeout=require(_0x29e0('0x2'));var express=require(_0x29e0('0x3'));var router=express[_0x29e0('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x29e0('0x5'));var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router['get']('/',auth[_0x29e0('0x6')](),controller[_0x29e0('0x7')]);router[_0x29e0('0x8')]('/:id',auth[_0x29e0('0x6')](),controller['show']);router[_0x29e0('0x9')]('/',auth[_0x29e0('0x6')](),controller[_0x29e0('0xa')]);router[_0x29e0('0xb')](_0x29e0('0xc'),auth['isAuthenticated'](),controller[_0x29e0('0xd')]);router[_0x29e0('0xe')](_0x29e0('0xc'),auth[_0x29e0('0x6')](),controller[_0x29e0('0xf')]);module[_0x29e0('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 0661e41..2266194 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 _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 +var _0x9125=['*,*,*,*','exports','STRING','TEXT'];(function(_0x2957a8,_0x1b06d7){var _0x20b696=function(_0x1141d2){while(--_0x1141d2){_0x2957a8['push'](_0x2957a8['shift']());}};_0x20b696(++_0x1b06d7);}(_0x9125,0x141));var _0x5912=function(_0x504dd8,_0x1396f2){_0x504dd8=_0x504dd8-0x0;var _0x54db75=_0x9125[_0x504dd8];return _0x54db75;};'use strict';var Sequelize=require('sequelize');module[_0x5912('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x5912('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x5912('0x2')]()},'description':{'type':Sequelize[_0x5912('0x1')]},'interval':{'type':Sequelize[_0x5912('0x1')],'defaultValue':_0x5912('0x3')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index a491ca0..e63528f 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 _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 +var _0xb24e=['model','query','attributes','intersection','fields','length','nolimit','offset','order','sort','filters','where','type','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','key'];(function(_0x71e9e4,_0x2b8f91){var _0x44f29d=function(_0x42b0d3){while(--_0x42b0d3){_0x71e9e4['push'](_0x71e9e4['shift']());}};_0x44f29d(++_0x2b8f91);}(_0xb24e,0x1e5));var _0xeb24=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xb24e[_0x19950b];return _0x3c6b41;};'use strict';var pdf=require(_0xeb24('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xeb24('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb24('0x2'));var rp=require(_0xeb24('0x3'));var moment=require('moment');var BPromise=require(_0xeb24('0x4'));var Mustache=require(_0xeb24('0x5'));var util=require(_0xeb24('0x6'));var path=require(_0xeb24('0x7'));var sox=require(_0xeb24('0x8'));var csv=require(_0xeb24('0x9'));var ejs=require(_0xeb24('0xa'));var fs=require('fs');var _=require(_0xeb24('0xb'));var squel=require('squel');var crypto=require(_0xeb24('0xc'));var jsforce=require(_0xeb24('0xd'));var deskjs=require(_0xeb24('0xe'));var toCsv=require(_0xeb24('0x9'));var querystring=require(_0xeb24('0xf'));var Papa=require(_0xeb24('0x10'));var Redis=require('ioredis');var authService=require(_0xeb24('0x11'));var qs=require(_0xeb24('0x12'));var as=require(_0xeb24('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeb24('0x14'))(_0xeb24('0x15'));var utils=require(_0xeb24('0x16'));var config=require(_0xeb24('0x17'));var db=require(_0xeb24('0x18'))['db'];function respondWithStatusCode(_0x4f65a8,_0x34d7a6){_0x34d7a6=_0x34d7a6||0xcc;return function(_0x496172){if(_0x496172){return _0x4f65a8[_0xeb24('0x19')](_0x34d7a6);}return _0x4f65a8[_0xeb24('0x1a')](_0x34d7a6)[_0xeb24('0x1b')]();};}function respondWithResult(_0x1427d1,_0x14a67f){_0x14a67f=_0x14a67f||0xc8;return function(_0x25ad4e){if(_0x25ad4e){return _0x1427d1[_0xeb24('0x1a')](_0x14a67f)[_0xeb24('0x1c')](_0x25ad4e);}};}function respondWithFilteredResult(_0x219b94,_0x5cdfbd){return function(_0x5e02a7){if(_0x5e02a7){var _0xa764a5=_0x5e02a7['count'],_0x51e6be=_0x5cdfbd['offset'],_0x7ec4b9=_0x5cdfbd['offset']+_0x5cdfbd[_0xeb24('0x1d')],_0x1b123a;if(_0x7ec4b9>=_0xa764a5){_0x7ec4b9=_0xa764a5;_0x1b123a=0xc8;}else{_0x1b123a=0xce;}_0x219b94['status'](_0x1b123a);return _0x219b94['set'](_0xeb24('0x1e'),_0x51e6be+'-'+_0x7ec4b9+'/'+_0xa764a5)['json'](_0x5e02a7);}return null;};}function patchUpdates(_0xf3774b){return function(_0xed27fc){try{jsonpatch[_0xeb24('0x1f')](_0xed27fc,_0xf3774b,!![]);}catch(_0x14c654){return BPromise[_0xeb24('0x20')](_0x14c654);}return _0xed27fc[_0xeb24('0x21')]();};}function saveUpdates(_0x13c1c7,_0x599e37){return function(_0x165366){if(_0x165366){return _0x165366[_0xeb24('0x22')](_0x13c1c7)[_0xeb24('0x23')](function(_0x1f65da){return _0x1f65da;});}return null;};}function removeEntity(_0x4aa392,_0x20ab9c){return function(_0x22c530){if(_0x22c530){return _0x22c530[_0xeb24('0x24')]()[_0xeb24('0x23')](function(){_0x4aa392[_0xeb24('0x1a')](0xcc)[_0xeb24('0x1b')]();});}};}function handleEntityNotFound(_0x330b60,_0x14f905){return function(_0x446885){if(!_0x446885){_0x330b60[_0xeb24('0x19')](0x194);}return _0x446885;};}function handleError(_0x30ca83,_0x2dc700){_0x2dc700=_0x2dc700||0x1f4;return function(_0x1cb88b){logger[_0xeb24('0x25')](_0x1cb88b[_0xeb24('0x26')]);if(_0x1cb88b[_0xeb24('0x27')]){delete _0x1cb88b[_0xeb24('0x27')];}_0x30ca83[_0xeb24('0x1a')](_0x2dc700)[_0xeb24('0x28')](_0x1cb88b);};}exports[_0xeb24('0x29')]=function(_0x229683,_0x29514d){var _0x5a1f2d={},_0x2d1980={},_0xec09f7={'count':0x0,'rows':[]};var _0x86af55=_[_0xeb24('0x2a')](db[_0xeb24('0x2b')][_0xeb24('0x2c')],function(_0x2f0332){return{'name':_0x2f0332[_0xeb24('0x2d')],'type':_0x2f0332['type'][_0xeb24('0x2e')]};});_0x2d1980[_0xeb24('0x2f')]=_[_0xeb24('0x2a')](_0x86af55,'name');_0x2d1980['query']=_['keys'](_0x229683[_0xeb24('0x30')]);_0x2d1980['filters']=_['intersection'](_0x2d1980[_0xeb24('0x2f')],_0x2d1980['query']);_0x5a1f2d[_0xeb24('0x31')]=_[_0xeb24('0x32')](_0x2d1980[_0xeb24('0x2f')],qs[_0xeb24('0x33')](_0x229683['query'][_0xeb24('0x33')]));_0x5a1f2d[_0xeb24('0x31')]=_0x5a1f2d[_0xeb24('0x31')][_0xeb24('0x34')]?_0x5a1f2d[_0xeb24('0x31')]:_0x2d1980[_0xeb24('0x2f')];if(!_0x229683[_0xeb24('0x30')]['hasOwnProperty'](_0xeb24('0x35'))){_0x5a1f2d[_0xeb24('0x1d')]=qs[_0xeb24('0x1d')](_0x229683[_0xeb24('0x30')]['limit']);_0x5a1f2d[_0xeb24('0x36')]=qs[_0xeb24('0x36')](_0x229683['query']['offset']);}_0x5a1f2d[_0xeb24('0x37')]=qs[_0xeb24('0x38')](_0x229683[_0xeb24('0x30')][_0xeb24('0x38')]);_0x5a1f2d['where']=qs[_0xeb24('0x39')](_['pick'](_0x229683[_0xeb24('0x30')],_0x2d1980[_0xeb24('0x39')]),_0x86af55);if(_0x229683[_0xeb24('0x30')]['filter']){_0x5a1f2d[_0xeb24('0x3a')]=_['merge'](_0x5a1f2d['where'],{'$or':_['map'](_0x86af55,function(_0xe763b8){if(_0xe763b8[_0xeb24('0x3b')]!==_0xeb24('0x3c')){var _0x311ee4={};_0x311ee4[_0xe763b8[_0xeb24('0x27')]]={'$like':'%'+_0x229683[_0xeb24('0x30')][_0xeb24('0x3d')]+'%'};return _0x311ee4;}})});}_0x5a1f2d=_[_0xeb24('0x3e')]({},_0x5a1f2d,_0x229683[_0xeb24('0x3f')]);var _0x191bc1={'where':_0x5a1f2d[_0xeb24('0x3a')]};return db[_0xeb24('0x2b')][_0xeb24('0x40')](_0x191bc1)[_0xeb24('0x23')](function(_0x4d4f7d){_0xec09f7[_0xeb24('0x40')]=_0x4d4f7d;if(_0x229683[_0xeb24('0x30')][_0xeb24('0x41')]){_0x5a1f2d[_0xeb24('0x42')]=[{'all':!![]}];}return db[_0xeb24('0x2b')][_0xeb24('0x43')](_0x5a1f2d);})[_0xeb24('0x23')](function(_0x6f5940){_0xec09f7[_0xeb24('0x44')]=_0x6f5940;return _0xec09f7;})['then'](respondWithFilteredResult(_0x29514d,_0x5a1f2d))[_0xeb24('0x45')](handleError(_0x29514d,null));};exports[_0xeb24('0x46')]=function(_0x54eb1a,_0x27f493){var _0x3f129b={'raw':!![],'where':{'id':_0x54eb1a[_0xeb24('0x47')]['id']}},_0x1dec81={};_0x1dec81['model']=_[_0xeb24('0x48')](db['WhatsappApplication'][_0xeb24('0x2c')]);_0x1dec81[_0xeb24('0x30')]=_[_0xeb24('0x48')](_0x54eb1a[_0xeb24('0x30')]);_0x1dec81[_0xeb24('0x39')]=_[_0xeb24('0x32')](_0x1dec81[_0xeb24('0x2f')],_0x1dec81[_0xeb24('0x30')]);_0x3f129b['attributes']=_[_0xeb24('0x32')](_0x1dec81[_0xeb24('0x2f')],qs[_0xeb24('0x33')](_0x54eb1a[_0xeb24('0x30')]['fields']));_0x3f129b[_0xeb24('0x31')]=_0x3f129b[_0xeb24('0x31')]['length']?_0x3f129b[_0xeb24('0x31')]:_0x1dec81[_0xeb24('0x2f')];if(_0x54eb1a[_0xeb24('0x30')][_0xeb24('0x41')]){_0x3f129b[_0xeb24('0x42')]=[{'all':!![]}];}_0x3f129b=_[_0xeb24('0x3e')]({},_0x3f129b,_0x54eb1a['options']);return db[_0xeb24('0x2b')]['find'](_0x3f129b)[_0xeb24('0x23')](handleEntityNotFound(_0x27f493,null))[_0xeb24('0x23')](respondWithResult(_0x27f493,null))['catch'](handleError(_0x27f493,null));};exports['create']=function(_0x51fffb,_0x4f9915){return db[_0xeb24('0x2b')][_0xeb24('0x49')](_0x51fffb[_0xeb24('0x4a')],{})[_0xeb24('0x23')](respondWithResult(_0x4f9915,0xc9))[_0xeb24('0x45')](handleError(_0x4f9915,null));};exports[_0xeb24('0x22')]=function(_0x2a632a,_0x3ce99a){if(_0x2a632a['body']['id']){delete _0x2a632a[_0xeb24('0x4a')]['id'];}return db[_0xeb24('0x2b')]['find']({'where':{'id':_0x2a632a[_0xeb24('0x47')]['id']}})['then'](handleEntityNotFound(_0x3ce99a,null))[_0xeb24('0x23')](saveUpdates(_0x2a632a[_0xeb24('0x4a')],null))[_0xeb24('0x23')](respondWithResult(_0x3ce99a,null))[_0xeb24('0x45')](handleError(_0x3ce99a,null));};exports['destroy']=function(_0xc6c605,_0x588edf){return db[_0xeb24('0x2b')][_0xeb24('0x4b')]({'where':{'id':_0xc6c605[_0xeb24('0x47')]['id']}})['then'](handleEntityNotFound(_0x588edf,null))[_0xeb24('0x23')](removeEntity(_0x588edf,null))[_0xeb24('0x45')](handleError(_0x588edf,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 23159e0..4ead990 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 _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 +var _0x0271=['moment','bluebird','path','rimraf','define','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x24dff7,_0xb7ddab){var _0x1b9152=function(_0x5be86e){while(--_0x5be86e){_0x24dff7['push'](_0x24dff7['shift']());}};_0x1b9152(++_0xb7ddab);}(_0x0271,0x189));var _0x1027=function(_0x1b57c2,_0x52e796){_0x1b57c2=_0x1b57c2-0x0;var _0x750c38=_0x0271[_0x1b57c2];return _0x750c38;};'use strict';var _=require('lodash');var util=require(_0x1027('0x0'));var logger=require(_0x1027('0x1'))(_0x1027('0x2'));var moment=require(_0x1027('0x3'));var BPromise=require(_0x1027('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1027('0x5'));var rimraf=require(_0x1027('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0xf69d1a,_0x12c03e){return _0xf69d1a[_0x1027('0x7')]('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1027('0x8')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index e4de0f3..a37fd2c 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 _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 +var _0x6c32=['request','info','request\x20sent','debug','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','result','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x7b7098,_0x4157bc){var _0x4cc759=function(_0x3d4cc8){while(--_0x3d4cc8){_0x7b7098['push'](_0x7b7098['shift']());}};_0x4cc759(++_0x4157bc);}(_0x6c32,0xb5));var _0x26c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6c32[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x26c3('0x0'));var util=require('util');var moment=require(_0x26c3('0x1'));var BPromise=require('bluebird');var rs=require(_0x26c3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x26c3('0x3'))['db'];var utils=require(_0x26c3('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x26c3('0x5'));var jayson=require(_0x26c3('0x6'));var client=jayson[_0x26c3('0x7')][_0x26c3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x17bc12,_0x2756e5,_0x438a89){return new BPromise(function(_0x11ed3d,_0x2134b8){return client[_0x26c3('0x9')](_0x17bc12,_0x438a89)['then'](function(_0x561496){logger[_0x26c3('0xa')]('WhatsappApplication,\x20%s,\x20%s',_0x2756e5,_0x26c3('0xb'));logger[_0x26c3('0xc')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x2756e5,_0x26c3('0xb'),JSON[_0x26c3('0xd')](_0x561496));if(_0x561496[_0x26c3('0xe')]){if(_0x561496[_0x26c3('0xe')][_0x26c3('0xf')]===0x1f4){logger['error'](_0x26c3('0x10'),_0x2756e5,_0x561496[_0x26c3('0xe')][_0x26c3('0x11')]);return _0x2134b8(_0x561496[_0x26c3('0xe')][_0x26c3('0x11')]);}logger[_0x26c3('0xe')](_0x26c3('0x10'),_0x2756e5,_0x561496[_0x26c3('0xe')]['message']);return _0x11ed3d(_0x561496['error'][_0x26c3('0x11')]);}else{logger[_0x26c3('0xa')](_0x26c3('0x10'),_0x2756e5,_0x26c3('0xb'));_0x11ed3d(_0x561496[_0x26c3('0x12')][_0x26c3('0x11')]);}})['catch'](function(_0x2edaca){logger[_0x26c3('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x2756e5,_0x2edaca);_0x2134b8(_0x2edaca);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index a2c87e4..7f21f74 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 _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 +var _0x4d65=['../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','download','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','multer','express','../../components/auth/service','../../components/interaction/service'];(function(_0xacff7b,_0x11de3d){var _0x59b50e=function(_0x591e7c){while(--_0x591e7c){_0xacff7b['push'](_0xacff7b['shift']());}};_0x59b50e(++_0x11de3d);}(_0x4d65,0xc0));var _0x54d6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4d65[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x54d6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x54d6('0x1'));var router=express['Router']();var auth=require(_0x54d6('0x2'));var interaction=require(_0x54d6('0x3'));var config=require(_0x54d6('0x4'));var controller=require(_0x54d6('0x5'));router[_0x54d6('0x6')]('/',auth[_0x54d6('0x7')](),controller[_0x54d6('0x8')]);router['get'](_0x54d6('0x9'),auth[_0x54d6('0x7')](),controller[_0x54d6('0xa')]);router['get'](_0x54d6('0xb'),auth[_0x54d6('0x7')](),controller[_0x54d6('0xc')]);router[_0x54d6('0x6')](_0x54d6('0xd'),auth[_0x54d6('0x7')](),controller['getMessages']);router[_0x54d6('0x6')](_0x54d6('0xe'),auth[_0x54d6('0x7')](),controller[_0x54d6('0xf')]);router[_0x54d6('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x54d6('0x10')](_0x54d6('0xd'),auth[_0x54d6('0x7')](),controller[_0x54d6('0x11')]);router[_0x54d6('0x10')](_0x54d6('0x12'),auth[_0x54d6('0x7')](),interaction[_0x54d6('0x13')](_0x54d6('0x14'),_0x54d6('0x15')),controller['addTags']);router[_0x54d6('0x16')](_0x54d6('0xb'),auth['isAuthenticated'](),interaction[_0x54d6('0x13')](_0x54d6('0x14'),_0x54d6('0x17')),controller[_0x54d6('0x18')]);router[_0x54d6('0x19')](_0x54d6('0xb'),auth[_0x54d6('0x7')](),interaction['tracked']('whatsapp',_0x54d6('0x1a')),controller[_0x54d6('0x1b')]);router['delete']('/:id/tags',auth[_0x54d6('0x7')](),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 d9428f0..fae3a09 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 _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 +var _0xede8=['ENUM','out','sequelize','moment','STRING','DATE'];(function(_0x5f382f,_0x3f1432){var _0x3bb11b=function(_0x4daf9b){while(--_0x4daf9b){_0x5f382f['push'](_0x5f382f['shift']());}};_0x3bb11b(++_0x3f1432);}(_0xede8,0x182));var _0x8ede=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xede8[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x8ede('0x0'));var moment=require(_0x8ede('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8ede('0x2')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x8ede('0x2')]},'read1stAt':{'type':Sequelize[_0x8ede('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x8ede('0x4')]('in',_0x8ede('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8ede('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x8ede('0x4')]('in','out'),'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 a22b2ee..535ba58 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(_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 +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(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x7a54,0x106));var _0x47a5=function(_0x25c465,_0x184735){_0x25c465=_0x25c465-0x0;var _0x32a4b6=_0x7a54[_0x25c465];return _0x32a4b6;};'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 198fa65..b7891c0 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 _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 +var _0xc9bf=['events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','then','setDataValue','map','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x293e55,_0x167995){var _0x27f9ef=function(_0x490aca){while(--_0x490aca){_0x293e55['push'](_0x293e55['shift']());}};_0x27f9ef(++_0x167995);}(_0xc9bf,0x1ed));var _0xfc9b=function(_0x114315,_0x304d88){_0x114315=_0x114315-0x0;var _0x2186ba=_0xc9bf[_0x114315];return _0x2186ba;};'use strict';var EventEmitter=require(_0xfc9b('0x0'));var WhatsappInteraction=require(_0xfc9b('0x1'))['db'][_0xfc9b('0x2')];var WhatsappMessage=require(_0xfc9b('0x1'))['db'][_0xfc9b('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xfc9b('0x4')](0x0);var events={'afterCreate':_0xfc9b('0x5'),'afterUpdate':_0xfc9b('0x6'),'afterDestroy':_0xfc9b('0x7')};function emitEvent(_0x5b283f){return function(_0x2cbfb5,_0x494627,_0x546c7d){_0x2cbfb5['getUsers']({'attributes':['id'],'raw':!![]})[_0xfc9b('0x8')](function(_0x5b2cd3){_0x2cbfb5[_0xfc9b('0x9')]('Users',_0x5b2cd3[_0xfc9b('0xa')](function(_0x490622){return{'id':_0x490622['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x2cbfb5['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfc9b('0x8')](function(_0x4bbaf9){_0x2cbfb5['setDataValue']('unreadMessages',_0x4bbaf9[_0xfc9b('0xb')]);WhatsappInteractionEvents[_0xfc9b('0xc')](_0x5b283f+':'+_0x2cbfb5['id'],_0x2cbfb5);WhatsappInteractionEvents[_0xfc9b('0xc')](_0x5b283f,_0x2cbfb5);_0x546c7d(null);})[_0xfc9b('0xd')](_0x546c7d(null));};}for(var e in events){if(events[_0xfc9b('0xe')](e)){var event=events[e];WhatsappInteraction[_0xfc9b('0xf')](e,emitEvent(event));}}module[_0xfc9b('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index bdc0991..ba24aa0 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 _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 +var _0x00b5=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','changed'];(function(_0x28c2cc,_0x212fab){var _0xf79b8f=function(_0x385b1f){while(--_0x385b1f){_0x28c2cc['push'](_0x28c2cc['shift']());}};_0xf79b8f(++_0x212fab);}(_0x00b5,0x103));var _0x500b=function(_0x5f2e2c,_0x110a16){_0x5f2e2c=_0x5f2e2c-0x0;var _0x5acf22=_0x00b5[_0x5f2e2c];return _0x5acf22;};'use strict';var _=require(_0x500b('0x0'));var util=require(_0x500b('0x1'));var logger=require('../../config/logger')(_0x500b('0x2'));var moment=require(_0x500b('0x3'));var BPromise=require('bluebird');var rp=require(_0x500b('0x4'));var fs=require('fs');var path=require(_0x500b('0x5'));var rimraf=require(_0x500b('0x6'));var config=require(_0x500b('0x7'));var attributes=require(_0x500b('0x8'));module[_0x500b('0x9')]=function(_0x33c80e,_0x400228){return _0x33c80e[_0x500b('0xa')](_0x500b('0xb'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d8cb7,_0x1fef46,_0x57584a){if(_0x2d8cb7[_0x500b('0xc')](_0x500b('0xd'))){_0x2d8cb7[_0x500b('0xe')]=moment()[_0x500b('0xf')](_0x500b('0x10'));}_0x57584a(null,_0x2d8cb7);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 5b70b4a..a0e9cb4 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 _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 +var _0xdab6=['options','raw','where','UpdateWhatsappInteraction','debug','AddTagsToWhatsappInteraction','find','addTags','ids','spread','AddTags','lodash','moment','ioredis','rpc','../../config/environment','jayson/promise','redis','localhost','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','WhatsappInteraction','body'];(function(_0x5a71d3,_0x41cbd8){var _0xb929be=function(_0x28cadd){while(--_0x28cadd){_0x5a71d3['push'](_0x5a71d3['shift']());}};_0xb929be(++_0x41cbd8);}(_0xdab6,0x197));var _0x6dab=function(_0x33337f,_0x5d7319){_0x33337f=_0x33337f-0x0;var _0x3d9d50=_0xdab6[_0x33337f];return _0x3d9d50;};'use strict';var _=require(_0x6dab('0x0'));var util=require('util');var moment=require(_0x6dab('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6dab('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6dab('0x3'));var config=require(_0x6dab('0x4'));var jayson=require(_0x6dab('0x5'));var client=jayson['client']['http']({'port':0x232a});config[_0x6dab('0x6')]=_['defaults'](config[_0x6dab('0x6')],{'host':_0x6dab('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6dab('0x6')]));require('./whatsappInteraction.socket')[_0x6dab('0x8')](socket);function respondWithRpcPromise(_0xbf63a6,_0x5565d1,_0x16463d){return new BPromise(function(_0x5da310,_0x5a5680){return client[_0x6dab('0x9')](_0xbf63a6,_0x16463d)[_0x6dab('0xa')](function(_0x4318ff){logger[_0x6dab('0xb')](_0x6dab('0xc'),_0x5565d1,_0x6dab('0xd'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x5565d1,_0x6dab('0xd'),JSON[_0x6dab('0xe')](_0x4318ff));if(_0x4318ff[_0x6dab('0xf')]){if(_0x4318ff[_0x6dab('0xf')][_0x6dab('0x10')]===0x1f4){logger[_0x6dab('0xf')]('WhatsappInteraction,\x20%s,\x20%s',_0x5565d1,_0x4318ff[_0x6dab('0xf')][_0x6dab('0x11')]);return _0x5a5680(_0x4318ff['error']['message']);}logger[_0x6dab('0xf')](_0x6dab('0xc'),_0x5565d1,_0x4318ff[_0x6dab('0xf')][_0x6dab('0x11')]);return _0x5da310(_0x4318ff[_0x6dab('0xf')][_0x6dab('0x11')]);}else{logger[_0x6dab('0xb')](_0x6dab('0xc'),_0x5565d1,_0x6dab('0xd'));_0x5da310(_0x4318ff[_0x6dab('0x12')][_0x6dab('0x11')]);}})[_0x6dab('0x13')](function(_0x5ad1b5){logger[_0x6dab('0xf')]('WhatsappInteraction,\x20%s,\x20%s',_0x5565d1,_0x5ad1b5);_0x5a5680(_0x5ad1b5);});});}exports['UpdateWhatsappInteraction']=function(_0x1fdb8d){var _0xbf1032=this;return new Promise(function(_0x2d1f61,_0x513587){return db[_0x6dab('0x14')]['update'](_0x1fdb8d[_0x6dab('0x15')],{'raw':_0x1fdb8d[_0x6dab('0x16')]?_0x1fdb8d[_0x6dab('0x16')][_0x6dab('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fdb8d[_0x6dab('0x16')]?_0x1fdb8d[_0x6dab('0x16')][_0x6dab('0x18')]||null:null,'attributes':_0x1fdb8d[_0x6dab('0x16')]?_0x1fdb8d[_0x6dab('0x16')]['attributes']||null:null,'limit':_0x1fdb8d[_0x6dab('0x16')]?_0x1fdb8d[_0x6dab('0x16')]['limit']||null:null})[_0x6dab('0xa')](function(_0x410ca4){logger[_0x6dab('0xb')](_0x6dab('0x19'),_0x1fdb8d);logger[_0x6dab('0x1a')](_0x6dab('0x19'),_0x1fdb8d,JSON[_0x6dab('0xe')](_0x410ca4));_0x2d1f61(_0x410ca4);})[_0x6dab('0x13')](function(_0xb7f5){logger[_0x6dab('0xf')](_0x6dab('0x19'),_0xb7f5[_0x6dab('0x11')],_0x1fdb8d);_0x513587(_0xbf1032[_0x6dab('0xf')](0x1f4,_0xb7f5['message']));});});};exports[_0x6dab('0x1b')]=function(_0xc80738){return new Promise(function(_0x222d60,_0x5a21df){return db[_0x6dab('0x14')][_0x6dab('0x1c')]({'where':_0xc80738['options']?_0xc80738[_0x6dab('0x16')][_0x6dab('0x18')]||null:null})[_0x6dab('0xa')](function(_0x4bbb92){if(_0x4bbb92){return _0x4bbb92[_0x6dab('0x1d')](_0xc80738[_0x6dab('0x15')][_0x6dab('0x1e')],_['omit'](_0xc80738[_0x6dab('0x15')],[_0x6dab('0x1e'),'id'])||{});}})[_0x6dab('0x1f')](function(_0x1d64d3){logger[_0x6dab('0xb')]('AddTags',_0xc80738);logger['debug'](_0x6dab('0x20'),_0xc80738,JSON['stringify'](_0x1d64d3));_0x222d60(_0x1d64d3);})[_0x6dab('0x13')](function(_0x3ebf9b){logger[_0x6dab('0xf')](_0x6dab('0x20'),_0x3ebf9b['message'],_0xc80738);_0x5a21df(_this[_0x6dab('0xf')](0x1f4,_0x3ebf9b[_0x6dab('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 002a51c..124b045 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 _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 +var _0x1cd9=['emit','removeListener','register','whatsappInteraction:','./whatsappInteraction.events','save'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1cd9,0x118));var _0x91cd=function(_0x17e798,_0x446651){_0x17e798=_0x17e798-0x0;var _0x47ef8c=_0x1cd9[_0x17e798];return _0x47ef8c;};'use strict';var WhatsappInteractionEvents=require(_0x91cd('0x0'));var events=[_0x91cd('0x1'),'remove','update'];function createListener(_0x42fac1,_0x5a35bb){return function(_0x5f17b1){_0x5a35bb[_0x91cd('0x2')](_0x42fac1,_0x5f17b1);};}function removeListener(_0x18bdd3,_0x16a9d0){return function(){WhatsappInteractionEvents[_0x91cd('0x3')](_0x18bdd3,_0x16a9d0);};}exports[_0x91cd('0x4')]=function(_0x30f2f1){for(var _0x536353=0x0,_0x40f510=events['length'];_0x536353<_0x40f510;_0x536353++){var _0x6fdf2d=events[_0x536353];var _0x23c792=createListener(_0x91cd('0x5')+_0x6fdf2d,_0x30f2f1);WhatsappInteractionEvents['on'](_0x6fdf2d,_0x23c792);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index eca16d2..6b97896 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 _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 +var _0x6347=['status','put','/:id/accept','accept','/:id/reject','reject','multer','util','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','/:id/status'];(function(_0x58ff7a,_0x300d57){var _0x3e491b=function(_0x4fd4a7){while(--_0x4fd4a7){_0x58ff7a['push'](_0x58ff7a['shift']());}};_0x3e491b(++_0x300d57);}(_0x6347,0x90));var _0x7634=function(_0x5e5585,_0x2d4d7b){_0x5e5585=_0x5e5585-0x0;var _0x486032=_0x6347[_0x5e5585];return _0x486032;};'use strict';var multer=require(_0x7634('0x0'));var util=require(_0x7634('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7634('0x2')]();var auth=require(_0x7634('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7634('0x4'));var controller=require('./whatsappMessage.controller');router[_0x7634('0x5')]('/',auth[_0x7634('0x6')](),controller[_0x7634('0x7')]);router[_0x7634('0x5')](_0x7634('0x8'),auth[_0x7634('0x6')](),controller[_0x7634('0x9')]);router['get'](_0x7634('0xa'),auth[_0x7634('0x6')](),controller[_0x7634('0xb')]);router[_0x7634('0xc')]('/',auth['isAuthenticated'](),interaction[_0x7634('0xd')](_0x7634('0xe'),_0x7634('0xf')),controller['create']);router[_0x7634('0xc')](_0x7634('0x10'),controller[_0x7634('0x11')]);router[_0x7634('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router['put'](_0x7634('0x13'),auth[_0x7634('0x6')](),controller[_0x7634('0x14')]);router[_0x7634('0x12')](_0x7634('0x15'),auth[_0x7634('0x6')](),controller[_0x7634('0x16')]);router['delete'](_0x7634('0xa'),auth[_0x7634('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 8b5c2a2..a80971d 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 _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 +var _0x2b41=['TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2b41,0x146));var _0x12b4=function(_0x1acc03,_0x1794d6){_0x1acc03=_0x1acc03-0x0;var _0x51bc63=_0x2b41[_0x1acc03];return _0x51bc63;};'use strict';var Sequelize=require(_0x12b4('0x0'));module[_0x12b4('0x1')]={'body':{'type':Sequelize[_0x12b4('0x2')](_0x12b4('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x12b4('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x12b4('0x5')]('in',_0x12b4('0x6')),'defaultValue':_0x12b4('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x12b4('0x7')]},'secret':{'type':Sequelize[_0x12b4('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 9d960ea..37db165 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 _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 +var _0xe297=['reject','save','destroy','stack','name','send','index','map','WhatsappMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','sort','pick','where','merge','VIRTUAL','options','includeAll','include','rows','catch','params','rawAttributes','find','create','body','update','describe','whatsapp-interactions','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','CmContact','WhatsappInteraction','WhatsappInteractionId','UserId','isNil','read1stAt','format','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','rejectmessage','WhatsappAccount','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','bluebird','util','sox','to-csv','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./whatsappMessage.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~!@#$%^&-_=+[{]}.','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','sendStatus','status','end','json','count','offset','set','Content-Range','apply'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe297,0x152));var _0x7e29=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe297[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7e29('0x0'));var rimraf=require(_0x7e29('0x1'));var zipdir=require(_0x7e29('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7e29('0x3'));var Mustache=require('mustache');var util=require(_0x7e29('0x4'));var path=require('path');var sox=require(_0x7e29('0x5'));var csv=require(_0x7e29('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7e29('0x7'));var crypto=require(_0x7e29('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7e29('0x6'));var querystring=require(_0x7e29('0x9'));var Papa=require(_0x7e29('0xa'));var Redis=require(_0x7e29('0xb'));var authService=require(_0x7e29('0xc'));var qs=require(_0x7e29('0xd'));var as=require(_0x7e29('0xe'));var hardwareService=require(_0x7e29('0xf'));var logger=require(_0x7e29('0x10'))(_0x7e29('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x7e29('0x12'))['db'];config[_0x7e29('0x13')]=_[_0x7e29('0x14')](config[_0x7e29('0x13')],{'host':_0x7e29('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7e29('0x13')]));require(_0x7e29('0x16'))[_0x7e29('0x17')](socket);var jayson=require(_0x7e29('0x18'));var client=jayson[_0x7e29('0x19')][_0x7e29('0x1a')]({'port':0x232c});var client9002=jayson[_0x7e29('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x3e448c,_0x74964c,_0x563ca2){if(_0x563ca2){var _0x561a3b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x561a3b[_0x7e29('0x1b')](_0x74964c)){return _0x3e448c;}else{throw new db[(_0x7e29('0x1c'))][(_0x7e29('0x1d'))](_0x7e29('0x1e'));}}else{return _0x3e448c;}}function respondWithRpcPromise(_0x1c3318,_0x2339bf,_0x2a2a1f,_0x1bae09){return new BPromise(function(_0x41b078,_0x197606){var _0x8fbceb=_0x1bae09||client;return _0x8fbceb['request'](_0x1c3318,_0x2a2a1f)[_0x7e29('0x1f')](function(_0x26227e){logger[_0x7e29('0x20')](_0x7e29('0x21'),_0x2339bf,_0x7e29('0x22'));logger['debug'](_0x7e29('0x23'),_0x2339bf,'request\x20sent',JSON[_0x7e29('0x24')](_0x26227e));if(_0x26227e['error']){if(_0x26227e['error'][_0x7e29('0x25')]===0x1f4){logger[_0x7e29('0x26')](_0x7e29('0x21'),_0x2339bf,_0x26227e[_0x7e29('0x26')][_0x7e29('0x27')]);return _0x197606(_0x26227e[_0x7e29('0x26')]['message']);}logger[_0x7e29('0x26')](_0x7e29('0x21'),_0x2339bf,_0x26227e[_0x7e29('0x26')][_0x7e29('0x27')]);return _0x41b078(_0x26227e[_0x7e29('0x26')][_0x7e29('0x27')]);}else{logger[_0x7e29('0x20')](_0x7e29('0x21'),_0x2339bf,_0x7e29('0x22'));_0x41b078(_0x26227e['result'][_0x7e29('0x27')]);}})['catch'](function(_0x42d9e7){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x2339bf,_0x42d9e7);_0x197606(_0x42d9e7);});});}function respondWithStatusCode(_0x4118df,_0x1dcdd2){_0x1dcdd2=_0x1dcdd2||0xcc;return function(_0x38b094){if(_0x38b094){return _0x4118df[_0x7e29('0x28')](_0x1dcdd2);}return _0x4118df[_0x7e29('0x29')](_0x1dcdd2)[_0x7e29('0x2a')]();};}function respondWithResult(_0xdad545,_0x3e828b){_0x3e828b=_0x3e828b||0xc8;return function(_0x8007bb){if(_0x8007bb){return _0xdad545[_0x7e29('0x29')](_0x3e828b)[_0x7e29('0x2b')](_0x8007bb);}};}function respondWithFilteredResult(_0x1250a8,_0xab747c){return function(_0x421c87){if(_0x421c87){var _0x212264=_0x421c87[_0x7e29('0x2c')],_0x4ee07d=_0xab747c[_0x7e29('0x2d')],_0x472bf5=_0xab747c[_0x7e29('0x2d')]+_0xab747c['limit'],_0x360640;if(_0x472bf5>=_0x212264){_0x472bf5=_0x212264;_0x360640=0xc8;}else{_0x360640=0xce;}_0x1250a8[_0x7e29('0x29')](_0x360640);return _0x1250a8[_0x7e29('0x2e')](_0x7e29('0x2f'),_0x4ee07d+'-'+_0x472bf5+'/'+_0x212264)['json'](_0x421c87);}return null;};}function patchUpdates(_0x4c094d){return function(_0x178194){try{jsonpatch[_0x7e29('0x30')](_0x178194,_0x4c094d,!![]);}catch(_0x341b1d){return BPromise[_0x7e29('0x31')](_0x341b1d);}return _0x178194[_0x7e29('0x32')]();};}function saveUpdates(_0x15ec3e,_0x3b2823){return function(_0x3f37e9){if(_0x3f37e9){return _0x3f37e9['update'](_0x15ec3e)[_0x7e29('0x1f')](function(_0x59c729){return _0x59c729;});}return null;};}function removeEntity(_0x5afb39,_0x4f47d2){return function(_0x318aed){if(_0x318aed){return _0x318aed[_0x7e29('0x33')]()[_0x7e29('0x1f')](function(){_0x5afb39['status'](0xcc)[_0x7e29('0x2a')]();});}};}function handleEntityNotFound(_0x1282b1,_0x34baf8){return function(_0x1ac3c2){if(!_0x1ac3c2){_0x1282b1['sendStatus'](0x194);}return _0x1ac3c2;};}function handleError(_0x522d6c,_0x18fe2e){_0x18fe2e=_0x18fe2e||0x1f4;return function(_0x3a31f2){logger[_0x7e29('0x26')](_0x3a31f2[_0x7e29('0x34')]);if(_0x3a31f2[_0x7e29('0x35')]){delete _0x3a31f2['name'];}_0x522d6c['status'](_0x18fe2e)[_0x7e29('0x36')](_0x3a31f2);};}exports[_0x7e29('0x37')]=function(_0x34ce7f,_0x3b165c){var _0xee2147={},_0x4bc38f={},_0x471b88={'count':0x0,'rows':[]};var _0x37d90b=_[_0x7e29('0x38')](db[_0x7e29('0x39')]['rawAttributes'],function(_0x462e2d){return{'name':_0x462e2d[_0x7e29('0x3a')],'type':_0x462e2d[_0x7e29('0x3b')][_0x7e29('0x3c')]};});_0x4bc38f[_0x7e29('0x3d')]=_[_0x7e29('0x38')](_0x37d90b,'name');_0x4bc38f[_0x7e29('0x3e')]=_[_0x7e29('0x3f')](_0x34ce7f[_0x7e29('0x3e')]);_0x4bc38f[_0x7e29('0x40')]=_[_0x7e29('0x41')](_0x4bc38f[_0x7e29('0x3d')],_0x4bc38f['query']);_0xee2147[_0x7e29('0x42')]=_[_0x7e29('0x41')](_0x4bc38f['model'],qs[_0x7e29('0x43')](_0x34ce7f[_0x7e29('0x3e')]['fields']));_0xee2147[_0x7e29('0x42')]=_0xee2147[_0x7e29('0x42')][_0x7e29('0x44')]?_0xee2147[_0x7e29('0x42')]:_0x4bc38f['model'];if(!_0x34ce7f['query']['hasOwnProperty'](_0x7e29('0x45'))){_0xee2147['limit']=qs[_0x7e29('0x46')](_0x34ce7f[_0x7e29('0x3e')][_0x7e29('0x46')]);_0xee2147[_0x7e29('0x2d')]=qs[_0x7e29('0x2d')](_0x34ce7f['query']['offset']);}_0xee2147['order']=qs[_0x7e29('0x47')](_0x34ce7f['query'][_0x7e29('0x47')]);_0xee2147['where']=qs[_0x7e29('0x40')](_[_0x7e29('0x48')](_0x34ce7f['query'],_0x4bc38f[_0x7e29('0x40')]),_0x37d90b);if(_0x34ce7f[_0x7e29('0x3e')]['filter']){_0xee2147[_0x7e29('0x49')]=_[_0x7e29('0x4a')](_0xee2147[_0x7e29('0x49')],{'$or':_['map'](_0x37d90b,function(_0x4c0fa6){if(_0x4c0fa6[_0x7e29('0x3b')]!==_0x7e29('0x4b')){var _0x261e1e={};_0x261e1e[_0x4c0fa6['name']]={'$like':'%'+_0x34ce7f[_0x7e29('0x3e')]['filter']+'%'};return _0x261e1e;}})});}_0xee2147=_[_0x7e29('0x4a')]({},_0xee2147,_0x34ce7f[_0x7e29('0x4c')]);var _0x8fb365={'where':_0xee2147[_0x7e29('0x49')]};return db['WhatsappMessage'][_0x7e29('0x2c')](_0x8fb365)[_0x7e29('0x1f')](function(_0x558a5f){_0x471b88[_0x7e29('0x2c')]=_0x558a5f;if(_0x34ce7f['query'][_0x7e29('0x4d')]){_0xee2147[_0x7e29('0x4e')]=[{'all':!![]}];}return db[_0x7e29('0x39')]['findAll'](_0xee2147);})['then'](function(_0x2c0793){_0x471b88[_0x7e29('0x4f')]=_0x2c0793;return _0x471b88;})[_0x7e29('0x1f')](respondWithFilteredResult(_0x3b165c,_0xee2147))[_0x7e29('0x50')](handleError(_0x3b165c,null));};exports['show']=function(_0x56b304,_0x5dbd07){var _0x5c71ed={'raw':!![],'where':{'id':_0x56b304[_0x7e29('0x51')]['id']}},_0x168949={};_0x168949[_0x7e29('0x3d')]=_[_0x7e29('0x3f')](db[_0x7e29('0x39')][_0x7e29('0x52')]);_0x168949['query']=_[_0x7e29('0x3f')](_0x56b304[_0x7e29('0x3e')]);_0x168949[_0x7e29('0x40')]=_[_0x7e29('0x41')](_0x168949['model'],_0x168949[_0x7e29('0x3e')]);_0x5c71ed[_0x7e29('0x42')]=_[_0x7e29('0x41')](_0x168949[_0x7e29('0x3d')],qs[_0x7e29('0x43')](_0x56b304['query']['fields']));_0x5c71ed[_0x7e29('0x42')]=_0x5c71ed[_0x7e29('0x42')][_0x7e29('0x44')]?_0x5c71ed[_0x7e29('0x42')]:_0x168949['model'];if(_0x56b304[_0x7e29('0x3e')][_0x7e29('0x4d')]){_0x5c71ed[_0x7e29('0x4e')]=[{'all':!![]}];}_0x5c71ed=_[_0x7e29('0x4a')]({},_0x5c71ed,_0x56b304['options']);return db[_0x7e29('0x39')][_0x7e29('0x53')](_0x5c71ed)[_0x7e29('0x1f')](handleEntityNotFound(_0x5dbd07,null))[_0x7e29('0x1f')](respondWithResult(_0x5dbd07,null))[_0x7e29('0x50')](handleError(_0x5dbd07,null));};exports[_0x7e29('0x54')]=function(_0x56661e,_0x520983){return db['WhatsappMessage'][_0x7e29('0x54')](_0x56661e[_0x7e29('0x55')],{})['then'](respondWithResult(_0x520983,0xc9))[_0x7e29('0x50')](handleError(_0x520983,null));};exports[_0x7e29('0x56')]=function(_0x2b0020,_0x365b2a){if(_0x2b0020[_0x7e29('0x55')]['id']){delete _0x2b0020['body']['id'];}return db[_0x7e29('0x39')]['find']({'where':{'id':_0x2b0020['params']['id']}})[_0x7e29('0x1f')](handleEntityNotFound(_0x365b2a,null))[_0x7e29('0x1f')](saveUpdates(_0x2b0020['body'],null))[_0x7e29('0x1f')](respondWithResult(_0x365b2a,null))[_0x7e29('0x50')](handleError(_0x365b2a,null));};exports[_0x7e29('0x33')]=function(_0x18d251,_0xa1f68){return db[_0x7e29('0x39')][_0x7e29('0x53')]({'where':{'id':_0x18d251[_0x7e29('0x51')]['id']}})[_0x7e29('0x1f')](handleEntityNotFound(_0xa1f68,null))['then'](removeEntity(_0xa1f68,null))[_0x7e29('0x50')](handleError(_0xa1f68,null));};exports[_0x7e29('0x57')]=function(_0x1c05f6,_0x3f978a){return db[_0x7e29('0x39')][_0x7e29('0x57')]()[_0x7e29('0x1f')](respondWithResult(_0x3f978a,null))[_0x7e29('0x50')](handleError(_0x3f978a,null));};var interaction_log=require('../../config/logger')(_0x7e29('0x58'));exports[_0x7e29('0x59')]=function(_0x4c13a6,_0x589ea7,_0x1fdd13){var _0x21fba0={'channel':_0x7e29('0x5a')};if(_0x4c13a6[_0x7e29('0x55')]['id']){delete _0x4c13a6[_0x7e29('0x55')]['id'];}_0x4c13a6[_0x7e29('0x55')][_0x7e29('0x5b')]=!![];_0x4c13a6[_0x7e29('0x55')][_0x7e29('0x5c')]=moment()['format'](_0x7e29('0x5d'));_0x4c13a6[_0x7e29('0x55')]['UserId']=_0x4c13a6[_0x7e29('0x55')]['UserId']||_0x4c13a6['user']['id'];return db[_0x7e29('0x39')][_0x7e29('0x53')]({'where':{'id':_0x4c13a6['params']['id'],'UserId':null},'include':[{'model':db[_0x7e29('0x5e')],'as':'Contact'}]})[_0x7e29('0x1f')](handleEntityNotFound(_0x589ea7,null))[_0x7e29('0x1f')](saveUpdates(_0x4c13a6['body'],null))[_0x7e29('0x1f')](function(_0x1ec74f){if(_0x1ec74f){_0x21fba0['message']=_0x1ec74f['get']({'plain':!![]});return db[_0x7e29('0x5f')][_0x7e29('0x53')]({'where':{'id':_0x1ec74f[_0x7e29('0x60')]}});}return null;})[_0x7e29('0x1f')](handleEntityNotFound(_0x589ea7,null))[_0x7e29('0x1f')](function(_0x5a1edb){if(_0x5a1edb){return _0x5a1edb[_0x7e29('0x56')]({'UserId':_0x4c13a6[_0x7e29('0x55')][_0x7e29('0x61')],'read1stAt':_[_0x7e29('0x62')](_0x5a1edb[_0x7e29('0x63')])?moment()[_0x7e29('0x64')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x7e29('0x1f')](function(_0x52d4de){if(_0x52d4de){_0x21fba0[_0x7e29('0x65')]=_0x52d4de[_0x7e29('0x66')]({'plain':!![]});interaction_log[_0x7e29('0x20')](_0x7e29('0x67'),_0x4c13a6[_0x7e29('0x68')]['id'],_0x4c13a6[_0x7e29('0x68')][_0x7e29('0x35')],_0x4c13a6[_0x7e29('0x68')][_0x7e29('0x69')],_0x21fba0[_0x7e29('0x65')]['id'],_0x4c13a6[_0x7e29('0x55')]?JSON['stringify'](_0x4c13a6[_0x7e29('0x55')]):_0x7e29('0x6a'));return respondWithRpcPromise(_0x7e29('0x6b'),_0x7e29('0x6c'),_0x21fba0);}return null;})['then'](function(_0x20bdac){if(_0x20bdac){if(_0x4c13a6[_0x7e29('0x55')][_0x7e29('0x6d')]){_0x21fba0[_0x7e29('0x27')][_0x7e29('0x6e')]=util[_0x7e29('0x64')](_0x7e29('0x6f'),_0x4c13a6[_0x7e29('0x68')][_0x7e29('0x35')]);_0x21fba0['message'][_0x7e29('0x70')]=_0x21fba0['channel'];_0x21fba0[_0x7e29('0x27')][_0x7e29('0x71')]=_0x7e29('0x59');return respondWithRpcPromise(_0x7e29('0x72'),_0x7e29('0x72'),{'event':_0x7e29('0x73'),'message':_0x21fba0[_0x7e29('0x27')]},client9002)[_0x7e29('0x1f')](function(){return _0x21fba0;});}return _0x21fba0;}return null;})[_0x7e29('0x1f')](respondWithResult(_0x589ea7,null))[_0x7e29('0x50')](handleError(_0x589ea7,null));};var interaction_log=require(_0x7e29('0x10'))(_0x7e29('0x58'));exports[_0x7e29('0x31')]=function(_0x5e7846,_0x2cb458,_0x1fa315){var _0xb7148c={'agent':{},'channel':_0x7e29('0x5a')};if(_0x5e7846[_0x7e29('0x55')]['id']){delete _0x5e7846[_0x7e29('0x55')]['id'];}_0x5e7846['body'][_0x7e29('0x61')]=_0x5e7846['body'][_0x7e29('0x61')]||_0x5e7846['user']['id'];_0xb7148c[_0x7e29('0x74')]['id']=_0x5e7846[_0x7e29('0x55')][_0x7e29('0x61')];return db[_0x7e29('0x39')][_0x7e29('0x53')]({'where':{'id':_0x5e7846[_0x7e29('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2cb458,null))[_0x7e29('0x1f')](function(_0x267aed){if(_0x267aed){_0xb7148c[_0x7e29('0x27')]=_0x267aed['get']({'plain':!![]});return db[_0x7e29('0x5f')][_0x7e29('0x53')]({'where':{'id':_0x267aed['WhatsappInteractionId']}});}return null;})[_0x7e29('0x1f')](handleEntityNotFound(_0x2cb458,null))[_0x7e29('0x1f')](function(_0x3dcaa2){if(_0x3dcaa2){_0xb7148c[_0x7e29('0x65')]=_0x3dcaa2[_0x7e29('0x66')]({'plain':!![]});interaction_log[_0x7e29('0x20')](_0x7e29('0x75'),_0x5e7846[_0x7e29('0x68')]['id'],_0x5e7846[_0x7e29('0x68')]['name'],_0x5e7846['user'][_0x7e29('0x69')],_0xb7148c[_0x7e29('0x65')]['id'],_0x5e7846['body']?JSON[_0x7e29('0x24')](_0x5e7846[_0x7e29('0x55')]):_0x7e29('0x6a'));return respondWithRpcPromise('RejectMessage',_0x7e29('0x76'),_0xb7148c);}return null;})[_0x7e29('0x1f')](function(_0x2f4aee){if(_0x2f4aee){_0x2f4aee[_0x7e29('0x27')][_0x7e29('0x6e')]=util[_0x7e29('0x64')](_0x7e29('0x6f'),_0x5e7846[_0x7e29('0x68')][_0x7e29('0x35')]);_0x2f4aee[_0x7e29('0x27')][_0x7e29('0x70')]=_0xb7148c[_0x7e29('0x70')];_0x2f4aee[_0x7e29('0x27')][_0x7e29('0x71')]=_0x7e29('0x31');respondWithRpcPromise(_0x7e29('0x72'),'EventManager',{'event':_0x7e29('0x77'),'message':_0x2f4aee[_0x7e29('0x27')]},client9002);return _0xb7148c;}return null;})['then'](respondWithResult(_0x2cb458,null))[_0x7e29('0x50')](handleError(_0x2cb458,null));};exports[_0x7e29('0x29')]=function(_0x1bc6b9,_0x5e9422,_0x2db76d){if(_0x1bc6b9[_0x7e29('0x55')]['id']){delete _0x1bc6b9[_0x7e29('0x55')]['id'];}var _0x16df24;return db[_0x7e29('0x39')]['find']({'where':{'id':_0x1bc6b9['params']['id']}})[_0x7e29('0x1f')](handleEntityNotFound(_0x5e9422,null))[_0x7e29('0x1f')](function(_0x43c1eb){if(_0x43c1eb){_0x16df24=_0x43c1eb;return db[_0x7e29('0x78')]['find']({'where':{'id':_0x43c1eb['WhatsappAccountId']}});}})[_0x7e29('0x1f')](handleEntityNotFound(_0x5e9422,null))['then'](function(_0x3e3b3d){if(_0x3e3b3d){logger[_0x7e29('0x79')](_0x7e29('0x7a'),_0x7e29('0x29'),_0x7e29('0x7b'),_0x3e3b3d[_0x7e29('0x3b')],util[_0x7e29('0x7c')](_0x1bc6b9[_0x7e29('0x55')],{'showHidden':![],'depth':null}));switch(_0x3e3b3d['type']){case'twilio':if(_0x1bc6b9['body'][_0x7e29('0x7d')]&&_0x1bc6b9[_0x7e29('0x55')][_0x7e29('0x7d')]===_0x16df24[_0x7e29('0x7e')]&&_0x1bc6b9['body']['MessageStatus']&&_0x1bc6b9[_0x7e29('0x55')][_0x7e29('0x7f')]==='read'){return _0x16df24[_0x7e29('0x56')]({'read':!![]});}else{logger['error'](_0x7e29('0x80'),_0x7e29('0x29'),'twilio',util[_0x7e29('0x7c')](_0x1bc6b9[_0x7e29('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x16df24;}})[_0x7e29('0x1f')](respondWithResult(_0x5e9422,null))['catch'](handleError(_0x5e9422,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 9196d15..6945e6f 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 _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 +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x542197,_0x40f3db){var _0x451ac0=function(_0x45ade1){while(--_0x45ade1){_0x542197['push'](_0x542197['shift']());}};_0x451ac0(++_0x40f3db);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2d52aa,_0x4179e9){_0x2d52aa=_0x2d52aa-0x0;var _0xde20c5=_0x5f2f[_0x2d52aa];return _0xde20c5;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index bb138a4..2f49d9b 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 _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 +var _0x37e1=['./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','body','models','direction','toLowerCase','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','update','catch','error','out','WhatsappAccount','find','type','twilio','accountSid','authToken','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','then','sid','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4bd91d,_0x287e43){var _0x1c26fa=function(_0x41a206){while(--_0x41a206){_0x4bd91d['push'](_0x4bd91d['shift']());}};_0x1c26fa(++_0x287e43);}(_0x37e1,0x18e));var _0x137e=function(_0x4a69de,_0x4bd791){_0x4a69de=_0x4a69de-0x0;var _0x17eb79=_0x37e1[_0x4a69de];return _0x17eb79;};'use strict';var _=require('lodash');var util=require(_0x137e('0x0'));var logger=require(_0x137e('0x1'))('api');var moment=require(_0x137e('0x2'));var BPromise=require(_0x137e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x137e('0x4'));var rimraf=require(_0x137e('0x5'));var config=require(_0x137e('0x6'));var attributes=require(_0x137e('0x7'));module['exports']=function(_0x672b8c,_0x5443b8){return _0x672b8c[_0x137e('0x8')](_0x137e('0x9'),attributes,{'tableName':_0x137e('0xa'),'paranoid':![],'indexes':[{'name':_0x137e('0xb'),'fields':[_0x137e('0xb')]},{'name':'fti_whatsapp_messages','fields':[_0x137e('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x543e29,_0x19562a,_0x5db909){var _0xaee03f=_0x672b8c[_0x137e('0xd')];var _0x157802=_0x543e29['get']({'plain':!![]});if(_0x157802[_0x137e('0xe')][_0x137e('0xf')]()==='in'||_0x157802[_0x137e('0xe')][_0x137e('0xf')]()==='out'&&!_0x157802[_0x137e('0x10')]&&!_[_0x137e('0x11')](_0x157802[_0x137e('0x12')])){_0xaee03f[_0x137e('0x13')][_0x137e('0x14')]({'where':{'id':_0x157802[_0x137e('0x15')]}})['then'](function(_0x2aaac4){if(_0x2aaac4){_0x2aaac4[_0x137e('0x16')]({'lastMsgAt':_0x157802['createdAt'],'lastMsgDirection':_0x157802['direction']['toLowerCase']()});}})[_0x137e('0x17')](function(_0x8c3d16){console[_0x137e('0x18')](_0x8c3d16);});}if(_0x157802['direction']===_0x137e('0x19')&&!_0x157802[_0x137e('0x10')]){var _0x28515e;_0xaee03f[_0x137e('0x1a')][_0x137e('0x1b')]({'where':{'id':_0x157802['WhatsappAccountId']},'raw':!![]})['then'](function(_0x1ff61a){_0x28515e=_0x1ff61a;if(_0x28515e&&_0x28515e[_0x137e('0x1c')]){switch(_0x28515e[_0x137e('0x1c')]){case _0x137e('0x1d'):var _0x210553=require(_0x137e('0x1d'));if(_0x28515e[_0x137e('0x1e')]&&_0x28515e[_0x137e('0x1f')]&&_0x28515e['phone']){var _0x5c649d=new _0x210553(_0x28515e[_0x137e('0x1e')],_0x28515e[_0x137e('0x1f')]);_0x5c649d['messages'][_0x137e('0x20')]({'body':_0x157802['body'],'to':_0x137e('0x21')+_0x157802['phone'],'from':_0x137e('0x21')+_0x28515e['phone'],'statusCallback':_0x28515e[_0x137e('0x22')]+_0x137e('0x23')+_0x157802['id']+_0x137e('0x24')+_0x28515e[_0x137e('0x25')]})[_0x137e('0x26')](function(_0x1dc1a9){if(_0x1dc1a9[_0x137e('0x27')]){return _0x543e29[_0x137e('0x16')]({'messageId':_0x1dc1a9['sid']});}})[_0x137e('0x17')](function(_0x51356b){logger[_0x137e('0x18')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x137e('0x28'),_0x137e('0x1d'),util[_0x137e('0x29')](_0x51356b,{'showHidden':![],'depth':null}));});}else{logger[_0x137e('0x18')](_0x137e('0x2a'),_0x137e('0x28'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})['finally'](function(){_0x5db909();});}else{_0x5db909();}}},'charset':_0x137e('0x2b'),'collate':_0x137e('0x2c')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 33414af..2bf063c 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 _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 +var _0x0a7d=['WhatsappMessage','create','body','options','raw','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateWhatsappMessage'];(function(_0x1c1c81,_0x3bc78a){var _0xb56c33=function(_0x39cec3){while(--_0x39cec3){_0x1c1c81['push'](_0x1c1c81['shift']());}};_0xb56c33(++_0x3bc78a);}(_0x0a7d,0x15a));var _0xd0a7=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x0a7d[_0xa8883];return _0x479426;};'use strict';var _=require('lodash');var util=require(_0xd0a7('0x0'));var moment=require('moment');var BPromise=require(_0xd0a7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd0a7('0x2'));var db=require(_0xd0a7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd0a7('0x4'))(_0xd0a7('0x5'));var config=require(_0xd0a7('0x6'));var jayson=require(_0xd0a7('0x7'));var client=jayson['client'][_0xd0a7('0x8')]({'port':0x232a});config[_0xd0a7('0x9')]=_[_0xd0a7('0xa')](config[_0xd0a7('0x9')],{'host':_0xd0a7('0xb'),'port':0x18eb});var socket=require(_0xd0a7('0xc'))(new Redis(config[_0xd0a7('0x9')]));require(_0xd0a7('0xd'))[_0xd0a7('0xe')](socket);function respondWithRpcPromise(_0x4d287f,_0xa171a,_0x234900){return new BPromise(function(_0x210ca6,_0x29ca95){return client['request'](_0x4d287f,_0x234900)[_0xd0a7('0xf')](function(_0x2b8cc7){logger[_0xd0a7('0x10')](_0xd0a7('0x11'),_0xa171a,_0xd0a7('0x12'));logger['debug'](_0xd0a7('0x13'),_0xa171a,_0xd0a7('0x12'),JSON[_0xd0a7('0x14')](_0x2b8cc7));if(_0x2b8cc7[_0xd0a7('0x15')]){if(_0x2b8cc7[_0xd0a7('0x15')][_0xd0a7('0x16')]===0x1f4){logger['error'](_0xd0a7('0x11'),_0xa171a,_0x2b8cc7[_0xd0a7('0x15')][_0xd0a7('0x17')]);return _0x29ca95(_0x2b8cc7[_0xd0a7('0x15')][_0xd0a7('0x17')]);}logger[_0xd0a7('0x15')](_0xd0a7('0x11'),_0xa171a,_0x2b8cc7[_0xd0a7('0x15')]['message']);return _0x210ca6(_0x2b8cc7['error']['message']);}else{logger['info'](_0xd0a7('0x11'),_0xa171a,_0xd0a7('0x12'));_0x210ca6(_0x2b8cc7[_0xd0a7('0x18')]['message']);}})['catch'](function(_0x2cf828){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0xa171a,_0x2cf828);_0x29ca95(_0x2cf828);});});}exports[_0xd0a7('0x19')]=function(_0x382a9b){var _0x19e380=this;return new Promise(function(_0x5a3d65,_0x34f923){return db[_0xd0a7('0x1a')][_0xd0a7('0x1b')](_0x382a9b[_0xd0a7('0x1c')],{'raw':_0x382a9b[_0xd0a7('0x1d')]?_0x382a9b[_0xd0a7('0x1d')][_0xd0a7('0x1e')]===undefined?!![]:![]:!![]})[_0xd0a7('0xf')](function(_0x2ebce3){logger[_0xd0a7('0x10')]('CreateWhatsappMessage',_0x382a9b);logger['debug'](_0xd0a7('0x19'),_0x382a9b,JSON[_0xd0a7('0x14')](_0x2ebce3));_0x5a3d65(_0x2ebce3);})['catch'](function(_0x49085b){logger['error'](_0xd0a7('0x19'),_0x49085b[_0xd0a7('0x17')],_0x382a9b);_0x34f923(_0x19e380['error'](0x1f4,_0x49085b[_0xd0a7('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index adce221..d9d2c75 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 _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 +var _0x3f0f=['update','emit','removeListener','register','length','whatsappMessage:','save'];(function(_0x462602,_0x2d7a7e){var _0x13e4e7=function(_0x460f5c){while(--_0x460f5c){_0x462602['push'](_0x462602['shift']());}};_0x13e4e7(++_0x2d7a7e);}(_0x3f0f,0x1a3));var _0xf3f0=function(_0x4bd7f5,_0x2543ac){_0x4bd7f5=_0x4bd7f5-0x0;var _0x309d49=_0x3f0f[_0x4bd7f5];return _0x309d49;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xf3f0('0x0'),'remove',_0xf3f0('0x1')];function createListener(_0x341896,_0x4f308f){return function(_0x2f67ea){_0x4f308f[_0xf3f0('0x2')](_0x341896,_0x2f67ea);};}function removeListener(_0x5d8d59,_0x35b62b){return function(){WhatsappMessageEvents[_0xf3f0('0x3')](_0x5d8d59,_0x35b62b);};}exports[_0xf3f0('0x4')]=function(_0x59c696){for(var _0x5d79e9=0x0,_0x1860ac=events[_0xf3f0('0x5')];_0x5d79e9<_0x1860ac;_0x5d79e9++){var _0x10577e=events[_0x5d79e9];var _0x5a45ae=createListener(_0xf3f0('0x6')+_0x10577e,_0x59c696);WhatsappMessageEvents['on'](_0x10577e,_0x5a45ae);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 1902b31..5298ced 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 _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 +var _0x7730=['getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','/describe','describe','get','/:id','/:id/members','/:id/teams'];(function(_0x16cb03,_0x43ea58){var _0x10944e=function(_0x27ebaa){while(--_0x27ebaa){_0x16cb03['push'](_0x16cb03['shift']());}};_0x10944e(++_0x43ea58);}(_0x7730,0x175));var _0x0773=function(_0x54f493,_0x385811){_0x54f493=_0x54f493-0x0;var _0x5f2b47=_0x7730[_0x54f493];return _0x5f2b47;};'use strict';var multer=require(_0x0773('0x0'));var util=require(_0x0773('0x1'));var path=require(_0x0773('0x2'));var timeout=require(_0x0773('0x3'));var express=require(_0x0773('0x4'));var router=express[_0x0773('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0773('0x6'));var config=require(_0x0773('0x7'));var controller=require(_0x0773('0x8'));router['get']('/',auth[_0x0773('0x9')](),controller[_0x0773('0xa')]);router['get'](_0x0773('0xb'),auth[_0x0773('0x9')](),controller[_0x0773('0xc')]);router[_0x0773('0xd')](_0x0773('0xe'),auth[_0x0773('0x9')](),controller['show']);router[_0x0773('0xd')](_0x0773('0xf'),auth[_0x0773('0x9')](),controller['getMembers']);router[_0x0773('0xd')](_0x0773('0x10'),auth[_0x0773('0x9')](),controller[_0x0773('0x11')]);router[_0x0773('0xd')](_0x0773('0x12'),auth[_0x0773('0x9')](),controller[_0x0773('0x13')]);router[_0x0773('0x14')]('/',auth[_0x0773('0x9')](),controller['create']);router[_0x0773('0x14')](_0x0773('0x10'),auth[_0x0773('0x9')](),controller[_0x0773('0x15')]);router['post'](_0x0773('0x12'),auth[_0x0773('0x9')](),controller[_0x0773('0x16')]);router[_0x0773('0x17')](_0x0773('0xe'),auth[_0x0773('0x9')](),controller[_0x0773('0x18')]);router[_0x0773('0x19')]('/:id',auth[_0x0773('0x9')](),controller[_0x0773('0x1a')]);router[_0x0773('0x19')](_0x0773('0x10'),auth[_0x0773('0x9')](),controller[_0x0773('0x1b')]);router['delete'](_0x0773('0x12'),auth[_0x0773('0x9')](),controller[_0x0773('0x1c')]);module[_0x0773('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 89be40f..85fd65e 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 _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 +var _0xde46=['roundrobin','STRING','INTEGER'];(function(_0x156320,_0x3e647b){var _0x33735e=function(_0x199ed6){while(--_0x199ed6){_0x156320['push'](_0x156320['shift']());}};_0x33735e(++_0x3e647b);}(_0xde46,0x6d));var _0x6de4=function(_0x59aea9,_0x3b3af9){_0x59aea9=_0x59aea9-0x0;var _0x75d7e8=_0xde46[_0x59aea9];return _0x75d7e8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6de4('0x0')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x6de4('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall',_0x6de4('0x2'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index a14fe86..7776700 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 _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 +var _0x73a3=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','UserWhatsappQueue','WhatsappQueueId','findAll','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','whatsappPause','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','ids','User','select','field','from','team_has_whatsapp_queues','user_has_teams','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','userWhatsappQueue:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','status','end','json','count','offset','reject','save','then','destroy','get','WhatsappQueues','UserProfileResource','sendStatus','error','stack','name','send','map','WhatsappQueue','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','params','keys','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation'];(function(_0x56f151,_0x281759){var _0x52c1e3=function(_0x12ba6d){while(--_0x12ba6d){_0x56f151['push'](_0x56f151['shift']());}};_0x52c1e3(++_0x281759);}(_0x73a3,0x14e));var _0x373a=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x73a3[_0x3e5086];return _0xfeb102;};'use strict';var pdf=require(_0x373a('0x0'));var emlformat=require(_0x373a('0x1'));var rimraf=require(_0x373a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x373a('0x3'));var rp=require(_0x373a('0x4'));var moment=require(_0x373a('0x5'));var BPromise=require(_0x373a('0x6'));var Mustache=require(_0x373a('0x7'));var util=require(_0x373a('0x8'));var path=require(_0x373a('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x373a('0xa'));var fs=require('fs');var _=require(_0x373a('0xb'));var squel=require(_0x373a('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x373a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x373a('0xe'));var Papa=require(_0x373a('0xf'));var Redis=require(_0x373a('0x10'));var authService=require(_0x373a('0x11'));var qs=require(_0x373a('0x12'));var as=require(_0x373a('0x13'));var hardwareService=require(_0x373a('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x373a('0x15'));var config=require(_0x373a('0x16'));var db=require(_0x373a('0x17'))['db'];config[_0x373a('0x18')]=_['defaults'](config[_0x373a('0x18')],{'host':_0x373a('0x19'),'port':0x18eb});var socket=require(_0x373a('0x1a'))(new Redis(config[_0x373a('0x18')]));require(_0x373a('0x1b'))['register'](socket);function respondWithStatusCode(_0x23cdc5,_0xffee92){_0xffee92=_0xffee92||0xcc;return function(_0x1e7742){if(_0x1e7742){return _0x23cdc5['sendStatus'](_0xffee92);}return _0x23cdc5[_0x373a('0x1c')](_0xffee92)[_0x373a('0x1d')]();};}function respondWithResult(_0x5f28dd,_0x778b60){_0x778b60=_0x778b60||0xc8;return function(_0x5a72d0){if(_0x5a72d0){return _0x5f28dd['status'](_0x778b60)[_0x373a('0x1e')](_0x5a72d0);}};}function respondWithFilteredResult(_0x4509ab,_0xbfc0e8){return function(_0x4cdf2a){if(_0x4cdf2a){var _0x3148ef=_0x4cdf2a[_0x373a('0x1f')],_0x4f793b=_0xbfc0e8['offset'],_0x6f452d=_0xbfc0e8[_0x373a('0x20')]+_0xbfc0e8['limit'],_0x1e7581;if(_0x6f452d>=_0x3148ef){_0x6f452d=_0x3148ef;_0x1e7581=0xc8;}else{_0x1e7581=0xce;}_0x4509ab[_0x373a('0x1c')](_0x1e7581);return _0x4509ab['set']('Content-Range',_0x4f793b+'-'+_0x6f452d+'/'+_0x3148ef)[_0x373a('0x1e')](_0x4cdf2a);}return null;};}function patchUpdates(_0x172004){return function(_0x20e91e){try{jsonpatch['apply'](_0x20e91e,_0x172004,!![]);}catch(_0x1a1933){return BPromise[_0x373a('0x21')](_0x1a1933);}return _0x20e91e[_0x373a('0x22')]();};}function saveUpdates(_0x2e01cf,_0x4e174b){return function(_0x5b09e6){if(_0x5b09e6){return _0x5b09e6['update'](_0x2e01cf)[_0x373a('0x23')](function(_0xfad915){return _0xfad915;});}return null;};}function removeEntity(_0xc8662e,_0x852597){return function(_0x5ea6c2){if(_0x5ea6c2){return _0x5ea6c2[_0x373a('0x24')]()[_0x373a('0x23')](function(){var _0x444853=_0x5ea6c2[_0x373a('0x25')]({'plain':!![]});var _0x36143e=_0x373a('0x26');return db[_0x373a('0x27')][_0x373a('0x24')]({'where':{'type':_0x36143e,'resourceId':_0x444853['id']}})[_0x373a('0x23')](function(){return _0x5ea6c2;});})['then'](function(){_0xc8662e['status'](0xcc)[_0x373a('0x1d')]();});}};}function handleEntityNotFound(_0x978b05,_0x509380){return function(_0x25d38f){if(!_0x25d38f){_0x978b05[_0x373a('0x28')](0x194);}return _0x25d38f;};}function handleError(_0x4b5de4,_0x465310){_0x465310=_0x465310||0x1f4;return function(_0x1e6b23){logger[_0x373a('0x29')](_0x1e6b23[_0x373a('0x2a')]);if(_0x1e6b23[_0x373a('0x2b')]){delete _0x1e6b23[_0x373a('0x2b')];}_0x4b5de4[_0x373a('0x1c')](_0x465310)[_0x373a('0x2c')](_0x1e6b23);};}exports['index']=function(_0x11c014,_0x19f384){var _0x4420ca={},_0x45ca94={},_0x55d095={'count':0x0,'rows':[]};var _0x1507e4=_[_0x373a('0x2d')](db[_0x373a('0x2e')][_0x373a('0x2f')],function(_0x3a07d5){return{'name':_0x3a07d5[_0x373a('0x30')],'type':_0x3a07d5[_0x373a('0x31')][_0x373a('0x32')]};});_0x45ca94['model']=_[_0x373a('0x2d')](_0x1507e4,'name');_0x45ca94[_0x373a('0x33')]=_['keys'](_0x11c014[_0x373a('0x33')]);_0x45ca94[_0x373a('0x34')]=_['intersection'](_0x45ca94[_0x373a('0x35')],_0x45ca94[_0x373a('0x33')]);_0x4420ca[_0x373a('0x36')]=_[_0x373a('0x37')](_0x45ca94[_0x373a('0x35')],qs[_0x373a('0x38')](_0x11c014['query']['fields']));_0x4420ca[_0x373a('0x36')]=_0x4420ca[_0x373a('0x36')][_0x373a('0x39')]?_0x4420ca[_0x373a('0x36')]:_0x45ca94[_0x373a('0x35')];if(!_0x11c014[_0x373a('0x33')][_0x373a('0x3a')](_0x373a('0x3b'))){_0x4420ca[_0x373a('0x3c')]=qs[_0x373a('0x3c')](_0x11c014[_0x373a('0x33')][_0x373a('0x3c')]);_0x4420ca[_0x373a('0x20')]=qs[_0x373a('0x20')](_0x11c014[_0x373a('0x33')][_0x373a('0x20')]);}_0x4420ca[_0x373a('0x3d')]=qs['sort'](_0x11c014[_0x373a('0x33')][_0x373a('0x3e')]);_0x4420ca['where']=qs[_0x373a('0x34')](_[_0x373a('0x3f')](_0x11c014[_0x373a('0x33')],_0x45ca94[_0x373a('0x34')]),_0x1507e4);if(_0x11c014[_0x373a('0x33')][_0x373a('0x40')]){_0x4420ca[_0x373a('0x41')]=_[_0x373a('0x42')](_0x4420ca[_0x373a('0x41')],{'$or':_[_0x373a('0x2d')](_0x1507e4,function(_0x2cd6f5){if(_0x2cd6f5[_0x373a('0x31')]!==_0x373a('0x43')){var _0x51611e={};_0x51611e[_0x2cd6f5[_0x373a('0x2b')]]={'$like':'%'+_0x11c014[_0x373a('0x33')][_0x373a('0x40')]+'%'};return _0x51611e;}})});}_0x4420ca=_['merge']({},_0x4420ca,_0x11c014[_0x373a('0x44')]);var _0x53ddfd={'where':_0x4420ca[_0x373a('0x41')]};return db[_0x373a('0x2e')][_0x373a('0x1f')](_0x53ddfd)[_0x373a('0x23')](function(_0x22aacd){_0x55d095[_0x373a('0x1f')]=_0x22aacd;if(_0x11c014[_0x373a('0x33')][_0x373a('0x45')]){_0x4420ca[_0x373a('0x46')]=[{'all':!![]}];}return db[_0x373a('0x2e')]['findAll'](_0x4420ca);})[_0x373a('0x23')](function(_0x4a5783){_0x55d095[_0x373a('0x47')]=_0x4a5783;return _0x55d095;})[_0x373a('0x23')](respondWithFilteredResult(_0x19f384,_0x4420ca))[_0x373a('0x48')](handleError(_0x19f384,null));};exports['show']=function(_0x4e5205,_0x4fd8b6){var _0x5e7085={'raw':!![],'where':{'id':_0x4e5205[_0x373a('0x49')]['id']}},_0x3deddb={};_0x3deddb[_0x373a('0x35')]=_[_0x373a('0x4a')](db['WhatsappQueue'][_0x373a('0x2f')]);_0x3deddb[_0x373a('0x33')]=_[_0x373a('0x4a')](_0x4e5205[_0x373a('0x33')]);_0x3deddb[_0x373a('0x34')]=_[_0x373a('0x37')](_0x3deddb['model'],_0x3deddb[_0x373a('0x33')]);_0x5e7085['attributes']=_['intersection'](_0x3deddb[_0x373a('0x35')],qs[_0x373a('0x38')](_0x4e5205['query'][_0x373a('0x38')]));_0x5e7085[_0x373a('0x36')]=_0x5e7085[_0x373a('0x36')]['length']?_0x5e7085[_0x373a('0x36')]:_0x3deddb[_0x373a('0x35')];if(_0x4e5205['query']['includeAll']){_0x5e7085['include']=[{'all':!![]}];}_0x5e7085=_['merge']({},_0x5e7085,_0x4e5205['options']);return db[_0x373a('0x2e')][_0x373a('0x4b')](_0x5e7085)[_0x373a('0x23')](handleEntityNotFound(_0x4fd8b6,null))['then'](respondWithResult(_0x4fd8b6,null))[_0x373a('0x48')](handleError(_0x4fd8b6,null));};exports[_0x373a('0x4c')]=function(_0x266f7c,_0x216b16){return db[_0x373a('0x2e')]['create'](_0x266f7c[_0x373a('0x4d')],{})['then'](function(_0x1a0914){var _0x4ff005=_0x266f7c[_0x373a('0x4e')][_0x373a('0x25')]({'plain':!![]});if(!_0x4ff005)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ff005[_0x373a('0x4f')]===_0x373a('0x4e')){var _0x5ce321=_0x1a0914[_0x373a('0x25')]({'plain':!![]});var _0xa5a4fe=_0x373a('0x26');return db[_0x373a('0x50')]['find']({'where':{'name':_0xa5a4fe,'userProfileId':_0x4ff005[_0x373a('0x51')]},'raw':!![]})[_0x373a('0x23')](function(_0x380ad5){if(_0x380ad5&&_0x380ad5[_0x373a('0x52')]===0x0){return db[_0x373a('0x27')][_0x373a('0x4c')]({'name':_0x5ce321[_0x373a('0x2b')],'resourceId':_0x5ce321['id'],'type':_0x380ad5['name'],'sectionId':_0x380ad5['id']},{})[_0x373a('0x23')](function(){return _0x1a0914;});}else{return _0x1a0914;}})[_0x373a('0x48')](function(_0x2482ef){logger[_0x373a('0x29')](_0x373a('0x53'),_0x2482ef);throw _0x2482ef;});}return _0x1a0914;})[_0x373a('0x23')](respondWithResult(_0x216b16,0xc9))[_0x373a('0x48')](handleError(_0x216b16,null));};exports[_0x373a('0x54')]=function(_0x3e3d56,_0x275bc0){if(_0x3e3d56[_0x373a('0x4d')]['id']){delete _0x3e3d56[_0x373a('0x4d')]['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x3e3d56['params']['id']}})[_0x373a('0x23')](handleEntityNotFound(_0x275bc0,null))[_0x373a('0x23')](saveUpdates(_0x3e3d56[_0x373a('0x4d')],null))[_0x373a('0x23')](respondWithResult(_0x275bc0,null))[_0x373a('0x48')](handleError(_0x275bc0,null));};exports[_0x373a('0x24')]=function(_0xa99023,_0x42accb){return db['WhatsappQueue'][_0x373a('0x4b')]({'where':{'id':_0xa99023['params']['id']}})[_0x373a('0x23')](handleEntityNotFound(_0x42accb,null))['then'](removeEntity(_0x42accb,null))[_0x373a('0x48')](handleError(_0x42accb,null));};exports['describe']=function(_0x1727e2,_0xd39371){return db['WhatsappQueue']['describe']()['then'](respondWithResult(_0xd39371,null))[_0x373a('0x48')](handleError(_0xd39371,null));};exports['getMembers']=function(_0x353304,_0x1370e6,_0x167713){var _0xdd2678={'raw':!![],'where':{}},_0x200538={},_0x28e683;return db['WhatsappQueue'][_0x373a('0x55')]({'where':{'id':_0x353304[_0x373a('0x49')]['id']}})['then'](handleEntityNotFound(_0x1370e6,null))[_0x373a('0x23')](function(_0x115e7a){if(_0x115e7a){_0x28e683=_0x115e7a[_0x373a('0x25')]({'plain':!![]});_0x200538[_0x373a('0x35')]=_[_0x373a('0x4a')](db[_0x373a('0x56')]['rawAttributes']);_0x200538[_0x373a('0x33')]=_[_0x373a('0x4a')](_0x353304['query']);_0x200538[_0x373a('0x34')]=_[_0x373a('0x37')](_0x200538[_0x373a('0x35')],_0x200538[_0x373a('0x33')]);_0xdd2678[_0x373a('0x36')]=_[_0x373a('0x37')](_0x200538[_0x373a('0x35')],qs[_0x373a('0x38')](_0x353304[_0x373a('0x33')][_0x373a('0x38')]));_0xdd2678['attributes']=_0xdd2678['attributes'][_0x373a('0x39')]?_0xdd2678[_0x373a('0x36')]:_0x200538[_0x373a('0x35')];if(!_0x353304[_0x373a('0x33')][_0x373a('0x3a')](_0x373a('0x3b'))){_0xdd2678['limit']=qs['limit'](_0x353304[_0x373a('0x33')]['limit']);_0xdd2678[_0x373a('0x20')]=qs[_0x373a('0x20')](_0x353304[_0x373a('0x33')][_0x373a('0x20')]);}_0xdd2678[_0x373a('0x3d')]=qs[_0x373a('0x3e')](_0x353304['query'][_0x373a('0x3e')]);_0xdd2678[_0x373a('0x41')]=qs[_0x373a('0x34')](_[_0x373a('0x3f')](_0x353304[_0x373a('0x33')],_0x200538['filters']));_0xdd2678[_0x373a('0x41')][_0x373a('0x57')]=_0x115e7a['id'];if(_0x353304[_0x373a('0x33')][_0x373a('0x40')]){_0xdd2678[_0x373a('0x41')]=_[_0x373a('0x42')](_0xdd2678[_0x373a('0x41')],{'$or':_[_0x373a('0x2d')](_0xdd2678[_0x373a('0x36')],function(_0x524b5d){var _0x9e73bb={};_0x9e73bb[_0x524b5d]={'$like':'%'+_0x353304[_0x373a('0x33')]['filter']+'%'};return _0x9e73bb;})});}_0xdd2678=_[_0x373a('0x42')]({},_0xdd2678,_0x353304[_0x373a('0x44')]);return db[_0x373a('0x56')][_0x373a('0x58')](_0xdd2678);}})[_0x373a('0x23')](function(_0x3cd889){if(_0x3cd889){return db['User'][_0x373a('0x59')]({'where':{'id':_['map'](_0x3cd889,_0x373a('0x5a')),'role':_0x373a('0x5b')},'attributes':['id',_0x373a('0x2b'),'whatsappPause',_0x373a('0x5c'),_0x373a('0x5d')]});}})[_0x373a('0x23')](function(_0x32293a){if(_0x32293a){return{'count':_0x32293a['count'],'rows':_[_0x373a('0x2d')](_0x32293a['rows'],function(_0xcd4ac4){return{'membername':_0xcd4ac4[_0x373a('0x2b')],'UserId':_0xcd4ac4['id'],'queue_name':_0x28e683[_0x373a('0x2b')],'WhatsappQueueId':_0x28e683['id'],'interface':util[_0x373a('0x5e')](_0x373a('0x5f'),_0x373a('0x60'),_0xcd4ac4[_0x373a('0x2b')]),'penalty':0x0,'paused':_0xcd4ac4[_0x373a('0x61')],'createdAt':_0xcd4ac4[_0x373a('0x5d')],'updatedAt':_0xcd4ac4[_0x373a('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x373a('0x23')](respondWithFilteredResult(_0x1370e6,_0xdd2678))[_0x373a('0x48')](handleError(_0x1370e6,null));};exports[_0x373a('0x62')]=function(_0x50ef34,_0x4999d6,_0x2336a0){var _0x2b5f35={};var _0x1d94a0={};var _0x3f25e8;var _0x2d1c28;return db[_0x373a('0x2e')][_0x373a('0x55')]({'where':{'id':_0x50ef34[_0x373a('0x49')]['id']}})['then'](handleEntityNotFound(_0x4999d6,null))['then'](function(_0xa98327){if(_0xa98327){_0x3f25e8=_0xa98327;_0x1d94a0['model']=_[_0x373a('0x4a')](db[_0x373a('0x63')][_0x373a('0x2f')]);_0x1d94a0[_0x373a('0x33')]=_['keys'](_0x50ef34[_0x373a('0x33')]);_0x1d94a0[_0x373a('0x34')]=_['intersection'](_0x1d94a0[_0x373a('0x35')],_0x1d94a0[_0x373a('0x33')]);_0x2b5f35[_0x373a('0x36')]=_[_0x373a('0x37')](_0x1d94a0[_0x373a('0x35')],qs[_0x373a('0x38')](_0x50ef34[_0x373a('0x33')][_0x373a('0x38')]));_0x2b5f35[_0x373a('0x36')]=_0x2b5f35[_0x373a('0x36')][_0x373a('0x39')]?_0x2b5f35[_0x373a('0x36')]:_0x1d94a0[_0x373a('0x35')];_0x2b5f35[_0x373a('0x3d')]=qs['sort'](_0x50ef34[_0x373a('0x33')][_0x373a('0x3e')]);_0x2b5f35[_0x373a('0x41')]=qs['filters'](_[_0x373a('0x3f')](_0x50ef34[_0x373a('0x33')],_0x1d94a0[_0x373a('0x34')]));if(_0x50ef34[_0x373a('0x33')][_0x373a('0x40')]){_0x2b5f35[_0x373a('0x41')]=_[_0x373a('0x42')](_0x2b5f35['where'],{'$or':_[_0x373a('0x2d')](_0x2b5f35['attributes'],function(_0x18765b){var _0x5960b5={};_0x5960b5[_0x18765b]={'$like':'%'+_0x50ef34['query']['filter']+'%'};return _0x5960b5;})});}_0x2b5f35=_[_0x373a('0x42')]({},_0x2b5f35,_0x50ef34['options']);return _0x3f25e8[_0x373a('0x62')](_0x2b5f35);}})[_0x373a('0x23')](function(_0x2cfa99){if(_0x2cfa99){_0x2d1c28=_0x2cfa99[_0x373a('0x39')];if(!_0x50ef34[_0x373a('0x33')]['hasOwnProperty']('nolimit')){_0x2b5f35['limit']=qs[_0x373a('0x3c')](_0x50ef34['query']['limit']);_0x2b5f35['offset']=qs[_0x373a('0x20')](_0x50ef34['query'][_0x373a('0x20')]);}return _0x3f25e8[_0x373a('0x62')](_0x2b5f35);}})[_0x373a('0x23')](function(_0x239be9){if(_0x239be9){return _0x239be9?{'count':_0x2d1c28,'rows':_0x239be9}:null;}})[_0x373a('0x23')](respondWithResult(_0x4999d6,null))[_0x373a('0x48')](handleError(_0x4999d6,null));};exports[_0x373a('0x64')]=function(_0x1ab889,_0x38b6c1,_0x3282db){var _0x2a944f=_0x1ab889['body']['ids'];return db[_0x373a('0x63')][_0x373a('0x58')]({'where':{'id':_0x2a944f},'attributes':['id'],'include':[{'model':db['User'],'as':_0x373a('0x65'),'attributes':['id',_0x373a('0x2b'),_0x373a('0x66'),_0x373a('0x67'),_0x373a('0x68')],'raw':!![]}]})[_0x373a('0x23')](function(_0xf8ad3f){if(_0xf8ad3f){var _0x973a1=_[_0x373a('0x69')](_0xf8ad3f,function(_0xbfe3e){var _0x4ccd53=_0xbfe3e[_0x373a('0x25')]({'plain':!![]});return _0x4ccd53[_0x373a('0x65')];});return db[_0x373a('0x2e')][_0x373a('0x4b')]({'where':{'id':_0x1ab889[_0x373a('0x49')]['id']}})[_0x373a('0x23')](function(_0x4fbde8){return db[_0x373a('0x6a')][_0x373a('0x6b')](function(_0x3f05a8){return _0x4fbde8['addTeams'](_0x2a944f,{'transaction':_0x3f05a8})[_0x373a('0x23')](function(){return BPromise[_0x373a('0x6c')](_0x973a1,function(_0x92e6c4){return db['UserWhatsappQueue'][_0x373a('0x6d')]({'where':{'UserId':_0x92e6c4['id'],'WhatsappQueueId':_0x1ab889['params']['id']},'transaction':_0x3f05a8});});})['then'](function(){_0x973a1[_0x373a('0x6e')](function(_0x2f7f06){socket[_0x373a('0x6f')](_0x373a('0x70'),{'UserId':_0x2f7f06['id'],'WhatsappQueueId':_0x4fbde8['id']});});});});});}})[_0x373a('0x23')](respondWithStatusCode(_0x38b6c1,null))[_0x373a('0x48')](handleError(_0x38b6c1,null));};exports[_0x373a('0x71')]=function(_0x116ae4,_0x304876,_0x4074f1){return db[_0x373a('0x63')][_0x373a('0x58')]({'where':{'id':_0x116ae4[_0x373a('0x33')][_0x373a('0x72')]},'attributes':['id'],'include':[{'model':db[_0x373a('0x73')],'as':_0x373a('0x65'),'attributes':['id'],'raw':!![]}]})[_0x373a('0x23')](handleEntityNotFound(_0x304876,null))['then'](function(_0x3a286e){var _0x20a26d=_['map'](_0x3a286e,'id');var _0x5822a6=[];var _0x8b6fa3=[];var _0x4b6261=squel[_0x373a('0x74')]();_0x4b6261[_0x373a('0x75')]('tq.TeamId')[_0x373a('0x76')](_0x373a('0x77'),'tq')['join'](_0x373a('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('WhatsappQueueId\x20=\x20?',_0x116ae4[_0x373a('0x49')]['id']);for(var _0x4f5401=0x0;_0x4f5401<_0x3a286e['length'];_0x4f5401+=0x1){let _0x4f36da=_0x3a286e[_0x4f5401];for(var _0x161ccf=0x0;_0x161ccf<_0x4f36da[_0x373a('0x65')][_0x373a('0x39')];_0x161ccf+=0x1){let _0x161e52=_0x4f36da[_0x373a('0x65')][_0x161ccf];var _0x57e89e=_0x4b6261['clone']();_0x57e89e[_0x373a('0x41')](_0x373a('0x79'),_0x161e52['id']);_0x8b6fa3[_0x373a('0x7a')](db[_0x373a('0x6a')][_0x373a('0x33')](_0x57e89e['toString'](),{'type':db['sequelize'][_0x373a('0x7b')][_0x373a('0x7c')]})[_0x373a('0x23')](function(_0x223b65){if(_0x223b65[_0x373a('0x39')]===0x1){return _0x161e52['id'];}else{var _0x169fbe=_[_0x373a('0x7d')](_['map'](_0x223b65,'TeamId'),function(_0x1b6002){return _[_0x373a('0x7e')](_0x20a26d,_0x1b6002);});if(_0x169fbe){return _0x161e52['id'];}}}));}}return BPromise[_0x373a('0x7f')](_0x8b6fa3)['then'](function(_0x34c9eb){_0x5822a6=_(_0x5822a6)[_0x373a('0x80')](_0x34c9eb)[_0x373a('0x81')]()[_0x373a('0x82')]();return db[_0x373a('0x2e')][_0x373a('0x4b')]({'where':{'id':_0x116ae4[_0x373a('0x49')]['id']}})[_0x373a('0x23')](function(_0x181ec3){return db[_0x373a('0x6a')][_0x373a('0x6b')](function(_0x33816f){return _0x181ec3['removeTeams'](_0x116ae4[_0x373a('0x33')][_0x373a('0x72')],{'transaction':_0x33816f})[_0x373a('0x23')](function(){if(!_[_0x373a('0x83')](_0x5822a6)){return _0x181ec3[_0x373a('0x84')](_0x5822a6,{'transaction':_0x33816f});}})['then'](function(){_0x5822a6[_0x373a('0x6e')](function(_0x27226d){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x27226d,'WhatsappQueueId':_0x181ec3['id']});});});});});});})[_0x373a('0x23')](respondWithStatusCode(_0x304876,null))[_0x373a('0x48')](handleError(_0x304876,null));};exports[_0x373a('0x85')]=function(_0x105152,_0xa9ff0f,_0x4d746b){return db[_0x373a('0x2e')][_0x373a('0x4b')]({'where':{'id':_0x105152['params']['id']}})[_0x373a('0x23')](handleEntityNotFound(_0xa9ff0f,null))[_0x373a('0x23')](function(_0xfc5494){if(_0xfc5494){return _0xfc5494[_0x373a('0x85')](_0x105152[_0x373a('0x4d')]['ids'],_[_0x373a('0x86')](_0x105152[_0x373a('0x4d')],[_0x373a('0x72'),'id'])||{})[_0x373a('0x87')](function(_0x129e16){for(var _0x1c58e3=0x0;_0x1c58e3<_0x105152[_0x373a('0x4d')][_0x373a('0x72')][_0x373a('0x39')];_0x1c58e3+=0x1){socket[_0x373a('0x6f')]('userWhatsappQueue:save',{'UserId':_0x105152[_0x373a('0x4d')]['ids'][_0x1c58e3],'WhatsappQueueId':_0x105152['params']['id']});}return _0x129e16;});}})[_0x373a('0x23')](respondWithResult(_0xa9ff0f,null))[_0x373a('0x48')](handleError(_0xa9ff0f,null));};exports['removeAgents']=function(_0x56ab60,_0x41d7aa,_0x9eb9f3){return db['WhatsappQueue'][_0x373a('0x4b')]({'where':{'id':_0x56ab60[_0x373a('0x49')]['id']}})[_0x373a('0x23')](handleEntityNotFound(_0x41d7aa,null))['then'](function(_0x183fe2){if(_0x183fe2){return _0x183fe2[_0x373a('0x84')](_0x56ab60[_0x373a('0x33')][_0x373a('0x72')])[_0x373a('0x23')](function(){if(_[_0x373a('0x88')](_0x56ab60[_0x373a('0x33')][_0x373a('0x72')])){for(var _0x29d603=0x0;_0x29d603<_0x56ab60[_0x373a('0x33')][_0x373a('0x72')]['length'];_0x29d603+=0x1){socket[_0x373a('0x6f')](_0x373a('0x89'),{'UserId':Number(_0x56ab60[_0x373a('0x33')][_0x373a('0x72')][_0x29d603]),'WhatsappQueueId':Number(_0x56ab60[_0x373a('0x49')]['id'])});}}else{socket[_0x373a('0x6f')](_0x373a('0x89'),{'UserId':Number(_0x56ab60[_0x373a('0x33')][_0x373a('0x72')]),'WhatsappQueueId':Number(_0x56ab60[_0x373a('0x49')]['id'])});}});}})[_0x373a('0x23')](respondWithStatusCode(_0x41d7aa,null))[_0x373a('0x48')](handleError(_0x41d7aa,null));};exports[_0x373a('0x8a')]=function(_0x15fdad,_0x4c8e7e,_0x357341){var _0x2dc745={};var _0x234742={};var _0x589c2b;var _0x5efd27;return db[_0x373a('0x2e')]['findOne']({'where':{'id':_0x15fdad[_0x373a('0x49')]['id']}})[_0x373a('0x23')](handleEntityNotFound(_0x4c8e7e,null))[_0x373a('0x23')](function(_0x36c559){if(_0x36c559){_0x589c2b=_0x36c559;_0x234742[_0x373a('0x35')]=_[_0x373a('0x4a')](db[_0x373a('0x73')][_0x373a('0x2f')]);_0x234742[_0x373a('0x33')]=_[_0x373a('0x4a')](_0x15fdad[_0x373a('0x33')]);_0x234742[_0x373a('0x34')]=_['intersection'](_0x234742[_0x373a('0x35')],_0x234742['query']);_0x2dc745[_0x373a('0x36')]=_[_0x373a('0x37')](_0x234742['model'],qs['fields'](_0x15fdad[_0x373a('0x33')][_0x373a('0x38')]));_0x2dc745[_0x373a('0x36')]=_0x2dc745[_0x373a('0x36')]['length']?_0x2dc745[_0x373a('0x36')]:_0x234742[_0x373a('0x35')];_0x2dc745['order']=qs[_0x373a('0x3e')](_0x15fdad[_0x373a('0x33')][_0x373a('0x3e')]);_0x2dc745[_0x373a('0x41')]=qs[_0x373a('0x34')](_['pick'](_0x15fdad[_0x373a('0x33')],_0x234742[_0x373a('0x34')]));if(_0x15fdad[_0x373a('0x33')][_0x373a('0x40')]){_0x2dc745['where']=_[_0x373a('0x42')](_0x2dc745['where'],{'$or':_[_0x373a('0x2d')](_0x2dc745[_0x373a('0x36')],function(_0x11dc5f){var _0x455983={};_0x455983[_0x11dc5f]={'$like':'%'+_0x15fdad[_0x373a('0x33')][_0x373a('0x40')]+'%'};return _0x455983;})});}_0x2dc745=_[_0x373a('0x42')]({},_0x2dc745,_0x15fdad[_0x373a('0x44')]);return _0x589c2b[_0x373a('0x8a')](_0x2dc745);}})[_0x373a('0x23')](function(_0x5ca800){if(_0x5ca800){_0x5efd27=_0x5ca800[_0x373a('0x39')];if(!_0x15fdad[_0x373a('0x33')][_0x373a('0x3a')](_0x373a('0x3b'))){_0x2dc745[_0x373a('0x3c')]=qs[_0x373a('0x3c')](_0x15fdad[_0x373a('0x33')][_0x373a('0x3c')]);_0x2dc745[_0x373a('0x20')]=qs[_0x373a('0x20')](_0x15fdad[_0x373a('0x33')][_0x373a('0x20')]);}return _0x589c2b['getAgents'](_0x2dc745);}})[_0x373a('0x23')](function(_0x5c9482){if(_0x5c9482){return _0x5c9482?{'count':_0x5efd27,'rows':_0x5c9482}:null;}})[_0x373a('0x23')](respondWithResult(_0x4c8e7e,null))[_0x373a('0x48')](handleError(_0x4c8e7e,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 102cef0..3c65ae5 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 _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 +var _0x5d26=['update','remove','emit','hasOwnProperty','exports','WhatsappQueue','setMaxListeners','save'];(function(_0x535357,_0x23513b){var _0x59ce9c=function(_0x17e3a7){while(--_0x17e3a7){_0x535357['push'](_0x535357['shift']());}};_0x59ce9c(++_0x23513b);}(_0x5d26,0x1e5));var _0x65d2=function(_0x9010c5,_0x1a284b){_0x9010c5=_0x9010c5-0x0;var _0x1ed623=_0x5d26[_0x9010c5];return _0x1ed623;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db'][_0x65d2('0x0')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x65d2('0x1')](0x0);var events={'afterCreate':_0x65d2('0x2'),'afterUpdate':_0x65d2('0x3'),'afterDestroy':_0x65d2('0x4')};function emitEvent(_0x360d58){return function(_0x405329,_0x2cfb86,_0x15467c){WhatsappQueueEvents[_0x65d2('0x5')](_0x360d58+':'+_0x405329['id'],_0x405329);WhatsappQueueEvents[_0x65d2('0x5')](_0x360d58,_0x405329);_0x15467c(null);};}for(var e in events){if(events[_0x65d2('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x65d2('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index cb63790..7b99306 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 _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 +var _0xed02=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','WhatsappQueue','whatsapp_queues','lodash'];(function(_0x1f3f2c,_0x2b79f6){var _0x9efc61=function(_0x2ba1e2){while(--_0x2ba1e2){_0x1f3f2c['push'](_0x1f3f2c['shift']());}};_0x9efc61(++_0x2b79f6);}(_0xed02,0x11d));var _0x2ed0=function(_0x4d58a7,_0x3b56c7){_0x4d58a7=_0x4d58a7-0x0;var _0x22dce7=_0xed02[_0x4d58a7];return _0x22dce7;};'use strict';var _=require(_0x2ed0('0x0'));var util=require(_0x2ed0('0x1'));var logger=require(_0x2ed0('0x2'))(_0x2ed0('0x3'));var moment=require(_0x2ed0('0x4'));var BPromise=require(_0x2ed0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ed0('0x6'));var rimraf=require('rimraf');var config=require(_0x2ed0('0x7'));var attributes=require('./whatsappQueue.attributes');module[_0x2ed0('0x8')]=function(_0x27966e,_0x423f41){return _0x27966e['define'](_0x2ed0('0x9'),attributes,{'tableName':_0x2ed0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 3ef2a50..649bc34 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 _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 +var _0x4ecf=['request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','attributes','limit','include','map','model','catch','ShowWhatsappQueue','then','lodash','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','register'];(function(_0x256cbf,_0x1fc046){var _0x20cfef=function(_0x3a78c1){while(--_0x3a78c1){_0x256cbf['push'](_0x256cbf['shift']());}};_0x20cfef(++_0x1fc046);}(_0x4ecf,0xef));var _0xf4ec=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x4ecf[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xf4ec('0x0'));var util=require(_0xf4ec('0x1'));var moment=require('moment');var BPromise=require(_0xf4ec('0x2'));var rs=require(_0xf4ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf4ec('0x4'));var logger=require('../../config/logger')(_0xf4ec('0x5'));var config=require(_0xf4ec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf4ec('0x7')]['http']({'port':0x232a});config['redis']=_[_0xf4ec('0x8')](config[_0xf4ec('0x9')],{'host':_0xf4ec('0xa'),'port':0x18eb});var socket=require(_0xf4ec('0xb'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0xf4ec('0xc')](socket);function respondWithRpcPromise(_0x1d1d0c,_0x6dcd0e,_0x1238c3){return new BPromise(function(_0x22c1cf,_0x103af3){return client[_0xf4ec('0xd')](_0x1d1d0c,_0x1238c3)['then'](function(_0x3736a6){logger[_0xf4ec('0xe')](_0xf4ec('0xf'),_0x6dcd0e,_0xf4ec('0x10'));logger[_0xf4ec('0x11')](_0xf4ec('0x12'),_0x6dcd0e,_0xf4ec('0x10'),JSON[_0xf4ec('0x13')](_0x3736a6));if(_0x3736a6['error']){if(_0x3736a6[_0xf4ec('0x14')][_0xf4ec('0x15')]===0x1f4){logger[_0xf4ec('0x14')](_0xf4ec('0xf'),_0x6dcd0e,_0x3736a6[_0xf4ec('0x14')][_0xf4ec('0x16')]);return _0x103af3(_0x3736a6['error'][_0xf4ec('0x16')]);}logger[_0xf4ec('0x14')](_0xf4ec('0xf'),_0x6dcd0e,_0x3736a6[_0xf4ec('0x14')][_0xf4ec('0x16')]);return _0x22c1cf(_0x3736a6[_0xf4ec('0x14')][_0xf4ec('0x16')]);}else{logger['info'](_0xf4ec('0xf'),_0x6dcd0e,_0xf4ec('0x10'));_0x22c1cf(_0x3736a6['result']['message']);}})['catch'](function(_0x42e0f8){logger['error'](_0xf4ec('0xf'),_0x6dcd0e,_0x42e0f8);_0x103af3(_0x42e0f8);});});}exports[_0xf4ec('0x17')]=function(_0x47e83d){var _0x3527a0=this;return new Promise(function(_0x4339c8,_0x128302){return db[_0xf4ec('0x18')][_0xf4ec('0x19')]({'raw':_0x47e83d[_0xf4ec('0x1a')]?_0x47e83d[_0xf4ec('0x1a')][_0xf4ec('0x1b')]===undefined?!![]:![]:!![],'where':_0x47e83d[_0xf4ec('0x1a')]?_0x47e83d[_0xf4ec('0x1a')]['where']||null:null,'attributes':_0x47e83d['options']?_0x47e83d[_0xf4ec('0x1a')][_0xf4ec('0x1c')]||null:null,'limit':_0x47e83d[_0xf4ec('0x1a')]?_0x47e83d[_0xf4ec('0x1a')][_0xf4ec('0x1d')]||null:null,'include':_0x47e83d[_0xf4ec('0x1a')]?_0x47e83d['options'][_0xf4ec('0x1e')]?_[_0xf4ec('0x1f')](_0x47e83d[_0xf4ec('0x1a')][_0xf4ec('0x1e')],function(_0x5eb418){return{'model':db[_0x5eb418[_0xf4ec('0x20')]],'as':_0x5eb418['as'],'attributes':_0x5eb418[_0xf4ec('0x1c')],'include':_0x5eb418[_0xf4ec('0x1e')]?_['map'](_0x5eb418[_0xf4ec('0x1e')],function(_0xd18034){return{'model':db[_0xd18034[_0xf4ec('0x20')]],'as':_0xd18034['as'],'attributes':_0xd18034[_0xf4ec('0x1c')],'include':_0xd18034[_0xf4ec('0x1e')]?_[_0xf4ec('0x1f')](_0xd18034[_0xf4ec('0x1e')],function(_0xccf216){return{'model':db[_0xccf216[_0xf4ec('0x20')]],'as':_0xccf216['as'],'attributes':_0xccf216[_0xf4ec('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x242094){logger[_0xf4ec('0xe')](_0xf4ec('0x17'),_0x47e83d);logger['debug'](_0xf4ec('0x17'),_0x47e83d,JSON[_0xf4ec('0x13')](_0x242094));_0x4339c8(_0x242094);})[_0xf4ec('0x21')](function(_0x52c49f){logger[_0xf4ec('0x14')](_0xf4ec('0x17'),_0x52c49f['message'],_0x47e83d);_0x128302(_0x3527a0['error'](0x1f4,_0x52c49f[_0xf4ec('0x16')]));});});};exports[_0xf4ec('0x22')]=function(_0x324f46){var _0xc46206=this;return new Promise(function(_0x11a836,_0x58e69e){return db['WhatsappQueue']['find']({'raw':_0x324f46[_0xf4ec('0x1a')]?_0x324f46['options']['raw']===undefined?!![]:![]:!![],'where':_0x324f46[_0xf4ec('0x1a')]?_0x324f46[_0xf4ec('0x1a')]['where']||null:null,'attributes':_0x324f46[_0xf4ec('0x1a')]?_0x324f46[_0xf4ec('0x1a')][_0xf4ec('0x1c')]||null:null,'include':_0x324f46[_0xf4ec('0x1a')]?_0x324f46['options'][_0xf4ec('0x1e')]?_[_0xf4ec('0x1f')](_0x324f46[_0xf4ec('0x1a')][_0xf4ec('0x1e')],function(_0x39145f){return{'model':db[_0x39145f[_0xf4ec('0x20')]],'as':_0x39145f['as'],'attributes':_0x39145f[_0xf4ec('0x1c')],'include':_0x39145f[_0xf4ec('0x1e')]?_[_0xf4ec('0x1f')](_0x39145f[_0xf4ec('0x1e')],function(_0x41c42f){return{'model':db[_0x41c42f['model']],'as':_0x41c42f['as'],'attributes':_0x41c42f[_0xf4ec('0x1c')],'include':_0x41c42f[_0xf4ec('0x1e')]?_[_0xf4ec('0x1f')](_0x41c42f['include'],function(_0x285027){return{'model':db[_0x285027[_0xf4ec('0x20')]],'as':_0x285027['as'],'attributes':_0x285027[_0xf4ec('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf4ec('0x23')](function(_0x25b06b){logger[_0xf4ec('0xe')](_0xf4ec('0x22'),_0x324f46);logger['debug'](_0xf4ec('0x22'),_0x324f46,JSON[_0xf4ec('0x13')](_0x25b06b));_0x11a836(_0x25b06b);})[_0xf4ec('0x21')](function(_0xc66012){logger[_0xf4ec('0x14')](_0xf4ec('0x22'),_0xc66012[_0xf4ec('0x16')],_0x324f46);_0x58e69e(_0xc46206[_0xf4ec('0x14')](0x1f4,_0xc66012[_0xf4ec('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index cccb4f2..6bb0ea7 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 _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 +var _0x4f79=['update','removeListener','./whatsappQueue.events','save'];(function(_0x14fc08,_0x273516){var _0x533854=function(_0xba288c){while(--_0xba288c){_0x14fc08['push'](_0x14fc08['shift']());}};_0x533854(++_0x273516);}(_0x4f79,0x1ce));var _0x94f7=function(_0x8d8a59,_0xb84752){_0x8d8a59=_0x8d8a59-0x0;var _0x4197a2=_0x4f79[_0x8d8a59];return _0x4197a2;};'use strict';var WhatsappQueueEvents=require(_0x94f7('0x0'));var events=[_0x94f7('0x1'),'remove',_0x94f7('0x2')];function createListener(_0x1d1014,_0x325467){return function(_0x388623){_0x325467['emit'](_0x1d1014,_0x388623);};}function removeListener(_0x147057,_0x41f032){return function(){WhatsappQueueEvents[_0x94f7('0x3')](_0x147057,_0x41f032);};}exports['register']=function(_0x2c7f7c){for(var _0xedddc0=0x0,_0x5a0ef5=events['length'];_0xedddc0<_0x5a0ef5;_0xedddc0++){var _0x4f7e62=events[_0xedddc0];var _0x589e54=createListener('whatsappQueue:'+_0x4f7e62,_0x2c7f7c);WhatsappQueueEvents['on'](_0x4f7e62,_0x589e54);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index bb1d489..62d8a59 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 _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 +var _0xaacd=['path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','multer','util'];(function(_0x45cb76,_0x4e511a){var _0x48c47a=function(_0x216591){while(--_0x216591){_0x45cb76['push'](_0x45cb76['shift']());}};_0x48c47a(++_0x4e511a);}(_0xaacd,0x1de));var _0xdaac=function(_0x19648c,_0x1ad579){_0x19648c=_0x19648c-0x0;var _0x376981=_0xaacd[_0x19648c];return _0x376981;};'use strict';var multer=require(_0xdaac('0x0'));var util=require(_0xdaac('0x1'));var path=require(_0xdaac('0x2'));var timeout=require(_0xdaac('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xdaac('0x4'));var interaction=require(_0xdaac('0x5'));var config=require(_0xdaac('0x6'));var controller=require(_0xdaac('0x7'));router[_0xdaac('0x8')]('/',auth['isAuthenticated'](),controller[_0xdaac('0x9')]);router[_0xdaac('0x8')](_0xdaac('0xa'),auth[_0xdaac('0xb')](),controller[_0xdaac('0xc')]);router['get'](_0xdaac('0xd'),auth[_0xdaac('0xb')](),controller[_0xdaac('0xe')]);router[_0xdaac('0xf')]('/',auth[_0xdaac('0xb')](),controller[_0xdaac('0x10')]);router[_0xdaac('0x11')](_0xdaac('0xd'),auth[_0xdaac('0xb')](),controller['update']);router[_0xdaac('0x12')](_0xdaac('0xd'),auth[_0xdaac('0xb')](),controller[_0xdaac('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 1df5af9..7e83722 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['DATE','sequelize','STRING'];(function(_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 +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x14f5b9,_0x193451){var _0x32606c=function(_0x4c0902){while(--_0x4c0902){_0x14f5b9['push'](_0x14f5b9['shift']());}};_0x32606c(++_0x193451);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 03df49e..77309a0 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 _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 +var _0x52a1=['intersection','fields','attributes','length','hasOwnProperty','limit','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','find','catch','create','body','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','set','Content-Range','json','apply','save','update','then','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','type','key','model','query','keys'];(function(_0x318dda,_0x1aa800){var _0x3f97ca=function(_0x1dc61a){while(--_0x1dc61a){_0x318dda['push'](_0x318dda['shift']());}};_0x3f97ca(++_0x1aa800);}(_0x52a1,0x1b7));var _0x152a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x52a1[_0x17d9e3];return _0x14192d;};'use strict';var pdf=require(_0x152a('0x0'));var emlformat=require(_0x152a('0x1'));var rimraf=require(_0x152a('0x2'));var zipdir=require(_0x152a('0x3'));var jsonpatch=require(_0x152a('0x4'));var rp=require(_0x152a('0x5'));var moment=require(_0x152a('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x152a('0x7'));var util=require('util');var path=require(_0x152a('0x8'));var sox=require(_0x152a('0x9'));var csv=require(_0x152a('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x152a('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x152a('0xc'));var Papa=require(_0x152a('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x152a('0xe'));var as=require(_0x152a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x152a('0x10'))(_0x152a('0x11'));var utils=require(_0x152a('0x12'));var config=require(_0x152a('0x13'));var db=require(_0x152a('0x14'))['db'];function respondWithStatusCode(_0x44120c,_0x51494a){_0x51494a=_0x51494a||0xcc;return function(_0x1554b9){if(_0x1554b9){return _0x44120c[_0x152a('0x15')](_0x51494a);}return _0x44120c[_0x152a('0x16')](_0x51494a)['end']();};}function respondWithResult(_0xa65299,_0x2f8817){_0x2f8817=_0x2f8817||0xc8;return function(_0x56bae6){if(_0x56bae6){return _0xa65299[_0x152a('0x16')](_0x2f8817)['json'](_0x56bae6);}};}function respondWithFilteredResult(_0x6e4b4f,_0x404bb8){return function(_0x1c4b71){if(_0x1c4b71){var _0x40e403=_0x1c4b71['count'],_0x1e411c=_0x404bb8[_0x152a('0x17')],_0x1ec269=_0x404bb8[_0x152a('0x17')]+_0x404bb8['limit'],_0xd1d182;if(_0x1ec269>=_0x40e403){_0x1ec269=_0x40e403;_0xd1d182=0xc8;}else{_0xd1d182=0xce;}_0x6e4b4f[_0x152a('0x16')](_0xd1d182);return _0x6e4b4f[_0x152a('0x18')](_0x152a('0x19'),_0x1e411c+'-'+_0x1ec269+'/'+_0x40e403)[_0x152a('0x1a')](_0x1c4b71);}return null;};}function patchUpdates(_0x3da410){return function(_0x12b31c){try{jsonpatch[_0x152a('0x1b')](_0x12b31c,_0x3da410,!![]);}catch(_0x5f131d){return BPromise['reject'](_0x5f131d);}return _0x12b31c[_0x152a('0x1c')]();};}function saveUpdates(_0x5285fe,_0x1d1d58){return function(_0x2b94d4){if(_0x2b94d4){return _0x2b94d4[_0x152a('0x1d')](_0x5285fe)['then'](function(_0x40af47){return _0x40af47;});}return null;};}function removeEntity(_0x3d9178,_0x5bdbf5){return function(_0x3897f9){if(_0x3897f9){return _0x3897f9['destroy']()[_0x152a('0x1e')](function(){_0x3d9178[_0x152a('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b99c2,_0x5e7df4){return function(_0x3c57e3){if(!_0x3c57e3){_0x2b99c2[_0x152a('0x15')](0x194);}return _0x3c57e3;};}function handleError(_0x46cc7e,_0x40ca50){_0x40ca50=_0x40ca50||0x1f4;return function(_0x1f9d6d){logger[_0x152a('0x1f')](_0x1f9d6d[_0x152a('0x20')]);if(_0x1f9d6d[_0x152a('0x21')]){delete _0x1f9d6d[_0x152a('0x21')];}_0x46cc7e[_0x152a('0x16')](_0x40ca50)[_0x152a('0x22')](_0x1f9d6d);};}exports[_0x152a('0x23')]=function(_0x191502,_0x285b05){var _0x330566={},_0x21cc4e={},_0x15c199={'count':0x0,'rows':[]};var _0x72e542=_[_0x152a('0x24')](db[_0x152a('0x25')][_0x152a('0x26')],function(_0x47a162){return{'name':_0x47a162['fieldName'],'type':_0x47a162[_0x152a('0x27')][_0x152a('0x28')]};});_0x21cc4e[_0x152a('0x29')]=_[_0x152a('0x24')](_0x72e542,_0x152a('0x21'));_0x21cc4e[_0x152a('0x2a')]=_[_0x152a('0x2b')](_0x191502[_0x152a('0x2a')]);_0x21cc4e['filters']=_[_0x152a('0x2c')](_0x21cc4e[_0x152a('0x29')],_0x21cc4e[_0x152a('0x2a')]);_0x330566['attributes']=_['intersection'](_0x21cc4e[_0x152a('0x29')],qs[_0x152a('0x2d')](_0x191502[_0x152a('0x2a')][_0x152a('0x2d')]));_0x330566['attributes']=_0x330566[_0x152a('0x2e')][_0x152a('0x2f')]?_0x330566[_0x152a('0x2e')]:_0x21cc4e[_0x152a('0x29')];if(!_0x191502[_0x152a('0x2a')][_0x152a('0x30')]('nolimit')){_0x330566[_0x152a('0x31')]=qs[_0x152a('0x31')](_0x191502[_0x152a('0x2a')]['limit']);_0x330566[_0x152a('0x17')]=qs[_0x152a('0x17')](_0x191502[_0x152a('0x2a')][_0x152a('0x17')]);}_0x330566['order']=qs['sort'](_0x191502[_0x152a('0x2a')][_0x152a('0x32')]);_0x330566[_0x152a('0x33')]=qs[_0x152a('0x34')](_['pick'](_0x191502['query'],_0x21cc4e[_0x152a('0x34')]),_0x72e542);if(_0x191502[_0x152a('0x2a')][_0x152a('0x35')]){_0x330566[_0x152a('0x33')]=_[_0x152a('0x36')](_0x330566[_0x152a('0x33')],{'$or':_[_0x152a('0x24')](_0x72e542,function(_0x40d370){if(_0x40d370[_0x152a('0x27')]!==_0x152a('0x37')){var _0x19d23f={};_0x19d23f[_0x40d370['name']]={'$like':'%'+_0x191502[_0x152a('0x2a')][_0x152a('0x35')]+'%'};return _0x19d23f;}})});}_0x330566=_[_0x152a('0x36')]({},_0x330566,_0x191502[_0x152a('0x38')]);var _0x3a8f83={'where':_0x330566[_0x152a('0x33')]};return db[_0x152a('0x25')]['count'](_0x3a8f83)[_0x152a('0x1e')](function(_0x19425d){_0x15c199[_0x152a('0x39')]=_0x19425d;if(_0x191502['query'][_0x152a('0x3a')]){_0x330566[_0x152a('0x3b')]=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x330566);})[_0x152a('0x1e')](function(_0x3e286f){_0x15c199[_0x152a('0x3c')]=_0x3e286f;return _0x15c199;})[_0x152a('0x1e')](respondWithFilteredResult(_0x285b05,_0x330566))['catch'](handleError(_0x285b05,null));};exports[_0x152a('0x3d')]=function(_0x2ed3b4,_0x570daa){var _0x36d05e={'raw':!![],'where':{'id':_0x2ed3b4['params']['id']}},_0x27c02c={};_0x27c02c[_0x152a('0x29')]=_['keys'](db['WhatsappQueueReport'][_0x152a('0x26')]);_0x27c02c[_0x152a('0x2a')]=_[_0x152a('0x2b')](_0x2ed3b4[_0x152a('0x2a')]);_0x27c02c[_0x152a('0x34')]=_['intersection'](_0x27c02c[_0x152a('0x29')],_0x27c02c[_0x152a('0x2a')]);_0x36d05e[_0x152a('0x2e')]=_[_0x152a('0x2c')](_0x27c02c[_0x152a('0x29')],qs[_0x152a('0x2d')](_0x2ed3b4[_0x152a('0x2a')]['fields']));_0x36d05e[_0x152a('0x2e')]=_0x36d05e[_0x152a('0x2e')][_0x152a('0x2f')]?_0x36d05e[_0x152a('0x2e')]:_0x27c02c[_0x152a('0x29')];if(_0x2ed3b4[_0x152a('0x2a')][_0x152a('0x3a')]){_0x36d05e['include']=[{'all':!![]}];}_0x36d05e=_[_0x152a('0x36')]({},_0x36d05e,_0x2ed3b4[_0x152a('0x38')]);return db[_0x152a('0x25')][_0x152a('0x3e')](_0x36d05e)[_0x152a('0x1e')](handleEntityNotFound(_0x570daa,null))[_0x152a('0x1e')](respondWithResult(_0x570daa,null))[_0x152a('0x3f')](handleError(_0x570daa,null));};exports[_0x152a('0x40')]=function(_0x26e2e1,_0x4e346f){return db[_0x152a('0x25')][_0x152a('0x40')](_0x26e2e1[_0x152a('0x41')],{})['then'](respondWithResult(_0x4e346f,0xc9))[_0x152a('0x3f')](handleError(_0x4e346f,null));};exports[_0x152a('0x1d')]=function(_0x47582a,_0x4dd229){if(_0x47582a[_0x152a('0x41')]['id']){delete _0x47582a[_0x152a('0x41')]['id'];}return db[_0x152a('0x25')]['find']({'where':{'id':_0x47582a[_0x152a('0x42')]['id']}})[_0x152a('0x1e')](handleEntityNotFound(_0x4dd229,null))['then'](saveUpdates(_0x47582a['body'],null))[_0x152a('0x1e')](respondWithResult(_0x4dd229,null))[_0x152a('0x3f')](handleError(_0x4dd229,null));};exports[_0x152a('0x43')]=function(_0x3e382c,_0x1da015){return db[_0x152a('0x25')][_0x152a('0x3e')]({'where':{'id':_0x3e382c[_0x152a('0x42')]['id']}})['then'](handleEntityNotFound(_0x1da015,null))[_0x152a('0x1e')](removeEntity(_0x1da015,null))[_0x152a('0x3f')](handleError(_0x1da015,null));};exports[_0x152a('0x44')]=function(_0xbbd02e,_0x166a7e){return db['WhatsappQueueReport'][_0x152a('0x44')]()[_0x152a('0x1e')](respondWithResult(_0x166a7e,null))[_0x152a('0x3f')](handleError(_0x166a7e,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index d634e98..2044f7d 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 _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 +var _0x2143=['define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','api','moment','./whatsappQueueReport.attributes','exports'];(function(_0x261999,_0x15f7e8){var _0x109e04=function(_0x4c8e93){while(--_0x4c8e93){_0x261999['push'](_0x261999['shift']());}};_0x109e04(++_0x15f7e8);}(_0x2143,0x194));var _0x3214=function(_0x501c0c,_0x2b8282){_0x501c0c=_0x501c0c-0x0;var _0x296087=_0x2143[_0x501c0c];return _0x296087;};'use strict';var _=require(_0x3214('0x0'));var util=require(_0x3214('0x1'));var logger=require('../../config/logger')(_0x3214('0x2'));var moment=require(_0x3214('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3214('0x4'));module[_0x3214('0x5')]=function(_0x5bd6ae,_0x4374fa){return _0x5bd6ae[_0x3214('0x6')](_0x3214('0x7'),attributes,{'tableName':_0x3214('0x8'),'paranoid':![],'indexes':[{'name':_0x3214('0x9'),'fields':[_0x3214('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 75ba062..01fc087 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 _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 +var _0x319a=['limit','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','code','error','message','catch','WhatsappQueueReport','body','options','raw','CreateWhatsappQueueReport','debug','UpdateWhatsappQueueReport','update','where','attributes'];(function(_0x559d28,_0xb3ed0b){var _0x57ddfe=function(_0x2ef2e2){while(--_0x2ef2e2){_0x559d28['push'](_0x559d28['shift']());}};_0x57ddfe(++_0xb3ed0b);}(_0x319a,0x10a));var _0xa319=function(_0x4a4667,_0x272385){_0x4a4667=_0x4a4667-0x0;var _0x3d4313=_0x319a[_0x4a4667];return _0x3d4313;};'use strict';var _=require('lodash');var util=require(_0xa319('0x0'));var moment=require(_0xa319('0x1'));var BPromise=require('bluebird');var rs=require(_0xa319('0x2'));var fs=require('fs');var Redis=require(_0xa319('0x3'));var db=require(_0xa319('0x4'))['db'];var utils=require(_0xa319('0x5'));var logger=require(_0xa319('0x6'))(_0xa319('0x7'));var config=require(_0xa319('0x8'));var jayson=require(_0xa319('0x9'));var client=jayson['client'][_0xa319('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c6ceb,_0x4923c4,_0x5d7099){return new BPromise(function(_0x1190f9,_0x19756b){return client[_0xa319('0xb')](_0x3c6ceb,_0x5d7099)[_0xa319('0xc')](function(_0x4f2bb3){logger[_0xa319('0xd')](_0xa319('0xe'),_0x4923c4,_0xa319('0xf'));logger['debug'](_0xa319('0x10'),_0x4923c4,'request\x20sent',JSON['stringify'](_0x4f2bb3));if(_0x4f2bb3['error']){if(_0x4f2bb3['error'][_0xa319('0x11')]===0x1f4){logger[_0xa319('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4923c4,_0x4f2bb3[_0xa319('0x12')][_0xa319('0x13')]);return _0x19756b(_0x4f2bb3[_0xa319('0x12')][_0xa319('0x13')]);}logger[_0xa319('0x12')](_0xa319('0xe'),_0x4923c4,_0x4f2bb3['error'][_0xa319('0x13')]);return _0x1190f9(_0x4f2bb3[_0xa319('0x12')][_0xa319('0x13')]);}else{logger[_0xa319('0xd')](_0xa319('0xe'),_0x4923c4,_0xa319('0xf'));_0x1190f9(_0x4f2bb3['result']['message']);}})[_0xa319('0x14')](function(_0x5c420b){logger[_0xa319('0x12')](_0xa319('0xe'),_0x4923c4,_0x5c420b);_0x19756b(_0x5c420b);});});}exports['CreateWhatsappQueueReport']=function(_0x1a2e2b){var _0x581886=this;return new Promise(function(_0x15e877,_0x4fb3fc){return db[_0xa319('0x15')]['create'](_0x1a2e2b[_0xa319('0x16')],{'raw':_0x1a2e2b['options']?_0x1a2e2b[_0xa319('0x17')][_0xa319('0x18')]===undefined?!![]:![]:!![]})[_0xa319('0xc')](function(_0x54adf3){logger[_0xa319('0xd')](_0xa319('0x19'),_0x1a2e2b);logger[_0xa319('0x1a')](_0xa319('0x19'),_0x1a2e2b,JSON['stringify'](_0x54adf3));_0x15e877(_0x54adf3);})[_0xa319('0x14')](function(_0x11e2b6){logger[_0xa319('0x12')](_0xa319('0x19'),_0x11e2b6[_0xa319('0x13')],_0x1a2e2b);_0x4fb3fc(_0x581886[_0xa319('0x12')](0x1f4,_0x11e2b6[_0xa319('0x13')]));});});};exports[_0xa319('0x1b')]=function(_0x2a8833){var _0x17e92c=this;return new Promise(function(_0x146ef7,_0x4d3adf){return db['WhatsappQueueReport'][_0xa319('0x1c')](_0x2a8833[_0xa319('0x16')],{'raw':_0x2a8833[_0xa319('0x17')]?_0x2a8833[_0xa319('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a8833[_0xa319('0x17')]?_0x2a8833[_0xa319('0x17')][_0xa319('0x1d')]||null:null,'attributes':_0x2a8833['options']?_0x2a8833[_0xa319('0x17')][_0xa319('0x1e')]||null:null,'limit':_0x2a8833[_0xa319('0x17')]?_0x2a8833['options'][_0xa319('0x1f')]||null:null})['then'](function(_0x2f5a8d){logger[_0xa319('0xd')](_0xa319('0x1b'),_0x2a8833);logger[_0xa319('0x1a')](_0xa319('0x1b'),_0x2a8833,JSON[_0xa319('0x20')](_0x2f5a8d));_0x146ef7(_0x2f5a8d);})[_0xa319('0x14')](function(_0x1d5d37){logger[_0xa319('0x12')](_0xa319('0x1b'),_0x1d5d37['message'],_0x2a8833);_0x4d3adf(_0x17e92c[_0xa319('0x12')](0x1f4,_0x1d5d37['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 2c41894..d5ddbd0 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 _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 +var _0xf5a7=['delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update'];(function(_0x1dd5d7,_0x9d1029){var _0x3fc753=function(_0x3f268f){while(--_0x3f268f){_0x1dd5d7['push'](_0x1dd5d7['shift']());}};_0x3fc753(++_0x9d1029);}(_0xf5a7,0xf5));var _0x7f5a=function(_0x198bcd,_0x39ed8f){_0x198bcd=_0x198bcd-0x0;var _0x123a33=_0xf5a7[_0x198bcd];return _0x123a33;};'use strict';var multer=require(_0x7f5a('0x0'));var util=require(_0x7f5a('0x1'));var path=require(_0x7f5a('0x2'));var timeout=require('connect-timeout');var express=require(_0x7f5a('0x3'));var router=express[_0x7f5a('0x4')]();var auth=require(_0x7f5a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7f5a('0x6'));var controller=require(_0x7f5a('0x7'));router[_0x7f5a('0x8')]('/',auth[_0x7f5a('0x9')](),controller[_0x7f5a('0xa')]);router[_0x7f5a('0x8')](_0x7f5a('0xb'),auth[_0x7f5a('0x9')](),controller[_0x7f5a('0xc')]);router[_0x7f5a('0x8')](_0x7f5a('0xd'),auth['isAuthenticated'](),controller[_0x7f5a('0xe')]);router[_0x7f5a('0xf')]('/',auth[_0x7f5a('0x9')](),controller[_0x7f5a('0x10')]);router[_0x7f5a('0x11')](_0x7f5a('0xd'),auth[_0x7f5a('0x9')](),controller[_0x7f5a('0x12')]);router[_0x7f5a('0x13')](_0x7f5a('0xd'),auth[_0x7f5a('0x9')](),controller[_0x7f5a('0x14')]);module[_0x7f5a('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 1d6fa50..2e56754 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 _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 +var _0xbaf0=['ENUM','account','agent','queue','exports','STRING'];(function(_0xe51757,_0x1337e1){var _0x14401e=function(_0x36f7e4){while(--_0x36f7e4){_0xe51757['push'](_0xe51757['shift']());}};_0x14401e(++_0x1337e1);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'uniqueid':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0baf('0x2')](_0x0baf('0x3'),_0x0baf('0x4'),_0x0baf('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index d132369..ae2287e 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 _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 +var _0x50ee=['WhatsappTransferReport','fieldName','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','rows','show','keys','length','include','create','catch','body','find','params','describe','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','json','apply','reject','save','update','then','destroy','error','name','send','index','map'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x50ee,0xaf));var _0xe50e=function(_0x386b03,_0x5d0000){_0x386b03=_0x386b03-0x0;var _0xd3d524=_0x50ee[_0x386b03];return _0xd3d524;};'use strict';var pdf=require(_0xe50e('0x0'));var emlformat=require(_0xe50e('0x1'));var rimraf=require(_0xe50e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe50e('0x3'));var moment=require(_0xe50e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe50e('0x5'));var util=require(_0xe50e('0x6'));var path=require(_0xe50e('0x7'));var sox=require(_0xe50e('0x8'));var csv=require('to-csv');var ejs=require(_0xe50e('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe50e('0xa'));var crypto=require(_0xe50e('0xb'));var jsforce=require(_0xe50e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe50e('0xd'));var querystring=require(_0xe50e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe50e('0xf'));var as=require(_0xe50e('0x10'));var hardwareService=require(_0xe50e('0x11'));var logger=require(_0xe50e('0x12'))(_0xe50e('0x13'));var utils=require(_0xe50e('0x14'));var config=require(_0xe50e('0x15'));var db=require(_0xe50e('0x16'))['db'];function respondWithStatusCode(_0x3b409f,_0x9e016b){_0x9e016b=_0x9e016b||0xcc;return function(_0x3858b4){if(_0x3858b4){return _0x3b409f[_0xe50e('0x17')](_0x9e016b);}return _0x3b409f[_0xe50e('0x18')](_0x9e016b)[_0xe50e('0x19')]();};}function respondWithResult(_0x4773a6,_0x41dd4d){_0x41dd4d=_0x41dd4d||0xc8;return function(_0x38b65e){if(_0x38b65e){return _0x4773a6[_0xe50e('0x18')](_0x41dd4d)['json'](_0x38b65e);}};}function respondWithFilteredResult(_0x3ae4f9,_0x178b87){return function(_0x18827e){if(_0x18827e){var _0x228898=_0x18827e[_0xe50e('0x1a')],_0x1e0729=_0x178b87[_0xe50e('0x1b')],_0x2ade80=_0x178b87['offset']+_0x178b87['limit'],_0x2b435d;if(_0x2ade80>=_0x228898){_0x2ade80=_0x228898;_0x2b435d=0xc8;}else{_0x2b435d=0xce;}_0x3ae4f9['status'](_0x2b435d);return _0x3ae4f9[_0xe50e('0x1c')]('Content-Range',_0x1e0729+'-'+_0x2ade80+'/'+_0x228898)[_0xe50e('0x1d')](_0x18827e);}return null;};}function patchUpdates(_0x200e6a){return function(_0x2164b8){try{jsonpatch[_0xe50e('0x1e')](_0x2164b8,_0x200e6a,!![]);}catch(_0x4b924e){return BPromise[_0xe50e('0x1f')](_0x4b924e);}return _0x2164b8[_0xe50e('0x20')]();};}function saveUpdates(_0x59eaac,_0x563c6b){return function(_0x19939e){if(_0x19939e){return _0x19939e[_0xe50e('0x21')](_0x59eaac)[_0xe50e('0x22')](function(_0x50ec85){return _0x50ec85;});}return null;};}function removeEntity(_0x419963,_0x44ca22){return function(_0x296d32){if(_0x296d32){return _0x296d32[_0xe50e('0x23')]()['then'](function(){_0x419963['status'](0xcc)[_0xe50e('0x19')]();});}};}function handleEntityNotFound(_0x5370f1,_0x89e459){return function(_0x3d0e22){if(!_0x3d0e22){_0x5370f1[_0xe50e('0x17')](0x194);}return _0x3d0e22;};}function handleError(_0x422546,_0x1fd177){_0x1fd177=_0x1fd177||0x1f4;return function(_0x513528){logger[_0xe50e('0x24')](_0x513528['stack']);if(_0x513528['name']){delete _0x513528[_0xe50e('0x25')];}_0x422546[_0xe50e('0x18')](_0x1fd177)[_0xe50e('0x26')](_0x513528);};}exports[_0xe50e('0x27')]=function(_0x318681,_0x36efed){var _0xb5d198={},_0x24c30c={},_0x164f5e={'count':0x0,'rows':[]};var _0x4fbc20=_[_0xe50e('0x28')](db[_0xe50e('0x29')]['rawAttributes'],function(_0x410135){return{'name':_0x410135[_0xe50e('0x2a')],'type':_0x410135['type'][_0xe50e('0x2b')]};});_0x24c30c['model']=_[_0xe50e('0x28')](_0x4fbc20,_0xe50e('0x25'));_0x24c30c[_0xe50e('0x2c')]=_['keys'](_0x318681[_0xe50e('0x2c')]);_0x24c30c[_0xe50e('0x2d')]=_[_0xe50e('0x2e')](_0x24c30c[_0xe50e('0x2f')],_0x24c30c[_0xe50e('0x2c')]);_0xb5d198['attributes']=_['intersection'](_0x24c30c[_0xe50e('0x2f')],qs['fields'](_0x318681[_0xe50e('0x2c')][_0xe50e('0x30')]));_0xb5d198['attributes']=_0xb5d198[_0xe50e('0x31')]['length']?_0xb5d198[_0xe50e('0x31')]:_0x24c30c[_0xe50e('0x2f')];if(!_0x318681[_0xe50e('0x2c')][_0xe50e('0x32')](_0xe50e('0x33'))){_0xb5d198['limit']=qs['limit'](_0x318681[_0xe50e('0x2c')]['limit']);_0xb5d198[_0xe50e('0x1b')]=qs[_0xe50e('0x1b')](_0x318681[_0xe50e('0x2c')]['offset']);}_0xb5d198[_0xe50e('0x34')]=qs[_0xe50e('0x35')](_0x318681['query'][_0xe50e('0x35')]);_0xb5d198[_0xe50e('0x36')]=qs['filters'](_['pick'](_0x318681['query'],_0x24c30c[_0xe50e('0x2d')]),_0x4fbc20);if(_0x318681['query'][_0xe50e('0x37')]){_0xb5d198['where']=_[_0xe50e('0x38')](_0xb5d198[_0xe50e('0x36')],{'$or':_['map'](_0x4fbc20,function(_0x3b5590){if(_0x3b5590[_0xe50e('0x39')]!==_0xe50e('0x3a')){var _0x131c39={};_0x131c39[_0x3b5590[_0xe50e('0x25')]]={'$like':'%'+_0x318681[_0xe50e('0x2c')][_0xe50e('0x37')]+'%'};return _0x131c39;}})});}_0xb5d198=_[_0xe50e('0x38')]({},_0xb5d198,_0x318681[_0xe50e('0x3b')]);var _0xf7f6b0={'where':_0xb5d198[_0xe50e('0x36')]};return db[_0xe50e('0x29')][_0xe50e('0x1a')](_0xf7f6b0)['then'](function(_0x2420e6){_0x164f5e[_0xe50e('0x1a')]=_0x2420e6;if(_0x318681[_0xe50e('0x2c')][_0xe50e('0x3c')]){_0xb5d198['include']=[{'all':!![]}];}return db[_0xe50e('0x29')]['findAll'](_0xb5d198);})[_0xe50e('0x22')](function(_0x2bd149){_0x164f5e[_0xe50e('0x3d')]=_0x2bd149;return _0x164f5e;})['then'](respondWithFilteredResult(_0x36efed,_0xb5d198))['catch'](handleError(_0x36efed,null));};exports[_0xe50e('0x3e')]=function(_0x363556,_0x19a22d){var _0x2c6017={'raw':!![],'where':{'id':_0x363556['params']['id']}},_0x4fc845={};_0x4fc845[_0xe50e('0x2f')]=_[_0xe50e('0x3f')](db['WhatsappTransferReport']['rawAttributes']);_0x4fc845[_0xe50e('0x2c')]=_[_0xe50e('0x3f')](_0x363556[_0xe50e('0x2c')]);_0x4fc845[_0xe50e('0x2d')]=_[_0xe50e('0x2e')](_0x4fc845[_0xe50e('0x2f')],_0x4fc845[_0xe50e('0x2c')]);_0x2c6017[_0xe50e('0x31')]=_[_0xe50e('0x2e')](_0x4fc845[_0xe50e('0x2f')],qs[_0xe50e('0x30')](_0x363556[_0xe50e('0x2c')]['fields']));_0x2c6017[_0xe50e('0x31')]=_0x2c6017[_0xe50e('0x31')][_0xe50e('0x40')]?_0x2c6017['attributes']:_0x4fc845[_0xe50e('0x2f')];if(_0x363556[_0xe50e('0x2c')]['includeAll']){_0x2c6017[_0xe50e('0x41')]=[{'all':!![]}];}_0x2c6017=_[_0xe50e('0x38')]({},_0x2c6017,_0x363556[_0xe50e('0x3b')]);return db[_0xe50e('0x29')]['find'](_0x2c6017)[_0xe50e('0x22')](handleEntityNotFound(_0x19a22d,null))[_0xe50e('0x22')](respondWithResult(_0x19a22d,null))['catch'](handleError(_0x19a22d,null));};exports['create']=function(_0x5c41d4,_0x3e8abe){return db['WhatsappTransferReport'][_0xe50e('0x42')](_0x5c41d4['body'],{})['then'](respondWithResult(_0x3e8abe,0xc9))[_0xe50e('0x43')](handleError(_0x3e8abe,null));};exports[_0xe50e('0x21')]=function(_0x1693b0,_0x32c990){if(_0x1693b0['body']['id']){delete _0x1693b0[_0xe50e('0x44')]['id'];}return db[_0xe50e('0x29')][_0xe50e('0x45')]({'where':{'id':_0x1693b0[_0xe50e('0x46')]['id']}})[_0xe50e('0x22')](handleEntityNotFound(_0x32c990,null))[_0xe50e('0x22')](saveUpdates(_0x1693b0['body'],null))[_0xe50e('0x22')](respondWithResult(_0x32c990,null))[_0xe50e('0x43')](handleError(_0x32c990,null));};exports[_0xe50e('0x23')]=function(_0xfcb83,_0x305aaf){return db[_0xe50e('0x29')][_0xe50e('0x45')]({'where':{'id':_0xfcb83['params']['id']}})['then'](handleEntityNotFound(_0x305aaf,null))[_0xe50e('0x22')](removeEntity(_0x305aaf,null))['catch'](handleError(_0x305aaf,null));};exports[_0xe50e('0x47')]=function(_0x104056,_0x49e4f9){return db['WhatsappTransferReport'][_0xe50e('0x47')]()[_0xe50e('0x22')](respondWithResult(_0x49e4f9,null))['catch'](handleError(_0x49e4f9,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index c96a5b1..258c865 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 _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 +var _0xbf38=['request-promise','path','rimraf','../../config/environment','WhatsappTransferReport','uniqueid','lodash','api','moment'];(function(_0x1ae8d2,_0x542702){var _0x20f63d=function(_0x1ff174){while(--_0x1ff174){_0x1ae8d2['push'](_0x1ae8d2['shift']());}};_0x20f63d(++_0x542702);}(_0xbf38,0x96));var _0x8bf3=function(_0x174e66,_0x3ef28d){_0x174e66=_0x174e66-0x0;var _0x1d3a43=_0xbf38[_0x174e66];return _0x1d3a43;};'use strict';var _=require(_0x8bf3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8bf3('0x1'));var moment=require(_0x8bf3('0x2'));var BPromise=require('bluebird');var rp=require(_0x8bf3('0x3'));var fs=require('fs');var path=require(_0x8bf3('0x4'));var rimraf=require(_0x8bf3('0x5'));var config=require(_0x8bf3('0x6'));var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x525f96,_0x5c27df){return _0x525f96['define'](_0x8bf3('0x7'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x8bf3('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 7afd1c5..b7d5845 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(_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 +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(_0x1ec669,_0x118209){var _0x1ea564=function(_0xe939d0){while(--_0xe939d0){_0x1ec669['push'](_0x1ec669['shift']());}};_0x1ea564(++_0x118209);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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 f63d8e0..e238796 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x1c52=['Online\x20apps:','map','filter','name','join','Offline\x20apps:','status','online','None','./config/seedDB','default','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/environment','app','./config/pm2','./config/schedule','./config/schedule/chat','sequelize','sync','then','listen','start','info'];(function(_0x81604e,_0xe54af9){var _0x13e7ed=function(_0x256016){while(--_0x256016){_0x81604e['push'](_0x81604e['shift']());}};_0x13e7ed(++_0xe54af9);}(_0x1c52,0xb6));var _0x21c5=function(_0x4df299,_0x155212){_0x4df299=_0x4df299-0x0;var _0x2aa0ba=_0x1c52[_0x4df299];return _0x2aa0ba;};'use strict';var _=require(_0x21c5('0x0'));var mysqldb=require(_0x21c5('0x1'));var rpc=require(_0x21c5('0x2'));var config=require(_0x21c5('0x3'));var logger=require('./config/logger')(_0x21c5('0x4'));var pm2=require(_0x21c5('0x5'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x21c5('0x6'));var chat=require(_0x21c5('0x7'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0x21c5('0x8')][_0x21c5('0x9')]()[_0x21c5('0xa')](function(){return rpc[_0x21c5('0xb')]();})['then'](function(_0x311889){logger['info'](_0x311889);return chat[_0x21c5('0xc')]();})[_0x21c5('0xa')](function(){return schedule[_0x21c5('0xc')]();})[_0x21c5('0xa')](function(){return transcribe[_0x21c5('0xc')]();})['then'](function(_0x2cf9ab){logger[_0x21c5('0xd')](_0x2cf9ab);return pm2[_0x21c5('0xc')](pm2Config);})[_0x21c5('0xa')](function(_0x431da5){logger[_0x21c5('0xd')](_0x21c5('0xe'),_[_0x21c5('0xf')](_[_0x21c5('0x10')](_0x431da5,{'status':'online'}),_0x21c5('0x11'))[_0x21c5('0x12')]());logger['info'](_0x21c5('0x13'),_[_0x21c5('0xf')](_['filter'](_0x431da5,function(_0x579dd5){return _0x579dd5[_0x21c5('0x14')]!==_0x21c5('0x15');}),'name')[_0x21c5('0x12')]()||_0x21c5('0x16'));config['seedDB']&&require(_0x21c5('0x17'))[_0x21c5('0x18')]();require('./config/license')[_0x21c5('0x18')]();})['catch'](function(_0x4ad709){logger[_0x21c5('0x19')](_0x21c5('0x1a'),_0x4ad709);process[_0x21c5('0x1b')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 4fe5ceb..63e178b 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 _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 +var _0x2c60=['apikey','sub','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','status','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','sign','secret','session','payload','options','promisify','verify','randomBytes','toString','hex','floor','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','secrets','role','name','internal','email','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','findOne','closed','disposition','then','json','unmanaged','Unmanaged.','Forbidden.','catch','use','authorization','headers','Basic','User','find','authenticate','pass','Wrong\x20credentials.','startsWith','Bearer','Unknown\x20authorization\x20format','query','getUuid'];(function(_0x50df09,_0x39298e){var _0x3a2872=function(_0x5b4119){while(--_0x5b4119){_0x50df09['push'](_0x50df09['shift']());}};_0x3a2872(++_0x39298e);}(_0x2c60,0x1b0));var _0x02c6=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x2c60[_0x2b7764];return _0x848dcb;};'use strict';var db=require(_0x02c6('0x0'))['db'];var config=require(_0x02c6('0x1'));var hardwareConf=require(_0x02c6('0x2'));var _=require(_0x02c6('0x3'));var jwt=require(_0x02c6('0x4'));var expressJwt=require(_0x02c6('0x5'));var compose=require(_0x02c6('0x6'));var basicAuth=require(_0x02c6('0x7'));var crypto=require(_0x02c6('0x8'));var BPromise=require(_0x02c6('0x9'));var validateJwt=expressJwt({'secret':config[_0x02c6('0xa')]['session']});var userAttributes=['id',_0x02c6('0xb'),'fullname',_0x02c6('0xc'),_0x02c6('0xd'),_0x02c6('0xe'),_0x02c6('0xf'),_0x02c6('0x10'),'md5secret',_0x02c6('0x11'),_0x02c6('0x12'),_0x02c6('0x13'),_0x02c6('0x14'),_0x02c6('0x15'),_0x02c6('0x16'),_0x02c6('0x17'),_0x02c6('0x18'),_0x02c6('0x19'),_0x02c6('0x1a'),_0x02c6('0x1b'),_0x02c6('0x1c'),_0x02c6('0x1d'),_0x02c6('0x1e'),_0x02c6('0x1f'),'phoneBarAutoAnswerDelay',_0x02c6('0x20'),_0x02c6('0x21'),'phoneBarEnableDtmfTone',_0x02c6('0x22'),_0x02c6('0x23'),_0x02c6('0x24'),_0x02c6('0x25'),_0x02c6('0x26'),_0x02c6('0x27'),_0x02c6('0x28'),'userProfileId'];exports[_0x02c6('0x29')]=function(){return this[_0x02c6('0x2a')](!![])['use'](function(_0x36690e,_0xb696a0,_0x22d5cf){if(_0x36690e[_0x02c6('0x2b')]){_0x22d5cf();}else{return db[_0x02c6('0x2c')][_0x02c6('0x2d')]({'where':{'id':_0x36690e['params']['id']},'attributes':['id',_0x02c6('0x2e'),_0x02c6('0x2f')],'raw':!![]})[_0x02c6('0x30')](function(_0x2fbb52){if(_0x2fbb52&&_0x2fbb52[_0x02c6('0x2e')]){return _0xb696a0['status'](_0x2fbb52[_0x02c6('0x2f')]==='unmanaged'?0x195:0x193)[_0x02c6('0x31')]({'message':_0x2fbb52['disposition']===_0x02c6('0x32')?_0x02c6('0x33'):_0x02c6('0x34')});}else{_0x22d5cf();}})[_0x02c6('0x35')](function(_0x41f910){_0x22d5cf(_0x41f910);});}});};exports[_0x02c6('0x2a')]=function isAuthenticated(_0x4776f0){return compose()[_0x02c6('0x36')](function(_0x54844a,_0x2dab2b,_0x589912){if(_0x54844a['headers'][_0x02c6('0x37')]){if(_['startsWith'](_0x54844a[_0x02c6('0x38')][_0x02c6('0x37')],_0x02c6('0x39'))){var _0x3b99ba=basicAuth(_0x54844a);db[_0x02c6('0x3a')][_0x02c6('0x3b')]({'where':{'name':_0x3b99ba[_0x02c6('0xc')]}})['then'](function(_0x1f6e21){if(!_0x1f6e21||!_0x1f6e21[_0x02c6('0x3c')](_0x3b99ba[_0x02c6('0x3d')])){return _0x2dab2b['status'](0x191)['json']({'message':_0x02c6('0x3e')});}_0x54844a['user']={'id':_0x1f6e21['id']};_0x589912();})[_0x02c6('0x35')](function(_0xf3e85d){_0x589912(_0xf3e85d);});}else if(_[_0x02c6('0x3f')](_0x54844a[_0x02c6('0x38')][_0x02c6('0x37')],_0x02c6('0x40'))){validateJwt(_0x54844a,_0x2dab2b,_0x589912);}else{if(_0x4776f0){_0x589912();}else{return _0x2dab2b['status'](0x193)[_0x02c6('0x31')]({'message':_0x02c6('0x41')});}}}else if(_0x54844a[_0x02c6('0x42')]['apikey']){try{var _0x3107f3={'audience':hardwareConf[_0x02c6('0x43')](),'issuer':hardwareConf[_0x02c6('0x43')]()};verifyJwt(_0x54844a['query'][_0x02c6('0x44')],_0x3107f3)['then'](function(_0x227cb5){return db[_0x02c6('0x3a')][_0x02c6('0x3b')]({'where':{'id':_0x227cb5[_0x02c6('0x45')]}})[_0x02c6('0x30')](function(_0x5b0cee){if(!_0x5b0cee||!_['isEqual'](_0x5b0cee['apiKeyNonce'],_0x227cb5[_0x02c6('0x46')])){return _0x2dab2b['status'](0x191)[_0x02c6('0x31')]({'message':_0x02c6('0x47')});}_0x54844a[_0x02c6('0x2b')]={'id':_0x5b0cee['id']};_0x589912();});})[_0x02c6('0x35')](function(){return _0x2dab2b[_0x02c6('0x48')](0x191)[_0x02c6('0x31')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x8e9e2e){_0x589912(_0x8e9e2e);}}else if(_0x4776f0){_0x589912();}else{return _0x2dab2b[_0x02c6('0x48')](0x193)[_0x02c6('0x31')]({'message':_0x02c6('0x41')});}})['use'](function(_0x482a4b,_0x3c2bea,_0x1db991){if(_0x482a4b[_0x02c6('0x2b')]){db[_0x02c6('0x3a')][_0x02c6('0x3b')]({'where':{'id':_0x482a4b[_0x02c6('0x2b')]['id']},'attributes':userAttributes})[_0x02c6('0x30')](function(_0x5ac2d6){if(!_0x5ac2d6){return _0x3c2bea[_0x02c6('0x48')](0x194)[_0x02c6('0x31')]({'message':_0x02c6('0x49')});}_0x482a4b[_0x02c6('0x2b')]=_0x5ac2d6;_0x1db991();})[_0x02c6('0x35')](function(_0x30fd9d){_0x1db991(_0x30fd9d);});}else if(_0x4776f0){_0x1db991();}else{return _0x3c2bea['status'](0x194)[_0x02c6('0x31')]({'message':_0x02c6('0x4a')});}});};exports[_0x02c6('0x4b')]=function canUpdate(){return compose()[_0x02c6('0x36')](function(_0x41562a,_0x3cdd69,_0x1773d2){return require('../../config/license/util')[_0x02c6('0x4c')]()[_0x02c6('0x30')](function(_0x217d3f){if(_0x217d3f['update']){_0x1773d2();}else{return _0x3cdd69[_0x02c6('0x48')](0x193)['json']({'message':_0x02c6('0x4d')});}})[_0x02c6('0x35')](function(_0x1f9db3){_0x1773d2(_0x1f9db3);});});};exports[_0x02c6('0x4e')]=function(_0x5572d8,_0x174ecd,_0x4a746e){_0x5572d8[_0x02c6('0x4e')]=!![];return _0x4a746e();};exports['signToken']=function signToken(_0x1de8e6){return signJwt(_0x1de8e6);};exports[_0x02c6('0x4f')]=function(_0x35cfcd,_0x51f23d){if(!_0x35cfcd['user']){return _0x51f23d['status'](0x194)[_0x02c6('0x31')]({'message':_0x02c6('0x50')});}var _0x5d5c4e={'payload':{'id':_0x35cfcd[_0x02c6('0x2b')]['id'],'role':_0x35cfcd[_0x02c6('0x2b')][_0x02c6('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5d5c4e)['then'](function(_0x132ccd){_0x51f23d['cookie']('motion.token',_0x132ccd);_0x51f23d['redirect']('/dashboards/general');})[_0x02c6('0x35')](function(_0x4bf4c8){return _0x51f23d[_0x02c6('0x48')](0x1f4)['send'](_0x4bf4c8);});};exports[_0x02c6('0x51')]=function(_0x2fcd54){if(_[_0x02c6('0x52')](_0x2fcd54[_0x02c6('0x53')])||_[_0x02c6('0x52')](_0x2fcd54[_0x02c6('0x54')])){return null;}else{return createJwt(_0x2fcd54);}};exports[_0x02c6('0x55')]=function(_0x5304db){_0x5304db[_0x02c6('0x53')]=generateNonce();_0x5304db['apiKeyIat']=generateIssuedAt();return createJwt(_0x5304db);};exports[_0x02c6('0x56')]=function(_0x3c0c52,_0x9f0221){var _0x17ccd8=_0x3c0c52[_0x02c6('0x42')]['apikey'];if(_0x17ccd8){var _0x31e990={'nonce':_0x9f0221[_0x02c6('0x53')],'iat':_0x9f0221[_0x02c6('0x54')],'audience':hardwareConf[_0x02c6('0x43')](),'issuer':hardwareConf[_0x02c6('0x43')]()};return verifyJwt(_0x17ccd8,_0x31e990)[_0x02c6('0x30')](function(){return generateApiKey(_0x9f0221);});}else{throw{'message':_0x02c6('0x57')};}};function signJwt(_0xcfab5e){var _0x30b42c=BPromise['promisify'](jwt[_0x02c6('0x58')],{'context':jwt});var _0x49b112=_0xcfab5e[_0x02c6('0x59')]||config['secrets'][_0x02c6('0x5a')];return new BPromise(function(_0x3a0cc6,_0x3f0f2a){_0x30b42c(_0xcfab5e[_0x02c6('0x5b')],_0x49b112,_0xcfab5e[_0x02c6('0x5c')])[_0x02c6('0x30')](function(_0x1fa555){_0x3a0cc6(_0x1fa555);})['catch'](function(_0x4c7da2){_0x3f0f2a(_0x4c7da2);});});}function verifyJwt(_0x40f728,_0x164f00,_0x2d66c9){var _0x5a370d=BPromise[_0x02c6('0x5d')](jwt[_0x02c6('0x5e')],{'context':jwt});var _0x3dd8a3=_0x2d66c9||config['secrets'][_0x02c6('0x5a')];return new BPromise(function(_0x2a511e,_0x4432ca){_0x5a370d(_0x40f728,_0x3dd8a3,_0x164f00)[_0x02c6('0x30')](function(_0x6d3dd2){_0x2a511e(_0x6d3dd2);})[_0x02c6('0x35')](function(_0x1a6011){_0x4432ca(_0x1a6011);});});}function generateNonce(){return crypto[_0x02c6('0x5f')](0x10)[_0x02c6('0x60')](_0x02c6('0x61'));}function generateIssuedAt(){return Math[_0x02c6('0x62')](Date['now']()/0x3e8)[_0x02c6('0x60')]();}function createJwt(_0x5c5413){var _0x443e3f={'payload':{'iat':_0x5c5413[_0x02c6('0x54')],'nonce':_0x5c5413['apiKeyNonce']},'options':{'algorithm':_0x02c6('0x63'),'subject':_0x5c5413['id'][_0x02c6('0x60')](),'issuer':hardwareConf[_0x02c6('0x43')](),'audience':hardwareConf[_0x02c6('0x43')]()}};return signJwt(_0x443e3f)[_0x02c6('0x30')](function(_0xb22eb7){return{'iat':_0x5c5413[_0x02c6('0x54')],'nonce':_0x5c5413[_0x02c6('0x53')],'token':_0xb22eb7};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 714b9e2..37dd735 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(_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 +var _0xcb91=['unlink','createReadStream','createWriteStream','createDecipher','update','aes192','hasOwnProperty','createCipher','algorithm','data','binary','write','end','final','close'];(function(_0x5d1c7b,_0x1d7a08){var _0x3cd3c3=function(_0x45ceb3){while(--_0x45ceb3){_0x5d1c7b['push'](_0x5d1c7b['shift']());}};_0x3cd3c3(++_0x1d7a08);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xcb91[_0x3511d3];return _0x5d6321;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var defaultOptions={'algorithm':_0x1cb9('0x0')};function combineOptions(_0xe4a5bf){var _0x17d4ec={};for(var _0x22c4b8 in defaultOptions){if(defaultOptions['hasOwnProperty'](_0x22c4b8)){_0x17d4ec[_0x22c4b8]=defaultOptions[_0x22c4b8];}}if(_0xe4a5bf){for(var _0x8c392f in _0xe4a5bf){if(_0xe4a5bf[_0x1cb9('0x1')](_0x8c392f)){_0x17d4ec[_0x8c392f]=_0xe4a5bf[_0x8c392f];}}}return _0x17d4ec;}exports['encryptFile']=function(_0x13d5fd,_0x1b26cd,_0x53ffbd,_0x226b69){return new BPromise(function(_0x3f7deb,_0x4ffe20){_0x226b69=combineOptions(_0x226b69);var _0x38737d=new Buffer(_0x53ffbd);var _0x12567c=fs['createReadStream'](_0x13d5fd);var _0x3ae0f1=fs['createWriteStream'](_0x1b26cd);var _0x567139=crypto[_0x1cb9('0x2')](_0x226b69[_0x1cb9('0x3')],_0x38737d);_0x12567c['on'](_0x1cb9('0x4'),function(_0x1f0eca){var _0x2fc627=new Buffer(_0x567139['update'](_0x1f0eca),_0x1cb9('0x5'));_0x3ae0f1[_0x1cb9('0x6')](_0x2fc627);});_0x12567c['on'](_0x1cb9('0x7'),function(){try{var _0x3fdd83=new Buffer(_0x567139[_0x1cb9('0x8')]('binary'),'binary');_0x3ae0f1['write'](_0x3fdd83);_0x3ae0f1[_0x1cb9('0x7')]();_0x3ae0f1['on'](_0x1cb9('0x9'),function(){return _0x3f7deb(_0x1b26cd);});}catch(_0x384496){fs[_0x1cb9('0xa')](_0x1b26cd);return _0x4ffe20(_0x384496);}});});};exports['decryptFile']=function(_0x397727,_0x6ef389,_0x1b3cd7,_0x8dfa55){return new BPromise(function(_0x3e2d11,_0x5806d8){_0x8dfa55=combineOptions(_0x8dfa55);var _0x5572cb=new Buffer(_0x1b3cd7);var _0xd446a3=fs[_0x1cb9('0xb')](_0x397727);var _0x3904b7=fs[_0x1cb9('0xc')](_0x6ef389);var _0x3e21e0=crypto[_0x1cb9('0xd')](_0x8dfa55[_0x1cb9('0x3')],_0x5572cb);_0xd446a3['on']('data',function(_0x479d43){var _0x1b2fa6=new Buffer(_0x3e21e0[_0x1cb9('0xe')](_0x479d43),_0x1cb9('0x5'));_0x3904b7[_0x1cb9('0x6')](_0x1b2fa6);});_0xd446a3['on'](_0x1cb9('0x7'),function(){try{var _0x4014de=new Buffer(_0x3e21e0[_0x1cb9('0x8')]('binary'),'binary');_0x3904b7[_0x1cb9('0x6')](_0x4014de);_0x3904b7['end']();_0x3904b7['on'](_0x1cb9('0x9'),function(){return _0x3e2d11(_0x6ef389);});}catch(_0x2265ea){fs['unlink'](_0x6ef389);return _0x5806d8(_0x2265ea);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 21e81b1..ac06ed9 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 _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 +var _0x9f62=['find','split','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','push','dirname','basename','.csv','existsSync','join','mkdirSync','each','csv','%s.%s','writeFileSync','zip','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','path','to-csv','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV'];(function(_0x1fc1f9,_0x454fb2){var _0x4987ca=function(_0x5e90dd){while(--_0x5e90dd){_0x1fc1f9['push'](_0x1fc1f9['shift']());}};_0x4987ca(++_0x454fb2);}(_0x9f62,0x154));var _0x29f6=function(_0x185774,_0x14d074){_0x185774=_0x185774-0x0;var _0x3d2575=_0x9f62[_0x185774];return _0x3d2575;};'use strict';var util=require('util');var path=require(_0x29f6('0x0'));var _=require('lodash');var csv=require(_0x29f6('0x1'));var fs=require('fs');var BPromise=require(_0x29f6('0x2'));var zipdir=require(_0x29f6('0x3'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x29f6('0x4'))[_0x29f6('0x5')];var logger=require(_0x29f6('0x6'))(_0x29f6('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x29f6('0x8')][0x3];var PATH=process[_0x29f6('0x8')][0x4];function analyticExtractedReport(_0x9a43fe,_0x2ba602){var _0x416c6c={'status':_0x9a43fe};var _0x5e9945={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2ba602){_0x416c6c['savename']=_0x2ba602;}return db['AnalyticExtractedReport']['update'](_0x416c6c,_0x5e9945);}function main(){var _0xe25841=0x1388;var _0x44db16;logger['info'](util['format'](_0x29f6('0x9'),EXTRACTED_REPORT_ID,_0x29f6('0xa')));return db['Setting'][_0x29f6('0xb')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x29f6('0xc'),'splitSizeCsv']})['then'](function(_0x559585){if(_0x559585){_0x44db16=_0x559585;_0xe25841=_0x44db16['splitSizeCsv']||0x1388;}})[_0x29f6('0xd')](function(){return dbH[_0x29f6('0xe')][_0x29f6('0xf')](util[_0x29f6('0x10')](_0x29f6('0x11'),QUERY),{'type':dbH[_0x29f6('0xe')][_0x29f6('0x12')][_0x29f6('0x13')]});})[_0x29f6('0xd')](function(_0x19331f){if(!_0x19331f[0x0][_0x29f6('0x14')]){return analyticExtractedReport(_0x29f6('0x15'));}var _0x1dde97=[];var _0x3a75d0=0x0;var _0x25e5a2=!![];if(_0x19331f&&_0x19331f[_0x29f6('0x16')]){var _0x3584a1=_0x19331f[0x0]['num']%(_0x3a75d0+_0xe25841);if(_0x44db16['split']){for(;_0x25e5a2;_0x3a75d0+=_0xe25841,_0x3584a1=_0x19331f[0x0][_0x29f6('0x14')]%(_0x3a75d0+_0xe25841)){if(_0x3584a1==0x0||_0x3584a1==_0x19331f[0x0][_0x29f6('0x14')]){_0x25e5a2=![];}_0x1dde97[_0x29f6('0x17')](dbH['sequelize'][_0x29f6('0xf')](util[_0x29f6('0x10')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xe25841,_0x3a75d0),{'type':dbH[_0x29f6('0xe')][_0x29f6('0x12')][_0x29f6('0x13')]}));}}else{_0x1dde97[_0x29f6('0x17')](dbH[_0x29f6('0xe')][_0x29f6('0xf')](QUERY,{'type':dbH['sequelize'][_0x29f6('0x12')]['SELECT']}));}}var _0x4acb15=path[_0x29f6('0x18')](PATH);var _0x1fa159=path[_0x29f6('0x19')](PATH,_0x29f6('0x1a'));var _0x54ddeb=_0x44db16[_0x29f6('0xc')]&&_0x1dde97['length']>0x1;var _0xd4179c=[];if(!fs[_0x29f6('0x1b')](path[_0x29f6('0x1c')](_0x4acb15,_0x1fa159))&&_0x54ddeb){fs[_0x29f6('0x1d')](path['join'](_0x4acb15,_0x1fa159));}return BPromise[_0x29f6('0x1e')](_0x1dde97,function(_0x4d494f){_0xd4179c['push'](_0x4d494f);})[_0x29f6('0xd')](function(){for(var _0x45f792=0x0;_0x45f792<_0xd4179c[_0x29f6('0x16')];_0x45f792+=0x1){var _0x342038;var _0x84ccb7=_0xd4179c[_0x45f792];if(_0x54ddeb){_0x342038=path[_0x29f6('0x1c')](_0x4acb15,_0x1fa159,util[_0x29f6('0x10')]('%s%d.%s',_0x1fa159,_0x45f792,_0x29f6('0x1f')));}else{_0x342038=path[_0x29f6('0x1c')](_0x4acb15,util[_0x29f6('0x10')](_0x29f6('0x20'),_0x1fa159,_0x29f6('0x1f')));}fs[_0x29f6('0x21')](_0x342038,csv(_0x84ccb7));}})[_0x29f6('0xd')](function(){if(_0x54ddeb){zipdir(path[_0x29f6('0x1c')](_0x4acb15,_0x1fa159),{'saveTo':path[_0x29f6('0x1c')](_0x4acb15,util[_0x29f6('0x10')](_0x29f6('0x20'),_0x1fa159,_0x29f6('0x22')))},function(_0x40c830,_0x304c28){});rimraf(path[_0x29f6('0x1c')](_0x4acb15,_0x1fa159),function(){});}})[_0x29f6('0xd')](function(){logger[_0x29f6('0x23')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x29f6('0xa')));return analyticExtractedReport('Completed',_0x54ddeb?util[_0x29f6('0x10')](_0x29f6('0x20'),_0x1fa159,_0x54ddeb?_0x29f6('0x22'):_0x29f6('0x1f')):null);});})['catch'](function(_0x53e11f){logger[_0x29f6('0x23')](util[_0x29f6('0x10')](_0x29f6('0x24'),EXTRACTED_REPORT_ID,_0x29f6('0xa')),util[_0x29f6('0x25')](_0x53e11f,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x29f6('0x26'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index d94e6f3..2b56f8b 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 _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 +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(_0xfcccb8,_0x5c7af5){var _0x218471=function(_0x1e842f){while(--_0x1e842f){_0xfcccb8['push'](_0xfcccb8['shift']());}};_0x218471(++_0x5c7af5);}(_0xb10b,0x12a));var _0xbb10=function(_0x227e24,_0x573dd6){_0x227e24=_0x227e24-0x0;var _0x2ccc99=_0xb10b[_0x227e24];return _0x2ccc99;};'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 209b951..725c9e7 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 _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 +var _0x0c51=['XLSX','Setting','find','split','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','length','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','lodash','json2xls','bluebird','zip-dir','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0x3df83d,_0x37bc93){var _0x5e333f=function(_0x1bffc2){while(--_0x1bffc2){_0x3df83d['push'](_0x3df83d['shift']());}};_0x5e333f(++_0x37bc93);}(_0x0c51,0x7d));var _0x10c5=function(_0xafadf7,_0xe4d086){_0xafadf7=_0xafadf7-0x0;var _0x1e4c7d=_0x0c51[_0xafadf7];return _0x1e4c7d;};'use strict';var util=require(_0x10c5('0x0'));var path=require('path');var _=require(_0x10c5('0x1'));var fs=require('fs');var json2xls=require(_0x10c5('0x2'));var BPromise=require(_0x10c5('0x3'));var zipdir=require(_0x10c5('0x4'));var rimraf=require('rimraf');var db=require(_0x10c5('0x5'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x10c5('0x6'))(_0x10c5('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x10c5('0x8')][0x2]);var QUERY=process[_0x10c5('0x8')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x4305b1,_0x5d7471){var _0x597d29={'status':_0x4305b1};var _0x35d203={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5d7471){_0x597d29[_0x10c5('0x9')]=_0x5d7471;}return db[_0x10c5('0xa')]['update'](_0x597d29,_0x35d203);}function main(){var _0x36b555=0x1388;var _0x5e5d81;logger['info'](util[_0x10c5('0xb')](_0x10c5('0xc'),EXTRACTED_REPORT_ID,_0x10c5('0xd')));return db[_0x10c5('0xe')][_0x10c5('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x10c5('0x10'),'splitSizeXlsx']})[_0x10c5('0x11')](function(_0x522721){if(_0x522721){_0x5e5d81=_0x522721;_0x36b555=_0x5e5d81['splitSizeXlsx']||0x1388;}})[_0x10c5('0x11')](function(){return dbH[_0x10c5('0x12')]['query'](util['format'](_0x10c5('0x13'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x10c5('0x14')]});})[_0x10c5('0x11')](function(_0x5161a3){if(!_0x5161a3[0x0][_0x10c5('0x15')]){return analyticExtractedReport('Empty');}var _0x1c3a6c=[];var _0x523181=0x0;var _0x48eb69=!![];if(_0x5e5d81[_0x10c5('0x10')]){if(_0x5161a3&&_0x5161a3[_0x10c5('0x16')]){var _0x22da1=_0x5161a3[0x0]['num']%(_0x523181+_0x36b555);for(;_0x48eb69;_0x523181+=_0x36b555,_0x22da1=_0x5161a3[0x0]['num']%(_0x523181+_0x36b555)){if(_0x22da1==0x0||_0x22da1==_0x5161a3[0x0][_0x10c5('0x15')]){_0x48eb69=![];}_0x1c3a6c[_0x10c5('0x17')](dbH[_0x10c5('0x12')][_0x10c5('0x18')](util[_0x10c5('0xb')](_0x10c5('0x19'),QUERY,_0x36b555,_0x523181),{'type':dbH[_0x10c5('0x12')][_0x10c5('0x1a')][_0x10c5('0x14')]}));}}}else{_0x1c3a6c[_0x10c5('0x17')](dbH[_0x10c5('0x12')]['query'](QUERY,{'type':dbH[_0x10c5('0x12')][_0x10c5('0x1a')]['SELECT']}));}var _0x3e955c=path[_0x10c5('0x1b')](PATH);var _0x379828=path['basename'](PATH,_0x10c5('0x1c'));var _0x228f92=_0x5e5d81[_0x10c5('0x10')]&&_0x1c3a6c[_0x10c5('0x16')]>0x1;var _0x45f67f=[];if(!fs[_0x10c5('0x1d')](path[_0x10c5('0x1e')](_0x3e955c,_0x379828))&&_0x228f92){fs[_0x10c5('0x1f')](path['join'](_0x3e955c,_0x379828));}return BPromise[_0x10c5('0x20')](_0x1c3a6c,function(_0x475d66){_0x45f67f[_0x10c5('0x17')](_0x475d66);})[_0x10c5('0x11')](function(){for(var _0x32800e=0x0;_0x32800e<_0x45f67f[_0x10c5('0x16')];_0x32800e+=0x1){var _0x5513cf;var _0x808e66=_0x45f67f[_0x32800e];if(_0x228f92){_0x5513cf=path['join'](_0x3e955c,_0x379828,util[_0x10c5('0xb')](_0x10c5('0x21'),_0x379828,_0x32800e,_0x10c5('0x22')));}else{_0x5513cf=path['join'](_0x3e955c,util[_0x10c5('0xb')](_0x10c5('0x23'),_0x379828,_0x10c5('0x22')));}fs[_0x10c5('0x24')](_0x5513cf,json2xls(_0x808e66),_0x10c5('0x25'));}})[_0x10c5('0x11')](function(){if(_0x228f92){zipdir(path['join'](_0x3e955c,_0x379828),{'saveTo':path[_0x10c5('0x1e')](_0x3e955c,util[_0x10c5('0xb')](_0x10c5('0x23'),_0x379828,'zip'))},function(_0x2d3847,_0x386513){});rimraf(path[_0x10c5('0x1e')](_0x3e955c,_0x379828),function(){});}})['then'](function(){logger[_0x10c5('0x26')](util['format'](_0x10c5('0x27'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x10c5('0x28'),_0x228f92?util[_0x10c5('0xb')](_0x10c5('0x23'),_0x379828,_0x228f92?_0x10c5('0x29'):_0x10c5('0x22')):null);});})[_0x10c5('0x2a')](function(_0x2ecc25){logger[_0x10c5('0x26')](util[_0x10c5('0xb')](_0x10c5('0x2b'),EXTRACTED_REPORT_ID,_0x10c5('0xd')),util[_0x10c5('0x2c')](_0x2ecc25,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x10c5('0x2d'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 5b58e05..e4d8956 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 _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 +var _0x2394=['MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime','last','concat','Hangup','transaction','bulkCreate','catch','rewrite','lodash','models','Interval','intervals','VoiceExtension','findAll','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','then','groupBy','queue','playback','extensions','extension','find','push','Set','format','CDR(type)=%s','type','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN}','context','priority','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0'];(function(_0x3eb867,_0x460eea){var _0x1522da=function(_0x15b610){while(--_0x15b610){_0x3eb867['push'](_0x3eb867['shift']());}};_0x1522da(++_0x460eea);}(_0x2394,0x1f4));var _0x4239=function(_0x12f750,_0x44e587){_0x12f750=_0x12f750-0x0;var _0x18014b=_0x2394[_0x12f750];return _0x18014b;};'use strict';var _=require(_0x4239('0x0'));var util=require('util');function rewrite(_0x5af467,_0x257e2a){var _0xdf9b0a=this;return _0x5af467[_0x4239('0x1')][_0x4239('0x2')]['findAll']({'raw':!![]})['then'](function(_0x78dae3){_0xdf9b0a[_0x4239('0x3')]=_0x78dae3;return _0x5af467['models'][_0x4239('0x4')][_0x4239('0x5')]({'where':{'IntervalId':_0x257e2a[_0x4239('0x6')]},'raw':!![]});})['then'](function(_0x26b373){return _0x5af467[_0x4239('0x1')][_0x4239('0x4')][_0x4239('0x5')]({'where':{'exten':{'$in':_[_0x4239('0x7')](_[_0x4239('0x8')](_0x26b373,_0x4239('0x9')))}},'order':[{'raw':_0x4239('0xa')}],'raw':!![]});})[_0x4239('0xb')](function(_0x4d2066){var _0x3103e0=_['filter'](_0x4d2066,{'priority':'1'});var _0x3308aa=_['filter'](_0x4d2066,{'isApp':0x1});var _0x494914=_[_0x4239('0xc')](_0x3308aa,'exten');var _0x81b5ce=[_0x4239('0xd'),_0x4239('0xe')];var _0x4a6c1b=[];var _0x1d3476=[];for(var _0x533433 in _0x494914){if(_0x494914['hasOwnProperty'](_0x533433)){_0xdf9b0a['priority']=0x2;_0xdf9b0a[_0x4239('0xf')]=[];_0xdf9b0a[_0x4239('0x10')]=_[_0x4239('0x11')](_0x3103e0,{'exten':_0x494914[_0x533433][0x0][_0x4239('0x9')]});_0xdf9b0a['extensions'][_0x4239('0x12')]({'type':_0x494914[_0x533433][0x0]['type'],'app':_0x4239('0x13'),'appdata':util[_0x4239('0x14')](_0x4239('0x15'),_0x494914[_0x533433][0x0][_0x4239('0x16')]),'context':_0x494914[_0x533433][0x0]['context'],'exten':_0x494914[_0x533433][0x0][_0x4239('0x9')],'priority':_0xdf9b0a['priority']++,'VoiceExtensionId':_0x494914[_0x533433][0x0][_0x4239('0x17')]});if(_0x494914[_0x533433][0x0][_0x4239('0x16')]===_0x4239('0x18')){if(_0xdf9b0a[_0x4239('0x10')]){_0xdf9b0a['extensions'][_0x4239('0x12')]({'type':_0x494914[_0x533433][0x0]['type'],'app':_0x4239('0x13'),'appdata':_0x4239('0x19')+(_0xdf9b0a[_0x4239('0x10')][_0x4239('0x1a')]?'${EXTEN:'+_0xdf9b0a[_0x4239('0x10')][_0x4239('0x1a')]+'}':_0x4239('0x1b')),'context':_0x494914[_0x533433][0x0][_0x4239('0x1c')],'exten':_0x494914[_0x533433][0x0][_0x4239('0x9')],'priority':_0xdf9b0a[_0x4239('0x1d')]++,'VoiceExtensionId':_0x494914[_0x533433][0x0]['VoiceExtensionId']});}_0xdf9b0a[_0x4239('0xf')][_0x4239('0x12')]({'type':_0x494914[_0x533433][0x0][_0x4239('0x16')],'app':_0x4239('0x13'),'appdata':_0x4239('0x1e')+_0x494914[_0x533433][0x0][_0x4239('0x17')],'context':_0x494914[_0x533433][0x0][_0x4239('0x1c')],'exten':_0x494914[_0x533433][0x0]['exten'],'priority':_0xdf9b0a[_0x4239('0x1d')]++,'VoiceExtensionId':_0x494914[_0x533433][0x0]['VoiceExtensionId']});var _0x1e2e10=_0xdf9b0a[_0x4239('0x1d')]++;_0xdf9b0a[_0x4239('0xf')][_0x4239('0x12')]({'type':_0x494914[_0x533433][0x0][_0x4239('0x16')],'app':_0x4239('0x1f'),'appdata':_0x4239('0x20')+(_0x1e2e10+0x2)+_0x4239('0x21')+(_0x1e2e10+0x1)+')','context':_0x494914[_0x533433][0x0][_0x4239('0x1c')],'exten':_0x494914[_0x533433][0x0][_0x4239('0x9')],'priority':_0x1e2e10,'VoiceExtensionId':_0x494914[_0x533433][0x0][_0x4239('0x17')]});if(_0xdf9b0a[_0x4239('0x10')]){_0xdf9b0a['extensions'][_0x4239('0x12')]({'type':_0x494914[_0x533433][0x0][_0x4239('0x16')],'app':_0x4239('0x13'),'appdata':_0xdf9b0a[_0x4239('0x10')][_0x4239('0x1a')]?_0x4239('0x22')+_0xdf9b0a[_0x4239('0x10')][_0x4239('0x1a')]+'}':_0x4239('0x23'),'context':_0x494914[_0x533433][0x0][_0x4239('0x1c')],'exten':_0x494914[_0x533433][0x0][_0x4239('0x9')],'priority':_0xdf9b0a[_0x4239('0x1d')]++,'VoiceExtensionId':_0x494914[_0x533433][0x0]['VoiceExtensionId']});}_0xdf9b0a[_0x4239('0xf')][_0x4239('0x12')]({'type':_0x494914[_0x533433][0x0][_0x4239('0x16')],'app':'Set','appdata':_0x4239('0x24')+_0x494914[_0x533433][0x0]['VoiceExtensionId'],'context':_0x494914[_0x533433][0x0][_0x4239('0x1c')],'exten':_0x494914[_0x533433][0x0][_0x4239('0x9')],'priority':_0xdf9b0a['priority']++,'VoiceExtensionId':_0x494914[_0x533433][0x0][_0x4239('0x17')]});if(_0xdf9b0a[_0x4239('0x10')]&&_0xdf9b0a['extension'][_0x4239('0x25')](_0x4239('0x26'))&&_0xdf9b0a[_0x4239('0x10')][_0x4239('0x26')]!==_0x4239('0x27')){_0xdf9b0a[_0x4239('0xf')][_0x4239('0x12')]({'type':_0x494914[_0x533433][0x0][_0x4239('0x16')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x494914[_0x533433][0x0][_0x4239('0x1c')],'exten':_0x494914[_0x533433][0x0][_0x4239('0x9')],'priority':_0xdf9b0a[_0x4239('0x1d')]++,'VoiceExtensionId':_0x494914[_0x533433][0x0][_0x4239('0x17')]});_0xdf9b0a[_0x4239('0xf')]['push']({'type':_0x494914[_0x533433][0x0][_0x4239('0x16')],'app':_0x4239('0x13'),'appdata':_0x4239('0x28')+_0xdf9b0a[_0x4239('0x10')]['recordingFormat']||_0x4239('0x29'),'context':_0x494914[_0x533433][0x0][_0x4239('0x1c')],'exten':_0x494914[_0x533433][0x0]['exten'],'priority':_0xdf9b0a[_0x4239('0x1d')]++,'VoiceExtensionId':_0x494914[_0x533433][0x0]['VoiceExtensionId']});}}_0xdf9b0a['extensions'][_0x4239('0x12')]({'type':_0x494914[_0x533433][0x0][_0x4239('0x16')],'app':_0x4239('0x13'),'appdata':_0x4239('0x2a'),'context':_0x494914[_0x533433][0x0][_0x4239('0x1c')],'exten':_0x494914[_0x533433][0x0]['exten'],'priority':_0xdf9b0a['priority']++,'VoiceExtensionId':_0x494914[_0x533433][0x0]['VoiceExtensionId']});_0xdf9b0a[_0x4239('0xf')][_0x4239('0x12')]({'type':_0x494914[_0x533433][0x0]['type'],'app':_0x4239('0x13'),'appdata':_0x4239('0x2b'),'context':_0x494914[_0x533433][0x0][_0x4239('0x1c')],'exten':_0x494914[_0x533433][0x0][_0x4239('0x9')],'priority':_0xdf9b0a[_0x4239('0x1d')]++,'VoiceExtensionId':_0x494914[_0x533433][0x0]['VoiceExtensionId']});_0xdf9b0a['extensions']['push']({'type':_0x494914[_0x533433][0x0][_0x4239('0x16')],'app':'Set','appdata':_0x4239('0x2c'),'context':_0x494914[_0x533433][0x0][_0x4239('0x1c')],'exten':_0x494914[_0x533433][0x0][_0x4239('0x9')],'priority':_0xdf9b0a[_0x4239('0x1d')]++,'VoiceExtensionId':_0x494914[_0x533433][0x0]['VoiceExtensionId']});for(var _0x338095=0x0,_0x24e3bf=0x0;_0x338095<_0x494914[_0x533433][_0x4239('0x2d')];_0x338095+=0x1,_0x24e3bf=0x0){var _0x218f7e=_0x494914[_0x533433][_0x338095];if(_0x218f7e['type']){_0x218f7e[_0x4239('0x16')]=_0x218f7e[_0x4239('0x16')][_0x4239('0x2e')]();}var _0x4f58b0=[];var _0x54d49b=[];delete _0x218f7e['id'];delete _0x218f7e[_0x4239('0x2f')];delete _0x218f7e['updatedAt'];var _0x4bb2b1=_0x218f7e[_0x4239('0x30')]!=='*,*,*,*'?[_0x218f7e[_0x4239('0x30')]]:_0x218f7e['IntervalId']?_[_0x4239('0x8')](_['filter'](_0xdf9b0a[_0x4239('0x3')],{'IntervalId':_0x218f7e[_0x4239('0x6')]}),_0x4239('0x30')):[];if(_0x218f7e[_0x4239('0x25')](_0x4239('0x31'))){if(_0x218f7e['tag']&&_0x218f7e['tag']!=='--'){_0x4f58b0[_0x4239('0x12')]({'type':_0x218f7e[_0x4239('0x16')],'app':'Set','appdata':'CDR(tag)='+_0x218f7e[_0x4239('0x31')],'context':_0x218f7e['context'],'exten':_0x218f7e[_0x4239('0x9')],'priority':_0x4bb2b1['length']+_0xdf9b0a['priority']+_0x24e3bf++,'VoiceExtensionId':_0x218f7e[_0x4239('0x17')]});}}if(_0x218f7e[_0x4239('0x16')]===_0x4239('0x18')&&_0x218f7e[_0x4239('0x25')](_0x4239('0x32'))){if(_0x218f7e[_0x4239('0x32')]){_0x4f58b0['push']({'type':_0x218f7e[_0x4239('0x16')],'app':_0x4239('0x1f'),'appdata':_0x4239('0x33')+_0x218f7e[_0x4239('0x32')]+')','context':_0x218f7e['context'],'exten':_0x218f7e['exten'],'priority':_0x4bb2b1['length']+_0xdf9b0a['priority']+_0x24e3bf++,'VoiceExtensionId':_0x218f7e[_0x4239('0x17')]});}else{_0x4f58b0[_0x4239('0x12')]({'type':_0x218f7e[_0x4239('0x16')],'app':_0x4239('0x1f'),'appdata':_0x4239('0x34'),'context':_0x218f7e[_0x4239('0x1c')],'exten':_0x218f7e[_0x4239('0x9')],'priority':_0x4bb2b1['length']+_0xdf9b0a[_0x4239('0x1d')]+_0x24e3bf++,'VoiceExtensionId':_0x218f7e[_0x4239('0x17')]});}}if(_0x218f7e[_0x4239('0x25')](_0x4239('0x35'))){if(_0x81b5ce['indexOf'](_0x218f7e['app'][_0x4239('0x2e')]())>=0x0&&_0x218f7e[_0x4239('0x36')]!==_0x4239('0x37')){if(_0x218f7e[_0x4239('0x35')]){_0x4f58b0[_0x4239('0x12')]({'type':_0x218f7e['type'],'app':_0x4239('0x1f'),'appdata':_0x4239('0x38'),'context':_0x218f7e[_0x4239('0x1c')],'exten':_0x218f7e[_0x4239('0x9')],'priority':_0x4bb2b1[_0x4239('0x2d')]+_0xdf9b0a[_0x4239('0x1d')]+_0x24e3bf++,'VoiceExtensionId':_0x218f7e['VoiceExtensionId']});_0x4f58b0[_0x4239('0x12')]({'type':_0x218f7e[_0x4239('0x16')],'app':_0x4239('0x13'),'appdata':_0x4239('0x39'),'context':_0x218f7e[_0x4239('0x1c')],'exten':_0x218f7e['exten'],'priority':_0x4bb2b1[_0x4239('0x2d')]+_0xdf9b0a[_0x4239('0x1d')]+_0x24e3bf++,'VoiceExtensionId':_0x218f7e[_0x4239('0x17')]});}else{_0x4f58b0['push']({'type':_0x218f7e[_0x4239('0x16')],'app':_0x4239('0x1f'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x218f7e[_0x4239('0x1c')],'exten':_0x218f7e[_0x4239('0x9')],'priority':_0x4bb2b1[_0x4239('0x2d')]+_0xdf9b0a[_0x4239('0x1d')]+_0x24e3bf++,'VoiceExtensionId':_0x218f7e['VoiceExtensionId']});_0x4f58b0[_0x4239('0x12')]({'type':_0x218f7e[_0x4239('0x16')],'app':_0x4239('0x13'),'appdata':_0x4239('0x3a'),'context':_0x218f7e['context'],'exten':_0x218f7e[_0x4239('0x9')],'priority':_0x4bb2b1['length']+_0xdf9b0a[_0x4239('0x1d')]+_0x24e3bf++,'VoiceExtensionId':_0x218f7e[_0x4239('0x17')]});}}}for(var _0x333daf=0x0;_0x333daf<_0x4bb2b1[_0x4239('0x2d')];_0x333daf+=0x1){var _0x4f52ce=_0xdf9b0a['priority']+_0x4bb2b1[_0x4239('0x2d')];var _0x1a3f53=_0x333daf===_0x4bb2b1[_0x4239('0x2d')]-0x1?_0xdf9b0a[_0x4239('0x1d')]+_0x4f58b0[_0x4239('0x2d')]+_0x54d49b[_0x4239('0x2d')]+0x2:_0xdf9b0a[_0x4239('0x1d')]+_0x333daf+0x1;_0x4f58b0[_0x4239('0x3b')](_0x333daf,0x0,{'type':_0x218f7e[_0x4239('0x16')],'app':_0x4239('0x3c'),'appdata':_0x4bb2b1[_0x333daf]+'?'+_0x218f7e[_0x4239('0x1c')]+',${EXTEN},'+_0x4f52ce+':'+_0x218f7e[_0x4239('0x1c')]+',${EXTEN},'+_0x1a3f53,'exten':_0x218f7e[_0x4239('0x9')],'context':_0x218f7e[_0x4239('0x1c')],'priority':_0xdf9b0a['priority']+_0x333daf,'VoiceExtensionId':_0x494914[_0x533433][0x0][_0x4239('0x17')]});}_0x218f7e['priority']=_0x4f58b0[_0x4239('0x2d')]?_[_0x4239('0x3d')](_0x4f58b0)[_0x4239('0x1d')]+0x1:_0xdf9b0a[_0x4239('0x1d')];_0xdf9b0a[_0x4239('0x1d')]=(_0x54d49b[_0x4239('0x2d')]?_[_0x4239('0x3d')](_0x54d49b)['priority']:_0x218f7e[_0x4239('0x1d')])+0x1;_0xdf9b0a[_0x4239('0xf')]=_[_0x4239('0x3e')](_0xdf9b0a[_0x4239('0xf')],_0x4f58b0,[_0x218f7e],_0x54d49b);}_0xdf9b0a[_0x4239('0xf')][_0x4239('0x12')]({'type':_0x494914[_0x533433][0x0][_0x4239('0x16')],'app':_0x4239('0x3f'),'exten':_0x494914[_0x533433][0x0][_0x4239('0x9')],'context':_0x494914[_0x533433][0x0][_0x4239('0x1c')],'priority':_0xdf9b0a[_0x4239('0x1d')],'VoiceExtensionId':_0x494914[_0x533433][0x0][_0x4239('0x17')]});_0x4a6c1b[_0x4239('0x12')](_0x494914[_0x533433][0x0][_0x4239('0x17')]);_0x1d3476=_['concat'](_0x1d3476,_0xdf9b0a[_0x4239('0xf')]);}}return _0x5af467[_0x4239('0x40')](function(_0x16045d){return _0x5af467[_0x4239('0x1')]['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0x4a6c1b}},'transaction':_0x16045d})['then'](function(_0x499e43){return _0x5af467['models'][_0x4239('0x4')][_0x4239('0x41')](_['sortBy'](_0x1d3476,'priority'),{'transaction':_0x16045d});});});})[_0x4239('0x42')](function(_0x535add){console['error'](_0x535add);});}exports[_0x4239('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 7d8cb9f..9b29da7 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 _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 +var _0xe706=['toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','insert','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','Lists','get','dialCheckDuplicateType','always','push','sequelize','VoiceQueueId','catch','onlyIfOpen','query','all','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','emit','Unable\x20to\x20delete\x20temp\x20file:','info','CSV\x20import\x20process\x20stopped!','split','parse','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','pick','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()'];(function(_0x101daa,_0x2beb4a){var _0xbd4eeb=function(_0xe6296d){while(--_0xe6296d){_0x101daa['push'](_0x101daa['shift']());}};_0xbd4eeb(++_0x2beb4a);}(_0xe706,0xa3));var _0x6e70=function(_0x3a544a,_0x73a217){_0x3a544a=_0x3a544a-0x0;var _0x342f1e=_0xe706[_0x3a544a];return _0x342f1e;};'use strict';var BPromise=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var socket=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));require(_0x6e70('0xd'))[_0x6e70('0xe')](socket);try{if(!process[_0x6e70('0xf')][0x2]||process[_0x6e70('0xf')][0x2]===_0x6e70('0x10')||process[_0x6e70('0xf')][0x2]===_0x6e70('0x11')){throw new Error(_0x6e70('0x12'));}var FILEPATH=process[_0x6e70('0xf')][0x2];if(!process[_0x6e70('0xf')][0x3]||process[_0x6e70('0xf')][0x3]===_0x6e70('0x10')||process['argv'][0x3]==='null'||!process[_0x6e70('0xf')][0x4]||process[_0x6e70('0xf')][0x4]===_0x6e70('0x10')||process[_0x6e70('0xf')][0x4]===_0x6e70('0x11')){throw new Error(_0x6e70('0x13'));}var FIELDS=_[_0x6e70('0x14')](process[_0x6e70('0xf')][0x3]['split'](','),process['argv'][0x4]['split'](','));if(!process[_0x6e70('0xf')][0x5]||process['argv'][0x5]==='undefined'||process[_0x6e70('0xf')][0x5]===_0x6e70('0x11')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x6e70('0xf')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x6e70('0xf')][0x6]!==_0x6e70('0x10')&&process['argv'][0x6]!=='null'?process[_0x6e70('0xf')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x6e70('0xf')][0x7]!==_0x6e70('0x10')&&process['argv'][0x7]!=='null'?process[_0x6e70('0xf')][0x7]:null;if(!process[_0x6e70('0xf')][0x8]||process[_0x6e70('0xf')][0x8]===_0x6e70('0x10')||process[_0x6e70('0xf')][0x8]===_0x6e70('0x11')){throw new Error(_0x6e70('0x15'));}var SOCKET_TIMESTAMP=process[_0x6e70('0xf')][0x8];}catch(_0x29326f){logger[_0x6e70('0x16')](_0x29326f);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(_0x4a0cfe,_0x228350,_0x344b65,_0x27b294){var _0x502b2d={'message':_0x228350};_0x502b2d[_0x4a0cfe]=!![];if(_0x344b65){_0x502b2d[_0x6e70('0x17')]=_0x344b65;}if(_0x27b294){_0x502b2d[_0x6e70('0x18')]=_0x27b294;}return _0x502b2d;}function isEmail(_0x3337a6){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'](_0x3337a6);}function checkRow(_0x10fc91,_0x538b9c,_0x50aec2){return new BPromise(function(_0x4e97c7,_0x41e352){if(_[_0x6e70('0x19')](_0x10fc91)){return _0x41e352(handleCheckRowError('error',_0x6e70('0x1a'),null,_0x50aec2));}if(_0x10fc91[_0x6e70('0x1b')]&&_0x10fc91['errors'][_0x6e70('0x1c')]){var _0x67fb43=_[_0x6e70('0x1d')](_0x10fc91['errors'],'message')[_0x6e70('0x1e')](';');return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x67fb43,null,_0x50aec2));}var _0x83c836={};for(var _0x114344 in FIELDS){if(FIELDS[_0x6e70('0x1f')](_0x114344)&&FIELDS[_0x114344]){_0x83c836[_0x114344]=_0x10fc91['data'][0x0][FIELDS[_0x114344]]||_0x10fc91[_0x6e70('0x20')][0x0]['\ufeff'+FIELDS[_0x114344]];}}if(!_0x83c836[_0x6e70('0x21')]){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x22'),null,_0x50aec2));}if(!_0x83c836[_0x6e70('0x23')]){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x24'),null,_0x50aec2));}if(_0x83c836[_0x6e70('0x25')]){var _0x3a0821=moment(_0x83c836[_0x6e70('0x25')],'YYYY-MM-DD');if(!_0x3a0821[_0x6e70('0x26')]()){return _0x41e352(handleCheckRowError('error',_0x6e70('0x27'),null,_0x50aec2));}}if(_0x83c836['email']){if(!isEmail(_0x83c836[_0x6e70('0x28')])){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x29'),null,_0x50aec2));}}_0x83c836['ListId']=LISTID;_0x83c836[_0x6e70('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x6e70('0x1c')]&&_0x538b9c){var _0x5780a1={};for(var _0x13d673=0x0,_0x154925=DUPLICATES['length'];_0x13d673<_0x154925;_0x13d673+=0x1){_0x5780a1[DUPLICATES[_0x13d673]]=_0x83c836[DUPLICATES[_0x13d673]];}var _0x10d8f6=_[_0x6e70('0x2b')](_0x538b9c,_0x5780a1);if(_0x10d8f6){return _0x41e352(handleCheckRowError(_0x6e70('0x2c'),_0x6e70('0x2d'),_0x10d8f6,_0x50aec2));}}return db[_0x6e70('0x2e')][_0x6e70('0x2f')](_0x83c836,{'raw':!![],'hooks':![],'fields':_[_0x6e70('0x30')](_0x83c836)})[_0x6e70('0x31')](function(_0xf146fd){if(DUPLICATES&&DUPLICATES[_0x6e70('0x1c')]&&_0x538b9c){_0x538b9c['push'](_[_0x6e70('0x32')](_0x83c836,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xf146fd['id'];return _0x4e97c7();})['catch'](function(_0x23cd1a){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x33')+(_0x23cd1a[_0x6e70('0x34')]||JSON[_0x6e70('0x35')](_0x23cd1a)),null,_0x50aec2));});});}function checkHopper(){function _0x989b80(){return function(_0x2440be){logger[_0x6e70('0x16')](_0x6e70('0x36'),_0x6e70('0x37'),util[_0x6e70('0x38')](_0x2440be,{'showHidden':![],'depth':null}));};}var _0x23d5e2=function(_0x5594d3,_0x501b53){var _0x5446a2=squel['insert']()[_0x6e70('0x39')](_0x6e70('0x3a'))[_0x6e70('0x3b')]([_0x6e70('0x23'),_0x6e70('0x3c'),_0x6e70('0x3d'),'ListId',_0x501b53,_0x6e70('0x3e'),_0x6e70('0x3f')],squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'),_0x6e70('0x23'))[_0x6e70('0x41')](_0x6e70('0x42'),'scheduledAt')[_0x6e70('0x41')]('id',_0x6e70('0x3d'))[_0x6e70('0x41')](LISTID[_0x6e70('0x43')](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x5594d3['id'][_0x6e70('0x43')](),_0x501b53)['field']('NOW()','createdAt')[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')](_0x6e70('0x46'))['where'](_0x6e70('0x47'))[_0x6e70('0x48')](_0x6e70('0x49'),LISTID['toString']())['where']('phone\x20IS\x20NOT\x20NULL')[_0x6e70('0x48')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'))[_0x6e70('0x45')]('cm_hopper')[_0x6e70('0x48')](_0x501b53+'\x20=\x20?',_0x5594d3['id'][_0x6e70('0x43')]())))[_0x6e70('0x43')]();return _0x5446a2;};var _0x2dafb5=function(_0x3478e2,_0x5bbc3a){var _0x291de6=squel[_0x6e70('0x4a')]()[_0x6e70('0x39')](_0x6e70('0x3a'))[_0x6e70('0x3b')]([_0x6e70('0x23'),_0x6e70('0x3c'),'ContactId',_0x6e70('0x44'),_0x5bbc3a,_0x6e70('0x3e'),_0x6e70('0x3f')],squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'),_0x6e70('0x23'))['field'](_0x6e70('0x42'),'scheduledAt')[_0x6e70('0x41')]('id',_0x6e70('0x3d'))['field'](LISTID['toString'](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x3478e2['id'][_0x6e70('0x43')](),_0x5bbc3a)['field']('NOW()',_0x6e70('0x3e'))[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')](_0x6e70('0x46'))['where'](_0x6e70('0x47'))[_0x6e70('0x48')](_0x6e70('0x49'),LISTID[_0x6e70('0x43')]())[_0x6e70('0x48')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x6e70('0x48')](_0x6e70('0x4b'))[_0x6e70('0x48')](_0x6e70('0x4c'),squel[_0x6e70('0x40')]()['field'](_0x6e70('0x4d'))[_0x6e70('0x45')](_0x6e70('0x4e'))[_0x6e70('0x48')](_0x5bbc3a+_0x6e70('0x4f'),_0x3478e2['id']['toString']()))[_0x6e70('0x48')](_0x6e70('0x4c'),squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'))[_0x6e70('0x45')]('cm_hopper')[_0x6e70('0x48')](_0x5bbc3a+_0x6e70('0x4f'),_0x3478e2['id']['toString']())))[_0x6e70('0x43')]();return _0x291de6;};function _0xebe5f7(_0x54efdf,_0x3cfaa9){var _0xb3f06c=squel[_0x6e70('0x4a')]()[_0x6e70('0x39')](_0x6e70('0x3a'))['fromQuery']([_0x6e70('0x23'),_0x6e70('0x3c'),_0x6e70('0x3d'),_0x6e70('0x44'),_0x3cfaa9,_0x6e70('0x3e'),_0x6e70('0x3f')],squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'),_0x6e70('0x23'))[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3c'))[_0x6e70('0x41')]('id',_0x6e70('0x3d'))[_0x6e70('0x41')](LISTID[_0x6e70('0x43')](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x54efdf['id'][_0x6e70('0x43')](),_0x3cfaa9)['field'](_0x6e70('0x42'),_0x6e70('0x3e'))[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')]('cm_contacts')[_0x6e70('0x48')](_0x6e70('0x47'))['where'](_0x6e70('0x49'),LISTID[_0x6e70('0x43')]())[_0x6e70('0x48')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x6e70('0x48')](_0x6e70('0x4b')))[_0x6e70('0x43')]();return _0xb3f06c;}function _0x41a861(_0x10d299,_0x739946){var _0x30cd88=squel['insert']()['into'](_0x6e70('0x50'))[_0x6e70('0x3b')]([_0x6e70('0x23'),_0x6e70('0x3d'),'ListId',_0x739946,'createdAt',_0x6e70('0x3f')],squel[_0x6e70('0x40')]()['field']('phone',_0x6e70('0x23'))['field']('id',_0x6e70('0x3d'))[_0x6e70('0x41')](LISTID[_0x6e70('0x43')](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x10d299['id'][_0x6e70('0x43')](),_0x739946)[_0x6e70('0x41')](_0x6e70('0x42'),'createdAt')[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')](_0x6e70('0x46'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x6e70('0x49'),LISTID[_0x6e70('0x43')]())[_0x6e70('0x48')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x6e70('0x48')](_0x6e70('0x4b')))[_0x6e70('0x43')]();return _0x30cd88;}return db[_0x6e70('0x51')][_0x6e70('0x52')]({'where':{'type':_0x6e70('0x53')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x6e70('0x54')],'as':_0x6e70('0x55'),'where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x82a9a){var _0x515c0c=[];if(_0x82a9a){var _0xce964b;for(var _0x531097=0x0,_0x5b4046;_0x531097<_0x82a9a[_0x6e70('0x1c')];_0x531097+=0x1){_0x5b4046=_0x82a9a[_0x531097][_0x6e70('0x56')]({'plain':!![]});switch(_0x5b4046[_0x6e70('0x57')]){case _0x6e70('0x58'):_0x515c0c[_0x6e70('0x59')](db[_0x6e70('0x5a')]['query'](_0x2dafb5(_0x5b4046,_0x6e70('0x5b')))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));break;case _0x6e70('0x5d'):_0x515c0c[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0x23d5e2(_0x5b4046,_0x6e70('0x5b')))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));break;default:_0x515c0c['push'](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0xebe5f7(_0x5b4046,_0x6e70('0x5b')))['then'](function(){})['catch'](_0x989b80()));}}}return _0x515c0c;})[_0x6e70('0x5f')]()[_0x6e70('0x31')](function(){return db[_0x6e70('0x51')][_0x6e70('0x52')]({'where':{'type':_0x6e70('0x53')},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x241a21){var _0x56d4d9=[];if(_0x241a21){var _0x58666a;for(var _0x1c7c5f=0x0,_0xf7a034;_0x1c7c5f<_0x241a21[_0x6e70('0x1c')];_0x1c7c5f+=0x1){_0xf7a034=_0x241a21[_0x1c7c5f][_0x6e70('0x56')]({'plain':!![]});_0x56d4d9[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0x41a861(_0xf7a034,_0x6e70('0x5b')))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));}}return _0x56d4d9;})[_0x6e70('0x5f')]();})[_0x6e70('0x31')](function(){return db[_0x6e70('0x60')]['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x6e70('0x54')],'as':'Lists','where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x4b2d40){var _0x5b5471=[];if(_0x4b2d40){for(var _0x402f6f=0x0,_0x48e04b;_0x402f6f<_0x4b2d40['length'];_0x402f6f+=0x1){_0x48e04b=_0x4b2d40[_0x402f6f][_0x6e70('0x56')]({'plain':!![]});switch(_0x48e04b[_0x6e70('0x57')]){case _0x6e70('0x58'):_0x5b5471['push'](db['sequelize']['query'](_0x2dafb5(_0x48e04b,_0x6e70('0x61')))['then'](function(){})[_0x6e70('0x5c')](_0x989b80()));break;case _0x6e70('0x5d'):_0x5b5471[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0x23d5e2(_0x48e04b,_0x6e70('0x61')))[_0x6e70('0x31')](function(){})['catch'](_0x989b80()));break;default:_0x5b5471[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0xebe5f7(_0x48e04b,'CampaignId'))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));}}}return _0x5b5471;})[_0x6e70('0x5f')]();})[_0x6e70('0x31')](function(){return db[_0x6e70('0x60')][_0x6e70('0x52')]({'attributes':['id'],'include':[{'model':db[_0x6e70('0x54')],'as':_0x6e70('0x62'),'where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x48f6fd){var _0x463eed=[];if(_0x48f6fd){for(var _0x39e6db=0x0,_0x53acc8;_0x39e6db<_0x48f6fd[_0x6e70('0x1c')];_0x39e6db+=0x1){_0x53acc8=_0x48f6fd[_0x39e6db][_0x6e70('0x56')]({'plain':!![]});_0x463eed['push'](db['sequelize'][_0x6e70('0x5e')](_0x41a861(_0x53acc8,'CampaignId'))[_0x6e70('0x31')](function(){})['catch'](_0x989b80()));}}return _0x463eed;})[_0x6e70('0x5f')]();})[_0x6e70('0x5c')](function(_0x106f32){logger[_0x6e70('0x16')](_0x6e70('0x63'),_0x6e70('0x64'),_0x106f32[_0x6e70('0x34')]);});}var processPromises=function(_0x5afbf5){return BPromise['all'](promises)[_0x6e70('0x31')](function(_0x4bf451){})[_0x6e70('0x5c')](function(_0xa2a4d5){logger[_0x6e70('0x16')](_0x6e70('0x65'),JSON['stringify'](_0xa2a4d5));})[_0x6e70('0x66')](function(){socket['emit'](_0x6e70('0x67')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5afbf5){return _0x5afbf5[_0x6e70('0x68')]();}});};var endCsv=function(){return BPromise[_0x6e70('0x69')]()[_0x6e70('0x31')](function(){if(hopperContacts){return checkHopper();}})[_0x6e70('0x31')](function(){socket[_0x6e70('0x6a')](_0x6e70('0x67')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x1d6acf){logger['error'](_0x6e70('0x6b'),JSON['stringify'](_0x1d6acf));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger[_0x6e70('0x6c')](_0x6e70('0x6d'));endCsv();});function main(){return BPromise[_0x6e70('0x69')]()[_0x6e70('0x31')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x6e70('0x6e')](',');return db['CmContact'][_0x6e70('0x52')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x6e70('0x31')](function(_0x48c30c){var _0x3c2d33=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x6e70('0x6f')](_0x3c2d33,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5d0585,_0x4a87e2){total+=0x1;var _0x25f60c=total;promises[_0x6e70('0x59')](checkRow(_0x5d0585,_0x48c30c,_0x25f60c)[_0x6e70('0x31')](function(){success+=0x1;})[_0x6e70('0x5c')](function(_0x3e6661){if(_0x3e6661[_0x6e70('0x16')]){errors+=0x1;delete _0x3e6661[_0x6e70('0x16')];}else if(_0x3e6661['duplicate']){duplicates+=0x1;delete _0x3e6661[_0x6e70('0x2c')];}rows['push'](_0x3e6661);}));if(total%0xc8===0x0){_0x4a87e2[_0x6e70('0x70')]();return processPromises(_0x4a87e2);}},'complete':function(){return processPromises()[_0x6e70('0x31')](function(){logger[_0x6e70('0x6c')](_0x6e70('0x71'));endCsv();});},'error':function(_0x4764d5,_0x41b7de){logger[_0x6e70('0x6c')]('CSV\x20parse\x20error',JSON[_0x6e70('0x35')](_0x4764d5));endCsv();}});})['catch'](function(_0x27bdf2){logger[_0x6e70('0x16')](_0x6e70('0x72'),JSON[_0x6e70('0x35')](_0x27bdf2));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index bbd4419..1f5121d 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 _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 +var _0x85e1=['spread','catch','info','main','binding','root','.csv','header','writeFileSync','parse','createReadStream','data','length','hasOwnProperty','replace','scheduledat','isValid','isNaN','UserId','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','SystemRow','appendFileSync','rows','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','campaigns_has_cm_blacklists','CampaignId','each','then','finish','affectedRows','emit','unlink','exit','complete','argv','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.id','cm_contacts.createdAt','cm_contacts.UserId','insert','cm_hopper','ListId','updatedAt','priority','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','cm_contacts.updatedAt','into','cm_hopper_black','fromQuery','createdAt','fields','.CmListId','cm_contacts.phone\x20NOT\x20IN\x20(?)','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','field','min_id','group','error','message','errors','push','code','sequelize','query'];(function(_0x34c063,_0x11d3d7){var _0x2c63a3=function(_0x5983d0){while(--_0x5983d0){_0x34c063['push'](_0x34c063['shift']());}};_0x2c63a3(++_0x11d3d7);}(_0x85e1,0x1cb));var _0x185e=function(_0x28f72e,_0x8600a6){_0x28f72e=_0x28f72e-0x0;var _0x17c161=_0x85e1[_0x28f72e];return _0x17c161;};'use strict';var fs=require('fs');var path=require(_0x185e('0x0'));var _=require(_0x185e('0x1'));var Papa=require(_0x185e('0x2'));var util=require(_0x185e('0x3'));var BPromise=require(_0x185e('0x4'));var moment=require(_0x185e('0x5'));var squel=require(_0x185e('0x6'));var Redis=require(_0x185e('0x7'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0x185e('0x8'))('import');config[_0x185e('0x9')]=_[_0x185e('0xa')](config[_0x185e('0x9')],{'host':_0x185e('0xb'),'port':0x18eb});var socket=require(_0x185e('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x185e('0xd')](_0x185e('0xe'));function isEmail(_0x431401){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'](_0x431401);}function selectNotIn(_0x1db3c8,_0x2ca1d8,_0x40447f,_0x2ed08b,_0x21eea3){return squel[_0x185e('0xf')]()['field'](_0x185e('0x10'))[_0x185e('0x11')](_0x2ed08b)[_0x185e('0x12')](_0x2ca1d8,null,_0x2ca1d8+_0x185e('0x13')+_0x2ed08b+'.'+_0x40447f)[_0x185e('0x14')](_0x2ed08b+'.'+_0x40447f+_0x185e('0x15')+_0x1db3c8+'.'+_0x40447f)[_0x185e('0x14')](_0x2ca1d8+_0x185e('0x16')+_0x21eea3[_0x185e('0x12')]()+')');}function insertCmHopper(_0x4bc16c,_0x30cb1a,_0x1a9f0f,_0x588639,_0x5f69cd){var _0x3dca20=[_0x185e('0x17'),'cm_contacts.scheduledat',_0x185e('0x18'),'cm_contacts.ListId',_0x30cb1a+'.'+_0x588639,_0x185e('0x19'),'cm_contacts.updatedAt','cm_contacts.priority',_0x185e('0x1a'),'\x22'+_0x5f69cd+'\x22'];return squel[_0x185e('0x1b')]()['into'](_0x185e('0x1c'))['fromQuery'](['phone','scheduledat','ContactId',_0x185e('0x1d'),_0x588639,'createdAt',_0x185e('0x1e'),_0x185e('0x1f'),'UserId','recallme'],squel[_0x185e('0xf')]()['fields'](_0x3dca20)['from'](_0x30cb1a)[_0x185e('0x12')](_0x185e('0x20'),null,_0x185e('0x21')+_0x30cb1a+'.CmListId')[_0x185e('0x12')](_0x1a9f0f,null,_0x1a9f0f+'.id\x20=\x20'+_0x30cb1a+'.'+_0x588639)[_0x185e('0x14')](_0x30cb1a+_0x185e('0x22'),_0x4bc16c)[_0x185e('0x14')](_0x185e('0x23'),NOW)[_0x185e('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x30cb1a,_0x1a9f0f,_0x588639,_0x185e('0x1c'),[_0x185e('0x24'),_0x185e('0x25')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x30cb1a,_0x1a9f0f,_0x588639,_0x185e('0x1c'),[_0x185e('0x24')])))[_0x185e('0x26')]();}function insertCmHopperBlack(_0xd22b12,_0x471fbc,_0x3ee932,_0x42dd5b){var _0x3d2586=[_0x185e('0x17'),'cm_contacts.id',_0x185e('0x27'),_0x471fbc+'.'+_0x42dd5b,_0x185e('0x19'),_0x185e('0x28')];return squel[_0x185e('0x1b')]()[_0x185e('0x29')](_0x185e('0x2a'))[_0x185e('0x2b')](['phone','ContactId',_0x185e('0x1d'),_0x42dd5b,_0x185e('0x2c'),_0x185e('0x1e')],squel[_0x185e('0xf')]()[_0x185e('0x2d')](_0x3d2586)['from'](_0x471fbc)[_0x185e('0x12')](_0x185e('0x20'),null,_0x185e('0x21')+_0x471fbc+_0x185e('0x2e'))[_0x185e('0x12')](_0x3ee932,null,_0x3ee932+_0x185e('0x13')+_0x471fbc+'.'+_0x42dd5b)[_0x185e('0x14')](_0x471fbc+_0x185e('0x22'),_0xd22b12)[_0x185e('0x14')](_0x185e('0x23'),NOW)[_0x185e('0x14')](_0x185e('0x2f'),squel[_0x185e('0xf')]()['field'](_0x185e('0x10'))[_0x185e('0x11')](_0x185e('0x2a'))[_0x185e('0x14')](_0x185e('0x30'),_0xd22b12)['where'](_0x42dd5b+_0x185e('0x31'),_0x471fbc+'.'+_0x42dd5b)))[_0x185e('0x26')]();}function insertCmContact(_0x19bc17,_0x2901de,_0x415a57,_0x2332ab){var _0x1b6727=_[_0x185e('0x32')](_[_0x185e('0x33')](_0x2332ab),[_0x185e('0x1d'),_0x185e('0x34'),_0x185e('0x2c'),_0x185e('0x1e')]);return squel[_0x185e('0x1b')]()['into'](_0x185e('0x20'))['fromQuery'](_0x1b6727,squel[_0x185e('0xf')]()['fields'](_0x1b6727)[_0x185e('0x11')](_0x2901de)[_0x185e('0x14')]('('+_0x415a57[_0x185e('0x12')](',')+_0x185e('0x35'),squel['select']()[_0x185e('0x2d')](_0x415a57)[_0x185e('0x11')](_0x185e('0x20'))[_0x185e('0x14')](_0x185e('0x30'),_0x19bc17)['where'](_0x185e('0x36')))['where']('id\x20IN\x20?',squel['select']()[_0x185e('0x37')]('MIN(id)',_0x185e('0x38'))[_0x185e('0x11')](_0x2901de)[_0x185e('0x39')](_0x415a57['join'](','))))['toString']();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x171f61){logger[_0x185e('0x3a')](_0x171f61[_0x185e('0x3b')]);process['exit'](0x1);}function handleError(_0x4a8018,_0xc1f30c){stats[_0x185e('0x3c')][_0x185e('0x3d')]({'name':_0xc1f30c[_0x185e('0x3e')],'message':_0xc1f30c[_0x185e('0x3b')],'row':_0x4a8018});}function handleQuery(_0x4d1fe8){logger['info'](_0x4d1fe8);return db[_0x185e('0x3f')][_0x185e('0x40')](_0x4d1fe8)[_0x185e('0x41')](function(_0x1ff8ea){results[_0x185e('0x3d')](_0x1ff8ea);})[_0x185e('0x42')](function(_0x4aacfb){logger[_0x185e('0x3a')](_0x4aacfb[_0x185e('0x3b')]);});}function main(_0x147020,_0x18f7ec,_0x5b7d4b,_0x5310da){logger[_0x185e('0x43')](_0x185e('0x44'),_0x147020,JSON['stringify'](_0x18f7ec));process['send']('start');var _0x5718d1=_0x18f7ec[_0x185e('0x45')];var _0x10eaea=_0x18f7ec['socket_timestamp'];var _0x5a1073=path[_0x185e('0x12')](config[_0x185e('0x46')],'server/files/tmp',_0x10eaea+_0x185e('0x47'));var _0x143c1f=_['keys'](_0x5718d1)['join']();logger['info'](_0x185e('0x48'),_0x143c1f);fs[_0x185e('0x49')](_0x5a1073,_0x143c1f+'\x0a');Papa[_0x185e('0x4a')](fs[_0x185e('0x4b')](_0x147020),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2614f9,_0x1f4bc6){try{for(var _0xf34905=0x0,_0x5ab4f8=[];_0xf34905<_0x2614f9[_0x185e('0x4c')][_0x185e('0x4d')];_0xf34905++){stats['rows']+=0x1;if(_0x2614f9[_0x185e('0x3c')][_0xf34905]){handleError(_0x2614f9[_0x185e('0x4c')][_0xf34905],_0x2614f9[_0x185e('0x3c')][_0xf34905]);}else{var _0x154acd=[];for(var _0x4ea7b6 in _0x5718d1){if(_0x5718d1[_0x185e('0x4e')](_0x4ea7b6)){if(_0x2614f9['data'][_0xf34905][_0x5718d1[_0x4ea7b6]]){var _0x203df2=_['trim'](_0x2614f9[_0x185e('0x4c')][_0xf34905][_0x5718d1[_0x4ea7b6]][_0x185e('0x4f')](/"/g,'\x27'));switch(_0x4ea7b6){case _0x185e('0x50'):var _0x7ff25=moment(_0x203df2,_0x185e('0xe'),!![]);if(_0x7ff25[_0x185e('0x51')]()){_0x5ab4f8[_0x185e('0x3d')]('\x22'+_0x203df2+'\x22');}else{_0x154acd[_0x185e('0x3d')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x185e('0x1f'):var _0x5a9182=parseInt(_0x203df2);_0x203df2=_[_0x185e('0x52')](_0x5a9182)||_0x5a9182<0x0||_0x5a9182>0x4?_0x5310da?0x3:0x2:_0x5a9182;_0x5ab4f8['push']('\x22'+_0x203df2+'\x22');break;case _0x185e('0x53'):var _0x4bfc1c=parseInt(_0x203df2);if(_[_0x185e('0x54')](_0x4bfc1c)&&_[_0x185e('0x55')](_0x5b7d4b,_0x4bfc1c)){_0x5ab4f8[_0x185e('0x3d')]('\x22'+_0x4bfc1c+'\x22');}else{_0x154acd[_0x185e('0x3d')](_0x185e('0x56'));}break;case _0x185e('0x57'):if(isEmail(_0x203df2)){_0x5ab4f8[_0x185e('0x3d')]('\x22'+_0x203df2+'\x22');}else{_0x154acd[_0x185e('0x3d')](_0x185e('0x58'));}break;case'dateOfBirth':var _0x257d49=moment(_0x203df2,_0x185e('0x59'),!![]);if(_0x257d49[_0x185e('0x51')]()){_0x5ab4f8[_0x185e('0x3d')]('\x22'+_0x203df2+'\x22');}else{_0x154acd[_0x185e('0x3d')](_0x185e('0x5a'));}break;default:_0x5ab4f8[_0x185e('0x3d')]('\x22'+_0x203df2+'\x22');}}else{switch(_0x4ea7b6){case _0x185e('0x5b'):case _0x185e('0x10'):_0x154acd[_0x185e('0x3d')](_0x4ea7b6+'\x20not\x20specified');break;default:_0x5ab4f8['push']('\x22\x22');}}}}if(_0x154acd[_0x185e('0x4d')]){handleError(_0x2614f9['data'][_0xf34905],{'code':_0x185e('0x5c'),'message':_0x154acd[_0x185e('0x12')]()});}else{fs[_0x185e('0x5d')](_0x5a1073,_0x5ab4f8[_0x185e('0x12')]()+'\x0a');}_0x5ab4f8=[];}if(!(stats[_0x185e('0x5e')]%0xc8)){socket['emit'](_0x185e('0x5f')+_0x10eaea,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x185e('0x60'));_0x1f4bc6[_0x185e('0x61')]();}}catch(_0x50b6f3){handleError(_0x2614f9['data'][_0xf34905],{'code':_0x185e('0x62'),'message':_0x50b6f3['message']});logger[_0x185e('0x3a')](_0x185e('0x63'),_0x50b6f3[_0x185e('0x3b')]);}},'complete':function(){try{var _0x16be54=[];var _0x25c0ae='cm_contacts';if(_0x18f7ec[_0x185e('0x64')]&&_0x18f7ec[_0x185e('0x64')]['length']){_0x25c0ae=_0x185e('0x65')+_0x10eaea;_0x16be54['push']('CREATE\x20TABLE\x20'+_0x25c0ae+_0x185e('0x66'));}var _0x2bea4e=util['format'](_0x185e('0x67'),_0x5a1073,_0x25c0ae,_0x143c1f,_0x18f7ec['ListId'],_0x18f7ec[_0x185e('0x34')]||null,NOW,NOW);if(_[_0x185e('0x68')](_0x5718d1['scheduledat'])){_0x2bea4e+=_0x185e('0x69');}_0x16be54['push'](_0x2bea4e);if(_0x18f7ec[_0x185e('0x64')]&&_0x18f7ec['duplicates']['length']){_0x16be54[_0x185e('0x3d')](insertCmContact(_0x18f7ec[_0x185e('0x1d')],_0x25c0ae,_0x18f7ec[_0x185e('0x64')],_0x5718d1));_0x16be54[_0x185e('0x3d')](_0x185e('0x6a')+_0x25c0ae+';');}_0x16be54[_0x185e('0x3d')](insertCmHopper(_0x18f7ec[_0x185e('0x1d')],'voice_queues_has_cm_lists',_0x185e('0x6b'),_0x185e('0x6c'),_0x5310da));_0x16be54[_0x185e('0x3d')](insertCmHopperBlack(_0x18f7ec['ListId'],_0x185e('0x6d'),_0x185e('0x6b'),_0x185e('0x6c')));_0x16be54[_0x185e('0x3d')](insertCmHopper(_0x18f7ec[_0x185e('0x1d')],_0x185e('0x6e'),_0x185e('0x6f'),'CampaignId',_0x5310da));_0x16be54[_0x185e('0x3d')](insertCmHopperBlack(_0x18f7ec['ListId'],_0x185e('0x70'),_0x185e('0x6f'),_0x185e('0x71')));BPromise[_0x185e('0x72')](_0x16be54,handleQuery)[_0x185e('0x73')](function(_0x211df2){stats[_0x185e('0x74')]=!![];stats[_0x185e('0x75')]=_0x18f7ec['duplicates']&&_0x18f7ec['duplicates'][_0x185e('0x4d')]?results[0x2][_0x185e('0x75')]:results[0x0][_0x185e('0x75')];socket[_0x185e('0x76')]('contact:import:'+_0x10eaea,stats);fs[_0x185e('0x77')](_0x147020);fs[_0x185e('0x77')](_0x5a1073);process[_0x185e('0x78')](0x0);})['catch'](function(_0x33bff4){logger[_0x185e('0x3a')](_0x33bff4['message']);process[_0x185e('0x78')](0x1);});}catch(_0xc1a31e){logger[_0x185e('0x3a')](_0x185e('0x79'),_0xc1a31e[_0x185e('0x3b')]);process[_0x185e('0x78')](0x1);}},'error':function(_0x3cc841,_0x11081f,_0x58a5c1,_0x251202){throw new Error(_0x251202);}});}function validate(){if(process[_0x185e('0x7a')]&&process[_0x185e('0x7a')]['length']<0x4){throw new Error('arguments\x20\x20\x20');}var _0x498049=path[_0x185e('0x12')](config[_0x185e('0x46')],_0x185e('0x7b'),process[_0x185e('0x7a')][0x2]);if(!fs[_0x185e('0x7c')](_0x498049)){throw new Error(_0x185e('0x7d'));}var _0x25d330={};try{_0x25d330=JSON[_0x185e('0x4a')](process[_0x185e('0x7a')][0x3]);if(!_0x25d330['binding']){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x25d330[_0x185e('0x45')]['phone']){throw new Error('phone\x20is\x20mandatory');}if(!_0x25d330['binding'][_0x185e('0x5b')]){throw new Error(_0x185e('0x7e'));}var _0x5cf0a4=0x0;if(_0x25d330[_0x185e('0x45')][_0x185e('0x53')]){_0x5cf0a4=0x1;}if(!_0x25d330[_0x185e('0x1d')]){throw new Error(_0x185e('0x7f'));}}catch(_0x3a9aed){throw new Error('body\x20id\x20mandatory');}var _0x4e6fdb=[];try{_0x4e6fdb=_[_0x185e('0x80')](JSON['parse'](process['argv'][0x4]),'id');}catch(_0x56ddf3){logger[_0x185e('0x43')](_0x185e('0x81'));}main(_0x498049,_0x25d330,_0x4e6fdb,_0x5cf0a4);}validate();process['on'](_0x185e('0x82'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index eb6a173..0f3eff6 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 _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 +var _0xeb3b=['endtime','duration','Billable\x20Time','billableseconds','getSubjects','string','voice','inbound','variable','queue','push','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','toLowerCase','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','Call\x20To','destexten','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','***\x20Time\x20Info\x20***','Agent\x20Ring','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','Called\x20Number','membername','starttime','Answer\x20Time','answertime','Complete\x20Time'];(function(_0x50514b,_0x83db65){var _0x5d8587=function(_0x327ba5){while(--_0x327ba5){_0x50514b['push'](_0x50514b['shift']());}};_0x5d8587(++_0x83db65);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x58efa6,_0x2c00bd){_0x58efa6=_0x58efa6-0x0;var _0x5d643c=_0xeb3b[_0x58efa6];return _0x5d643c;};'use strict';exports[_0xbeb3('0x0')]=function(_0x1130ba,_0xc5aaa3){var _0x33e049=[{'type':_0xbeb3('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x1130ba['toLowerCase']()){case _0xbeb3('0x2'):switch(_0xc5aaa3['toLowerCase']()){case _0xbeb3('0x3'):_0x33e049['push']({'type':_0xbeb3('0x4'),'content':'','variableName':_0xbeb3('0x5')});_0x33e049[_0xbeb3('0x6')]({'type':_0xbeb3('0x4'),'content':'','variableName':_0xbeb3('0x7')});break;case _0xbeb3('0x8'):_0x33e049['push']({'type':_0xbeb3('0x1'),'content':_0xbeb3('0x9'),'variableName':null});_0x33e049[_0xbeb3('0x6')]({'type':_0xbeb3('0x4'),'content':'','variableName':_0xbeb3('0xa')});break;}}return _0x33e049;};exports[_0xbeb3('0xb')]=function(_0x10161e,_0x567333){var _0x2d1e06=[];switch(_0x10161e[_0xbeb3('0xc')]()){case'voice':switch(_0x567333[_0xbeb3('0xc')]()){case _0xbeb3('0x3'):_0x2d1e06=[{'type':_0xbeb3('0x1'),'content':_0xbeb3('0xd'),'key':null,'keyType':null,'variableName':null},{'type':_0xbeb3('0xe'),'content':'','key':_0xbeb3('0xf'),'keyType':'variable','variableName':'calleridnum'},{'type':_0xbeb3('0xe'),'content':'','key':_0xbeb3('0x10'),'keyType':'variable','variableName':'calleridname'},{'type':_0xbeb3('0xe'),'content':'','key':_0xbeb3('0x11'),'keyType':_0xbeb3('0x4'),'variableName':_0xbeb3('0x12')},{'type':_0xbeb3('0xe'),'content':'','key':'Queue','keyType':_0xbeb3('0x4'),'variableName':'queue'},{'type':_0xbeb3('0xe'),'content':'','key':'UniqueId','keyType':'variable','variableName':'uniqueid'},{'type':_0xbeb3('0xe'),'content':'','key':_0xbeb3('0x13'),'keyType':_0xbeb3('0x4'),'variableName':_0xbeb3('0x14')},{'type':'string','content':_0xbeb3('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0xbeb3('0xe'),'content':'','key':_0xbeb3('0x16'),'keyType':'variable','variableName':'destcalleridname'},{'type':_0xbeb3('0xe'),'content':'','key':'Agent\x20Number','keyType':_0xbeb3('0x4'),'variableName':'destcalleridnum'},{'type':'string','content':_0xbeb3('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0xbeb3('0xe'),'content':'','key':_0xbeb3('0x18'),'keyType':'variable','variableName':_0xbeb3('0x14')},{'type':_0xbeb3('0xe'),'content':'','key':'Agent\x20Connect','keyType':_0xbeb3('0x4'),'variableName':_0xbeb3('0x19')},{'type':'keyValue','content':'','key':_0xbeb3('0x1a'),'keyType':_0xbeb3('0x4'),'variableName':_0xbeb3('0x1b')},{'type':_0xbeb3('0xe'),'content':'','key':_0xbeb3('0x1c'),'keyType':_0xbeb3('0x4'),'variableName':_0xbeb3('0x1d')},{'type':_0xbeb3('0xe'),'content':'','key':_0xbeb3('0x1e'),'keyType':'variable','variableName':'talktime'}];break;case _0xbeb3('0x8'):_0x2d1e06=[{'type':'string','content':_0xbeb3('0xd'),'variableName':null},{'type':_0xbeb3('0xe'),'content':'','key':_0xbeb3('0x1f'),'keyType':_0xbeb3('0x4'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0xbeb3('0xe'),'content':'','key':'Member\x20Name','keyType':_0xbeb3('0x4'),'keyContent':'','variableName':_0xbeb3('0x20')},{'type':'keyValue','content':'','key':'UniqueId','keyType':_0xbeb3('0x4'),'keyContent':'','variableName':'uniqueid'},{'type':'keyValue','content':'','key':'Date','keyType':'variable','keyContent':'','variableName':_0xbeb3('0x21')},{'type':'string','content':_0xbeb3('0x17')},{'type':_0xbeb3('0xe'),'content':'','key':_0xbeb3('0x22'),'keyType':_0xbeb3('0x4'),'keyContent':'','variableName':_0xbeb3('0x23')},{'type':_0xbeb3('0xe'),'content':'','key':_0xbeb3('0x24'),'keyType':_0xbeb3('0x4'),'keyContent':'','variableName':_0xbeb3('0x25')},{'type':_0xbeb3('0xe'),'content':'','key':'Duration','keyType':_0xbeb3('0x4'),'keyContent':'','variableName':_0xbeb3('0x26')},{'type':'keyValue','content':'','key':_0xbeb3('0x27'),'keyType':_0xbeb3('0x4'),'keyContent':'','variableName':_0xbeb3('0x28')}];break;}}return _0x2d1e06;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index ce0ff3b..6508178 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 _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 +var _0x48c6=['../../config/logger','sms-interactions','chat-interactions','upperFirst','toLowerCase','toUpperCase','name','role','stringify','Interaction','findOne','then','update','info','catch','error','user','clone','body','html','fax','lodash','../../mysqldb','openchannel-interactions'];(function(_0x45233f,_0x2a073d){var _0x475718=function(_0x12b46d){while(--_0x12b46d){_0x45233f['push'](_0x45233f['shift']());}};_0x475718(++_0x2a073d);}(_0x48c6,0x17d));var _0x648c=function(_0x2ddd9d,_0x3eef84){_0x2ddd9d=_0x2ddd9d-0x0;var _0x2fb5fa=_0x48c6[_0x2ddd9d];return _0x2fb5fa;};'use strict';var _=require(_0x648c('0x0'));var db=require(_0x648c('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x648c('0x2')),'mail':require(_0x648c('0x3'))('mail-interactions'),'fax':require(_0x648c('0x3'))('fax-interactions'),'sms':require(_0x648c('0x3'))(_0x648c('0x4')),'chat':require(_0x648c('0x3'))(_0x648c('0x5')),'whatsapp':require('../../config/logger')('whatsapp-interactions')};function getInteractionId(_0x486379,_0x246fc9,_0x349b2e){if(_0x486379&&_0x486379[_[_0x648c('0x6')](_0x349b2e)+'InteractionId']){return _0x486379[_[_0x648c('0x6')](_0x349b2e)+'InteractionId'];}else if(_0x486379&&_0x486379['id']){return _0x486379['id'];}else if(_0x246fc9&&_0x246fc9['id']){return _0x246fc9['id'];}else{return'unknown';}}function log(_0x5167d4,_0x178248,_0x323c3e,_0x461a47,_0x261ce6,_0x26e60e){loggers[_0x261ce6[_0x648c('0x7')]()][_0x5167d4]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x26e60e[_0x648c('0x8')](),_0x178248?_0x178248['id']:null,_0x178248?_0x178248[_0x648c('0x9')]:null,_0x178248?_0x178248[_0x648c('0xa')]:null,getInteractionId(_0x323c3e,_0x461a47,_0x261ce6),_0x323c3e?JSON[_0x648c('0xb')](_0x323c3e):'null');}function updateUser(_0x4d8d0e,_0x2f5cc1,_0x3de2b4,_0x485d5d,_0x2d0862){db[_[_0x648c('0x6')](_0x485d5d)+_0x648c('0xc')][_0x648c('0xd')]({'where':{'id':getInteractionId(_0x2f5cc1,_0x3de2b4,_0x485d5d)}})[_0x648c('0xe')](function(_0x581700){if(_0x581700){return _0x581700[_0x648c('0xf')]({'UserId':_0x4d8d0e?_0x4d8d0e['id']:null});}})[_0x648c('0xe')](function(_0x4c1bf4){if(_0x4c1bf4){log(_0x648c('0x10'),_0x4d8d0e,_0x2f5cc1,_0x3de2b4,_0x485d5d,_0x2d0862);}})[_0x648c('0x11')](function(){log(_0x648c('0x12'),_0x4d8d0e,_0x2f5cc1,_0x3de2b4,_0x485d5d,_0x2d0862);});}exports['tracked']=function(_0x21b8bd,_0x349ec2){return function(_0x35e9ff,_0x4e1a02,_0x55e3e7){var _0x4fd450=_0x35e9ff[_0x648c('0x13')];var _0x35471e={};var _0x3d2f1f=_0x35e9ff['query'];if(_0x35471e){_0x35471e=_[_0x648c('0x14')](_0x35e9ff[_0x648c('0x15')]);_0x35471e=_['omit'](_0x35471e,['body',_0x648c('0x16'),'phone',_0x648c('0x17'),'mobile']);}updateUser(_0x4fd450,_0x35471e,_0x3d2f1f,_0x21b8bd,_0x349ec2);_0x55e3e7(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 8018101..6887dd4 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 _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 +var _0x1252=['format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','%s:%s:%s','update','base64','final','utf8','hasOwnProperty','use','License','findOne','then','count','status'];(function(_0x4c95af,_0x3ea284){var _0x54e0ab=function(_0x226455){while(--_0x226455){_0x4c95af['push'](_0x4c95af['shift']());}};_0x54e0ab(++_0x3ea284);}(_0x1252,0x146));var _0x2125=function(_0x1fd809,_0x1bf2d0){_0x1fd809=_0x1fd809-0x0;var _0x28c337=_0x1252[_0x1fd809];return _0x28c337;};'use strict';var crypto=require(_0x2125('0x0'));var util=require(_0x2125('0x1'));var compose=require(_0x2125('0x2'));var db=require(_0x2125('0x3'))['db'];var config=require(_0x2125('0x4'));function getValueFromLicense(_0x2e00b6,_0x58af28){if(_0x2e00b6&&_0x58af28){if(_0x58af28[_0x2125('0x5')]&&_0x58af28[_0x2125('0x6')]){var _0x4670fe=_0x58af28[_0x2125('0x5')];var _0x92661d=_0x58af28[_0x2125('0x6')];var _0xb79a68=_0x4670fe[_0x2125('0x7')]('-')[0x4];var _0x569a5e=_0x4670fe['split']('-')[0x0];var _0x1b1fb2=crypto[_0x2125('0x8')](_0x2125('0x9'),util['format'](_0x2125('0xa'),_0xb79a68,_0x4670fe,_0x569a5e));var _0x5cc59b=_0x1b1fb2[_0x2125('0xb')](_0x92661d,_0x2125('0xc'),'utf8');_0x5cc59b+=_0x1b1fb2[_0x2125('0xd')](_0x2125('0xe'));var _0x381739=JSON['parse'](_0x5cc59b);return _0x381739[_0x2125('0xf')](_0x2e00b6)?_0x381739[_0x2e00b6]:null;}}return null;}function isLimit(_0x1c32d9,_0x5c8820,_0x1d301d,_0x4e5e13){var _0x21cb88=_0x5c8820;return compose()[_0x2125('0x10')](function(_0x34d34b,_0x4c603c,_0x5e4e76){return db[_0x2125('0x11')][_0x2125('0x12')]({'where':{'id':0x1},'raw':!![]})[_0x2125('0x13')](function(_0x86fc3e){var _0x9772ed=getValueFromLicense(_0x1c32d9,_0x86fc3e);return _0x9772ed?_0x9772ed:_0x21cb88;})[_0x2125('0x13')](function(_0x268e72){_0x21cb88=_0x268e72;return _0x1d301d[_0x2125('0x14')](_0x4e5e13);})['then'](function(_0x335e34){if(_0x335e34>=_0x21cb88){return _0x4c603c[_0x2125('0x15')](0x193)['json']({'message':util[_0x2125('0x16')](_0x2125('0x17'),_0x1c32d9)});}_0x5e4e76();})[_0x2125('0x18')](function(_0x28b3db){_0x5e4e76(_0x28b3db);});});}function isUserLimit(){return isLimit(_0x2125('0x19'),0x1,db[_0x2125('0x1a')],{'where':{'$or':[{'role':_0x2125('0x1b')},{'role':_0x2125('0x1c')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index bbf21f5..621d187 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 _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 +var _0xa410=['$lte','days','format','castTo','CAST(','field','\x20AS\x20','text','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$startsWith','$endsWith','LIKE\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','DATE','utcOffset','add','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','replace','length','split','slice','forEach','shift','match','indexOf','push','$eq','operator','$between','value','includes','$gt'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xa410,0x111));var _0x0a41=function(_0x3341e3,_0x544d12){_0x3341e3=_0x3341e3-0x0;var _0x294748=_0xa410[_0x3341e3];return _0x294748;};'use strict';var _=require(_0x0a41('0x0'));var moment=require(_0x0a41('0x1'));exports[_0x0a41('0x2')]=function(_0x2071ef){var _0x1ab712={'conditions':[]};_0x1ab712[_0x0a41('0x3')]=_[_0x0a41('0x4')](_0x2071ef,_0x0a41('0x5'))?'or':'and';var _0x3f0147=_0x2071ef[_0x0a41('0x6')]('[$and]','')[_0x0a41('0x6')]('[$or]','')['split']('||');for(var _0x3f8f23=0x0;_0x3f8f23<_0x3f0147[_0x0a41('0x7')];_0x3f8f23++){var _0x166af3=_0x3f0147[_0x3f8f23][_0x0a41('0x8')](':=');var _0x14b683=_0x166af3[0x0];var _0x19a6e1=_0x166af3[_0x0a41('0x9')](0x1);_0x19a6e1[_0x0a41('0xa')](function(_0x2225f5){var _0x116e59=_0x2225f5['split']('[')[_0x0a41('0xb')]();var _0x9712b2=_0x2225f5[_0x0a41('0xc')](/\[(.*?)\]/g);_0x9712b2[_0x0a41('0xa')](function(_0x195b4f){var _0x486d01=_0x195b4f['split']('[')['filter'](function(_0x482d23){return _0x482d23[_0x0a41('0xd')](']')>-0x1;})['map'](function(_0x4e9904){return _0x4e9904['split'](']')[0x0];})[0x0];_0x1ab712['conditions'][_0x0a41('0xe')]({'field':_0x14b683,'operator':_0x116e59,'value':_0x486d01});});});}return _0x1ab712;};exports['buildExpression']=function(_0x198859,_0x55e4ee,_0x9c2073){var _0x12fdcf={};if(_0x55e4ee==='DATE'){if(_0x9c2073['operator']===_0x0a41('0xf')){_0x9c2073[_0x0a41('0x10')]=_0x0a41('0x11');_0x9c2073[_0x0a41('0x12')]+=','+_0x9c2073[_0x0a41('0x12')];}else if(_[_0x0a41('0x13')]([_0x0a41('0x14'),_0x0a41('0x15')],_0x9c2073['operator'])){_0x9c2073[_0x0a41('0x12')]=moment(_0x9c2073[_0x0a41('0x12')])['add'](0x1,_0x0a41('0x16'))[_0x0a41('0x17')]('YYYY-MM-DD');}}if(_0x9c2073[_0x0a41('0x18')]){_0x55e4ee=_0x9c2073[_0x0a41('0x18')];_0x12fdcf['text']=_0x0a41('0x19')+_0x198859+'.'+_0x9c2073[_0x0a41('0x1a')]+_0x0a41('0x1b')+_0x9c2073[_0x0a41('0x18')]+')\x20'+parseOperator(_0x9c2073['operator']);}else{_0x12fdcf[_0x0a41('0x1c')]=_0x198859+'.'+_0x9c2073[_0x0a41('0x1a')]+'\x20'+parseOperator(_0x9c2073[_0x0a41('0x10')]);}if(_[_0x0a41('0x13')]([_0x0a41('0x1d'),_0x0a41('0x1e')],_0x9c2073[_0x0a41('0x10')]))_0x12fdcf['text']='('+_0x12fdcf[_0x0a41('0x1c')]+_0x0a41('0x1f')+_0x198859+'.'+_0x9c2073[_0x0a41('0x1a')]+_0x0a41('0x20');_0x12fdcf[_0x0a41('0x12')]=parseValue(_0x55e4ee,_0x9c2073[_0x0a41('0x10')],_0x9c2073['value']);return _0x12fdcf;};function parseOperator(_0x2c4bc5){var _0x269f40;switch(_0x2c4bc5){case _0x0a41('0x21'):_0x269f40=_0x0a41('0x22');break;case _0x0a41('0x1e'):_0x269f40=_0x0a41('0x23');break;case _0x0a41('0xf'):_0x269f40=_0x0a41('0x24');break;case _0x0a41('0x1d'):_0x269f40='<>\x20?';break;case'$substring':case _0x0a41('0x25'):case _0x0a41('0x26'):_0x269f40=_0x0a41('0x27');break;case'$lt':_0x269f40='<\x20?';break;case _0x0a41('0x14'):_0x269f40='>\x20?';break;case'$lte':_0x269f40=_0x0a41('0x28');break;case _0x0a41('0x29'):_0x269f40=_0x0a41('0x2a');break;case _0x0a41('0x11'):_0x269f40=_0x0a41('0x2b');break;}return _0x269f40;}function parseValue(_0x5d6f7d,_0x440b64,_0x114fdd){var _0x5ecd1c={'start':undefined,'end':undefined};switch(_0x440b64){case _0x0a41('0x21'):case _0x0a41('0x1e'):_0x5ecd1c['start']=_0x114fdd[_0x0a41('0x8')](',');break;case'$substring':_0x5ecd1c[_0x0a41('0x2c')]='%'+_0x114fdd+'%';break;case'$startsWith':_0x5ecd1c[_0x0a41('0x2c')]=_0x114fdd+'%';break;case _0x0a41('0x26'):_0x5ecd1c[_0x0a41('0x2c')]='%'+_0x114fdd;break;case'$between':var _0x924709=_0x114fdd[_0x0a41('0x8')](',');var _0x114fdd=_0x924709[_0x0a41('0xb')]();var _0xd11617=_0x924709[_0x0a41('0x2d')]();if(_0x5d6f7d===_0x0a41('0x2e')){_0x114fdd=moment(_0x114fdd)[_0x0a41('0x2f')](0x0,!![])[_0x0a41('0x17')]();_0xd11617=moment(_0xd11617)[_0x0a41('0x2f')](0x0,!![])[_0x0a41('0x30')](0x17,'hours')[_0x0a41('0x30')](0x3b,'minutes')[_0x0a41('0x30')](0x3b,'seconds')[_0x0a41('0x17')]();}_0x5ecd1c={'start':_0x114fdd,'end':_0xd11617};break;default:_0x5ecd1c[_0x0a41('0x2c')]=_0x114fdd;break;}return _0x5ecd1c;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 654efba..c15abf3 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 _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 +var _0x3f2e=['hasOwnProperty','match','^[0-9]*$','isEmail','getFullTextValue','toString','join','lodash','sequelize','moment','fields','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','parse','$gte','format','YYYY-MM-DD','utc','$lte','isArray','offset','sort','priority','cast','col','DESC','unsigned','ASC','omit','length','isObject','isString','unset'];(function(_0x22f931,_0x51e7d9){var _0x283386=function(_0x16fe83){while(--_0x16fe83){_0x22f931['push'](_0x22f931['shift']());}};_0x283386(++_0x51e7d9);}(_0x3f2e,0x166));var _0xe3f2=function(_0x24a711,_0x2c44e7){_0x24a711=_0x24a711-0x0;var _0x24dad5=_0x3f2e[_0x24a711];return _0x24dad5;};'use strict';var _=require(_0xe3f2('0x0'));var sequelize=require(_0xe3f2('0x1'));var moment=require(_0xe3f2('0x2'));var LIMIT_VALUE=0xfa;exports[_0xe3f2('0x3')]=function(_0x2cfb4a){var _0x834381=null;if(_0x2cfb4a){_0x834381=_0x2cfb4a[_0xe3f2('0x4')](',');}return _0x834381;};exports[_0xe3f2('0x5')]=function(_0x1dbe3d,_0x26d1e3){var _0x439105={};if(!_[_0xe3f2('0x6')](_0x1dbe3d)){_[_0xe3f2('0x7')](_0x1dbe3d,function(_0x3902e6,_0x2dff57){try{if(_0x26d1e3){var _0x8218c2=_[_0xe3f2('0x8')](_0x26d1e3,{'name':_0x2dff57})||{};if(_0x8218c2[_0xe3f2('0x9')]===_0xe3f2('0xa')&&_[_0xe3f2('0xb')](_0x3902e6)){var _0x2fb6ce=JSON[_0xe3f2('0xc')](_0x3902e6);var _0x460859={'$gte':moment(moment(_0x2fb6ce[_0xe3f2('0xd')])[_0xe3f2('0xe')](_0xe3f2('0xf')))[_0xe3f2('0x10')]()[_0xe3f2('0xe')](),'$lte':moment(moment(_0x2fb6ce[_0xe3f2('0x11')])['format'](_0xe3f2('0xf')))[_0xe3f2('0x10')]()['subtract'](0x1,'s')[_0xe3f2('0xe')]()};_0x439105[_0x2dff57]=_0x460859;}else{_0x439105[_0x2dff57]=_[_0xe3f2('0x12')](_0x3902e6)?_0x3902e6:JSON['parse'](_0x3902e6);}}else{_0x439105[_0x2dff57]=_['isArray'](_0x3902e6)?_0x3902e6:JSON[_0xe3f2('0xc')](_0x3902e6);}}catch(_0x24a3f9){_0x439105[_0x2dff57]=_0x3902e6['split'](',');}});}return _0x439105;};exports['limit']=function(_0x1b7baa){_0x1b7baa=parseInt(_0x1b7baa,0xa);if(!_0x1b7baa||_0x1b7baa<0x0){_0x1b7baa=LIMIT_VALUE;}return _0x1b7baa;};exports[_0xe3f2('0x13')]=function(_0x421cdf){_0x421cdf=parseInt(_0x421cdf,0xa);if(!_0x421cdf||_0x421cdf<0x0){_0x421cdf=0x0;}return _0x421cdf;};exports[_0xe3f2('0x14')]=function(_0x3feac8){var _0x3e49c6,_0xdc81ea=null;if(_0x3feac8){_0x3e49c6=_0x3feac8['split'](',');_0xdc81ea=_['map'](_0x3e49c6,function(_0x5baa11){if(_0x5baa11['indexOf']('-')===0x0){return[_0x5baa11===_0xe3f2('0x15')?sequelize[_0xe3f2('0x16')](sequelize[_0xe3f2('0x17')](_0xe3f2('0x15')),'unsigned'):_0x5baa11['substr'](0x1),_0xe3f2('0x18')];}else{return[_0x5baa11===_0xe3f2('0x15')?sequelize[_0xe3f2('0x16')](sequelize[_0xe3f2('0x17')](_0xe3f2('0x15')),_0xe3f2('0x19')):_0x5baa11,_0xe3f2('0x1a')];}});}return _0xdc81ea;};exports[_0xe3f2('0x1b')]=function(_0x59b6ea,_0x5865fe){if(_[_0xe3f2('0x6')](_0x59b6ea)){return _0x59b6ea;}if(_[_0xe3f2('0x12')](_0x59b6ea)){for(var _0x398407=0x0;_0x398407<_0x59b6ea[_0xe3f2('0x1c')];_0x398407+=0x1){_0x59b6ea[_0x398407]=this['omit'](_0x59b6ea[_0x398407],_0x5865fe);}return _0x59b6ea;}if(!_[_0xe3f2('0x1d')](_0x59b6ea)){return _0x59b6ea;}if(_[_0xe3f2('0x1e')](_0x5865fe)){_0x5865fe=[_0x5865fe];}if(!_[_0xe3f2('0x12')](_0x5865fe)){return _0x59b6ea;}for(var _0x1a8b3c=0x0;_0x1a8b3c<_0x5865fe[_0xe3f2('0x1c')];_0x1a8b3c+=0x1){_[_0xe3f2('0x1f')](_0x59b6ea,_0x5865fe[_0x1a8b3c]);}for(var _0x287f57 in _0x59b6ea){if(_0x59b6ea[_0xe3f2('0x20')](_0x287f57)){_0x59b6ea[_0x287f57]=this[_0xe3f2('0x1b')](_0x59b6ea[_0x287f57],_0x5865fe);}}return _0x59b6ea;};exports['isNumeric']=function(_0x55096e){return _0x55096e[_0xe3f2('0x21')](RegExp(_0xe3f2('0x22')))?!![]:![];};exports[_0xe3f2('0x23')]=function(_0x571fcf){return _0x571fcf[_0xe3f2('0x21')](/^\S+@\S+$/)?!![]:![];};exports[_0xe3f2('0x24')]=function(_0x386bd0){var _0x4483d6=[];_0x386bd0['split']('\x20')['forEach'](function(_0x123b3f){_0x4483d6['push']('+'+_0x123b3f[_0xe3f2('0x25')]()+'*');});return _0x4483d6[_0xe3f2('0x26')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index f825313..43be170 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x21ef=['engine','ejs','renderFile','view\x20engine','html','urlencoded','50mb','json','initialize','express','body-parser','method-override','errorhandler','path','passport','cors','moment','./environment','../mysqldb','default','env','set','appPath','join','development','test','root','client','use','json\x20replacer','toISOString','static','get','views'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x21ef,0x17f));var _0xf21e=function(_0x349a13,_0x3cd835){_0x349a13=_0x349a13-0x0;var _0x47ddc0=_0x21ef[_0x349a13];return _0x47ddc0;};'use strict';var express=require(_0xf21e('0x0'));var favicon=require('serve-favicon');var bodyParser=require(_0xf21e('0x1'));var methodOverride=require(_0xf21e('0x2'));var cookieParser=require('cookie-parser');var errorHandler=require(_0xf21e('0x3'));var path=require(_0xf21e('0x4'));var passport=require(_0xf21e('0x5'));var cors=require(_0xf21e('0x6'));var moment=require(_0xf21e('0x7'));var config=require(_0xf21e('0x8'));var db=require(_0xf21e('0x9'))['db'];exports[_0xf21e('0xa')]=function(_0x4b63d5){var _0x35ab9d=_0x4b63d5['get'](_0xf21e('0xb'));if(_0x35ab9d==='production'){_0x4b63d5[_0xf21e('0xc')](_0xf21e('0xd'),path[_0xf21e('0xe')](config['root'],'public'));}if(_0x35ab9d===_0xf21e('0xf')||_0x35ab9d===_0xf21e('0x10')){_0x4b63d5[_0xf21e('0xc')]('appPath',path[_0xf21e('0xe')](config[_0xf21e('0x11')],_0xf21e('0x12')));_0x4b63d5[_0xf21e('0x13')](errorHandler());}_0x4b63d5[_0xf21e('0xc')](_0xf21e('0x14'),function(_0xd5ff76,_0x545431){if(this[_0xd5ff76]instanceof Date){_0x545431=this[_0xd5ff76][_0xf21e('0x15')]()['split']('.')[0x0]+'Z';}return _0x545431;});_0x4b63d5['use'](express[_0xf21e('0x16')](_0x4b63d5[_0xf21e('0x17')](_0xf21e('0xd'))));_0x4b63d5[_0xf21e('0xc')](_0xf21e('0x18'),config[_0xf21e('0x11')]+'/server/views');_0x4b63d5[_0xf21e('0x19')]('html',require(_0xf21e('0x1a'))[_0xf21e('0x1b')]);_0x4b63d5[_0xf21e('0xc')](_0xf21e('0x1c'),_0xf21e('0x1d'));_0x4b63d5[_0xf21e('0x13')](bodyParser[_0xf21e('0x1e')]({'limit':_0xf21e('0x1f'),'extended':!![]}));_0x4b63d5[_0xf21e('0x13')](bodyParser[_0xf21e('0x20')]({'limit':_0xf21e('0x1f')}));_0x4b63d5[_0xf21e('0x13')](cors());_0x4b63d5[_0xf21e('0x13')](methodOverride());_0x4b63d5[_0xf21e('0x13')](cookieParser());_0x4b63d5['use'](passport[_0xf21e('0x21')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 478aeea..8ca3413 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 _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 +var _0x598a=['address','127.0.0.1','getFirstInterface','cpus','map','join','md5','update','digest','hex','getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','ipAddress','createHash','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','keys','length','filter','IPv4','internal','concat','head','mac'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x598a,0xfb));var _0xa598=function(_0x2aad5a,_0x2498b4){_0x2aad5a=_0x2aad5a-0x0;var _0xa29401=_0x598a[_0x2aad5a];return _0xa29401;};'use strict';var _=require(_0xa598('0x0'));var os=require('os');var crypto=require(_0xa598('0x1'));var machine=require(_0xa598('0x2'));var exec=require(_0xa598('0x3'))[_0xa598('0x4')];function getInterfaces(){var _0x4d3555=[];var _0x3a2794=os['networkInterfaces']();var _0x4958fc=_['orderBy'](_[_0xa598('0x5')](_0x3a2794));for(var _0x8f041b=0x0;_0x8f041b<_0x4958fc[_0xa598('0x6')];_0x8f041b++){var _0x2b0ef0=_0x3a2794[_0x4958fc[_0x8f041b]][_0xa598('0x7')](function(_0x4d82ee){return _0x4d82ee['family']===_0xa598('0x8')&&_0x4d82ee[_0xa598('0x9')]===![];});_0x4d3555=_0x4d3555[_0xa598('0xa')](_0x2b0ef0);}return _0x4d3555;}function getFirstInterface(){var _0xe36e4f=_[_0xa598('0xb')](getInterfaces());return{'macAddress':_0xe36e4f&&_0xe36e4f[_0xa598('0xc')]?_0xe36e4f['mac']:'00:00:00:00:00:00','ipAddress':_0xe36e4f&&_0xe36e4f[_0xa598('0xd')]?_0xe36e4f[_0xa598('0xd')]:_0xa598('0xe')};}exports[_0xa598('0xf')]=getFirstInterface;function getCPUhash(){var _0xa1c53=_['orderBy'](os[_0xa598('0x10')]()[_0xa598('0x11')](function(_0x468710){return _0x468710['model'];}))[_0xa598('0x12')](':');return crypto['createHash'](_0xa598('0x13'))[_0xa598('0x14')](_0xa1c53)[_0xa598('0x15')](_0xa598('0x16'));}exports[_0xa598('0x17')]=function(){switch(os[_0xa598('0x18')]()){case _0xa598('0x19'):return exec(_0xa598('0x1a'),{'encoding':_0xa598('0x1b')})['replace']('\x0d\x0a','');default:var _0x88df86=getFirstInterface();var _0x82a6cc=getCPUhash();var _0x6e6ff5=_0x82a6cc+'|'+os[_0xa598('0x1c')]()+'|'+_0x88df86[_0xa598('0x1d')]+'|'+_0x88df86[_0xa598('0x1e')];var _0x3cbb9f=crypto[_0xa598('0x1f')](_0xa598('0x13'))[_0xa598('0x14')](_0x6e6ff5)['digest'](_0xa598('0x16'));return _0x3cbb9f[_0xa598('0x20')](0x0,0x8)+'-'+_0x3cbb9f[_0xa598('0x20')](0x8,0xc)+'-'+_0x3cbb9f[_0xa598('0x20')](0xc,0x10)+'-'+_0x3cbb9f[_0xa598('0x20')](0x10,0x14)+'-'+_0x3cbb9f[_0xa598('0x20')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 55d7199..def2a7c 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 _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 +var _0xb422=['THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','DEMO\x20START\x20AT\x20%s','catch','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','request-promise','version','../environment','../logger','../../api/jira/jira.controller','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','then','createCipher','session','utf8','base64','final','createDecipher','aes-256-ctr','secrets','update','||FIELD||VALUE||\x0a','User','admin','email','|machineUuid|','|name|','fullname','|email|','getFirstInterface','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1'];(function(_0x5f1baf,_0x2942f0){var _0x30aa8d=function(_0x14c9c4){while(--_0x14c9c4){_0x5f1baf['push'](_0x5f1baf['shift']());}};_0x30aa8d(++_0x2942f0);}(_0xb422,0x85));var _0x2b42=function(_0x2ae5ce,_0x481760){_0x2ae5ce=_0x2ae5ce-0x0;var _0x3ccd3c=_0xb422[_0x2ae5ce];return _0x3ccd3c;};'use strict';var util=require('util');var crypto=require('crypto');var moment=require('moment');var rp=require(_0x2b42('0x0'));var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0x2b42('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x2b42('0x2'));var hardware=require('./hardware');var logger=require(_0x2b42('0x3'))('license');var jira=require(_0x2b42('0x4'));var HOST=_0x2b42('0x5');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x750c2){return new BPromise(function(_0x51b3bd,_0xde9c67){var _0x1b64f7=util[_0x2b42('0x6')]('%s/api/servers/%s/check?version=%s',HOST,_0x750c2,module['exports'][_0x2b42('0x1')]);if(oldToken){_0x1b64f7=util['format'](_0x2b42('0x7'),HOST,_0x750c2,module[_0x2b42('0x8')][_0x2b42('0x1')],oldToken);}var _0x1ec844={'uri':_0x1b64f7,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x1ec844)[_0x2b42('0x9')](function(_0x18f30b){_0x51b3bd(_0x18f30b);})['catch'](function(_0x391127){_0xde9c67(_0x391127);});});}function encryptDate(_0x30a882){var _0x22272e=crypto[_0x2b42('0xa')]('aes-256-ctr',config['secrets'][_0x2b42('0xb')]);var _0x10cd23=_0x22272e['update'](_0x30a882,_0x2b42('0xc'),_0x2b42('0xd'));_0x10cd23+=_0x22272e[_0x2b42('0xe')](_0x2b42('0xd'));return _0x10cd23;}function decryptDate(_0x4cb695){var _0xc7e610=crypto[_0x2b42('0xf')](_0x2b42('0x10'),config[_0x2b42('0x11')][_0x2b42('0xb')]);var _0x4897d8=_0xc7e610[_0x2b42('0x12')](_0x4cb695,_0x2b42('0xd'),_0x2b42('0xc'));_0x4897d8+=_0xc7e610[_0x2b42('0xe')](_0x2b42('0xc'));return _0x4897d8;}function sendJiraAlert(_0x3ab83c,_0xa28ba4,_0x4728f4){var _0x490053=_0x2b42('0x13');return db[_0x2b42('0x14')]['findOne']({'where':{'role':_0x2b42('0x15')},'attributes':['fullname',_0x2b42('0x16')],'raw':!![]})[_0x2b42('0x9')](function(_0x18e43a){ADMIN=_0x18e43a;_0x490053+='|reason|'+_0x4728f4+'|\x0a';_0x490053+='|uuid|'+_0x3ab83c+'|\x0a';_0x490053+=_0x2b42('0x17')+_0xa28ba4+'|\x0a';_0x490053+=_0x2b42('0x18')+ADMIN[_0x2b42('0x19')]+'|\x0a';_0x490053+=_0x2b42('0x1a')+ADMIN['email']+'|\x0a';return _0x490053;})[_0x2b42('0x9')](function(_0x355859){var _0x5063b6=hardware[_0x2b42('0x1b')]()[_0x2b42('0x1c')];return jira[_0x2b42('0x1d')]({'key':_0x2b42('0x1e'),'summary':_0x2b42('0x1f'),'description':_0x355859,'issuetype':_0x2b42('0x20'),'oldToken':_0x3ab83c,'newToken':_0xa28ba4,'email':ADMIN['email'],'name':ADMIN[_0x2b42('0x19')],'reason':GRAY_PERIOD_REASON,'ip':_0x5063b6});});}function manageLicense(_0x319692,_0x477e97){var _0x256fc9=_0x477e97[_0x2b42('0x21')]({'plain':!![]});httpRequest(_0x319692)[_0x2b42('0x9')](function(_0x130912){if(oldToken){oldToken=undefined;}if(_0x130912[_0x2b42('0x22')]){if(!_0x256fc9[_0x2b42('0x23')]&&_0x256fc9[_0x2b42('0x23')]!=_0x130912[_0x2b42('0x23')]||_0x256fc9['license']&&_0x256fc9['data2']){logger[_0x2b42('0x24')](_0x2b42('0x25'));}if(_0x256fc9[_0x2b42('0x23')]&&!_0x256fc9[_0x2b42('0x26')]&&_0x256fc9['license']!=_0x130912[_0x2b42('0x23')]){logger[_0x2b42('0x24')](_0x2b42('0x27'));}if(_0x256fc9['license']&&!_0x256fc9['data2']&&_0x256fc9[_0x2b42('0x23')]==_0x130912[_0x2b42('0x23')]){return _0x477e97;}return _0x477e97[_0x2b42('0x12')]({'data1':_0x319692,'data2':null,'license':_0x130912[_0x2b42('0x23')]});}else{if(_0x130912['license']||_0x256fc9[_0x2b42('0x23')]){if(!_0x256fc9[_0x2b42('0x26')]){if(_0x256fc9[_0x2b42('0x28')]==_0x319692){GRAY_PERIOD_REASON='Disabled';logger[_0x2b42('0x24')](_0x2b42('0x29'));}else{GRAY_PERIOD_REASON=_0x2b42('0x2a');oldToken=_0x256fc9[_0x2b42('0x28')];logger[_0x2b42('0x24')](_0x2b42('0x2b'),_0x256fc9[_0x2b42('0x28')],_0x319692);}sendJiraAlert(_0x256fc9[_0x2b42('0x28')],_0x130912[_0x2b42('0x2c')],GRAY_PERIOD_REASON);logger[_0x2b42('0x24')](_0x2b42('0x2d'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x2b42('0x6')]('YYYY-MM-DD\x20HH:mm'));return _0x477e97['update']({'data2':encryptDate(moment()[_0x2b42('0x6')](_0x2b42('0x2e')))});}else{if(moment()['diff'](decryptDate(_0x256fc9['data2']),'days')>DAYS){logger[_0x2b42('0x24')](_0x2b42('0x2f'),moment()[_0x2b42('0x6')]('YYYY-MM-DD\x20HH:mm'));return _0x477e97[_0x2b42('0x12')]({'data1':_0x319692,'data2':null,'license':null});}}}else{if(_0x256fc9[_0x2b42('0x28')]!=_0x319692){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x256fc9[_0x2b42('0x28')],_0x319692);return _0x477e97[_0x2b42('0x12')]({'data1':_0x319692,'data2':null,'license':null});}}}return _0x477e97;})[_0x2b42('0x9')](function(_0x4efb12){_0x477e97=_0x4efb12;})[_0x2b42('0x30')](function(_0x16d364){logger[_0x2b42('0x31')](_0x16d364[_0x2b42('0x32')]);})[_0x2b42('0x33')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x477e97);},TIME);});}function defaultLicense(){var _0x388def=hardware[_0x2b42('0x34')]();if(_0x388def){return db[_0x2b42('0x35')][_0x2b42('0x36')]({'where':{'id':0x1},'defaults':{'data1':_0x388def}})[_0x2b42('0x37')](function(_0x27b219,_0x45fb9f){logger[_0x2b42('0x24')](_0x2b42('0x38'),_0x388def);manageLicense(_0x388def,_0x27b219);})[_0x2b42('0x30')](function(_0x4fdd40){logger['error'](_0x4fdd40[_0x2b42('0x32')]);});}}exports[_0x2b42('0x39')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index df3832b..6946b5e 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 _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 +var _0x7de4=['uuid','machineUuid','disabled','Breaking\x20license','data1','Demo\x20license','getLicense','find','then','checkLicense','crypto','lodash','moment','../environment','../../mysqldb','license','data2','split','createDecipher','%s:%s:%s','update','utf8','final','parse','demo','getUuid','aes-256-ctr','secrets','base64','gray','deadline','add','format','grayReason'];(function(_0x54ce75,_0xf87395){var _0x1be166=function(_0x3f0d4e){while(--_0x3f0d4e){_0x54ce75['push'](_0x54ce75['shift']());}};_0x1be166(++_0xf87395);}(_0x7de4,0xb4));var _0x47de=function(_0x3fd2fa,_0x3b3ef0){_0x3fd2fa=_0x3fd2fa-0x0;var _0x52cd41=_0x7de4[_0x3fd2fa];return _0x52cd41;};'use strict';var crypto=require(_0x47de('0x0'));var util=require('util');var _=require(_0x47de('0x1'));var moment=require(_0x47de('0x2'));var hardware=require('./hardware');var config=require(_0x47de('0x3'));var db=require(_0x47de('0x4'))['db'];function checkLicense(_0x10a014,_0x23d1ea){if(_0x10a014){try{var _0x12ecf9=_0x23d1ea||_0x10a014[_0x47de('0x5')];if(_['isEmpty'](_0x12ecf9)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x36a9bc=_0x10a014['data1'];var _0x1765fa=_0x10a014[_0x47de('0x6')];var _0x540c65=_0x36a9bc[_0x47de('0x7')]('-')[0x4];var _0x23e380=_0x36a9bc[_0x47de('0x7')]('-')[0x0];var _0x247262=crypto[_0x47de('0x8')]('aes-256-ctr',util['format'](_0x47de('0x9'),_0x540c65,_0x36a9bc,_0x23e380));var _0x54cded=_0x247262[_0x47de('0xa')](_0x12ecf9,'base64',_0x47de('0xb'));_0x54cded+=_0x247262[_0x47de('0xc')](_0x47de('0xb'));var _0x20a566=JSON[_0x47de('0xd')](_0x54cded);_0x20a566[_0x47de('0xe')]=![];_0x20a566['uuid']=_0x36a9bc;_0x20a566['machineUuid']=hardware[_0x47de('0xf')]();if(_0x1765fa){var _0x650764=crypto[_0x47de('0x8')](_0x47de('0x10'),config[_0x47de('0x11')]['session']);var _0xe03c29=_0x650764[_0x47de('0xa')](_0x1765fa,_0x47de('0x12'),_0x47de('0xb'));_0xe03c29+=_0x650764[_0x47de('0xc')]('utf8');_0x20a566[_0x47de('0x13')]=_0xe03c29;_0x20a566[_0x47de('0x14')]=moment(_0xe03c29)[_0x47de('0x15')](0x7,'days')[_0x47de('0x16')]();_0x20a566[_0x47de('0x17')]=_0x20a566[_0x47de('0x18')]!=_0x20a566[_0x47de('0x19')]?'changed':_0x47de('0x1a');}return _0x20a566;}catch(_0x15a275){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x47de('0x1b'),'uuid':_0x10a014[_0x47de('0x1c')],'machineUuid':hardware['getUuid'](),'message':_0x15a275['message'],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x47de('0x1d'),'uuid':_0x10a014[_0x47de('0x1c')],'machineUuid':hardware[_0x47de('0xf')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0x47de('0x1e')]=function(_0x2e922f){return db['License'][_0x47de('0x1f')](_['defaults'](_0x2e922f,{'raw':!![],'where':{'id':0x1}}))[_0x47de('0x20')](function(_0x3e66fa){return checkLicense(_0x3e66fa,null);});};exports[_0x47de('0x21')]=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index ab28024..71a79e3 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 _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 +var _0xca3a=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x5a227d,_0x220692){var _0x1033f1=function(_0x1baa0d){while(--_0x1baa0d){_0x5a227d['push'](_0x5a227d['shift']());}};_0x1033f1(++_0x220692);}(_0xca3a,0x78));var _0xaca3=function(_0x2c2839,_0x1d1d47){_0x2c2839=_0x2c2839-0x0;var _0x224936=_0xca3a[_0x2c2839];return _0x224936;};'use strict';module[_0xaca3('0x0')]={'DOMAIN':_0xaca3('0x1'),'SESSION_SECRET':_0xaca3('0x2'),'GOOGLE_ID':_0xaca3('0x3'),'GOOGLE_SECRET':_0xaca3('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 725b825..258a755 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0xfe58=['moment','INFO','join','log','xcally','format','%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','exports','Logger','transports','%s-%s','error','info','Console','env'];(function(_0x476d18,_0x4d5d3a){var _0x670eef=function(_0x126d4a){while(--_0x126d4a){_0x476d18['push'](_0x476d18['shift']());}};_0x670eef(++_0x4d5d3a);}(_0xfe58,0x104));var _0x8fe5=function(_0x5e3b21,_0x2e2cc4){_0x5e3b21=_0x5e3b21-0x0;var _0x391d00=_0xfe58[_0x5e3b21];return _0x391d00;};'use strict';var moment=require(_0x8fe5('0x0'));var winston=require('winston');var util=require('util');var path=require('path');var debugLevel=_0x8fe5('0x1');function filename(_0x4a9541,_0x2c8276){return path[_0x8fe5('0x2')]('/var',_0x8fe5('0x3'),_0x8fe5('0x4'),util[_0x8fe5('0x5')](_0x8fe5('0x6'),_0x4a9541,_0x2c8276));}function formatter(_0x162f93,_0x35fdfe){return util[_0x8fe5('0x5')](_0x8fe5('0x7'),moment()['format'](_0x8fe5('0x8')),_0x35fdfe[_0x8fe5('0x9')][_0x8fe5('0xa')](),_0x162f93,_0x35fdfe[_0x8fe5('0xb')]);}module[_0x8fe5('0xc')]=function(_0x2d674a){return new winston[(_0x8fe5('0xd'))]({'transports':[new winston[(_0x8fe5('0xe'))]['File']({'name':util[_0x8fe5('0x5')](_0x8fe5('0xf'),_0x2d674a,_0x8fe5('0x10')),'filename':filename(_0x2d674a,_0x8fe5('0x10')),'level':_0x8fe5('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x42c3c3){return formatter(_0x2d674a,_0x42c3c3);}}),new winston[(_0x8fe5('0xe'))]['File']({'name':util[_0x8fe5('0x5')](_0x8fe5('0xf'),_0x2d674a,_0x8fe5('0x11')),'filename':filename(_0x2d674a,_0x8fe5('0x11')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x234325){return formatter(_0x2d674a,_0x234325);}}),new winston[(_0x8fe5('0xe'))][(_0x8fe5('0x12'))]({'level':process[_0x8fe5('0x13')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x3c6d43){return formatter(_0x2d674a,_0x3c6d43);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index c8ee662..b5e8de4 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 _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 +var _0x3040=['exports','express','join','ami','../../services/ami/index.js','agi','../../services/agi/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js'];(function(_0x7781d3,_0x2ca0fb){var _0x169456=function(_0x28b1bb){while(--_0x28b1bb){_0x7781d3['push'](_0x7781d3['shift']());}};_0x169456(++_0x2ca0fb);}(_0x3040,0x6f));var _0x0304=function(_0x281b72,_0x41a005){_0x281b72=_0x281b72-0x0;var _0x1443dc=_0x3040[_0x281b72];return _0x1443dc;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x0304('0x0'),'script':path[_0x0304('0x1')](__dirname,'../../services/express/index.js')},{'name':_0x0304('0x2'),'script':path[_0x0304('0x1')](__dirname,_0x0304('0x3'))},{'name':_0x0304('0x4'),'script':path[_0x0304('0x1')](__dirname,_0x0304('0x5'))},{'name':'email','script':path[_0x0304('0x1')](__dirname,'../../services/email/index.js')},{'name':_0x0304('0x6'),'script':path['join'](__dirname,_0x0304('0x7'))},{'name':'xdr','script':path[_0x0304('0x1')](__dirname,_0x0304('0x8'))}]};module[_0x0304('0x9')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 7206bfc..d61605c 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 _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 +var _0x6462=['disconnect','stop','restart','list','delete','dump','saved','pm2','bluebird','./config','connect','connected','start','then'];(function(_0x1e393b,_0x355f6b){var _0x3d0bfe=function(_0x320830){while(--_0x320830){_0x1e393b['push'](_0x1e393b['shift']());}};_0x3d0bfe(++_0x355f6b);}(_0x6462,0x11f));var _0x2646=function(_0x25660f,_0x51ecde){_0x25660f=_0x25660f-0x0;var _0x358722=_0x6462[_0x25660f];return _0x358722;};'use strict';var pm2=require(_0x2646('0x0'));var BPromise=require(_0x2646('0x1'));var config=require(_0x2646('0x2'));function connect(){return new BPromise(function(_0x191bd7,_0x49dbe3){return pm2[_0x2646('0x3')](function(_0x888ca2){if(_0x888ca2){return _0x49dbe3(_0x888ca2);}return _0x191bd7(_0x2646('0x4'));});});};exports[_0x2646('0x5')]=function(_0x34c686){return connect()[_0x2646('0x6')](function(){return new BPromise(function(_0x301b01,_0x482618){return pm2['start'](_0x34c686,function(_0x9024f4,_0x3cac63){if(_0x9024f4){return _0x482618(_0x9024f4);}pm2[_0x2646('0x7')]();return _0x301b01(_0x3cac63);});});});};exports['stop']=function(_0x22796c){return connect()[_0x2646('0x6')](function(){return new BPromise(function(_0x42f167,_0x2eda4d){return pm2[_0x2646('0x8')](_0x22796c,function(_0x19a547,_0x5b666d){if(_0x19a547){return _0x2eda4d(_0x19a547);}pm2[_0x2646('0x7')]();return _0x42f167(_0x5b666d);});});});};exports[_0x2646('0x9')]=function(_0x50aa72){return connect()[_0x2646('0x6')](function(){return new BPromise(function(_0x4b4023,_0x3a3daf){return pm2[_0x2646('0x9')](_0x50aa72,function(_0x17aca,_0x3ea81f){if(_0x17aca){return _0x3a3daf(_0x17aca);}pm2['disconnect']();return _0x4b4023(_0x3ea81f);});});});};exports[_0x2646('0xa')]=function(){return connect()['then'](function(){return new BPromise(function(_0x478b72,_0xa1b487){return pm2['list'](function(_0x1727ce,_0x8bcc76){if(_0x1727ce){return _0xa1b487(_0x1727ce);}pm2[_0x2646('0x7')]();return _0x478b72(_0x8bcc76);});});});};exports['describe']=function(_0x593642){return connect()[_0x2646('0x6')](function(){return new BPromise(function(_0x19a4a1,_0x52914d){return pm2['describe'](_0x593642,function(_0x477528,_0x29d0e6){if(_0x477528){return _0x52914d(_0x477528);}pm2[_0x2646('0x7')]();return _0x19a4a1(_0x29d0e6);});});});};exports[_0x2646('0xb')]=function(_0xd3e3f5){return connect()[_0x2646('0x6')](function(){return new BPromise(function(_0x45d577,_0x24cd8c){return pm2[_0x2646('0xb')](_0xd3e3f5,function(_0x2c0339,_0x20850f){if(_0x2c0339){return _0x24cd8c(_0x2c0339);}pm2['disconnect']();return _0x45d577(_0x20850f);});});});};exports['dump']=function(){return connect()['then'](function(){return new BPromise(function(_0x12dcf4,_0x297887){return pm2[_0x2646('0xc')](function(_0x36ee19){if(_0x36ee19){return _0x297887(_0x36ee19);}return _0x12dcf4(_0x2646('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 55851ff..03ea121 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 _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 +var _0xcc0b=['lodash','../../mysqldb','../../config/environment','redis','defaults','localhost','socket.io-emitter','Setting','find','then','chatTimeout','ChatInteraction','findAll','minutes','system','timeout','format','map','length','chatInteraction:update','catch','error','start'];(function(_0x3151ac,_0x364f57){var _0x2f9707=function(_0x3bdbb8){while(--_0x3bdbb8){_0x3151ac['push'](_0x3151ac['shift']());}};_0x2f9707(++_0x364f57);}(_0xcc0b,0x12b));var _0xbcc0=function(_0x38d6e8,_0x21c3b9){_0x38d6e8=_0x38d6e8-0x0;var _0x37e27f=_0xcc0b[_0x38d6e8];return _0x37e27f;};'use strict';var _=require(_0xbcc0('0x0'));var moment=require('moment');var Redis=require('ioredis');var db=require(_0xbcc0('0x1'))['db'];var config=require(_0xbcc0('0x2'));config[_0xbcc0('0x3')]=_[_0xbcc0('0x4')](config[_0xbcc0('0x3')],{'host':_0xbcc0('0x5'),'port':0x18eb});var io=require(_0xbcc0('0x6'))(new Redis(config[_0xbcc0('0x3')]));function closeInteractions(){var _0x3d4ae0=0x0;var _0x2174ed=[];return db[_0xbcc0('0x7')][_0xbcc0('0x8')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xbcc0('0x9')](function(_0x380c92){_0x3d4ae0=_0x380c92[_0xbcc0('0xa')];if(_0x3d4ae0){return db[_0xbcc0('0xb')][_0xbcc0('0xc')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x380c92[_0xbcc0('0xa')],_0xbcc0('0xd'))}}});}else{return[];}})[_0xbcc0('0x9')](function(_0x59d8d5){_0x2174ed=_0x59d8d5;if(_0x3d4ae0){return db[_0xbcc0('0xb')]['update']({'closeReason':_0xbcc0('0xe'),'disposition':_0xbcc0('0xf'),'closed':!![],'closedAt':moment()[_0xbcc0('0x10')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_[_0xbcc0('0x11')](_0x2174ed||[],'id')}});}})['then'](function(_0x44cc3d){for(var _0x5054fd=0x0;_0x5054fd<_0x2174ed[_0xbcc0('0x12')];_0x5054fd++){io['emit'](_0xbcc0('0x13'),{'id':_0x2174ed[_0x5054fd]['id'],'closed':!![]});}})[_0xbcc0('0x14')](function(_0xad7d2d){console[_0xbcc0('0x15')](_0xad7d2d);});}exports[_0xbcc0('0x16')]=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 bfc3bba..1c0a663 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 _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 +var _0xa32b=['error','error\x20mail','data','isNil','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','keys','jobs','map','keyBy','toString','intersection','difference','length','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','exists','stop\x20cron','run','util','path','lodash','cron-job-manager','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','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','subtractNumber','subtractUnit','join','../../files/reports','savename','basename','zip','existsSync','status','Sent','message','text','stringify','attachments','empty\x20file,\x20email\x20not\x20sent','request','then','email\x20sent'];(function(_0x5effa2,_0x52a5d1){var _0x126eb2=function(_0x218406){while(--_0x218406){_0x5effa2['push'](_0x5effa2['shift']());}};_0x126eb2(++_0x52a5d1);}(_0xa32b,0x7e));var _0xba32=function(_0x405dc0,_0x5f2898){_0x405dc0=_0x405dc0-0x0;var _0x1ed46d=_0xa32b[_0x405dc0];return _0x1ed46d;};'use strict';var fs=require('fs');var util=require(_0xba32('0x0'));var path=require(_0xba32('0x1'));var _=require(_0xba32('0x2'));var moment=require('moment');var CronJobManager=require(_0xba32('0x3'));var jayson=require(_0xba32('0x4'));var BPromise=require('bluebird');var logger=require(_0xba32('0x5'))(_0xba32('0x6'));var db=require(_0xba32('0x7'))['db'];var analyticCustomReportController=require(_0xba32('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xba32('0x9')][_0xba32('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x24d8ff,_0x136c26){return function(){logger[_0xba32('0xb')](_0xba32('0xc'),_0x24d8ff[_0xba32('0xd')]);var _0xc99798=!![];var _0x15ecfd={'tls':{'rejectUnauthorized':![]}};if(_0x24d8ff[_0xba32('0xe')][_0xba32('0xf')][_0xba32('0x10')]){_0x15ecfd[_0xba32('0x10')]=_0x24d8ff[_0xba32('0xe')]['Smtp'][_0xba32('0x10')];}else{_0x15ecfd[_0xba32('0x11')]=_0x24d8ff['MailAccount'][_0xba32('0xf')]['host'];_0x15ecfd[_0xba32('0x12')]=_0x24d8ff[_0xba32('0xe')][_0xba32('0xf')][_0xba32('0x12')];_0x15ecfd[_0xba32('0x13')]=_0x24d8ff[_0xba32('0xe')]['Smtp']['secure'];}if(_0x24d8ff[_0xba32('0xe')][_0xba32('0xf')][_0xba32('0x14')]){_0x15ecfd[_0xba32('0x15')]={'user':_0x24d8ff[_0xba32('0xe')]['Smtp'][_0xba32('0x16')],'pass':_0x24d8ff[_0xba32('0xe')][_0xba32('0xf')][_0xba32('0x17')]};}var _0x1327eb={'account':_0x15ecfd,'message':{'from':util[_0xba32('0x18')](_0xba32('0x19'),_0x24d8ff[_0xba32('0xe')][_0xba32('0x1a')],_0x24d8ff['MailAccount'][_0xba32('0xd')]||_0x24d8ff[_0xba32('0xe')][_0xba32('0xf')]['user']),'to':_0x24d8ff['email'],'cc':_0x24d8ff['cc'],'bcc':_0x24d8ff[_0xba32('0x1b')],'subject':util[_0xba32('0x18')]('Report\x20%s\x20last\x20%s\x20%s',_0x136c26[_0xba32('0x1a')],_0x24d8ff[_0xba32('0x1c')],_0x24d8ff[_0xba32('0x1d')])}};var _0x372b6b=path[_0xba32('0x1e')](__dirname,_0xba32('0x1f'));var _0x5b59e2=_0x136c26[_0xba32('0x20')];var _0x2cf923=util[_0xba32('0x18')]('%s.%s',path[_0xba32('0x21')](_0x136c26[_0xba32('0x20')],path['extname'](_0x136c26[_0xba32('0x20')])),_0xba32('0x22'));var _0x3f1f60=path[_0xba32('0x1e')](_0x372b6b,_0x5b59e2);var _0x1e0069=path[_0xba32('0x1e')](_0x372b6b,_0x2cf923);if(fs[_0xba32('0x23')](_0x3f1f60)){_0x136c26[_0xba32('0x24')]=_0xba32('0x25');_0x1327eb[_0xba32('0x26')]['attachments']=[{'filename':_0x5b59e2,'path':_0x3f1f60}];_0x1327eb[_0xba32('0x26')][_0xba32('0x27')]=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xba32('0x28')](_0x136c26,null,0x2));}else if(fs['existsSync'](_0x1e0069)){_0x136c26['status']=_0xba32('0x25');_0x1327eb[_0xba32('0x26')][_0xba32('0x29')]=[{'filename':_0x2cf923,'path':_0x1e0069}];}else{_0x1327eb[_0xba32('0x26')][_0xba32('0x27')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x24d8ff['sendIfEmpty']){_0xc99798=![];logger[_0xba32('0xb')](_0xba32('0x2a'));}}if(_0xc99798){return client[_0xba32('0x2b')]('SendMail',_0x1327eb)[_0xba32('0x2c')](function(_0x23080a){if(_0x23080a['error']){return logger['error']('error\x20mail',JSON[_0xba32('0x28')](_0x23080a));}return logger[_0xba32('0xb')](_0xba32('0x2d'));})['catch'](function(_0x129f22){return logger[_0xba32('0x2e')](_0xba32('0x2f'),JSON['stringify'](_0x129f22));});}};}function handleError(){return function(_0x48d5d7){return logger[_0xba32('0x2e')](JSON['stringify'](_0x48d5d7));};}function handleResult(_0x49101d){return function(_0x5bf1d0){logger[_0xba32('0xb')](_0xba32('0x30'),JSON[_0xba32('0x28')](_0x5bf1d0));if(_0x49101d['MailAccount']&&_0x49101d[_0xba32('0xe')]['Smtp']&&!_[_0xba32('0x31')](_0x49101d[_0xba32('0xd')])){setTimeout(handleSendEmail(_0x49101d,_0x5bf1d0),0x3c*0x3e8);}};}function handleJob(_0x7df9e2){return function(){try{if(_[_0xba32('0x31')](_0x7df9e2['subtractNumber'])){return logger[_0xba32('0xb')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xba32('0x31')](_0x7df9e2[_0xba32('0x1d')])){return logger[_0xba32('0xb')]('subtractUnit\x20null\x20or\x20undefined');}var _0x3b8c86={'startDate':moment()['subtract'](_0x7df9e2['subtractNumber'],_0x7df9e2[_0xba32('0x1d')])[_0xba32('0x18')](_0xba32('0x32')),'endDate':moment()[_0xba32('0x18')](_0xba32('0x32')),'type':'scheduled','output':_0x7df9e2[_0xba32('0x33')],'name':_0x7df9e2[_0xba32('0x1a')]};if(!_[_0xba32('0x31')](_0x7df9e2[_0xba32('0x34')])){logger['info'](_0xba32('0x35'),_0x7df9e2['DefaultReportId']);return analyticDefaultReportController[_0xba32('0x36')]({'id':_0x7df9e2[_0xba32('0x34')]},_0x3b8c86)[_0xba32('0x2c')](handleResult(_0x7df9e2))[_0xba32('0x37')](handleError());}if(!_['isNil'](_0x7df9e2[_0xba32('0x38')])){logger[_0xba32('0xb')](_0xba32('0x39'),_0x7df9e2['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x7df9e2[_0xba32('0x38')]},_0x3b8c86)['then'](handleResult(_0x7df9e2))['catch'](handleError());}}catch(_0x5cd0fb){logger['error'](JSON[_0xba32('0x28')](_0x5cd0fb));}return logger[_0xba32('0xb')](_0xba32('0x3a'));};}function getJobs(_0x13b0fb){var _0xce3e34={};if(_0x13b0fb){_0xce3e34['id']=_0x13b0fb;}return db[_0xba32('0x3b')][_0xba32('0x3c')]({'where':_0xce3e34,'include':[{'model':db[_0xba32('0xe')],'attributes':['id',_0xba32('0x1a'),_0xba32('0xd')],'include':[{'model':db['MailServerOut'],'as':_0xba32('0xf')}]}]})['then'](function(_0x324d0a){var _0x1caace=_[_0xba32('0x3d')](manager[_0xba32('0x3e')]);var _0x34dd7e=_[_0xba32('0x3f')](_0x324d0a,function(_0x4a8949){return _0x4a8949['id']['toString']();});var _0x32d31c=_[_0xba32('0x40')](_0x324d0a,function(_0xe4f83a){return _0xe4f83a['id'][_0xba32('0x41')]();});var _0x3373dd=_0x13b0fb?_0x34dd7e:_['difference'](_0x34dd7e,_0x1caace);var _0x2d160a=_[_0xba32('0x42')](_0x34dd7e,_0x1caace);var _0x1b0193=_[_0xba32('0x43')](_0x1caace,_0x34dd7e);var _0x256fbb;var _0xb2400;for(_0x256fbb=0x0;_0x256fbb<_0x1b0193[_0xba32('0x44')]&&!_0x13b0fb;_0x256fbb+=0x1){_0xb2400=_0x1b0193[_0x256fbb][_0xba32('0x41')]();if(manager['exists'](_0xb2400)){manager[_0xba32('0x45')](_0xb2400);manager[_0xba32('0x46')](_0xb2400);logger[_0xba32('0xb')](_0xba32('0x47'),_0xb2400);}}logger[_0xba32('0xb')](_0xba32('0x48'),JSON['stringify'](_0x3373dd));for(_0x256fbb=0x0;_0x256fbb<_0x3373dd[_0xba32('0x44')];_0x256fbb+=0x1){_0xb2400=_0x3373dd[_0x256fbb][_0xba32('0x41')]();logger[_0xba32('0xb')](_0xba32('0x49'),_0xb2400);if(_0x13b0fb){logger[_0xba32('0xb')](_0xba32('0x4a'),_0x13b0fb);logger[_0xba32('0xb')](JSON[_0xba32('0x28')](_0x32d31c[_0xb2400]));BPromise[_0xba32('0x4b')]()[_0xba32('0x2c')](handleJob(_0x32d31c[_0xb2400]));logger['info'](_0xba32('0x4c'),_0x32d31c[_0xb2400][_0xba32('0x1a')],_0x32d31c[_0xb2400][_0xba32('0x4d')]);}else if(_0x32d31c[_0xb2400][_0xba32('0x4d')]&&_0x32d31c[_0xb2400][_0xba32('0x4e')]&&moment()[_0xba32('0x4f')](_0x32d31c[_0xb2400][_0xba32('0x50')],_0x32d31c[_0xb2400][_0xba32('0x51')])){manager[_0xba32('0x52')](_0xb2400,_0x32d31c[_0xb2400][_0xba32('0x4d')],handleJob(_0x32d31c[_0xb2400]));manager['start'](_0xb2400);logger[_0xba32('0xb')]('add\x20cron',_0x32d31c[_0xb2400]['name'],_0x32d31c[_0xb2400][_0xba32('0x4d')]);}else if(manager[_0xba32('0x53')](_0xb2400)){manager['stop'](_0xb2400);manager['deleteJob'](_0xb2400);logger[_0xba32('0xb')](_0xba32('0x54'),_0x32d31c[_0xb2400][_0xba32('0x1a')],_0x32d31c[_0xb2400]['cron']);}}for(_0x256fbb=0x0,_0xb2400;_0x256fbb<_0x2d160a[_0xba32('0x44')]&&!_0x13b0fb;_0x256fbb+=0x1){_0xb2400=_0x2d160a[_0x256fbb]['toString']();if(manager[_0xba32('0x53')](_0xb2400)){if(_0x32d31c[_0xb2400][_0xba32('0x4d')]&&_0x32d31c[_0xb2400][_0xba32('0x4e')]&&moment()['isBetween'](_0x32d31c[_0xb2400][_0xba32('0x50')],_0x32d31c[_0xb2400][_0xba32('0x51')])){manager['update'](_0xb2400,_0x32d31c[_0xb2400][_0xba32('0x4d')],handleJob(_0x32d31c[_0xb2400]));logger['info']('update\x20cron',_0x32d31c[_0xb2400][_0xba32('0x1a')],_0x32d31c[_0xb2400]['cron']);}else{manager[_0xba32('0x45')](_0xb2400);manager[_0xba32('0x46')](_0xb2400);logger[_0xba32('0xb')](_0xba32('0x54'),_0x32d31c[_0xb2400]['name'],_0x32d31c[_0xb2400]['cron']);}}}})[_0xba32('0x37')](function(_0x55ff80){logger['error'](JSON[_0xba32('0x28')](_0x55ff80));});}exports[_0xba32('0x55')]=function(_0x5b7ace){return getJobs(_0x5b7ace);};exports['start']=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 17e65f7..97ecda8 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 _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 +var _0x512c=['bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','[RECORDING:%d]\x20Get\x20transcript','Transcript','TranscriptFileUri','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentimentRegion','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','data2','Positive','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','error','lodash','request-promise','util'];(function(_0x47c430,_0x3865e2){var _0x1258ab=function(_0x4d6744){while(--_0x4d6744){_0x47c430['push'](_0x47c430['shift']());}};_0x1258ab(++_0x3865e2);}(_0x512c,0xd8));var _0xc512=function(_0x2e9a63,_0x35f934){_0x2e9a63=_0x2e9a63-0x0;var _0x45764e=_0x512c[_0x2e9a63];return _0x45764e;};var _=require(_0xc512('0x0'));var AWS=require('aws-sdk');var rp=require(_0xc512('0x1'));var util=require(_0xc512('0x2'));var BPromise=require(_0xc512('0x3'));var db=require(_0xc512('0x4'))['db'];var logger=require(_0xc512('0x5'))(_0xc512('0x6'));function getTranscriptionJob(_0x4ff825,_0x489ee9,_0x2d9b15,_0x3ae325){return new Promise(function(_0x6381f7,_0x33aead){var _0x108195=new AWS[(_0xc512('0x7'))]({'accessKeyId':_0x489ee9,'secretAccessKey':_0x4ff825,'region':_0x2d9b15});_0x108195['getTranscriptionJob']({'TranscriptionJobName':_0x3ae325},function(_0x12506c,_0x54a93b){if(_0x12506c){return _0x33aead(_0x12506c);}else{return _0x6381f7(_0x54a93b);}});});}function sentiment(_0x2ae2ca,_0x5bf1b3,_0x2835f0,_0x4bb403,_0x3b8cd0){return new Promise(function(_0x11f501,_0x5eea1b){var _0x4bcb5f=new AWS[(_0xc512('0x8'))]({'accessKeyId':_0x5bf1b3,'secretAccessKey':_0x2ae2ca,'region':_0x2835f0});_0x4bcb5f[_0xc512('0x9')]({'Text':_0x4bb403,'LanguageCode':_0x3b8cd0[_0xc512('0xa')](0x0,0x2)},function(_0x4cd680,_0x2af908){if(_0x4cd680){return _0x5eea1b(_0x4cd680);}else{return _0x11f501(_0x2af908);}});});}function checkTranscribeJob(_0x4d77b6,_0x10ffe7,_0x26c5f4){var _0x1154e9;return new BPromise(function(_0x1ae961,_0x4f8cc9){logger[_0xc512('0xb')](util[_0xc512('0xc')](_0xc512('0xd'),_0x4d77b6['id'],_0x4d77b6[_0xc512('0xe')]));return getTranscriptionJob(_0x26c5f4[_0xc512('0xf')],_0x26c5f4['data2'],_0x10ffe7[_0xc512('0x10')],_0x4d77b6['transcribeName'])['then'](function(_0x28e8de){logger[_0xc512('0xb')](util[_0xc512('0xc')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x4d77b6['id'],_0x4d77b6['transcribeName'],_0x28e8de[_0xc512('0x11')][_0xc512('0x12')]));if(!_0x4d77b6[_0xc512('0x13')]){switch(_0x28e8de[_0xc512('0x11')][_0xc512('0x12')]){case _0xc512('0x14'):var _0x217884={'transcribeStatus':_0x28e8de['TranscriptionJob'][_0xc512('0x12')],'fileUri':_0x28e8de[_0xc512('0x11')]['Transcript']['TranscriptFileUri']};logger['info'](util[_0xc512('0xc')](_0xc512('0x15'),_0x4d77b6['id']));return rp({'uri':_0x28e8de[_0xc512('0x11')][_0xc512('0x16')][_0xc512('0x17')],'json':!![]})[_0xc512('0x18')](function(_0x3382fe){logger['info'](util[_0xc512('0xc')](_0xc512('0x19'),_0x4d77b6['id']));if(_0x3382fe&&_0x3382fe['results']&&_0x3382fe[_0xc512('0x1a')][_0xc512('0x1b')]&&_0x3382fe[_0xc512('0x1a')]['transcripts'][_0xc512('0x1c')]){_0x217884['fileText']='';for(var _0x4aee38=0x0;_0x4aee38<_0x3382fe['results'][_0xc512('0x1b')][_0xc512('0x1c')];_0x4aee38++){_0x217884[_0xc512('0x13')]+=_0x3382fe[_0xc512('0x1a')]['transcripts'][_0x4aee38]['transcript']+'';}}return _0x4d77b6[_0xc512('0x1d')](_0x217884);})[_0xc512('0x18')](function(){logger['info'](util[_0xc512('0xc')](_0xc512('0x1e'),_0x4d77b6['id']));if(!_0x4d77b6[_0xc512('0x1f')]){throw new db[(_0xc512('0x20'))]['ValidationError'](_0xc512('0x21'));}if(!_0x10ffe7['sentiment']||!_0x10ffe7['sentimentAccountId']||!_0x10ffe7[_0xc512('0x22')]||!_0x10ffe7[_0xc512('0x23')]||!_0x10ffe7[_0xc512('0x24')]){throw new db[(_0xc512('0x20'))][(_0xc512('0x25'))](_0xc512('0x26'));}if(!_0x217884['fileText']){throw new Error(_0xc512('0x27'));}if(_0x10ffe7[_0xc512('0x28')]===_0x26c5f4['id']){return _0x26c5f4;}else{return db[_0xc512('0x29')][_0xc512('0x2a')]({'where':{'id':_settings[_0xc512('0x28')]}});}})['then'](function(_0x67c55e){if(!_0x67c55e){throw new db[(_0xc512('0x20'))][(_0xc512('0x25'))](_0xc512('0x2b'));}if(!_0x67c55e[_0xc512('0xf')]||!_0x67c55e['data2']){throw new db[(_0xc512('0x20'))]['ValidationError'](_0xc512('0x2c'));}_0x1154e9=_0x67c55e;logger[_0xc512('0xb')](util[_0xc512('0xc')](_0xc512('0x2d'),_0x4d77b6['id']));return sentiment(_0x1154e9[_0xc512('0xf')],_0x1154e9['data2'],_0x10ffe7[_0xc512('0x22')],_0x217884[_0xc512('0x13')],_0x10ffe7[_0xc512('0x23')]);})[_0xc512('0x18')](function(_0x20f3c6){logger['info'](util[_0xc512('0xc')](_0xc512('0x2e'),_0x4d77b6['id']));return _0x4d77b6['update']({'sentiment':_0x20f3c6[_0xc512('0x2f')],'sPositive':_0x20f3c6[_0xc512('0x30')]['Positive'],'sNegative':_0x20f3c6[_0xc512('0x30')][_0xc512('0x31')],'sMixed':_0x20f3c6['SentimentScore'][_0xc512('0x32')],'sNeutral':_0x20f3c6[_0xc512('0x30')][_0xc512('0x33')]});})[_0xc512('0x18')](function(){logger['info'](util[_0xc512('0xc')](_0xc512('0x1e'),_0x4d77b6['id']));_0x1ae961();});case _0xc512('0x34'):return _0x4d77b6[_0xc512('0x1d')]({'transcribeStatus':'FAILED','failureReason':_0x28e8de[_0xc512('0x11')][_0xc512('0x35')]})[_0xc512('0x18')](function(){logger[_0xc512('0xb')](util['format'](_0xc512('0x1e'),_0x4d77b6['id']));_0x1ae961();});default:logger[_0xc512('0xb')](util[_0xc512('0xc')](_0xc512('0x36'),_0x4d77b6['id']));break;}}else{return BPromise[_0xc512('0x37')]()[_0xc512('0x18')](function(){if(!_0x4d77b6[_0xc512('0x1f')]){throw new db[(_0xc512('0x20'))][(_0xc512('0x25'))](_0xc512('0x21'));}if(!_0x10ffe7[_0xc512('0x38')]||!_0x10ffe7[_0xc512('0x28')]||!_0x10ffe7['sentimentRegion']||!_0x10ffe7[_0xc512('0x23')]||!_0x10ffe7[_0xc512('0x24')]){throw new db[(_0xc512('0x20'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x4d77b6[_0xc512('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x10ffe7[_0xc512('0x28')]===_0x26c5f4['id']){return _0x26c5f4;}else{return db[_0xc512('0x29')]['findOne']({'where':{'id':_settings[_0xc512('0x28')]}});}})[_0xc512('0x18')](function(_0x598cf9){if(!_0x598cf9){throw new db['Sequelize'][(_0xc512('0x25'))](_0xc512('0x2b'));}if(!_0x598cf9[_0xc512('0xf')]||!_0x598cf9[_0xc512('0x39')]){throw new db[(_0xc512('0x20'))][(_0xc512('0x25'))](_0xc512('0x2c'));}_0x1154e9=_0x598cf9;logger[_0xc512('0xb')](util[_0xc512('0xc')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4d77b6['id']));return sentiment(_0x1154e9[_0xc512('0xf')],_0x1154e9[_0xc512('0x39')],_0x10ffe7['sentimentRegion'],_0x4d77b6[_0xc512('0x13')],_0x10ffe7[_0xc512('0x23')]);})[_0xc512('0x18')](function(_0x49038a){logger['info'](util[_0xc512('0xc')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x4d77b6['id']));return _0x4d77b6[_0xc512('0x1d')]({'sentiment':_0x49038a[_0xc512('0x2f')],'sPositive':_0x49038a[_0xc512('0x30')][_0xc512('0x3a')],'sNegative':_0x49038a[_0xc512('0x30')][_0xc512('0x31')],'sMixed':_0x49038a[_0xc512('0x30')]['Mixed'],'sNeutral':_0x49038a[_0xc512('0x30')][_0xc512('0x33')],'transcribeStatus':_0xc512('0x14')});})[_0xc512('0x18')](function(){logger[_0xc512('0xb')](util[_0xc512('0xc')](_0xc512('0x1e'),_0x4d77b6['id']));_0x1ae961();});}})['catch'](function(_0x25028d){if(_0x25028d){if(!_0x25028d[_0xc512('0x3b')]||_0x25028d[_0xc512('0x3b')]!==_0xc512('0x3c')){logger['error'](util[_0xc512('0xc')](_0xc512('0x3d'),_0x4d77b6['id']),util[_0xc512('0x3e')](_0x25028d,{'showHidden':![],'depth':null}));}}_0x1ae961();});});}function checkTranscribe(){var _0x55f993;var _0x557cb6;var _0x3eee7c;return db[_0xc512('0x3f')][_0xc512('0x40')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xc512('0x18')](function(_0x120967){if(!_0x120967||!_0x120967[_0xc512('0x1c')]){throw new db[(_0xc512('0x20'))][(_0xc512('0x25'))](_0xc512('0x41'));}_0x55f993=_0x120967;return db['Setting'][_0xc512('0x2a')]({'where':{'id':0x1}});})[_0xc512('0x18')](function(_0x2804a9){if(!_0x2804a9){throw new db[(_0xc512('0x20'))][(_0xc512('0x25'))](_0xc512('0x42'));}_0x557cb6=_0x2804a9;if(!_0x557cb6[_0xc512('0x6')]||!_0x557cb6[_0xc512('0x43')]||!_0x557cb6[_0xc512('0x10')]||!_0x557cb6[_0xc512('0x23')]||!_0x557cb6[_0xc512('0x24')]){throw new db[(_0xc512('0x20'))][(_0xc512('0x25'))](_0xc512('0x44'));}return db[_0xc512('0x29')]['findOne']({'where':{'id':_0x557cb6[_0xc512('0x43')]}});})[_0xc512('0x18')](function(_0x2c1026){if(!_0x2c1026){throw new db[(_0xc512('0x20'))][(_0xc512('0x25'))](_0xc512('0x2b'));}if(!_0x2c1026['data1']||!_0x2c1026['data2']){throw new db['Sequelize'][(_0xc512('0x25'))](_0xc512('0x2c'));}_0x3eee7c=_0x2c1026;var _0x2192d1=[];_0x55f993[_0xc512('0x45')](function(_0x1576b3){_0x2192d1[_0xc512('0x46')](checkTranscribeJob(_0x1576b3,_0x557cb6,_0x3eee7c));});return BPromise[_0xc512('0x47')](_0x2192d1);})['catch'](function(_0x2e7f43){if(_0x2e7f43){if(!_0x2e7f43[_0xc512('0x3b')]||_0x2e7f43['name']!==_0xc512('0x3c')){logger[_0xc512('0x48')](util[_0xc512('0x3e')](_0x2e7f43,{'showHidden':![],'depth':null}));}}});}exports['start']=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 8c3129d..60ac214 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x039b=['CmContact','destroy','then','log','finished\x20populating','contacts1','CmHopper','bulkCreate','hopper1','hopper2','util','../mysqldb','Innocenzo','Biondo','innocenzo.biondo','push','now','@xcally.com'];(function(_0x5f363e,_0x5c29e8){var _0x263a9f=function(_0x5eec9a){while(--_0x5eec9a){_0x5f363e['push'](_0x5f363e['shift']());}};_0x263a9f(++_0x5c29e8);}(_0x039b,0x1ba));var _0xb039=function(_0x21d685,_0x18a5e5){_0x21d685=_0x21d685-0x0;var _0x49f3c9=_0x039b[_0x21d685];return _0x49f3c9;};'use strict';var util=require(_0xb039('0x0'));var db=require(_0xb039('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0xb039('0x2')+i,'lastName':_0xb039('0x3')+i,'phone':0xf879fb460+i,'email':_0xb039('0x4')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xb039('0x5')]({'id':i,'active':![],'scheduledat':Date[_0xb039('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xb039('0x6')](),'updatedAt':Date[_0xb039('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xb039('0x5')]({'id':i,'firstName':_0xb039('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xb039('0x4')+i+_0xb039('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xb039('0x5')]({'id':i,'active':![],'scheduledat':Date[_0xb039('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xb039('0x6')](),'updatedAt':Date[_0xb039('0x6')]()});}db[_0xb039('0x8')][_0xb039('0x9')]({'where':{}})[_0xb039('0xa')](function(){return db[_0xb039('0x8')]['bulkCreate'](contacts);})[_0xb039('0xa')](function(){console[_0xb039('0xb')](_0xb039('0xc'),_0xb039('0xd'));return db[_0xb039('0xe')]['destroy']({'where':{}});})[_0xb039('0xa')](function(){return db['CmHopper'][_0xb039('0xf')](hopper);})[_0xb039('0xa')](function(){console['log'](_0xb039('0xc'),_0xb039('0x10'));return db[_0xb039('0x8')][_0xb039('0xf')](contacts2);})['then'](function(){console[_0xb039('0xb')](_0xb039('0xc'),'contacts2');return db[_0xb039('0xe')][_0xb039('0xf')](hopper2);})[_0xb039('0xa')](function(){console[_0xb039('0xb')]('finished\x20populating',_0xb039('0x11'));})['catch'](function(_0x1fc9a7){console[_0xb039('0xb')](_0x1fc9a7);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index bf75075..d227f2b 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x5463=['%s%s','agent','format','%s%s@xcally.com','friend','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','catch','util','../mysqldb','push'];(function(_0x455a8b,_0x9c2d5e){var _0x5de887=function(_0x57d8e1){while(--_0x57d8e1){_0x455a8b['push'](_0x455a8b['shift']());}};_0x5de887(++_0x9c2d5e);}(_0x5463,0x18c));var _0x3546=function(_0x12bcd7,_0x10acb1){_0x12bcd7=_0x12bcd7-0x0;var _0x51b78d=_0x5463[_0x12bcd7];return _0x51b78d;};'use strict';var util=require(_0x3546('0x0'));var db=require(_0x3546('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x3546('0x2')]({'name':util['format'](_0x3546('0x3'),'agent',i),'fullname':util['format']('%s%s',_0x3546('0x4'),i),'email':util[_0x3546('0x5')](_0x3546('0x6'),_0x3546('0x4'),i),'role':_0x3546('0x4'),'password':'password','internal':0xfa0+i,'type':_0x3546('0x7'),'transport':['udp','ws',_0x3546('0x8')],'disallow':[_0x3546('0x9')],'allow':[_0x3546('0xa')],'defaultuser':util[_0x3546('0x5')](_0x3546('0x3'),_0x3546('0x4'),i),'encryption':'yes','avpf':_0x3546('0xb'),'force_avp':_0x3546('0xb'),'icesupport':_0x3546('0xb'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x3546('0xc'),'dtlsprivatekey':_0x3546('0xd'),'dtlssetup':_0x3546('0xe'),'callerid':util[_0x3546('0x5')](_0x3546('0xf'),util[_0x3546('0x5')](_0x3546('0x3'),_0x3546('0x4'),i),0xfa0+i)});}db['User'][_0x3546('0x10')](users)[_0x3546('0x11')](function(){console['log']('add\x20user');})[_0x3546('0x12')](function(_0x107c4c){console['log'](_0x107c4c);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index aea3aca..fde5224 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x534d=['user_has_fax_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','setMaxListeners','address','request','connection','remoteAddress','remotePort','connectedAt','log','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','where','Campaign','%s:queue:%s','user:%s','handshake','query','userProfileId','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','format','admin','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','ChatQueue','push','SmsQueue','MailQueue','OpenchannelQueue','Trunk','FaxQueue','WhatsappQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','length','voice','chat','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','map','user_has_mail_interactions:remove','FaxInteractions'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x534d,0x79));var _0xd534=function(_0x3f8feb,_0x159af2){_0x3f8feb=_0x3f8feb-0x0;var _0x577ff2=_0x534d[_0x3f8feb];return _0x577ff2;};'use strict';var _=require(_0xd534('0x0'));var util=require(_0xd534('0x1'));var BPromise=require(_0xd534('0x2'));var db=require(_0xd534('0x3'))['db'];var config=require(_0xd534('0x4'));var queryQueues={'attributes':['id',_0xd534('0x5')],'include':[{'as':_0xd534('0x6'),'model':db[_0xd534('0x7')],'attributes':['id',_0xd534('0x5'),_0xd534('0x8')],'raw':!![],'where':{'role':_0xd534('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xd534('0x5')],'where':{'role':_0xd534('0xa')}};var queryTrunks={'raw':!![],'attributes':['id',_0xd534('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0xd534('0x5')],'where':{'role':_0xd534('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xd534('0x5'),_0xd534('0xb')],'where':{'type':_0xd534('0xc')}};function getAssociatedResources(_0x49c1fb,_0x3da8e0,_0x37a2c8){return db[_0xd534('0xd')][_0xd534('0xe')]({'where':{'name':_0x49c1fb,'userProfileId':_0x3da8e0},'raw':!![]})[_0xd534('0xf')](function(_0x4a8c5a){if(_0x4a8c5a){if(_0x4a8c5a[_0xd534('0x10')]){switch(_0x49c1fb){case _0xd534('0x11'):case _0xd534('0x12'):case _0xd534('0x13'):case _0xd534('0x14'):case _0xd534('0x15'):case _0xd534('0x16'):case _0xd534('0x17'):return db[_0x37a2c8]['findAll'](queryQueues);case'Telephones':return db[_0x37a2c8][_0xd534('0x18')](queryTelephones);case _0xd534('0x19'):return db[_0x37a2c8][_0xd534('0x18')](queryTrunks);case _0xd534('0x1a'):return db[_0x37a2c8][_0xd534('0x18')](queryCampaigns);}}else{return db[_0xd534('0x1b')][_0xd534('0x18')]({'attributes':[_0xd534('0x1c')],'where':{'sectionId':_0x4a8c5a['id']},'raw':!![]})[_0xd534('0xf')](function(_0x1ec85f){if(_0x1ec85f){var _0x502c61={'where':{'id':_['map'](_0x1ec85f,_0xd534('0x1c'))},'raw':!![]};switch(_0x37a2c8){case _0xd534('0x7'):_0x502c61[_0xd534('0x1d')]['role']='telephone';break;case _0xd534('0x1e'):_0x502c61[_0xd534('0x1d')][_0xd534('0xb')]=_0xd534('0xc');break;}return db[_0x37a2c8]['findAll'](_0x502c61);}else{return[];}});}}else{return[];}})['then'](function(_0x354ea4){return _0x354ea4;});}function joinOrLeaveQueues(_0x65672f,_0x48d7b5,_0x5e4270,_0xde7071){_0x65672f[_0x48d7b5](util['format'](_0xd534('0x1f'),_0x5e4270,_0xde7071[_0xd534('0x5')]));if(_0xde7071[_0xd534('0x6')]){for(var _0x4464d3=0x0;_0x4464d3<_0xde7071[_0xd534('0x6')]['length'];_0x4464d3+=0x1){_0x65672f[_0x48d7b5](util['format'](_0xd534('0x20'),_0xde7071['Agents'][_0x4464d3][_0xd534('0x5')]));}}}function joinOrLeave(_0x123ec9,_0x4d139f,_0x3138f6){var _0x38681b;if(_0x123ec9[_0xd534('0x21')][_0xd534('0x22')]['id']){db['User']['find']({'attributes':['id',_0xd534('0x5'),_0xd534('0x8'),_0xd534('0x23')],'where':{'id':_0x123ec9['handshake'][_0xd534('0x22')]['id']},'include':[{'model':db[_0xd534('0x24')],'as':_0xd534('0x25'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xd534('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xd534('0x27')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xd534('0x28')],'as':_0xd534('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xd534('0x2a')],'as':_0xd534('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0xd534('0x2c')],'as':_0xd534('0x2d'),'attributes':['id'],'raw':!![]}]})['then'](function(_0xf3da75){if(_0xf3da75){_0x38681b=_0xf3da75;_0x123ec9[_0x4d139f](util[_0xd534('0x2e')](_0xd534('0x20'),_0xf3da75[_0xd534('0x5')]));var _0x12692c=[];switch(_0xf3da75[_0xd534('0x8')]){case _0xd534('0x2f'):_0x123ec9[_0x4d139f](_0xd534('0x30'));_0x123ec9[_0x4d139f](_0xd534('0x31'));if(queryQueues[_0xd534('0x32')](_0xd534('0x33'))){delete queryQueues[_0xd534('0x33')];}_0x12692c['push'](db[_0xd534('0x34')][_0xd534('0x18')](queryQueues));_0x12692c['push'](db[_0xd534('0x35')][_0xd534('0x18')](queryQueues));_0x12692c['push'](db['FaxQueue']['findAll'](queryQueues));_0x12692c[_0xd534('0x36')](db[_0xd534('0x37')]['findAll'](queryQueues));_0x12692c[_0xd534('0x36')](db[_0xd534('0x38')][_0xd534('0x18')](queryQueues));_0x12692c['push'](db[_0xd534('0x39')][_0xd534('0x18')](queryQueues));_0x12692c[_0xd534('0x36')](db['WhatsappQueue'][_0xd534('0x18')](queryQueues));_0x12692c[_0xd534('0x36')](db[_0xd534('0x7')]['findAll'](queryTelephones));_0x12692c[_0xd534('0x36')](db[_0xd534('0x3a')]['findAll'](queryTrunks));_0x12692c[_0xd534('0x36')](db[_0xd534('0x1e')][_0xd534('0x18')](queryCampaigns));_0x12692c[_0xd534('0x36')](db['User'][_0xd534('0x18')](queryAgents));break;case'user':_0x123ec9[_0x4d139f]('voice:inbound');_0x123ec9[_0x4d139f]('voice:outbound');_0x12692c[_0xd534('0x36')](getAssociatedResources(_0xd534('0x11'),_0xf3da75[_0xd534('0x23')],_0xd534('0x34')));_0x12692c['push'](getAssociatedResources('ChatQueues',_0xf3da75[_0xd534('0x23')],_0xd534('0x35')));_0x12692c[_0xd534('0x36')](getAssociatedResources(_0xd534('0x13'),_0xf3da75[_0xd534('0x23')],_0xd534('0x3b')));_0x12692c['push'](getAssociatedResources(_0xd534('0x14'),_0xf3da75['userProfileId'],_0xd534('0x37')));_0x12692c[_0xd534('0x36')](getAssociatedResources(_0xd534('0x15'),_0xf3da75[_0xd534('0x23')],_0xd534('0x38')));_0x12692c['push'](getAssociatedResources(_0xd534('0x16'),_0xf3da75['userProfileId'],_0xd534('0x39')));_0x12692c[_0xd534('0x36')](getAssociatedResources(_0xd534('0x17'),_0xf3da75[_0xd534('0x23')],_0xd534('0x3c')));_0x12692c['push'](getAssociatedResources('Telephones',_0xf3da75[_0xd534('0x23')],_0xd534('0x7')));_0x12692c[_0xd534('0x36')](getAssociatedResources(_0xd534('0x19'),_0xf3da75[_0xd534('0x23')],_0xd534('0x3a')));_0x12692c[_0xd534('0x36')](getAssociatedResources(_0xd534('0x1a'),_0xf3da75['userProfileId'],_0xd534('0x1e')));_0x12692c[_0xd534('0x36')](db[_0xd534('0x7')]['findAll'](queryAgents));break;case'agent':_0x123ec9[_0x4d139f](_0xd534('0x30'));_0x123ec9[_0x4d139f](_0xd534('0x31'));_0x12692c['push'](_0xf3da75[_0xd534('0x3d')]({'attributes':['id','name']}));_0x12692c[_0xd534('0x36')](_0xf3da75[_0xd534('0x3e')]({'attributes':['id',_0xd534('0x5')]}));_0x12692c['push'](_0xf3da75[_0xd534('0x3f')]({'attributes':['id',_0xd534('0x5')]}));_0x12692c[_0xd534('0x36')](_0xf3da75[_0xd534('0x40')]({'attributes':['id',_0xd534('0x5')]}));_0x12692c[_0xd534('0x36')](_0xf3da75[_0xd534('0x41')]({'attributes':['id',_0xd534('0x5')]}));_0x12692c[_0xd534('0x36')](_0xf3da75[_0xd534('0x42')]({'attributes':['id','name']}));_0x12692c['push'](_0xf3da75['getWhatsappQueues']({'attributes':['id',_0xd534('0x5')]}));break;}return BPromise[_0xd534('0x43')](_0x12692c);}})[_0xd534('0xf')](function(_0x35063e){if(_0x35063e&&_0x35063e[_0xd534('0x44')]){for(var _0x9dbaec=0x0;_0x9dbaec<_0x35063e['length'];_0x9dbaec+=0x1){for(var _0x3ee60a=0x0;_0x3ee60a<_0x35063e[_0x9dbaec]['length'];_0x3ee60a+=0x1){switch(_0x9dbaec){case 0x0:joinOrLeaveQueues(_0x123ec9,_0x4d139f,_0xd534('0x45'),_0x35063e[_0x9dbaec][_0x3ee60a]);break;case 0x1:joinOrLeaveQueues(_0x123ec9,_0x4d139f,_0xd534('0x46'),_0x35063e[_0x9dbaec][_0x3ee60a]);break;case 0x2:joinOrLeaveQueues(_0x123ec9,_0x4d139f,'fax',_0x35063e[_0x9dbaec][_0x3ee60a]);break;case 0x3:joinOrLeaveQueues(_0x123ec9,_0x4d139f,_0xd534('0x47'),_0x35063e[_0x9dbaec][_0x3ee60a]);break;case 0x4:joinOrLeaveQueues(_0x123ec9,_0x4d139f,_0xd534('0x48'),_0x35063e[_0x9dbaec][_0x3ee60a]);break;case 0x5:joinOrLeaveQueues(_0x123ec9,_0x4d139f,_0xd534('0x49'),_0x35063e[_0x9dbaec][_0x3ee60a]);break;case 0x6:joinOrLeaveQueues(_0x123ec9,_0x4d139f,_0xd534('0x4a'),_0x35063e[_0x9dbaec][_0x3ee60a]);break;case 0x7:_0x123ec9[_0x4d139f](util['format'](_0xd534('0x4b'),_0x35063e[_0x9dbaec][_0x3ee60a][_0xd534('0x5')]));break;case 0x8:_0x123ec9[_0x4d139f](util[_0xd534('0x2e')](_0xd534('0x4c'),_0x35063e[_0x9dbaec][_0x3ee60a][_0xd534('0x5')]));break;case 0x9:_0x123ec9[_0x4d139f](util[_0xd534('0x2e')](_0xd534('0x4d'),_0x35063e[_0x9dbaec][_0x3ee60a]['type'],_0x35063e[_0x9dbaec][_0x3ee60a]['name']));break;case 0xa:_0x123ec9[_0x4d139f](util[_0xd534('0x2e')](_0xd534('0x20'),_0x35063e[_0x9dbaec][_0x3ee60a]['name']));break;}}}}})['then'](function(){if(_0x4d139f==='leave'){var _0x17c87d=_['map'](_0x38681b[_0xd534('0x25')],'id');return _0x38681b[_0xd534('0x4e')](_0x17c87d)[_0xd534('0xf')](function(){for(var _0x688c14=0x0;_0x688c14<_0x17c87d['length'];_0x688c14+=0x1){_0x3138f6[_0xd534('0x4f')](_0xd534('0x50'),{'ChatInteractionId':Number(_0x17c87d[_0x688c14]),'UserId':Number(_0x38681b['id'])});}});}})[_0xd534('0xf')](function(){if(_0x4d139f===_0xd534('0x51')){var _0x1acd0f=_[_0xd534('0x52')](_0x38681b[_0xd534('0x26')],'id');return _0x38681b['removeMailInteractions'](_0x1acd0f)[_0xd534('0xf')](function(){for(var _0x3d069f=0x0;_0x3d069f<_0x1acd0f['length'];_0x3d069f+=0x1){_0x3138f6['emit'](_0xd534('0x53'),{'MailInteractionId':Number(_0x1acd0f[_0x3d069f]),'UserId':Number(_0x38681b['id'])});}});}})[_0xd534('0xf')](function(){if(_0x4d139f===_0xd534('0x51')){var _0x3c2414=_[_0xd534('0x52')](_0x38681b[_0xd534('0x54')],'id');return _0x38681b['removeFaxInteractions'](_0x3c2414)[_0xd534('0xf')](function(){for(var _0x3ddb2e=0x0;_0x3ddb2e<_0x3c2414[_0xd534('0x44')];_0x3ddb2e+=0x1){_0x3138f6['emit'](_0xd534('0x55'),{'FaxInteractionId':Number(_0x3c2414[_0x3ddb2e]),'UserId':Number(_0x38681b['id'])});}});}})['then'](function(){if(_0x4d139f==='leave'){var _0x41c705=_[_0xd534('0x52')](_0x38681b[_0xd534('0x29')],'id');return _0x38681b['removeSmsInteractions'](_0x41c705)[_0xd534('0xf')](function(){for(var _0x51f0fd=0x0;_0x51f0fd<_0x41c705[_0xd534('0x44')];_0x51f0fd+=0x1){_0x3138f6[_0xd534('0x4f')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x41c705[_0x51f0fd]),'UserId':Number(_0x38681b['id'])});}});}})[_0xd534('0xf')](function(){if(_0x4d139f===_0xd534('0x51')){var _0x510bb3=_[_0xd534('0x52')](_0x38681b[_0xd534('0x2b')],'id');return _0x38681b[_0xd534('0x56')](_0x510bb3)[_0xd534('0xf')](function(){for(var _0x378871=0x0;_0x378871<_0x510bb3['length'];_0x378871+=0x1){_0x3138f6['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x510bb3[_0x378871]),'UserId':Number(_0x38681b['id'])});}});}})[_0xd534('0xf')](function(){if(_0x4d139f===_0xd534('0x51')){var _0x56b857=_['map'](_0x38681b[_0xd534('0x2d')],'id');return _0x38681b[_0xd534('0x57')](_0x56b857)[_0xd534('0xf')](function(){for(var _0x5aebf0=0x0;_0x5aebf0<_0x56b857['length'];_0x5aebf0+=0x1){_0x3138f6['emit'](_0xd534('0x58'),{'WhatsappInteractionId':Number(_0x56b857[_0x5aebf0]),'UserId':Number(_0x38681b['id'])});}});}})[_0xd534('0x59')](function(_0x5163bc){_0x123ec9['log'](_0x5163bc);});}}function onDisconnect(_0x4e4cbd,_0x4cf506){joinOrLeave(_0x4e4cbd,'leave',_0x4cf506);}function onConnect(_0x46a156){joinOrLeave(_0x46a156,_0xd534('0x5a'));}exports[_0xd534('0x5b')]=function(_0x19ba41){_0x19ba41['on']('connection',function(_0x35c542){_0x35c542[_0xd534('0x5c')](0x0);_0x35c542[_0xd534('0x5d')]=_0x35c542[_0xd534('0x5e')][_0xd534('0x5f')][_0xd534('0x60')]+':'+_0x35c542[_0xd534('0x5e')]['connection'][_0xd534('0x61')];_0x35c542[_0xd534('0x62')]=new Date();_0x35c542[_0xd534('0x63')]=function(_0x401348){console['log']('SocketIO\x20'+_0x35c542['nsp'][_0xd534('0x5')]+'['+_0x35c542[_0xd534('0x5d')]+']',_0x401348);};_0x35c542['on'](_0xd534('0x64'),function(){onDisconnect(_0x35c542,_0x19ba41);_0x35c542[_0xd534('0x63')](_0xd534('0x65'));});onConnect(_0x35c542);_0x35c542[_0xd534('0x63')](_0xd534('0x66'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index cd07e86..7a1c4a7 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 _0xe8f2=['find','name','interface','SIP/%s','catch','changed','closed','get','format','length','model','hook','callback','condition','../../mysqldb','jayson/promise','../logger','triggers','http','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','Chat','ChatMessage','newmessage','Sms','SmsInteraction','SmsMessage','WhatsappInteraction','Whatsapp','WhatsappMessage','Fax','FaxInteraction','Mail','MailInteraction','MailMessage','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','EventManager','then','info','error','Trigger,\x20%s','channel','event','UserId','User'];(function(_0x29aefc,_0x4dcf53){var _0x11be36=function(_0x3d472a){while(--_0x3d472a){_0x29aefc['push'](_0x29aefc['shift']());}};_0x11be36(++_0x4dcf53);}(_0xe8f2,0x74));var _0x2e8f=function(_0x246175,_0x1168ae){_0x246175=_0x246175-0x0;var _0x3d33bf=_0xe8f2[_0x246175];return _0x3d33bf;};'use strict';var util=require('util');var db=require(_0x2e8f('0x0'))['db'];var jayson=require(_0x2e8f('0x1'));var logger=require(_0x2e8f('0x2'))(_0x2e8f('0x3'));var client=jayson['client'][_0x2e8f('0x4')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x2e8f('0x5'),'event':_0x2e8f('0x6'),'condition':_0x2e8f('0x7'),'callback':afterCreate},{'channel':'Chat','model':_0x2e8f('0x5'),'event':_0x2e8f('0x8'),'condition':_0x2e8f('0x9'),'callback':afterUpdate},{'channel':_0x2e8f('0xa'),'model':_0x2e8f('0xb'),'event':_0x2e8f('0x6'),'condition':_0x2e8f('0xc'),'callback':afterCreateMessage},{'channel':_0x2e8f('0xd'),'model':'SmsInteraction','event':'afterCreate','condition':_0x2e8f('0x7'),'callback':afterCreate},{'channel':'Sms','model':_0x2e8f('0xe'),'event':'afterUpdate','condition':_0x2e8f('0x9'),'callback':afterUpdate},{'channel':_0x2e8f('0xd'),'model':_0x2e8f('0xf'),'event':_0x2e8f('0x6'),'condition':_0x2e8f('0xc'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x2e8f('0x10'),'event':_0x2e8f('0x6'),'condition':_0x2e8f('0x7'),'callback':afterCreate},{'channel':_0x2e8f('0x11'),'model':_0x2e8f('0x10'),'event':_0x2e8f('0x8'),'condition':_0x2e8f('0x9'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0x2e8f('0x12'),'event':_0x2e8f('0x6'),'condition':_0x2e8f('0xc'),'callback':afterCreateMessage},{'channel':_0x2e8f('0x13'),'model':'FaxInteraction','event':_0x2e8f('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x2e8f('0x13'),'model':_0x2e8f('0x14'),'event':_0x2e8f('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Fax','model':'FaxMessage','event':_0x2e8f('0x6'),'condition':_0x2e8f('0xc'),'callback':afterCreateMessage},{'channel':_0x2e8f('0x15'),'model':_0x2e8f('0x16'),'event':_0x2e8f('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x2e8f('0x15'),'model':_0x2e8f('0x16'),'event':_0x2e8f('0x8'),'condition':_0x2e8f('0x9'),'callback':afterUpdate},{'channel':_0x2e8f('0x15'),'model':_0x2e8f('0x17'),'event':_0x2e8f('0x6'),'condition':_0x2e8f('0xc'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0x2e8f('0x18'),'event':_0x2e8f('0x6'),'condition':_0x2e8f('0x7'),'callback':afterCreate},{'channel':_0x2e8f('0x19'),'model':_0x2e8f('0x18'),'event':_0x2e8f('0x8'),'condition':_0x2e8f('0x9'),'callback':afterUpdate},{'channel':_0x2e8f('0x19'),'model':_0x2e8f('0x1a'),'event':_0x2e8f('0x6'),'condition':_0x2e8f('0xc'),'callback':afterCreateMessage}];function request(_0x145130){return client[_0x2e8f('0x1b')](_0x2e8f('0x1c'),_0x145130)[_0x2e8f('0x1d')](function(_0x39ba0d){logger[_0x2e8f('0x1e')]('Trigger,\x20%s',_0x2e8f('0x1c'),_0x39ba0d);if(_0x39ba0d['error']){if(_0x39ba0d[_0x2e8f('0x1f')]['code']===0x1f4){logger[_0x2e8f('0x1f')](_0x2e8f('0x20'),'EventManager',_0x39ba0d[_0x2e8f('0x1f')]);}}})['catch'](function(_0x46be8a){logger[_0x2e8f('0x1f')]('Trigger,\x20%s',_0x2e8f('0x1c'),_0x46be8a);});}function afterCreateMessage(_0x2ae897,_0x57142e){return function(_0x256800,_0x5448fd){_0x256800=_0x256800['get']({'plain':!![]});_0x256800[_0x2e8f('0x21')]=_0x2ae897;_0x256800[_0x2e8f('0x22')]=_0x256800['direction'];if(_0x256800[_0x2e8f('0x23')]){return db[_0x2e8f('0x24')][_0x2e8f('0x25')]({'where':{'id':_0x256800[_0x2e8f('0x23')]},'attributes':['id',_0x2e8f('0x26')],'raw':!![]})[_0x2e8f('0x1d')](function(_0xdc1a89){_0x256800[_0x2e8f('0x27')]=util['format'](_0x2e8f('0x28'),_0xdc1a89[_0x2e8f('0x26')]);_0x256800['channel']=_0x2ae897;return request({'event':'incomingmessage','message':_0x256800});})[_0x2e8f('0x29')](function(_0x55bf91){console[_0x2e8f('0x1f')](_0x55bf91);});}else{return request({'event':'outgoingmessage','message':_0x256800});}};}function afterCreate(_0x17f187,_0x2dbe9c){return function(_0x55e5f4,_0x13d24f){_0x55e5f4=_0x55e5f4['get']({'plain':!![]});_0x55e5f4[_0x2e8f('0x21')]=_0x17f187;_0x55e5f4[_0x2e8f('0x22')]='opened';return request({'event':_0x2dbe9c,'message':_0x55e5f4});};}function afterUpdate(_0x1afba9,_0xfc2bd6){return function(_0x461916,_0x6a1eed){if(_0x461916[_0x2e8f('0x2a')](_0x2e8f('0x2b'))&&_0x461916[_0x2e8f('0x2b')]){_0x461916=_0x461916[_0x2e8f('0x2c')]({'plain':!![]});_0x461916[_0x2e8f('0x21')]=_0x1afba9;_0x461916[_0x2e8f('0x22')]=_0x2e8f('0x2b');if(_0x461916[_0x2e8f('0x23')]){return db[_0x2e8f('0x24')][_0x2e8f('0x25')]({'where':{'id':_0x461916[_0x2e8f('0x23')]},'attributes':['id',_0x2e8f('0x26')],'raw':!![]})[_0x2e8f('0x1d')](function(_0x3cf8a1){_0x461916[_0x2e8f('0x27')]=util[_0x2e8f('0x2d')](_0x2e8f('0x28'),_0x3cf8a1['name']);return request({'event':_0xfc2bd6,'message':_0x461916});})[_0x2e8f('0x29')](function(_0x263913){console[_0x2e8f('0x1f')](_0x263913);});}else{return request({'event':_0xfc2bd6,'message':_0x461916});}}};}exports['default']=function(){for(var _0x23958c=0x0;_0x23958c=_0x351af5[_0x9dc1('0x12')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x565ca7(_0x5dd3fc);})[_0x9dc1('0x13')](function(_0x5150bc){_0x1d356a(_0x5150bc);});});}; \ No newline at end of file +var _0x82bd=['isValidChannel','toLowerCase','includes','clearBlockUser','getLicense','role','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','voice','fax','getChannels'];(function(_0x5a0f26,_0x4bee1f){var _0x1f42b2=function(_0x198d0a){while(--_0x198d0a){_0x5a0f26['push'](_0x5a0f26['shift']());}};_0x1f42b2(++_0x4bee1f);}(_0x82bd,0x65));var _0xd82b=function(_0x2ffc46,_0x35ce3c){_0x2ffc46=_0x2ffc46-0x0;var _0x1eda8f=_0x82bd[_0x2ffc46];return _0x1eda8f;};'use strict';var _=require(_0xd82b('0x0'));var BPromise=require(_0xd82b('0x1'));var db=require(_0xd82b('0x2'))['db'];var util=require(_0xd82b('0x3'));var channels=[_0xd82b('0x4'),'mail','chat',_0xd82b('0x5'),'sms','whatsapp','openchannel'];exports[_0xd82b('0x6')]=function(){return channels;};exports[_0xd82b('0x7')]=function(_0x188746){_0x188746=_0x188746[_0xd82b('0x8')]();return _[_0xd82b('0x9')](channels,_0x188746);};exports[_0xd82b('0xa')]=function(_0x275588,_0x3b7b97,_0x1e69ee,_0x29b169){var _0x1931e4={'loginAttempts':_0x3b7b97,'blocked':_0x1e69ee};if(!_['isUndefined'](_0x29b169)){_0x1931e4['blockedAt']=_0x29b169;}return _0x275588['updateAttributes'](_0x1931e4);};exports[_0xd82b('0xb')]=function(_0x276e62){return new BPromise(function(_0x4592f0,_0x5d6298){var _0x5bab51=0x0;if(_0x276e62[_0xd82b('0xc')]!=='agent'){_0x4592f0(_0x276e62);}db['User']['count']({'where':{'role':_0xd82b('0xd'),'online':!![],'id':{'$ne':_0x276e62['id']}}})['then'](function(_0x400cb4){_0x5bab51=_0x400cb4;return util[_0xd82b('0xb')]();})[_0xd82b('0xe')](function(_0x22d9e3){if(_0x22d9e3&&_0x22d9e3[_0xd82b('0xf')]&&_0x5bab51>=_0x22d9e3[_0xd82b('0xf')]){throw Error(_0xd82b('0x10'));}_0x4592f0(_0x276e62);})[_0xd82b('0x11')](function(_0x2a65e4){_0x5d6298(_0x2a65e4);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 2fc68f2..0ab6d57 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0xbcd8=['exports','404','status','render','send'];(function(_0x267c52,_0x3c0df3){var _0x46c47b=function(_0x3c3740){while(--_0x3c3740){_0x267c52['push'](_0x267c52['shift']());}};_0x46c47b(++_0x3c0df3);}(_0xbcd8,0x145));var _0x8bcd=function(_0x19c136,_0x2cc9b1){_0x19c136=_0x19c136-0x0;var _0x34e478=_0xbcd8[_0x19c136];return _0x34e478;};'use strict';module[_0x8bcd('0x0')][0x194]=function pageNotFound(_0x5c9351,_0x3b6d6c){var _0x8c197e=_0x8bcd('0x1');var _0x33e932=0x194;var _0x230087={'status':_0x33e932};_0x3b6d6c[_0x8bcd('0x2')](_0x230087[_0x8bcd('0x2')]);_0x3b6d6c[_0x8bcd('0x3')](_0x8c197e,{},function(_0x7d6ce0,_0x89515a){if(_0x7d6ce0){return _0x3b6d6c[_0x8bcd('0x2')](_0x230087['status'])['json'](_0x230087);}_0x3b6d6c[_0x8bcd('0x4')](_0x89515a);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 39fda6f..f8a461b 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x1dcc=['name','database','username','password','options','sequelizeHistory','User','../api/user/user.model','VoiceChanSpy','import','VoiceContext','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../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','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','IntegrationReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','Notification','../api/notification/notification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','cascade','UserId','hasMany','VoiceQueuesRt','Extensions','OpenchannelInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','Notifications','SenderId','userProfileId','belongsToMany','Groups','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','VoiceQueue','VoiceQueues','MailQueues','FaxQueue','FaxQueues','UserFaxQueue','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_sms_accounts','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','belongsTo','TrunkBackup','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','VoiceMailMessage','mailboxuser','uniqueid','ContactId','MailAccountId','hasOne','Imap','Smtp','Dispositions','Answers','Interactions','MailApplication','List','ListId','Template','TemplateId','MailInteractionId','Account','Contact','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','restrict','TagId','Dashboard','Items','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','AttachmentId','SmsMessage','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','Agent','ChatQueueId','Website','ChatInteractionId','team_has_chat_queues','ChatInternalMessage','ChatGroupId','chat_group_has_users','CmCompany','JscriptySessionReport','Company','CompanyId','cm_contact_has_tags','Queue','Campaign','OwnerId','CampaignId','Condition','All','OneAll','Any','AutomationAnyId','AutomationId','Intervals','MailApplications','FaxApplications','DefaultReportId','AnalyticCustomReport','Mohs','chat_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Actions','AnalyticFieldReport','Fields','CustomReportId','AnalyticMetric','MetricId','Configurations','AccountId','DescriptionId','Subject','SubjectId','Description','Field','FieldId','SugarcrmConfiguration','SugarcrmField','Subjects','Descriptions','VariableId','DeskField','ZohoConfiguration','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerField','ServicenowAccount','Dynamics365Configuration','FreshsalesConfiguration','ChatQueueReport','ToId','JscriptyQuestionReport','SessionId','SmsQueueReport','ProjectId','team_has_mail_queues','team_has_whatsapp_queues','HopperFinals','TrunkId','TrunkBackupId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromAccount','FromUserId','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAgent','ToUserId','ToAgent','ToQueue','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','ToSmsQueueId','CmCustomField','CustomFields','HopperHistory','voice_queues_has_cm_lists','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','whatsapp_interaction_has_tags','Interaction','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','path','../config/environment','sequelize','lodash','determine','defaultsDeep','motion2','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','xC@LL1234'];(function(_0x15744b,_0x215275){var _0x1fc14f=function(_0x19948a){while(--_0x19948a){_0x15744b['push'](_0x15744b['shift']());}};_0x1fc14f(++_0x215275);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x2525c7,_0x13b1a8){_0x2525c7=_0x2525c7-0x0;var _0x2f1ea4=_0x1dcc[_0x2525c7];return _0x2f1ea4;};'use strict';var path=require(_0xc1dc('0x0'));var config=require(_0xc1dc('0x1'));var Sequelize=require(_0xc1dc('0x2'));var _=require(_0xc1dc('0x3'));var jstz=require('jstz');var timezone=jstz[_0xc1dc('0x4')]();config['sequelize']=_[_0xc1dc('0x5')](config[_0xc1dc('0x2')],{'database':_0xc1dc('0x6'),'username':'xcall','password':'xC@LL1234','options':{'host':_0xc1dc('0x7'),'port':0xcea,'dialect':_0xc1dc('0x8'),'dialectOptions':{'charset':_0xc1dc('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xc1dc('0xa'),'collate':_0xc1dc('0xb')}}});config['sequelizeHistory']=_[_0xc1dc('0x5')](config['sequelizeHistory'],{'database':_0xc1dc('0x6'),'username':'xcall','password':_0xc1dc('0xc'),'options':{'host':_0xc1dc('0x7'),'port':0xcea,'dialect':_0xc1dc('0x8'),'dialectOptions':{'charset':_0xc1dc('0x9')},'logging':![],'timezone':timezone[_0xc1dc('0xd')](),'define':{'charset':_0xc1dc('0xa'),'collate':_0xc1dc('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xc1dc('0x2')][_0xc1dc('0xe')],config['sequelize'][_0xc1dc('0xf')],config[_0xc1dc('0x2')][_0xc1dc('0x10')],config['sequelize'][_0xc1dc('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xc1dc('0x12')][_0xc1dc('0xe')],config[_0xc1dc('0x12')][_0xc1dc('0xf')],config[_0xc1dc('0x12')][_0xc1dc('0x10')],config[_0xc1dc('0x12')][_0xc1dc('0x11')])};db[_0xc1dc('0x13')]=db[_0xc1dc('0x2')]['import'](_0xc1dc('0x14'));db[_0xc1dc('0x15')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0xc1dc('0x17')]=db[_0xc1dc('0x2')]['import']('../api/voiceContext/voiceContext.model');db[_0xc1dc('0x18')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x19'));db[_0xc1dc('0x1a')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x1b'));db['VoiceQueue']=db['sequelize']['import'](_0xc1dc('0x1c'));db[_0xc1dc('0x1d')]=db['sequelize'][_0xc1dc('0x16')](_0xc1dc('0x1e'));db[_0xc1dc('0x1f')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x20'));db[_0xc1dc('0x21')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x22'));db['VoiceMailMessage']=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x23'));db[_0xc1dc('0x24')]=db['sequelize'][_0xc1dc('0x16')](_0xc1dc('0x25'));db[_0xc1dc('0x26')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x27'));db[_0xc1dc('0x28')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0xc1dc('0x29')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x2a'));db[_0xc1dc('0x2b')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x2c'));db[_0xc1dc('0x2d')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')]('../api/trunk/trunk.model');db[_0xc1dc('0x2e')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x2f'));db[_0xc1dc('0x30')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x31'));db[_0xc1dc('0x32')]=db['sequelize']['import'](_0xc1dc('0x33'));db[_0xc1dc('0x34')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x35'));db[_0xc1dc('0x36')]=db['sequelize'][_0xc1dc('0x16')](_0xc1dc('0x37'));db['UserFaxQueue']=db[_0xc1dc('0x2')][_0xc1dc('0x16')]('../api/userFaxQueue/userFaxQueue.model');db[_0xc1dc('0x38')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')]('../api/userSmsQueue/userSmsQueue.model');db[_0xc1dc('0x39')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x3a'));db[_0xc1dc('0x3b')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x3c'));db[_0xc1dc('0x3d')]=db['sequelize'][_0xc1dc('0x16')](_0xc1dc('0x3e'));db[_0xc1dc('0x3f')]=db['sequelize'][_0xc1dc('0x16')](_0xc1dc('0x40'));db[_0xc1dc('0x41')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x42'));db[_0xc1dc('0x43')]=db[_0xc1dc('0x2')]['import'](_0xc1dc('0x44'));db[_0xc1dc('0x45')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x46'));db[_0xc1dc('0x47')]=db['sequelize'][_0xc1dc('0x16')](_0xc1dc('0x48'));db[_0xc1dc('0x49')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')]('../api/mailMessage/mailMessage.model');db['MailApplication']=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x4a'));db[_0xc1dc('0x4b')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x4c'));db['Dashboard']=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x4d'));db['DashboardItem']=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x4e'));db[_0xc1dc('0x4f')]=db['sequelize']['import'](_0xc1dc('0x50'));db[_0xc1dc('0x51')]=db['sequelize'][_0xc1dc('0x16')](_0xc1dc('0x52'));db[_0xc1dc('0x53')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x54'));db[_0xc1dc('0x55')]=db['sequelize']['import'](_0xc1dc('0x56'));db['FaxQueue']=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x57'));db[_0xc1dc('0x58')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x59'));db[_0xc1dc('0x5a')]=db['sequelize'][_0xc1dc('0x16')](_0xc1dc('0x5b'));db[_0xc1dc('0x5c')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x5d'));db[_0xc1dc('0x5e')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x5f'));db['SmsMessage']=db['sequelize']['import'](_0xc1dc('0x60'));db[_0xc1dc('0x61')]=db['sequelize'][_0xc1dc('0x16')](_0xc1dc('0x62'));db['OpenchannelAccount']=db[_0xc1dc('0x2')]['import'](_0xc1dc('0x63'));db[_0xc1dc('0x64')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x65'));db[_0xc1dc('0x66')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0xc1dc('0x67')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x68'));db['OpenchannelQueue']=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x69'));db[_0xc1dc('0x6a')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x6b'));db[_0xc1dc('0x6c')]=db['sequelize'][_0xc1dc('0x16')](_0xc1dc('0x6d'));db[_0xc1dc('0x6e')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x6f'));db[_0xc1dc('0x70')]=db['sequelize'][_0xc1dc('0x16')](_0xc1dc('0x71'));db[_0xc1dc('0x72')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x73'));db[_0xc1dc('0x74')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0xc1dc('0x75')]=db['sequelize'][_0xc1dc('0x16')](_0xc1dc('0x76'));db[_0xc1dc('0x77')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x78'));db[_0xc1dc('0x79')]=db['sequelize'][_0xc1dc('0x16')](_0xc1dc('0x7a'));db['CmCompany']=db['sequelize'][_0xc1dc('0x16')](_0xc1dc('0x7b'));db[_0xc1dc('0x7c')]=db[_0xc1dc('0x2')]['import']('../api/cmContact/cmContact.model');db[_0xc1dc('0x7d')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')]('../api/cmHopper/cmHopper.model');db[_0xc1dc('0x7e')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x7f'));db[_0xc1dc('0x80')]=db['sequelize'][_0xc1dc('0x16')](_0xc1dc('0x81'));db[_0xc1dc('0x82')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x83'));db[_0xc1dc('0x84')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x85'));db[_0xc1dc('0x86')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x87'));db[_0xc1dc('0x88')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x89'));db[_0xc1dc('0x8a')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x8b'));db[_0xc1dc('0x8c')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x8d'));db['Condition']=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x8e'));db['Interval']=db['sequelize'][_0xc1dc('0x16')]('../api/interval/interval.model');db[_0xc1dc('0x8f')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x90'));db['Cdr']=db['sequelize'][_0xc1dc('0x16')](_0xc1dc('0x91'));db[_0xc1dc('0x92')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x93'));db[_0xc1dc('0x94')]=db['sequelize'][_0xc1dc('0x16')]('../api/schedule/schedule.model');db[_0xc1dc('0x95')]=db[_0xc1dc('0x2')]['import'](_0xc1dc('0x96'));db[_0xc1dc('0x97')]=db['sequelize'][_0xc1dc('0x16')](_0xc1dc('0x98'));db['Template']=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x99'));db[_0xc1dc('0x9a')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x9b'));db[_0xc1dc('0x9c')]=db['sequelize'][_0xc1dc('0x16')]('../api/variable/variable.model');db[_0xc1dc('0x9d')]=db['sequelize'][_0xc1dc('0x16')](_0xc1dc('0x9e'));db[_0xc1dc('0x9f')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')]('../api/integrationReport/integrationReport.model');db['AnalyticCustomReport']=db[_0xc1dc('0x2')]['import'](_0xc1dc('0xa0'));db[_0xc1dc('0xa1')]=db[_0xc1dc('0x2')]['import'](_0xc1dc('0xa2'));db['AnalyticExtractedReport']=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xa3'));db['AnalyticMetric']=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xa4'));db['AnalyticFieldReport']=db['sequelize'][_0xc1dc('0x16')](_0xc1dc('0xa5'));db[_0xc1dc('0xa6')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xa7'));db[_0xc1dc('0xa8')]=db['sequelize'][_0xc1dc('0x16')](_0xc1dc('0xa9'));db[_0xc1dc('0xaa')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xab'));db[_0xc1dc('0xac')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xad'));db[_0xc1dc('0xae')]=db[_0xc1dc('0x2')]['import']('../api/intSugarcrmAccount/intSugarcrmAccount.model');db['SugarcrmConfiguration']=db['sequelize']['import'](_0xc1dc('0xaf'));db['SugarcrmField']=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xb0'));db[_0xc1dc('0xb1')]=db[_0xc1dc('0x2')]['import']('../api/intDeskAccount/intDeskAccount.model');db[_0xc1dc('0xb2')]=db[_0xc1dc('0x2')]['import'](_0xc1dc('0xb3'));db['DeskField']=db['sequelize']['import']('../api/intDeskField/intDeskField.model');db[_0xc1dc('0xb4')]=db['sequelize'][_0xc1dc('0x16')](_0xc1dc('0xb5'));db['ZohoConfiguration']=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xb6'));db[_0xc1dc('0xb7')]=db[_0xc1dc('0x2')]['import'](_0xc1dc('0xb8'));db['ZendeskAccount']=db['sequelize']['import'](_0xc1dc('0xb9'));db[_0xc1dc('0xba')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xbb'));db[_0xc1dc('0xbc')]=db[_0xc1dc('0x2')]['import'](_0xc1dc('0xbd'));db[_0xc1dc('0xbe')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xbf'));db[_0xc1dc('0xc0')]=db['sequelize'][_0xc1dc('0x16')](_0xc1dc('0xc1'));db['FreshdeskField']=db['sequelize'][_0xc1dc('0x16')](_0xc1dc('0xc2'));db[_0xc1dc('0xc3')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xc4'));db[_0xc1dc('0xc5')]=db['sequelize']['import'](_0xc1dc('0xc6'));db['VtigerField']=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xc7'));db['ServicenowAccount']=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xc8'));db[_0xc1dc('0xc9')]=db[_0xc1dc('0x2')]['import'](_0xc1dc('0xca'));db[_0xc1dc('0xcb')]=db['sequelize'][_0xc1dc('0x16')](_0xc1dc('0xcc'));db[_0xc1dc('0xcd')]=db['sequelize']['import']('../api/intDynamics365Account/intDynamics365Account.model');db['Dynamics365Configuration']=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xce'));db[_0xc1dc('0xcf')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0xc1dc('0xd0')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db['FreshsalesConfiguration']=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xd1'));db[_0xc1dc('0xd2')]=db[_0xc1dc('0x2')]['import'](_0xc1dc('0xd3'));db[_0xc1dc('0x9d')]=db['sequelize'][_0xc1dc('0x16')](_0xc1dc('0x9e'));db[_0xc1dc('0xd4')]=db[_0xc1dc('0x2')]['import']('../api/network/network.model');db['ChatQueueReport']=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xd5'));db['ChatInternalMessage']=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xd6'));db[_0xc1dc('0xd7')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db['JscriptyQuestionReport']=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xd8'));db['JscriptySessionReport']=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xd9'));db['SmsQueueReport']=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xda'));db[_0xc1dc('0xdb')]=db[_0xc1dc('0x2')]['import']('../api/squareReport/squareReport.model');db[_0xc1dc('0xdc')]=db[_0xc1dc('0x2')]['import'](_0xc1dc('0xdd'));db[_0xc1dc('0xde')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xdf'));db['Setting']=db[_0xc1dc('0x2')][_0xc1dc('0x16')]('../api/setting/setting.model');db[_0xc1dc('0xe0')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xe1'));db[_0xc1dc('0xe2')]=db[_0xc1dc('0x2')]['import'](_0xc1dc('0xe3'));db['SquareRecording']=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xe4'));db[_0xc1dc('0xe5')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xe6'));db[_0xc1dc('0xe7')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xe8'));db[_0xc1dc('0xe9')]=db['sequelize'][_0xc1dc('0x16')](_0xc1dc('0xea'));db['Campaign']=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xeb'));db['Migration']=db[_0xc1dc('0x2')]['import'](_0xc1dc('0xec'));db[_0xc1dc('0xed')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xee'));db[_0xc1dc('0xef')]=db[_0xc1dc('0x2')]['import']('../api/plugin/plugin.model');db[_0xc1dc('0xf0')]=db[_0xc1dc('0x2')]['import'](_0xc1dc('0xf1'));db[_0xc1dc('0xf2')]=db['sequelize'][_0xc1dc('0x16')](_0xc1dc('0xf3'));db['FaxTransferReport']=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xf4'));db[_0xc1dc('0xf5')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xf6'));db['SmsTransferReport']=db['sequelize'][_0xc1dc('0x16')]('../api/smsTransferReport/smsTransferReport.model');db[_0xc1dc('0xf7')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xf8'));db[_0xc1dc('0xf9')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xfa'));db[_0xc1dc('0xfb')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xfc'));db[_0xc1dc('0xfd')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')]('../api/userProfileSection/userProfileSection.model');db['UserProfileResource']=db[_0xc1dc('0x2')][_0xc1dc('0x16')]('../api/userProfileResource/userProfileResource.model');db[_0xc1dc('0xfe')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0xff'));db[_0xc1dc('0x100')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x101'));db[_0xc1dc('0x102')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x103'));db[_0xc1dc('0x104')]=db[_0xc1dc('0x2')]['import'](_0xc1dc('0x105'));db[_0xc1dc('0x106')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x107'));db[_0xc1dc('0x108')]=db['sequelize'][_0xc1dc('0x16')]('../api/whatsappQueueReport/whatsappQueueReport.model');db['WhatsappTransferReport']=db[_0xc1dc('0x2')]['import'](_0xc1dc('0x109'));db[_0xc1dc('0x10a')]=db[_0xc1dc('0x2')][_0xc1dc('0x16')](_0xc1dc('0x10b'));db[_0xc1dc('0x10c')]=db[_0xc1dc('0x2')]['import'](_0xc1dc('0x10d'));db[_0xc1dc('0x13')]['hasOne'](db['VoiceMail'],{'as':_0xc1dc('0x21'),'onDelete':_0xc1dc('0x10e'),'foreignKey':_0xc1dc('0x10f')});db['User'][_0xc1dc('0x110')](db[_0xc1dc('0x1d')],{'as':'Recordings','foreignKey':_0xc1dc('0x10f')});db[_0xc1dc('0x13')][_0xc1dc('0x110')](db[_0xc1dc('0x30')],{'as':_0xc1dc('0x111'),'foreignKey':_0xc1dc('0x10f')});db[_0xc1dc('0x13')][_0xc1dc('0x110')](db['VoiceExtension'],{'as':_0xc1dc('0x112'),'onDelete':'cascade','hooks':!![]});db['User'][_0xc1dc('0x110')](db[_0xc1dc('0x80')],{'as':'HopperFinals','foreignKey':_0xc1dc('0x10f')});db['User']['hasMany'](db[_0xc1dc('0x82')],{'as':'HopperHistory','foreignKey':'UserId'});db['User']['hasMany'](db[_0xc1dc('0x84')],{'as':_0xc1dc('0x84'),'foreignKey':_0xc1dc('0x10f')});db[_0xc1dc('0x13')][_0xc1dc('0x110')](db[_0xc1dc('0x66')],{'as':_0xc1dc('0x113'),'foreignKey':_0xc1dc('0x10f')});db[_0xc1dc('0x13')][_0xc1dc('0x110')](db[_0xc1dc('0x70')],{'as':'ChatInteractions','foreignKey':_0xc1dc('0x10f')});db[_0xc1dc('0x13')][_0xc1dc('0x110')](db['SmsInteraction'],{'as':_0xc1dc('0x114'),'foreignKey':_0xc1dc('0x10f')});db[_0xc1dc('0x13')][_0xc1dc('0x110')](db[_0xc1dc('0x53')],{'as':_0xc1dc('0x115'),'foreignKey':_0xc1dc('0x10f')});db[_0xc1dc('0x13')]['hasMany'](db[_0xc1dc('0x47')],{'as':_0xc1dc('0x116'),'foreignKey':'UserId'});db['User'][_0xc1dc('0x110')](db['WhatsappInteraction'],{'as':_0xc1dc('0x117'),'foreignKey':_0xc1dc('0x10f')});db[_0xc1dc('0x13')][_0xc1dc('0x110')](db[_0xc1dc('0xfe')],{'as':_0xc1dc('0x118'),'foreignKey':_0xc1dc('0x119')});db[_0xc1dc('0x13')]['belongsTo'](db[_0xc1dc('0xfb')],{'as':_0xc1dc('0xfb'),'foreignKey':_0xc1dc('0x11a')});db[_0xc1dc('0x13')][_0xc1dc('0x11b')](db[_0xc1dc('0x77')],{'as':_0xc1dc('0x11c'),'through':'chat_group_has_users'});db['User'][_0xc1dc('0x11b')](db[_0xc1dc('0x7c')],{'as':_0xc1dc('0x11d'),'through':_0xc1dc('0x11e')});db[_0xc1dc('0x13')][_0xc1dc('0x11b')](db[_0xc1dc('0xf7')],{'as':_0xc1dc('0x11f'),'through':_0xc1dc('0x120')});db[_0xc1dc('0x13')][_0xc1dc('0x11b')](db['Team'],{'through':_0xc1dc('0x121')});db[_0xc1dc('0x13')][_0xc1dc('0x11b')](db[_0xc1dc('0x47')],{'as':'MailInteractions','through':_0xc1dc('0x122')});db['User'][_0xc1dc('0x11b')](db['ChatInteraction'],{'as':_0xc1dc('0x123'),'through':_0xc1dc('0x124')});db[_0xc1dc('0x13')][_0xc1dc('0x11b')](db[_0xc1dc('0x53')],{'as':_0xc1dc('0x115'),'through':_0xc1dc('0x125')});db[_0xc1dc('0x13')]['belongsToMany'](db['SmsInteraction'],{'as':_0xc1dc('0x114'),'through':_0xc1dc('0x126')});db[_0xc1dc('0x13')][_0xc1dc('0x11b')](db['OpenchannelInteraction'],{'as':_0xc1dc('0x113'),'through':'user_has_openchannel_interactions'});db['User']['belongsToMany'](db[_0xc1dc('0x104')],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db[_0xc1dc('0x13')][_0xc1dc('0x11b')](db[_0xc1dc('0x127')],{'as':_0xc1dc('0x128'),'through':_0xc1dc('0x32'),'required':![]});db[_0xc1dc('0x13')][_0xc1dc('0x11b')](db[_0xc1dc('0x43')],{'as':_0xc1dc('0x129'),'through':_0xc1dc('0x36'),'required':![]});db[_0xc1dc('0x13')]['belongsToMany'](db['ChatQueue'],{'as':'ChatQueues','through':_0xc1dc('0x34'),'required':![],'hooks':!![]});db[_0xc1dc('0x13')][_0xc1dc('0x11b')](db[_0xc1dc('0x12a')],{'as':_0xc1dc('0x12b'),'through':_0xc1dc('0x12c'),'required':![]});db[_0xc1dc('0x13')][_0xc1dc('0x11b')](db['SmsQueue'],{'as':_0xc1dc('0x12d'),'through':_0xc1dc('0x38'),'required':![]});db['User']['belongsToMany'](db[_0xc1dc('0x12e')],{'as':_0xc1dc('0x12f'),'through':_0xc1dc('0x39'),'required':![]});db['User']['belongsToMany'](db[_0xc1dc('0x10a')],{'as':_0xc1dc('0x130'),'through':_0xc1dc('0x3b'),'required':![]});db['User'][_0xc1dc('0x11b')](db[_0xc1dc('0xf7')],{'through':_0xc1dc('0x120')});db['User'][_0xc1dc('0x11b')](db['VoicePrefix'],{'as':_0xc1dc('0x131'),'through':_0xc1dc('0x132'),'required':![]});db['User'][_0xc1dc('0x11b')](db['ChatWebsite'],{'as':'ChatWebsites','through':_0xc1dc('0x133')});db[_0xc1dc('0x13')][_0xc1dc('0x11b')](db['FaxAccount'],{'as':_0xc1dc('0x134'),'through':_0xc1dc('0x135')});db[_0xc1dc('0x13')][_0xc1dc('0x11b')](db['MailAccount'],{'as':_0xc1dc('0x136'),'through':_0xc1dc('0x137')});db[_0xc1dc('0x13')][_0xc1dc('0x11b')](db[_0xc1dc('0x138')],{'as':_0xc1dc('0x139'),'through':'user_has_openchannel_accounts'});db[_0xc1dc('0x13')][_0xc1dc('0x11b')](db[_0xc1dc('0x5a')],{'as':'SmsAccounts','through':_0xc1dc('0x13a')});db[_0xc1dc('0x13')][_0xc1dc('0x11b')](db[_0xc1dc('0x100')],{'as':'WhatsappAccounts','through':'user_has_whatsapp_accounts'});db[_0xc1dc('0x13')][_0xc1dc('0x11b')](db[_0xc1dc('0xe2')],{'as':'SquareProjects','through':_0xc1dc('0x13b')});db[_0xc1dc('0x15')][_0xc1dc('0x110')](db[_0xc1dc('0x18')],{'as':_0xc1dc('0x13c'),'onDelete':'cascade','foreignKey':_0xc1dc('0x13d')});db[_0xc1dc('0x17')][_0xc1dc('0x110')](db['VoiceExtension'],{'onDelete':_0xc1dc('0x10e')});db[_0xc1dc('0x18')][_0xc1dc('0x110')](db[_0xc1dc('0x18')],{'as':_0xc1dc('0x13e'),'onDelete':'cascade'});db[_0xc1dc('0x1a')][_0xc1dc('0x11b')](db['Sound'],{'as':_0xc1dc('0x13f'),'through':_0xc1dc('0x140')});db['VoiceQueue'][_0xc1dc('0x110')](db[_0xc1dc('0x30')],{'as':_0xc1dc('0x141'),'foreignKey':_0xc1dc('0x142')});db['VoiceQueue']['hasMany'](db[_0xc1dc('0x7d')],{'as':_0xc1dc('0x143'),'foreignKey':_0xc1dc('0x142')});db['VoiceQueue'][_0xc1dc('0x110')](db[_0xc1dc('0x80')],{'as':'HopperFinals','foreignKey':_0xc1dc('0x142')});db[_0xc1dc('0x127')][_0xc1dc('0x110')](db['CmHopperHistory'],{'as':_0xc1dc('0x144'),'foreignKey':_0xc1dc('0x142')});db[_0xc1dc('0x127')]['hasMany'](db[_0xc1dc('0x84')],{'as':'ReportAgentPreview','foreignKey':_0xc1dc('0x142')});db[_0xc1dc('0x127')][_0xc1dc('0x110')](db['CmHopperBlack'],{'as':_0xc1dc('0x145'),'foreignKey':_0xc1dc('0x142')});db['VoiceQueue'][_0xc1dc('0x110')](db['JscriptySessionReport'],{'as':_0xc1dc('0x146'),'foreignKey':_0xc1dc('0x142')});db[_0xc1dc('0x127')][_0xc1dc('0x147')](db['Trunk'],{'as':'Trunk','foreignKey':'TrunkId'});db[_0xc1dc('0x127')][_0xc1dc('0x147')](db[_0xc1dc('0x2d')],{'as':_0xc1dc('0x148'),'foreignKey':'TrunkBackupId'});db['VoiceQueue']['belongsTo'](db[_0xc1dc('0x149')],{'as':'Interval','foreignKey':_0xc1dc('0x14a')});db[_0xc1dc('0x127')]['belongsTo'](db[_0xc1dc('0x8f')],{'as':_0xc1dc('0x14b'),'foreignKey':_0xc1dc('0x14c')});db[_0xc1dc('0x127')][_0xc1dc('0x11b')](db['CmList'],{'as':_0xc1dc('0x11f'),'through':'voice_queues_has_cm_lists'});db['VoiceQueue'][_0xc1dc('0x11b')](db[_0xc1dc('0x13')],{'as':_0xc1dc('0x14d'),'through':_0xc1dc('0x32')});db[_0xc1dc('0x127')][_0xc1dc('0x11b')](db[_0xc1dc('0xe7')],{'as':_0xc1dc('0x14e'),'through':_0xc1dc('0x14f')});db[_0xc1dc('0x127')][_0xc1dc('0x11b')](db[_0xc1dc('0xf7')],{'as':_0xc1dc('0x150'),'through':_0xc1dc('0x151')});db['VoiceRecording']['belongsTo'](db[_0xc1dc('0x13')],{'as':_0xc1dc('0x13'),'foreignKey':_0xc1dc('0x10f')});db['ScreenRecording'][_0xc1dc('0x147')](db['User'],{'as':_0xc1dc('0x13'),'foreignKey':_0xc1dc('0x10f')});db[_0xc1dc('0x21')][_0xc1dc('0x110')](db['VoiceMailMessage'],{'as':_0xc1dc('0x152'),'onDelete':_0xc1dc('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0xc1dc('0x153')});db[_0xc1dc('0x154')]['belongsTo'](db[_0xc1dc('0x21')],{'foreignKey':_0xc1dc('0x155'),'targetKey':_0xc1dc('0x153')});db[_0xc1dc('0x24')][_0xc1dc('0x110')](db[_0xc1dc('0x29')],{'as':'QueueCalls','foreignKey':'uniqueid','constraints':![]});db[_0xc1dc('0x24')][_0xc1dc('0x110')](db[_0xc1dc('0x28')],{'as':'AgentReports','foreignKey':_0xc1dc('0x156'),'constraints':![]});db[_0xc1dc('0x24')][_0xc1dc('0x147')](db[_0xc1dc('0x13')],{'as':_0xc1dc('0x13'),'foreignKey':'UserId'});db['VoiceCallReport'][_0xc1dc('0x147')](db['CmContact'],{'as':'Contact','foreignKey':_0xc1dc('0x157')});db[_0xc1dc('0x3d')][_0xc1dc('0x147')](db[_0xc1dc('0x41')],{'as':_0xc1dc('0x41'),'foreignKey':_0xc1dc('0x158')});db[_0xc1dc('0x3f')][_0xc1dc('0x147')](db[_0xc1dc('0x41')],{'as':_0xc1dc('0x41'),'foreignKey':_0xc1dc('0x158')});db[_0xc1dc('0x41')][_0xc1dc('0x159')](db[_0xc1dc('0x3d')],{'as':_0xc1dc('0x15a'),'onDelete':_0xc1dc('0x10e')});db[_0xc1dc('0x41')][_0xc1dc('0x159')](db[_0xc1dc('0x3f')],{'as':_0xc1dc('0x15b'),'onDelete':_0xc1dc('0x10e')});db[_0xc1dc('0x41')][_0xc1dc('0x110')](db[_0xc1dc('0x8c')],{'as':_0xc1dc('0x15c'),'foreignKey':'MailAccountId'});db[_0xc1dc('0x41')][_0xc1dc('0x110')](db[_0xc1dc('0x8a')],{'as':_0xc1dc('0x15d'),'foreignKey':'MailAccountId'});db[_0xc1dc('0x41')][_0xc1dc('0x110')](db[_0xc1dc('0x49')],{'as':_0xc1dc('0x152'),'foreignKey':'MailAccountId'});db[_0xc1dc('0x41')][_0xc1dc('0x110')](db['MailInteraction'],{'as':_0xc1dc('0x15e')});db[_0xc1dc('0x41')][_0xc1dc('0x110')](db[_0xc1dc('0x15f')],{'as':_0xc1dc('0x13e')});db[_0xc1dc('0x41')][_0xc1dc('0x147')](db['CmList'],{'as':_0xc1dc('0x160'),'foreignKey':_0xc1dc('0x161')});db['MailAccount']['belongsTo'](db[_0xc1dc('0x162')],{'as':'Template','foreignKey':_0xc1dc('0x163')});db['MailAccount'][_0xc1dc('0x147')](db[_0xc1dc('0x8f')],{'as':_0xc1dc('0x14b'),'foreignKey':_0xc1dc('0x14c')});db[_0xc1dc('0x41')][_0xc1dc('0x11b')](db['User'],{'as':'Agents','through':'user_has_mail_accounts'});db['MailQueue']['belongsToMany'](db['User'],{'as':_0xc1dc('0x14d'),'through':_0xc1dc('0x36')});db[_0xc1dc('0x43')][_0xc1dc('0x11b')](db[_0xc1dc('0xe7')],{'through':'team_has_mail_queues','as':_0xc1dc('0x14e')});db[_0xc1dc('0x47')][_0xc1dc('0x110')](db[_0xc1dc('0x49')],{'as':_0xc1dc('0x152'),'onDelete':_0xc1dc('0x10e'),'foreignKey':_0xc1dc('0x164')});db[_0xc1dc('0x47')][_0xc1dc('0x147')](db[_0xc1dc('0x41')],{'as':_0xc1dc('0x165'),'foreignKey':_0xc1dc('0x158')});db[_0xc1dc('0x47')]['belongsTo'](db[_0xc1dc('0x7c')],{'as':_0xc1dc('0x166'),'foreignKey':_0xc1dc('0x157')});db[_0xc1dc('0x47')][_0xc1dc('0x147')](db[_0xc1dc('0x13')],{'as':_0xc1dc('0x167'),'foreignKey':_0xc1dc('0x10f')});db[_0xc1dc('0x47')][_0xc1dc('0x11b')](db['Tag'],{'through':_0xc1dc('0x168'),'as':_0xc1dc('0x169')});db[_0xc1dc('0x47')]['belongsToMany'](db[_0xc1dc('0x97')],{'through':_0xc1dc('0x168'),'as':_0xc1dc('0x16a')});db[_0xc1dc('0x47')]['belongsToMany'](db[_0xc1dc('0x13')],{'as':_0xc1dc('0x16b'),'through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db['MailMessage'][_0xc1dc('0x110')](db[_0xc1dc('0xed')],{'as':_0xc1dc('0x16c'),'onDelete':_0xc1dc('0x10e')});db[_0xc1dc('0x49')][_0xc1dc('0x147')](db[_0xc1dc('0x13')],{'as':'User'});db[_0xc1dc('0x49')][_0xc1dc('0x147')](db[_0xc1dc('0x7c')],{'onDelete':'cascade','as':'Contact'});db['MailMessage'][_0xc1dc('0x147')](db['MailInteraction'],{'as':'Interaction','foreignKey':'MailInteractionId'});db[_0xc1dc('0x49')]['belongsTo'](db['MailAccount'],{'as':_0xc1dc('0x165'),'foreignKey':_0xc1dc('0x158')});db['MailApplication'][_0xc1dc('0x147')](db[_0xc1dc('0x13')],{'onDelete':_0xc1dc('0x16d')});db[_0xc1dc('0x15f')][_0xc1dc('0x147')](db['MailQueue'],{'onDelete':_0xc1dc('0x16d')});db[_0xc1dc('0x15f')]['belongsTo'](db[_0xc1dc('0x41')],{'onDelete':'restrict'});db[_0xc1dc('0x15f')][_0xc1dc('0x147')](db['Interval'],{'onDelete':_0xc1dc('0x16d'),'foreignKey':_0xc1dc('0x14a')});db[_0xc1dc('0x15f')][_0xc1dc('0x147')](db[_0xc1dc('0x97')],{'onDelete':'restrict','foreignKey':_0xc1dc('0x16e')});db[_0xc1dc('0x4b')][_0xc1dc('0x147')](db['MailAccount'],{});db[_0xc1dc('0x4b')][_0xc1dc('0x147')](db['CmList'],{'as':'List','foreignKey':_0xc1dc('0x161')});db[_0xc1dc('0x4b')][_0xc1dc('0x147')](db[_0xc1dc('0x7c')],{'as':_0xc1dc('0x166'),'foreignKey':_0xc1dc('0x157')});db[_0xc1dc('0x4b')]['belongsTo'](db[_0xc1dc('0x47')],{});db['MailQueueReport']['belongsTo'](db[_0xc1dc('0x49')],{});db['MailQueueReport'][_0xc1dc('0x147')](db['User'],{});db[_0xc1dc('0x4b')][_0xc1dc('0x147')](db[_0xc1dc('0x43')],{});db[_0xc1dc('0x16f')]['hasMany'](db['DashboardItem'],{'as':_0xc1dc('0x170'),'onDelete':_0xc1dc('0x10e')});db['FaxAccount'][_0xc1dc('0x110')](db[_0xc1dc('0x8c')],{'as':_0xc1dc('0x15c'),'foreignKey':'FaxAccountId'});db[_0xc1dc('0x4f')]['hasMany'](db[_0xc1dc('0x8a')],{'as':_0xc1dc('0x15d'),'foreignKey':_0xc1dc('0x171')});db[_0xc1dc('0x4f')][_0xc1dc('0x110')](db[_0xc1dc('0x53')],{'as':'Interactions'});db[_0xc1dc('0x4f')][_0xc1dc('0x110')](db[_0xc1dc('0x51')],{'as':_0xc1dc('0x13e')});db[_0xc1dc('0x4f')][_0xc1dc('0x110')](db[_0xc1dc('0x18')],{'as':_0xc1dc('0x172'),'onDelete':_0xc1dc('0x10e')});db[_0xc1dc('0x4f')][_0xc1dc('0x110')](db[_0xc1dc('0x55')],{'as':_0xc1dc('0x152')});db[_0xc1dc('0x4f')][_0xc1dc('0x147')](db[_0xc1dc('0x2d')],{'as':'Trunk'});db[_0xc1dc('0x4f')][_0xc1dc('0x147')](db[_0xc1dc('0xf7')],{'as':'List','foreignKey':_0xc1dc('0x161')});db[_0xc1dc('0x4f')][_0xc1dc('0x147')](db[_0xc1dc('0x8f')],{'as':'mandatoryDispositionPause','foreignKey':_0xc1dc('0x14c')});db[_0xc1dc('0x4f')][_0xc1dc('0x11b')](db['User'],{'as':'Agents','through':_0xc1dc('0x135')});db['FaxApplication']['belongsTo'](db[_0xc1dc('0x13')],{'onDelete':_0xc1dc('0x16d')});db[_0xc1dc('0x51')][_0xc1dc('0x147')](db[_0xc1dc('0x12a')],{'onDelete':_0xc1dc('0x16d')});db['FaxApplication']['belongsTo'](db[_0xc1dc('0x4f')],{'onDelete':_0xc1dc('0x16d')});db[_0xc1dc('0x51')][_0xc1dc('0x147')](db[_0xc1dc('0x97')],{'onDelete':_0xc1dc('0x16d'),'foreignKey':_0xc1dc('0x16e')});db['FaxInteraction']['hasMany'](db[_0xc1dc('0x55')],{'as':_0xc1dc('0x152'),'onDelete':_0xc1dc('0x10e'),'foreignKey':_0xc1dc('0x173')});db['FaxInteraction'][_0xc1dc('0x147')](db[_0xc1dc('0x4f')],{'as':_0xc1dc('0x165'),'foreignKey':_0xc1dc('0x171')});db['FaxInteraction']['belongsTo'](db[_0xc1dc('0x7c')],{'as':'Contact','foreignKey':_0xc1dc('0x157')});db['FaxInteraction'][_0xc1dc('0x147')](db['User'],{'as':_0xc1dc('0x167'),'foreignKey':_0xc1dc('0x10f')});db[_0xc1dc('0x53')][_0xc1dc('0x11b')](db['Tag'],{'through':_0xc1dc('0x174'),'as':_0xc1dc('0x169')});db[_0xc1dc('0x53')][_0xc1dc('0x11b')](db['Tag'],{'through':_0xc1dc('0x174'),'as':_0xc1dc('0x16a')});db['FaxInteraction']['belongsToMany'](db[_0xc1dc('0x13')],{'as':_0xc1dc('0x16b'),'through':_0xc1dc('0x125'),'foreignKey':'FaxInteractionId'});db[_0xc1dc('0x55')]['belongsTo'](db[_0xc1dc('0x13')],{'onDelete':_0xc1dc('0x10e'),'as':_0xc1dc('0x13')});db['FaxMessage']['belongsTo'](db[_0xc1dc('0x53')],{'as':'Interaction','foreignKey':_0xc1dc('0x173')});db[_0xc1dc('0x55')][_0xc1dc('0x147')](db[_0xc1dc('0x7c')],{'onDelete':_0xc1dc('0x10e'),'as':_0xc1dc('0x166')});db['FaxMessage'][_0xc1dc('0x147')](db['Attachment'],{'as':_0xc1dc('0xed'),'foreignKey':_0xc1dc('0x175')});db['FaxMessage'][_0xc1dc('0x147')](db[_0xc1dc('0x4f')],{'as':_0xc1dc('0x165'),'foreignKey':_0xc1dc('0x171')});db[_0xc1dc('0x12a')][_0xc1dc('0x11b')](db['User'],{'as':_0xc1dc('0x14d'),'through':_0xc1dc('0x12c')});db[_0xc1dc('0x12a')][_0xc1dc('0x11b')](db[_0xc1dc('0xe7')],{'through':'team_has_fax_queues','as':_0xc1dc('0x14e')});db[_0xc1dc('0x58')][_0xc1dc('0x147')](db[_0xc1dc('0x4f')],{});db[_0xc1dc('0x58')][_0xc1dc('0x147')](db['CmList'],{'as':_0xc1dc('0x160'),'foreignKey':_0xc1dc('0x161')});db['FaxQueueReport'][_0xc1dc('0x147')](db[_0xc1dc('0x7c')],{'as':_0xc1dc('0x166'),'foreignKey':_0xc1dc('0x157')});db[_0xc1dc('0x58')][_0xc1dc('0x147')](db[_0xc1dc('0x53')],{});db[_0xc1dc('0x58')][_0xc1dc('0x147')](db['FaxMessage'],{});db['FaxQueueReport'][_0xc1dc('0x147')](db['User'],{});db[_0xc1dc('0x58')][_0xc1dc('0x147')](db[_0xc1dc('0x12a')],{});db[_0xc1dc('0x5a')]['hasMany'](db[_0xc1dc('0x8c')],{'as':_0xc1dc('0x15c'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0xc1dc('0x110')](db[_0xc1dc('0x8a')],{'as':_0xc1dc('0x15d'),'foreignKey':'SmsAccountId'});db[_0xc1dc('0x5a')][_0xc1dc('0x110')](db[_0xc1dc('0x176')],{'as':_0xc1dc('0x152'),'foreignKey':'SmsAccountId'});db[_0xc1dc('0x5a')][_0xc1dc('0x110')](db[_0xc1dc('0x5e')],{'as':_0xc1dc('0x15e')});db['SmsAccount'][_0xc1dc('0x110')](db['SmsApplication'],{'as':_0xc1dc('0x13e')});db[_0xc1dc('0x5a')]['belongsTo'](db[_0xc1dc('0xf7')],{'as':'List','foreignKey':_0xc1dc('0x161')});db[_0xc1dc('0x5a')][_0xc1dc('0x147')](db['Pause'],{'as':_0xc1dc('0x14b'),'foreignKey':_0xc1dc('0x14c')});db['SmsAccount'][_0xc1dc('0x11b')](db[_0xc1dc('0x13')],{'as':_0xc1dc('0x14d'),'through':'user_has_sms_accounts'});db['SmsApplication'][_0xc1dc('0x147')](db[_0xc1dc('0x13')],{'onDelete':_0xc1dc('0x16d')});db['SmsApplication'][_0xc1dc('0x147')](db[_0xc1dc('0x61')],{'onDelete':'restrict'});db[_0xc1dc('0x5c')][_0xc1dc('0x147')](db[_0xc1dc('0x5a')],{'onDelete':'restrict'});db[_0xc1dc('0x5c')][_0xc1dc('0x147')](db['Interval'],{'onDelete':_0xc1dc('0x16d'),'foreignKey':_0xc1dc('0x14a')});db[_0xc1dc('0x5c')]['belongsTo'](db[_0xc1dc('0x97')],{'onDelete':'restrict','foreignKey':_0xc1dc('0x16e')});db[_0xc1dc('0x5e')][_0xc1dc('0x110')](db[_0xc1dc('0x176')],{'as':_0xc1dc('0x152'),'onDelete':_0xc1dc('0x10e'),'foreignKey':'SmsInteractionId'});db[_0xc1dc('0x5e')]['belongsTo'](db[_0xc1dc('0x5a')],{'as':'Account','foreignKey':_0xc1dc('0x177')});db[_0xc1dc('0x5e')]['belongsTo'](db['CmContact'],{'as':_0xc1dc('0x166'),'foreignKey':_0xc1dc('0x157')});db[_0xc1dc('0x5e')][_0xc1dc('0x147')](db['User'],{'as':_0xc1dc('0x167'),'foreignKey':_0xc1dc('0x10f')});db[_0xc1dc('0x5e')][_0xc1dc('0x11b')](db[_0xc1dc('0x97')],{'through':_0xc1dc('0x178'),'as':'Tags'});db[_0xc1dc('0x5e')][_0xc1dc('0x11b')](db[_0xc1dc('0x97')],{'through':'sms_interaction_has_tags','as':'ThroughTags'});db[_0xc1dc('0x5e')][_0xc1dc('0x11b')](db[_0xc1dc('0x13')],{'as':'Users','through':_0xc1dc('0x126'),'foreignKey':_0xc1dc('0x179')});db[_0xc1dc('0x176')][_0xc1dc('0x147')](db['User'],{'as':_0xc1dc('0x13')});db['SmsMessage'][_0xc1dc('0x147')](db[_0xc1dc('0x7c')],{'onDelete':_0xc1dc('0x10e'),'as':_0xc1dc('0x166')});db[_0xc1dc('0x176')][_0xc1dc('0x147')](db[_0xc1dc('0x5e')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0xc1dc('0x179')});db[_0xc1dc('0x176')]['belongsTo'](db[_0xc1dc('0x5a')],{'as':_0xc1dc('0x165'),'foreignKey':_0xc1dc('0x177')});db[_0xc1dc('0x61')][_0xc1dc('0x11b')](db['User'],{'as':'Agents','through':'UserSmsQueue','foreignKey':_0xc1dc('0x17a')});db[_0xc1dc('0x61')][_0xc1dc('0x11b')](db[_0xc1dc('0xe7')],{'through':_0xc1dc('0x17b'),'as':_0xc1dc('0x14e')});db[_0xc1dc('0x138')][_0xc1dc('0x110')](db['Disposition'],{'as':_0xc1dc('0x15c'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xc1dc('0x110')](db[_0xc1dc('0x8a')],{'as':_0xc1dc('0x15d'),'foreignKey':'OpenchannelAccountId'});db[_0xc1dc('0x138')][_0xc1dc('0x110')](db[_0xc1dc('0x66')],{'as':_0xc1dc('0x15e'),'foreignKey':_0xc1dc('0x17c')});db['OpenchannelAccount'][_0xc1dc('0x110')](db['OpenchannelMessage'],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db[_0xc1dc('0x138')][_0xc1dc('0x110')](db[_0xc1dc('0x64')],{'as':_0xc1dc('0x13e'),'foreignKey':'OpenchannelAccountId'});db[_0xc1dc('0x138')][_0xc1dc('0x147')](db[_0xc1dc('0xf7')],{'as':'List','foreignKey':'ListId'});db[_0xc1dc('0x138')][_0xc1dc('0x147')](db[_0xc1dc('0x8f')],{'as':_0xc1dc('0x14b'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xc1dc('0x138')][_0xc1dc('0x11b')](db[_0xc1dc('0x13')],{'as':_0xc1dc('0x14d'),'through':_0xc1dc('0x17d')});db['OpenchannelApplication']['belongsTo'](db['User'],{'onDelete':_0xc1dc('0x16d')});db['OpenchannelApplication'][_0xc1dc('0x147')](db[_0xc1dc('0x12e')],{'onDelete':_0xc1dc('0x16d'),'foreignKey':_0xc1dc('0x17e')});db[_0xc1dc('0x64')]['belongsTo'](db[_0xc1dc('0x138')],{'onDelete':_0xc1dc('0x16d'),'foreignKey':'OpenchannelAccountId'});db[_0xc1dc('0x64')][_0xc1dc('0x147')](db['Interval'],{'onDelete':'restrict','foreignKey':_0xc1dc('0x14a')});db['OpenchannelApplication'][_0xc1dc('0x147')](db[_0xc1dc('0x97')],{'onDelete':_0xc1dc('0x16d'),'foreignKey':_0xc1dc('0x16e')});db[_0xc1dc('0x66')][_0xc1dc('0x110')](db[_0xc1dc('0x67')],{'as':_0xc1dc('0x152'),'onDelete':_0xc1dc('0x10e'),'foreignKey':_0xc1dc('0x17f')});db[_0xc1dc('0x66')][_0xc1dc('0x147')](db[_0xc1dc('0x138')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0xc1dc('0x66')][_0xc1dc('0x147')](db[_0xc1dc('0x7c')],{'as':_0xc1dc('0x166'),'foreignKey':_0xc1dc('0x157')});db[_0xc1dc('0x66')][_0xc1dc('0x147')](db['User'],{'as':'Owner','foreignKey':_0xc1dc('0x10f')});db[_0xc1dc('0x66')][_0xc1dc('0x11b')](db[_0xc1dc('0x97')],{'through':_0xc1dc('0x180'),'as':'Tags'});db[_0xc1dc('0x66')][_0xc1dc('0x11b')](db[_0xc1dc('0x97')],{'through':_0xc1dc('0x180'),'as':_0xc1dc('0x16a')});db['OpenchannelInteraction']['belongsToMany'](db[_0xc1dc('0x13')],{'as':_0xc1dc('0x16b'),'through':_0xc1dc('0x181'),'foreignKey':_0xc1dc('0x17f')});db[_0xc1dc('0x67')][_0xc1dc('0x147')](db[_0xc1dc('0x13')],{'onDelete':_0xc1dc('0x10e'),'as':'User'});db[_0xc1dc('0x67')][_0xc1dc('0x147')](db[_0xc1dc('0x7c')],{'onDelete':'cascade','as':_0xc1dc('0x166')});db['OpenchannelMessage']['belongsTo'](db[_0xc1dc('0x66')],{'onDelete':_0xc1dc('0x10e'),'as':'Interaction','foreignKey':_0xc1dc('0x17f')});db[_0xc1dc('0x67')]['belongsTo'](db[_0xc1dc('0xed')],{'as':_0xc1dc('0xed'),'foreignKey':_0xc1dc('0x175')});db['OpenchannelMessage'][_0xc1dc('0x147')](db[_0xc1dc('0x138')],{'as':_0xc1dc('0x165'),'foreignKey':_0xc1dc('0x17c')});db['OpenchannelQueue'][_0xc1dc('0x11b')](db[_0xc1dc('0x13')],{'as':_0xc1dc('0x14d'),'through':_0xc1dc('0x39'),'foreignKey':'OpenchannelQueueId'});db[_0xc1dc('0x12e')]['belongsToMany'](db[_0xc1dc('0xe7')],{'through':_0xc1dc('0x182'),'as':_0xc1dc('0x14e')});db['ChatWebsite'][_0xc1dc('0x110')](db[_0xc1dc('0x8c')],{'as':_0xc1dc('0x15c'),'foreignKey':_0xc1dc('0x183')});db[_0xc1dc('0x6a')][_0xc1dc('0x110')](db[_0xc1dc('0x8a')],{'as':_0xc1dc('0x15d'),'foreignKey':_0xc1dc('0x183')});db[_0xc1dc('0x6a')][_0xc1dc('0x110')](db[_0xc1dc('0x79')],{'as':_0xc1dc('0x184')});db[_0xc1dc('0x6a')][_0xc1dc('0x110')](db[_0xc1dc('0x70')],{'as':'Interactions'});db[_0xc1dc('0x6a')][_0xc1dc('0x110')](db[_0xc1dc('0x6e')],{'as':_0xc1dc('0x13e')});db[_0xc1dc('0x6a')][_0xc1dc('0x110')](db[_0xc1dc('0x72')],{'as':_0xc1dc('0x152')});db['ChatWebsite'][_0xc1dc('0x147')](db[_0xc1dc('0xf7')],{'as':_0xc1dc('0x160'),'foreignKey':_0xc1dc('0x161')});db[_0xc1dc('0x6a')]['belongsTo'](db[_0xc1dc('0x149')],{'as':'Interval','foreignKey':_0xc1dc('0x14a')});db[_0xc1dc('0x6a')][_0xc1dc('0x147')](db[_0xc1dc('0x8f')],{'as':_0xc1dc('0x14b'),'foreignKey':_0xc1dc('0x14c')});db['ChatWebsite'][_0xc1dc('0x11b')](db[_0xc1dc('0x13')],{'as':'Agents','through':'user_has_chat_websites'});db[_0xc1dc('0x6c')][_0xc1dc('0x147')](db['OpenchannelAccount'],{});db[_0xc1dc('0x6c')][_0xc1dc('0x147')](db[_0xc1dc('0xf7')],{'as':_0xc1dc('0x160'),'foreignKey':_0xc1dc('0x161')});db['OpenchannelQueueReport'][_0xc1dc('0x147')](db[_0xc1dc('0x7c')],{'as':_0xc1dc('0x166'),'foreignKey':_0xc1dc('0x157')});db[_0xc1dc('0x6c')][_0xc1dc('0x147')](db['OpenchannelInteraction'],{});db[_0xc1dc('0x6c')]['belongsTo'](db[_0xc1dc('0x67')],{});db[_0xc1dc('0x6c')][_0xc1dc('0x147')](db[_0xc1dc('0x13')],{});db[_0xc1dc('0x6c')][_0xc1dc('0x147')](db[_0xc1dc('0x12e')],{});db[_0xc1dc('0x6e')]['belongsTo'](db[_0xc1dc('0x13')],{'as':_0xc1dc('0x185'),'foreignKey':_0xc1dc('0x10f'),'onDelete':_0xc1dc('0x16d')});db[_0xc1dc('0x6e')][_0xc1dc('0x147')](db[_0xc1dc('0x75')],{'as':'Queue','foreignKey':_0xc1dc('0x186'),'onDelete':_0xc1dc('0x16d')});db[_0xc1dc('0x6e')][_0xc1dc('0x147')](db[_0xc1dc('0x6a')],{'as':_0xc1dc('0x187'),'foreignKey':_0xc1dc('0x183'),'onDelete':_0xc1dc('0x16d')});db[_0xc1dc('0x6e')][_0xc1dc('0x147')](db[_0xc1dc('0x97')],{'onDelete':_0xc1dc('0x16d'),'foreignKey':_0xc1dc('0x16e')});db[_0xc1dc('0x70')][_0xc1dc('0x110')](db[_0xc1dc('0x72')],{'as':_0xc1dc('0x152'),'onDelete':'cascade','foreignKey':_0xc1dc('0x188')});db[_0xc1dc('0x70')][_0xc1dc('0x147')](db[_0xc1dc('0x6a')],{'as':_0xc1dc('0x165'),'foreignKey':_0xc1dc('0x183')});db[_0xc1dc('0x70')][_0xc1dc('0x147')](db['CmContact'],{'as':_0xc1dc('0x166'),'foreignKey':_0xc1dc('0x157')});db[_0xc1dc('0x70')][_0xc1dc('0x147')](db[_0xc1dc('0x13')],{'as':'Owner','foreignKey':_0xc1dc('0x10f')});db[_0xc1dc('0x70')][_0xc1dc('0x11b')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0xc1dc('0x169')});db['ChatInteraction'][_0xc1dc('0x11b')](db[_0xc1dc('0x97')],{'through':'chat_interaction_has_tags','as':_0xc1dc('0x16a')});db[_0xc1dc('0x70')][_0xc1dc('0x11b')](db[_0xc1dc('0x13')],{'as':_0xc1dc('0x16b'),'through':_0xc1dc('0x124'),'foreignKey':_0xc1dc('0x188')});db[_0xc1dc('0x72')]['belongsTo'](db[_0xc1dc('0x13')],{'onDelete':_0xc1dc('0x10e'),'as':_0xc1dc('0x13')});db[_0xc1dc('0x72')][_0xc1dc('0x147')](db[_0xc1dc('0x7c')],{'onDelete':'cascade','as':_0xc1dc('0x166'),'foreignKey':_0xc1dc('0x157')});db[_0xc1dc('0x72')]['belongsTo'](db[_0xc1dc('0x70')],{'onDelete':'cascade','as':'Interaction','foreignKey':'ChatInteractionId'});db['ChatMessage']['belongsTo'](db['Attachment'],{'as':'Attachment','foreignKey':_0xc1dc('0x175')});db[_0xc1dc('0x72')][_0xc1dc('0x147')](db[_0xc1dc('0x6a')],{'as':'Account','foreignKey':_0xc1dc('0x183')});db[_0xc1dc('0x74')]['belongsTo'](db[_0xc1dc('0x7c')],{'onDelete':_0xc1dc('0x10e'),'as':_0xc1dc('0x166'),'foreignKey':'ContactId'});db['ChatOfflineMessage'][_0xc1dc('0x147')](db[_0xc1dc('0x6a')],{'as':_0xc1dc('0x165'),'foreignKey':_0xc1dc('0x183')});db['ChatQueue']['belongsToMany'](db['User'],{'as':_0xc1dc('0x14d'),'through':'UserChatQueue','hooks':!![]});db['ChatQueue'][_0xc1dc('0x11b')](db[_0xc1dc('0xe7')],{'through':_0xc1dc('0x189'),'as':_0xc1dc('0x14e')});db['ChatGroup'][_0xc1dc('0x110')](db[_0xc1dc('0x18a')],{'as':'Messages','foreignKey':_0xc1dc('0x18b'),'onDelete':'cascade'});db[_0xc1dc('0x77')]['belongsToMany'](db[_0xc1dc('0x13')],{'as':'Members','through':_0xc1dc('0x18c')});db['ChatProactiveAction'][_0xc1dc('0x147')](db[_0xc1dc('0x6a')],{'as':_0xc1dc('0x187'),'foreignKey':_0xc1dc('0x183')});db[_0xc1dc('0x18d')][_0xc1dc('0x110')](db['CmContact'],{'as':_0xc1dc('0x11d'),'foreignKey':'CompanyId'});db[_0xc1dc('0x7c')][_0xc1dc('0x110')](db[_0xc1dc('0x7d')],{'as':_0xc1dc('0x143'),'foreignKey':_0xc1dc('0x157')});db[_0xc1dc('0x7c')]['hasMany'](db[_0xc1dc('0x80')],{'as':'HopperFinals','foreignKey':_0xc1dc('0x157')});db['CmContact'][_0xc1dc('0x110')](db['CmHopperHistory'],{'as':_0xc1dc('0x144'),'foreignKey':_0xc1dc('0x157')});db[_0xc1dc('0x7c')][_0xc1dc('0x110')](db[_0xc1dc('0x84')],{'as':_0xc1dc('0x84'),'foreignKey':'ContactId'});db[_0xc1dc('0x7c')]['hasMany'](db[_0xc1dc('0x18e')],{'as':_0xc1dc('0x146'),'foreignKey':_0xc1dc('0x157')});db[_0xc1dc('0x7c')][_0xc1dc('0x110')](db[_0xc1dc('0x66')],{'as':_0xc1dc('0x113'),'foreignKey':_0xc1dc('0x157'),'onDelete':_0xc1dc('0x16d')});db[_0xc1dc('0x7c')][_0xc1dc('0x110')](db['ChatInteraction'],{'as':_0xc1dc('0x123'),'foreignKey':_0xc1dc('0x157'),'onDelete':_0xc1dc('0x16d')});db[_0xc1dc('0x7c')][_0xc1dc('0x110')](db[_0xc1dc('0x5e')],{'as':_0xc1dc('0x114'),'foreignKey':_0xc1dc('0x157'),'onDelete':_0xc1dc('0x16d')});db[_0xc1dc('0x7c')]['hasMany'](db[_0xc1dc('0x53')],{'as':_0xc1dc('0x115'),'foreignKey':_0xc1dc('0x157'),'onDelete':_0xc1dc('0x16d')});db[_0xc1dc('0x7c')][_0xc1dc('0x110')](db['MailInteraction'],{'as':_0xc1dc('0x116'),'foreignKey':_0xc1dc('0x157'),'onDelete':_0xc1dc('0x16d')});db[_0xc1dc('0x7c')][_0xc1dc('0x147')](db[_0xc1dc('0x18d')],{'as':_0xc1dc('0x18f'),'foreignKey':_0xc1dc('0x190')});db[_0xc1dc('0x7c')][_0xc1dc('0x147')](db['CmList'],{'as':_0xc1dc('0x160'),'foreignKey':_0xc1dc('0x161'),'onDelete':_0xc1dc('0x10e')});db[_0xc1dc('0x7c')]['belongsToMany'](db[_0xc1dc('0x13')],{'as':_0xc1dc('0x16b'),'through':_0xc1dc('0x11e')});db[_0xc1dc('0x7c')][_0xc1dc('0x11b')](db[_0xc1dc('0x97')],{'as':_0xc1dc('0x169'),'through':_0xc1dc('0x191')});db[_0xc1dc('0x7c')][_0xc1dc('0x11b')](db[_0xc1dc('0x97')],{'through':'cm_contact_has_tags','as':_0xc1dc('0x16a')});db['CmHopper'][_0xc1dc('0x147')](db[_0xc1dc('0x7c')],{'as':_0xc1dc('0x166'),'foreignKey':'ContactId','onDelete':_0xc1dc('0x10e')});db[_0xc1dc('0x7d')][_0xc1dc('0x147')](db[_0xc1dc('0xf7')],{'as':_0xc1dc('0x160'),'foreignKey':_0xc1dc('0x161'),'onDelete':'cascade'});db[_0xc1dc('0x7d')][_0xc1dc('0x147')](db[_0xc1dc('0x13')],{'as':'Agent','foreignKey':_0xc1dc('0x10f')});db[_0xc1dc('0x7d')][_0xc1dc('0x147')](db[_0xc1dc('0x127')],{'as':_0xc1dc('0x192'),'foreignKey':_0xc1dc('0x142'),'onDelete':_0xc1dc('0x10e')});db[_0xc1dc('0x7d')]['belongsTo'](db[_0xc1dc('0x193')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0xc1dc('0x10e')});db['CmHopper'][_0xc1dc('0x147')](db['User'],{'as':'Owner','foreignKey':_0xc1dc('0x194')});db[_0xc1dc('0x7e')]['belongsTo'](db[_0xc1dc('0x7c')],{'as':'Contact','foreignKey':_0xc1dc('0x157'),'onDelete':_0xc1dc('0x10e')});db['CmHopperBlack'][_0xc1dc('0x147')](db[_0xc1dc('0xf7')],{'as':'List','foreignKey':_0xc1dc('0x161'),'onDelete':'cascade'});db[_0xc1dc('0x7e')][_0xc1dc('0x147')](db[_0xc1dc('0x127')],{'as':_0xc1dc('0x192'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0xc1dc('0x7e')][_0xc1dc('0x147')](db[_0xc1dc('0x193')],{'as':_0xc1dc('0x193'),'foreignKey':_0xc1dc('0x195'),'onDelete':'cascade'});db['Automation']['hasMany'](db[_0xc1dc('0x196')],{'as':{'plural':_0xc1dc('0x197'),'singular':_0xc1dc('0x198')},'foreignKey':'AutomationAllId','onDelete':_0xc1dc('0x10e'),'hooks':!![]});db['Automation'][_0xc1dc('0x110')](db[_0xc1dc('0x196')],{'as':{'plural':_0xc1dc('0x199'),'singular':'OneAny'},'foreignKey':_0xc1dc('0x19a'),'onDelete':'cascade','hooks':!![]});db[_0xc1dc('0x88')][_0xc1dc('0x110')](db['Action'],{'as':'Actions','foreignKey':_0xc1dc('0x19b'),'onDelete':'cascade','hooks':!![]});db[_0xc1dc('0x149')][_0xc1dc('0x110')](db[_0xc1dc('0x149')],{'as':_0xc1dc('0x19c'),'foreignKey':_0xc1dc('0x14a'),'onDelete':_0xc1dc('0x10e'),'hooks':!![],'required':![]});db[_0xc1dc('0x149')][_0xc1dc('0x110')](db[_0xc1dc('0x18')],{'as':_0xc1dc('0x112'),'foreignKey':_0xc1dc('0x14a'),'onDelete':'restrict'});db[_0xc1dc('0x149')][_0xc1dc('0x110')](db['MailApplication'],{'as':_0xc1dc('0x19d'),'foreignKey':_0xc1dc('0x14a')});db['Interval']['hasMany'](db['ChatApplication'],{'as':'ChatApplications','foreignKey':'IntervalId'});db[_0xc1dc('0x149')]['hasMany'](db[_0xc1dc('0x51')],{'as':_0xc1dc('0x19e'),'foreignKey':_0xc1dc('0x14a')});db['Interval'][_0xc1dc('0x110')](db[_0xc1dc('0x5c')],{'as':'SmsApplications','foreignKey':_0xc1dc('0x14a')});db[_0xc1dc('0x94')]['belongsTo'](db['MailAccount'],{});db['Schedule'][_0xc1dc('0x147')](db['AnalyticDefaultReport'],{'foreignKey':_0xc1dc('0x19f')});db['Schedule'][_0xc1dc('0x147')](db[_0xc1dc('0x1a0')],{'foreignKey':'CustomReportId'});db[_0xc1dc('0x95')]['belongsToMany'](db[_0xc1dc('0x1a')],{'as':_0xc1dc('0x1a1'),'through':_0xc1dc('0x140'),'onDelete':_0xc1dc('0x16d')});db[_0xc1dc('0x97')][_0xc1dc('0x11b')](db[_0xc1dc('0x7c')],{'through':_0xc1dc('0x191')});db[_0xc1dc('0x97')]['belongsToMany'](db['ChatInteraction'],{'through':_0xc1dc('0x1a2')});db[_0xc1dc('0x97')][_0xc1dc('0x11b')](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0xc1dc('0x97')][_0xc1dc('0x11b')](db[_0xc1dc('0x5e')],{'through':_0xc1dc('0x178')});db[_0xc1dc('0x97')][_0xc1dc('0x11b')](db[_0xc1dc('0x53')],{'through':_0xc1dc('0x174')});db[_0xc1dc('0x97')][_0xc1dc('0x11b')](db['OpenchannelInteraction'],{'through':_0xc1dc('0x180')});db[_0xc1dc('0x97')][_0xc1dc('0x11b')](db['WhatsappInteraction'],{'through':'whatsapp_interaction_has_tags'});db[_0xc1dc('0x9a')][_0xc1dc('0x110')](db[_0xc1dc('0x196')],{'as':{'plural':_0xc1dc('0x1a3'),'singular':_0xc1dc('0x1a4')},'foreignKey':_0xc1dc('0x1a5'),'onDelete':_0xc1dc('0x10e'),'hooks':!![]});db['Trigger'][_0xc1dc('0x110')](db[_0xc1dc('0x196')],{'as':{'plural':_0xc1dc('0x1a6'),'singular':_0xc1dc('0x1a7')},'foreignKey':_0xc1dc('0x1a8'),'onDelete':_0xc1dc('0x10e'),'hooks':!![]});db[_0xc1dc('0x9a')][_0xc1dc('0x110')](db[_0xc1dc('0x86')],{'as':_0xc1dc('0x1a9'),'foreignKey':'TriggerId','onDelete':_0xc1dc('0x10e'),'hooks':!![]});db[_0xc1dc('0x1a0')][_0xc1dc('0x110')](db[_0xc1dc('0x1aa')],{'as':_0xc1dc('0x1ab'),'onDelete':'cascade','foreignKey':_0xc1dc('0x1ac'),'hooks':!![]});db[_0xc1dc('0xa1')][_0xc1dc('0x110')](db[_0xc1dc('0x1aa')],{'as':'Fields','onDelete':_0xc1dc('0x10e'),'foreignKey':'DefaultReportId'});db[_0xc1dc('0x1ad')][_0xc1dc('0x110')](db[_0xc1dc('0x1aa')],{'as':'Fields','onDelete':_0xc1dc('0x10e'),'foreignKey':_0xc1dc('0x1ae')});db[_0xc1dc('0x1aa')]['belongsTo'](db[_0xc1dc('0x1ad')],{'foreignKey':'MetricId'});db['SalesforceAccount']['hasMany'](db[_0xc1dc('0xaa')],{'as':_0xc1dc('0x1af'),'onDelete':'cascade','foreignKey':_0xc1dc('0x1b0')});db[_0xc1dc('0xaa')][_0xc1dc('0x110')](db[_0xc1dc('0xac')],{'as':'Subjects','onDelete':_0xc1dc('0x10e'),'foreignKey':'SubjectId'});db['SalesforceConfiguration']['hasMany'](db[_0xc1dc('0xac')],{'as':'Descriptions','onDelete':_0xc1dc('0x10e'),'foreignKey':_0xc1dc('0x1b1')});db[_0xc1dc('0xaa')][_0xc1dc('0x110')](db['SalesforceField'],{'as':_0xc1dc('0x1ab'),'onDelete':_0xc1dc('0x10e'),'foreignKey':'FieldId'});db[_0xc1dc('0xaa')]['belongsTo'](db[_0xc1dc('0xa8')],{'as':'Account','foreignKey':_0xc1dc('0x1b0')});db['SalesforceField']['hasMany'](db['SalesforceField'],{'as':_0xc1dc('0x1b2'),'foreignKey':_0xc1dc('0x1b3')});db[_0xc1dc('0xac')]['hasMany'](db[_0xc1dc('0xac')],{'as':_0xc1dc('0x1b4'),'foreignKey':_0xc1dc('0x1b1')});db[_0xc1dc('0xac')]['hasMany'](db[_0xc1dc('0xac')],{'as':_0xc1dc('0x1b5'),'foreignKey':_0xc1dc('0x1b6')});db['SalesforceField'][_0xc1dc('0x147')](db[_0xc1dc('0x9c')],{'as':_0xc1dc('0x9c'),'foreignKey':'VariableId'});db[_0xc1dc('0xae')]['hasMany'](db[_0xc1dc('0x1b7')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xc1dc('0x1b0')});db['SugarcrmConfiguration'][_0xc1dc('0x110')](db[_0xc1dc('0x1b8')],{'as':_0xc1dc('0x1b9'),'onDelete':_0xc1dc('0x10e'),'foreignKey':_0xc1dc('0x1b3')});db[_0xc1dc('0x1b7')][_0xc1dc('0x110')](db[_0xc1dc('0x1b8')],{'as':_0xc1dc('0x1ba'),'onDelete':_0xc1dc('0x10e'),'foreignKey':'DescriptionId'});db[_0xc1dc('0x1b7')][_0xc1dc('0x110')](db[_0xc1dc('0x1b8')],{'as':_0xc1dc('0x1ab'),'onDelete':_0xc1dc('0x10e'),'foreignKey':_0xc1dc('0x1b6')});db[_0xc1dc('0x1b7')][_0xc1dc('0x147')](db['SugarcrmAccount'],{'as':'Account','foreignKey':_0xc1dc('0x1b0')});db[_0xc1dc('0x1b8')]['hasMany'](db[_0xc1dc('0x1b8')],{'as':'Subject','foreignKey':_0xc1dc('0x1b3')});db[_0xc1dc('0x1b8')][_0xc1dc('0x110')](db[_0xc1dc('0x1b8')],{'as':_0xc1dc('0x1b4'),'foreignKey':'DescriptionId'});db[_0xc1dc('0x1b8')][_0xc1dc('0x110')](db[_0xc1dc('0x1b8')],{'as':_0xc1dc('0x1b5'),'foreignKey':_0xc1dc('0x1b6')});db[_0xc1dc('0x1b8')][_0xc1dc('0x147')](db['Variable'],{'as':_0xc1dc('0x9c'),'foreignKey':_0xc1dc('0x1bb')});db['DeskAccount']['hasMany'](db['DeskConfiguration'],{'as':_0xc1dc('0x1af'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xc1dc('0xb2')]['hasMany'](db[_0xc1dc('0x1bc')],{'as':_0xc1dc('0x1b9'),'onDelete':_0xc1dc('0x10e'),'foreignKey':'SubjectId'});db[_0xc1dc('0xb2')][_0xc1dc('0x110')](db[_0xc1dc('0x1bc')],{'as':_0xc1dc('0x1ba'),'onDelete':_0xc1dc('0x10e'),'foreignKey':_0xc1dc('0x1b1')});db[_0xc1dc('0xb2')]['hasMany'](db['DeskField'],{'as':_0xc1dc('0x1ab'),'onDelete':_0xc1dc('0x10e'),'foreignKey':_0xc1dc('0x1b6')});db[_0xc1dc('0xb2')][_0xc1dc('0x147')](db[_0xc1dc('0xb1')],{'as':'Account','foreignKey':_0xc1dc('0x1b0')});db[_0xc1dc('0xb2')][_0xc1dc('0x11b')](db['Tag'],{'through':'int_desk_configuration_has_tags'});db[_0xc1dc('0x1bc')]['hasMany'](db[_0xc1dc('0x1bc')],{'as':_0xc1dc('0x1b2'),'foreignKey':_0xc1dc('0x1b3')});db[_0xc1dc('0x1bc')]['hasMany'](db[_0xc1dc('0x1bc')],{'as':_0xc1dc('0x1b4'),'foreignKey':_0xc1dc('0x1b1')});db[_0xc1dc('0x1bc')][_0xc1dc('0x110')](db[_0xc1dc('0x1bc')],{'as':'Field','foreignKey':'FieldId'});db[_0xc1dc('0x1bc')][_0xc1dc('0x147')](db['Variable'],{'as':_0xc1dc('0x9c'),'foreignKey':_0xc1dc('0x1bb')});db['ZohoAccount'][_0xc1dc('0x110')](db[_0xc1dc('0x1bd')],{'as':_0xc1dc('0x1af'),'onDelete':_0xc1dc('0x10e'),'foreignKey':_0xc1dc('0x1b0')});db[_0xc1dc('0x1bd')][_0xc1dc('0x110')](db[_0xc1dc('0xb7')],{'as':_0xc1dc('0x1b9'),'onDelete':'cascade','foreignKey':_0xc1dc('0x1b3')});db['ZohoConfiguration'][_0xc1dc('0x110')](db[_0xc1dc('0xb7')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xc1dc('0x1b1')});db['ZohoConfiguration'][_0xc1dc('0x110')](db['ZohoField'],{'as':_0xc1dc('0x1ab'),'onDelete':'cascade','foreignKey':_0xc1dc('0x1b6')});db[_0xc1dc('0x1bd')][_0xc1dc('0x147')](db[_0xc1dc('0xb4')],{'as':_0xc1dc('0x165'),'foreignKey':_0xc1dc('0x1b0')});db[_0xc1dc('0xb7')][_0xc1dc('0x110')](db[_0xc1dc('0xb7')],{'as':'Subject','foreignKey':_0xc1dc('0x1b3')});db[_0xc1dc('0xb7')][_0xc1dc('0x110')](db[_0xc1dc('0xb7')],{'as':_0xc1dc('0x1b4'),'foreignKey':_0xc1dc('0x1b1')});db[_0xc1dc('0xb7')][_0xc1dc('0x110')](db[_0xc1dc('0xb7')],{'as':_0xc1dc('0x1b5'),'foreignKey':_0xc1dc('0x1b6')});db['ZohoField'][_0xc1dc('0x147')](db[_0xc1dc('0x9c')],{'as':_0xc1dc('0x9c'),'foreignKey':_0xc1dc('0x1bb')});db[_0xc1dc('0x1be')]['hasMany'](db[_0xc1dc('0xba')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xc1dc('0x1b0')});db['ZendeskConfiguration'][_0xc1dc('0x110')](db[_0xc1dc('0xbc')],{'as':'Subjects','foreignKey':_0xc1dc('0x1b3')});db['ZendeskConfiguration'][_0xc1dc('0x110')](db['ZendeskField'],{'as':'Descriptions','foreignKey':_0xc1dc('0x1b1')});db[_0xc1dc('0xba')][_0xc1dc('0x110')](db[_0xc1dc('0xbc')],{'as':_0xc1dc('0x1ab'),'foreignKey':_0xc1dc('0x1b6')});db[_0xc1dc('0xba')][_0xc1dc('0x147')](db['ZendeskAccount'],{'as':_0xc1dc('0x165'),'foreignKey':_0xc1dc('0x1b0')});db[_0xc1dc('0xba')][_0xc1dc('0x11b')](db[_0xc1dc('0x97')],{'through':_0xc1dc('0x1bf')});db['ZendeskField'][_0xc1dc('0x110')](db['ZendeskField'],{'as':_0xc1dc('0x1b2'),'foreignKey':_0xc1dc('0x1b3')});db[_0xc1dc('0xbc')][_0xc1dc('0x110')](db[_0xc1dc('0xbc')],{'as':_0xc1dc('0x1b4'),'foreignKey':_0xc1dc('0x1b1')});db[_0xc1dc('0xbc')][_0xc1dc('0x110')](db['ZendeskField'],{'as':_0xc1dc('0x1b5'),'foreignKey':_0xc1dc('0x1b6')});db[_0xc1dc('0xbc')][_0xc1dc('0x147')](db['Variable'],{'as':_0xc1dc('0x9c'),'foreignKey':'VariableId'});db[_0xc1dc('0xbe')][_0xc1dc('0x110')](db[_0xc1dc('0xc0')],{'as':_0xc1dc('0x1af'),'onDelete':'cascade','foreignKey':_0xc1dc('0x1b0')});db[_0xc1dc('0xc0')]['hasMany'](db[_0xc1dc('0x1c0')],{'as':_0xc1dc('0x1b9'),'onDelete':_0xc1dc('0x10e'),'foreignKey':'SubjectId'});db[_0xc1dc('0xc0')]['hasMany'](db[_0xc1dc('0x1c0')],{'as':_0xc1dc('0x1ba'),'onDelete':_0xc1dc('0x10e'),'foreignKey':_0xc1dc('0x1b1')});db[_0xc1dc('0xc0')][_0xc1dc('0x110')](db[_0xc1dc('0x1c0')],{'as':_0xc1dc('0x1ab'),'onDelete':_0xc1dc('0x10e'),'foreignKey':_0xc1dc('0x1b6')});db[_0xc1dc('0xc0')][_0xc1dc('0x147')](db[_0xc1dc('0xbe')],{'as':_0xc1dc('0x165'),'foreignKey':_0xc1dc('0x1b0')});db[_0xc1dc('0xc0')][_0xc1dc('0x11b')](db[_0xc1dc('0x97')],{'through':_0xc1dc('0x1c1')});db[_0xc1dc('0x1c0')][_0xc1dc('0x110')](db[_0xc1dc('0x1c0')],{'as':_0xc1dc('0x1b2'),'foreignKey':'SubjectId'});db[_0xc1dc('0x1c0')][_0xc1dc('0x110')](db[_0xc1dc('0x1c0')],{'as':_0xc1dc('0x1b4'),'foreignKey':'DescriptionId'});db[_0xc1dc('0x1c0')]['hasMany'](db['FreshdeskField'],{'as':_0xc1dc('0x1b5'),'foreignKey':_0xc1dc('0x1b6')});db[_0xc1dc('0x1c0')][_0xc1dc('0x147')](db[_0xc1dc('0x9c')],{'as':_0xc1dc('0x9c'),'foreignKey':_0xc1dc('0x1bb')});db[_0xc1dc('0xc3')][_0xc1dc('0x110')](db[_0xc1dc('0xc5')],{'as':_0xc1dc('0x1af'),'onDelete':_0xc1dc('0x10e'),'foreignKey':_0xc1dc('0x1b0')});db[_0xc1dc('0xc5')]['hasMany'](db[_0xc1dc('0x1c2')],{'as':'Subjects','foreignKey':_0xc1dc('0x1b3')});db[_0xc1dc('0xc5')][_0xc1dc('0x110')](db[_0xc1dc('0x1c2')],{'as':_0xc1dc('0x1ba'),'foreignKey':_0xc1dc('0x1b1')});db['VtigerConfiguration']['hasMany'](db[_0xc1dc('0x1c2')],{'as':_0xc1dc('0x1ab'),'foreignKey':'FieldId'});db['VtigerConfiguration'][_0xc1dc('0x147')](db[_0xc1dc('0xc3')],{'as':_0xc1dc('0x165'),'foreignKey':_0xc1dc('0x1b0')});db[_0xc1dc('0x1c2')][_0xc1dc('0x110')](db[_0xc1dc('0x1c2')],{'as':'Subject','foreignKey':_0xc1dc('0x1b3')});db[_0xc1dc('0x1c2')][_0xc1dc('0x110')](db[_0xc1dc('0x1c2')],{'as':_0xc1dc('0x1b4'),'foreignKey':'DescriptionId'});db[_0xc1dc('0x1c2')][_0xc1dc('0x110')](db['VtigerField'],{'as':'Field','foreignKey':_0xc1dc('0x1b6')});db[_0xc1dc('0x1c2')][_0xc1dc('0x147')](db[_0xc1dc('0x9c')],{'as':'Variable','foreignKey':_0xc1dc('0x1bb')});db[_0xc1dc('0x1c3')]['hasMany'](db['ServicenowConfiguration'],{'as':'Configurations','onDelete':_0xc1dc('0x10e'),'foreignKey':_0xc1dc('0x1b0')});db[_0xc1dc('0xc9')][_0xc1dc('0x110')](db[_0xc1dc('0xcb')],{'as':_0xc1dc('0x1b9'),'foreignKey':_0xc1dc('0x1b3')});db[_0xc1dc('0xc9')][_0xc1dc('0x110')](db[_0xc1dc('0xcb')],{'as':_0xc1dc('0x1ba'),'foreignKey':_0xc1dc('0x1b1')});db[_0xc1dc('0xc9')][_0xc1dc('0x110')](db[_0xc1dc('0xcb')],{'as':_0xc1dc('0x1ab'),'foreignKey':'FieldId'});db[_0xc1dc('0xc9')][_0xc1dc('0x147')](db['ServicenowAccount'],{'as':_0xc1dc('0x165'),'foreignKey':_0xc1dc('0x1b0')});db[_0xc1dc('0xcb')]['hasMany'](db[_0xc1dc('0xcb')],{'as':'Subject','foreignKey':_0xc1dc('0x1b3')});db[_0xc1dc('0xcb')][_0xc1dc('0x110')](db[_0xc1dc('0xcb')],{'as':_0xc1dc('0x1b4'),'foreignKey':_0xc1dc('0x1b1')});db[_0xc1dc('0xcb')]['hasMany'](db[_0xc1dc('0xcb')],{'as':'Field','foreignKey':_0xc1dc('0x1b6')});db[_0xc1dc('0xcb')]['belongsTo'](db[_0xc1dc('0x9c')],{'as':_0xc1dc('0x9c'),'foreignKey':_0xc1dc('0x1bb')});db['Dynamics365Account']['hasMany'](db[_0xc1dc('0x1c4')],{'as':_0xc1dc('0x1af'),'onDelete':_0xc1dc('0x10e'),'foreignKey':_0xc1dc('0x1b0')});db[_0xc1dc('0x1c4')][_0xc1dc('0x110')](db[_0xc1dc('0xcf')],{'as':_0xc1dc('0x1b9'),'onDelete':_0xc1dc('0x10e'),'foreignKey':_0xc1dc('0x1b3')});db[_0xc1dc('0x1c4')]['hasMany'](db[_0xc1dc('0xcf')],{'as':_0xc1dc('0x1ba'),'onDelete':_0xc1dc('0x10e'),'foreignKey':'DescriptionId'});db[_0xc1dc('0x1c4')][_0xc1dc('0x110')](db[_0xc1dc('0xcf')],{'as':'Fields','onDelete':_0xc1dc('0x10e'),'foreignKey':_0xc1dc('0x1b6')});db['Dynamics365Configuration'][_0xc1dc('0x147')](db[_0xc1dc('0xcd')],{'as':_0xc1dc('0x165'),'foreignKey':_0xc1dc('0x1b0')});db[_0xc1dc('0xcf')][_0xc1dc('0x110')](db[_0xc1dc('0xcf')],{'as':_0xc1dc('0x1b2'),'foreignKey':_0xc1dc('0x1b3')});db[_0xc1dc('0xcf')][_0xc1dc('0x110')](db[_0xc1dc('0xcf')],{'as':_0xc1dc('0x1b4'),'foreignKey':'DescriptionId'});db[_0xc1dc('0xcf')]['hasMany'](db[_0xc1dc('0xcf')],{'as':_0xc1dc('0x1b5'),'foreignKey':_0xc1dc('0x1b6')});db[_0xc1dc('0xcf')]['belongsTo'](db[_0xc1dc('0x9c')],{'as':'Variable','foreignKey':'VariableId'});db[_0xc1dc('0xd0')][_0xc1dc('0x110')](db[_0xc1dc('0x1c5')],{'as':_0xc1dc('0x1af'),'onDelete':'cascade','foreignKey':_0xc1dc('0x1b0')});db[_0xc1dc('0x1c5')][_0xc1dc('0x110')](db[_0xc1dc('0xd2')],{'as':'Subjects','foreignKey':_0xc1dc('0x1b3')});db['FreshsalesConfiguration'][_0xc1dc('0x110')](db['FreshsalesField'],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0xc1dc('0x1c5')][_0xc1dc('0x110')](db[_0xc1dc('0xd2')],{'as':'Fields','foreignKey':'FieldId'});db[_0xc1dc('0x1c5')]['belongsTo'](db[_0xc1dc('0xd0')],{'as':_0xc1dc('0x165'),'foreignKey':_0xc1dc('0x1b0')});db[_0xc1dc('0xd2')][_0xc1dc('0x110')](db['FreshsalesField'],{'as':_0xc1dc('0x1b2'),'foreignKey':_0xc1dc('0x1b3')});db['FreshsalesField'][_0xc1dc('0x110')](db[_0xc1dc('0xd2')],{'as':_0xc1dc('0x1b4'),'foreignKey':_0xc1dc('0x1b1')});db['FreshsalesField']['hasMany'](db[_0xc1dc('0xd2')],{'as':_0xc1dc('0x1b5'),'foreignKey':'FieldId'});db[_0xc1dc('0xd2')][_0xc1dc('0x147')](db[_0xc1dc('0x9c')],{'as':_0xc1dc('0x9c'),'foreignKey':'VariableId'});db[_0xc1dc('0x1c6')][_0xc1dc('0x147')](db[_0xc1dc('0x6a')],{});db['ChatQueueReport'][_0xc1dc('0x147')](db['CmList'],{'as':_0xc1dc('0x160'),'foreignKey':_0xc1dc('0x161')});db[_0xc1dc('0x1c6')][_0xc1dc('0x147')](db['CmContact'],{'as':_0xc1dc('0x166'),'foreignKey':_0xc1dc('0x157')});db['ChatQueueReport'][_0xc1dc('0x147')](db[_0xc1dc('0x70')],{});db[_0xc1dc('0x1c6')][_0xc1dc('0x147')](db['ChatMessage'],{});db[_0xc1dc('0x1c6')][_0xc1dc('0x147')](db['User'],{});db['ChatQueueReport'][_0xc1dc('0x147')](db[_0xc1dc('0x75')],{});db[_0xc1dc('0x18a')][_0xc1dc('0x147')](db[_0xc1dc('0x13')],{'onDelete':_0xc1dc('0x10e'),'foreignKey':'FromId'});db[_0xc1dc('0x18a')][_0xc1dc('0x147')](db['User'],{'onDelete':_0xc1dc('0x10e'),'foreignKey':_0xc1dc('0x1c7')});db[_0xc1dc('0x18e')][_0xc1dc('0x110')](db[_0xc1dc('0x1c8')],{'foreignKey':_0xc1dc('0x1c9'),'onDelete':_0xc1dc('0x10e')});db[_0xc1dc('0x18e')][_0xc1dc('0x110')](db[_0xc1dc('0xd7')],{'foreignKey':'SessionId','onDelete':_0xc1dc('0x10e')});db[_0xc1dc('0x1ca')][_0xc1dc('0x147')](db[_0xc1dc('0x5a')],{});db[_0xc1dc('0x1ca')][_0xc1dc('0x147')](db['CmList'],{'as':_0xc1dc('0x160'),'foreignKey':'ListId'});db[_0xc1dc('0x1ca')][_0xc1dc('0x147')](db[_0xc1dc('0x7c')],{'as':_0xc1dc('0x166'),'foreignKey':_0xc1dc('0x157')});db[_0xc1dc('0x1ca')][_0xc1dc('0x147')](db[_0xc1dc('0x5e')],{});db[_0xc1dc('0x1ca')]['belongsTo'](db[_0xc1dc('0x176')],{});db[_0xc1dc('0x1ca')][_0xc1dc('0x147')](db[_0xc1dc('0x13')],{});db[_0xc1dc('0x1ca')][_0xc1dc('0x147')](db['SmsQueue'],{});db[_0xc1dc('0xde')]['hasMany'](db[_0xc1dc('0x18e')],{'foreignKey':_0xc1dc('0x1cb')});db[_0xc1dc('0xde')][_0xc1dc('0x110')](db['JscriptyQuestionReport'],{'foreignKey':_0xc1dc('0x1cb')});db[_0xc1dc('0xde')][_0xc1dc('0x110')](db[_0xc1dc('0xd7')],{'foreignKey':'ProjectId'});db['SquareProject'][_0xc1dc('0x11b')](db['User'],{'as':_0xc1dc('0x16b'),'through':_0xc1dc('0x13b')});db['Team'][_0xc1dc('0x11b')](db[_0xc1dc('0x13')],{'as':_0xc1dc('0x14d'),'through':_0xc1dc('0x121')});db['Team'][_0xc1dc('0x11b')](db[_0xc1dc('0x127')],{'through':_0xc1dc('0x14f'),'as':_0xc1dc('0x128')});db[_0xc1dc('0xe7')][_0xc1dc('0x11b')](db['MailQueue'],{'through':_0xc1dc('0x1cc'),'as':_0xc1dc('0x129')});db[_0xc1dc('0xe7')][_0xc1dc('0x11b')](db[_0xc1dc('0x75')],{'through':'team_has_chat_queues','as':'ChatQueues'});db[_0xc1dc('0xe7')][_0xc1dc('0x11b')](db['FaxQueue'],{'through':'team_has_fax_queues','as':'FaxQueues'});db['Team'][_0xc1dc('0x11b')](db[_0xc1dc('0x61')],{'through':'team_has_sms_queues','as':_0xc1dc('0x12d')});db[_0xc1dc('0xe7')][_0xc1dc('0x11b')](db[_0xc1dc('0x12e')],{'through':_0xc1dc('0x182'),'as':_0xc1dc('0x12f')});db[_0xc1dc('0xe7')][_0xc1dc('0x11b')](db[_0xc1dc('0x10a')],{'through':_0xc1dc('0x1cd'),'as':_0xc1dc('0x130')});db[_0xc1dc('0x193')][_0xc1dc('0x110')](db['CmHopper'],{'as':'Hoppers','foreignKey':'CampaignId'});db[_0xc1dc('0x193')]['hasMany'](db[_0xc1dc('0x80')],{'as':_0xc1dc('0x1ce'),'foreignKey':_0xc1dc('0x195')});db[_0xc1dc('0x193')][_0xc1dc('0x110')](db['CmHopperHistory'],{'as':_0xc1dc('0x144'),'foreignKey':_0xc1dc('0x195')});db[_0xc1dc('0x193')][_0xc1dc('0x110')](db['CmHopperBlack'],{'as':_0xc1dc('0x145'),'foreignKey':_0xc1dc('0x195')});db[_0xc1dc('0x193')]['belongsTo'](db['Trunk'],{'as':'Trunk','foreignKey':_0xc1dc('0x1cf')});db['Campaign'][_0xc1dc('0x147')](db[_0xc1dc('0x2d')],{'as':_0xc1dc('0x148'),'foreignKey':_0xc1dc('0x1d0')});db[_0xc1dc('0x193')][_0xc1dc('0x147')](db[_0xc1dc('0x149')],{'as':_0xc1dc('0x149'),'foreignKey':'IntervalId'});db[_0xc1dc('0x193')][_0xc1dc('0x147')](db[_0xc1dc('0xe2')],{'as':_0xc1dc('0xe2'),'foreignKey':'SquareProjectId'});db[_0xc1dc('0x193')]['belongsToMany'](db[_0xc1dc('0xf7')],{'as':_0xc1dc('0x11f'),'through':_0xc1dc('0x1d1')});db[_0xc1dc('0x193')]['belongsToMany'](db[_0xc1dc('0xf7')],{'as':'BlackLists','through':_0xc1dc('0x1d2')});db[_0xc1dc('0xf0')][_0xc1dc('0x147')](db[_0xc1dc('0x49')],{});db[_0xc1dc('0xf0')]['belongsTo'](db[_0xc1dc('0x47')],{});db['MailTransferReport'][_0xc1dc('0x147')](db[_0xc1dc('0x41')],{'foreignKey':'FromMailAccountId','as':_0xc1dc('0x1d3')});db['MailTransferReport'][_0xc1dc('0x147')](db[_0xc1dc('0x13')],{'foreignKey':_0xc1dc('0x1d4'),'as':'FromAgent'});db[_0xc1dc('0xf0')][_0xc1dc('0x147')](db[_0xc1dc('0x13')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xc1dc('0xf0')][_0xc1dc('0x147')](db[_0xc1dc('0x43')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0xc1dc('0xf0')][_0xc1dc('0x147')](db[_0xc1dc('0x41')],{'foreignKey':_0xc1dc('0x1d5'),'as':_0xc1dc('0x1d6')});db[_0xc1dc('0xf2')][_0xc1dc('0x147')](db[_0xc1dc('0x72')],{});db['ChatTransferReport'][_0xc1dc('0x147')](db['ChatInteraction'],{});db[_0xc1dc('0xf2')][_0xc1dc('0x147')](db[_0xc1dc('0x6a')],{'foreignKey':_0xc1dc('0x1d7'),'as':_0xc1dc('0x1d3')});db['ChatTransferReport'][_0xc1dc('0x147')](db[_0xc1dc('0x13')],{'foreignKey':_0xc1dc('0x1d4'),'as':_0xc1dc('0x1d8')});db['ChatTransferReport'][_0xc1dc('0x147')](db['User'],{'foreignKey':_0xc1dc('0x1d9'),'as':_0xc1dc('0x1da')});db['ChatTransferReport'][_0xc1dc('0x147')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0xc1dc('0x1db')});db[_0xc1dc('0xf2')]['belongsTo'](db['ChatWebsite'],{'foreignKey':'ToChatWebsiteId','as':_0xc1dc('0x1d6')});db['FaxTransferReport']['belongsTo'](db[_0xc1dc('0x55')],{});db[_0xc1dc('0x1dc')][_0xc1dc('0x147')](db[_0xc1dc('0x53')],{});db[_0xc1dc('0x1dc')][_0xc1dc('0x147')](db[_0xc1dc('0x4f')],{'foreignKey':_0xc1dc('0x1dd'),'as':'FromAccount'});db[_0xc1dc('0x1dc')][_0xc1dc('0x147')](db[_0xc1dc('0x13')],{'foreignKey':_0xc1dc('0x1d4'),'as':'FromAgent'});db[_0xc1dc('0x1dc')][_0xc1dc('0x147')](db[_0xc1dc('0x13')],{'foreignKey':_0xc1dc('0x1d9'),'as':_0xc1dc('0x1da')});db[_0xc1dc('0x1dc')][_0xc1dc('0x147')](db['FaxQueue'],{'foreignKey':_0xc1dc('0x1de'),'as':_0xc1dc('0x1db')});db['FaxTransferReport']['belongsTo'](db[_0xc1dc('0x4f')],{'foreignKey':'ToFaxAccountId','as':_0xc1dc('0x1d6')});db[_0xc1dc('0xf5')][_0xc1dc('0x147')](db[_0xc1dc('0x67')],{});db[_0xc1dc('0xf5')][_0xc1dc('0x147')](db[_0xc1dc('0x66')],{});db['OpenchannelTransferReport']['belongsTo'](db[_0xc1dc('0x138')],{'foreignKey':_0xc1dc('0x1df'),'as':_0xc1dc('0x1d3')});db['OpenchannelTransferReport'][_0xc1dc('0x147')](db[_0xc1dc('0x13')],{'foreignKey':_0xc1dc('0x1d4'),'as':_0xc1dc('0x1d8')});db[_0xc1dc('0xf5')][_0xc1dc('0x147')](db[_0xc1dc('0x13')],{'foreignKey':_0xc1dc('0x1d9'),'as':_0xc1dc('0x1da')});db[_0xc1dc('0xf5')]['belongsTo'](db[_0xc1dc('0x12e')],{'foreignKey':_0xc1dc('0x1e0'),'as':_0xc1dc('0x1db')});db[_0xc1dc('0xf5')][_0xc1dc('0x147')](db[_0xc1dc('0x138')],{'foreignKey':_0xc1dc('0x1e1'),'as':_0xc1dc('0x1d6')});db[_0xc1dc('0x1e2')][_0xc1dc('0x147')](db[_0xc1dc('0x176')],{});db['SmsTransferReport'][_0xc1dc('0x147')](db[_0xc1dc('0x5e')],{});db[_0xc1dc('0x1e2')][_0xc1dc('0x147')](db[_0xc1dc('0x5a')],{'foreignKey':'FromSmsAccountId','as':_0xc1dc('0x1d3')});db[_0xc1dc('0x1e2')]['belongsTo'](db['User'],{'foreignKey':_0xc1dc('0x1d4'),'as':_0xc1dc('0x1d8')});db[_0xc1dc('0x1e2')][_0xc1dc('0x147')](db['User'],{'foreignKey':_0xc1dc('0x1d9'),'as':'ToAgent'});db[_0xc1dc('0x1e2')][_0xc1dc('0x147')](db[_0xc1dc('0x61')],{'foreignKey':_0xc1dc('0x1e3'),'as':_0xc1dc('0x1db')});db[_0xc1dc('0x1e2')][_0xc1dc('0x147')](db['SmsAccount'],{'foreignKey':'ToSmsAccountId','as':_0xc1dc('0x1d6')});db['CmList'][_0xc1dc('0x110')](db[_0xc1dc('0x8c')],{'as':_0xc1dc('0x15c'),'foreignKey':'ListId'});db['CmList']['hasMany'](db[_0xc1dc('0x1e4')],{'as':_0xc1dc('0x1e5'),'foreignKey':'ListId'});db[_0xc1dc('0xf7')][_0xc1dc('0x110')](db[_0xc1dc('0x7c')],{'as':'Contacts','onDelete':_0xc1dc('0x10e'),'foreignKey':'ListId'});db[_0xc1dc('0xf7')][_0xc1dc('0x110')](db[_0xc1dc('0x80')],{'as':_0xc1dc('0x1ce'),'foreignKey':_0xc1dc('0x161')});db[_0xc1dc('0xf7')][_0xc1dc('0x110')](db[_0xc1dc('0x82')],{'as':_0xc1dc('0x1e6'),'foreignKey':_0xc1dc('0x161')});db[_0xc1dc('0xf7')][_0xc1dc('0x110')](db[_0xc1dc('0x84')],{'as':_0xc1dc('0x84'),'foreignKey':_0xc1dc('0x161')});db[_0xc1dc('0xf7')]['belongsToMany'](db[_0xc1dc('0x127')],{'as':'Queues','through':_0xc1dc('0x1e7')});db['CmList'][_0xc1dc('0x11b')](db['User'],{'as':_0xc1dc('0x14d'),'through':_0xc1dc('0x120')});db['VoicePrefix'][_0xc1dc('0x110')](db[_0xc1dc('0x18')],{'as':_0xc1dc('0x112'),'onDelete':'cascade'});db[_0xc1dc('0xf9')]['belongsToMany'](db[_0xc1dc('0x13')],{'as':_0xc1dc('0x14d'),'through':'user_has_voice_prefixes'});db[_0xc1dc('0xfb')]['hasMany'](db[_0xc1dc('0x13')],{'as':_0xc1dc('0x16b'),'foreignKey':'userProfileId'});db['UserProfile'][_0xc1dc('0x110')](db[_0xc1dc('0xfd')],{'as':_0xc1dc('0x1e8'),'foreignKey':'userProfileId','onDelete':_0xc1dc('0x10e')});db[_0xc1dc('0xfd')]['hasMany'](db[_0xc1dc('0x1e9')],{'as':_0xc1dc('0x1ea'),'foreignKey':_0xc1dc('0x1eb'),'onDelete':_0xc1dc('0x10e')});db[_0xc1dc('0x100')][_0xc1dc('0x110')](db[_0xc1dc('0x8c')],{'as':'Dispositions','foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0xc1dc('0x110')](db[_0xc1dc('0x8a')],{'as':'Answers','foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0xc1dc('0x110')](db[_0xc1dc('0x106')],{'as':_0xc1dc('0x152'),'foreignKey':_0xc1dc('0x1ec')});db['WhatsappAccount'][_0xc1dc('0x110')](db['WhatsappInteraction'],{'as':_0xc1dc('0x15e')});db[_0xc1dc('0x100')]['hasMany'](db['WhatsappApplication'],{'as':_0xc1dc('0x13e')});db[_0xc1dc('0x100')][_0xc1dc('0x147')](db[_0xc1dc('0xf7')],{'as':_0xc1dc('0x160'),'foreignKey':_0xc1dc('0x161')});db[_0xc1dc('0x100')][_0xc1dc('0x147')](db[_0xc1dc('0x8f')],{'as':'mandatoryDispositionPause','foreignKey':_0xc1dc('0x14c')});db[_0xc1dc('0x100')]['belongsToMany'](db['User'],{'as':_0xc1dc('0x14d'),'through':_0xc1dc('0x1ed')});db['WhatsappApplication'][_0xc1dc('0x147')](db[_0xc1dc('0x13')],{'onDelete':_0xc1dc('0x16d')});db['WhatsappApplication'][_0xc1dc('0x147')](db['WhatsappQueue'],{'onDelete':_0xc1dc('0x16d')});db[_0xc1dc('0x102')][_0xc1dc('0x147')](db[_0xc1dc('0x100')],{'onDelete':_0xc1dc('0x16d')});db[_0xc1dc('0x102')][_0xc1dc('0x147')](db[_0xc1dc('0x149')],{'onDelete':_0xc1dc('0x16d'),'foreignKey':_0xc1dc('0x14a')});db[_0xc1dc('0x102')]['belongsTo'](db[_0xc1dc('0x97')],{'onDelete':_0xc1dc('0x16d'),'foreignKey':_0xc1dc('0x16e')});db['WhatsappInteraction'][_0xc1dc('0x110')](db[_0xc1dc('0x106')],{'as':_0xc1dc('0x152'),'onDelete':'cascade','foreignKey':_0xc1dc('0x1ee')});db[_0xc1dc('0x104')][_0xc1dc('0x147')](db[_0xc1dc('0x100')],{'as':_0xc1dc('0x165'),'foreignKey':_0xc1dc('0x1ec')});db[_0xc1dc('0x104')][_0xc1dc('0x147')](db[_0xc1dc('0x7c')],{'as':_0xc1dc('0x166'),'foreignKey':_0xc1dc('0x157')});db[_0xc1dc('0x104')][_0xc1dc('0x147')](db['User'],{'as':_0xc1dc('0x167'),'foreignKey':'UserId'});db[_0xc1dc('0x104')][_0xc1dc('0x11b')](db[_0xc1dc('0x97')],{'through':_0xc1dc('0x1ef'),'as':_0xc1dc('0x169')});db[_0xc1dc('0x104')]['belongsToMany'](db[_0xc1dc('0x97')],{'through':_0xc1dc('0x1ef'),'as':_0xc1dc('0x16a')});db[_0xc1dc('0x104')]['belongsToMany'](db[_0xc1dc('0x13')],{'as':_0xc1dc('0x16b'),'through':'user_has_whatsapp_interactions','foreignKey':_0xc1dc('0x1ee')});db[_0xc1dc('0x106')][_0xc1dc('0x147')](db[_0xc1dc('0x13')],{'as':'User'});db['WhatsappMessage']['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':_0xc1dc('0x166')});db[_0xc1dc('0x106')][_0xc1dc('0x147')](db[_0xc1dc('0x104')],{'onDelete':'cascade','as':_0xc1dc('0x1f0'),'foreignKey':_0xc1dc('0x1ee')});db['WhatsappMessage'][_0xc1dc('0x147')](db['WhatsappAccount'],{'as':_0xc1dc('0x165'),'foreignKey':'WhatsappAccountId'});db[_0xc1dc('0x108')][_0xc1dc('0x147')](db[_0xc1dc('0x100')],{});db['WhatsappQueueReport'][_0xc1dc('0x147')](db['CmList'],{'as':_0xc1dc('0x160'),'foreignKey':_0xc1dc('0x161')});db['WhatsappQueueReport'][_0xc1dc('0x147')](db[_0xc1dc('0x7c')],{'as':_0xc1dc('0x166'),'foreignKey':_0xc1dc('0x157')});db[_0xc1dc('0x108')][_0xc1dc('0x147')](db[_0xc1dc('0x104')],{});db[_0xc1dc('0x108')][_0xc1dc('0x147')](db[_0xc1dc('0x10a')],{});db[_0xc1dc('0x108')]['belongsTo'](db['WhatsappMessage'],{});db[_0xc1dc('0x108')][_0xc1dc('0x147')](db[_0xc1dc('0x13')],{});db['WhatsappTransferReport']['belongsTo'](db[_0xc1dc('0x106')],{});db[_0xc1dc('0x1f1')]['belongsTo'](db[_0xc1dc('0x104')],{});db[_0xc1dc('0x1f1')][_0xc1dc('0x147')](db['WhatsappAccount'],{'foreignKey':_0xc1dc('0x1f2'),'as':_0xc1dc('0x1d3')});db[_0xc1dc('0x1f1')][_0xc1dc('0x147')](db[_0xc1dc('0x100')],{'foreignKey':_0xc1dc('0x1f3'),'as':'ToAccount'});db[_0xc1dc('0x1f1')][_0xc1dc('0x147')](db[_0xc1dc('0x10a')],{'foreignKey':_0xc1dc('0x1f4'),'as':_0xc1dc('0x1db')});db[_0xc1dc('0x1f1')]['belongsTo'](db[_0xc1dc('0x13')],{'foreignKey':_0xc1dc('0x1d4'),'as':_0xc1dc('0x1d8')});db[_0xc1dc('0x1f1')][_0xc1dc('0x147')](db['User'],{'foreignKey':_0xc1dc('0x1d9'),'as':_0xc1dc('0x1da')});db['WhatsappQueue'][_0xc1dc('0x11b')](db[_0xc1dc('0x13')],{'as':_0xc1dc('0x14d'),'through':_0xc1dc('0x3b'),'foreignKey':_0xc1dc('0x1f5')});db[_0xc1dc('0x10a')][_0xc1dc('0x11b')](db[_0xc1dc('0xe7')],{'through':_0xc1dc('0x1cd'),'as':'Teams'});module[_0xc1dc('0x1f6')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 3ba34bc..0e651b8 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x7d70=['/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','/api/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/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/auth/local','/api/auth/google','./api/authGoogle','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','./api/system','./api/pm2','/api/webbar','/apidoc','root','/www','static','join','/demo','/snippet','1.0.16','/plugins','route','resolve','get','appPath','/index.html','path','express-winston','./errors','./config/environment','api','default','use','logger','format','x-forwarded-for','headers','connection','remoteAddress','statusCode','user','name','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','url','responseTime','device','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','./api/automation','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x7d70,0x1b0));var _0x07d7=function(_0x2016a4,_0x42d37f){_0x2016a4=_0x2016a4-0x0;var _0x58ceb6=_0x7d70[_0x2016a4];return _0x58ceb6;};'use strict';var path=require(_0x07d7('0x0'));var express=require('express');var ewinston=require(_0x07d7('0x1'));var util=require('util');var errors=require(_0x07d7('0x2'));var config=require(_0x07d7('0x3'));var logger=require('./config/logger')(_0x07d7('0x4'));var authLogger=require('./config/logger')('auth');exports[_0x07d7('0x5')]=function(_0x19f422){_0x19f422[_0x07d7('0x6')](ewinston[_0x07d7('0x7')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x1bdba0,_0x1c54ab){return util[_0x07d7('0x8')]('%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s',_0x1bdba0['method'],_0x1bdba0['headers'][_0x07d7('0x9')]?_0x1bdba0[_0x07d7('0xa')][_0x07d7('0x9')]:_0x1bdba0[_0x07d7('0xb')][_0x07d7('0xc')]||_0x1bdba0['ip'],_0x1bdba0['url'],_0x1c54ab[_0x07d7('0xd')],_0x1c54ab['responseTime'],_0x1bdba0[_0x07d7('0xe')]?_0x1bdba0[_0x07d7('0xe')]['id']:null,_0x1bdba0[_0x07d7('0xe')]?_0x1bdba0['user'][_0x07d7('0xf')]:null,_0x1bdba0['user']?_0x1bdba0[_0x07d7('0xe')][_0x07d7('0x10')]:null);}}));_0x19f422['use'](ewinston[_0x07d7('0x7')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x2b5f5a,_0x43f912){var _0x37d8a3=_0x07d7('0x11');if(_0x2b5f5a[_0x07d7('0x12')]&&_0x2b5f5a[_0x07d7('0x12')]['device']&&_0x2b5f5a[_0x07d7('0x12')]['agent_id']){_0x37d8a3=_0x07d7('0x13');}return util[_0x07d7('0x8')](_0x37d8a3,_0x2b5f5a[_0x07d7('0x14')],_0x2b5f5a[_0x07d7('0xa')][_0x07d7('0x9')]?_0x2b5f5a[_0x07d7('0xa')][_0x07d7('0x9')]:_0x2b5f5a[_0x07d7('0xb')]['remoteAddress']||_0x2b5f5a['ip'],_0x2b5f5a[_0x07d7('0x15')],_0x43f912[_0x07d7('0xd')],_0x43f912[_0x07d7('0x16')],_0x2b5f5a[_0x07d7('0xe')]?_0x2b5f5a[_0x07d7('0xe')]['id']:null,_0x2b5f5a[_0x07d7('0xe')]?_0x2b5f5a[_0x07d7('0xe')][_0x07d7('0xf')]:null,_0x2b5f5a['user']?_0x2b5f5a[_0x07d7('0xe')][_0x07d7('0x10')]:null,_0x2b5f5a[_0x07d7('0x12')]&&_0x2b5f5a['body']['device']?_0x2b5f5a[_0x07d7('0x12')][_0x07d7('0x17')]:_0x07d7('0x18'),_0x2b5f5a[_0x07d7('0x12')]&&_0x2b5f5a[_0x07d7('0x12')]['agent_id']?_0x2b5f5a[_0x07d7('0x12')]['agent_id']:'',_0x2b5f5a[_0x07d7('0x12')]&&_0x2b5f5a[_0x07d7('0x12')][_0x07d7('0x19')]?_0x2b5f5a[_0x07d7('0x12')][_0x07d7('0x19')]:'');},'ignoreRoute':function(_0x243e98){var _0x5aed64=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5aed64[_0x07d7('0x1a')](_0x243e98['url']);}}));_0x19f422[_0x07d7('0x6')](_0x07d7('0x1b'),require(_0x07d7('0x1c')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x1d'),require('./api/voiceChanSpy'));_0x19f422[_0x07d7('0x6')](_0x07d7('0x1e'),require(_0x07d7('0x1f')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x20'),require('./api/voiceExtension'));_0x19f422['use']('/api/voice/mohs',require(_0x07d7('0x21')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x22'),require(_0x07d7('0x23')));_0x19f422[_0x07d7('0x6')]('/api/voice/recordings',require(_0x07d7('0x24')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x25'),require(_0x07d7('0x26')));_0x19f422[_0x07d7('0x6')]('/api/voice/mails',require('./api/voiceMail'));_0x19f422[_0x07d7('0x6')](_0x07d7('0x27'),require(_0x07d7('0x28')));_0x19f422[_0x07d7('0x6')]('/api/voice/calls/reports',require(_0x07d7('0x29')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x2a'),require(_0x07d7('0x2b')));_0x19f422['use']('/api/voice/agents/reports',require(_0x07d7('0x2c')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x2d'),require(_0x07d7('0x2e')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x2f'),require(_0x07d7('0x30')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x31'),require(_0x07d7('0x32')));_0x19f422['use']('/api/voice/transfers/reports',require(_0x07d7('0x33')));_0x19f422[_0x07d7('0x6')]('/api/mail/out_servers',require(_0x07d7('0x34')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x35'),require(_0x07d7('0x36')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x37'),require(_0x07d7('0x38')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x39'),require('./api/mailSubstatus'));_0x19f422[_0x07d7('0x6')](_0x07d7('0x3a'),require('./api/mailInteraction'));_0x19f422['use'](_0x07d7('0x3b'),require(_0x07d7('0x3c')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x3d'),require(_0x07d7('0x3e')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x3f'),require(_0x07d7('0x40')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x41'),require(_0x07d7('0x42')));_0x19f422[_0x07d7('0x6')]('/api/dashboards/items',require(_0x07d7('0x43')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x44'),require(_0x07d7('0x45')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x46'),require(_0x07d7('0x47')));_0x19f422['use'](_0x07d7('0x48'),require(_0x07d7('0x49')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x4a'),require(_0x07d7('0x4b')));_0x19f422[_0x07d7('0x6')]('/api/fax/queues',require(_0x07d7('0x4c')));_0x19f422['use']('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x19f422[_0x07d7('0x6')](_0x07d7('0x4d'),require('./api/smsAccount'));_0x19f422[_0x07d7('0x6')](_0x07d7('0x4e'),require(_0x07d7('0x4f')));_0x19f422['use'](_0x07d7('0x50'),require(_0x07d7('0x51')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x52'),require('./api/smsMessage'));_0x19f422[_0x07d7('0x6')](_0x07d7('0x53'),require(_0x07d7('0x54')));_0x19f422['use'](_0x07d7('0x55'),require('./api/openchannelAccount'));_0x19f422[_0x07d7('0x6')]('/api/openchannel/applications',require(_0x07d7('0x56')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x57'),require('./api/openchannelInteraction'));_0x19f422['use'](_0x07d7('0x58'),require('./api/openchannelMessage'));_0x19f422[_0x07d7('0x6')]('/api/openchannel/queues',require(_0x07d7('0x59')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x5a'),require('./api/chatWebsite'));_0x19f422['use'](_0x07d7('0x5b'),require(_0x07d7('0x5c')));_0x19f422['use'](_0x07d7('0x5d'),require(_0x07d7('0x5e')));_0x19f422['use'](_0x07d7('0x5f'),require(_0x07d7('0x60')));_0x19f422['use'](_0x07d7('0x61'),require(_0x07d7('0x62')));_0x19f422['use']('/api/chat/offline_messages',require('./api/chatOfflineMessage'));_0x19f422[_0x07d7('0x6')](_0x07d7('0x63'),require(_0x07d7('0x64')));_0x19f422['use'](_0x07d7('0x65'),require(_0x07d7('0x66')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x67'),require('./api/chatProactiveAction'));_0x19f422[_0x07d7('0x6')](_0x07d7('0x68'),require(_0x07d7('0x69')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x6a'),require(_0x07d7('0x6b')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x6c'),require(_0x07d7('0x6d')));_0x19f422['use'](_0x07d7('0x6e'),require(_0x07d7('0x6f')));_0x19f422['use']('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x19f422[_0x07d7('0x6')](_0x07d7('0x70'),require('./api/cmHopperHistory'));_0x19f422[_0x07d7('0x6')](_0x07d7('0x71'),require(_0x07d7('0x72')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x73'),require(_0x07d7('0x74')));_0x19f422[_0x07d7('0x6')]('/api/automations',require(_0x07d7('0x75')));_0x19f422[_0x07d7('0x6')]('/api/canned_answers',require(_0x07d7('0x76')));_0x19f422['use']('/api/dispositions',require(_0x07d7('0x77')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x78'),require(_0x07d7('0x79')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x7a'),require(_0x07d7('0x7b')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x7c'),require(_0x07d7('0x7d')));_0x19f422['use'](_0x07d7('0x7e'),require(_0x07d7('0x7f')));_0x19f422['use'](_0x07d7('0x80'),require(_0x07d7('0x81')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x82'),require(_0x07d7('0x83')));_0x19f422['use']('/api/sounds',require(_0x07d7('0x84')));_0x19f422['use'](_0x07d7('0x85'),require('./api/tag'));_0x19f422[_0x07d7('0x6')](_0x07d7('0x86'),require(_0x07d7('0x87')));_0x19f422['use'](_0x07d7('0x88'),require(_0x07d7('0x89')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x8a'),require(_0x07d7('0x8b')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x8c'),require(_0x07d7('0x8d')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x8e'),require(_0x07d7('0x8f')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x90'),require(_0x07d7('0x91')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x92'),require(_0x07d7('0x93')));_0x19f422['use'](_0x07d7('0x94'),require(_0x07d7('0x95')));_0x19f422['use'](_0x07d7('0x96'),require(_0x07d7('0x97')));_0x19f422[_0x07d7('0x6')]('/api/analytics/field_reports',require('./api/analyticFieldReport'));_0x19f422['use']('/api/analytics/tree_reports',require(_0x07d7('0x98')));_0x19f422[_0x07d7('0x6')]('/api/integrations/salesforce/accounts',require(_0x07d7('0x99')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x9a'),require(_0x07d7('0x9b')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x9c'),require('./api/intSalesforceField'));_0x19f422['use'](_0x07d7('0x9d'),require('./api/intSugarcrmAccount'));_0x19f422[_0x07d7('0x6')](_0x07d7('0x9e'),require(_0x07d7('0x9f')));_0x19f422['use'](_0x07d7('0xa0'),require('./api/intSugarcrmField'));_0x19f422[_0x07d7('0x6')](_0x07d7('0xa1'),require(_0x07d7('0xa2')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xa3'),require(_0x07d7('0xa4')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xa5'),require('./api/intDeskField'));_0x19f422['use'](_0x07d7('0xa6'),require(_0x07d7('0xa7')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xa8'),require(_0x07d7('0xa9')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xaa'),require('./api/intZohoField'));_0x19f422['use']('/api/integrations/zendesk/accounts',require(_0x07d7('0xab')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xac'),require(_0x07d7('0xad')));_0x19f422[_0x07d7('0x6')]('/api/integrations/zendesk/fields',require(_0x07d7('0xae')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xaf'),require('./api/intFreshdeskAccount'));_0x19f422[_0x07d7('0x6')](_0x07d7('0xb0'),require(_0x07d7('0xb1')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xb2'),require('./api/intFreshdeskField'));_0x19f422['use'](_0x07d7('0xb3'),require(_0x07d7('0xb4')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xb5'),require(_0x07d7('0xb6')));_0x19f422[_0x07d7('0x6')]('/api/integrations/vtiger/fields',require(_0x07d7('0xb7')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xb8'),require(_0x07d7('0xb9')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xba'),require(_0x07d7('0xbb')));_0x19f422['use'](_0x07d7('0xbc'),require('./api/intServicenowField'));_0x19f422['use'](_0x07d7('0xbd'),require(_0x07d7('0xbe')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xbf'),require('./api/intDynamics365Configuration'));_0x19f422[_0x07d7('0x6')](_0x07d7('0xc0'),require(_0x07d7('0xc1')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xc2'),require('./api/intFreshsalesAccount'));_0x19f422['use'](_0x07d7('0xc3'),require(_0x07d7('0xc4')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xc5'),require(_0x07d7('0xc6')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xc7'),require(_0x07d7('0xc8')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xc9'),require(_0x07d7('0xca')));_0x19f422['use']('/api/chat/internal/messages',require(_0x07d7('0xcb')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xcc'),require(_0x07d7('0xcd')));_0x19f422['use'](_0x07d7('0xce'),require(_0x07d7('0xcf')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xd0'),require(_0x07d7('0xd1')));_0x19f422['use'](_0x07d7('0xd2'),require(_0x07d7('0xd3')));_0x19f422['use'](_0x07d7('0xd4'),require(_0x07d7('0xd5')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xd6'),require(_0x07d7('0xd7')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xd8'),require(_0x07d7('0xd9')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xda'),require('./api/setting'));_0x19f422[_0x07d7('0x6')](_0x07d7('0xdb'),require('./api/squareOdbc'));_0x19f422[_0x07d7('0x6')](_0x07d7('0xdc'),require(_0x07d7('0xdd')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xde'),require(_0x07d7('0xdf')));_0x19f422['use']('/api/square/messages',require('./api/squareMessage'));_0x19f422[_0x07d7('0x6')](_0x07d7('0xe0'),require(_0x07d7('0xe1')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xe2'),require(_0x07d7('0xe3')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xe4'),require(_0x07d7('0xe5')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xe6'),require('./api/migration'));_0x19f422[_0x07d7('0x6')](_0x07d7('0xe7'),require(_0x07d7('0xe8')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xe9'),require(_0x07d7('0xea')));_0x19f422['use'](_0x07d7('0xeb'),require(_0x07d7('0xec')));_0x19f422[_0x07d7('0x6')]('/api/chat/reports/transfer',require(_0x07d7('0xed')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xee'),require(_0x07d7('0xef')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xf0'),require(_0x07d7('0xf1')));_0x19f422[_0x07d7('0x6')]('/api/sms/reports/transfer',require(_0x07d7('0xf2')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xf3'),require('./api/cmList'));_0x19f422[_0x07d7('0x6')](_0x07d7('0xf4'),require(_0x07d7('0xf5')));_0x19f422['use'](_0x07d7('0xf6'),require(_0x07d7('0xf7')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xf8'),require(_0x07d7('0xf9')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xfa'),require(_0x07d7('0xfb')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xfc'),require(_0x07d7('0xfd')));_0x19f422[_0x07d7('0x6')](_0x07d7('0xfe'),require(_0x07d7('0xff')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x100'),require(_0x07d7('0x101')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x102'),require(_0x07d7('0x103')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x104'),require(_0x07d7('0x105')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x106'),require(_0x07d7('0x107')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x108'),require(_0x07d7('0x109')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x10a'),require(_0x07d7('0x10b')));_0x19f422[_0x07d7('0x6')]('/api/cloudProviders',require(_0x07d7('0x10c')));_0x19f422['use'](_0x07d7('0x10d'),require('./api/authLocal'));_0x19f422[_0x07d7('0x6')](_0x07d7('0x10e'),require(_0x07d7('0x10f')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x110'),require('./api/jira'));_0x19f422[_0x07d7('0x6')](_0x07d7('0x111'),require(_0x07d7('0x112')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x113'),require(_0x07d7('0x114')));_0x19f422[_0x07d7('0x6')]('/api/system',require(_0x07d7('0x115')));_0x19f422[_0x07d7('0x6')]('/api/pm2',require(_0x07d7('0x116')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x117'),require('./api/webbar'));_0x19f422[_0x07d7('0x6')](_0x07d7('0x118'),express['static'](path['join'](config[_0x07d7('0x119')],_0x07d7('0x118'))));_0x19f422['use'](_0x07d7('0x11a'),express[_0x07d7('0x11b')](path[_0x07d7('0x11c')](config[_0x07d7('0x119')],'/www')));_0x19f422[_0x07d7('0x6')](_0x07d7('0x11d'),express[_0x07d7('0x11b')](path['join'](config['root'],_0x07d7('0x11d'))));_0x19f422[_0x07d7('0x6')](_0x07d7('0x11e'),express[_0x07d7('0x11b')](path[_0x07d7('0x11c')](config[_0x07d7('0x119')],'snippet',_0x07d7('0x11f'))));_0x19f422['use'](_0x07d7('0x120'),express[_0x07d7('0x11b')](path[_0x07d7('0x11c')](config[_0x07d7('0x119')],'/server/files/plugins')));_0x19f422['route']('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0x19f422[_0x07d7('0x121')]('/*')['get'](function(_0x3fedfd,_0x47faae){_0x47faae['sendFile'](path[_0x07d7('0x122')](_0x19f422[_0x07d7('0x123')](_0x07d7('0x124'))+_0x07d7('0x125')));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 879a80d..7360b0f 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x1f24=['../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','port','error','log','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','listen','../api/user/user.rpc','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1f24,0x10e));var _0x41f2=function(_0x2553af,_0x30d90e){_0x2553af=_0x2553af-0x0;var _0x53ab3c=_0x1f24[_0x2553af];return _0x53ab3c;};'use strict';var jayson=require(_0x41f2('0x0'));var BPromise=require(_0x41f2('0x1'));var _=require(_0x41f2('0x2'));var config=require('../config/environment');exports[_0x41f2('0x3')]=function(){return new BPromise(function(_0x1dc63e,_0x5337e9){var _0x56266e={};_0x56266e=_['merge'](_0x56266e,require(_0x41f2('0x4')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require('../api/voiceExtension/voiceExtension.rpc'));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x6')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require('../api/voiceRecording/voiceRecording.rpc'));_0x56266e=_['merge'](_0x56266e,require(_0x41f2('0x7')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x8')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x9')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0xa')));_0x56266e=_['merge'](_0x56266e,require(_0x41f2('0xb')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0xc')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0xd')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0xe')));_0x56266e=_['merge'](_0x56266e,require(_0x41f2('0xf')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x10')));_0x56266e=_['merge'](_0x56266e,require(_0x41f2('0x11')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x12')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x13')));_0x56266e=_['merge'](_0x56266e,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x56266e=_['merge'](_0x56266e,require(_0x41f2('0x14')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x15')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x16')));_0x56266e=_['merge'](_0x56266e,require(_0x41f2('0x17')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x18')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x56266e=_['merge'](_0x56266e,require(_0x41f2('0x19')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x1a')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require('../api/smsMessage/smsMessage.rpc'));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x1b')));_0x56266e=_['merge'](_0x56266e,require(_0x41f2('0x1c')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x1d')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x1e')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x56266e=_['merge'](_0x56266e,require(_0x41f2('0x1f')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x20')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require('../api/chatQueue/chatQueue.rpc'));_0x56266e=_['merge'](_0x56266e,require(_0x41f2('0x21')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x22')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x23')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x24')));_0x56266e=_['merge'](_0x56266e,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x25')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require('../api/interval/interval.rpc'));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x26')));_0x56266e=_['merge'](_0x56266e,require(_0x41f2('0x27')));_0x56266e=_['merge'](_0x56266e,require(_0x41f2('0x28')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x29')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x2a')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x2b')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x2c')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x2d')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x2e')));_0x56266e=_['merge'](_0x56266e,require(_0x41f2('0x2f')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x30')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x31')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x32')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x33')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x34')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require('../api/squareOdbc/squareOdbc.rpc'));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require('../api/squareProject/squareProject.rpc'));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x35')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x36')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x37')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x38')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x39')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x3a')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x3b')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x3c')));_0x56266e=_[_0x41f2('0x5')](_0x56266e,require(_0x41f2('0x3d')));_0x56266e=_['merge'](_0x56266e,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x27b3b6=jayson[_0x41f2('0x3e')](_0x56266e)[_0x41f2('0x3f')]();var _0x4c1da4=config[_0x41f2('0x40')][_0x41f2('0x41')]||config[_0x41f2('0x41')]+0x1;var _0x1b696d=config[_0x41f2('0x40')]['ip']||'localhost';_0x27b3b6['on'](_0x41f2('0x42'),function(_0x416d2d){return _0x5337e9(_0x416d2d);});_0x27b3b6[_0x41f2('0x3')](_0x4c1da4,_0x1b696d,function(){console[_0x41f2('0x43')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x1b696d,_0x4c1da4);require(_0x41f2('0x44'))[_0x41f2('0x45')]();return _0x1dc63e(_0x41f2('0x46')+_0x1b696d+':'+_0x4c1da4);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 6cf13f4..942a346 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(_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 +var _0xa9e0=['utf8','setTimeout','setEncoding','ready','line','toLowerCase','hangup','emit','520\x20End\x20of\x20proper','function','substring','replace','result=','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','write','inherits','prototype','sendRequest','command','sync','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','label','exports','util','lodash','events','./error','call'];(function(_0x3fc3b8,_0xa0aa0e){var _0x4fdd19=function(_0x17dbc4){while(--_0x17dbc4){_0x3fc3b8['push'](_0x3fc3b8['shift']());}};_0x4fdd19(++_0xa0aa0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x0a9e('0x3'));function AGIChannel(_0x4ce2f1){var _0x333808=this,_0x432180=new AGIReply(),_0x2ab90b=![],_0x991246={};EventEmitter[_0x0a9e('0x4')](_0x333808);_0x4ce2f1['setEncoding'](_0x0a9e('0x5'));_0x4ce2f1[_0x0a9e('0x6')](0x8*0x3c*0x3c*0x3e8);_0x432180[_0x0a9e('0x7')]('utf8');_0x432180['on']('headers',function(_0xe42b77){for(var _0x56465b in _0xe42b77){_0x333808[_0x56465b]=_0xe42b77[_0x56465b];}_0x333808['emit'](_0x0a9e('0x8'));});_0x432180['on'](_0x0a9e('0x9'),function(_0x307b3e){if(_0x307b3e[_0x0a9e('0xa')]()==_0x0a9e('0xb')){_0x333808[_0x0a9e('0xc')]('hangup');return;}if(_0x307b3e['substring'](0x0,0xb)=='520-Invalid'){_0x2ab90b=!![];}if(_0x2ab90b){_0x991246['rx']+=_0x307b3e+'\x0a';if(_0x307b3e['search'](_0x0a9e('0xd'))!=-0x1){_0x2ab90b=![];}}else{_0x991246['rx']=_0x307b3e;}if(_0x2ab90b){return;}if(typeof _0x991246['cb']==_0x0a9e('0xe')){var _0xd5b662=_0x991246['rx'][_0x0a9e('0xf')](0x0,0x3),_0x26d672=null,_0x32d742=null;_0xd5b662=parseInt(_0xd5b662);if(isNaN(_0xd5b662)){_0x991246['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0xd5b662!=0xc8){_0x991246['cb'](null,{'code':_0xd5b662,'result':-0x1,'extra':'KO'});return;}_0x26d672=_0x991246['rx'][_0x0a9e('0xf')](0x4)[_0x0a9e('0x10')](_0x0a9e('0x11'),'');if(_0x26d672[_0x0a9e('0x12')]('\x20')!=-0x1){_0x26d672=_0x26d672[_0x0a9e('0x13')](0x0,_0x26d672[_0x0a9e('0x12')]('\x20'));}if(_['startsWith'](_0x26d672,'-1')){_0x26d672=parseInt(_0x26d672);}_0x32d742=_0x991246['rx'][_0x0a9e('0x14')]('\x20');if(_0x32d742['length']==0x3){_0x32d742=_0x32d742[0x2][_0x0a9e('0xf')](0x1,_0x32d742[0x2]['length']-0x1);}else if(_0x32d742[_0x0a9e('0x15')]>0x3){var _0x12066b=/\((.+)\)/;var _0x48f32d=_0x991246['rx'][_0x0a9e('0x16')](_0x12066b);if(_0x48f32d){_0x32d742=_0x48f32d[0x1];}else{_0x32d742=null;}}else{_0x32d742=null;}_0x991246['cb'](null,{'code':_0xd5b662,'result':_0x26d672,'extra':_0x32d742});}});_0x4ce2f1['on']('error',function(_0x459eb1){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x17'),new AGIError(_0x0a9e('0x18'),_0x459eb1[_0x0a9e('0x19')]));});_0x4ce2f1['on'](_0x0a9e('0x1a'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1a'),new AGIError(_0x0a9e('0x1b')));});_0x4ce2f1['on'](_0x0a9e('0x1c'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x4ce2f1[_0x0a9e('0x1d')]();});_0x4ce2f1[_0x0a9e('0x1e')](_0x432180);this['command']=function(_0x20f109,_0x5a09ef){var _0x20f109=_0x20f109||'',_0x5a09ef=typeof _0x5a09ef==_0x0a9e('0xe')?_0x5a09ef:new Function();_0x991246={'tx':_0x20f109,'rx':'','cb':_0x5a09ef};_0x4ce2f1[_0x0a9e('0x1f')](_0x20f109+'\x0a');},this[_0x0a9e('0x1a')]=function(){_0x4ce2f1['destroy']();};}util[_0x0a9e('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x22')]=function(_0x4d00e6){return this[_0x0a9e('0x23')][_0x0a9e('0x24')](this,_0x4d00e6);};AGIChannel[_0x0a9e('0x21')]['answer']=function(){return this['sendRequest'](_0x0a9e('0x25'));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x26')]=function(_0x33161b,_0x526cf3,_0x384319){_0x33161b=_0x33161b===undefined?'beep':_0x33161b;_0x526cf3=_0x526cf3===undefined?'5':_0x526cf3;_0x384319=_0x384319===undefined?'1':_0x384319;return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x27'),_0x33161b,_0x526cf3*0x3e8,_0x384319));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x28')]=function(_0x14433c){_0x14433c=_0x14433c||_0x0a9e('0x29');return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2b'),_0x14433c));};AGIChannel['prototype'][_0x0a9e('0x2c')]=function(_0x468813,_0x2b1f27){if(_[_0x0a9e('0x2d')](_0x2b1f27)){return this['sendRequest'](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27[_0x0a9e('0x2f')](',')));}return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x30')]=function(_0x1dbde2){return this['sendRequest'](util[_0x0a9e('0x2a')]('SET\x20CONTEXT\x20%s',_0x1dbde2));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x31')]=function(_0x1122db){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20EXTENSION\x20%s',_0x1122db));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x32')]=function(_0x40cb85){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x33'),_0x40cb85));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0xb')]=function(){return this['sendRequest'](_0x0a9e('0x34'));};AGIChannel['prototype'][_0x0a9e('0x35')]=function(_0x14b13f,_0x2b7e7f){var _0x3f3d41=_['isBoolean'](_0x2b7e7f)||_[_0x0a9e('0x36')](_0x2b7e7f)?_0x2b7e7f[_0x0a9e('0x37')]():_0x2b7e7f;return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x14b13f,_0x3f3d41?_0x3f3d41['toString']()[_0x0a9e('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x0a9e('0x38')]=function(_0x3d9717,_0x381c37){return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x39'),_0x3d9717,_0x381c37));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3a')]=function(_0x533942,_0x1dbf74){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SAY\x20DIGITS\x20%s\x20%s',_0x533942,_0x1dbf74));};AGIChannel['prototype'][_0x0a9e('0x3b')]=function(_0x40d766,_0x5adda1){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3c'),_0x40d766,_0x5adda1));};AGIChannel[_0x0a9e('0x21')]['continueAt']=function(_0x5a594b,_0x15e37d,_0x45b3d0){_0x15e37d=_0x15e37d||this['extension'];_0x45b3d0=_0x45b3d0||0x1;this[_0x0a9e('0x30')](_0x5a594b);this[_0x0a9e('0x31')](_0x15e37d);this[_0x0a9e('0x32')](_0x45b3d0);return this['noop'](util[_0x0a9e('0x2a')](_0x0a9e('0x3d'),_0x5a594b,_0x15e37d,_0x45b3d0));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3e')]=function(_0x13cb1f){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3f'),_0x13cb1f));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x40')]=function(_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x37f6cc,_0x4d04c8){_0x148007=_0x148007||'wav';_0x1a7bce=_0x1a7bce||'';_0x11ca30=_0x11ca30===undefined?-0x1:_0x11ca30==='-1'?-0x1:_0x11ca30*0x3e8;_0x37f6cc=_0x37f6cc===undefined?'':'s='+_0x37f6cc;_0x4d04c8=_0x4d04c8?_0x0a9e('0x41'):'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x42'),_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x4d04c8,_0x37f6cc));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x43')]=function(_0x10b040,_0x445e25){_0x445e25=_0x445e25||'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x44'),_0x10b040,_0x445e25));};AGIChannel[_0x0a9e('0x21')]['agi']=function(_0x117c99){return this[_0x0a9e('0x2c')](_0x0a9e('0x45'),_0x117c99);};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x46')]=function(_0xbe9d19){return this[_0x0a9e('0x2c')](_0x0a9e('0x47'),_0xbe9d19);};AGIChannel['prototype'][_0x0a9e('0x17')]=function(_0x48fd45,_0x473dc8){this[_0x0a9e('0x28')](util[_0x0a9e('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x48fd45['id'],_0x48fd45[_0x0a9e('0x48')],_0x473dc8));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x0a9e('0x49')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 6b43e29..b492e20 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 _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 +var _0xe4ef=['push','format','apply','name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe4ef,0x17b));var _0xfe4e=function(_0x17508b,_0x54e648){_0x17508b=_0x17508b-0x0;var _0x30f762=_0xe4ef[_0x17508b];return _0x30f762;};'use strict';var util=require(_0xfe4e('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0xfe4e('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0xfe4e('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0xfe4e('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0xfe4e('0x4'),'E_AGI_SOCKET_ERROR':_0xfe4e('0x5'),'E_AGI_SOCKET_CLOSE':_0xfe4e('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xfe4e('0x7'),'E_AGI_COMMAND_EMPTY':_0xfe4e('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xfe4e('0x9'),'E_AGI_IVR_ENTRY':_0xfe4e('0xa')};function AGIError(_0x5393a6){var _0x5393a6=_0x5393a6||null,_0x56c01b=_0x56c01b||[],_0xcb6fa6=0x1,_0x5c8fed='';if(!error[_0x5393a6]){_0x5393a6=_0xfe4e('0xb');}_0x56c01b[_0xfe4e('0xc')](error[_0x5393a6]);while(arguments[_0xcb6fa6]){_0x56c01b['push'](arguments[_0xcb6fa6]);_0xcb6fa6++;}_0x5c8fed=util[_0xfe4e('0xd')][_0xfe4e('0xe')](util,_0x56c01b);this['message']=_0x5c8fed;this[_0xfe4e('0xf')]=_0x5393a6;}module[_0xfe4e('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 51f42e1..5f69960 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 _0x6f7a=['split','agicommand','vswitch','target','traverseBFS','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','push','getVertex','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available'];(function(_0x61c887,_0x5522c2){var _0x200c44=function(_0x4d4448){while(--_0x4d4448){_0x61c887['push'](_0x61c887['shift']());}};_0x200c44(++_0x5522c2);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x858ecb,_0x3e8665){_0x858ecb=_0x858ecb-0x0;var _0x446dc1=_0x6f7a[_0x858ecb];return _0x446dc1;};'use strict';var _=require(_0xa6f7('0x0'));var logger=require(_0xa6f7('0x1'))(_0xa6f7('0x2'));var verticesWithRetry=[_0xa6f7('0x3'),'getdigits',_0xa6f7('0x4')];var Graph=function(){this[_0xa6f7('0x5')]={};this[_0xa6f7('0x6')]={};this[_0xa6f7('0x7')]=0x0;};Graph[_0xa6f7('0x8')][_0xa6f7('0x9')]=function(_0x35f8f0){this[_0xa6f7('0x5')][_0x35f8f0['id']]=_0x35f8f0;this[_0xa6f7('0x6')][_0x35f8f0['id']]=[];};Graph[_0xa6f7('0x8')][_0xa6f7('0xa')]=function(_0x481a8c,_0x4b4f9e,_0x30f2a7){this[_0xa6f7('0x6')][_0x481a8c][_0xa6f7('0xb')]({'target':_0x4b4f9e,'condition':_0x30f2a7});this[_0xa6f7('0x7')]+=0x1;};Graph[_0xa6f7('0x8')]['size']=function(){return _['size'](this[_0xa6f7('0x5')]);};Graph[_0xa6f7('0x8')]['relations']=function(){return this[_0xa6f7('0x7')];};Graph['prototype'][_0xa6f7('0xc')]=function(_0x1303c3){return this[_0xa6f7('0x5')][_0x1303c3];};Graph[_0xa6f7('0x8')]['traverseBFS']=function(_0x3fc7f1,_0x532352){if(!this[_0xa6f7('0x5')][_0x3fc7f1]){return logger[_0xa6f7('0xd')](_0xa6f7('0xe'));}var _0x4d3d59=_0x532352(this[_0xa6f7('0x5')][_0x3fc7f1]);if(!_0x4d3d59){return logger['info'](_0xa6f7('0xf'));}if(this['edges'][_0x3fc7f1][_0xa6f7('0x10')]===0x0){return logger[_0xa6f7('0xd')](_0xa6f7('0x11'));}for(var _0x47e664=0x0,_0xdb37e2=[],_0x22635e=![];_0x47e664\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 +var _0x8ef6=['dnid','evtHangup','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','mxCell','isArray','length','source','target','addEdge','value','getSquareProject','then','createSquareReport','catch','indexOf','agi_','inspect','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','joinAt','omit','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','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','Project\x20%s\x20not\x20published','continueAt','Project\x20%s\x20not\x20found','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','connection','xml2json','lodash','syncho','util','moment','../../config/environment','../../config/logger','../../config/license/util','./rpc','./mailRpc','./graph','defaults','agi','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[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','uniqueid'];(function(_0x1e5086,_0x54fd73){var _0x3e0113=function(_0x29041a){while(--_0x29041a){_0x1e5086['push'](_0x1e5086['shift']());}};_0x3e0113(++_0x54fd73);}(_0x8ef6,0xf2));var _0x68ef=function(_0xcd933f,_0x394e33){_0xcd933f=_0xcd933f-0x0;var _0x98cd1b=_0x8ef6[_0xcd933f];return _0x98cd1b;};'use strict';var parser=require(_0x68ef('0x0'));var _=require(_0x68ef('0x1'));var syncho=require(_0x68ef('0x2'));var util=require(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var config=require(_0x68ef('0x5'));var logger=require(_0x68ef('0x6'))('agi');var utilLicense=require(_0x68ef('0x7'));var rpc=require(_0x68ef('0x8'));var mailRpc=require(_0x68ef('0x9'));var Graph=require(_0x68ef('0xa'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x68ef('0xb')](config[_0x68ef('0xc')],{'ip':_0x68ef('0xd'),'port':0x11dd});function connectionHandler(_0x4eb5eb){process[_0x68ef('0xe')](function(){syncho(function(){try{setChannelVariables(_0x4eb5eb);agiHandler(_0x4eb5eb);}catch(_0x31007e){logger[_0x68ef('0xf')](_0x31007e[_0x68ef('0x10')]);}});});}function listeningHandler(){console[_0x68ef('0x11')](_0x68ef('0x12'),config[_0x68ef('0xc')][_0x68ef('0x13')]);logger[_0x68ef('0x14')](util[_0x68ef('0x15')](_0x68ef('0x16'),config[_0x68ef('0xc')]['ip'],config['agi'][_0x68ef('0x13')]));}function errorHandler(_0x46356f){if(_0x46356f&&_0x46356f[_0x68ef('0x17')]&&_0x46356f[_0x68ef('0x18')]){logger[_0x68ef('0xf')](util[_0x68ef('0x15')]('[%s]\x20%s',_0x46356f[_0x68ef('0x17')],_0x46356f[_0x68ef('0x18')]));}else{logger[_0x68ef('0xf')](util['format'](_0x68ef('0x19'),_0x46356f[_0x68ef('0x10')]));}}function closeHandler(){logger[_0x68ef('0x14')](util['format'](_0x68ef('0x1a'),this[_0x68ef('0x1b')],this[_0x68ef('0x1c')],this[_0x68ef('0x1d')],this['dnid'],this[_0x68ef('0x1e')]));try{createSquareReport(this);}catch(_0x54139e){logger['error'](_0x54139e[_0x68ef('0x10')]);}}function timeoutHandler(){logger[_0x68ef('0x14')](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x68ef('0x1b')],this[_0x68ef('0x1c')],this[_0x68ef('0x1d')],this['dnid'],this[_0x68ef('0x1e')]));}function hangupHandler(){logger[_0x68ef('0x14')](util[_0x68ef('0x15')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x68ef('0x1b')],this[_0x68ef('0x1c')],this['callerid'],this[_0x68ef('0x1f')],this[_0x68ef('0x1e')]));this[_0x68ef('0x20')]=!![];}function getRoot(_0x5ddec7){return parser['toJson'](_0x5ddec7,{'object':!![]})['mxGraphModel'][_0x68ef('0x21')];}function addVertex(_0x2023f2,_0x312cc9,_0x2e6e39){_0x312cc9[_0x68ef('0x22')]=_0x2e6e39;if(_0x312cc9[_0x68ef('0x23')](_0x68ef('0x24'))){_0x312cc9[_0x68ef('0x25')]=parseInt(_0x312cc9[_0x68ef('0x24')],0xa);}_0x2023f2[_0x68ef('0x26')](_['omit'](_0x312cc9,_0x68ef('0x27')));}function initGraph(_0x57f9ee,_0x599243){var _0x55d8b0=new Graph();for(var _0x1a7ce1 in _0x57f9ee){if(_0x57f9ee[_0x68ef('0x23')](_0x1a7ce1)){if(_[_0x68ef('0x28')](_0x57f9ee[_0x1a7ce1])){for(var _0x29518e=0x0;_0x29518e<_0x57f9ee[_0x1a7ce1]['length'];_0x29518e+=0x1){addVertex(_0x55d8b0,_0x57f9ee[_0x1a7ce1][_0x29518e],_0x1a7ce1);}}else{addVertex(_0x55d8b0,_0x57f9ee[_0x1a7ce1],_0x1a7ce1);}}}for(var _0x4a0550=0x0;_0x4a0550<_0x599243[_0x68ef('0x29')];_0x4a0550+=0x1){if(_0x599243[_0x4a0550][_0x68ef('0x2a')]&&_0x599243[_0x4a0550][_0x68ef('0x2b')]){_0x55d8b0[_0x68ef('0x2c')](_0x599243[_0x4a0550][_0x68ef('0x2a')],_0x599243[_0x4a0550][_0x68ef('0x2b')],_0x599243[_0x4a0550][_0x68ef('0x2d')]);}}return _0x55d8b0;}function getSquareProject(_0x4579cb,_0x5a6dfd){rpc[_0x68ef('0x2e')](_0x4579cb)[_0x68ef('0x2f')](function(_0x132d9e){_0x5a6dfd(null,_0x132d9e);})['catch'](function(_0x370a8f){_0x5a6dfd(null,_0x370a8f);});}function createSquareReport(_0x523120,_0x133788){rpc[_0x68ef('0x30')](_0x523120)['then'](function(_0x5e1e1b){if(_0x133788){_0x133788(null,_0x5e1e1b);}})[_0x68ef('0x31')](function(_0x5fa72a){if(_0x133788){_0x133788(null,_0x5fa72a);}});}function setChannelVariables(_0x4b8fc8){for(var _0xf58fa1 in _0x4b8fc8){if(_0x4b8fc8[_0x68ef('0x23')](_0xf58fa1)){if(_0xf58fa1[_0x68ef('0x32')](_0x68ef('0x33'))===0x0){_0x4b8fc8[_0xf58fa1['substring'](0x4)]=_0x4b8fc8[_0xf58fa1];delete _0x4b8fc8[_0xf58fa1];}}}}function getLogFromObject(_0x2c8bd0){return util[_0x68ef('0x34')](_0x2c8bd0,{'showHidden':![],'depth':null});}function agiHandler(_0x5f137b){var _0x2f8de2,_0x5237e1,_0x14581d,_0xab3c17,_0x4973c2;logger[_0x68ef('0x35')]('variables',JSON[_0x68ef('0x36')](_0x5f137b,null,0x2));logger['info'](util[_0x68ef('0x15')](_0x68ef('0x37'),_0x5f137b[_0x68ef('0x1b')],_0x5f137b['calleridname'],_0x5f137b[_0x68ef('0x1d')],_0x5f137b['dnid'],_0x5f137b[_0x68ef('0x1e')]));_0x5f137b['on']('error',errorHandler);_0x5f137b['on'](_0x68ef('0x38'),closeHandler);_0x5f137b['on'](_0x68ef('0x39'),timeoutHandler);_0x5f137b[_0x68ef('0x20')]=![];_0x5f137b['on'](_0x68ef('0x3a'),hangupHandler);var _0x2181d9=getSquareProject[_0x68ef('0x3b')](null,_0x5f137b['arg_1']);if(_0x2181d9){if(_0x2181d9[_0x68ef('0x3c')]){_0x2f8de2=getRoot(_0x2181d9[_0x68ef('0x3c')]);if(_0x2f8de2&&_0x2f8de2[_0x68ef('0x3d')]){logger['debug'](_0x68ef('0x21'),JSON[_0x68ef('0x36')](_0x2f8de2,null,0x2));_0x5f137b[_0x68ef('0x3e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5237e1=initGraph(_[_0x68ef('0x3f')](_0x2f8de2,_0x68ef('0x27')),_0x2f8de2[_0x68ef('0x27')]);_0x14581d=new Vertices(_0x5f137b,rpc,mailRpc);logger[_0x68ef('0x14')](util[_0x68ef('0x15')](_0x68ef('0x40'),_0x5f137b[_0x68ef('0x1b')],_0x5f137b['calleridname'],_0x5f137b[_0x68ef('0x1d')],_0x5f137b[_0x68ef('0x1f')],_0x5f137b[_0x68ef('0x1e')]));_0x5237e1[_0x68ef('0x41')](_0x2f8de2['start']['id'],function(_0x3cb156){try{_0x3cb156=_0x14581d[_0x68ef('0x42')](_0x3cb156);logger[_0x68ef('0x35')](_0x68ef('0x43'),JSON[_0x68ef('0x36')](_0x3cb156,null,0x2));if(_0x3cb156[_0x68ef('0x22')]==='gotoc'){logger[_0x68ef('0x14')](_0x68ef('0x44'));_0x5f137b[_0x68ef('0x45')]=_0x3cb156[_0x68ef('0x45')]||_0x5f137b[_0x68ef('0x45')];_0x5f137b[_0x68ef('0x46')]=_0x3cb156[_0x68ef('0x46')];_0x5f137b[_0x68ef('0x47')]=_0x3cb156[_0x68ef('0x47')]?_0x3cb156['priority']-0x1:0x1;return null;}else if(_0x3cb156&&_0x14581d[_0x3cb156[_0x68ef('0x22')]]){_0x4973c2=_0x14581d[_0x3cb156[_0x68ef('0x22')]](_0x3cb156);logger[_0x68ef('0x14')](_0x68ef('0x48'),JSON[_0x68ef('0x36')](_0x4973c2,null,0x2));if(_0x4973c2&&_0x4973c2[_0x68ef('0x49')]===AGI_CODE_SUCCESS&&_0x4973c2[_0x68ef('0x4a')]!==AGI_RESULT_ERROR&&!_0x5f137b['evtHangup']){logger[_0x68ef('0x35')]('response',getLogFromObject(_0x4973c2));return _[_0x68ef('0x4b')](_0x4973c2[_0x68ef('0x4a')])?null:_0x4973c2[_0x68ef('0x4a')][_0x68ef('0x4c')]();}else{logger['error'](_0x68ef('0x48'),getLogFromObject(_0x4973c2));return null;}}else{logger['error'](_0x68ef('0x4d'));return null;}}catch(_0x499423){logger[_0x68ef('0xf')](_0x499423[_0x68ef('0x10')]);return null;}});if(_0x2f8de2[_0x68ef('0x4e')]){logger['info'](util['format'](_0x68ef('0x4f'),_0x5f137b[_0x68ef('0x1b')],_0x5f137b['calleridname'],_0x5f137b['callerid'],_0x5f137b['dnid'],_0x5f137b[_0x68ef('0x1e')]));_0x5237e1[_0x68ef('0x41')](_0x2f8de2[_0x68ef('0x4e')]['id'],function(_0x5a2b65){try{_0x5a2b65=_0x14581d[_0x68ef('0x42')](_0x5a2b65);logger['debug']('vertex',JSON[_0x68ef('0x36')](_0x5a2b65,null,0x2));if(_0x5a2b65&&_0x14581d[_0x5a2b65[_0x68ef('0x22')]]){_0x4973c2=_0x14581d[_0x5a2b65[_0x68ef('0x22')]](_0x5a2b65);if(_0x4973c2){logger[_0x68ef('0x35')]('response',getLogFromObject(_0x4973c2));return _[_0x68ef('0x4b')](_0x4973c2[_0x68ef('0x4a')])?null:_0x4973c2[_0x68ef('0x4a')][_0x68ef('0x4c')]();}else{logger['error']('response',getLogFromObject(_0x4973c2));return null;}}else{logger[_0x68ef('0xf')](_0x68ef('0x4d'));return null;}}catch(_0x566e7c){logger[_0x68ef('0xf')](_0x566e7c[_0x68ef('0x10')]);return null;}});}logger[_0x68ef('0x14')](util[_0x68ef('0x15')](_0x68ef('0x50'),_0x5f137b['arg_1'],_0x5f137b[_0x68ef('0x1c')],_0x5f137b[_0x68ef('0x1d')],_0x5f137b[_0x68ef('0x1f')],_0x5f137b['uniqueid']));logger[_0x68ef('0x14')](util[_0x68ef('0x15')](_0x68ef('0x51'),_0x5f137b['context'],_0x5f137b[_0x68ef('0x46')],parseInt(_0x5f137b['priority'],0xa)+0x1));_0x5f137b['continueAt'](_0x5f137b[_0x68ef('0x45')],_0x5f137b['extension'],parseInt(_0x5f137b[_0x68ef('0x47')],0xa)+0x1);_0x5f137b[_0x68ef('0x38')]();}}else{logger[_0x68ef('0xf')](util[_0x68ef('0x15')](_0x68ef('0x52'),_0x5f137b[_0x68ef('0x1b')]));_0x5f137b[_0x68ef('0x53')](_0x5f137b[_0x68ef('0x45')],_0x5f137b[_0x68ef('0x46')],parseInt(_0x5f137b[_0x68ef('0x47')],0xa)+0x1);_0x5f137b['close']();}}else{logger['error'](util[_0x68ef('0x15')](_0x68ef('0x54'),_0x5f137b[_0x68ef('0x1b')]));_0x5f137b[_0x68ef('0x53')](_0x5f137b[_0x68ef('0x45')],_0x5f137b[_0x68ef('0x46')],parseInt(_0x5f137b[_0x68ef('0x47')],0xa)+0x1);_0x5f137b[_0x68ef('0x38')]();}}function main(){var _0x40c784;return utilLicense['getLicense']()['then'](function(_0x42a4b2){if(_0x42a4b2){if(_0x42a4b2['voice']){if(_0x42a4b2[_0x68ef('0x55')]&&_0x42a4b2['callysquare']>0x0){logger[_0x68ef('0x14')](util[_0x68ef('0x15')]('[LICENSE]\x20CHANNELS:\x20%s',_0x42a4b2[_0x68ef('0x55')]));_0x40c784=_0x42a4b2['callysquare'];}else{logger[_0x68ef('0x14')](_0x68ef('0x56'));}}else{logger[_0x68ef('0x14')](_0x68ef('0x57'));_0x40c784=-0x1;}}})[_0x68ef('0x31')](function(_0x3d81c8){logger['error'](_0x68ef('0x58'),_0x3d81c8[_0x68ef('0x10')]);})[_0x68ef('0x4e')](function(){var _0x20dc7f=require(_0x68ef('0x59'))(config[_0x68ef('0xc')]['port'],config[_0x68ef('0xc')]['ip'],_0x40c784);_0x20dc7f['on'](_0x68ef('0xf'),errorHandler);_0x20dc7f['on']('listening',listeningHandler);_0x20dc7f['on'](_0x68ef('0x5a'),connectionHandler);_0x20dc7f['on'](_0x68ef('0x38'),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 968843f..ab93320 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 _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 +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x39634b,_0x14f217){var _0x597363=function(_0x2545d4){while(--_0x2545d4){_0x39634b['push'](_0x39634b['shift']());}};_0x597363(++_0x14f217);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 b104659..1937779 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(_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 +var _0xb10b=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','trim','slice','length','emit','headers','line','exports','util','Transform'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0xb10b,0x12a));var _0xbb10=function(_0x1daebd,_0x79a89){_0x1daebd=_0x1daebd-0x0;var _0x462a89=_0xb10b[_0x1daebd];return _0x462a89;};'use strict';var util=require(_0xbb10('0x0'));var Transform=require('stream')[_0xbb10('0x1')];function AGIReply(_0x35bc5f){Transform[_0xbb10('0x2')](this,_0x35bc5f);this['_localBuffer']='';this[_0xbb10('0x3')]=![];}util[_0xbb10('0x4')](AGIReply,Transform);AGIReply[_0xbb10('0x5')][_0xbb10('0x6')]=function(_0x49baf4,_0x312b72,_0x481979){var _0x328583='\x0a',_0x3cdd53=['\x0a\x0a',_0xbb10('0x7')],_0x513741=-0x1,_0x1b9e94=-0x1,_0x3fb675='',_0x21370f=0x0,_0x1c3ee5='',_0x2353ef='';this[_0xbb10('0x8')]+=_0x49baf4[_0xbb10('0x9')]();_0x1c3ee5=this['_localBuffer'];if(!this['_inBody']){_0x21370f=0x0;while(_0x3cdd53[_0x21370f]){while((_0x1b9e94=_0x1c3ee5[_0xbb10('0xa')](_0x3cdd53[_0x21370f]))!=-0x1){_0x3fb675=_0x3cdd53[_0x21370f];_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x1b9e94);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x1b9e94+_0x3fb675['length']);var _0x408248=_0x2353ef[_0xbb10('0xc')](_0x328583),_0x5be7e0=0x0,_0x44fb19={},_0x916a32='',_0x285009='',_0x193a27=-0x1;while(_0x408248[_0x5be7e0]){_0x193a27=_0x408248[_0x5be7e0][_0xbb10('0xa')](':');if(_0x193a27!=-0x1){_0x916a32=_0x408248[_0x5be7e0]['slice'](0x0,_0x193a27)[_0xbb10('0xd')]();_0x285009=_0x408248[_0x5be7e0][_0xbb10('0xe')](_0x193a27+0x1)[_0xbb10('0xd')]();if(_0x916a32[_0xbb10('0xf')]>0x0){_0x44fb19[_0x916a32]=_0x285009;}}else{}_0x5be7e0++;}this[_0xbb10('0x10')](_0xbb10('0x11'),_0x44fb19);this[_0xbb10('0x3')]=!![];}_0x21370f++;}this[_0xbb10('0x8')]=_0x1c3ee5;}else{while((_0x513741=_0x1c3ee5[_0xbb10('0xa')](_0x328583))!=-0x1){_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x513741);this['emit'](_0xbb10('0x12'),_0x2353ef);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x513741+_0x328583[_0xbb10('0xf')]);}this[_0xbb10('0x8')]=_0x1c3ee5;}_0x481979();};module[_0xbb10('0x13')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 0493a52..ca86bac 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 _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 +var _0x6ea6=['getSquareOdbcById','dsn','ShowUser','getTrunkById','getSoundById','ShowSound','save_name','getIntervalById','Interval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','phone','ListId','getPauseById','ShowPause','agentLogin','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','http','then','error','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','email','getSquareProjectById','name','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable'];(function(_0x5d8d8a,_0x44eaa6){var _0x2656c9=function(_0xd4c485){while(--_0xd4c485){_0x5d8d8a['push'](_0x5d8d8a['shift']());}};_0x2656c9(++_0x44eaa6);}(_0x6ea6,0x14f));var _0x66ea=function(_0x2d364e,_0x301c5e){_0x2d364e=_0x2d364e-0x0;var _0x1b9312=_0x6ea6[_0x2d364e];return _0x1b9312;};'use strict';var BPromise=require(_0x66ea('0x0'));var moment=require(_0x66ea('0x1'));var _=require(_0x66ea('0x2'));var util=require(_0x66ea('0x3'));var jayson=require(_0x66ea('0x4'));var client=jayson[_0x66ea('0x5')][_0x66ea('0x6')]({'port':0x2329});function request(_0xb2e7d6,_0x1449db){return new BPromise(function(_0x1b5935,_0x1b266f){return client['request'](_0xb2e7d6,_0x1449db)[_0x66ea('0x7')](function(_0x39b73c){if(_0x39b73c['error']){return _0x1b266f(_0x39b73c[_0x66ea('0x8')]['message']);}else{return _0x1b5935(_0x39b73c[_0x66ea('0x9')]);}})[_0x66ea('0xa')](function(_0x390bf8){return _0x1b266f(_0x390bf8);});});}exports[_0x66ea('0xb')]=function(_0xf27ef){return request(_0x66ea('0xc'),{'options':{'raw':![],'where':{'name':_0xf27ef},'attributes':[_0x66ea('0xd')]}});};exports[_0x66ea('0xe')]=function(_0xb23a8c){return request(_0x66ea('0xf'),{'options':{'raw':![],'where':{'id':_0xb23a8c},'include':[{'model':_0x66ea('0x10'),'as':_0x66ea('0x11')}],'attributes':['id','name',_0x66ea('0x12')]}});};exports[_0x66ea('0x13')]=function(_0x194b20){return request(_0x66ea('0xc'),{'options':{'where':{'id':_0x194b20},'attributes':[_0x66ea('0x14')]}});};exports[_0x66ea('0x15')]=function(_0xb000ca){return request(_0x66ea('0x16'),{'options':{'where':{'id':_0xb000ca},'attributes':[_0x66ea('0x14')]}});};exports[_0x66ea('0x17')]=function(_0x9d4fed){return request(_0x66ea('0x18'),{'options':{'where':{'id':_0x9d4fed},'attributes':[_0x66ea('0x14')]}});};exports[_0x66ea('0x19')]=function(_0xc5bddb){return request('ShowSquareOdbc',{'options':{'where':{'id':_0xc5bddb},'attributes':[_0x66ea('0x1a')]}});};exports['getUserById']=function(_0x1d7847){return request(_0x66ea('0x1b'),{'options':{'where':{'id':_0x1d7847},'attributes':[_0x66ea('0x14')]}});};exports[_0x66ea('0x1c')]=function(_0x1ad666){return request('ShowTrunk',{'options':{'where':{'id':_0x1ad666},'attributes':[_0x66ea('0x14')]}});};exports[_0x66ea('0x1d')]=function(_0x29a569){return request(_0x66ea('0x1e'),{'options':{'where':{'id':_0x29a569},'attributes':[_0x66ea('0x1f')]}});};exports[_0x66ea('0x20')]=function(_0x27c97d){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x27c97d},'include':[{'model':_0x66ea('0x21'),'as':_0x66ea('0x22')}]}});};exports['getSmsAccountById']=function(_0x3c6118){return request(_0x66ea('0x23'),{'options':{'where':{'id':_0x3c6118},'attributes':['id',_0x66ea('0x14')]}});};exports[_0x66ea('0x24')]=function(_0x40f9a4){return request(_0x66ea('0x25'),{'body':_0x40f9a4});};exports[_0x66ea('0x26')]=function(_0x5c9a6f){return request(_0x66ea('0x27'),{'body':_0x5c9a6f});};exports[_0x66ea('0x28')]=function(_0xe88d47){return request(_0x66ea('0x29'),{'body':_[_0x66ea('0x2a')](_0xe88d47,{'project_name':_0xe88d47['arg_1'],'prev_project_name':_0xe88d47[_0x66ea('0x2b')]||'','is_subproject':_0xe88d47[_0x66ea('0x2b')]?!![]:![],'leaveAt':moment()[_0x66ea('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x66ea('0x2d')]=function(_0x52a49b){return request(_0x66ea('0x2e'),{'body':_0x52a49b});};exports[_0x66ea('0x2f')]=function(_0x24689f){return request(_0x66ea('0x30'),{'body':_0x24689f});};exports[_0x66ea('0x31')]=function(_0x4ad257){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x4ad257[_0x66ea('0x32')],'ListId':_0x4ad257[_0x66ea('0x33')]}}})[_0x66ea('0x7')](function(_0x10fd87){if(_0x10fd87){return _0x10fd87;}return request('CreateCmContact',{'body':_0x4ad257});});};exports[_0x66ea('0x34')]=function(_0xdf645c){return request(_0x66ea('0x35'),{'options':{'where':{'id':_0xdf645c},'attributes':[_0x66ea('0x14')]}});};exports[_0x66ea('0x36')]=function(_0x2db68d,_0xe54b4f){return request('LoginUser',{'body':{'interface':_0xe54b4f},'options':{'where':_0x2db68d}});};exports['agentPause']=function(_0x1d8408,_0x37ab51,_0x3d504f){return request(_0x66ea('0x37'),{'body':{'type':_0x37ab51,'uniqueid':_0x3d504f},'options':{'where':_0x1d8408}});};exports[_0x66ea('0x38')]=function(_0x59ad8b){return request(_0x66ea('0x39'),{'body':{},'options':{'where':_0x59ad8b}});};exports[_0x66ea('0x3a')]=function(_0x4b24da){return request(_0x66ea('0x3b'),{'body':{},'options':{'where':_0x4b24da}});}; \ 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 1cce63c..d46e751 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 _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 +var _0xe107=['exports','./polly'];(function(_0x183c9b,_0x108d81){var _0x307e83=function(_0x23808c){while(--_0x23808c){_0x183c9b['push'](_0x183c9b['shift']());}};_0x307e83(++_0x108d81);}(_0xe107,0xb3));var _0x7e10=function(_0x19ceda,_0x294d08){_0x19ceda=_0x19ceda-0x0;var _0x57f5c6=_0xe107[_0x19ceda];return _0x57f5c6;};var polly=require(_0x7e10('0x0'));var lex=require('./lex');module[_0x7e10('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 b291d53..440a233 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 _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 +var _0x0b78=['exports','./lib/api'];(function(_0x1f3591,_0x1270e9){var _0x3ffcd8=function(_0x1898ac){while(--_0x1898ac){_0x1f3591['push'](_0x1f3591['shift']());}};_0x3ffcd8(++_0x1270e9);}(_0x0b78,0x1ad));var _0x80b7=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0b78[_0x4b369d];return _0x571a98;};'use strict';var lex=require(_0x80b7('0x0'));module[_0x80b7('0x1')]=function(_0x5d450f,_0x10e644,_0x4f55ab,_0x4bffac,_0x261012,_0x4ee9b4){return lex(_0x5d450f,_0x10e644,_0x4f55ab,_0x4bffac,_0x261012,_0x4ee9b4);}; \ 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 c0b8039..cca6ea9 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 _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 +var _0x2002=['postText','slots','hasOwnProperty','slot_','exports','LexRuntime','$LATEST','bluebird','aws-sdk'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2002,0x103));var _0x2200=function(_0x31df6f,_0x380e73){_0x31df6f=_0x31df6f-0x0;var _0x31e353=_0x2002[_0x31df6f];return _0x31e353;};'use strict';var BPromise=require(_0x2200('0x0'));var AWS=require(_0x2200('0x1'));function lexResult(_0x2aeaea,_0x5e6151){return new BPromise(function(_0x22b108,_0x48b1bc){_0x2aeaea[_0x2200('0x2')](_0x5e6151,function(_0x7c5a6d,_0x451362){if(_0x7c5a6d){_0x48b1bc(_0x7c5a6d);}if(_0x451362[_0x2200('0x3')]){for(const _0x477b55 in _0x451362['slots']){if(_0x451362[_0x2200('0x3')][_0x2200('0x4')](_0x477b55)){var _0x4c1282=_0x451362[_0x2200('0x3')][_0x477b55];_0x451362[_0x2200('0x5')+_0x477b55]=_0x4c1282;}}}_0x22b108(_0x451362);});});}module[_0x2200('0x6')]=function(_0x2ec2bf,_0x1f57b3,_0x197981,_0x406d5d,_0x19d108,_0x24dd13){var _0x1796e2=new AWS[(_0x2200('0x7'))]({'accessKeyId':_0x1f57b3,'secretAccessKey':_0x197981,'region':_0x406d5d});var _0x110c86={'botAlias':_0x2200('0x8'),'botName':_0x24dd13,'inputText':_0x19d108,'userId':_0x2ec2bf};return lexResult(_0x1796e2,_0x110c86);}; \ 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 ac3fcf4..3edde54 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 _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 +'use strict';var polly=require('./lib/api');module['exports']=function(_0x2db1e0,_0x18c3a8,_0x3b0a08,_0x26abfc,_0x423355,_0x23e8fd,_0xafd5e6){return polly(_0x2db1e0,_0x18c3a8,_0x3b0a08,_0x26abfc,_0x423355,_0x23e8fd,_0xafd5e6);}; \ 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 ec35aee..eb52e84 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 _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 +var _0x8ccc=['AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','randomstring','synthesizeSpeech'];(function(_0x5e5347,_0x20eea4){var _0x502fe2=function(_0x5eec0b){while(--_0x5eec0b){_0x5e5347['push'](_0x5e5347['shift']());}};_0x502fe2(++_0x20eea4);}(_0x8ccc,0xae));var _0xc8cc=function(_0x3fc649,_0x1eca02){_0x3fc649=_0x3fc649-0x0;var _0xc266ec=_0x8ccc[_0x3fc649];return _0xc266ec;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require(_0xc8cc('0x0'));var AWS=require('aws-sdk');function pollyResult(_0x1b66a6,_0xc6eb5b,_0x53426d){return new BPromise(function(_0x143270,_0x2531d0){_0x1b66a6[_0xc8cc('0x1')](_0xc6eb5b,function(_0x5afef6,_0x1e20ee){if(_0x5afef6){_0x2531d0(_0x5afef6);}else if(_0x1e20ee){if(_0x1e20ee[_0xc8cc('0x2')]instanceof Buffer){fs[_0xc8cc('0x3')](_0x53426d,_0x1e20ee[_0xc8cc('0x2')],function(_0x41a215){if(_0x41a215){_0x2531d0(_0x41a215);}else{_0x143270();}});}else{_0x2531d0(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x2531d0(new Error(_0xc8cc('0x4')));}});});}module[_0xc8cc('0x5')]=function(_0x19793e,_0x24df0e,_0x5d55cd,_0x59b094,_0x5d4737,_0x1495e9,_0x15c61b){var _0x2d441c=new AWS['Polly']({'accessKeyId':_0x19793e,'secretAccessKey':_0x24df0e,'region':_0x5d55cd});var _0x33fd23={'Text':_0x5d4737,'TextType':_0x1495e9||_0xc8cc('0x6'),'OutputFormat':_0xc8cc('0x7'),'VoiceId':_0x59b094};return pollyResult(_0x2d441c,_0x33fd23,_0x15c61b);}; \ 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 d01c26c..0c22d7f 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 _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 +var _0xdb39=['./lib/api','exports'];(function(_0x4effa3,_0x591921){var _0x1eb030=function(_0x51f933){while(--_0x51f933){_0x4effa3['push'](_0x4effa3['shift']());}};_0x1eb030(++_0x591921);}(_0xdb39,0x1a8));var _0x9db3=function(_0x56825b,_0x172b8d){_0x56825b=_0x56825b-0x0;var _0x69ce77=_0xdb39[_0x56825b];return _0x69ce77;};'use strict';var asr=require(_0x9db3('0x0'));module[_0x9db3('0x1')]=function(_0x523aea,_0x10f050,_0x75df76,_0x331bf9){return asr(_0x523aea,_0x10f050,_0x75df76);}; \ 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 d886079..6378dc1 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 _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 +var _0x04e1=['string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','url','bluebird','exports'];(function(_0x5cc51f,_0x22c480){var _0x315a2f=function(_0x4f93bd){while(--_0x4f93bd){_0x5cc51f['push'](_0x5cc51f['shift']());}};_0x315a2f(++_0x22c480);}(_0x04e1,0x190));var _0x104e=function(_0x4ec3a2,_0x10e83b){_0x4ec3a2=_0x4ec3a2-0x0;var _0x99c3b6=_0x04e1[_0x4ec3a2];return _0x99c3b6;};'use strict';var url=require(_0x104e('0x0'));var BPromise=require(_0x104e('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x104e('0x2')]=function(_0x3550d3,_0x5e8bf0,_0x3a15d0){return new BPromise(function(_0xa7c2a1,_0x1597eb){var _0xc17ba7;if(typeof _0x3550d3!==_0x104e('0x3')||_0x3550d3[_0x104e('0x4')]===0x0){return _0x1597eb(_0x104e('0x5'));}if(typeof _0x5e8bf0!==_0x104e('0x3')||_0x5e8bf0[_0x104e('0x4')]===0x0){return _0x1597eb('key\x20should\x20be\x20a\x20string');}if(typeof _0x3a15d0!==_0x104e('0x6')&&(typeof _0x3a15d0!=='string'||_0x3a15d0[_0x104e('0x4')]===0x0)){return _0x1597eb(_0x104e('0x7'));}try{_0xc17ba7=fs['readFileSync'](_0x3550d3)[_0x104e('0x8')](_0x104e('0x9'));}catch(_0x10821d){return _0x1597eb(_0x10821d);}return _0xa7c2a1({'method':_0x104e('0xa'),'uri':host+_0x104e('0xb')+_0x5e8bf0,'body':{'config':{'encoding':_0x104e('0xc'),'sampleRateHertz':'8000','languageCode':_0x3a15d0},'audio':{'content':_0xc17ba7}},'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 c9f7e59..e97064b 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 _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 +var _0x024b=['./asr','exports'];(function(_0x4de156,_0x19d256){var _0x3f6afd=function(_0x5d8e9e){while(--_0x5d8e9e){_0x4de156['push'](_0x4de156['shift']());}};_0x3f6afd(++_0x19d256);}(_0x024b,0xac));var _0xb024=function(_0x1cccd3,_0x307ba0){_0x1cccd3=_0x1cccd3-0x0;var _0x40a7af=_0x024b[_0x1cccd3];return _0x40a7af;};var asr=require(_0xb024('0x0'));module[_0xb024('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 be4cbe1..b06edc1 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 _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 +var _0x4564=['finish\x20download\x20file','close','download\x20error','pipe','end','https:','transcode','wav','error\x20convert','info','finish\x20to\x20convert','start','tmp','generate','.wav','writeFileSync','base64','then','unlink','chmodSync','777','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','audioConfig','MP3','text:synthesize','resolve','.mp3','audioContent','writeFile','googleCloudTTS\x20path','split','googleTTS','goggleTTS\x20path','googleASR','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','stringify','result','source','resolvedQuery','actionIncomplete','fulfillment','score','status','code','metadata','isFallbackIntent','asr','Tilde\x20ASR\x20transcription','awsPolly','polly','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','parse','nda','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','path','http','https','url','randomstring','sox','request-promise','querystring','google-tts-api','apiai-promise','md5','./google','./tilde','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream'];(function(_0x1628c1,_0x120470){var _0x5bd9b2=function(_0x279bcd){while(--_0x279bcd){_0x1628c1['push'](_0x1628c1['shift']());}};_0x5bd9b2(++_0x120470);}(_0x4564,0x129));var _0x4456=function(_0x3c1cb8,_0x48eea1){_0x3c1cb8=_0x3c1cb8-0x0;var _0x5d10f8=_0x4564[_0x3c1cb8];return _0x5d10f8;};'use strict';var fs=require('fs');var path=require(_0x4456('0x0'));var http=require(_0x4456('0x1'));var https=require(_0x4456('0x2'));var urlParse=require(_0x4456('0x3'))['parse'];var BPromise=require('bluebird');var rs=require(_0x4456('0x4'));var sox=require(_0x4456('0x5'));var rp=require(_0x4456('0x6'));var util=require('util');var querystring=require(_0x4456('0x7'));var tts=require(_0x4456('0x8'));var apiai=require(_0x4456('0x9'));var md5=require(_0x4456('0xa'));var google=require(_0x4456('0xb'));var aws=require('./aws');var tilde=require(_0x4456('0xc'));var sestek=require(_0x4456('0xd'));var logger=require(_0x4456('0xe'))(_0x4456('0xf'));var ISPEECH_API=_0x4456('0x10');function downloadFile(_0x277462,_0x55c8fb){return new BPromise(function(_0x53c7f6,_0x556526){var _0x435aff=urlParse(_0x277462);var _0x5b1229=_0x435aff[_0x4456('0x11')]==='https:'?https:http;var _0x54c2d6={'host':_0x435aff[_0x4456('0x12')],'path':_0x435aff['path'],'headers':{'user-agent':_0x4456('0x13')}};_0x5b1229[_0x4456('0x14')](_0x54c2d6,function(_0xaf1592){if(_0xaf1592[_0x4456('0x15')]!==0xc8){logger[_0x4456('0x16')](_0x4456('0x17')+_0x277462+_0x4456('0x18')+_0xaf1592[_0x4456('0x15')]+'\x20('+_0xaf1592[_0x4456('0x19')]+')');_0x556526(new Error('request\x20to\x20'+_0x277462+_0x4456('0x18')+_0xaf1592['statusCode']+'\x20('+_0xaf1592[_0x4456('0x19')]+')'));return;}var _0x7626a8=fs[_0x4456('0x1a')](_0x55c8fb);_0x7626a8['on']('finish',function(){logger['info'](_0x4456('0x1b'));_0x7626a8[_0x4456('0x1c')](_0x53c7f6);});_0x7626a8['on'](_0x4456('0x16'),function(_0x1465c3){fs['unlink'](_0x55c8fb);logger[_0x4456('0x16')](_0x4456('0x1d'),_0x1465c3);_0x556526(_0x1465c3);});_0xaf1592[_0x4456('0x1e')](_0x7626a8);})['on'](_0x4456('0x16'),function(_0x28020d){logger[_0x4456('0x16')](_0x28020d);_0x556526(_0x28020d);})[_0x4456('0x1f')]();});}function uploadFile(_0x1667ad){return new BPromise(function(_0x5a148f,_0x4dba03){var _0x1571a7=urlParse(_0x1667ad);var _0x40bfa9=_0x1571a7[_0x4456('0x11')]===_0x4456('0x20')?https:http;var _0x12e339={'host':_0x1571a7[_0x4456('0x12')],'path':_0x1571a7[_0x4456('0x0')],'headers':{'user-agent':_0x4456('0x13')}};_0x40bfa9[_0x4456('0x14')](_0x12e339,function(_0x53d007){if(_0x53d007['statusCode']!==0xc8){_0x4dba03(new Error(_0x4456('0x17')+_0x1667ad+_0x4456('0x18')+_0x53d007[_0x4456('0x15')]+'\x20('+_0x53d007[_0x4456('0x19')]+')'));return;}var _0x4eddcf='';_0x53d007['on']('data',function(_0x1a3248){_0x4eddcf+=_0x1a3248;});_0x53d007['on'](_0x4456('0x1f'),function(){_0x5a148f(_0x4eddcf);});})['on'](_0x4456('0x16'),function(_0x46761f){_0x4dba03(_0x46761f);})[_0x4456('0x1f')]();});}function convertFile(_0x2c9cf5,_0x9bd79f){return new BPromise(function(_0x127893,_0x93fe96){var _0xec573f=sox[_0x4456('0x21')](_0x2c9cf5,_0x9bd79f,{'sampleRate':0x1f40,'format':_0x4456('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xec573f['on'](_0x4456('0x16'),function(_0x547b22){logger[_0x4456('0x16')](_0x4456('0x23'),_0x547b22);_0x93fe96(_0x547b22);});_0xec573f['on'](_0x4456('0x1f'),function(){logger[_0x4456('0x24')](_0x4456('0x25'));_0x127893();});_0xec573f[_0x4456('0x26')]();});}function base64Decode(_0x50ec53,_0x44b7c1){var _0x36a6e1=path['resolve'](__dirname,_0x4456('0x27'),rs[_0x4456('0x28')](0x4)+_0x4456('0x29'));fs[_0x4456('0x2a')](_0x36a6e1,_0x50ec53,_0x4456('0x2b'));return convertFile(_0x36a6e1,_0x44b7c1)[_0x4456('0x2c')](function(){try{fs[_0x4456('0x2d')](_0x36a6e1);fs[_0x4456('0x2e')](_0x44b7c1,_0x4456('0x2f'));}catch(_0x3df293){logger[_0x4456('0x16')](_0x3df293);}return _0x44b7c1['split']('.')[0x0];});}function base64Encode(_0x17cf36){var _0x4add65=fs['readFileSync'](_0x17cf36);return new Buffer(_0x4add65)[_0x4456('0x30')](_0x4456('0x2b'));}exports[_0x4456('0x31')]=function(_0x464e27,_0x314aeb,_0x58a38d,_0x355a56,_0x20506b,_0x5dd8f0){var _0x4290e6,_0x5972c2;var _0x2192a8=_0x4456('0x32');var _0x568d30=_0x4456('0x33')+_0x464e27;var _0x1d2953={};if(_0x314aeb==='ssml'){_0x1d2953[_0x4456('0x34')]={'ssml':_0x58a38d};}else{_0x1d2953[_0x4456('0x34')]={'text':_0x58a38d};};_0x1d2953['voice']={'languageCode':_0x355a56,'ssmlGender':_0x20506b};_0x1d2953[_0x4456('0x35')]={'audioEncoding':_0x4456('0x36'),'sampleRateHertz':0x1f40};var _0x4303fc={'url':_0x2192a8+_0x4456('0x37')+_0x568d30,'method':'POST','json':!![],'body':_0x1d2953};return rp(_0x4303fc)['then'](function(_0x5b2e48){return new BPromise(function(_0x54de96,_0x28977d){_0x4290e6=path[_0x4456('0x38')](__dirname,_0x4456('0x27'),rs['generate'](0x4)+_0x4456('0x39'));var _0x12fdcd=Buffer['from'](_0x5b2e48[_0x4456('0x3a')],_0x4456('0x2b'));return fs[_0x4456('0x3b')](_0x4290e6,_0x12fdcd,function(_0x1682ae){_0x28977d(_0x1682ae);},function(_0x4e940b){fs[_0x4456('0x2e')](_0x4290e6,'777');_0x54de96(_0x4e940b);});});})['then'](function(_0x4b4f25){_0x5972c2=path[_0x4456('0x38')](__dirname,_0x4456('0x27'),rs[_0x4456('0x28')](0x4)+_0x4456('0x29'));return convertFile(_0x4290e6,_0x5972c2);})[_0x4456('0x2c')](function(){try{fs[_0x4456('0x2d')](_0x4290e6);fs[_0x4456('0x2e')](_0x5972c2,_0x4456('0x2f'));}catch(_0x2f01f5){logger['error'](_0x2f01f5);}logger[_0x4456('0x24')](_0x4456('0x3c'),_0x5972c2['split']('.')[0x0]);return _0x5972c2[_0x4456('0x3d')]('.')[0x0];});};exports[_0x4456('0x3e')]=function(_0x3a86ac,_0x227b72){var _0x3dbd1d,_0x51fd47;return tts(_0x3a86ac,_0x227b72||'en',0x1)[_0x4456('0x2c')](function(_0x2bbdfc){logger[_0x4456('0x24')](_0x2bbdfc);_0x3dbd1d=path[_0x4456('0x38')](__dirname,_0x4456('0x27'),rs[_0x4456('0x28')](0x4)+_0x4456('0x39'));return downloadFile(_0x2bbdfc,_0x3dbd1d);})['then'](function(){_0x51fd47=path['resolve'](__dirname,_0x4456('0x27'),rs[_0x4456('0x28')](0x4)+_0x4456('0x29'));return convertFile(_0x3dbd1d,_0x51fd47);})[_0x4456('0x2c')](function(){try{fs[_0x4456('0x2d')](_0x3dbd1d);fs['chmodSync'](_0x51fd47,_0x4456('0x2f'));}catch(_0x10aafa){logger['error'](_0x10aafa);}logger['info'](_0x4456('0x3f'),_0x51fd47[_0x4456('0x3d')]('.')[0x0]);return _0x51fd47[_0x4456('0x3d')]('.')[0x0];});};exports[_0x4456('0x40')]=function(_0x5481dc,_0x3f9ebb,_0x27fd9a){return google['asr'](_0x5481dc,_0x3f9ebb,_0x27fd9a)[_0x4456('0x2c')](function(_0x1bd6f1){logger[_0x4456('0x24')](_0x1bd6f1[_0x4456('0x41')]);return rp(_0x1bd6f1);})[_0x4456('0x2c')](function(_0x30b73f){var _0x4a2423='';var _0x59489f=0x0;try{fs['unlink'](_0x5481dc);}catch(_0x149515){logger['error'](_0x149515);}if(_0x30b73f&&_0x30b73f[_0x4456('0x42')]){_0x4a2423=_0x30b73f[_0x4456('0x42')]['map'](function(_0x573dea){return _0x573dea&&_0x573dea[_0x4456('0x43')][0x0]&&_0x573dea[_0x4456('0x43')][0x0][_0x4456('0x44')]?_0x573dea['alternatives'][0x0][_0x4456('0x44')]:'';})[_0x4456('0x45')]('\x0a');_0x59489f=_0x30b73f['results'][_0x4456('0x46')](function(_0x35ca5f){return _0x35ca5f&&_0x35ca5f[_0x4456('0x43')][0x0]&&_0x35ca5f[_0x4456('0x43')][0x0][_0x4456('0x47')]?_0x35ca5f[_0x4456('0x43')][0x0][_0x4456('0x47')]:0x0;})['join']('\x0a');}logger['info'](_0x4456('0x48'),_0x4a2423);logger[_0x4456('0x24')](_0x4456('0x49'),_0x59489f);return{'transcript':_0x4a2423,'confidence':_0x59489f};})[_0x4456('0x4a')](function(_0xe0dfab){logger['error'](_0x4456('0x4b'),_0xe0dfab[_0x4456('0x15')],_0xe0dfab[_0x4456('0x4c')],_0xe0dfab['message']);});};exports[_0x4456('0x4d')]=function(_0x7bd443,_0x3e7903,_0xd3f7d5,_0x43c987){var _0x1b7f83=apiai(_0x3e7903,{'language':_0x43c987||'en'});return _0x1b7f83['textRequest'](_0xd3f7d5,{'sessionId':md5(_0x7bd443)})['then'](function(_0xc8fc08){logger[_0x4456('0x24')](JSON[_0x4456('0x4e')](_0xc8fc08));return{'source':_0xc8fc08[_0x4456('0x4f')][_0x4456('0x50')],'resolvedQuery':_0xc8fc08[_0x4456('0x4f')][_0x4456('0x51')],'action':_0xc8fc08[_0x4456('0x4f')]['action'],'actionIncomplete':_0xc8fc08['result'][_0x4456('0x52')],'speech':_0xc8fc08[_0x4456('0x4f')][_0x4456('0x53')]['speech'],'score':_0xc8fc08[_0x4456('0x4f')][_0x4456('0x54')],'statusCode':_0xc8fc08[_0x4456('0x55')][_0x4456('0x56')],'endConversation':_0xc8fc08['result'][_0x4456('0x57')]['endConversation']||![],'isFallbackIntent':_0xc8fc08[_0x4456('0x4f')]['metadata'][_0x4456('0x58')]};});};exports['tildeASR']=function(_0xea3d1d,_0x22ce93,_0x2109ee,_0x282e94){return tilde[_0x4456('0x59')](_0xea3d1d,_0x22ce93,_0x2109ee,_0x282e94)[_0x4456('0x2c')](function(_0x1792f1){try{fs['unlink'](_0xea3d1d);}catch(_0x43ff8d){logger[_0x4456('0x16')](_0x43ff8d);}logger['info'](_0x4456('0x5a'),_0x1792f1[_0x4456('0x44')]);logger['info']('Tilde\x20ASR\x20confidence',_0x1792f1[_0x4456('0x47')]);return _0x1792f1;});};exports[_0x4456('0x5b')]=function(_0x22838a,_0x575709,_0x4a1b35,_0x5bcec8,_0x38eeef,_0x48ad78){var _0x30608d=path[_0x4456('0x38')](__dirname,_0x4456('0x27'),rs['generate'](0x4)+'.mp3');var _0x589094;return aws[_0x4456('0x5c')](_0x22838a,_0x575709,_0x4a1b35,_0x5bcec8,_0x38eeef,_0x48ad78,_0x30608d)['then'](function(){_0x589094=path[_0x4456('0x38')](__dirname,'tmp',rs[_0x4456('0x28')](0x4)+_0x4456('0x29'));return convertFile(_0x30608d,_0x589094);})['then'](function(){try{fs[_0x4456('0x2d')](_0x30608d);fs[_0x4456('0x2e')](_0x589094,_0x4456('0x2f'));}catch(_0x3d38ad){logger[_0x4456('0x16')](_0x3d38ad);}return _0x589094[_0x4456('0x3d')]('.')[0x0];});};exports['awsLex']=function(_0x3ef352,_0x179ea7,_0x438342,_0x359842,_0x51dd97,_0x27e3e7){return aws[_0x4456('0x5d')](_0x3ef352,_0x179ea7,_0x438342,_0x359842,_0x51dd97,_0x27e3e7)[_0x4456('0x2c')](function(_0x26ef84){logger[_0x4456('0x24')](JSON[_0x4456('0x4e')](_0x26ef84));return _0x26ef84;});};exports[_0x4456('0x5e')]=function(_0x288561,_0x57a078,_0x389c16,_0x355191){var _0x2609fd=util[_0x4456('0x5f')](_0x4456('0x60'),ISPEECH_API,_0x288561,encodeURIComponent(_0x57a078),_0x389c16,_0x355191);var _0x856160=path[_0x4456('0x38')](__dirname,_0x4456('0x27'),rs[_0x4456('0x28')](0x4)+'.mp3');var _0x239e55;return downloadFile(_0x2609fd,_0x856160)[_0x4456('0x2c')](function(){_0x239e55=path['resolve'](__dirname,_0x4456('0x27'),rs[_0x4456('0x28')](0x4)+_0x4456('0x29'));return convertFile(_0x856160,_0x239e55);})[_0x4456('0x2c')](function(){try{fs[_0x4456('0x2d')](_0x856160);fs[_0x4456('0x2e')](_0x239e55,_0x4456('0x2f'));}catch(_0x3752ab){logger[_0x4456('0x16')](_0x3752ab);}return _0x239e55['split']('.')[0x0];});};exports[_0x4456('0x61')]=function(_0x19ca9f,_0x3f6e54,_0x504025,_0xef2ed0){var _0xeb5cfa=util[_0x4456('0x5f')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x3f6e54,_0x504025,base64Encode(_0x19ca9f),_0xef2ed0?util['format'](_0x4456('0x62'),encodeURIComponent(_0xef2ed0)):_0x4456('0x63'));return uploadFile(_0xeb5cfa)[_0x4456('0x2c')](function(_0x11622e){return querystring[_0x4456('0x64')](_0x11622e);});};exports['sestekNDA']=function(_0x2ed1b7,_0x5c9f13){return sestek[_0x4456('0x65')](_0x2ed1b7,_0x5c9f13)[_0x4456('0x2c')](function(_0x488d27){logger['info'](JSON[_0x4456('0x4e')](_0x488d27));var _0x20942d={'speech':_0x488d27['text'],'action':_0x488d27['channelData']?_0x488d27['channelData']['CustomAction']:undefined,'actiondata':_0x488d27[_0x4456('0x66')]?_0x488d27[_0x4456('0x66')][_0x4456('0x67')]:undefined};if(_0x488d27[_0x4456('0x66')]&&_0x488d27['channelData']['AudioFromTts']){return base64Decode(_0x488d27[_0x4456('0x66')][_0x4456('0x68')][_0x4456('0x69')],path[_0x4456('0x38')](__dirname,_0x4456('0x27'),rs[_0x4456('0x28')](0x4)+_0x4456('0x29')))[_0x4456('0x2c')](function(_0x1a202c){_0x20942d[_0x4456('0x6a')]=_0x1a202c;return _0x20942d;});}return _0x20942d;});};exports[_0x4456('0x6b')]=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 8ff9828..35454cd 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 _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 +var _0xc1e9=['exports','./nda'];(function(_0x3168e1,_0xa046e0){var _0x13ad69=function(_0x136b1f){while(--_0x136b1f){_0x3168e1['push'](_0x3168e1['shift']());}};_0x13ad69(++_0xa046e0);}(_0xc1e9,0x181));var _0x9c1e=function(_0x54e282,_0x324bbd){_0x54e282=_0x54e282-0x0;var _0x55d348=_0xc1e9[_0x54e282];return _0x55d348;};var nda=require(_0x9c1e('0x0'));module[_0x9c1e('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 067b36e..cf8b51f 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 _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 +var _0x6283=['audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','url','../../../../../config/logger','agi','exports','POST','/token','password','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','body','channelData','ProjectName','project','AudioOutputSettings'];(function(_0x13c0cd,_0x3ceb1d){var _0x5bda3f=function(_0x1f954c){while(--_0x1f954c){_0x13c0cd['push'](_0x13c0cd['shift']());}};_0x5bda3f(++_0x3ceb1d);}(_0x6283,0x186));var _0x3628=function(_0x17643c,_0x57bacf){_0x17643c=_0x17643c-0x0;var _0x2c1634=_0x6283[_0x17643c];return _0x2c1634;};'use strict';var rp=require('request-promise');var url=require(_0x3628('0x0'));var logger=require(_0x3628('0x1'))(_0x3628('0x2'));module[_0x3628('0x3')]=function(_0x180efd,_0x45386a){var _0x485606={'method':_0x3628('0x4'),'uri':url['resolve'](_0x45386a['ndauth_url'],_0x3628('0x5')),'form':{'grant_type':'password','username':_0x45386a['username'],'password':_0x45386a[_0x3628('0x6')]},'json':!![]};return rp(_0x485606)[_0x3628('0x7')](function(_0x5c2b7e){var _0x529b98={'method':_0x3628('0x4'),'uri':url[_0x3628('0x8')](_0x45386a[_0x3628('0x9')],_0x3628('0xa')),'body':{'type':_0x45386a[_0x3628('0xb')]||_0x3628('0xc'),'channelId':'Nda','conversation':{'id':_0x180efd[_0x3628('0xd')]},'from':{'id':_0x180efd[_0x3628('0xe')],'name':_0x180efd[_0x3628('0xf')]},'recipient':{'id':_0x180efd[_0x3628('0x10')],'name':_0x180efd[_0x3628('0x11')]},'text':_0x45386a[_0x3628('0x12')],'channelData':{}},'headers':{'Authorization':_0x3628('0x13')+_0x5c2b7e[_0x3628('0x14')]},'json':!![]};if(_0x45386a['project']){_0x529b98[_0x3628('0x15')][_0x3628('0x16')][_0x3628('0x17')]=_0x45386a[_0x3628('0x18')];}if(_0x45386a['ndagenerate_audio']=='1'){_0x529b98[_0x3628('0x15')][_0x3628('0x16')][_0x3628('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x3628('0x1a')};}if(_0x45386a[_0x3628('0x1b')]){_0x529b98['body'][_0x3628('0x16')][_0x3628('0x1c')]=_0x45386a[_0x3628('0x1b')];if(_0x45386a[_0x3628('0x1d')]){_0x529b98[_0x3628('0x15')][_0x3628('0x16')][_0x3628('0x1e')]=_0x45386a[_0x3628('0x1d')];}}logger[_0x3628('0x1f')](JSON['stringify'](_0x529b98));return rp(_0x529b98);});}; \ 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 8ce7895..c521929 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 _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 +var _0x1dc0=['exports','./lib/api'];(function(_0x2d9c11,_0x2a4c8a){var _0x3b3e89=function(_0x415955){while(--_0x415955){_0x2d9c11['push'](_0x2d9c11['shift']());}};_0x3b3e89(++_0x2a4c8a);}(_0x1dc0,0xab));var _0x01dc=function(_0x34f240,_0x13490b){_0x34f240=_0x34f240-0x0;var _0x4c2ffd=_0x1dc0[_0x34f240];return _0x4c2ffd;};'use strict';var asr=require(_0x01dc('0x0'));module[_0x01dc('0x1')]=function(_0x4da007,_0x170a25,_0x451c4b,_0x5b4a63){return asr(_0x4da007,_0x170a25,_0x451c4b,_0x5b4a63);}; \ 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 b7702eb..ac789d1 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 _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 +var _0x56fd=['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','info','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','result','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','open','message','crypto','../../../../../../config/logger','exports','Tilde\x20URI'];(function(_0x593b76,_0xe8930e){var _0x139130=function(_0x564cb8){while(--_0x564cb8){_0x593b76['push'](_0x593b76['shift']());}};_0x139130(++_0xe8930e);}(_0x56fd,0x125));var _0xd56f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x56fd[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xd56f('0x0'));var logger=require(_0xd56f('0x1'))('agi');module[_0xd56f('0x2')]=function(_0x46969d,_0x314191,_0x25f7a0,_0x4906d2){return new BPromise(function(_0x11bfd7,_0x38c409){logger['info'](_0xd56f('0x3'),_0x4906d2||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x62d58e=new WebSocket(_0x4906d2||_0xd56f('0x4'),{'perMessageDeflate':![]});var _0x14e927='';var _0x14dcba='0';var _0x157495='1';var _0x36512a=_0xd56f('0x5');function _0x33d73f(_0x5f446c){var _0x4f8b46=crypto['createHash'](_0xd56f('0x6'));_0x4f8b46[_0xd56f('0x7')](_0x5f446c);return _0x4f8b46[_0xd56f('0x8')]('hex');}function _0x440de7(){try{logger[_0xd56f('0x9')](_0xd56f('0xa'));var _0x5b415e=moment()[_0xd56f('0xb')]();var _0x3e53cb=_0x33d73f(_0x5b415e+_0x314191+_0x25f7a0);_0x62d58e[_0xd56f('0xc')](JSON[_0xd56f('0xd')]({'appID':_0x314191,'timestamp':_0x5b415e,'appKey':_0x3e53cb}));var _0x1d4d59=fs['createReadStream'](_0x46969d);_0x1d4d59['on'](_0xd56f('0xe'),function(_0x547479){_0x62d58e[_0xd56f('0xc')](_0x547479);});_0x1d4d59['on'](_0xd56f('0xf'),function(){_0x62d58e[_0xd56f('0xc')](_0xd56f('0x10'));});}catch(_0x121897){logger[_0xd56f('0x11')](_0xd56f('0x12'),JSON[_0xd56f('0xd')](_0x121897));_0x62d58e[_0xd56f('0x13')]();}}function _0x21e1b2(_0x222456){try{if(_0x222456){var _0x419602=JSON[_0xd56f('0x14')](_0x222456);switch(_0x419602['status']){case 0x0:if(_0x419602[_0xd56f('0x15')]){if(_0x419602[_0xd56f('0x15')]['final']){logger[_0xd56f('0x9')](_0xd56f('0x16'),JSON[_0xd56f('0xd')](_0x419602['result'][_0xd56f('0x17')]));_0x14e927=_0x419602[_0xd56f('0x15')][_0xd56f('0x17')][0x0]['transcript'];_0x14dcba=_0x419602['result'][_0xd56f('0x17')][0x0][_0xd56f('0x18')];_0x157495='0';_0x36512a=_0xd56f('0x19');_0x62d58e[_0xd56f('0x13')]();}}break;case 0x1:logger[_0xd56f('0x9')](_0xd56f('0x5'));_0x157495='1';_0x36512a=_0xd56f('0x5');break;case 0x2:logger['info'](_0xd56f('0x1a'));_0x157495='2';_0x36512a=_0xd56f('0x1a');break;case 0x9:logger[_0xd56f('0x9')](_0xd56f('0x1b'));_0x157495='9';_0x36512a=_0xd56f('0x1b');break;case 0xa:logger[_0xd56f('0x9')](_0xd56f('0x1c'));_0x157495='10';_0x36512a=_0xd56f('0x1c');break;case 0xb:logger[_0xd56f('0x9')](_0xd56f('0x1d'));_0x157495='11';_0x36512a=_0xd56f('0x1d');}}}catch(_0x21d1f8){logger[_0xd56f('0x11')](_0xd56f('0x1e'),JSON['stringify'](_0x21d1f8));_0x62d58e['terminate']();}}function _0x532fe1(){logger[_0xd56f('0x9')]('Close\x20Tilde\x20ASR\x20socket');_0x11bfd7({'transcript':_0x14e927,'confidence':_0x14dcba,'status':_0x157495,'status_message':_0x36512a});}function _0x8d5947(_0xa25645){logger[_0xd56f('0x11')]('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0xa25645)){logger[_0xd56f('0x11')](_['isObject'](_0xa25645)?JSON[_0xd56f('0xd')](_0xa25645):_0xa25645);}}_0x62d58e['on'](_0xd56f('0x1f'),_0x440de7);_0x62d58e['on'](_0xd56f('0x20'),_0x21e1b2);_0x62d58e['on']('close',_0x532fe1);_0x62d58e['on'](_0xd56f('0x11'),_0x8d5947);});}; \ 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 7bb6634..e62ab52 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 _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 +var _0x4639=['./asr'];(function(_0x3e3507,_0x2988bf){var _0x20907e=function(_0x592962){while(--_0x592962){_0x3e3507['push'](_0x3e3507['shift']());}};_0x20907e(++_0x2988bf);}(_0x4639,0x115));var _0x9463=function(_0xdbc93e,_0x4fcd8e){_0xdbc93e=_0xdbc93e-0x0;var _0x29df2c=_0x4639[_0xdbc93e];return _0x29df2c;};var asr=require(_0x9463('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index ab76e35..4429778 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 _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 +var _0x8f37=['close','E_AGI_SERVER_CLOSE','nextTick','inherits','util','net','events','./channel','127.0.0.1','error','E_AGI_ARGUMENT_PORT','listen','listening','emit','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code'];(function(_0x29285e,_0xc2f384){var _0x52e46d=function(_0x5dda24){while(--_0x5dda24){_0x29285e['push'](_0x29285e['shift']());}};_0x52e46d(++_0xc2f384);}(_0x8f37,0x190));var _0x78f3=function(_0x323a21,_0x4e4b90){_0x323a21=_0x323a21-0x0;var _0x292ce3=_0x8f37[_0x323a21];return _0x292ce3;};'use strict';var util=require(_0x78f3('0x0'));var net=require(_0x78f3('0x1'));var EventEmitter=require(_0x78f3('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x78f3('0x3'));var AGIServer=function(_0x3c1fa6,_0x3b0667,_0x539794){var _0x1d59a5=this,_0x3c1fa6=_0x3c1fa6||0x11dd,_0x3b0667=_0x3b0667||_0x78f3('0x4'),_0x597b85=null,_0x11c6ad=0x0;EventEmitter['call'](_0x1d59a5);function _0x58bd73(){if(!_0x3c1fa6){_0x1d59a5['emit'](_0x78f3('0x5'),new AGIError(_0x78f3('0x6')));return![];}_0x597b85=net['createServer']();_0x597b85[_0x78f3('0x7')](_0x3c1fa6,_0x3b0667);_0x597b85['on'](_0x78f3('0x8'),function(){_0x1d59a5[_0x78f3('0x9')](_0x78f3('0x8'));});_0x597b85['on'](_0x78f3('0xa'),function(_0x53b7fd){_0x597b85[_0x78f3('0xb')](function(_0x3d5b47,_0x4c57c9){if(_0x3d5b47){_0x1d59a5[_0x78f3('0x9')](_0x78f3('0x5'),new AGIError(_0x78f3('0xc'),_0x3d5b47));}else if(_0x539794&&_0x539794<0x0){_0x1d59a5['emit'](_0x78f3('0x5'),new AGIError(_0x78f3('0xd')));_0x53b7fd[_0x78f3('0xe')]();}else if(_0x539794&&_0x539794>0x0&&_0x539794<_0x4c57c9){_0x11c6ad+=0x1;_0x1d59a5[_0x78f3('0x9')](_0x78f3('0x5'),new AGIError(_0x78f3('0xf'),_0x11c6ad));_0x53b7fd[_0x78f3('0xe')]();}else{var _0x38db12=new AGIChannel(_0x53b7fd);_0x38db12['on'](_0x78f3('0x10'),function(){_0x1d59a5[_0x78f3('0x9')](_0x78f3('0xa'),_0x38db12);});}});});_0x597b85['on'](_0x78f3('0x5'),function(_0x3e2a15){_0x1d59a5[_0x78f3('0x9')](_0x78f3('0x5'),new AGIError(_0x78f3('0xc'),_0x3e2a15[_0x78f3('0x11')]));});_0x597b85['on'](_0x78f3('0x12'),function(){_0x1d59a5[_0x78f3('0x9')](_0x78f3('0x12'),new AGIError(_0x78f3('0x13')));});}process[_0x78f3('0x14')](function(){_0x58bd73();});};util[_0x78f3('0x15')](AGIServer,EventEmitter);module['exports']=function(_0x2f7ec9,_0x1010aa,_0x53ee6a){return new AGIServer(_0x2f7ec9,_0x1010aa,_0x53ee6a);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index a474247..14c5c68 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 _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 +var _0x77c9=['output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','email','subject','service','host','port','secure','auth','user','pass','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Answer','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','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','join','exports','util','lodash','shelljs','odbc','moment','mustache','request-promise','../../config/logger','../../config/environment','./scripts','rawHeaders','rawBody','menu','getdigits','getsecretdigits','rpc','mailRpc','getVariable','then','catch','prototype','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','dsn','getUserById','name','getTrunk','save_name','getMailAccountById','sendMailMessage','IntervalId','interval','Intervals','getSoundPath','getQueryOdbc','open','error','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','label','agicommand','arg_1','createSquareRecording','uniqueid','callerid','calleridname','context','accountcode','dnid','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','callback_priority','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','ssmlGender','MP3','googleTTS','restAPI','method','timeout','number','includes','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','url','headers','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','sestekNDA','ispeech_tts_language','en-US','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','uri','clear','hasOwnProperty','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','isString','saveRestApiResult','%s.%s','setVariable','split','length','replaceAll','extra','toString','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','isConfigured','no\x20text\x20configured','MRCPSynth','result','noop','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','DIAL','SIP/%s','opts','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','maxRetry','no\x20file\x20audio\x20selected','getData','response','mindigit','maxdigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_secret_access_key','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','beep','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','extension','priority','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeechTTS','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','forEach','%s[%s]','variable\x20%s[key]\x20set','file_id','getSound','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block'];(function(_0x1aee25,_0xab3788){var _0xf5aa80=function(_0x1a2975){while(--_0x1a2975){_0x1aee25['push'](_0x1aee25['shift']());}};_0xf5aa80(++_0xab3788);}(_0x77c9,0x6a));var _0x977c=function(_0x2cdc86,_0x4c16c7){_0x2cdc86=_0x2cdc86-0x0;var _0x2e1b96=_0x77c9[_0x2cdc86];return _0x2e1b96;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x977c('0x0'));var _=require(_0x977c('0x1'));var sh=require(_0x977c('0x2'));var odbc=require(_0x977c('0x3'))();var rs=require('randomstring');var moment=require(_0x977c('0x4'));var Mustache=require(_0x977c('0x5'));var rp=require(_0x977c('0x6'));var logger=require(_0x977c('0x7'))('agi');var config=require(_0x977c('0x8'));var scripts=require(_0x977c('0x9'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x977c('0xa'),_0x977c('0xb')];var verticesWithRetry=[_0x977c('0xc'),_0x977c('0xd'),_0x977c('0xe')];var AGIVertices=function(_0x1df6bb,_0x280d62,_0x50e1d6){this['channel']=_0x1df6bb;this[_0x977c('0xf')]=_0x280d62;this[_0x977c('0x10')]=_0x50e1d6;};AGIVertices['prototype'][_0x977c('0x11')]=function(_0x49fff1,_0x2f2aab){this[_0x977c('0xf')]['getVariableById'](_0x49fff1)[_0x977c('0x12')](function(_0x66d7fe){_0x2f2aab(null,_0x66d7fe?_0x66d7fe['name']:![]);})[_0x977c('0x13')](function(_0x2796dd){_0x2f2aab(_0x2796dd);});};AGIVertices[_0x977c('0x14')][_0x977c('0x15')]=function(_0x12ba4f,_0x5bd514){this[_0x977c('0xf')][_0x977c('0x16')](_0x12ba4f)[_0x977c('0x12')](function(_0x4d1384){_0x5bd514(null,_0x4d1384?_0x4d1384['name']:![]);})[_0x977c('0x13')](function(_0x3f80cd){_0x5bd514(_0x3f80cd);});};AGIVertices[_0x977c('0x14')][_0x977c('0x17')]=function(_0x20f64f,_0x41ce0b){this[_0x977c('0xf')][_0x977c('0x18')](_0x20f64f)[_0x977c('0x12')](function(_0x4082ba){_0x41ce0b(null,_0x4082ba?_0x4082ba['name']:![]);})[_0x977c('0x13')](function(_0x1fa692){_0x41ce0b(_0x1fa692);});};AGIVertices[_0x977c('0x14')]['getSquareOdbc']=function(_0x6c6517,_0x95a640){this[_0x977c('0xf')]['getSquareOdbcById'](_0x6c6517)[_0x977c('0x12')](function(_0x41b2ff){_0x95a640(null,_0x41b2ff?_0x41b2ff[_0x977c('0x19')]:![]);})[_0x977c('0x13')](function(_0x301a84){_0x95a640(_0x301a84);});};AGIVertices[_0x977c('0x14')]['getUser']=function(_0x52a8d8,_0x5c4a17){this[_0x977c('0xf')][_0x977c('0x1a')](_0x52a8d8)[_0x977c('0x12')](function(_0x272de7){_0x5c4a17(null,_0x272de7?_0x272de7[_0x977c('0x1b')]:![]);})[_0x977c('0x13')](function(_0x7df701){_0x5c4a17(_0x7df701);});};AGIVertices['prototype'][_0x977c('0x1c')]=function(_0x5e4399,_0x59f8e2){this[_0x977c('0xf')]['getTrunkById'](_0x5e4399)['then'](function(_0x5d5af1){_0x59f8e2(null,_0x5d5af1?_0x5d5af1[_0x977c('0x1b')]:![]);})[_0x977c('0x13')](function(_0x361329){_0x59f8e2(_0x361329);});};AGIVertices[_0x977c('0x14')]['getSound']=function(_0x1beade,_0x473bde){var _0x11d11e=this;this[_0x977c('0xf')]['getSoundById'](_0x1beade)[_0x977c('0x12')](function(_0x1397fa){_0x473bde(null,_0x1397fa?_0x11d11e['getSoundPath'](_0x1397fa[_0x977c('0x1d')]):![]);})[_0x977c('0x13')](function(_0x53883f){_0x473bde(_0x53883f);});};AGIVertices[_0x977c('0x14')]['getMailAccount']=function(_0x39e809,_0x79dea4){this[_0x977c('0xf')][_0x977c('0x1e')](_0x39e809)[_0x977c('0x12')](function(_0x1ae395){_0x79dea4(null,_0x1ae395?_0x1ae395:![]);})[_0x977c('0x13')](function(_0x927b23){_0x79dea4(_0x927b23);});};AGIVertices['prototype'][_0x977c('0x1f')]=function(_0x355f1c,_0x50f1ba,_0x59762a){this[_0x977c('0x10')][_0x977c('0x1f')](_0x355f1c,_0x50f1ba)[_0x977c('0x12')](function(){_0x59762a(null);})[_0x977c('0x13')](function(_0x4ca98e){_0x59762a(_0x4ca98e);});};AGIVertices[_0x977c('0x14')]['getIntervals']=function(_0x151fdf,_0x97f37c){this['rpc']['getIntervalById'](_0x151fdf)[_0x977c('0x12')](function(_0x555dc1){if(_0x555dc1){if(_0x555dc1[_0x977c('0x20')]){_0x97f37c(null,[_0x555dc1[_0x977c('0x21')]]);}else{_0x97f37c(null,_['map'](_0x555dc1[_0x977c('0x22')],_0x977c('0x21')));}}else{_0x97f37c(null,![]);}})[_0x977c('0x13')](function(_0x44a288){_0x97f37c(_0x44a288);});};AGIVertices[_0x977c('0x14')][_0x977c('0x23')]=function(_0x191972){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0x191972);};AGIVertices[_0x977c('0x14')][_0x977c('0x24')]=function(_0x718af4,_0xc9aaf7,_0x2d9b16){odbc[_0x977c('0x25')](_0x718af4,function(_0x5330d3){if(_0x5330d3){logger[_0x977c('0x26')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x5330d3);_0x2d9b16(_0x5330d3);}else{logger[_0x977c('0x27')]('ODBC\x20connection\x20successfully');odbc[_0x977c('0x28')](_0xc9aaf7,function(_0x1e8229,_0x1beac0){if(_0x1e8229){logger['info'](_0x977c('0x29'),_0xc9aaf7);_0x2d9b16(_0x1e8229);}else{logger[_0x977c('0x27')](_0x977c('0x2a'),_0xc9aaf7);odbc[_0x977c('0x2b')](function(_0x3c7d35){if(_0x3c7d35){logger[_0x977c('0x26')](_0x977c('0x2c'),_0x3c7d35);}_0x2d9b16(null,_0x1beac0);});}});}});};AGIVertices[_0x977c('0x14')][_0x977c('0x2d')]=function(_0x5f3afa,_0x717cde){this[_0x977c('0xf')][_0x977c('0x2e')](_0x5f3afa)[_0x977c('0x12')](function(_0x124f28){_0x717cde(null,_0x124f28?_0x124f28:![]);})['catch'](function(_0x2bbd49){_0x717cde(_0x2bbd49);});};AGIVertices['prototype'][_0x977c('0x2f')]=function(_0x418a18,_0x2abe02){this['rpc']['createSmsMessage'](_0x418a18)[_0x977c('0x12')](function(_0x1c4c66){_0x2abe02(null,_0x1c4c66);})['catch'](function(_0x4423f6){_0x2abe02(_0x4423f6);});};AGIVertices[_0x977c('0x14')][_0x977c('0x30')]=function(_0x39d15f,_0x2114f0,_0x1a4fcc){this[_0x977c('0xf')][_0x977c('0x30')]({'uniqueid':this[_0x977c('0x31')]['uniqueid'],'node':_0x39d15f[_0x977c('0x32')],'application':_0x39d15f[_0x977c('0x33')],'data':_0x2114f0||null,'project_name':this[_0x977c('0x31')][_0x977c('0x34')],'callerid':this[_0x977c('0x31')]['callerid']})[_0x977c('0x12')](function(_0x53336d){if(_0x1a4fcc){_0x1a4fcc(null,_0x53336d);}})['catch'](function(_0x13b353){if(_0x1a4fcc){_0x1a4fcc(_0x13b353);}});};AGIVertices[_0x977c('0x14')][_0x977c('0x35')]=function(_0x2ac992,_0x1014a9,_0x23cb19,_0x5498cb){this[_0x977c('0xf')]['createSquareRecording']({'uniqueid':this[_0x977c('0x31')][_0x977c('0x36')],'callerid':this[_0x977c('0x31')][_0x977c('0x37')],'calleridname':this[_0x977c('0x31')][_0x977c('0x38')],'context':this['channel'][_0x977c('0x39')],'extension':this['channel']['extension'],'priority':this[_0x977c('0x31')]['priority'],'accountcode':this['channel'][_0x977c('0x3a')],'dnid':this[_0x977c('0x31')][_0x977c('0x3b')],'projectName':this[_0x977c('0x31')]['arg_1'],'saveName':_0x1014a9,'filename':_0x2ac992[_0x977c('0x3c')]||_0x1014a9,'savePath':_0x23cb19})['then'](function(_0x48d3b4){_0x5498cb(null,_0x48d3b4);})[_0x977c('0x13')](function(_0x294805){_0x5498cb(_0x294805);});};AGIVertices[_0x977c('0x14')][_0x977c('0x3d')]=function(_0x34b9fe,_0x1beaee,_0x26bda4){this[_0x977c('0xf')][_0x977c('0x3d')]({'uniqueid':this['channel'][_0x977c('0x36')],'body':_0x34b9fe,'direction':_0x1beaee})[_0x977c('0x12')](function(_0x48ba91){if(_0x26bda4){_0x26bda4(null,_0x48ba91);}})[_0x977c('0x13')](function(_0x39a401){if(_0x26bda4){_0x26bda4(_0x39a401);}});};AGIVertices[_0x977c('0x14')][_0x977c('0x3e')]=function(_0x4e5737,_0x22470a){this[_0x977c('0xf')][_0x977c('0x3e')]({'firstName':_['isEmpty'](_0x4e5737[_0x977c('0x1b')])||_[_0x977c('0x3f')](_0x4e5737[_0x977c('0x1b')])?_0x977c('0x40')+Math[_0x977c('0x41')]():_0x4e5737[_0x977c('0x1b')],'lastName':_[_0x977c('0x42')](_0x4e5737[_0x977c('0x43')])||_[_0x977c('0x3f')](_0x4e5737[_0x977c('0x43')])?null:_0x4e5737[_0x977c('0x43')],'phone':_0x4e5737[_0x977c('0x44')],'ListId':_0x4e5737[_0x977c('0x45')],'scheduledat':_0x4e5737[_0x977c('0x46')],'callbackUniqueid':this[_0x977c('0x31')][_0x977c('0x36')],'tags':'callback','description':_0x977c('0x47')+_0x4e5737[_0x977c('0x46')]['toString'](),'priority':_0x4e5737[_0x977c('0x48')]})['then'](function(_0x1b4545){_0x22470a(null,_0x1b4545);})['catch'](function(_0x886037){_0x22470a(_0x886037);});};AGIVertices[_0x977c('0x14')]['getPause']=function(_0x57a0e4,_0x5cc5eb){this[_0x977c('0xf')]['getPauseById'](_0x57a0e4)[_0x977c('0x12')](function(_0x1ed6bf){_0x5cc5eb(null,_0x1ed6bf?_0x1ed6bf[_0x977c('0x1b')]:![]);})['catch'](function(_0x9df184){_0x5cc5eb(_0x9df184);});};AGIVertices[_0x977c('0x14')][_0x977c('0x49')]=function(_0x51799d,_0x1c85da,_0x22cda3){var _0x24474b={'role':_0x977c('0x4a')};_0x24474b[_0x51799d]=this[_0x977c('0x31')][_0x977c('0x37')];this[_0x977c('0xf')][_0x977c('0x49')](_0x24474b,_0x1c85da,this['channel'][_0x977c('0x36')])[_0x977c('0x12')](function(_0x3581d3){_0x22cda3(null,_[_0x977c('0x3f')](_0x3581d3)?![]:!![]);})[_0x977c('0x13')](function(_0x57f8dd){logger[_0x977c('0x26')](_0x57f8dd);_0x22cda3(null,![]);});};AGIVertices[_0x977c('0x14')][_0x977c('0x4b')]=function(_0x1e7a69,_0x256d0c){var _0xdf5670={'role':_0x977c('0x4a')};_0xdf5670[_0x1e7a69]=this[_0x977c('0x31')][_0x977c('0x37')];this['rpc'][_0x977c('0x4b')](_0xdf5670)[_0x977c('0x12')](function(_0x639477){_0x256d0c(null,_[_0x977c('0x3f')](_0x639477)?![]:!![]);})[_0x977c('0x13')](function(_0x500978){logger[_0x977c('0x26')](_0x500978);_0x256d0c(null,![]);});};AGIVertices[_0x977c('0x14')][_0x977c('0x4c')]=function(_0xf7f9e1,_0xe731c){var _0x171b60={'role':_0x977c('0x4a')};_0x171b60[_0xf7f9e1]=this[_0x977c('0x31')][_0x977c('0x37')];this[_0x977c('0xf')][_0x977c('0x4c')](_0x171b60)[_0x977c('0x12')](function(_0xb74bbd){_0xe731c(null,_[_0x977c('0x3f')](_0xb74bbd)?![]:!![]);})[_0x977c('0x13')](function(_0xa2631b){logger[_0x977c('0x26')](_0xa2631b);_0xe731c(null,![]);});};AGIVertices[_0x977c('0x14')][_0x977c('0x4d')]=function(_0x38d751,_0x7cff56){var _0x7c6524={'role':'agent'};_0x7c6524[_0x38d751]=this[_0x977c('0x31')][_0x977c('0x37')];var _0x586664=_0x38d751!=_0x977c('0x4e')?util[_0x977c('0x4f')]('%s/%s@from-sip/n',_0x977c('0x50'),this['channel']['callerid']):undefined;this[_0x977c('0xf')][_0x977c('0x4d')](_0x7c6524,_0x586664)[_0x977c('0x12')](function(_0x301099){_0x7cff56(null,_[_0x977c('0x3f')](_0x301099)?![]:!![]);})[_0x977c('0x13')](function(_0x2de58c){logger[_0x977c('0x26')](_0x2de58c);_0x7cff56(null,![]);});};AGIVertices['prototype'][_0x977c('0x51')]=function(_0x3f2f02,_0x332432){sh[_0x977c('0x52')](_[_0x977c('0x53')](_0x3f2f02),function(_0x348f44,_0x2bdb81){var _0x11d9c1=_0x2bdb81[_0x977c('0x54')](/(\r\n|\n|\r)/gm,'');_0x332432(null,_0x11d9c1);});};AGIVertices[_0x977c('0x14')]['googleCloudTTS']=function(_0x247c36,_0x35fd6a){scripts[_0x977c('0x55')](_0x247c36['apiKey'],_0x247c36[_0x977c('0x56')]||_0x977c('0x57'),_0x247c36[_0x977c('0x57')],_0x247c36[_0x977c('0x58')]||'en-US',_0x247c36[_0x977c('0x59')]||'MALE',_0x247c36['audioEncoding']||_0x977c('0x5a'))['then'](function(_0xe1cb4b){_0x35fd6a(null,_0xe1cb4b);})['catch'](function(_0x3cbaa8){_0x35fd6a(_0x3cbaa8);});};AGIVertices['prototype'][_0x977c('0x5b')]=function(_0x39b321,_0x128385){scripts[_0x977c('0x5b')](_0x39b321[_0x977c('0x57')],_0x39b321['google_tts_language']||'en',0x1)['then'](function(_0x1df84b){_0x128385(null,_0x1df84b);})[_0x977c('0x13')](function(_0x14c785){_0x128385(_0x14c785);});};AGIVertices[_0x977c('0x14')][_0x977c('0x5c')]=function(_0x5ba237,_0x580610){var _0xc05d2e={'uri':_0x5ba237['url'],'method':_0x5ba237[_0x977c('0x5d')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5ba237[_0x977c('0x5e')])===_0x977c('0x5f')&&parseInt(_0x5ba237[_0x977c('0x5e')])>=0x1?parseInt(_0x5ba237['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x977c('0x60')](['POST','PUT'],_0xc05d2e[_0x977c('0x5d')][_0x977c('0x61')]())){try{_0xc05d2e[_0x977c('0x62')]=_0x5ba237['rawBody']?JSON[_0x977c('0x63')](_0x5ba237['rawBody']):{};}catch(_0x121f21){logger[_0x977c('0x26')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x121f21);}}try{_0xc05d2e['headers']=_0x5ba237[_0x977c('0xa')]?JSON[_0x977c('0x63')](_0x5ba237[_0x977c('0xa')]):{};}catch(_0x49e585){logger[_0x977c('0x26')](_0x977c('0x64'),_0x49e585);}if(_0x5ba237[_0x977c('0x65')]){try{var _0x34471c=require(_0x5ba237[_0x977c('0x65')])[_0x977c('0x66')](this,_0xc05d2e);_0xc05d2e['uri']=Mustache['render'](_0x5ba237[_0x977c('0x67')],_0x34471c,{},['$$','$$']);if(_0xc05d2e['headers']){_0xc05d2e[_0x977c('0x68')]=JSON[_0x977c('0x63')](Mustache[_0x977c('0x69')](JSON[_0x977c('0x6a')](_0xc05d2e[_0x977c('0x68')]),_0x34471c,{},['$$','$$']));}if(_0xc05d2e[_0x977c('0x62')]){_0xc05d2e[_0x977c('0x62')]=JSON[_0x977c('0x63')](Mustache['render'](JSON[_0x977c('0x6a')](_0xc05d2e['body']),_0x34471c,{},['$$','$$']));}}catch(_0x31e479){logger[_0x977c('0x26')](_0x977c('0x6b'),_0x31e479);}}rp(_0xc05d2e)['then'](function(_0x4f40fa){var _0x451232={'statusCode':_0x4f40fa['statusCode']||0xc8,'statusMessage':_0x4f40fa[_0x977c('0x6c')]||'OK','headers':_0x4f40fa[_0x977c('0x68')]||{},'body':_0x4f40fa[_0x977c('0x62')]||{}};_0x580610(null,_0x451232);})[_0x977c('0x13')](function(_0x1637db){var _0x3d02ac={'statusCode':_0x1637db[_0x977c('0x6d')]||0x1f4,'statusMessage':_0x1637db[_0x977c('0x6e')]||_0x977c('0x6f'),'headers':_0x1637db['options']['headers']||{},'body':_0x1637db[_0x977c('0x70')]['body']||{}};_0x580610(null,_0x3d02ac);});};AGIVertices[_0x977c('0x14')][_0x977c('0x71')]=function(_0x569ed5,_0x28a1de){scripts[_0x977c('0x71')](this[_0x977c('0x31')][_0x977c('0x36')],_0x569ed5[_0x977c('0x72')],_0x569ed5[_0x977c('0x57')],_0x569ed5[_0x977c('0x73')]||'en')['then'](function(_0x456944){_0x28a1de(null,_0x456944);})[_0x977c('0x13')](function(_0x2a09c1){_0x28a1de(_0x2a09c1);});};AGIVertices['prototype']['sestekNDA']=function(_0x107c00,_0x124792){scripts[_0x977c('0x74')](this[_0x977c('0x31')],_0x107c00)['then'](function(_0x45385f){_0x124792(null,_0x45385f);})[_0x977c('0x13')](function(_0x3fb1b9){_0x124792(_0x3fb1b9);});};AGIVertices[_0x977c('0x14')]['ispeechTTS']=function(_0x424bbe,_0x7be3cc){scripts['ispeechTTS'](_0x424bbe['key'],_0x424bbe[_0x977c('0x57')],_0x424bbe[_0x977c('0x75')]||_0x977c('0x76'),_0x424bbe['speed'])['then'](function(_0x1b7aab){_0x7be3cc(null,_0x1b7aab);})[_0x977c('0x13')](function(_0xc2ca14){_0x7be3cc(_0xc2ca14);});};AGIVertices[_0x977c('0x14')][_0x977c('0x77')]=function(_0x40f042,_0x315c6d,_0x5db37b){scripts['ispeechASR'](_0x315c6d,_0x40f042[_0x977c('0x72')],_0x40f042[_0x977c('0x78')]||'en-US',this['isConfigured'](_0x40f042[_0x977c('0x79')])?_0x40f042[_0x977c('0x79')]:undefined)[_0x977c('0x12')](function(_0x51eabb){_0x5db37b(null,_0x51eabb);})[_0x977c('0x13')](function(_0x1ac529){_0x5db37b(_0x1ac529);});};AGIVertices['prototype'][_0x977c('0x7a')]=function(_0x5bf6f7,_0x541789){scripts[_0x977c('0x7a')](_0x5bf6f7[_0x977c('0x7b')],_0x5bf6f7['aws_secret_access_key'],_0x5bf6f7[_0x977c('0x7c')],_0x5bf6f7[_0x977c('0x7d')]||_0x977c('0x7e'),_0x5bf6f7['text'],_0x5bf6f7[_0x977c('0x7f')]||_0x977c('0x57'))['then'](function(_0x1985c0){_0x541789(null,_0x1985c0);})[_0x977c('0x13')](function(_0x393b47){_0x541789(_0x393b47);});};AGIVertices[_0x977c('0x14')][_0x977c('0x80')]=function(_0x5db0bc,_0xd071a6){scripts[_0x977c('0x80')](this[_0x977c('0x31')]['uniqueid'],_0x5db0bc['aws_access_key_id'],_0x5db0bc['aws_secret_access_key'],_0x5db0bc[_0x977c('0x81')],_0x5db0bc['text'],_0x5db0bc[_0x977c('0x82')])[_0x977c('0x12')](function(_0x36c5c4){_0xd071a6(null,_0x36c5c4);})['catch'](function(_0x26cffa){_0xd071a6(_0x26cffa);});};AGIVertices[_0x977c('0x14')][_0x977c('0x83')]=function(_0x245322,_0x3e52a6,_0x14e601){scripts['googleASR'](_0x3e52a6,_0x245322[_0x977c('0x72')],_0x245322[_0x977c('0x84')]||_0x977c('0x76'))[_0x977c('0x12')](function(_0x1f4a26){_0x14e601(null,_0x1f4a26);})[_0x977c('0x13')](function(_0x2b3a5b){_0x14e601(_0x2b3a5b);});};AGIVertices[_0x977c('0x14')][_0x977c('0x85')]=function(_0x35d4d9,_0x2cb8b0,_0x45b875){scripts[_0x977c('0x85')](_0x2cb8b0,_0x35d4d9['appid'],_0x35d4d9[_0x977c('0x86')],_0x35d4d9[_0x977c('0x87')])[_0x977c('0x12')](function(_0x3d2bb2){_0x45b875(null,_0x3d2bb2);})[_0x977c('0x13')](function(_0x5e57ba){_0x45b875(_0x5e57ba);});};AGIVertices[_0x977c('0x14')][_0x977c('0x88')]=function(_0x3d601e){var _0x73e6c7=_[_0x977c('0x60')](verticesWithRetry,_0x3d601e['agicommand'])?_0x3d601e:_['clone'](_0x3d601e);for(var _0x435ce5 in _0x73e6c7){if(_0x73e6c7[_0x977c('0x89')](_0x435ce5)){if(_0x73e6c7[_0x435ce5]&&_['isString'](_0x73e6c7[_0x435ce5])){if(_[_0x977c('0x60')](recursiveMapAttributes,_0x435ce5)){_0x73e6c7[_0x435ce5]=this['replaceObjectAllVariables'](_0x73e6c7[_0x435ce5]);}else{_0x73e6c7[_0x435ce5]=this[_0x977c('0x8a')](_0x73e6c7[_0x435ce5]);}}}}return _0x73e6c7;};AGIVertices[_0x977c('0x14')][_0x977c('0x8b')]=function(_0x4abb4b){for(var _0x4344e3 in _0x4abb4b){if(_0x4abb4b['hasOwnProperty'](_0x4344e3)){if(_[_0x977c('0x8c')](_0x4abb4b[_0x4344e3])){this[_0x977c('0x8b')](_0x4abb4b[_0x4344e3]);}else if(_[_0x977c('0x8d')](_0x4abb4b[_0x4344e3])){for(var _0x5cc777=0x0;_0x5cc777<_0x4abb4b[_0x4344e3]['length'];_0x5cc777++){this[_0x977c('0x8b')](_0x4abb4b[_0x4344e3][_0x5cc777]);}}else if(_[_0x977c('0x8e')](_0x4abb4b[_0x4344e3])){_0x4abb4b[_0x4344e3]=this[_0x977c('0x8a')](_0x4abb4b[_0x4344e3]);}}}};AGIVertices[_0x977c('0x14')][_0x977c('0x8f')]=function(_0x19a3a5,_0x23c613){for(var _0x480a2a in _0x19a3a5){if(_0x19a3a5[_0x977c('0x89')](_0x480a2a)){if(_[_0x977c('0x8c')](_0x19a3a5[_0x480a2a])){if(!_['isEmpty'](_0x19a3a5[_0x480a2a])){this['saveRestApiResult'](_0x19a3a5[_0x480a2a],util[_0x977c('0x4f')](_0x977c('0x90'),_0x23c613,_0x480a2a));}}else if(_[_0x977c('0x8d')](_0x19a3a5[_0x480a2a])){for(var _0x501f3f=0x0;_0x501f3f<_0x19a3a5[_0x480a2a]['length'];_0x501f3f++){this[_0x977c('0x8f')](_0x19a3a5[_0x480a2a][_0x501f3f],util[_0x977c('0x4f')](_0x977c('0x90'),_0x23c613,_0x480a2a+'['+_0x501f3f+']'));}}else{if(!_[_0x977c('0x3f')](_0x19a3a5[_0x480a2a])){this[_0x977c('0x31')][_0x977c('0x91')](util[_0x977c('0x4f')](_0x977c('0x90'),_0x23c613,_0x480a2a),_0x19a3a5[_0x480a2a]);}}}}};AGIVertices[_0x977c('0x14')]['replaceObjectAllVariables']=function(_0x3c02b2){try{var _0x56c847=JSON[_0x977c('0x63')](_0x3c02b2);this[_0x977c('0x8b')](_0x56c847);return JSON[_0x977c('0x6a')](_0x56c847);}catch(_0x573c52){return this[_0x977c('0x8a')](_0x3c02b2);}};AGIVertices['prototype']['replaceAllVariables']=function(_0x378900){var _0x40ce08=_0x378900[_0x977c('0x92')]('{');for(var _0x2cec98=0x1;_0x2cec98<_0x40ce08[_0x977c('0x93')];_0x2cec98+=0x1){var _0x42597e=_0x40ce08[_0x2cec98][_0x977c('0x92')]('}');if(_0x42597e[_0x977c('0x93')]>0x1){_0x378900=_0x378900[_0x977c('0x94')]('{'+_0x42597e[0x0]+'}',this[_0x977c('0x31')][_0x977c('0x11')](_0x42597e[0x0])[_0x977c('0x95')]||_0x42597e[0x0]);}}if(_0x40ce08['length']===0x1){return _0x378900[_0x977c('0x96')]();}return this[_0x977c('0x8a')](_0x378900);};AGIVertices[_0x977c('0x14')][_0x977c('0x97')]=function(_0x33340d,_0x19aee3){var _0x454299=this[_0x977c('0x31')][_0x977c('0x11')](_0x33340d);if(_0x454299['result']===-0x1){return _0x454299;}logger[_0x977c('0x27')](util[_0x977c('0x4f')](_0x977c('0x98'),_0x19aee3,_0x454299['extra']));return this[_0x977c('0x31')]['setVariable'](_0x19aee3,_0x454299[_0x977c('0x95')]);};AGIVertices[_0x977c('0x14')]['isConfigured']=function(_0x29805f){return _0x29805f&&_0x29805f!=='0'&&_0x29805f!=='-1'&&_0x29805f!=='';};AGIVertices[_0x977c('0x14')]['maxRetry']=function(_0x4c4943){this[_0x977c('0x30')][_0x977c('0x66')](this,_0x4c4943,'-');_0x4c4943[_0x977c('0x99')]=_0x4c4943['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x977c('0x14')][_0x977c('0x9a')]=function(_0x3cbb2a){logger[_0x977c('0x27')](util[_0x977c('0x4f')](_0x977c('0x9b'),_0x3cbb2a[_0x977c('0x32')]));if(!this[_0x977c('0x9c')](_0x3cbb2a[_0x977c('0x57')])){return this[_0x977c('0x31')]['noop'](_0x977c('0x9d'));}var _0x59f62f='\x22'+_0x3cbb2a[_0x977c('0x57')]+'\x22';if(this['isConfigured'](_0x3cbb2a['options'])){_0x59f62f+=','+_0x3cbb2a[_0x977c('0x70')];}var _0x539a7d=this[_0x977c('0x31')][_0x977c('0x52')](_0x977c('0x9e'),_0x59f62f);if(_0x539a7d[_0x977c('0x9f')]===-0x1){return _0x539a7d;}return this[_0x977c('0x31')][_0x977c('0xa0')](util[_0x977c('0x4f')]('Executed\x20command\x20MRCPSynth\x20%s',_0x59f62f));};AGIVertices['prototype'][_0x977c('0xa1')]=function(_0x5a842d){logger[_0x977c('0x27')](util[_0x977c('0x4f')](_0x977c('0xa2'),_0x5a842d[_0x977c('0x32')]));if(!this[_0x977c('0x9c')](_0x5a842d[_0x977c('0xa3')])){return this[_0x977c('0x31')][_0x977c('0xa0')]('no\x20grammar\x20configured');}var _0x25aa3a=_0x5a842d[_0x977c('0xa3')];if(this[_0x977c('0x9c')](_0x5a842d['options'])){_0x25aa3a+=','+_0x5a842d[_0x977c('0x70')];}var _0x52b722=this['channel'][_0x977c('0x52')]('MRCPRecog',_0x25aa3a);if(_0x52b722[_0x977c('0x9f')]===-0x1){return _0x52b722;}var _0x1cea99=this[_0x977c('0x97')](_0x977c('0xa4'),_0x977c('0xa5'));if(_0x1cea99[_0x977c('0x9f')]===-0x1){return _0x1cea99;}var _0x2202b7=this[_0x977c('0x97')](_0x977c('0xa6'),'MRCP_RECOG_TRANSCRIPT');if(_0x2202b7[_0x977c('0x9f')]===-0x1){return _0x2202b7;}var _0x2c31f1=this[_0x977c('0x97')](_0x977c('0xa7'),_0x977c('0xa8'));if(_0x2c31f1[_0x977c('0x9f')]===-0x1){return _0x2c31f1;}return this['channel'][_0x977c('0xa0')](util[_0x977c('0x4f')](_0x977c('0xa9'),_0x25aa3a));};AGIVertices['prototype'][_0x977c('0xaa')]=function(_0xb24d6){logger[_0x977c('0x27')](util[_0x977c('0x4f')](_0x977c('0xab'),_0xb24d6[_0x977c('0x32')]));return this['channel'][_0x977c('0xaa')]([_0xb24d6[_0x977c('0xac')],_0xb24d6[_0x977c('0xad')]]);};AGIVertices[_0x977c('0x14')][_0x977c('0xae')]=function(_0x89789e){logger['info'](util[_0x977c('0x4f')](_0x977c('0xaf'),_0x89789e['label']));if(this['isConfigured'](_0x89789e[_0x977c('0x5e')])){logger[_0x977c('0x27')](util['format']('Wait\x20%s\x20seconds\x20before\x20answer',_0x89789e[_0x977c('0x5e')]));var _0x40333a=this[_0x977c('0x31')][_0x977c('0xb0')](_0x89789e[_0x977c('0x5e')]);if(_0x40333a['result']===-0x1){return _0x40333a;}}return this['channel'][_0x977c('0xae')]();};AGIVertices[_0x977c('0x14')][_0x977c('0xb1')]=function(_0x500b2e){logger[_0x977c('0x27')](util[_0x977c('0x4f')](_0x977c('0xb2'),_0x500b2e['label']));if(!this['isConfigured'](_0x500b2e[_0x977c('0x45')])){return this[_0x977c('0x31')]['error'](_0x500b2e,'no\x20list\x20selected');}_0x500b2e[_0x977c('0x46')]=moment();if(this['isConfigured'](_0x500b2e[_0x977c('0xb3')])){_0x500b2e[_0x977c('0x46')]=moment()['add'](_0x500b2e['delay'],_0x977c('0xb4'));}if(!this[_0x977c('0x9c')](_0x500b2e['callback_priority'])){_0x500b2e['callback_priority']=0x2;}this['createCmContact']['sync'](this,_0x500b2e);return this[_0x977c('0x31')]['noop'](util[_0x977c('0x4f')](_0x977c('0xb5'),_0x500b2e[_0x977c('0x44')],_0x500b2e[_0x977c('0x45')],_0x500b2e[_0x977c('0x46')]));};AGIVertices['prototype'][_0x977c('0xb6')]=function(_0x2da95e){logger['info'](util[_0x977c('0x4f')](_0x977c('0xb7'),_0x2da95e[_0x977c('0x32')]));var _0x772915=this[_0x977c('0x31')]['exec'](_0x2da95e[_0x977c('0xb8')],_0x2da95e['options']);if(_0x772915[_0x977c('0x9f')]===-0x1){return _0x772915;}return this[_0x977c('0x31')]['noop'](util[_0x977c('0x4f')](_0x977c('0xb9'),_0x2da95e['application'],_0x2da95e['options']));};AGIVertices[_0x977c('0x14')][_0x977c('0xba')]=function(_0x8089fc){logger[_0x977c('0x27')](util[_0x977c('0x4f')](_0x977c('0xbb'),_0x8089fc[_0x977c('0x32')]));if(!this['isConfigured'](_0x8089fc['text'])){return this['channel']['noop'](_0x977c('0x9d'));}var _0x357e88='\x22'+_0x8089fc[_0x977c('0x57')]+'\x22';if(this[_0x977c('0x9c')](_0x8089fc[_0x977c('0x70')])){_0x357e88+=','+_0x8089fc[_0x977c('0x70')];}var _0x4bf03b=this['channel']['exec'](_0x977c('0x9e'),_0x357e88);if(_0x4bf03b[_0x977c('0x9f')]===-0x1){return _0x4bf03b;}return this[_0x977c('0x31')][_0x977c('0xa0')](util[_0x977c('0x4f')]('Executed\x20command\x20MRCPSynth\x20%s',_0x357e88));};AGIVertices[_0x977c('0x14')]['sestektts']=function(_0x260ae6){logger[_0x977c('0x27')](util[_0x977c('0x4f')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x260ae6[_0x977c('0x32')]));if(!this['isConfigured'](_0x260ae6[_0x977c('0x57')])){return this[_0x977c('0x31')][_0x977c('0xa0')]('no\x20text\x20configured');}var _0x370ad7='\x22'+_0x260ae6['text']+'\x22';if(this[_0x977c('0x9c')](_0x260ae6[_0x977c('0x70')])){_0x370ad7+=','+_0x260ae6[_0x977c('0x70')];}var _0x2a2085=this[_0x977c('0x31')][_0x977c('0x52')](_0x977c('0x9e'),_0x370ad7);if(_0x2a2085[_0x977c('0x9f')]===-0x1){return _0x2a2085;}return this[_0x977c('0x31')][_0x977c('0xa0')](util[_0x977c('0x4f')]('Executed\x20command\x20MRCPSynth\x20%s',_0x370ad7));};AGIVertices['prototype']['lumenvoxasr']=function(_0x114136){logger[_0x977c('0x27')](util[_0x977c('0x4f')](_0x977c('0xbc'),_0x114136[_0x977c('0x32')]));if(!this['isConfigured'](_0x114136[_0x977c('0xa3')])){return this['channel'][_0x977c('0xa0')](_0x977c('0xbd'));}var _0x28b2d0=_0x114136['grammar'];if(this[_0x977c('0x9c')](_0x114136[_0x977c('0x70')])){_0x28b2d0+=','+_0x114136[_0x977c('0x70')];}var _0x22ef6b=this[_0x977c('0x31')][_0x977c('0x52')](_0x977c('0xbe'),_0x28b2d0);if(_0x22ef6b['result']===-0x1){return _0x22ef6b;}var _0x2485ff=this[_0x977c('0x97')](_0x977c('0xa4'),'LUMENVOX_ASR_CONFIDENCE');if(_0x2485ff[_0x977c('0x9f')]===-0x1){return _0x2485ff;}var _0xebbb12=this['getAndSetVariable'](_0x977c('0xa6'),_0x977c('0xbf'));if(_0xebbb12['result']===-0x1){return _0xebbb12;}var _0x42828b=this[_0x977c('0x97')]('RECOG_INSTANCE()',_0x977c('0xc0'));if(_0x42828b[_0x977c('0x9f')]===-0x1){return _0x42828b;}return this[_0x977c('0x31')][_0x977c('0xa0')](util['format'](_0x977c('0xa9'),_0x28b2d0));};AGIVertices[_0x977c('0x14')][_0x977c('0xc1')]=function(_0x3451f0){logger[_0x977c('0x27')](util[_0x977c('0x4f')](_0x977c('0xc2'),_0x3451f0['label']));if(!this[_0x977c('0x9c')](_0x3451f0['grammar'])){return this[_0x977c('0x31')][_0x977c('0xa0')](_0x977c('0xbd'));}var _0xfeda4d=_0x3451f0['grammar'];if(this['isConfigured'](_0x3451f0[_0x977c('0x70')])){_0xfeda4d+=','+_0x3451f0['options'];}var _0x5ec066=this[_0x977c('0x31')][_0x977c('0x52')](_0x977c('0xbe'),_0xfeda4d);if(_0x5ec066[_0x977c('0x9f')]===-0x1){return _0x5ec066;}var _0x4a715e=this[_0x977c('0x97')]('RECOG_CONFIDENCE()',_0x977c('0xc3'));if(_0x4a715e[_0x977c('0x9f')]===-0x1){return _0x4a715e;}var _0xed496a=this[_0x977c('0x97')]('RECOG_INPUT()',_0x977c('0xc4'));if(_0xed496a[_0x977c('0x9f')]===-0x1){return _0xed496a;}var _0x489c9f=this['getAndSetVariable'](_0x977c('0xa7'),_0x977c('0xc5'));if(_0x489c9f[_0x977c('0x9f')]===-0x1){return _0x489c9f;}return this['channel'][_0x977c('0xa0')](util[_0x977c('0x4f')]('Executed\x20command\x20MRCPRecog\x20%s',_0xfeda4d));};AGIVertices[_0x977c('0x14')][_0x977c('0xc6')]=function(_0x342912){logger[_0x977c('0x27')](util[_0x977c('0x4f')](_0x977c('0xc7'),_0x342912[_0x977c('0x32')]));if(!this[_0x977c('0x9c')](_0x342912[_0x977c('0xc8')])){return this[_0x977c('0x31')]['error'](_0x342912,_0x977c('0xc9'));}var _0x11988e=this[_0x977c('0xca')]['sync'](this,_0x342912[_0x977c('0xc8')]);if(!_0x11988e){return this[_0x977c('0x31')][_0x977c('0x26')](_0x342912,_0x977c('0xcb'));}if(!this[_0x977c('0x9c')](_0x342912[_0x977c('0x28')])){return this[_0x977c('0x31')]['error'](_0x342912,'no\x20query\x20configured');}var _0x4c5e02=_0x342912[_0x977c('0x28')][_0x977c('0x54')](/(\r\n|\n|\r)/gm,'\x20');this[_0x977c('0x31')]['noop'](util['format']('query:\x20%s',_0x4c5e02));var _0x3e5711=this[_0x977c('0x24')][_0x977c('0x66')](this,_0x11988e,_0x4c5e02);this[_0x977c('0x30')][_0x977c('0x66')](this,_0x342912,_0x4c5e02);if(!this[_0x977c('0x9c')](_0x342912[_0x977c('0xcc')])){return this[_0x977c('0x31')][_0x977c('0xa0')](_0x977c('0xcd'));}var _0x5bd35b=this[_0x977c('0x11')][_0x977c('0x66')](this,_0x342912[_0x977c('0xcc')]);if(!_0x5bd35b){return this[_0x977c('0x31')][_0x977c('0x26')](_0x342912,_0x977c('0xce'));}var _0x38584b=this;_0x3e5711['forEach'](function(_0x1618a2,_0x315588){Object[_0x977c('0xcf')](_0x1618a2)['forEach'](function(_0x4744b9){_0x38584b[_0x977c('0x31')]['setVariable'](util[_0x977c('0x4f')](_0x977c('0xd0'),_0x5bd35b,_0x315588,_0x4744b9),_0x1618a2[_0x4744b9]);});});this[_0x977c('0x31')]['setVariable'](util[_0x977c('0x4f')](_0x977c('0xd1'),_0x5bd35b),_0x3e5711[_0x977c('0x93')]);return this[_0x977c('0x31')][_0x977c('0xa0')](util[_0x977c('0x4f')]('variable\x20%s\x20set',_0x5bd35b));};AGIVertices['prototype'][_0x977c('0xd2')]=function(_0x52c499){logger['debug'](util['format'](_0x977c('0xd3'),_0x52c499[_0x977c('0x32')]));if(!this[_0x977c('0x9c')](_0x52c499[_0x977c('0xd4')])){return this['channel']['error'](_0x52c499,_0x977c('0xd5'));}var _0xf22791=this[_0x977c('0xd6')][_0x977c('0x66')](this,_0x52c499[_0x977c('0xd4')]);if(!_0xf22791){return this[_0x977c('0x31')][_0x977c('0x26')](_0x52c499,'no\x20user\x20found');}var _0x2ef241=this[_0x977c('0x31')][_0x977c('0x52')](_0x977c('0xd7'),[util[_0x977c('0x4f')](_0x977c('0xd8'),_0xf22791),_0x52c499[_0x977c('0x5e')],_0x52c499[_0x977c('0xd9')],_0x52c499['url']]);if(_0x2ef241[_0x977c('0x9f')]===-0x1){return _0x2ef241;}return this[_0x977c('0x31')][_0x977c('0xa0')](util[_0x977c('0x4f')]('Executed\x20command\x20%s',_0x977c('0xd7')));};AGIVertices[_0x977c('0x14')]['dialogflow']=function(_0x11f7d7){logger['info'](util[_0x977c('0x4f')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x11f7d7['label']));if(!this[_0x977c('0x9c')](_0x11f7d7[_0x977c('0x72')])){return this[_0x977c('0x31')][_0x977c('0xa0')](_0x977c('0xda'));}if(!this[_0x977c('0x9c')](_0x11f7d7['text'])){return this[_0x977c('0x31')][_0x977c('0xa0')](_0x977c('0x9d'));}this[_0x977c('0x31')][_0x977c('0xdb')]=!![];this[_0x977c('0x30')](_0x11f7d7);this[_0x977c('0x3d')](_0x11f7d7[_0x977c('0x57')],'in');this['channel']['noop'](util[_0x977c('0x4f')](_0x977c('0xdc'),_0x11f7d7[_0x977c('0x57')]));var _0x16536b=this[_0x977c('0x71')]['sync'](this,_0x11f7d7);if(_0x16536b){for(var _0x491e1a in _0x16536b){if(_0x16536b[_0x977c('0x89')](_0x491e1a)){this[_0x977c('0x31')][_0x977c('0x91')](util['format'](_0x977c('0xdd'),_0x491e1a[_0x977c('0x61')]()),_0x16536b[_0x491e1a]);}}this[_0x977c('0x3d')](_0x16536b[_0x977c('0xde')],_0x977c('0xdf'));return this[_0x977c('0x31')][_0x977c('0xa0')](util[_0x977c('0x4f')]('Dialogflow\x20Result\x20%s',_0x16536b[_0x977c('0xde')]));}return this[_0x977c('0x31')][_0x977c('0x26')](_0x11f7d7,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x977c('0x14')][_0x977c('0xe0')]=function(_0x260a7d){logger[_0x977c('0x27')](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x260a7d[_0x977c('0x32')]));if(!this[_0x977c('0x9c')](_0x260a7d[_0x977c('0xe1')])){return this['channel'][_0x977c('0xa0')](_0x977c('0xe2'));}if(!this[_0x977c('0x9c')](_0x260a7d['username'])){return this[_0x977c('0x31')][_0x977c('0xa0')]('no\x20username\x20configured');}if(!this[_0x977c('0x9c')](_0x260a7d[_0x977c('0xe3')])){return this[_0x977c('0x31')]['noop'](_0x977c('0xe4'));}if(!this[_0x977c('0x9c')](_0x260a7d[_0x977c('0xe5')])){return this[_0x977c('0x31')][_0x977c('0xa0')](_0x977c('0x9d'));}this[_0x977c('0x31')][_0x977c('0xdb')]=!![];this['createSquareDetailsReport'](_0x260a7d);this[_0x977c('0x3d')](_0x260a7d[_0x977c('0x57')],'in');this[_0x977c('0x31')][_0x977c('0xa0')](util[_0x977c('0x4f')](_0x977c('0xe6'),_0x260a7d['text']));var _0x4567a2=this[_0x977c('0x74')][_0x977c('0x66')](this,_0x260a7d);if(_0x4567a2){for(var _0x227694 in _0x4567a2){if(_0x4567a2[_0x977c('0x89')](_0x227694)){this[_0x977c('0x31')][_0x977c('0x91')](util['format']('SESTEK_NDA_%s',_0x227694[_0x977c('0x61')]()),_0x4567a2[_0x227694]);}}this[_0x977c('0x3d')](_0x4567a2[_0x977c('0xde')],_0x977c('0xdf'));if(_0x4567a2[_0x977c('0xe7')]){this[_0x977c('0x31')]['noop'](util[_0x977c('0x4f')](_0x977c('0xe8'),_0x4567a2['audiofile']));var _0x100beb=this[_0x977c('0x31')][_0x977c('0xe9')](_0x4567a2[_0x977c('0xe7')]);try{fs[_0x977c('0xea')](_0x4567a2[_0x977c('0xe7')]+_0x977c('0xeb'));}catch(_0x159862){logger[_0x977c('0x26')](_0x159862);}return _0x100beb;}else{return this[_0x977c('0x31')]['noop'](util['format'](_0x977c('0xec'),_0x4567a2[_0x977c('0xde')]));}}return this['channel'][_0x977c('0x26')](_0x260a7d,_0x977c('0xed'));};AGIVertices['prototype'][_0x977c('0xee')]=function(_0x31229e){logger['info'](util[_0x977c('0x4f')](_0x977c('0xef'),_0x31229e[_0x977c('0x32')]));return this[_0x977c('0x31')]['noop'](_0x977c('0xee'));};AGIVertices[_0x977c('0x14')][_0x977c('0xf0')]=function(_0xa52377){logger[_0x977c('0x27')](util[_0x977c('0x4f')](_0x977c('0xf1'),_0xa52377['label']));var _0x3bf45f='';if(_0xa52377[_0x977c('0xf2')]){if(!this[_0x977c('0x9c')](_0xa52377[_0x977c('0xf2')])){return this['channel'][_0x977c('0x26')](_0xa52377,_0x977c('0xf3'));}else{var _0x2cf857=parseInt(_0xa52377['trunk_id'],0xa);if(isNaN(_0x2cf857)){_0x3bf45f=_0xa52377[_0x977c('0xf2')];}else{_0x3bf45f=this[_0x977c('0x1c')][_0x977c('0x66')](this,_0xa52377[_0x977c('0xf2')]);if(!_0x3bf45f){return this[_0x977c('0x31')][_0x977c('0x26')](_0xa52377,_0x977c('0xf4'));}}}}else if(_0xa52377[_0x977c('0xf5')]){_0x3bf45f=_0xa52377[_0x977c('0xf5')];}else{return this[_0x977c('0x31')][_0x977c('0x26')](_0xa52377,_0x977c('0xf3'));}var _0x549311=this[_0x977c('0x31')]['exec'](_0x977c('0xd7'),[util[_0x977c('0x4f')](_0x977c('0xf6'),_0x3bf45f,_0xa52377[_0x977c('0x44')]),_0xa52377[_0x977c('0x5e')],_0xa52377['opts'],_0xa52377['url']]);if(_0x549311[_0x977c('0x9f')]===-0x1){return _0x549311;}return this[_0x977c('0x31')][_0x977c('0xa0')](util[_0x977c('0x4f')](_0x977c('0xf7'),_0x977c('0xd7')));};AGIVertices['prototype']['finally']=function(_0x1d96dc){logger['info'](util[_0x977c('0x4f')](_0x977c('0xf8'),_0x1d96dc['label']));return this[_0x977c('0x31')][_0x977c('0xa0')]('finally');};AGIVertices[_0x977c('0x14')][_0x977c('0xd')]=function(_0x2c38c7){logger['info'](util[_0x977c('0x4f')](_0x977c('0xf9'),_0x2c38c7['label']));if(_0x2c38c7[_0x977c('0x99')]===0x0){return this[_0x977c('0xfa')](_0x2c38c7);}_0x2c38c7[_0x977c('0x99')]-=0x1;if(!this[_0x977c('0x9c')](_0x2c38c7['file_id'])){return this['channel'][_0x977c('0x26')](_0x2c38c7,_0x977c('0xfb'));}var _0x1a6b27=this['getSound'][_0x977c('0x66')](this,_0x2c38c7['file_id']);if(!_0x1a6b27){return this[_0x977c('0x31')]['error'](_0x2c38c7,'no\x20file\x20audio\x20found');}if(!this[_0x977c('0x9c')](_0x2c38c7['variable_id'])){return this[_0x977c('0x31')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x44c14d=this[_0x977c('0x31')][_0x977c('0xfc')](_0x1a6b27,_0x2c38c7[_0x977c('0xfd')],_0x2c38c7['maxdigit']);var _0x5e6eef=_0x44c14d['result']?_0x44c14d[_0x977c('0x9f')][_0x977c('0x96')]():'';logger[_0x977c('0x27')]('test',JSON[_0x977c('0x6a')](_0x44c14d));if(_0x44c14d['result']===-0x1){this[_0x977c('0x30')]['sync'](this,_0x2c38c7,_0x5e6eef);return _0x44c14d;}else if(_0x44c14d[_0x977c('0x95')]===_0x977c('0x5e')){_0x44c14d[_0x977c('0x9f')]=_0x5e6eef[_0x977c('0x93')]>=parseInt(_0x2c38c7['mindigit'])?'x':'i';}else{_0x44c14d[_0x977c('0x9f')]=_0x5e6eef[_0x977c('0x93')]>=parseInt(_0x2c38c7[_0x977c('0xfe')])&&_0x5e6eef[_0x977c('0x93')]<=parseInt(_0x2c38c7[_0x977c('0xff')])?'x':'i';}var _0x53323e=this[_0x977c('0x11')][_0x977c('0x66')](this,_0x2c38c7[_0x977c('0xcc')]);if(!_0x53323e){return this[_0x977c('0x31')][_0x977c('0x26')](_0x2c38c7,'no\x20variable\x20found');}this['channel'][_0x977c('0x91')](_0x53323e,_0x5e6eef);if(this[_0x977c('0x9c')](_0x2c38c7[_0x977c('0x100')])){var _0x3cce87=parseInt(_0x2c38c7[_0x977c('0x100')],0xa);var _0x37ae24=rs[_0x977c('0x101')]({'charset':'*','length':_0x3cce87});var _0x265bc8=_0x5e6eef['length'];if(_0x265bc8>0x0){if(_0x265bc8>_0x3cce87){this[_0x977c('0x30')][_0x977c('0x66')](this,_0x2c38c7,_0x2c38c7['hiddendigitspos']===_0x977c('0x102')?_0x37ae24+_0x5e6eef['substr'](_0x3cce87):_0x5e6eef[_0x977c('0x103')](0x0,_0x265bc8-_0x3cce87)+_0x37ae24);}else{this[_0x977c('0x30')][_0x977c('0x66')](this,_0x2c38c7,rs[_0x977c('0x101')]({'charset':'*','length':_0x265bc8}));}}else{this[_0x977c('0x30')][_0x977c('0x66')](this,_0x2c38c7,'');}}else{this[_0x977c('0x30')][_0x977c('0x66')](this,_0x2c38c7,_0x5e6eef);}return _0x44c14d;};AGIVertices['prototype'][_0x977c('0xe')]=function(_0x6e93f1){logger['info'](util['format'](_0x977c('0x104'),_0x6e93f1['label']));return this[_0x977c('0xd')](_0x6e93f1);};AGIVertices['prototype']['goal']=function(_0x6adc5d){logger['info'](util[_0x977c('0x4f')](_0x977c('0x105'),_0x6adc5d[_0x977c('0x32')]));this[_0x977c('0x30')][_0x977c('0x66')](this,_0x6adc5d,_0x6adc5d[_0x977c('0x106')]);return this[_0x977c('0x31')][_0x977c('0xa0')](util[_0x977c('0x4f')](_0x977c('0x107'),_0x6adc5d[_0x977c('0x106')]));};AGIVertices['prototype'][_0x977c('0x108')]=function(_0x4f60f0){logger[_0x977c('0x27')](util[_0x977c('0x4f')](_0x977c('0x109'),_0x4f60f0[_0x977c('0x32')]));if(!this[_0x977c('0x9c')](_0x4f60f0['aws_access_key_id'])||!this[_0x977c('0x9c')](_0x4f60f0[_0x977c('0x10a')])){return this[_0x977c('0x31')][_0x977c('0xa0')](_0x977c('0x10b'));}if(!this['isConfigured'](_0x4f60f0[_0x977c('0x57')])){return this['channel'][_0x977c('0xa0')]('no\x20text\x20configured');}this[_0x977c('0x31')]['noop'](util[_0x977c('0x4f')](_0x977c('0x10c'),_0x4f60f0[_0x977c('0x57')]));var _0x2996b2=this[_0x977c('0x7a')][_0x977c('0x66')](this,_0x4f60f0);if(_0x2996b2){this[_0x977c('0x31')][_0x977c('0xa0')](util['format']('aws\x20Polly\x20%s\x20file\x20created',_0x2996b2));var _0x12152a=this[_0x977c('0x31')][_0x977c('0xe9')](_0x2996b2);try{fs[_0x977c('0xea')](_0x2996b2+_0x977c('0xeb'));}catch(_0x41d0bf){logger[_0x977c('0x26')](_0x41d0bf);}return _0x12152a;}return this[_0x977c('0x31')]['error'](_0x4f60f0,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0x977c('0x10d')]=function(_0xb5713e){logger[_0x977c('0x27')](util[_0x977c('0x4f')](_0x977c('0x10e'),_0xb5713e['label']));if(!this[_0x977c('0x9c')](_0xb5713e[_0x977c('0x7b')])||!this['isConfigured'](_0xb5713e[_0x977c('0x10a')])){return this[_0x977c('0x31')][_0x977c('0xa0')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0xb5713e['aws_bot_name'])){return this[_0x977c('0x31')][_0x977c('0xa0')](_0x977c('0x10f'));}if(!this[_0x977c('0x9c')](_0xb5713e[_0x977c('0x57')])){return this[_0x977c('0x31')]['noop'](_0x977c('0x9d'));}this[_0x977c('0x31')][_0x977c('0xdb')]=!![];this[_0x977c('0x30')](_0xb5713e);this['createSquareMessage'](_0xb5713e[_0x977c('0x57')],'in');this[_0x977c('0x31')][_0x977c('0xa0')](util[_0x977c('0x4f')]('Trying\x20Amazon\x20Lex:\x20%s',_0xb5713e[_0x977c('0x57')]));var _0x45c17b=this[_0x977c('0x80')][_0x977c('0x66')](this,_0xb5713e);if(_0x45c17b){for(var _0x3cf1af in _0x45c17b){if(_0x45c17b[_0x977c('0x89')](_0x3cf1af)&&_['isString'](_0x45c17b[_0x3cf1af])){this[_0x977c('0x31')]['setVariable'](util['format'](_0x977c('0x110'),_0x3cf1af[_0x977c('0x61')]()),_0x45c17b[_0x3cf1af]);}}if(_[_0x977c('0x3f')](_0x45c17b[_0x977c('0x6e')])){return this[_0x977c('0x31')][_0x977c('0xa0')](_0x977c('0x111'));}else{this[_0x977c('0x3d')](_0x45c17b['message'],_0x977c('0xdf'));return this['channel'][_0x977c('0xa0')](util[_0x977c('0x4f')]('Amazon\x20Lex\x20Result\x20%s',_0x45c17b[_0x977c('0x6e')]));}}return this[_0x977c('0x31')][_0x977c('0x26')](_0xb5713e,_0x977c('0x112'));};AGIVertices[_0x977c('0x14')][_0x977c('0x113')]=function(_0x985112){logger['info'](util[_0x977c('0x4f')](_0x977c('0x114'),_0x985112[_0x977c('0x32')],_0x985112[_0x977c('0x5e')]));if(!this[_0x977c('0x9c')](_0x985112[_0x977c('0x72')])){return this[_0x977c('0x31')][_0x977c('0xa0')](_0x977c('0xda'));}var _0x2faf90=_0x977c('0x115');var _0x2edf66=util[_0x977c('0x4f')](_0x977c('0x116'),FILES_PATH,rs['generate'](0x4));var _0x591ded=util['format'](_0x977c('0x90'),_0x2edf66,_0x2faf90);var _0x36b326=!![];if(_0x985112['beep']===_0x977c('0x117')){_0x36b326=![];}var _0x52a595=this[_0x977c('0x31')][_0x977c('0x118')](_0x2edf66,_0x2faf90,_0x985112[_0x977c('0x119')],_0x985112[_0x977c('0x5e')],undefined,_0x36b326);if(_0x52a595[_0x977c('0x9f')]!==-0x1){this[_0x977c('0x31')][_0x977c('0xa0')](util[_0x977c('0x4f')](_0x977c('0x11a'),_0x591ded));var _0x547e36=this[_0x977c('0x83')]['sync'](this,_0x985112,_0x591ded);if(_0x547e36){for(var _0x5980ad in _0x547e36){if(_0x547e36[_0x977c('0x89')](_0x5980ad)){this[_0x977c('0x31')][_0x977c('0x91')](util[_0x977c('0x4f')](_0x977c('0x11b'),_0x5980ad[_0x977c('0x61')]()),_0x547e36[_0x5980ad]);}}return this['channel'][_0x977c('0xa0')](util[_0x977c('0x4f')](_0x977c('0x11c'),JSON['stringify'](_0x547e36)));}}return _0x52a595;};AGIVertices[_0x977c('0x14')][_0x977c('0x11d')]=function(_0x28b03b){logger[_0x977c('0x27')](util[_0x977c('0x4f')](_0x977c('0x11e'),_0x28b03b['label']));if(!this[_0x977c('0x9c')](_0x28b03b['appid'])){return this['channel'][_0x977c('0xa0')](_0x977c('0x11f'));}if(!this[_0x977c('0x9c')](_0x28b03b[_0x977c('0x86')])){return this[_0x977c('0x31')][_0x977c('0xa0')](_0x977c('0x120'));}var _0x47ef54=_0x977c('0x115');var _0x49abfc=util[_0x977c('0x4f')](_0x977c('0x116'),FILES_PATH,rs[_0x977c('0x101')](0x4));var _0x3496d9=util[_0x977c('0x4f')]('%s.%s',_0x49abfc,_0x47ef54);var _0x26955f=!![];if(_0x28b03b[_0x977c('0x121')]===_0x977c('0x117')){_0x26955f=![];}var _0x4ab128=this[_0x977c('0x31')][_0x977c('0x118')](_0x49abfc,_0x47ef54,_0x28b03b['intKey'],_0x28b03b[_0x977c('0x5e')],undefined,_0x26955f);if(_0x4ab128['result']!==-0x1){this[_0x977c('0x31')][_0x977c('0xa0')](util[_0x977c('0x4f')](_0x977c('0x122'),_0x3496d9));var _0x1d4d34=this[_0x977c('0x85')][_0x977c('0x66')](this,_0x28b03b,_0x3496d9);if(_0x1d4d34){for(var _0x41eed4 in _0x1d4d34){if(_0x1d4d34[_0x977c('0x89')](_0x41eed4)){this['channel'][_0x977c('0x91')](util[_0x977c('0x4f')]('TILDE_ASR_%s',_0x41eed4[_0x977c('0x61')]()),_0x1d4d34[_0x41eed4]);}}return this[_0x977c('0x31')][_0x977c('0xa0')](util[_0x977c('0x4f')](_0x977c('0x123'),JSON[_0x977c('0x6a')](_0x1d4d34)));}}return _0x4ab128;};AGIVertices['prototype']['gotoc']=function(_0x4d0a7b){logger['info'](util[_0x977c('0x4f')](_0x977c('0x124'),_0x4d0a7b[_0x977c('0x32')]));return this[_0x977c('0x31')]['continueAt'](_0x4d0a7b['context'],_0x4d0a7b[_0x977c('0x125')],_0x4d0a7b[_0x977c('0x126')]);};AGIVertices['prototype']['gotoif']=function(_0x4b52c8){logger[_0x977c('0x27')](util[_0x977c('0x4f')](_0x977c('0x127'),_0x4b52c8[_0x977c('0x32')]));if(!this['isConfigured'](_0x4b52c8[_0x977c('0x128')])){return this[_0x977c('0x31')][_0x977c('0x26')](_0x4b52c8,_0x977c('0x129'));}try{var _0x4fae8f=eval(_0x4b52c8[_0x977c('0x128')])?_0x977c('0x12a'):_0x977c('0x12b');this['channel'][_0x977c('0xa0')](util[_0x977c('0x4f')](_0x977c('0x12c'),_0x4b52c8['condition'],_0x4fae8f));return{'code':0xc8,'result':_0x4fae8f};}catch(_0x21cf70){return{'code':0xc8,'result':_0x977c('0x12b')};}};AGIVertices[_0x977c('0x14')]['gotoiftime']=function(_0x184f2e){logger[_0x977c('0x27')](util['format'](_0x977c('0x12d'),_0x184f2e[_0x977c('0x32')]));if(!this[_0x977c('0x9c')](_0x184f2e[_0x977c('0x12e')])){return this[_0x977c('0x31')]['error'](_0x184f2e,_0x977c('0x12f'));}var _0x20bdd0=this[_0x977c('0x130')][_0x977c('0x66')](this,_0x184f2e[_0x977c('0x12e')]);if(!_0x20bdd0){return this[_0x977c('0x31')][_0x977c('0x26')](_0x184f2e,_0x977c('0x131'));}for(var _0x180ce5=0x0;_0x180ce5<_0x20bdd0[_0x977c('0x93')];_0x180ce5+=0x1){var _0x3da47e=this[_0x977c('0x31')][_0x977c('0x11')](util[_0x977c('0x4f')](_0x977c('0x132'),_0x20bdd0[_0x180ce5]));if(_0x3da47e[_0x977c('0x9f')]===-0x1){return _0x3da47e;}logger[_0x977c('0x27')](util[_0x977c('0x4f')]('IFTIME\x20%s\x20%s',_0x20bdd0[_0x180ce5],_0x3da47e[_0x977c('0x95')]));if(_0x3da47e[_0x977c('0x95')]===_0x977c('0x12a')){logger[_0x977c('0x27')](util[_0x977c('0x4f')](_0x977c('0x133'),_0x20bdd0[_0x180ce5],_0x977c('0x12a')));this[_0x977c('0x31')]['noop'](util[_0x977c('0x4f')](_0x977c('0x133'),_0x20bdd0[_0x180ce5],_0x977c('0x12a')));return{'code':0xc8,'result':_0x977c('0x12a')};}else{logger[_0x977c('0x27')](util['format']('IFTIME\x20%s\x20%s',_0x20bdd0[_0x180ce5],_0x977c('0x12b')));this[_0x977c('0x31')]['noop'](util[_0x977c('0x4f')]('IFTIME\x20%s\x20%s',_0x20bdd0[_0x180ce5],_0x977c('0x12b')));}}return{'code':0xc8,'result':_0x977c('0x12b')};};AGIVertices[_0x977c('0x14')][_0x977c('0x134')]=function(_0x52cdd9){logger[_0x977c('0x27')](util[_0x977c('0x4f')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x52cdd9['label']));return this[_0x977c('0x31')]['hangup']();};AGIVertices['prototype'][_0x977c('0x135')]=function(_0x1ad139){logger[_0x977c('0x27')](util[_0x977c('0x4f')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x1ad139['label']));if(!this[_0x977c('0x9c')](_0x1ad139['key'])){return this[_0x977c('0x31')][_0x977c('0xa0')](_0x977c('0xda'));}var _0x568e65=_0x977c('0x115');var _0x51bee0=util[_0x977c('0x4f')](_0x977c('0x116'),FILES_PATH,rs[_0x977c('0x101')](0x4));var _0x430418=util[_0x977c('0x4f')](_0x977c('0x90'),_0x51bee0,_0x568e65);var _0x45f3f6=!![];if(_0x1ad139[_0x977c('0x121')]===_0x977c('0x117')){_0x45f3f6=![];}var _0x91956f=this['channel'][_0x977c('0x118')](_0x51bee0,_0x568e65,_0x1ad139[_0x977c('0x119')],_0x1ad139['timeout'],undefined,_0x45f3f6);if(_0x91956f[_0x977c('0x9f')]!==-0x1){this[_0x977c('0x31')][_0x977c('0xa0')](util[_0x977c('0x4f')](_0x977c('0x136'),_0x430418));var _0x3a1916=this[_0x977c('0x77')]['sync'](this,_0x1ad139,_0x430418);if(_0x3a1916){for(var _0x2fabc1 in _0x3a1916){if(_0x3a1916['hasOwnProperty'](_0x2fabc1)){this[_0x977c('0x31')][_0x977c('0x91')](util['format'](_0x977c('0x137'),_0x2fabc1[_0x977c('0x61')]()),_0x3a1916[_0x2fabc1]);}}return this[_0x977c('0x31')][_0x977c('0xa0')](util[_0x977c('0x4f')](_0x977c('0x138'),JSON[_0x977c('0x6a')](_0x3a1916)));}}return _0x91956f;};AGIVertices['prototype'][_0x977c('0x139')]=function(_0x3dd12e){logger[_0x977c('0x27')](util[_0x977c('0x4f')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x3dd12e['label']));if(!this[_0x977c('0x9c')](_0x3dd12e['key'])){return this[_0x977c('0x31')]['noop']('no\x20key\x20configured');}if(!this[_0x977c('0x9c')](_0x3dd12e[_0x977c('0x57')])){return this[_0x977c('0x31')][_0x977c('0xa0')](_0x977c('0x9d'));}this[_0x977c('0x31')][_0x977c('0xa0')](util['format'](_0x977c('0x13a'),_0x3dd12e[_0x977c('0x57')]));var _0x3db092=this[_0x977c('0x13b')]['sync'](this,_0x3dd12e);if(_0x3db092){this['channel']['noop'](util[_0x977c('0x4f')](_0x977c('0x136'),_0x3db092));var _0x2de4bc=this[_0x977c('0x31')][_0x977c('0xe9')](_0x3db092,_0x3dd12e[_0x977c('0x119')]);try{fs['unlink'](_0x3db092+_0x977c('0xeb'));}catch(_0x329fb4){logger[_0x977c('0x26')](_0x329fb4);}return _0x2de4bc;}return this[_0x977c('0x31')][_0x977c('0x26')](_0x3dd12e,_0x977c('0x13c'));};AGIVertices[_0x977c('0x14')][_0x977c('0x13d')]=function(_0x57d224){logger[_0x977c('0x27')](util[_0x977c('0x4f')](_0x977c('0x13e'),_0x57d224['label']));if(!this[_0x977c('0x9c')](_0x57d224['findBy'])){return this[_0x977c('0x31')][_0x977c('0x26')](_0x57d224,'no\x20find\x20by\x20configured');}logger['info'](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x977c('0x31')][_0x977c('0x37')],_0x57d224[_0x977c('0x13f')]));var _0x3668ba=this[_0x977c('0x4d')][_0x977c('0x66')](this,_0x57d224['findBy']);if(_0x3668ba){logger[_0x977c('0x27')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x977c('0x31')]['callerid'],_0x57d224[_0x977c('0x13f')]));this[_0x977c('0x31')][_0x977c('0xa0')](util['format'](_0x977c('0x140'),this['channel'][_0x977c('0x37')],_0x57d224['findBy']));return{'code':0xc8,'result':_0x977c('0x141')};}else{logger[_0x977c('0x27')](util['format'](_0x977c('0x142'),this[_0x977c('0x31')][_0x977c('0x37')],_0x57d224[_0x977c('0x13f')]));this[_0x977c('0x31')]['noop'](util['format'](_0x977c('0x142'),this[_0x977c('0x31')][_0x977c('0x37')],_0x57d224[_0x977c('0x13f')]));return{'code':0xc8,'result':_0x977c('0x143')};}};AGIVertices['prototype'][_0x977c('0x144')]=function(_0x3beb34){logger[_0x977c('0x27')](util[_0x977c('0x4f')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x3beb34['label']));if(!this[_0x977c('0x9c')](_0x3beb34['findBy'])){return this[_0x977c('0x31')][_0x977c('0x26')](_0x3beb34,_0x977c('0x145'));}logger[_0x977c('0x27')](util['format'](_0x977c('0x146'),this['channel'][_0x977c('0x37')],_0x3beb34['findBy']));var _0x1f40b1=this[_0x977c('0x4c')][_0x977c('0x66')](this,_0x3beb34[_0x977c('0x13f')]);if(_0x1f40b1){logger[_0x977c('0x27')](util[_0x977c('0x4f')](_0x977c('0x140'),this[_0x977c('0x31')][_0x977c('0x37')],_0x3beb34['findBy']));this[_0x977c('0x31')]['noop'](util[_0x977c('0x4f')](_0x977c('0x140'),this['channel'][_0x977c('0x37')],_0x3beb34[_0x977c('0x13f')]));return{'code':0xc8,'result':_0x977c('0x141')};}else{logger['info'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x977c('0x37')],_0x3beb34['findBy']));this['channel'][_0x977c('0xa0')](util['format'](_0x977c('0x142'),this[_0x977c('0x31')][_0x977c('0x37')],_0x3beb34['findBy']));return{'code':0xc8,'result':_0x977c('0x143')};}};AGIVertices[_0x977c('0x14')][_0x977c('0x147')]=function(_0x33207b){logger[_0x977c('0x27')](util[_0x977c('0x4f')](_0x977c('0x148'),_0x33207b['label']));if(!this['isConfigured'](_0x33207b[_0x977c('0x149')])){return this[_0x977c('0x31')]['error'](_0x33207b,_0x977c('0x14a'));}this['channel'][_0x977c('0xa0')](util['format'](_0x977c('0x14b'),_0x33207b['operation']));var _0x5269e6=eval(_0x33207b[_0x977c('0x149')]);if(!this[_0x977c('0x9c')](_0x33207b[_0x977c('0xcc')])){return this[_0x977c('0x31')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5c496b=this[_0x977c('0x11')][_0x977c('0x66')](this,_0x33207b[_0x977c('0xcc')]);if(!_0x5c496b){return this[_0x977c('0x31')][_0x977c('0x26')](_0x33207b,_0x977c('0xce'));}if(_[_0x977c('0x8d')](_0x5269e6)){var _0xa33af4=this;_0x5269e6[_0x977c('0x14c')](function(_0xb7bf6f,_0x3c14af){_0xa33af4['channel'][_0x977c('0x91')](util[_0x977c('0x4f')](_0x977c('0x14d'),_0x5c496b,_0x3c14af),_0xb7bf6f);});return this[_0x977c('0x31')]['noop'](util[_0x977c('0x4f')](_0x977c('0x14e'),_0x5c496b));}else{return this[_0x977c('0x31')]['setVariable'](_0x5c496b,_0x5269e6);}};AGIVertices[_0x977c('0x14')]['menu']=function(_0x36b9fc){logger[_0x977c('0x27')](util[_0x977c('0x4f')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x36b9fc['label']));if(_0x36b9fc['retry']===0x0){return this[_0x977c('0xfa')](_0x36b9fc);}_0x36b9fc[_0x977c('0x99')]-=0x1;if(!this[_0x977c('0x9c')](_0x36b9fc[_0x977c('0x14f')])){return this[_0x977c('0x31')][_0x977c('0x26')](_0x36b9fc,_0x977c('0xfb'));}var _0x3e8686=this[_0x977c('0x150')][_0x977c('0x66')](this,_0x36b9fc[_0x977c('0x14f')]);if(!_0x3e8686){return this[_0x977c('0x31')][_0x977c('0x26')](_0x36b9fc,_0x977c('0x151'));}var _0x4bb02b=this[_0x977c('0x31')]['getData'](_0x3e8686,_0x36b9fc[_0x977c('0xfd')],_0x36b9fc[_0x977c('0x152')]);var _0x43ca1f=_0x4bb02b['result'];if(_0x4bb02b[_0x977c('0x9f')]===-0x1){this[_0x977c('0x30')][_0x977c('0x66')](this,_0x36b9fc,'-1');return _0x4bb02b;}else if(_0x4bb02b['extra']===_0x977c('0x5e')){_0x4bb02b[_0x977c('0x9f')]=_0x4bb02b['result'][_0x977c('0x93')]>0x0?_0x4bb02b['result']:'t';}else if(_[_0x977c('0x42')](_0x4bb02b[_0x977c('0x9f')])){_0x4bb02b[_0x977c('0x9f')]='#';_0x43ca1f='#';}if(!this[_0x977c('0x9c')](_0x36b9fc[_0x977c('0xcc')])){this[_0x977c('0x31')]['noop'](_0x977c('0xcd'));}else{var _0x37cf31=this[_0x977c('0x11')][_0x977c('0x66')](this,_0x36b9fc[_0x977c('0xcc')]);if(!_0x37cf31){return this['channel'][_0x977c('0x26')](_0x36b9fc,_0x977c('0xce'));}this[_0x977c('0x31')]['setVariable'](_0x37cf31,_0x43ca1f);}this[_0x977c('0x30')][_0x977c('0x66')](this,_0x36b9fc,_0x43ca1f);return _0x4bb02b;};AGIVertices[_0x977c('0x14')][_0x977c('0xa0')]=function(_0x509a68){logger[_0x977c('0x27')](util[_0x977c('0x4f')](_0x977c('0x153'),_0x509a68[_0x977c('0x32')]));return this[_0x977c('0x31')]['noop'](_0x509a68[_0x977c('0x154')]||_0x509a68[_0x977c('0x32')]);};AGIVertices['prototype'][_0x977c('0x155')]=function(_0x403a36){logger['info'](util[_0x977c('0x4f')](_0x977c('0x156'),_0x403a36[_0x977c('0x32')]));if(!this[_0x977c('0x9c')](_0x403a36[_0x977c('0x13f')])){return this[_0x977c('0x31')][_0x977c('0x26')](_0x403a36,'no\x20find\x20by\x20configured');}logger[_0x977c('0x27')](util[_0x977c('0x4f')](_0x977c('0x146'),this['channel'][_0x977c('0x37')],_0x403a36[_0x977c('0x13f')]));var _0x24b3c7=this[_0x977c('0x157')][_0x977c('0x66')](this,_0x403a36['pause_id']);var _0x96b8d7=this[_0x977c('0x49')][_0x977c('0x66')](this,_0x403a36[_0x977c('0x13f')],_0x24b3c7);if(_0x96b8d7){logger['info'](util[_0x977c('0x4f')](_0x977c('0x140'),this['channel'][_0x977c('0x37')],_0x403a36['findBy']));this['channel'][_0x977c('0xa0')](util[_0x977c('0x4f')](_0x977c('0x140'),this[_0x977c('0x31')][_0x977c('0x37')],_0x403a36[_0x977c('0x13f')]));return{'code':0xc8,'result':_0x977c('0x141')};}else{logger[_0x977c('0x27')](util[_0x977c('0x4f')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x977c('0x31')][_0x977c('0x37')],_0x403a36[_0x977c('0x13f')]));this[_0x977c('0x31')][_0x977c('0xa0')](util[_0x977c('0x4f')](_0x977c('0x140'),this['channel'][_0x977c('0x37')],_0x403a36[_0x977c('0x13f')]));return{'code':0xc8,'result':_0x977c('0x143')};}};AGIVertices[_0x977c('0x14')][_0x977c('0x158')]=function(_0x443220){logger['info'](util[_0x977c('0x4f')](_0x977c('0x159'),_0x443220[_0x977c('0x32')]));if(!this['isConfigured'](_0x443220['file_id'])){return this[_0x977c('0x31')][_0x977c('0x26')](_0x443220,'no\x20file\x20audio\x20selected');}var _0x328cd4=this[_0x977c('0x150')]['sync'](this,_0x443220['file_id']);if(!_0x328cd4){return this[_0x977c('0x31')][_0x977c('0x26')](_0x443220,_0x977c('0x151'));}var _0x177302=this['channel'][_0x977c('0x52')](_0x977c('0x15a'),[_0x328cd4,_0x443220[_0x977c('0xd9')]]);if(_0x177302[_0x977c('0x9f')]===-0x1){return _0x177302;}return this[_0x977c('0x31')][_0x977c('0xa0')](util['format'](_0x977c('0xb9'),_0x977c('0x15a'),_0x328cd4));};AGIVertices['prototype']['queue']=function(_0x5ca8e7){logger['info'](util[_0x977c('0x4f')](_0x977c('0x15b'),_0x5ca8e7[_0x977c('0x32')]));if(!this['isConfigured'](_0x5ca8e7[_0x977c('0x15c')])){return this[_0x977c('0x31')][_0x977c('0x26')](_0x5ca8e7,'no\x20queue\x20selected');}var _0x2c92a1='';var _0x36227f=parseInt(_0x5ca8e7[_0x977c('0x15c')],0xa);if(isNaN(_0x36227f)){_0x2c92a1=_0x5ca8e7[_0x977c('0x15c')];}else{_0x2c92a1=this[_0x977c('0x15')][_0x977c('0x66')](this,_0x5ca8e7[_0x977c('0x15c')]);if(!_0x2c92a1){return this[_0x977c('0x31')]['error'](_0x5ca8e7,_0x977c('0x15d'));}}var _0x2f7a29='';if(this['isConfigured'](_0x5ca8e7['file_id'])){var _0x301737=this[_0x977c('0x150')][_0x977c('0x66')](this,_0x5ca8e7['file_id']);if(_0x301737){_0x2f7a29=_0x301737;}}this[_0x977c('0x30')][_0x977c('0x66')](this,_0x5ca8e7,_0x2c92a1);if(_0x5ca8e7[_0x977c('0xd9')][_0x977c('0x15e')]('x')<0x0){_0x5ca8e7[_0x977c('0xd9')]+='x';}if(_0x5ca8e7[_0x977c('0xd9')]['indexOf']('X')<0x0){_0x5ca8e7[_0x977c('0xd9')]+='X';}this[_0x977c('0x31')]['setVariable'](_0x977c('0x15f'),_0x2c92a1?_0x2c92a1[_0x977c('0x160')]():'');var _0x5a87d1=this[_0x977c('0x31')][_0x977c('0x52')]('QUEUE',[_0x2c92a1,_0x5ca8e7[_0x977c('0xd9')],_0x5ca8e7['url'],_0x2f7a29,_0x5ca8e7['timeout'],_0x5ca8e7[_0x977c('0xaa')],_0x5ca8e7[_0x977c('0x161')],_0x5ca8e7[_0x977c('0x162')],'',_0x5ca8e7[_0x977c('0x163')]]);if(_0x5a87d1[_0x977c('0x9f')]===-0x1){return _0x5a87d1;}return this['channel']['noop'](util[_0x977c('0x4f')](_0x977c('0xb9'),'QUEUE',_0x2c92a1));};AGIVertices[_0x977c('0x14')][_0x977c('0x164')]=function(_0x232e82){logger[_0x977c('0x27')](util['format'](_0x977c('0x165'),_0x232e82[_0x977c('0x32')]));var _0x1b22db=_0x232e82['recordingFormat']||_0x977c('0x115');var _0x3d80e8=util[_0x977c('0x4f')](_0x977c('0x166'),this[_0x977c('0x31')][_0x977c('0x36')],rs['generate'](0x5));var _0x56ab9f=util[_0x977c('0x4f')](_0x977c('0x167'),FILES_PATH,_0x3d80e8,_0x1b22db);var _0x39887c=util['format']('%s/recordings/%s',FILES_PATH,_0x3d80e8);this[_0x977c('0x35')][_0x977c('0x66')](this,_0x232e82,_0x3d80e8,_0x56ab9f);this[_0x977c('0x31')]['setVariable'](_0x977c('0x168'),_0x3d80e8);logger[_0x977c('0x27')](_0x977c('0x169'),_0x39887c,_0x1b22db,_0x232e82['escape_digits'],_0x232e82[_0x977c('0x5e')]);return this[_0x977c('0x31')][_0x977c('0x118')](_0x39887c,_0x1b22db,_0x232e82[_0x977c('0x16a')],_0x232e82[_0x977c('0x5e')],undefined,!![]);};AGIVertices[_0x977c('0x14')][_0x977c('0x16b')]=function(_0x4d19fc){logger[_0x977c('0x27')](util[_0x977c('0x4f')](_0x977c('0x16c'),_0x4d19fc['label']));if(!this[_0x977c('0x9c')](_0x4d19fc[_0x977c('0x67')])){return this['channel']['noop'](_0x977c('0x16d'));}var _0x368b63=this[_0x977c('0x5c')][_0x977c('0x66')](this,_0x4d19fc);logger['info'](util['format'](_0x977c('0x16e'),util[_0x977c('0x16f')](_0x368b63,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x4d19fc[_0x977c('0xcc')])){return this[_0x977c('0x31')]['noop'](_0x977c('0x170'));}var _0x7db9e9=this[_0x977c('0x11')][_0x977c('0x66')](this,_0x4d19fc[_0x977c('0xcc')]);if(!_0x7db9e9){return this[_0x977c('0x31')][_0x977c('0x26')](_0x4d19fc,'no\x20variable\x20found');}this[_0x977c('0x31')]['setVariable'](util[_0x977c('0x4f')](_0x977c('0x171'),_0x7db9e9),_0x368b63[_0x977c('0x6d')]?_0x368b63[_0x977c('0x6d')]:'200');this['channel'][_0x977c('0x91')](util[_0x977c('0x4f')](_0x977c('0x172'),_0x7db9e9),_0x368b63['statusMessage']?_0x368b63[_0x977c('0x6c')]:'OK');if(_0x368b63[_0x977c('0x62')]){try{this[_0x977c('0x8f')](_0x368b63[_0x977c('0x62')],_0x7db9e9);}catch(_0x28e457){logger[_0x977c('0x26')](util['format']('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x7db9e9));}}return this[_0x977c('0x31')]['noop'](util['format'](_0x977c('0x173'),_0x7db9e9));};AGIVertices[_0x977c('0x14')][_0x977c('0x174')]=function(_0x4179c9){logger['info'](util[_0x977c('0x4f')](_0x977c('0x175'),_0x4179c9[_0x977c('0x32')]));return this[_0x977c('0x31')][_0x977c('0x176')](_0x4179c9[_0x977c('0x177')][_0x977c('0x54')](/\s+/g,''),_0x4179c9[_0x977c('0x16a')]);};AGIVertices[_0x977c('0x14')][_0x977c('0x178')]=function(_0x74f200){logger[_0x977c('0x27')](util[_0x977c('0x4f')](_0x977c('0x179'),_0x74f200[_0x977c('0x32')]));return this[_0x977c('0x31')][_0x977c('0x17a')](_0x74f200['number'][_0x977c('0x54')](/\s+/g,''),_0x74f200[_0x977c('0x16a')]);};AGIVertices[_0x977c('0x14')]['sayphonetic']=function(_0x5eea54){logger['info'](util[_0x977c('0x4f')](_0x977c('0x17b'),_0x5eea54['label']));return this[_0x977c('0x31')][_0x977c('0x17c')](_0x5eea54[_0x977c('0x57')],_0x5eea54[_0x977c('0x16a')]);};AGIVertices[_0x977c('0x14')]['sendMail']=function(_0x495e72){logger[_0x977c('0x27')](util[_0x977c('0x4f')](_0x977c('0x17d'),_0x495e72[_0x977c('0x32')]));if(!this[_0x977c('0x9c')](_0x495e72[_0x977c('0x17e')])){return this[_0x977c('0x31')][_0x977c('0xa0')](_0x977c('0x17f'));}var _0x3c3bdc=this['getMailAccount']['sync'](this,_0x495e72['account_id']);if(!_0x3c3bdc||!_0x3c3bdc[_0x977c('0x180')]){return this[_0x977c('0x31')][_0x977c('0x26')](_0x495e72,_0x977c('0x181'));}var _0x72cdab={'from':util[_0x977c('0x4f')]('\x22%s\x22\x20<%s>',_0x3c3bdc[_0x977c('0x1b')],_0x3c3bdc[_0x977c('0x182')]||_0x3c3bdc['Smtp']['user']),'to':_0x495e72['to']||'','cc':_0x495e72['cc']||'','bcc':_0x495e72['bcc']||'','subject':_0x495e72[_0x977c('0x183')],'html':_0x495e72[_0x977c('0x57')],'text':_0x495e72[_0x977c('0x57')]};var _0x44e35f={'tls':{'rejectUnauthorized':![]}};if(_0x3c3bdc[_0x977c('0x180')][_0x977c('0x184')]){_0x44e35f['service']=_0x3c3bdc[_0x977c('0x180')]['service'];}else{_0x44e35f['host']=_0x3c3bdc['Smtp'][_0x977c('0x185')];_0x44e35f[_0x977c('0x186')]=_0x3c3bdc[_0x977c('0x180')][_0x977c('0x186')];_0x44e35f[_0x977c('0x187')]=_0x3c3bdc[_0x977c('0x180')][_0x977c('0x187')];}if(_0x3c3bdc[_0x977c('0x180')]['authentication']){_0x44e35f[_0x977c('0x188')]={'user':_0x3c3bdc[_0x977c('0x180')][_0x977c('0x189')],'pass':_0x3c3bdc[_0x977c('0x180')][_0x977c('0x18a')]};}if(this[_0x977c('0x9c')](_0x495e72[_0x977c('0x18b')])){}logger[_0x977c('0x18c')](_0x977c('0x18d'),JSON[_0x977c('0x6a')](_0x72cdab));this[_0x977c('0x30')][_0x977c('0x66')](this,_0x495e72,_0x495e72[_0x977c('0x17e')]);this['channel'][_0x977c('0xa0')](util[_0x977c('0x4f')](_0x977c('0x18e'),_0x3c3bdc['name']));this[_0x977c('0x1f')][_0x977c('0x66')](this,_0x44e35f,_0x72cdab);return this[_0x977c('0x31')][_0x977c('0xa0')](_0x977c('0x18f'));};AGIVertices['prototype'][_0x977c('0x190')]=function(_0x327dfc){logger['info'](util[_0x977c('0x4f')](_0x977c('0x191'),_0x327dfc[_0x977c('0x32')]));return this[_0x977c('0x31')][_0x977c('0xa0')](_0x977c('0x192'));};AGIVertices[_0x977c('0x14')][_0x977c('0x193')]=function(_0x8d51bf){logger['info'](util[_0x977c('0x4f')](_0x977c('0x194'),_0x8d51bf[_0x977c('0x32')]));if(!this['isConfigured'](_0x8d51bf[_0x977c('0x195')])){return this[_0x977c('0x31')][_0x977c('0xa0')](_0x977c('0x196'));}var _0x3873f0=this[_0x977c('0x2d')][_0x977c('0x66')](this,_0x8d51bf[_0x977c('0x195')]);if(!_0x3873f0){return this[_0x977c('0x31')]['error'](_0x8d51bf,_0x977c('0x197'));}var _0x55cade={'body':_0x8d51bf['sms_text'],'phone':_0x8d51bf['to']||'','SmsAccountId':_0x3873f0['id']};logger[_0x977c('0x18c')](_0x977c('0x198'),JSON[_0x977c('0x6a')](_0x55cade));this[_0x977c('0x30')][_0x977c('0x66')](this,_0x8d51bf,_0x8d51bf[_0x977c('0x195')]);this[_0x977c('0x31')][_0x977c('0xa0')](util[_0x977c('0x4f')](_0x977c('0x199'),_0x3873f0[_0x977c('0x1b')]));this['createSmsMessage'][_0x977c('0x66')](this,_0x55cade);return this[_0x977c('0x31')]['noop']('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x977c('0x19a')]=function(_0x4bdbc5){logger[_0x977c('0x27')](util[_0x977c('0x4f')](_0x977c('0x19b'),_0x4bdbc5['label']));if(!this['isConfigured'](_0x4bdbc5[_0x977c('0xcc')])){return this[_0x977c('0x31')][_0x977c('0x26')](_0x4bdbc5,_0x977c('0x19c'));}var _0x3f95f4=this[_0x977c('0x11')][_0x977c('0x66')](this,_0x4bdbc5['variable_id']);if(!_0x3f95f4){return this[_0x977c('0x31')][_0x977c('0x26')](_0x4bdbc5,_0x977c('0xce'));}return this[_0x977c('0x31')][_0x977c('0x91')](_0x3f95f4,_0x4bdbc5[_0x977c('0x19d')]);};AGIVertices[_0x977c('0x14')][_0x977c('0x19e')]=function(_0xb3cd71){logger['info'](util[_0x977c('0x4f')](_0x977c('0x19f'),_0xb3cd71[_0x977c('0x32')]));this[_0x977c('0x31')][_0x977c('0xa0')](_0x977c('0x1a0'));if(_0xb3cd71[_0x977c('0xae')]==='yes'){this['channel'][_0x977c('0xa0')](_0x977c('0x1a1'));return this[_0x977c('0x31')][_0x977c('0xae')]();}return this[_0x977c('0x31')]['noop']('Skipped\x20Answer');};AGIVertices[_0x977c('0x14')][_0x977c('0x1a2')]=function(_0x8720e6){logger[_0x977c('0x27')](util[_0x977c('0x4f')](_0x977c('0x1a3'),_0x8720e6[_0x977c('0x32')]));if(!this[_0x977c('0x9c')](_0x8720e6[_0x977c('0x1a4')])){return this[_0x977c('0x31')][_0x977c('0x26')](_0x8720e6,_0x977c('0x1a5'));}var _0x36f348=this[_0x977c('0x17')][_0x977c('0x66')](this,_0x8720e6[_0x977c('0x1a4')]);if(!this['isConfigured'](_0x36f348)){return this[_0x977c('0x31')][_0x977c('0x26')](_0x8720e6,util[_0x977c('0x4f')](_0x977c('0x1a6'),_0x8720e6['project_id']));}if(_0x36f348===this[_0x977c('0x31')][_0x977c('0x34')]){return this['channel'][_0x977c('0x26')](_0x8720e6,_0x977c('0x1a7'));}this['createSquareDetailsReport'][_0x977c('0x66')](this,_0x8720e6,_0x36f348);var _0x1eed9a=this[_0x977c('0x31')][_0x977c('0x52')]('AGI',util[_0x977c('0x4f')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x977c('0xaa')]['host']||'127.0.0.1',_0x36f348,this[_0x977c('0x31')][_0x977c('0x34')]));if(_0x1eed9a[_0x977c('0x9f')]===-0x1){return _0x1eed9a;}return this[_0x977c('0x31')][_0x977c('0xa0')](util[_0x977c('0x4f')](_0x977c('0xb9'),_0x977c('0x1a8'),_0x36f348));};AGIVertices[_0x977c('0x14')]['system']=function(_0x31ca0c){logger[_0x977c('0x27')](util[_0x977c('0x4f')](_0x977c('0x1a9'),_0x31ca0c[_0x977c('0x32')]));var _0x33dc40=this[_0x977c('0x51')][_0x977c('0x66')](this,_0x31ca0c[_0x977c('0xac')]);this[_0x977c('0x30')][_0x977c('0x66')](this,_0x31ca0c,_0x31ca0c[_0x977c('0xac')]);if(this[_0x977c('0x9c')](_0x31ca0c['variable_id'])){var _0x55f7b3=this[_0x977c('0x11')][_0x977c('0x66')](this,_0x31ca0c[_0x977c('0xcc')]);if(_0x55f7b3){this['channel']['setVariable'](_0x55f7b3,_0x33dc40);return this['channel'][_0x977c('0xa0')](util[_0x977c('0x4f')](_0x977c('0x1aa'),_0x31ca0c['command'],_0x55f7b3));}}return this['channel'][_0x977c('0xa0')](util[_0x977c('0x4f')](_0x977c('0x1ab'),_0x31ca0c[_0x977c('0xac')]));};AGIVertices['prototype'][_0x977c('0x1ac')]=function(_0x5ed4ff){logger[_0x977c('0x27')](util[_0x977c('0x4f')](_0x977c('0x1ad'),_0x5ed4ff['label']));_0x5ed4ff[_0x977c('0x57')]=_0x5ed4ff[_0x977c('0x57')][_0x977c('0x54')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x977c('0x9c')](_0x5ed4ff[_0x977c('0x1ae')])){return this[_0x977c('0x31')]['noop'](_0x977c('0x1af'));}if(!this['isConfigured'](_0x5ed4ff[_0x977c('0x57')])){return this[_0x977c('0x31')][_0x977c('0xa0')]('no\x20text\x20configured');}this['channel'][_0x977c('0xa0')](util[_0x977c('0x4f')](_0x977c('0x1b0'),_0x5ed4ff['text']));var _0x3a446b=this[_0x977c('0x55')][_0x977c('0x66')](this,_0x5ed4ff);if(_0x3a446b){this[_0x977c('0x31')][_0x977c('0xa0')](util['format'](_0x977c('0x1b1'),_0x3a446b));var _0x45730e=this[_0x977c('0x31')][_0x977c('0xe9')](_0x3a446b);try{fs[_0x977c('0xea')](_0x3a446b+_0x977c('0xeb'));}catch(_0x4c7843){logger['error'](_0x4c7843);}return _0x45730e;}return this[_0x977c('0x31')][_0x977c('0x26')](_0x5ed4ff,_0x977c('0x1b2'));};AGIVertices[_0x977c('0x14')][_0x977c('0x1b3')]=function(_0xfdf308){logger[_0x977c('0x27')](util[_0x977c('0x4f')](_0x977c('0x1b4'),_0xfdf308[_0x977c('0x32')]));_0xfdf308[_0x977c('0x57')]=_0xfdf308[_0x977c('0x57')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x977c('0x9c')](_0xfdf308[_0x977c('0x57')])){return this[_0x977c('0x31')][_0x977c('0xa0')]('no\x20text\x20configured');}this[_0x977c('0x31')][_0x977c('0xa0')](util[_0x977c('0x4f')]('Trying\x20Google\x20TTS\x20%s',_0xfdf308[_0x977c('0x57')]));var _0xa49d3b=this[_0x977c('0x5b')]['sync'](this,_0xfdf308);if(_0xa49d3b){this[_0x977c('0x31')][_0x977c('0xa0')](util[_0x977c('0x4f')](_0x977c('0x1b5'),_0xa49d3b));var _0x55a822=this[_0x977c('0x31')][_0x977c('0xe9')](_0xa49d3b);try{fs[_0x977c('0xea')](_0xa49d3b+_0x977c('0xeb'));}catch(_0x50e6b0){logger['error'](_0x50e6b0);}return _0x55a822;}return this[_0x977c('0x31')]['error'](_0xfdf308,_0x977c('0x1b6'));};AGIVertices[_0x977c('0x14')][_0x977c('0x1b7')]=function(_0xc768b8){logger[_0x977c('0x27')](util[_0x977c('0x4f')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0xc768b8[_0x977c('0x32')]));if(!this[_0x977c('0x9c')](_0xc768b8[_0x977c('0x13f')])){return this['channel'][_0x977c('0x26')](_0xc768b8,_0x977c('0x145'));}logger[_0x977c('0x27')](util['format'](_0x977c('0x146'),this[_0x977c('0x31')][_0x977c('0x37')],_0xc768b8['findBy']));var _0x33b51e=this[_0x977c('0x4b')]['sync'](this,_0xc768b8['findBy']);if(_0x33b51e){logger[_0x977c('0x27')](util['format'](_0x977c('0x140'),this[_0x977c('0x31')]['callerid'],_0xc768b8[_0x977c('0x13f')]));this[_0x977c('0x31')][_0x977c('0xa0')](util[_0x977c('0x4f')](_0x977c('0x140'),this[_0x977c('0x31')]['callerid'],_0xc768b8[_0x977c('0x13f')]));return{'code':0xc8,'result':_0x977c('0x141')};}else{logger['info'](util['format'](_0x977c('0x142'),this[_0x977c('0x31')][_0x977c('0x37')],_0xc768b8[_0x977c('0x13f')]));this[_0x977c('0x31')][_0x977c('0xa0')](util[_0x977c('0x4f')](_0x977c('0x142'),this[_0x977c('0x31')][_0x977c('0x37')],_0xc768b8[_0x977c('0x13f')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x977c('0x14')]['voicemail']=function(_0x198faf){logger[_0x977c('0x27')](util[_0x977c('0x4f')](_0x977c('0x1b8'),_0x198faf[_0x977c('0x32')]));var _0x205805=this[_0x977c('0x31')][_0x977c('0x52')](_0x977c('0x1b9'),[_0x198faf[_0x977c('0x1ba')],_0x198faf[_0x977c('0x70')]]);if(_0x205805[_0x977c('0x9f')]===-0x1){return _0x205805;}return this['channel'][_0x977c('0xa0')](util['format']('Executed\x20command\x20%s\x20%s',_0x977c('0x1b9'),_0x198faf[_0x977c('0x1ba')]));};AGIVertices['prototype'][_0x977c('0x1bb')]=function(_0x191f69){logger[_0x977c('0x27')](util[_0x977c('0x4f')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x191f69[_0x977c('0x32')]));if(!this[_0x977c('0x9c')](_0x191f69[_0x977c('0xcc')])){return this[_0x977c('0x31')]['error'](_0x191f69,_0x977c('0x19c'));}var _0x368aea=this[_0x977c('0x11')][_0x977c('0x66')](this,_0x191f69[_0x977c('0xcc')]);if(!_0x368aea){return this[_0x977c('0x31')][_0x977c('0x26')](_0x191f69,_0x977c('0xce'));}var _0x40c857=this['channel']['getVariable'](_0x368aea);return{'code':0xc8,'result':_0x40c857['extra']?_0x40c857['extra']:'-'};};String[_0x977c('0x14')]['replaceAll']=function(_0x596804,_0x1db071){return this[_0x977c('0x92')](_0x596804)[_0x977c('0x1bc')](_0x1db071);};module[_0x977c('0x1bd')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index d881fe7..4e6d668 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 _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 +var _0xb903=['attended','destlinkedid','savePause','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','stopAcw','acwTimeout','lastPauseAt','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','[TIMER][STOP][AGENT:%s]','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','interface','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','Auto-Pause','exports','util','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncAgentRingNoAnswer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','prototype','startAcw','channels','mandatoryDisposition','name','mandatoryDispositionPause','Action','QueuePause','then','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]'];(function(_0x3164c6,_0x4f5f3b){var _0x36e930=function(_0x2b1626){while(--_0x2b1626){_0x3164c6['push'](_0x3164c6['shift']());}};_0x36e930(++_0x4f5f3b);}(_0xb903,0x185));var _0x3b90=function(_0x5a415f,_0x40a462){_0x5a415f=_0x5a415f-0x0;var _0x3c7ad7=_0xb903[_0x5a415f];return _0x3c7ad7;};'use strict';var util=require(_0x3b90('0x0'));var _=require(_0x3b90('0x1'));var moment=require(_0x3b90('0x2'));var ami=require(_0x3b90('0x3'));var logger=require('../../../config/logger')(_0x3b90('0x4'));var RpcUser=require(_0x3b90('0x5'));var RpcVoiceAgentReport=require(_0x3b90('0x6'));function Acw(_0x1cd5d8){this[_0x3b90('0x7')]=_0x1cd5d8[_0x3b90('0x7')];this[_0x3b90('0x8')]=_0x1cd5d8['agents'];this[_0x3b90('0x9')]=_0x1cd5d8['timers'];this['channels']={};ami['on'](_0x3b90('0xa'),this[_0x3b90('0xb')][_0x3b90('0xc')](this));ami['on'](_0x3b90('0xd'),this['syncHangupRequest']['bind'](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on']('agentringnoanswer',this[_0x3b90('0xe')][_0x3b90('0xc')](this));ami['on']('attendedtransfer',this[_0x3b90('0xf')][_0x3b90('0xc')](this));ami['on']('blindtransfer',this[_0x3b90('0x10')][_0x3b90('0xc')](this));ami['on'](_0x3b90('0x11'),this['syncAgentConnectPreview']['bind'](this));}function getDiff(_0x58c4d1){var _0x542cb3=moment()['milliseconds'](0x0);var _0x3a0a55=moment(_0x58c4d1)[_0x3b90('0x12')](0x0);return _0x542cb3['diff'](_0x3a0a55,'seconds');}Acw[_0x3b90('0x13')][_0x3b90('0x14')]=function(_0x381a9e){try{var _0x1af265=this;var _0x1efe01=this['channels'][_0x381a9e]['interface'];var _0xd83280=this[_0x3b90('0x15')][_0x381a9e]['queue'];var _0x269488=this[_0x3b90('0x7')][_0xd83280];var _0x11ad7d=![];var _0x131f3f='ACW';if(_0x269488[_0x3b90('0x16')]){if(_0x269488['mandatoryDispositionPause'][_0x3b90('0x17')]){_0x11ad7d=!![];_0x131f3f=_0x269488[_0x3b90('0x18')]['name'];}}ami[_0x3b90('0x19')]({'action':_0x3b90('0x1a'),'interface':_0x1efe01,'paused':!![],'reason':_0x131f3f})[_0x3b90('0x1b')](function(_0x3ce411){if(_0x1af265[_0x3b90('0x8')][_0x1efe01]){return RpcUser[_0x3b90('0x1c')](_0x1af265[_0x3b90('0x8')][_0x1efe01]['id'])[_0x3b90('0x1b')](function(_0xa98414){if(_0xa98414&&!_0xa98414[_0x3b90('0x1d')]){logger['info'](_0x3b90('0x1e'),_0x381a9e,_0x1efe01,_0xd83280);var _0x36b93e=_0x1af265[_0x3b90('0x15')][_0x381a9e][_0x3b90('0x1f')]&&_0x1af265[_0x3b90('0x15')][_0x381a9e][_0x3b90('0x20')]?_0x1af265['channels'][_0x381a9e]['destlinkedid']:_0x381a9e;return RpcUser[_0x3b90('0x21')](_0x1af265[_0x3b90('0x8')][_0x1efe01],_0x131f3f,_0x36b93e)[_0x3b90('0x1b')](function(_0x2ffa1a){if(!_0x11ad7d){_0x1af265['timers'][_0x1efe01]={};logger[_0x3b90('0x22')](_0x3b90('0x23'),_0x381a9e,_0x1af265[_0x3b90('0x7')][_0xd83280]['acwTimeout'],_0x1efe01,_0xd83280);_0x1af265[_0x3b90('0x9')][_0x1efe01][_0x3b90('0x24')]=setTimeout(_0x1af265[_0x3b90('0x25')][_0x3b90('0xc')](_0x1af265,_0x1efe01),_0x1af265[_0x3b90('0x7')][_0xd83280][_0x3b90('0x26')]*0x3e8);_0x1af265['timers'][_0x1efe01][_0x3b90('0x27')]=moment()['format'](_0x3b90('0x28'));_0x1af265[_0x3b90('0x9')][_0x1efe01][_0x3b90('0x29')]=_0x381a9e;_0x1af265[_0x3b90('0x9')][_0x1efe01][_0x3b90('0x2a')]=_0xd83280;_0x1af265[_0x3b90('0x9')][_0x1efe01][_0x3b90('0x2b')]=function(){var _0x2430ec=getDiff(_0x1af265['timers'][_0x1efe01]['lastPauseAt']);clearTimeout(_0x1af265[_0x3b90('0x9')][_0x1efe01][_0x3b90('0x24')]);_0x1af265[_0x3b90('0x9')][_0x1efe01][_0x3b90('0x24')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x2430ec},_0x1af265['timers'][_0x1efe01][_0x3b90('0x29')],_0x1efe01)[_0x3b90('0x1b')](function(_0x24d5c9){logger['info'](_0x3b90('0x2c'),_0x381a9e,_0x2430ec,_0x24d5c9);})['catch'](function(_0x49b4d2){logger[_0x3b90('0x2d')](_0x3b90('0x2e'),_0x381a9e,_0x49b4d2);});delete _0x1af265['timers'][_0x1efe01];};}});}else{logger[_0x3b90('0x22')](_0x3b90('0x2f'),_0x381a9e,_0x1efe01,_0xd83280);}});}})[_0x3b90('0x30')](function(_0x562882){logger['error'](_0x3b90('0x23'),_0x381a9e,_0x1af265[_0x3b90('0x7')][_0xd83280][_0x3b90('0x26')],_0x1efe01,_0xd83280);})[_0x3b90('0x31')](function(){delete _0x1af265['channels'][_0x381a9e];});}catch(_0x5a97fe){logger[_0x3b90('0x2d')](_0x3b90('0x32'),_0x5a97fe['message']);}};Acw['prototype'][_0x3b90('0x25')]=function(_0x146bc7){try{var _0x20416d=this;if(_0x20416d[_0x3b90('0x9')][_0x146bc7]){_0x20416d['timers'][_0x146bc7][_0x3b90('0x24')]=![];var _0x583842=_0x20416d[_0x3b90('0x9')][_0x146bc7][_0x3b90('0x29')];var _0x2355bf=_0x20416d[_0x3b90('0x9')][_0x146bc7][_0x3b90('0x2a')];var _0x3bf148=_0x20416d[_0x3b90('0x7')][_0x2355bf]['acwTimeout'];logger[_0x3b90('0x22')](_0x3b90('0x33'),_0x146bc7);RpcUser[_0x3b90('0x34')](this[_0x3b90('0x8')][_0x146bc7]);RpcVoiceAgentReport[_0x3b90('0x35')]({'acwtime':_0x3bf148,'agentacw':!![]},_0x583842,_0x146bc7)[_0x3b90('0x1b')](function(_0x63c44e){logger[_0x3b90('0x22')](_0x3b90('0x2c'),_0x583842,_0x3bf148,_0x63c44e);})['catch'](function(_0x369d0d){logger[_0x3b90('0x2d')](_0x3b90('0x2e'),_0x583842,_0x369d0d);});}else{logger[_0x3b90('0x2d')](_0x3b90('0x36'),_0x146bc7);if(_0x20416d[_0x3b90('0x9')]){logger[_0x3b90('0x22')](_0x3b90('0x37'),JSON[_0x3b90('0x38')](_0x20416d[_0x3b90('0x9')]));}}}catch(_0x47592a){logger[_0x3b90('0x2d')](_0x3b90('0x39'),_0x47592a[_0x3b90('0x3a')]);}};Acw[_0x3b90('0x13')][_0x3b90('0xb')]=function(_0x3a27cf){try{if(this[_0x3b90('0x7')][_0x3a27cf[_0x3b90('0x2a')]]&&(this[_0x3b90('0x7')][_0x3a27cf[_0x3b90('0x2a')]]['acw']||this[_0x3b90('0x7')][_0x3a27cf[_0x3b90('0x2a')]][_0x3b90('0x16')])){if(this[_0x3b90('0x8')][_0x3a27cf['interface']]){this[_0x3b90('0x15')][_0x3a27cf['uniqueid']]={'queue':_0x3a27cf['queue'],'interface':_0x3a27cf[_0x3b90('0x3b')],'destlinkedid':_0x3a27cf[_0x3b90('0x20')]};}}}catch(_0x49187d){logger[_0x3b90('0x2d')](_0x3b90('0x3c'),_0x49187d[_0x3b90('0x3a')]);}};Acw[_0x3b90('0x13')][_0x3b90('0x3d')]=function(_0x3fd5a1){try{if(this[_0x3b90('0x7')][_0x3fd5a1[_0x3b90('0x2a')]]&&(this[_0x3b90('0x7')][_0x3fd5a1['queue']][_0x3b90('0x4')]||this[_0x3b90('0x7')][_0x3fd5a1['queue']][_0x3b90('0x16')])){if(this[_0x3b90('0x8')][_0x3fd5a1[_0x3b90('0x3b')]]){this[_0x3b90('0x15')][_0x3fd5a1[_0x3b90('0x29')]]={'queue':_0x3fd5a1['queue'],'interface':_0x3fd5a1['interface']};}}}catch(_0x4034a3){logger['error'](_0x3b90('0x3e'),_0x4034a3[_0x3b90('0x3a')]);}};Acw[_0x3b90('0x13')][_0x3b90('0x3f')]=function(_0x177234){try{if(this['channels'][_0x177234['uniqueid']]&&_[_0x3b90('0x40')](this[_0x3b90('0x15')][_0x177234[_0x3b90('0x29')]]['attended'])){logger[_0x3b90('0x22')](_0x3b90('0x41'),_0x177234[_0x3b90('0x29')]);this[_0x3b90('0x14')](_0x177234[_0x3b90('0x29')]);}else if(this[_0x3b90('0x15')][_0x177234[_0x3b90('0x42')]]&&_[_0x3b90('0x40')](this[_0x3b90('0x15')][_0x177234['linkedid']][_0x3b90('0x1f')])){logger[_0x3b90('0x22')](_0x3b90('0x43'),_0x177234['linkedid']);this[_0x3b90('0x14')](_0x177234['linkedid']);}}catch(_0x288fbb){logger[_0x3b90('0x2d')](_0x3b90('0x44'),_0x288fbb['message']);}};Acw[_0x3b90('0x13')][_0x3b90('0x45')]=function(_0x5334b5){try{if(this['channels'][_0x5334b5[_0x3b90('0x29')]]&&this[_0x3b90('0x15')][_0x5334b5[_0x3b90('0x29')]][_0x3b90('0x1f')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x5334b5[_0x3b90('0x29')]);this[_0x3b90('0x14')](_0x5334b5[_0x3b90('0x29')]);}else if(this[_0x3b90('0x15')][_0x5334b5[_0x3b90('0x42')]]&&this[_0x3b90('0x15')][_0x5334b5[_0x3b90('0x42')]][_0x3b90('0x1f')]){logger[_0x3b90('0x22')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x5334b5[_0x3b90('0x42')]);this[_0x3b90('0x14')](_0x5334b5['linkedid']);}}catch(_0x1d211a){logger[_0x3b90('0x2d')]('[ACW][syncHangup]\x20%s',_0x1d211a[_0x3b90('0x3a')]);}};Acw[_0x3b90('0x13')][_0x3b90('0xf')]=function(_0x1bada9){try{if(!_[_0x3b90('0x46')](this[_0x3b90('0x15')][_0x1bada9[_0x3b90('0x47')]])){this['startAcw'](_0x1bada9[_0x3b90('0x47')]);if(this[_0x3b90('0x15')][_0x1bada9[_0x3b90('0x48')]]){this[_0x3b90('0x15')][_0x1bada9[_0x3b90('0x48')]][_0x3b90('0x1f')]=!![];this[_0x3b90('0x15')][_0x1bada9[_0x3b90('0x49')]]=this[_0x3b90('0x15')][_0x1bada9[_0x3b90('0x48')]];delete this[_0x3b90('0x15')][_0x1bada9[_0x3b90('0x48')]];}}else if(!_[_0x3b90('0x46')](this[_0x3b90('0x15')][_0x1bada9[_0x3b90('0x49')]])){this['startAcw'](_0x1bada9[_0x3b90('0x49')]);if(this['channels'][_0x1bada9[_0x3b90('0x4a')]]){this[_0x3b90('0x15')][_0x1bada9[_0x3b90('0x4a')]][_0x3b90('0x1f')]=!![];this[_0x3b90('0x15')][_0x1bada9[_0x3b90('0x47')]]=this['channels'][_0x1bada9[_0x3b90('0x4a')]];delete this[_0x3b90('0x15')][_0x1bada9[_0x3b90('0x4a')]];}}}catch(_0x8e1229){logger[_0x3b90('0x2d')](_0x3b90('0x4b'),_0x8e1229['message']);}};Acw[_0x3b90('0x13')][_0x3b90('0x10')]=function(_0xb41920){try{if(this['channels'][_0xb41920[_0x3b90('0x4c')]]){logger[_0x3b90('0x22')](_0x3b90('0x4d'),JSON[_0x3b90('0x38')](_0xb41920[_0x3b90('0x4c')]));this[_0x3b90('0x14')](_0xb41920[_0x3b90('0x4c')]);}else if(this[_0x3b90('0x15')][_0xb41920[_0x3b90('0x4e')]]){logger['info'](_0x3b90('0x4f'),JSON['stringify'](_0xb41920['transfererlinkedid']));this[_0x3b90('0x14')](_0xb41920[_0x3b90('0x4e')]);}}catch(_0x52c099){logger[_0x3b90('0x2d')](_0x3b90('0x50'),_0x52c099[_0x3b90('0x3a')]);}};Acw[_0x3b90('0x13')][_0x3b90('0xe')]=function(_0x260de4){try{if(this[_0x3b90('0x7')][_0x260de4['queue']]&&this['voiceQueues'][_0x260de4[_0x3b90('0x2a')]]['autopause']===_0x3b90('0x51')){if(this['agents'][_0x260de4[_0x3b90('0x3b')]]){logger['info']('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x260de4['uniqueid'],_0x260de4[_0x3b90('0x3b')],_0x260de4[_0x3b90('0x2a')]);return RpcUser[_0x3b90('0x21')](this[_0x3b90('0x8')][_0x260de4[_0x3b90('0x3b')]],_0x3b90('0x52'),_0x260de4[_0x3b90('0x29')]);}}}catch(_0x490fd1){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0x490fd1[_0x3b90('0x3a')]);}};module[_0x3b90('0x53')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 8e8eed7..0bfb23e 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 _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 +var _0xeb62=['connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','resolve','then','actionSipPeerStatus','actionQueueSummary','log','close','asterisk-manager','bluebird','moment','util','lodash','../../config/logger','../../config/environment','port','asterisk','username','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','actionDeviceStateList','devicestatelist','sippeerstatus','coreshowchannels','info','once'];(function(_0x6030e6,_0x5ef878){var _0x433894=function(_0x2cef40){while(--_0x2cef40){_0x6030e6['push'](_0x6030e6['shift']());}};_0x433894(++_0x5ef878);}(_0xeb62,0x1f3));var _0x2eb6=function(_0x38d8f0,_0x178e91){_0x38d8f0=_0x38d8f0-0x0;var _0x502691=_0xeb62[_0x38d8f0];return _0x502691;};'use strict';var Manager=require(_0x2eb6('0x0'));var BPromise=require(_0x2eb6('0x1'));var moment=require(_0x2eb6('0x2'));var util=require(_0x2eb6('0x3'));var _=require(_0x2eb6('0x4'));var logger=require(_0x2eb6('0x5'))('ami');var config=require(_0x2eb6('0x6'));var ami=new Manager(config['asterisk'][_0x2eb6('0x7')],config[_0x2eb6('0x8')]['ip'],config['asterisk'][_0x2eb6('0x9')],config[_0x2eb6('0x8')]['password'],!![]);ami[_0x2eb6('0xa')]();ami[_0x2eb6('0xb')]=BPromise[_0x2eb6('0xc')](ami[_0x2eb6('0xd')]);function error(_0x5617ce){logger[_0x2eb6('0xe')](util[_0x2eb6('0xf')](_0x2eb6('0x10'),config[_0x2eb6('0x8')]['username'],config[_0x2eb6('0x8')]['ip'],config[_0x2eb6('0x8')][_0x2eb6('0x7')],util[_0x2eb6('0x11')](_0x5617ce,![],null)));}function close(){logger['error'](util[_0x2eb6('0xf')](_0x2eb6('0x12'),config[_0x2eb6('0x8')][_0x2eb6('0x9')],config[_0x2eb6('0x8')]['ip'],config['asterisk'][_0x2eb6('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x2eb6('0xb')]({'action':_0x2eb6('0x13')});};};ami[_0x2eb6('0x14')]=function(){return function(){return ami[_0x2eb6('0xb')]({'action':_0x2eb6('0x15')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x2eb6('0xb')]({'action':_0x2eb6('0x16')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x2eb6('0xb')]({'action':'queuesummary'});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x2eb6('0xb')]({'action':_0x2eb6('0x17')});};};function connect(_0x158455){logger[_0x2eb6('0x18')](util[_0x2eb6('0xf')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x2eb6('0x8')]['username'],config[_0x2eb6('0x8')]['ip'],config[_0x2eb6('0x8')][_0x2eb6('0x7')]));ami[_0x2eb6('0x19')]('error',error);ami['once']('close',close);}ami['on'](_0x2eb6('0x1a'),connect);ami['on'](_0x2eb6('0x1b'),function(_0x596f63){logger[_0x2eb6('0x18')](util[_0x2eb6('0xf')](_0x2eb6('0x1c'),config['asterisk'][_0x2eb6('0x9')],config[_0x2eb6('0x8')]['ip'],config[_0x2eb6('0x8')]['port'],util[_0x2eb6('0x11')](_0x596f63,![],null)));});ami['on']('fullybooted',function(_0x28ba02){logger[_0x2eb6('0x18')](util[_0x2eb6('0xf')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x2eb6('0x8')][_0x2eb6('0x9')],config[_0x2eb6('0x8')]['ip'],config[_0x2eb6('0x8')][_0x2eb6('0x7')]));return BPromise[_0x2eb6('0x1d')]()[_0x2eb6('0x1e')](ami['actionSipShowRegistry']())['then'](ami[_0x2eb6('0x14')]())[_0x2eb6('0x1e')](ami[_0x2eb6('0x1f')]())[_0x2eb6('0x1e')](ami[_0x2eb6('0x20')]())[_0x2eb6('0x1e')](ami['actionCoreShowChannels']())['catch'](function(_0x10bcd4){console[_0x2eb6('0x21')](_0x10bcd4);});});ami[_0x2eb6('0x19')]('error',error);ami[_0x2eb6('0x19')](_0x2eb6('0x22'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index bfc5485..5ed27c6 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 _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 +var _0xc179=['http','Request','request','then','debug','rpc','error','message','result','catch','memberReport','exports','jayson/promise','bluebird','../../config/logger','ami','client'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xc179,0x171));var _0x9c17=function(_0x40453a,_0x1ff061){_0x40453a=_0x40453a-0x0;var _0x2da74d=_0xc179[_0x40453a];return _0x2da74d;};'use strict';var jayson=require(_0x9c17('0x0'));var BPromise=require(_0x9c17('0x1'));var logger=require(_0x9c17('0x2'))(_0x9c17('0x3'));var client=jayson[_0x9c17('0x4')][_0x9c17('0x5')]({'port':0x2329});client[_0x9c17('0x6')]=function(_0x25f619,_0xaf4923){return new BPromise(function(_0x2a2773,_0x243aa0){return client[_0x9c17('0x7')](_0x25f619,_0xaf4923)[_0x9c17('0x8')](function(_0x4284a3){logger[_0x9c17('0x9')](_0x9c17('0xa'),'memberReport',_0x25f619,_0xaf4923,_0x4284a3);if(_0x4284a3['error']){logger[_0x9c17('0xb')](_0x9c17('0xa'),'memberReport',_0x25f619,_0x4284a3[_0x9c17('0xb')][_0x9c17('0xc')],_0xaf4923);return _0x243aa0(_0x4284a3[_0x9c17('0xb')][_0x9c17('0xc')]);}else{return _0x2a2773(_0x4284a3[_0x9c17('0xd')]);}})[_0x9c17('0xe')](function(_0x3f338c){logger[_0x9c17('0xb')](_0x9c17('0xa'),_0x9c17('0xf'),_0x25f619,_0x3f338c,_0xaf4923);return _0x243aa0(_0x3f338c);});});};module[_0x9c17('0x10')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 00dad58..7e2a7be 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 _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 +var _0x6554=['moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','number','active','type','dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','CampaignId','idHopper','ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','prototype','queue','exports','util','lodash'];(function(_0x58c50e,_0x573495){var _0x4a8199=function(_0x2f237c){while(--_0x2f237c){_0x58c50e['push'](_0x58c50e['shift']());}};_0x4a8199(++_0x573495);}(_0x6554,0x181));var _0x4655=function(_0x58d6ac,_0x3c9aff){_0x58d6ac=_0x58d6ac-0x0;var _0x41fbdb=_0x6554[_0x58d6ac];return _0x41fbdb;};'use strict';var util=require(_0x4655('0x0'));var _=require(_0x4655('0x1'));var moment=require(_0x4655('0x2'));function checkNameSurname(_0x1c9a68,_0x175a7a,_0x2247d8){var _0x44d586='';if(!_[_0x4655('0x3')](_0x175a7a)&&_0x4655('0x4')===typeof _0x175a7a){_0x44d586+=_0x175a7a;}if(!_[_0x4655('0x3')](_0x2247d8)&&_0x4655('0x4')===typeof _0x2247d8){_0x44d586+='\x20'+_0x2247d8;}if(_0x44d586!==''){return _0x44d586;}return _0x1c9a68;}function Action(_0x139557,_0x48ba0c,_0x23df55){this[_0x4655('0x5')]=_0x139557;this[_0x4655('0x6')]=_0x23df55||undefined;this[_0x4655('0x7')]=checkNameSurname(_0x48ba0c[_0x4655('0x8')][_0x4655('0x9')],_0x48ba0c[_0x4655('0x8')][_0x4655('0xa')],_0x48ba0c[_0x4655('0x8')]['lastName']);this[_0x4655('0xb')]=_0x48ba0c[_0x4655('0x8')]['phone'];this['queue']=_0x139557['name'];this[_0x4655('0xc')]=_0x48ba0c[_0x4655('0xc')]||![];this[_0x4655('0xd')]=_0x139557[_0x4655('0xd')];this[_0x4655('0xe')]=_0x139557[_0x4655('0xe')]||0x3;this['scheduledat']=_0x48ba0c['scheduledat'];this[_0x4655('0xf')]=_0x48ba0c[_0x4655('0xf')];this[_0x4655('0x10')]=_0x48ba0c[_0x4655('0x10')];this[_0x4655('0x11')]=_0x48ba0c[_0x4655('0x11')];this[_0x4655('0x12')]=_0x48ba0c[_0x4655('0x12')];this[_0x4655('0x13')]=_0x48ba0c['countdropretry'];this[_0x4655('0x14')]=_0x48ba0c[_0x4655('0x14')];this['countmachineretry']=_0x48ba0c[_0x4655('0x15')];this[_0x4655('0x16')]=_0x48ba0c['countagentrejectretry'];this['ContactId']=_0x48ba0c['ContactId'];this[_0x4655('0x17')]=_0x48ba0c['ListId'];this[_0x4655('0x18')]=_0x48ba0c['UserId'];this['VoiceQueueId']=_0x48ba0c['VoiceQueueId'];this[_0x4655('0x19')]=_0x48ba0c[_0x4655('0x19')];this[_0x4655('0x1a')]=_0x48ba0c['id'];this[_0x4655('0x1b')]=_0x48ba0c['Contact'][_0x4655('0xa')]||'';this[_0x4655('0x1c')]=moment()[_0x4655('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4655('0x1e')]=_0x48ba0c[_0x4655('0x1e')];this[_0x4655('0x1f')]=_0x48ba0c[_0x4655('0x1f')];this[_0x4655('0x20')]=_0x48ba0c[_0x4655('0x20')];this[_0x4655('0x21')]=_0x48ba0c['recallme'];this[_0x4655('0x22')]='';this[_0x4655('0x23')]='';}Action['prototype'][_0x4655('0x24')]=function(){return util[_0x4655('0x1d')](_0x4655('0x25'),this['name'],this[_0x4655('0x5')][_0x4655('0x26')]>0x0?this[_0x4655('0xb')][_0x4655('0x27')](this[_0x4655('0x5')][_0x4655('0x26')]):this[_0x4655('0xb')]);};Action[_0x4655('0x28')]['getQueue']=function(){return this[_0x4655('0x29')];};module[_0x4655('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 6582062..34f2794 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 _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 +var _0xd4a8=['uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','seconds','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry'];(function(_0x52d4ad,_0x25e611){var _0x34a767=function(_0x1f3daa){while(--_0x1f3daa){_0x52d4ad['push'](_0x52d4ad['shift']());}};_0x34a767(++_0x25e611);}(_0xd4a8,0x7b));var _0x8d4a=function(_0x130d34,_0xb829c2){_0x130d34=_0x130d34-0x0;var _0x3bf5d2=_0xd4a8[_0x130d34];return _0x3bf5d2;};'use strict';var util=require(_0x8d4a('0x0'));var _=require(_0x8d4a('0x1'));var moment=require(_0x8d4a('0x2'));function getSeconds(_0x41999c,_0x212326){var _0x5b15bd=moment(_0x41999c)['milliseconds'](0x0);var _0x2b65c4=moment(_0x212326)[_0x8d4a('0x3')](0x0);return _0x5b15bd['diff'](_0x2b65c4,_0x8d4a('0x4'));}function AgentComplete(_0x34b9a2,_0x1ca72e){this['state']=0x4;this[_0x8d4a('0x5')]=_0x8d4a('0x6');this[_0x8d4a('0x7')]=_0x34b9a2[_0x8d4a('0x7')];this[_0x8d4a('0x8')]=_0x34b9a2['type'];this[_0x8d4a('0x9')]=_0x34b9a2['type']===_0x8d4a('0xa')?_0x8d4a('0xb'):_0x34b9a2[_0x8d4a('0x8')];this[_0x8d4a('0xc')]=_0x34b9a2[_0x8d4a('0xc')];this['countcongestionretry']=_0x34b9a2[_0x8d4a('0xd')];this[_0x8d4a('0xe')]=_0x34b9a2[_0x8d4a('0xe')];this[_0x8d4a('0xf')]=_0x34b9a2['countbusyretry']+_0x34b9a2[_0x8d4a('0xd')]+_0x34b9a2['countnoanswerretry']+_0x34b9a2[_0x8d4a('0x10')]+_0x34b9a2['countdropretry']+_0x34b9a2['countabandonedretry']+_0x34b9a2[_0x8d4a('0x11')]+_0x34b9a2[_0x8d4a('0x12')];this[_0x8d4a('0x10')]=_0x34b9a2[_0x8d4a('0x10')];this['countdropretry']=_0x34b9a2[_0x8d4a('0x13')];this[_0x8d4a('0x14')]=_0x34b9a2[_0x8d4a('0x14')];this[_0x8d4a('0x11')]=_0x34b9a2[_0x8d4a('0x11')];this[_0x8d4a('0x12')]=_0x34b9a2[_0x8d4a('0x12')];this[_0x8d4a('0x15')]=_0x1ca72e[_0x8d4a('0x15')];this[_0x8d4a('0x16')]=_0x34b9a2[_0x8d4a('0x17')];this[_0x8d4a('0x18')]=_0x34b9a2[_0x8d4a('0x19')];this[_0x8d4a('0x1a')]=_0x34b9a2['starttime'];this[_0x8d4a('0x1b')]=_0x34b9a2[_0x8d4a('0x1b')];this[_0x8d4a('0x1c')]=_0x34b9a2[_0x8d4a('0x1c')];this[_0x8d4a('0x1d')]=moment()[_0x8d4a('0x1e')](_0x8d4a('0x1f'));this[_0x8d4a('0x20')]=getSeconds(_0x34b9a2[_0x8d4a('0x1b')],_0x34b9a2[_0x8d4a('0x1a')]);this[_0x8d4a('0x21')]=getSeconds(_0x34b9a2['answertime'],_0x34b9a2[_0x8d4a('0x1b')]);this[_0x8d4a('0x22')]=getSeconds(this['endtime'],_0x34b9a2['answertime']);this['queue']=_0x1ca72e[_0x8d4a('0xb')];this['membername']=_0x1ca72e[_0x8d4a('0x23')];this[_0x8d4a('0x24')]=_0x1ca72e[_0x8d4a('0x24')];this[_0x8d4a('0x25')]=_0x34b9a2[_0x8d4a('0x25')];this[_0x8d4a('0x26')]=_0x34b9a2[_0x8d4a('0x26')];this['callbackat']=_0x34b9a2[_0x8d4a('0x27')];this[_0x8d4a('0x28')]=_0x34b9a2[_0x8d4a('0x28')];this['ContactId']=_0x34b9a2[_0x8d4a('0x29')];this[_0x8d4a('0x2a')]=_0x34b9a2[_0x8d4a('0x2a')];this[_0x8d4a('0x2b')]=_0x34b9a2[_0x8d4a('0x2b')];this[_0x8d4a('0x2c')]=_0x34b9a2['VoiceQueueId'];this[_0x8d4a('0x2d')]=_0x34b9a2[_0x8d4a('0x2d')];this[_0x8d4a('0x2e')]=_0x34b9a2[_0x8d4a('0x2e')]||'';this['originatecalleridname']=_0x34b9a2[_0x8d4a('0x2f')]||'';}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 72d9c55..1ee03c2 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 _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 +var _0x27f5=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x27f5,0xf4));var _0x527f=function(_0xe89d97,_0x33e5ac){_0xe89d97=_0xe89d97-0x0;var _0x1b6e5d=_0x27f5[_0xe89d97];return _0x1b6e5d;};'use strict';var util=require('util');var _=require(_0x527f('0x0'));var moment=require(_0x527f('0x1'));function getSeconds(_0x32fff9,_0x1d15bf){var _0x845ba9=moment(_0x32fff9)[_0x527f('0x2')](0x0);var _0x28017f=moment(_0x1d15bf)[_0x527f('0x2')](0x0);return _0x845ba9[_0x527f('0x3')](_0x28017f,'seconds');}function Final(_0x380db0){this[_0x527f('0x4')]=_0x380db0[_0x527f('0x4')];this[_0x527f('0x5')]=_0x380db0[_0x527f('0x5')];this[_0x527f('0x6')]=_0x380db0[_0x527f('0x6')];this[_0x527f('0x7')]=_0x380db0[_0x527f('0x6')]===_0x527f('0x8')?'queue':_0x380db0[_0x527f('0x6')];this[_0x527f('0x9')]=_0x380db0['countbusyretry'];this['countcongestionretry']=_0x380db0['countcongestionretry'];this['countnoanswerretry']=_0x380db0[_0x527f('0xa')];this[_0x527f('0xb')]=_0x380db0['countbusyretry']+_0x380db0[_0x527f('0xc')]+_0x380db0['countnoanswerretry']+_0x380db0[_0x527f('0xd')]+_0x380db0[_0x527f('0xe')]+_0x380db0['countabandonedretry']+_0x380db0[_0x527f('0xf')]+_0x380db0[_0x527f('0x10')];this['countnosuchnumberretry']=_0x380db0[_0x527f('0xd')];this['countdropretry']=_0x380db0[_0x527f('0xe')];this['countabandonedretry']=_0x380db0[_0x527f('0x11')];this[_0x527f('0xf')]=_0x380db0[_0x527f('0xf')];this[_0x527f('0x10')]=_0x380db0['countagentrejectretry'];this[_0x527f('0x12')]=_0x380db0['queue'];this[_0x527f('0x13')]=_0x380db0[_0x527f('0x13')];this[_0x527f('0x14')]=_0x380db0['calleridnum'];this[_0x527f('0x15')]=_0x380db0[_0x527f('0x15')];this['responsetime']=_0x380db0[_0x527f('0x16')];this[_0x527f('0x17')]=_0x380db0['responsetime'];this[_0x527f('0x18')]=_0x380db0[_0x527f('0x18')]||0x0;this['holdtime']=_0x380db0[_0x527f('0x19')]||0x0;this[_0x527f('0x1a')]=_0x380db0[_0x527f('0x1a')]||0x0;this[_0x527f('0x1b')]=_0x380db0['callback'];this[_0x527f('0x1c')]=_0x380db0['callbackuniqueid'];this[_0x527f('0x1d')]=_0x380db0[_0x527f('0x1d')];this[_0x527f('0x1e')]=_0x380db0['recallme'];this[_0x527f('0x1f')]=_0x380db0[_0x527f('0x1f')];this[_0x527f('0x20')]=_0x380db0[_0x527f('0x20')];this[_0x527f('0x21')]=_0x380db0[_0x527f('0x21')];this[_0x527f('0x22')]=_0x380db0[_0x527f('0x22')];this['CampaignId']=_0x380db0[_0x527f('0x23')];this[_0x527f('0x24')]=_0x380db0['originatecalleridnum']||'';this[_0x527f('0x25')]=_0x380db0[_0x527f('0x25')]||'';}module[_0x527f('0x26')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index a49f4c3..4d2f1f0 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 _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 +var _0x2c19=['name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','milliseconds','seconds','state','statedesc','Answer','scheduledat','campaigntype','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname'];(function(_0x55b25d,_0x5758d8){var _0x459162=function(_0x21774d){while(--_0x21774d){_0x55b25d['push'](_0x55b25d['shift']());}};_0x459162(++_0x5758d8);}(_0x2c19,0x118));var _0x92c1=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x2c19[_0x376b45];return _0x2341b3;};'use strict';var util=require(_0x92c1('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x2be165,_0x2f6ddc){var _0x2c1ae5=moment(_0x2be165)['milliseconds'](0x0);var _0x3ae84e=moment(_0x2f6ddc)[_0x92c1('0x1')](0x0);return _0x2c1ae5['diff'](_0x3ae84e,_0x92c1('0x2'));}function Hangup(_0x17e1b2,_0x135b49){this[_0x92c1('0x3')]=0x4;this[_0x92c1('0x4')]=_0x92c1('0x5');this[_0x92c1('0x6')]=_0x17e1b2['scheduledat'];this['type']=_0x17e1b2['type'];this[_0x92c1('0x7')]=_0x17e1b2[_0x92c1('0x8')]===_0x92c1('0x9')?_0x92c1('0xa'):_0x17e1b2[_0x92c1('0x8')];this[_0x92c1('0xb')]=_0x17e1b2[_0x92c1('0xb')];this[_0x92c1('0xc')]=_0x17e1b2[_0x92c1('0xc')];this['countnoanswerretry']=_0x17e1b2[_0x92c1('0xd')];this['countglobal']=_0x17e1b2['countbusyretry']+_0x17e1b2[_0x92c1('0xc')]+_0x17e1b2[_0x92c1('0xd')]+_0x17e1b2[_0x92c1('0xe')]+_0x17e1b2[_0x92c1('0xf')]+_0x17e1b2['countabandonedretry']+_0x17e1b2[_0x92c1('0x10')]+_0x17e1b2[_0x92c1('0x11')];this[_0x92c1('0xe')]=_0x17e1b2['countnosuchnumberretry'];this[_0x92c1('0xf')]=_0x17e1b2[_0x92c1('0xf')];this[_0x92c1('0x12')]=_0x17e1b2[_0x92c1('0x12')];this[_0x92c1('0x10')]=_0x17e1b2[_0x92c1('0x10')];this[_0x92c1('0x11')]=_0x17e1b2[_0x92c1('0x11')];this['uniqueid']=_0x135b49[_0x92c1('0x13')];this[_0x92c1('0x14')]=_0x17e1b2[_0x92c1('0x15')];this[_0x92c1('0x16')]=_0x17e1b2[_0x92c1('0x17')];this['starttime']=_0x17e1b2[_0x92c1('0x18')];this[_0x92c1('0x19')]=_0x17e1b2['responsetime'];this[_0x92c1('0x1a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x92c1('0x1b')]=getSeconds(_0x17e1b2['responsetime'],_0x17e1b2['starttime']);this[_0x92c1('0x1c')]=0x0;this['talktime']=getSeconds(this['endtime'],_0x17e1b2[_0x92c1('0x19')]);this['queue']=_0x17e1b2[_0x92c1('0xa')];this[_0x92c1('0x1d')]=_0x92c1('0x1e');this[_0x92c1('0x1f')]=_0x135b49[_0x92c1('0x20')];this[_0x92c1('0x21')]=_0x17e1b2['callback'];this[_0x92c1('0x22')]=_0x17e1b2['callbackuniqueid'];this['callbackat']=_0x17e1b2[_0x92c1('0x23')];this['recallme']=_0x17e1b2[_0x92c1('0x24')];this['ContactId']=_0x17e1b2[_0x92c1('0x25')];this[_0x92c1('0x26')]=_0x17e1b2[_0x92c1('0x26')];this[_0x92c1('0x27')]=_0x17e1b2[_0x92c1('0x27')];this[_0x92c1('0x28')]=_0x17e1b2[_0x92c1('0x28')];this['CampaignId']=_0x17e1b2[_0x92c1('0x29')];}module[_0x92c1('0x2a')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index c503ddb..1e6d506 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 _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 +var _0xfb0e=['CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','name','calleridnum','number','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x573973,_0x58f5a4){var _0x1f0689=function(_0x12449b){while(--_0x12449b){_0x573973['push'](_0x573973['shift']());}};_0x1f0689(++_0x58f5a4);}(_0xfb0e,0x13c));var _0xefb0=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xfb0e[_0x3a6efd];return _0x487b9a;};'use strict';var util=require(_0xefb0('0x0'));var _=require(_0xefb0('0x1'));var moment=require(_0xefb0('0x2'));function getSeconds(_0x2e2f42,_0x223c4f){var _0x299e43=moment(_0x2e2f42)[_0xefb0('0x3')](0x0);var _0x1de224=moment(_0x223c4f)[_0xefb0('0x3')](0x0);return _0x299e43['diff'](_0x1de224,_0xefb0('0x4'));}function History(_0x468492){this[_0xefb0('0x5')]=_0x468492[_0xefb0('0x5')];this['scheduledat']=_0x468492[_0xefb0('0x6')]||undefined;this[_0xefb0('0x7')]=_0x468492[_0xefb0('0x7')];this[_0xefb0('0x8')]=_0x468492['type']===_0xefb0('0x9')?_0xefb0('0xa'):_0x468492[_0xefb0('0x7')];this['countbusyretry']=_0x468492[_0xefb0('0xb')];this[_0xefb0('0xc')]=_0x468492['countcongestionretry'];this[_0xefb0('0xd')]=_0x468492['countnoanswerretry'];this['countglobal']=_0x468492['countbusyretry']+_0x468492[_0xefb0('0xc')]+_0x468492['countnoanswerretry']+_0x468492[_0xefb0('0xe')]+_0x468492[_0xefb0('0xf')]+_0x468492['countabandonedretry']+_0x468492[_0xefb0('0x10')]+_0x468492[_0xefb0('0x11')];this['countnosuchnumberretry']=_0x468492[_0xefb0('0xe')];this[_0xefb0('0xf')]=_0x468492[_0xefb0('0xf')];this[_0xefb0('0x12')]=_0x468492[_0xefb0('0x12')];this[_0xefb0('0x10')]=_0x468492[_0xefb0('0x10')];this[_0xefb0('0x11')]=_0x468492[_0xefb0('0x11')];this[_0xefb0('0xa')]=_0x468492['queue'];this[_0xefb0('0x13')]=_0x468492[_0xefb0('0x14')];this[_0xefb0('0x15')]=_0x468492[_0xefb0('0x16')];this['starttime']=_0x468492['starttime'];this['responsetime']=_0x468492[_0xefb0('0x17')];this['endtime']=_0x468492['responsetime'];this[_0xefb0('0x18')]=getSeconds(_0x468492[_0xefb0('0x17')],_0x468492['starttime']);this[_0xefb0('0x19')]=0x0;this[_0xefb0('0x1a')]=0x0;this[_0xefb0('0x1b')]=_0x468492[_0xefb0('0x1b')];this[_0xefb0('0x1c')]=_0x468492[_0xefb0('0x1c')];this[_0xefb0('0x1d')]=_0x468492[_0xefb0('0x1d')];this[_0xefb0('0x1e')]=_0x468492[_0xefb0('0x1e')];this['ContactId']=_0x468492[_0xefb0('0x1f')];this['ListId']=_0x468492[_0xefb0('0x20')];this[_0xefb0('0x21')]=_0x468492[_0xefb0('0x21')];this[_0xefb0('0x22')]=_0x468492[_0xefb0('0x22')];this[_0xefb0('0x23')]=_0x468492[_0xefb0('0x23')];this[_0xefb0('0x24')]=_0x468492[_0xefb0('0x24')]||'';this[_0xefb0('0x25')]=_0x468492['originatecalleridname']||'';}module[_0xefb0('0x26')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index dc39f63..cec9950 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 _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 +var _0x05c8=['outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','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','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\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','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','startProgressive','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','hasOwnProperty','originated','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','endtime','[uniqueid]','[actions]','clearZombieChannels','enqueue','isNil','Action','channel','catch','No\x20such\x20channel','[Dialer][checkChannel]','queue','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','then','checkIsBlackList','resolve','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','getContactDialerIvr','[getContactDialer]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','Success','isTrunkReachable','SIP/%s','status','reachable','unmonitored','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','statedesc','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','uniqueid','Machine','countglobal','amd','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','countbusyretry','countabandonedretry','dialGlobalMaxRetry','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','cause-txt','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','agiafterat','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','Abandoned','[syncAgentComplete][createHistory][11]','strategy','actionid','stateinterface','locked','idHopper','paused','queueStatusComplete','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','iftime\x20%s,%s','content','true','push','command','timezones','indexOf','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','checkIfTimeIntervals','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','originate','voiceQueue\x20is\x20undefine','Contact','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','outbound','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','createdAt','updatedAt','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','SIP/%s/%s%s','dialPrefix','substring','dialCutDigit','trim','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','Error','originate\x20action\x20Error','isSuccess','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialAgentRejectMaxRetry','object','entity\x20is\x20undefine','[callProgressDetecting]','NoSuchNumber','emit','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','buildObj','[syncAgentComplete][createHistory][3]','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[CatchErlangB]','erlangCallToSecond','one\x20call\x20every:','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','scheduledat','dialRecallMeTimeout','Agent','voicePause','log','Contact\x20updated','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','loggerHandler','[getContactCampaign2]','[countReScheduled]\x20','[getContactDialer2]','dialLimitQueue','tryOriginatePredictive','not_inuse','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','ivrOriginated','queueBooked','agentconnect','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','varset','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','message','NOT_ACTIVE','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','isEmpty','[ifTime][Action]','stringify','milliseconds','diff','seconds','type','available','loggedIn','pTalking','sumBillable','talking','total','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay'];(function(_0x5c9499,_0x221b1){var _0x1370d4=function(_0x2a077a){while(--_0x2a077a){_0x5c9499['push'](_0x5c9499['shift']());}};_0x1370d4(++_0x221b1);}(_0x05c8,0x1b9));var _0x805c=function(_0x276c93,_0x56a113){_0x276c93=_0x276c93-0x0;var _0x4462a3=_0x05c8[_0x276c93];return _0x4462a3;};'use strict';var util=require(_0x805c('0x0'));var _=require('lodash');var BPromise=require(_0x805c('0x1'));var uuid=require(_0x805c('0x2'));var moment=require(_0x805c('0x3'));var rr=require('rr');var md5=require(_0x805c('0x4'));var Redis=require(_0x805c('0x5'));var ut=require(_0x805c('0x6'));var config=require(_0x805c('0x7'));var logger=require(_0x805c('0x8'))('dialer');var loggerBooked=require(_0x805c('0x8'))(_0x805c('0x9'));var loggerPredictive=require('../../../config/logger')(_0x805c('0xa'));var loggerPredictiveCalls=require(_0x805c('0x8'))(_0x805c('0xb'));var loggerSyncQueueSummary=require(_0x805c('0x8'))(_0x805c('0xc'));var ami=require(_0x805c('0xd'));config[_0x805c('0xe')]=_[_0x805c('0xf')](config[_0x805c('0xe')],{'host':_0x805c('0x10'),'port':0x18eb});var io=require(_0x805c('0x11'))(new Redis(config[_0x805c('0xe')]));var cmHopper=require(_0x805c('0x12'));var cmHopperFinal=require(_0x805c('0x13'));var cmHopperHistory=require(_0x805c('0x14'));var cmHopperBlack=require(_0x805c('0x15'));var voiceQueueRt=require(_0x805c('0x16'));var Action=require('./action');var History=require(_0x805c('0x17'));var Final=require(_0x805c('0x18'));var AgentComplete=require(_0x805c('0x19'));var QueueCallerAbandon=require(_0x805c('0x1a'));var Hangup=require(_0x805c('0x1b'));var ipAgi=process[_0x805c('0x1c')][_0x805c('0x1d')]||_0x805c('0x1e');var strategy={'rrmemory':_0x805c('0x1f'),'roundrobin':_0x805c('0x20')};var Sequence=function(){};Sequence[_0x805c('0x21')]['enqueue']=function(_0x1a685b){this[_0x805c('0x22')]=this[_0x805c('0x22')]?this[_0x805c('0x22')][_0x805c('0x23')](_0x1a685b):_0x1a685b();};function Dialer(_0x33f181,_0xee5b55){this[_0x805c('0x24')]=new Sequence();this[_0x805c('0x25')]=_0xee5b55;this['voiceQueues']=_0x33f181[_0x805c('0x26')];this[_0x805c('0x27')]=_0x33f181[_0x805c('0x27')];this[_0x805c('0x28')]=_0x33f181['agents'];this['trunks']=_0x33f181[_0x805c('0x29')];this[_0x805c('0x2a')]=config[_0x805c('0x2a')]||0x2;this[_0x805c('0x2b')]={};this[_0x805c('0x2c')]={};this[_0x805c('0x2d')]={};this[_0x805c('0x2e')]={};this[_0x805c('0x2f')]={};this['startPredictive']={};this['startProgressive']={};this[_0x805c('0x30')]={};this[_0x805c('0x31')]={};this['queueBookedRR']={};ami['on'](_0x805c('0x32'),this['syncAgentConnect']['bind'](this));ami['on']('queuecallerabandon',this[_0x805c('0x33')][_0x805c('0x34')](this));ami['on'](_0x805c('0x35'),this[_0x805c('0x36')][_0x805c('0x34')](this));ami['on'](_0x805c('0x37'),this[_0x805c('0x38')]['bind'](this));ami['on'](_0x805c('0x39'),this[_0x805c('0xc')]['bind'](this));ami['on'](_0x805c('0x3a'),this[_0x805c('0x3b')][_0x805c('0x34')](this));ami['on'](_0x805c('0x3c'),this['syncNewExten'][_0x805c('0x34')](this));ami['on'](_0x805c('0x3d'),this[_0x805c('0x3e')]['bind'](this));ami['on'](_0x805c('0x3f'),this['syncQueueMember'][_0x805c('0x34')](this));ami['on'](_0x805c('0x40'),this[_0x805c('0x41')][_0x805c('0x34')](this));this[_0x805c('0x42')]();this[_0x805c('0x43')]();}function isNotNull(_0xf79b2c){return _0xf79b2c!==null&&!_[_0x805c('0x44')](_0xf79b2c);}function checkIsLoggedIn(_0x158608,_0x31526e){return function(){if(_0x31526e<=0x0){_0x158608['message']=_0x805c('0x45');throw _0x158608[_0x805c('0x46')]+_0x805c('0x47');}};}function isActive(_0x331f7d){return _0x331f7d;}function checkIsActive(_0x45ef5f,_0x5539e6){return function(){if(!isActive(_0x5539e6)){_0x45ef5f[_0x805c('0x48')]=_0x805c('0x49');throw _0x45ef5f['name']+_0x805c('0x4a');}};}function checkInterval(_0xa0cd1c){return function(){if(!isNotNull(_0xa0cd1c['Interval'])){_0xa0cd1c[_0x805c('0x48')]=_0x805c('0x4b');throw _0xa0cd1c[_0x805c('0x46')]+_0x805c('0x4c');}if(!isNotNull(_0xa0cd1c[_0x805c('0x4d')][_0x805c('0x4e')])){_0xa0cd1c[_0x805c('0x48')]=_0x805c('0x4b');throw _0xa0cd1c['name']+_0x805c('0x4c');}if(!isNotNull(_[_0x805c('0x4f')](_0xa0cd1c[_0x805c('0x4d')]['Intervals']))){_0xa0cd1c[_0x805c('0x48')]='INTERVAL_IS_NULL';throw _0xa0cd1c['name']+_0x805c('0x4c');}};}function msgResponse(_0x519e90,_0xd58ce9,_0x418da8){return{'action':_0x519e90,'response':_0xd58ce9,'message':_0x418da8,'stack':_0x418da8};}function myreject(_0xb6b4ef){return function(_0x35bd57){return _0xb6b4ef(msgResponse(_0x805c('0x50'),'Error',JSON[_0x805c('0x51')](_0x35bd57)));};}function getSeconds(_0x1f201b,_0x497be2){var _0x3c3a7f=moment(_0x1f201b)['milliseconds'](0x0);var _0x4f080c=moment(_0x497be2)[_0x805c('0x52')](0x0);return _0x3c3a7f[_0x805c('0x53')](_0x4f080c,_0x805c('0x54'));}function emit(_0x37f455,_0x274d13,_0x4088fd){io['to'](_0x37f455)['emit'](_0x274d13,_0x4088fd);}function emitVoiceQueueSummary(_0x46568b){if(_0x46568b[_0x805c('0x55')]==='outbound'){var _0x4587b6={'id':_0x46568b['id'],'name':_0x46568b['name'],'strategy':_0x46568b['strategy'],'answered':_0x46568b['answered'],'available':_0x46568b[_0x805c('0x56')],'loggedIn':_0x46568b[_0x805c('0x57')],'pTalking':_0x46568b[_0x805c('0x58')],'sumBillable':_0x46568b[_0x805c('0x59')],'sumDuration':_0x46568b['sumDuration'],'sumHoldTime':_0x46568b['sumHoldTime']||0x0,'talking':_0x46568b[_0x805c('0x5a')],'total':_0x46568b[_0x805c('0x5b')],'type':_0x46568b['type'],'unmanaged':_0x46568b['unmanaged'],'abandoned':_0x46568b[_0x805c('0x5c')],'waiting':_0x46568b[_0x805c('0x5d')],'loggedInDb':_0x46568b[_0x805c('0x5e')],'dialActive':_0x46568b[_0x805c('0x5f')],'dialMethod':_0x46568b[_0x805c('0x60')],'dialOriginateCallerIdName':_0x46568b['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x46568b[_0x805c('0x61')],'dialOriginateTimeout':_0x46568b[_0x805c('0x62')],'dialPrefix':_0x46568b['dialPrefix'],'outboundAnswerAgiCallsDay':_0x46568b[_0x805c('0x63')],'outboundAnswerCallsDay':_0x46568b[_0x805c('0x64')],'outboundBlacklistCallsDay':_0x46568b['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x46568b[_0x805c('0x65')],'outboundCongestionCallsDay':_0x46568b[_0x805c('0x66')],'outboundDropCallsDayACS':_0x46568b[_0x805c('0x67')],'outboundDropCallsDayCallersExit':_0x46568b['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x46568b['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x46568b[_0x805c('0x68')],'outboundNoSuchCallsDay':_0x46568b[_0x805c('0x69')],'outboundOriginateFailureCallsDay':_0x46568b['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x46568b['outboundReCallsDay'],'outboundRejectCallsDay':_0x46568b[_0x805c('0x6a')],'outboundUnknownCallsDay':_0x46568b[_0x805c('0x6b')],'predictiveIntervalAnsweredCalls':_0x46568b[_0x805c('0x6c')],'predictiveIntervalAvgHoldtime':_0x46568b[_0x805c('0x6d')],'predictiveIntervalAvgTalktime':_0x46568b['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x46568b[_0x805c('0x6e')],'predictiveIntervalDroppedCallsTimeout':_0x46568b[_0x805c('0x6f')],'predictiveIntervalErlangCalls':_0x46568b[_0x805c('0x70')],'predictiveIntervalErlangCallsDroppedCalls':_0x46568b[_0x805c('0x71')],'predictiveIntervalHitRate':_0x46568b[_0x805c('0x72')],'predictiveIntervalMultiplicativeFactor':_0x46568b[_0x805c('0x73')],'predictiveIntervalPauses':_0x46568b[_0x805c('0x74')],'predictiveIntervalAvailable':_0x46568b[_0x805c('0x75')],'predictiveIntervalTotalCalls':_0x46568b[_0x805c('0x76')],'message':_0x46568b[_0x805c('0x48')],'originated':_0x46568b['originated'],'erlangCalls':_0x46568b[_0x805c('0x77')],'erlangCallToSecond':_0x46568b['erlangCallToSecond'],'erlangAbandonmentRate':_0x46568b[_0x805c('0x78')],'erlangBusyFactor':_0x46568b[_0x805c('0x79')],'startPredictive':_0x46568b[_0x805c('0x7a')],'startProgressive':_0x46568b['startProgressive']};if(_0x46568b[_0x805c('0x7b')]){_0x4587b6['Trunk']={'id':_0x46568b[_0x805c('0x7b')]['id'],'name':_0x46568b[_0x805c('0x7b')][_0x805c('0x46')],'active':_0x46568b['Trunk'][_0x805c('0x7c')],'callerid':_0x46568b[_0x805c('0x7b')][_0x805c('0x7d')]};}if(_0x46568b['Interval']){_0x4587b6[_0x805c('0x4d')]={'id':_0x46568b[_0x805c('0x4d')]['id'],'name':_0x46568b[_0x805c('0x4d')][_0x805c('0x46')]};}var _0x2e0392=md5(JSON[_0x805c('0x51')](_0x4587b6));if(_0x46568b['md5']!==_0x2e0392){_0x46568b['md5']=_0x2e0392;emit(util[_0x805c('0x7e')](_0x805c('0x7f'),_0x4587b6[_0x805c('0x46')]),_0x805c('0x80'),_0x4587b6);}}}function emitCampaignSummary(_0x4c2952){if(_0x4c2952['type']===_0x805c('0x81')){emit(util[_0x805c('0x7e')](_0x805c('0x82'),_0x4c2952['name']),'campaign:save',_0x4c2952);}}function checkGetDataPredictive(_0x1677c8){if(isNotNull(_0x1677c8)){if(!_['isEmpty'](_0x1677c8)){loggerPredictive[_0x805c('0x83')](_0x805c('0x84'));loggerPredictive[_0x805c('0x83')](_0x805c('0x85'),_0x1677c8[_0x805c('0x76')]);loggerPredictive['info'](_0x805c('0x86'),_0x1677c8[_0x805c('0x6c')]);loggerPredictive[_0x805c('0x83')](_0x805c('0x87'),_0x1677c8[_0x805c('0x6f')]);loggerPredictive[_0x805c('0x83')](_0x805c('0x88'),_0x1677c8['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x805c('0x83')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1677c8['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x805c('0x83')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1677c8[_0x805c('0x89')]);loggerPredictive[_0x805c('0x83')](_0x805c('0x8a'));if(_0x1677c8[_0x805c('0x76')]>0x0){if(!_[_0x805c('0x44')](_0x1677c8[_0x805c('0x89')])&&_0x1677c8[_0x805c('0x89')]>0x0){return!![];}else{loggerPredictive[_0x805c('0x83')](_0x805c('0x8b'));}if(!_[_0x805c('0x44')](_0x1677c8['predictiveIntervalAvgHoldtime'])&&_0x1677c8[_0x805c('0x6d')]>0x0){return!![];}else{loggerPredictive[_0x805c('0x83')](_0x805c('0x8c'));}}else{loggerPredictive[_0x805c('0x83')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x805c('0x83')](_0x805c('0x8d'));}}else{loggerPredictive[_0x805c('0x83')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x23d78f){return function(_0x35dcf5){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0x805c('0x83')](_0x805c('0x8e'),_0x35dcf5['erlangCalls']);loggerPredictive[_0x805c('0x83')](_0x805c('0x8f'),_0x35dcf5['erlangCallToSecond']);loggerPredictive[_0x805c('0x83')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x35dcf5[_0x805c('0x78')]);loggerPredictive[_0x805c('0x83')](_0x805c('0x90'),_0x35dcf5[_0x805c('0x79')]);loggerPredictive[_0x805c('0x83')](_0x805c('0x91'),_0x35dcf5['erlangAbandonmentRate']);loggerPredictive[_0x805c('0x83')]('---------------------------');_[_0x805c('0x92')](_0x23d78f,_0x35dcf5);};}function getDiff(_0x23b9ea){var _0x22e7f0=moment()[_0x805c('0x52')](0x0);var _0x41558e=moment(_0x23b9ea)[_0x805c('0x52')](0x0);return _0x22e7f0['diff'](_0x41558e,_0x805c('0x54'));}function ifInterval(_0x434870,_0x4350b9){if(_[_0x805c('0x44')](_0x4350b9)){return![];}if(getDiff(_0x4350b9)<_0x434870*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x1e15b9){if(isNotNull(_0x1e15b9)){if(!_[_0x805c('0x44')](_0x1e15b9[_0x805c('0x93')])){_0x1e15b9[_0x805c('0x93')]=undefined;loggerPredictive[_0x805c('0x83')](_0x1e15b9[_0x805c('0x46')],_0x805c('0x94'));}if(!_[_0x805c('0x44')](_0x1e15b9['startPredictive'])){_0x1e15b9['startPredictive']=undefined;loggerPredictive['info'](_0x1e15b9[_0x805c('0x46')],_0x805c('0x95'));}if(!_[_0x805c('0x44')](_0x1e15b9[_0x805c('0x96')])){clearInterval(_0x1e15b9[_0x805c('0x96')]);_0x1e15b9[_0x805c('0x96')]=undefined;loggerPredictive['info'](_0x1e15b9[_0x805c('0x46')],_0x805c('0x97'));}}}function erlangb(_0x37e1f5,_0x1482f1){if(_0x1482f1===0x0){return 0x0;}var _0xc4714c=0x1;for(var _0x12df44=0x1;_0x12df44<=_0x1482f1;_0x12df44+=0x1){_0xc4714c=0x1+_0xc4714c*_0x12df44/_0x37e1f5;}return 0x1/_0xc4714c;}function isVoiceQueueOutbound(_0x37b539){return _0x37b539==='outbound';}function isNotPreview(_0x1a6409){return _0x1a6409!=='preview';}function isCampaignIvr(_0x42ab67){return _0x42ab67===_0x805c('0x81');}function getCallerId(_0x8f939f,_0x300dbe,_0x5442bd){if(!_[_0x805c('0x44')](_0x5442bd)&&'string'===typeof _0x5442bd&&!_[_0x805c('0x4f')](_0x5442bd)){if(!_[_0x805c('0x44')](_0x300dbe)&&_0x805c('0x98')===typeof _0x300dbe&&!_['isEmpty'](_0x300dbe)){return util[_0x805c('0x7e')](_0x805c('0x99'),_0x300dbe,_0x5442bd);}return util['format'](_0x805c('0x99'),_0x5442bd,_0x5442bd);}if(!_[_0x805c('0x44')](_0x8f939f)&&'string'===typeof _0x8f939f&&!_[_0x805c('0x4f')](_0x8f939f)){return _0x8f939f;}return _0x805c('0x9a');}function loggerCatchQueueSummary(_0x548503,_0x2566b7){return function(_0x4e5676){freeVariablesPredictive(_0x2566b7);emitVoiceQueueSummary(_0x2566b7);emitCampaignSummary(_0x2566b7);loggerSyncQueueSummary[_0x805c('0x9b')](_0x548503,util[_0x805c('0x9c')](_0x4e5676,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x190395,_0x348301){return function(_0x26be69){loggerPredictive['error'](_0x348301[_0x805c('0x46')],_0x190395);loggerPredictive[_0x805c('0x9b')](_0x26be69[_0x805c('0x9d')]);freeVariablesPredictive(_0x348301);};}function loggerCatch(_0x53c2f1){return function(_0x405bf8){logger[_0x805c('0x9b')](_0x53c2f1,util['inspect'](_0x405bf8,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x476916){return _0x476916&&!_[_0x805c('0x44')](_0x476916)&&_0x476916[_0x805c('0x9e')]>0x0;}function decremetOriginate(_0x247546){if(!_[_0x805c('0x44')](_0x247546)&&_0x247546!==null){if(_0x247546[_0x805c('0x9f')]('originated')){if(_0x247546[_0x805c('0xa0')]>0x0){_0x247546[_0x805c('0xa0')]-=0x1;}else{logger[_0x805c('0x9b')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x805c('0x9b')](_0x805c('0xa1'));}}function checkContactLowerLimitOriginate(_0x5b570c,_0x20fa6b,_0xd7d8ba){if(_0x20fa6b>_0xd7d8ba){for(var _0x31ecf5=0x0;_0x31ecf5<_0x20fa6b-_0xd7d8ba;_0x31ecf5+=0x1){decremetOriginate(_0x5b570c);}}}function loggerGetContactDialer(_0x4aa79f,_0x31954d,_0x371acb){return function(_0x45d943){checkContactLowerLimitOriginate(_0x31954d,_0x371acb,0x0);logger[_0x805c('0x9b')](_0x4aa79f,util['inspect'](_0x45d943,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5621a6){return function(_0x5d9ea2){if(isNotNull(_0x5d9ea2)&&isNotNull(_0x5d9ea2[0x0])){if(_0x5d9ea2[0x0][_0x805c('0xa2')]>0x0){_0x5621a6[_0x805c('0x48')]=_0x805c('0xa3');logger[_0x805c('0x83')]('[getContactDialer2][ReScheduled]'+_0x5621a6['name'],_0x5d9ea2[0x0][_0x805c('0xa2')],_0x805c('0xa4'));}else{_0x5621a6[_0x805c('0x48')]=_0x805c('0xa5');logger[_0x805c('0x83')]('[getContactDialer2][Empty]'+_0x5621a6[_0x805c('0x46')]);}}};}function notSendMessagesQueue(_0x4ba027){if(_0x4ba027['sendMessageOneNotActive']){freeVariablesPredictive(_0x4ba027);if(_0x4ba027[_0x805c('0xa0')]===0x0&&_0x4ba027[_0x805c('0x5a')]===0x0&&_0x4ba027[_0x805c('0x5d')]===0x0&&(_0x4ba027[_0x805c('0x58')]||0x0)===0x0){_0x4ba027[_0x805c('0xa6')]=![];_0x4ba027[_0x805c('0x56')]=0x0;_0x4ba027[_0x805c('0x48')]=_0x805c('0x49');loggerSyncQueueSummary[_0x805c('0x9b')](_0x805c('0xa7'),_0x4ba027[_0x805c('0x46')],_0x805c('0xa8'));}else{_0x4ba027[_0x805c('0x48')]=_0x805c('0xa9');loggerSyncQueueSummary[_0x805c('0x9b')](_0x805c('0xa7'),_0x4ba027[_0x805c('0x46')],_0x805c('0xaa'));}emitVoiceQueueSummary(_0x4ba027);}}function notSendMessagesCampaign(_0x539e61){if(_0x539e61[_0x805c('0xa6')]){if(_0x539e61[_0x805c('0xa0')]===0x0){_0x539e61[_0x805c('0xa6')]=![];_0x539e61[_0x805c('0x48')]=_0x805c('0x49');loggerSyncQueueSummary[_0x805c('0x9b')](_0x805c('0xab'),_0x539e61[_0x805c('0x46')],'is\x20not\x20active');}else{_0x539e61[_0x805c('0x48')]=_0x805c('0xa9');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x539e61[_0x805c('0x46')],'is\x20disactive');}emitCampaignSummary(_0x539e61);}}function createObjHistory(_0x3756de,_0x296e58,_0x57549c,_0x1dd325,_0x17e737){_0x3756de[_0x805c('0x48')]=_0x57549c;var _0x3516f0=new Action(_0x3756de,_0x296e58);var _0x3b09bd=new History(_0x3516f0);_0x3b09bd[_0x805c('0xac')]=_0x1dd325;_0x3b09bd['statedesc']=_0x17e737;_0x3b09bd[_0x805c('0xad')]=_0x3516f0['starttime'];return _0x3b09bd;}Dialer[_0x805c('0x21')]['loopClearZombieChannels']=function(){var _0x13f498=this;setInterval(function(){_0x13f498['clearZombieChannels'](_0x13f498[_0x805c('0x2e')],_0x805c('0xae'));_0x13f498['clearZombieChannels'](_0x13f498[_0x805c('0x2c')],_0x805c('0xaf'));},0x32c8);};Dialer[_0x805c('0x21')][_0x805c('0xb0')]=function(_0x319801,_0x4a52cb){var _0x3ec525=this;for(var _0x6a5028 in _0x319801){if(_0x319801[_0x805c('0x9f')](_0x6a5028)){this[_0x805c('0x24')][_0x805c('0xb1')](function(){if(!_[_0x805c('0xb2')](_0x319801[_0x6a5028])){return ami[_0x805c('0xb3')]({'action':'status','channel':_0x319801[_0x6a5028][_0x805c('0xb4')]})[_0x805c('0xb5')](function(_0x15f95f){if(_0x15f95f[_0x805c('0x48')]===_0x805c('0xb6')){setTimeout(function(){if(_0x319801[_0x6a5028]&&_0x319801[_0x6a5028][_0x805c('0x55')]!==_0x805c('0x81')){_0x3ec525['updateOriginated'](_0x3ec525[_0x805c('0x26')][_0x319801[_0x6a5028]['queue']]);logger[_0x805c('0x9b')](_0x805c('0xb7'),_0x4a52cb,_0x6a5028,_0x319801[_0x6a5028][_0x805c('0xb8')]);delete _0x319801[_0x6a5028];}if(_0x319801[_0x6a5028]&&_0x319801[_0x6a5028][_0x805c('0x55')]===_0x805c('0x81')){_0x3ec525[_0x805c('0xb9')](_0x3ec525[_0x805c('0x27')][_0x319801[_0x6a5028][_0x805c('0xb8')]]);logger['error'](_0x805c('0xba'),_0x4a52cb,_0x6a5028,_0x319801[_0x6a5028][_0x805c('0xb8')]);delete _0x319801[_0x6a5028];}},0x2328);}});}});}}};Dialer['prototype'][_0x805c('0xbb')]=function(_0x548775){return BPromise['resolve']()[_0x805c('0xbc')](cmHopper[_0x805c('0xbb')](_0x548775))['catch'](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x805c('0x21')][_0x805c('0xbd')]=function(_0x3372af){return BPromise[_0x805c('0xbe')]()[_0x805c('0xbc')](cmHopperBlack[_0x805c('0xbd')](_0x3372af))[_0x805c('0xb5')](loggerCatch(_0x805c('0xbf')));};Dialer['prototype'][_0x805c('0xc0')]=function(_0x28157e){return BPromise[_0x805c('0xbe')]()[_0x805c('0xbc')](cmHopperBlack['checkIsBlackListIvr'](_0x28157e))[_0x805c('0xb5')](loggerCatch(_0x805c('0xc1')));};Dialer[_0x805c('0x21')]['averageHandleTime']=function(_0x1d4e86){return BPromise[_0x805c('0xbe')]()[_0x805c('0xbc')](cmHopperHistory['avgHandleTime'](_0x1d4e86))['catch'](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0x805c('0x21')]['rescheduleContact']=function(_0x2d4627){return BPromise[_0x805c('0xbe')]()[_0x805c('0xbc')](cmHopper[_0x805c('0xc2')](_0x2d4627))[_0x805c('0xb5')](loggerCatch(_0x805c('0xc3')));};Dialer[_0x805c('0x21')][_0x805c('0xc4')]=function(_0x38bc22,_0x57cef0,_0x4e2e86){return BPromise[_0x805c('0xbe')]()[_0x805c('0xbc')](cmHopper[_0x805c('0xc4')](_0x38bc22,_0x57cef0,_0x4e2e86))[_0x805c('0xb5')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x805c('0x21')]['getContactDialer']=function(_0x4c9b16,_0x1964ad,_0x574cfe,_0x447c44){return BPromise['resolve']()[_0x805c('0xbc')](cmHopper[_0x805c('0xc5')](_0x4c9b16,_0x1964ad,_0x574cfe,_0x447c44))[_0x805c('0xb5')](loggerCatch('[getContactDialer]\x20'));};Dialer['prototype'][_0x805c('0xc6')]=function(_0x55b04c,_0x3c68c4,_0xe64826){return BPromise[_0x805c('0xbe')]()[_0x805c('0xbc')](cmHopper[_0x805c('0xc6')](_0x55b04c,_0x3c68c4,_0xe64826))['catch'](loggerCatch(_0x805c('0xc7')));};Dialer['prototype'][_0x805c('0xc8')]=function(_0x4b308c){return BPromise[_0x805c('0xbe')]()[_0x805c('0xbc')](voiceQueueRt[_0x805c('0xc8')](_0x4b308c))['catch'](loggerCatch(_0x805c('0xc9')));};Dialer['prototype']['moveContactManagedDialer']=function(_0x56be09){return BPromise[_0x805c('0xbe')]()[_0x805c('0xbc')](cmHopper[_0x805c('0xca')](_0x56be09))[_0x805c('0xb5')](loggerCatch(_0x805c('0xcb')));};Dialer[_0x805c('0x21')][_0x805c('0xcc')]=function(_0x3d84ae){return BPromise[_0x805c('0xbe')]()[_0x805c('0xbc')](cmHopperHistory[_0x805c('0xcc')](_0x3d84ae))['catch'](loggerCatch(_0x805c('0xcd')));};Dialer['prototype'][_0x805c('0xb9')]=function(_0x463cde){if(!_[_0x805c('0x44')](_0x463cde)&&_0x463cde!==null){if(_0x463cde[_0x805c('0x9f')](_0x805c('0xa0'))){if(_0x463cde[_0x805c('0xa0')]>0x0){_0x463cde[_0x805c('0xa0')]-=0x1;}else{logger[_0x805c('0x9b')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x805c('0x9b')](_0x805c('0xce'));}};Dialer['prototype']['loggerHandler']=function(_0x50df0e,_0x1ad7f4){var _0x496f1b=this;return function(_0x44494e){_0x496f1b[_0x805c('0xb9')](_0x1ad7f4);logger[_0x805c('0x9b')](_0x50df0e,util[_0x805c('0x9c')](_0x44494e,{'showHidden':![],'depth':null}));};};Dialer[_0x805c('0x21')][_0x805c('0xcf')]=function(_0x4f2ddc,_0x8ebcb8,_0x4f805f){var _0x96cddd={'state':0x19,'statedesc':_0x805c('0xd0')};this['updateOriginated'](_0x8ebcb8);this[_0x805c('0xd1')](_[_0x805c('0x92')](_0x96cddd,_[_0x805c('0xd2')](_0x4f805f,[_0x805c('0xd3'),_0x805c('0xd4'),_0x805c('0xd5'),_0x805c('0xd6'),_0x805c('0xd7')])),_0x805c('0xd8'),_0x805c('0xd9'));logger[_0x805c('0x9b')](_0x4f2ddc);};Dialer[_0x805c('0x21')]['isSuccess']=function(_0x57df6f){return _0x57df6f===_0x805c('0xda');};Dialer[_0x805c('0x21')][_0x805c('0xdb')]=function(_0xac7d3f){return!_[_0x805c('0x44')](_0xac7d3f)&&_0xac7d3f&&!_[_0x805c('0x44')](_0xac7d3f['name'])&&!_[_0x805c('0x44')](_0xac7d3f['active'])&&_0xac7d3f[_0x805c('0x7c')]&&(this['trunks'][util[_0x805c('0x7e')](_0x805c('0xdc'),_0xac7d3f[_0x805c('0x46')])][_0x805c('0xdd')]===_0x805c('0xde')||this[_0x805c('0x29')][util[_0x805c('0x7e')](_0x805c('0xdc'),_0xac7d3f['name'])][_0x805c('0xdd')]===_0x805c('0xdf'));};Dialer['prototype'][_0x805c('0xd1')]=function(_0x1f3aee,_0x110904,_0x443395){this['createHistory'](_0x1f3aee)[_0x805c('0xb5')](loggerCatch(_0x110904));this['moveContactManagedDialer'](_0x1f3aee)[_0x805c('0xb5')](loggerCatch(_0x443395));};Dialer[_0x805c('0x21')][_0x805c('0x3e')]=function(_0x230f91){var _0x5ebc4f=this['uniqueId'][_0x230f91['uniqueid']];var _0x1b8d3c;if(!_[_0x805c('0xb2')](_0x230f91)&&!_[_0x805c('0xb2')](_0x230f91[_0x805c('0xe0')])&&!_[_0x805c('0xb2')](_0x230f91[_0x805c('0xe0')][_0x805c('0xe1')])&&_0x230f91[_0x805c('0xe2')]===_0x805c('0xe3')&&_0x5ebc4f){if(_0x5ebc4f['type']!==_0x805c('0x81')&&this['voiceQueues'][_0x5ebc4f[_0x805c('0xb8')]][_0x805c('0xe4')]&&_0x230f91[_0x805c('0xe5')]===_0x805c('0xe6')){delete this[_0x805c('0x2e')][_0x230f91['uniqueid']];this[_0x805c('0xb9')](this[_0x805c('0x26')][_0x5ebc4f[_0x805c('0xb8')]]);this[_0x805c('0x26')][_0x5ebc4f['queue']][_0x805c('0x64')]+=0x1;this[_0x805c('0x26')][_0x5ebc4f[_0x805c('0xb8')]][_0x805c('0x63')]+=0x1;_0x1b8d3c=new Hangup(_0x5ebc4f,_0x230f91);_0x1b8d3c[_0x805c('0xac')]=0x12;_0x1b8d3c[_0x805c('0xe7')]=_0x805c('0xe8');_0x1b8d3c[_0x805c('0xe9')]=_0x805c('0xea');this[_0x805c('0xd1')](_0x1b8d3c,_0x805c('0xeb'),_0x805c('0xec'));}if(_0x5ebc4f[_0x805c('0x55')]!==_0x805c('0x81')&&this[_0x805c('0x26')][_0x5ebc4f['queue']][_0x805c('0xe4')]&&_0x230f91[_0x805c('0xe5')]==='MACHINE'){var _0x4f0ba3=this;return new BPromise(function(_0x5ea9de,_0x1a5668){delete _0x4f0ba3[_0x805c('0x2e')][_0x230f91[_0x805c('0xed')]];_0x4f0ba3['updateOriginated'](_0x4f0ba3[_0x805c('0x26')][_0x5ebc4f[_0x805c('0xb8')]]);_0x4f0ba3['voiceQueues'][_0x5ebc4f[_0x805c('0xb8')]][_0x805c('0x64')]+=0x1;_0x4f0ba3[_0x805c('0x26')][_0x5ebc4f[_0x805c('0xb8')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x14739d=_0x4f0ba3[_0x805c('0x26')][_0x5ebc4f[_0x805c('0xb8')]];var _0x394c2b=new Hangup(_0x5ebc4f,_0x230f91);_0x394c2b[_0x805c('0xac')]=0x13;_0x394c2b[_0x805c('0xe7')]=_0x805c('0xee');_0x394c2b[_0x805c('0xe9')]='AMD';_0x394c2b['countmachineretry']+=0x1;_0x394c2b[_0x805c('0xef')]+=0x1;_0x394c2b[_0x805c('0xf0')]=!![];_0x4f0ba3[_0x805c('0xcc')](_0x394c2b)[_0x805c('0xb5')](loggerCatch(_0x805c('0xf1')));if(_0x394c2b['countbusyretry']+_0x394c2b[_0x805c('0xf2')]+_0x394c2b[_0x805c('0xf3')]+_0x394c2b[_0x805c('0xf4')]+_0x394c2b[_0x805c('0xf5')]+_0x394c2b['countabandonedretry']+_0x394c2b[_0x805c('0xf6')]+_0x394c2b[_0x805c('0xf7')]>=_0x14739d['dialGlobalMaxRetry']){_0x4f0ba3[_0x805c('0xf8')](_0x394c2b,_0x5ea9de,_0x1a5668,_0x805c('0xf9'));}else{if(_0x394c2b['countmachineretry']>=_0x14739d[_0x805c('0xfa')]){_0x4f0ba3[_0x805c('0xfb')](_0x394c2b,_0x5ea9de,_0x1a5668,_0x805c('0xfc'));}else{_0x4f0ba3[_0x805c('0xc2')]({'active':![],'countmachineretry':_0x394c2b['countmachineretry'],'scheduledat':moment()[_0x805c('0xfd')](_0x14739d[_0x805c('0xfe')],_0x805c('0xff'))[_0x805c('0x7e')](_0x805c('0x100')),'ContactId':_0x394c2b['ContactId'],'ListId':_0x394c2b[_0x805c('0xd4')],'VoiceQueueId':_0x394c2b['VoiceQueueId']||undefined,'CampaignId':_0x394c2b[_0x805c('0xd7')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x5ea9de({'reschedule':0x1});}}});}if(_0x5ebc4f[_0x805c('0x55')]===_0x805c('0x81')&&this[_0x805c('0x27')][_0x5ebc4f['queue']]['dialAMDActive']&&_0x230f91['value']===_0x805c('0xe6')){delete this['uniqueId'][_0x230f91['uniqueid']];this[_0x805c('0xb9')](this[_0x805c('0x27')][_0x5ebc4f[_0x805c('0xb8')]]);_0x1b8d3c=new Hangup(_0x5ebc4f,_0x230f91);_0x1b8d3c[_0x805c('0xac')]=0x12;_0x1b8d3c[_0x805c('0xe7')]=_0x805c('0xe8');_0x1b8d3c[_0x805c('0xe9')]=_0x805c('0xea');this[_0x805c('0xd1')](_0x1b8d3c,_0x805c('0x101'),_0x805c('0x102'));}if(_0x5ebc4f[_0x805c('0x55')]===_0x805c('0x81')&&this[_0x805c('0x27')][_0x5ebc4f[_0x805c('0xb8')]]['dialAMDActive']&&_0x230f91['value']===_0x805c('0x103')){var _0x4f0ba3=this;return new BPromise(function(_0xf3f0c6,_0x16f668){delete _0x4f0ba3[_0x805c('0x2e')][_0x230f91['uniqueid']];_0x4f0ba3[_0x805c('0xb9')](_0x4f0ba3[_0x805c('0x27')][_0x5ebc4f[_0x805c('0xb8')]]);_0x4f0ba3[_0x805c('0x27')][_0x5ebc4f[_0x805c('0xb8')]]['outboundAnswerCallsDay']+=0x1;_0x4f0ba3[_0x805c('0x27')][_0x5ebc4f[_0x805c('0xb8')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x5591e2=_0x4f0ba3['campaigns'][_0x5ebc4f[_0x805c('0xb8')]];var _0x5d03b9=new Hangup(_0x5ebc4f,_0x230f91);_0x5d03b9[_0x805c('0xac')]=0x13;_0x5d03b9['statedesc']=_0x805c('0xee');_0x5d03b9[_0x805c('0xe9')]=_0x805c('0xea');_0x5d03b9[_0x805c('0xf6')]+=0x1;_0x5d03b9[_0x805c('0xef')]+=0x1;_0x5d03b9['amd']=!![];_0x4f0ba3[_0x805c('0xcc')](_0x5d03b9)[_0x805c('0xb5')](loggerCatch(_0x805c('0xf1')));if(_0x5d03b9[_0x805c('0x104')]+_0x5d03b9[_0x805c('0xf2')]+_0x5d03b9['countnoanswerretry']+_0x5d03b9[_0x805c('0xf4')]+_0x5d03b9['countdropretry']+_0x5d03b9[_0x805c('0x105')]+_0x5d03b9['countmachineretry']+_0x5d03b9[_0x805c('0xf7')]>=_0x5591e2[_0x805c('0x106')]){_0x4f0ba3[_0x805c('0xf8')](_0x5d03b9,_0xf3f0c6,_0x16f668,_0x805c('0xf9'));}else{if(_0x5d03b9['countmachineretry']>=_0x5591e2[_0x805c('0xfa')]){_0x4f0ba3[_0x805c('0xfb')](_0x5d03b9,_0xf3f0c6,_0x16f668,_0x805c('0xfc'));}else{_0x4f0ba3[_0x805c('0xc2')]({'active':![],'countmachineretry':_0x5d03b9[_0x805c('0xf6')],'scheduledat':moment()[_0x805c('0xfd')](_0x5591e2[_0x805c('0xfe')],_0x805c('0xff'))['format'](_0x805c('0x100')),'ContactId':_0x5d03b9[_0x805c('0xd3')],'ListId':_0x5d03b9[_0x805c('0xd4')],'VoiceQueueId':_0x5d03b9[_0x805c('0xd6')]||undefined,'CampaignId':_0x5d03b9[_0x805c('0xd7')]||undefined})['catch'](loggerCatch(_0x805c('0x107')));_0xf3f0c6({'reschedule':0x1});}}});}}};Dialer[_0x805c('0x21')][_0x805c('0x3b')]=function(_0x221729){var _0x3eeb96=this[_0x805c('0x2e')][_0x221729['uniqueid']];var _0x42781c=this;var _0x5a3d61;if(_0x3eeb96&&_0x3eeb96[_0x805c('0x55')]==='ivr'){delete this[_0x805c('0x2e')][_0x221729[_0x805c('0xed')]];this['updateOriginated'](this[_0x805c('0x27')][_0x3eeb96[_0x805c('0xb8')]]);this[_0x805c('0x27')][_0x3eeb96[_0x805c('0xb8')]][_0x805c('0x108')]+=0x1;_0x5a3d61=new Hangup(_0x3eeb96,_0x221729);this[_0x805c('0xcc')](_0x5a3d61)[_0x805c('0xb5')](loggerCatch(_0x805c('0x109')));this['moveContactManagedDialer'](_0x5a3d61)[_0x805c('0xb5')](loggerCatch(_0x805c('0x10a')));}if(_0x3eeb96&&_0x3eeb96['type']!==_0x805c('0x81')&&isNotNull(this[_0x805c('0x26')][_0x3eeb96['queue']]['dialQueueProject'])){delete this[_0x805c('0x2e')][_0x221729[_0x805c('0xed')]];this[_0x805c('0xb9')](this[_0x805c('0x26')][_0x3eeb96[_0x805c('0xb8')]]);this[_0x805c('0x26')][_0x3eeb96[_0x805c('0xb8')]][_0x805c('0x64')]+=0x1;this[_0x805c('0x26')][_0x3eeb96[_0x805c('0xb8')]][_0x805c('0x63')]+=0x1;_0x5a3d61=new Hangup(_0x3eeb96,_0x221729);_0x5a3d61['state']=0x10;_0x5a3d61[_0x805c('0xe7')]=_0x805c('0x10b');_0x5a3d61[_0x805c('0xe9')]='AGI';this['createHistory'](_0x5a3d61)[_0x805c('0xb5')](loggerCatch(_0x805c('0x109')));this['moveContactManagedDialer'](_0x5a3d61)[_0x805c('0xb5')](loggerCatch(_0x805c('0x10a')));}if(_0x3eeb96&&_0x3eeb96[_0x805c('0x55')]!==_0x805c('0x81')&&!isNotNull(this['voiceQueues'][_0x3eeb96[_0x805c('0xb8')]]['dialQueueProject'])){delete this['uniqueId'][_0x221729[_0x805c('0xed')]];this[_0x805c('0xb9')](this['voiceQueues'][_0x3eeb96[_0x805c('0xb8')]]);this['voiceQueues'][_0x3eeb96[_0x805c('0xb8')]][_0x805c('0x6b')]+=0x1;_0x5a3d61=new Hangup(_0x3eeb96,_0x221729);_0x5a3d61['state']=0xc;_0x5a3d61[_0x805c('0xe7')]=_0x221729[_0x805c('0x10c')];_0x5a3d61[_0x805c('0xe9')]='Unknow';this[_0x805c('0xcc')](_0x5a3d61)[_0x805c('0xb5')](loggerCatch(_0x805c('0x109')));this[_0x805c('0xca')](_0x5a3d61)[_0x805c('0xb5')](loggerCatch(_0x805c('0x10a')));}};Dialer[_0x805c('0x21')][_0x805c('0x38')]=function(_0x516ad0){var _0x22c320=this['uniqueId'][_0x516ad0['uniqueid']];var _0x34da06=this;if(this['voiceQueues'][_0x516ad0[_0x805c('0xb8')]]){if(_0x22c320&&_0x22c320[_0x805c('0x55')]!=='ivr'){delete this[_0x805c('0x2e')][_0x516ad0[_0x805c('0xed')]];this[_0x805c('0x26')][_0x516ad0[_0x805c('0xb8')]]['outboundAnswerCallsDay']+=0x1;var _0x23cbac=new AgentComplete(_0x22c320,_0x516ad0);if(_0x516ad0[_0x805c('0x10d')]===_0x805c('0x10e')){_0x23cbac['agiafterat']=this[_0x805c('0x26')][_0x516ad0[_0x805c('0xb8')]][_0x805c('0x10f')]&&this[_0x805c('0x26')][_0x516ad0[_0x805c('0xb8')]][_0x805c('0x110')]?moment()['format'](_0x805c('0x100')):undefined;}this[_0x805c('0xcc')](_0x23cbac)[_0x805c('0xb5')](loggerCatch(_0x805c('0x111')));this[_0x805c('0xca')](_0x23cbac)[_0x805c('0xb5')](loggerCatch(_0x805c('0x112')));}}};Dialer['prototype'][_0x805c('0x113')]=function(_0x3597b2){if(this[_0x805c('0x26')][_0x3597b2[_0x805c('0xb8')]]){if(this['uniqueId'][_0x3597b2[_0x805c('0xed')]]&&this['uniqueId'][_0x3597b2[_0x805c('0xed')]][_0x805c('0x55')]!=='ivr'){this[_0x805c('0xb9')](this[_0x805c('0x26')][_0x3597b2['queue']]);this[_0x805c('0x2e')][_0x3597b2[_0x805c('0xed')]][_0x805c('0x114')]=moment()[_0x805c('0x7e')](_0x805c('0x100'));}}};Dialer[_0x805c('0x21')][_0x805c('0x115')]=function(_0xb824d4){this[_0x805c('0xcc')](_0xb824d4)[_0x805c('0xb5')](loggerCatch(_0x805c('0x111')));this[_0x805c('0xca')](_0xb824d4)[_0x805c('0xb5')](loggerCatch(_0x805c('0x116')));};Dialer[_0x805c('0x21')][_0x805c('0x33')]=function(_0x40d8aa){var _0xc74bd5=this[_0x805c('0x2e')][_0x40d8aa[_0x805c('0xed')]];var _0x17010f=this;if(this['voiceQueues'][_0x40d8aa[_0x805c('0xb8')]]){if(_0xc74bd5&&_0xc74bd5[_0x805c('0x55')]!==_0x805c('0x81')){delete this[_0x805c('0x2e')][_0x40d8aa['uniqueid']];this[_0x805c('0xb9')](this[_0x805c('0x26')][_0x40d8aa[_0x805c('0xb8')]]);_0xc74bd5[_0x805c('0x117')]=moment()[_0x805c('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');var _0x31e331=new QueueCallerAbandon(_0xc74bd5,_0x40d8aa);if(getSeconds(_0xc74bd5[_0x805c('0x117')],_0xc74bd5['responsetime'])>=_0xc74bd5[_0x805c('0x118')]){this[_0x805c('0x26')][_0x40d8aa[_0x805c('0xb8')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x805c('0x26')][_0x40d8aa['queue']][_0x805c('0x119')]+=0x1;this[_0x805c('0x26')][_0x40d8aa[_0x805c('0xb8')]][_0x805c('0x71')]+=0x1;_0x31e331[_0x805c('0xac')]=0xa;_0x31e331['statedesc']=_0x805c('0x11a');_0x31e331[_0x805c('0x11b')]=_0x805c('0x11c');_0x31e331[_0x805c('0x11d')]=this['voiceQueues'][_0x40d8aa[_0x805c('0xb8')]]['dialQueueProject2']?moment()[_0x805c('0x7e')](_0x805c('0x100')):undefined;_0x31e331[_0x805c('0xf5')]+=0x1;_0x31e331[_0x805c('0xef')]+=0x1;if(_0x31e331['countdropretry']>=this['voiceQueues'][_0x40d8aa['queue']][_0x805c('0x11e')]){this[_0x805c('0x115')](_0x31e331);}else{this[_0x805c('0xc2')]({'active':![],'countdropretry':_0x31e331[_0x805c('0xf5')],'scheduledat':moment()[_0x805c('0xfd')](this[_0x805c('0x26')][_0x40d8aa[_0x805c('0xb8')]][_0x805c('0x11f')],'minutes')[_0x805c('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xc74bd5['ContactId'],'ListId':_0xc74bd5[_0x805c('0xd4')],'VoiceQueueId':_0xc74bd5['VoiceQueueId']||undefined,'CampaignId':_0xc74bd5[_0x805c('0xd7')]||undefined})['catch'](loggerCatch(_0x805c('0x120')));var _0x5d9e4f=new History(_0x31e331);_0x5d9e4f['state']=0xa;_0x5d9e4f[_0x805c('0xe7')]=_0x805c('0x11a');_0x5d9e4f[_0x805c('0x121')]=moment()[_0x805c('0x7e')](_0x805c('0x100'));_0x5d9e4f[_0x805c('0xad')]=_0x5d9e4f[_0x805c('0x121')];_0x5d9e4f[_0x805c('0x122')]=_0x31e331['calleridname'];_0x5d9e4f['calleridnum']=_0x31e331[_0x805c('0x123')];this[_0x805c('0xcc')](_0x5d9e4f)[_0x805c('0xb5')](loggerCatch(_0x805c('0x124')));}}else{this[_0x805c('0x26')][_0x40d8aa['queue']][_0x805c('0x6e')]+=0x1;this[_0x805c('0x26')][_0x40d8aa['queue']][_0x805c('0x125')]+=0x1;_0x31e331[_0x805c('0xac')]=0xb;_0x31e331['statedesc']='Abandoned';_0x31e331[_0x805c('0x11b')]=_0x805c('0x126');_0x31e331[_0x805c('0x105')]+=0x1;_0x31e331[_0x805c('0xef')]+=0x1;if(_0x31e331[_0x805c('0x105')]>=this[_0x805c('0x26')][_0x40d8aa[_0x805c('0xb8')]][_0x805c('0x127')]){this[_0x805c('0x115')](_0x31e331);}else{this[_0x805c('0xc2')]({'active':![],'countabandonedretry':_0x31e331[_0x805c('0x105')],'scheduledat':moment()[_0x805c('0xfd')](this[_0x805c('0x26')][_0x40d8aa[_0x805c('0xb8')]][_0x805c('0x128')],_0x805c('0xff'))[_0x805c('0x7e')](_0x805c('0x100')),'ContactId':_0xc74bd5['ContactId'],'ListId':_0xc74bd5[_0x805c('0xd4')],'VoiceQueueId':_0xc74bd5[_0x805c('0xd6')]||undefined,'CampaignId':_0xc74bd5[_0x805c('0xd7')]||undefined})['catch'](loggerCatch(_0x805c('0x129')));var _0x5d9e4f=new History(_0x31e331);_0x5d9e4f[_0x805c('0xac')]=0xb;_0x5d9e4f[_0x805c('0xe7')]=_0x805c('0x12a');_0x5d9e4f[_0x805c('0x121')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5d9e4f['endtime']=_0x5d9e4f['starttime'];_0x5d9e4f['calleridname']=_0x31e331[_0x805c('0x122')];_0x5d9e4f['calleridnum']=_0x31e331[_0x805c('0x123')];this['createHistory'](_0x5d9e4f)[_0x805c('0xb5')](loggerCatch(_0x805c('0x12b')));}}}}};Dialer[_0x805c('0x21')]['syncNewExten']=function(_0x39cd29){if(this[_0x805c('0x2c')][_0x39cd29['uniqueid']]){this[_0x805c('0x2c')][_0x39cd29[_0x805c('0xed')]][_0x805c('0xb4')]=_0x39cd29[_0x805c('0xb4')];}if(this['uniqueId'][_0x39cd29[_0x805c('0xed')]]){this[_0x805c('0x2e')][_0x39cd29[_0x805c('0xed')]][_0x805c('0xb4')]=_0x39cd29[_0x805c('0xb4')];}};Dialer[_0x805c('0x21')]['syncQueueMember']=function(_0x106ddb){if(strategy[this[_0x805c('0x26')][this[_0x805c('0x2c')][_0x106ddb['actionid']]['queue']][_0x805c('0x12c')]]===_0x805c('0x20')){if(this[_0x805c('0x2c')][_0x106ddb[_0x805c('0x12d')]]&&_[_0x805c('0xb2')](this['actions'][_0x106ddb[_0x805c('0x12d')]]['locked'])&&_0x106ddb[_0x805c('0xdd')]==='1'&&_0x106ddb['paused']==='0'){if(this[_0x805c('0x28')][_0x106ddb['stateinterface']]){if(!this[_0x805c('0x28')][_0x106ddb[_0x805c('0x12e')]][_0x805c('0x12f')]){this[_0x805c('0x28')][_0x106ddb[_0x805c('0x12e')]]['locked']=!![];this[_0x805c('0x2c')][_0x106ddb['actionid']][_0x805c('0x12f')]=!![];this[_0x805c('0x2c')][_0x106ddb[_0x805c('0x12d')]][_0x805c('0x12e')]=_0x106ddb[_0x805c('0x12e')];}}}}else if((strategy[this[_0x805c('0x26')][this['actions'][_0x106ddb[_0x805c('0x12d')]][_0x805c('0xb8')]][_0x805c('0x12c')]]||'rrmemory')==='rrmemory'){if(this[_0x805c('0x2c')][_0x106ddb[_0x805c('0x12d')]]){if(this[_0x805c('0x28')][_0x106ddb[_0x805c('0x12e')]]){this[_0x805c('0x2c')][_0x106ddb[_0x805c('0x12d')]]['stateinterface']=_0x106ddb[_0x805c('0x12e')];if(_['isNil'](this['queueBooked'][this[_0x805c('0x2c')][_0x106ddb['actionid']][_0x805c('0xb8')]])){this[_0x805c('0x31')][this['actions'][_0x106ddb[_0x805c('0x12d')]][_0x805c('0xb8')]]=[];}this['queueBooked'][this[_0x805c('0x2c')][_0x106ddb[_0x805c('0x12d')]][_0x805c('0xb8')]]['push'](_[_0x805c('0x92')](_[_0x805c('0xd2')](this['actions'][_0x106ddb[_0x805c('0x12d')]],[_0x805c('0x130'),_0x805c('0x12e')]),{'status':_0x106ddb[_0x805c('0xdd')],'paused':_0x106ddb[_0x805c('0x131')]}));}}}};function unlockQueueStatus(_0x3d077e,_0x1730fb){setTimeout(function(){if(_['isUndefined'](_0x3d077e[_0x805c('0x132')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x1730fb);}_0x3d077e[_0x805c('0x132')]=!![];loggerBooked['info'](_0x805c('0x133'),_0x1730fb,JSON[_0x805c('0x51')](_[_0x805c('0xd2')](_0x3d077e,[_0x805c('0x46'),_0x805c('0x132')])));},0x1f3);}Dialer[_0x805c('0x21')][_0x805c('0x41')]=function(_0x591d87){var _0x33df82=this;var _0x200d26=_0x33df82[_0x805c('0x26')][_0x33df82[_0x805c('0x2c')][_0x591d87[_0x805c('0x12d')]][_0x805c('0xb8')]];if(strategy[this[_0x805c('0x26')][this[_0x805c('0x2c')][_0x591d87[_0x805c('0x12d')]]['queue']][_0x805c('0x12c')]]===_0x805c('0x20')){if(this[_0x805c('0x2c')][_0x591d87[_0x805c('0x12d')]]&&this[_0x805c('0x2c')][_0x591d87[_0x805c('0x12d')]]['stateinterface']){this[_0x805c('0x25')]['run'](this[_0x805c('0x2c')][_0x591d87[_0x805c('0x12d')]][_0x805c('0x130')],this[_0x805c('0x2c')][_0x591d87[_0x805c('0x12d')]][_0x805c('0x12e')])['catch'](function(_0xa054bf){logger[_0x805c('0x9b')](_0x805c('0x134'),util[_0x805c('0x9c')](_0xa054bf,{'showHidden':![],'depth':null}));})[_0x805c('0x23')](function(){_0x33df82['updateOriginated'](_0x33df82['voiceQueues'][_0x33df82[_0x805c('0x2c')][_0x591d87[_0x805c('0x12d')]][_0x805c('0xb8')]]);_0x33df82[_0x805c('0x28')][_0x33df82[_0x805c('0x2c')][_0x591d87[_0x805c('0x12d')]][_0x805c('0x12e')]][_0x805c('0x12f')]=![];delete _0x33df82[_0x805c('0x2c')][_0x591d87[_0x805c('0x12d')]];unlockQueueStatus(_0x200d26);});}else{this[_0x805c('0xb9')](this[_0x805c('0x26')][this[_0x805c('0x2c')][_0x591d87[_0x805c('0x12d')]][_0x805c('0xb8')]]);this[_0x805c('0xc2')]({'active':![],'ContactId':this[_0x805c('0x2c')][_0x591d87[_0x805c('0x12d')]][_0x805c('0xd3')],'ListId':this[_0x805c('0x2c')][_0x591d87['actionid']][_0x805c('0xd4')],'VoiceQueueId':this[_0x805c('0x2c')][_0x591d87['actionid']][_0x805c('0xd6')]||undefined,'CampaignId':this['actions'][_0x591d87[_0x805c('0x12d')]][_0x805c('0xd7')]||undefined})[_0x805c('0xb5')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x591d87[_0x805c('0x12d')]];unlockQueueStatus(_0x200d26);}}else if((strategy[this[_0x805c('0x26')][this[_0x805c('0x2c')][_0x591d87[_0x805c('0x12d')]]['queue']]['strategy']]||'rrmemory')==='rrmemory'){var _0x1d53d0;if(this[_0x805c('0x2c')][_0x591d87[_0x805c('0x12d')]]&&!_[_0x805c('0x4f')](this[_0x805c('0x31')][this[_0x805c('0x2c')][_0x591d87['actionid']][_0x805c('0xb8')]])){if(this[_0x805c('0x135')][_0x33df82[_0x805c('0x2c')][_0x591d87['actionid']][_0x805c('0xb8')]]){this[_0x805c('0x135')][_0x33df82['actions'][_0x591d87['actionid']][_0x805c('0xb8')]]=this[_0x805c('0x135')][this[_0x805c('0x2c')][_0x591d87[_0x805c('0x12d')]][_0x805c('0xb8')]]?this[_0x805c('0x135')][this['actions'][_0x591d87[_0x805c('0x12d')]][_0x805c('0xb8')]]:this['queueBooked'][this[_0x805c('0x2c')][_0x591d87[_0x805c('0x12d')]][_0x805c('0xb8')]]?this[_0x805c('0x31')][this['actions'][_0x591d87[_0x805c('0x12d')]]['queue']]['_rr']||0x0:0x0;}this[_0x805c('0x31')][this[_0x805c('0x2c')][_0x591d87[_0x805c('0x12d')]][_0x805c('0xb8')]]['_rr']=this[_0x805c('0x135')][this['actions'][_0x591d87[_0x805c('0x12d')]]['queue']];for(var _0x1f5c1a=0x0;_0x1f5c1a=0x0?!![]:![];})[_0x805c('0xb5')](myreject(_0x2e1e0b)));}}else{_0x481ccc[_0x805c('0x151')](ami[_0x805c('0xb3')]({'action':_0x805c('0x152'),'command':util[_0x805c('0x7e')]('iftime\x20%s,%s',_0x6e59a0,!_['isUndefined'](config[_0x805c('0x153')][_0x261f28])?_0x261f28:'')})[_0x805c('0xbc')](function(_0x38201a){return _0x38201a[_0x805c('0x14f')][_0x805c('0x154')](_0x805c('0x150'))>=0x0?!![]:![];})[_0x805c('0xb5')](myreject(_0x2e1e0b)));}BPromise[_0x805c('0x155')](_0x481ccc)[_0x805c('0xbc')](function(_0x43b8a1){var _0x1ebce7=_[_0x805c('0x156')](_0x43b8a1);if(_0x1ebce7){return _0x49e917(_0x1ebce7);}else{_0x4bc1ae[_0x805c('0x48')]=_0xa71a60?_0x805c('0x157'):_0x805c('0x158');return _0x2e1e0b(msgResponse(_0x805c('0x159'),'Failure',_0x805c('0x15a')+_0xa71a60+'\x20'+_0x46b17d+'\x20Interval\x20is\x20overtime:\x20'+util[_0x805c('0x9c')](_0x6e59a0,{'showHidden':![],'depth':null})+_0x805c('0x15b')+_0x261f28));}})['catch'](function(_0x281fd0){return _0x2e1e0b(msgResponse(_0x805c('0x147'),_0x805c('0x148'),JSON[_0x805c('0x51')](_0x281fd0)));});});};Dialer['prototype']['checkDialMethod']=function(_0x7b5049){var _0x131910=this;return function(){switch(_0x7b5049[_0x805c('0x60')]){case'progressive':freeVariablesPredictive(_0x7b5049);_0x131910[_0x805c('0x15c')](_0x7b5049,0x1);break;case'power':freeVariablesPredictive(_0x7b5049);_0x131910['handlePower'](_0x7b5049,_0x7b5049[_0x805c('0x15d')]);break;case _0x805c('0xa'):_0x131910[_0x805c('0xa')](_0x7b5049);break;case'booked':freeVariablesPredictive(_0x7b5049);_0x131910[_0x805c('0x15c')](_0x7b5049,0x1);break;default:freeVariablesPredictive(_0x7b5049);logger['error'](_0x805c('0x15e'),_0x7b5049[_0x805c('0x46')],_0x805c('0x15f'));}};};Dialer['prototype'][_0x805c('0x160')]=function(_0xd7c37){var _0x21cd12=this;return function(){_0x21cd12[_0x805c('0x161')](_0xd7c37);};};Dialer[_0x805c('0x21')][_0x805c('0xc')]=function(_0x13116e){var _0x288da5=this;if(isNotPreview(_0x13116e['dialMethod'])){if(isVoiceQueueOutbound(_0x13116e[_0x805c('0x55')])&&isActive(_0x13116e['dialActive'])){_0x13116e[_0x805c('0xa6')]=!![];BPromise[_0x805c('0xbe')]()[_0x805c('0xbc')](checkIsLoggedIn(_0x13116e,_0x13116e['loggedIn']))[_0x805c('0xbc')](checkIsActive(_0x13116e,_0x13116e[_0x805c('0x5f')]))['then'](checkInterval(_0x13116e))[_0x805c('0xbc')](_0x288da5[_0x805c('0x162')](_0x13116e))[_0x805c('0xbc')](_0x288da5[_0x805c('0x146')](_0x13116e[_0x805c('0x163')],_0x13116e[_0x805c('0x164')],_0x13116e['name'],_0x13116e))[_0x805c('0xbc')](_0x288da5['checkIfTimeIntervals'](_0x13116e[_0x805c('0x4d')],_0x13116e['dialTimezone'],_0x13116e[_0x805c('0x46')],_0x13116e))[_0x805c('0xbc')](_0x288da5[_0x805c('0x165')](_0x13116e))['catch'](loggerCatchQueueSummary(_0x805c('0x166'),_0x13116e));}else{notSendMessagesQueue(_0x13116e);}}else{freeVariablesPredictive(_0x13116e);}};Dialer[_0x805c('0x21')][_0x805c('0x142')]=function(){var _0x3a64f9=this;var _0x206f14;for(var _0x5d85e7 in this[_0x805c('0x27')]){if(this[_0x805c('0x27')][_0x805c('0x9f')](_0x5d85e7)){_0x206f14=this['campaigns'][_0x5d85e7];if(isCampaignIvr(_0x206f14['type'])&&isActive(_0x206f14[_0x805c('0x7c')])){_0x206f14[_0x805c('0xa6')]=!![];BPromise['resolve']()[_0x805c('0xbc')](checkIsActive(_0x206f14,_0x206f14[_0x805c('0x7c')]))[_0x805c('0xbc')](checkInterval(_0x206f14))['then'](_0x3a64f9[_0x805c('0x162')](_0x206f14))[_0x805c('0xbc')](_0x3a64f9['checkIfTime'](_0x206f14[_0x805c('0x163')],_0x206f14[_0x805c('0x164')],_0x206f14[_0x805c('0x46')],_0x206f14))[_0x805c('0xbc')](_0x3a64f9[_0x805c('0x167')](_0x206f14[_0x805c('0x4d')],_0x206f14[_0x805c('0x164')],_0x206f14[_0x805c('0x46')],_0x206f14))[_0x805c('0xbc')](_0x3a64f9['launchHandleIvr'](_0x206f14))[_0x805c('0xb5')](loggerCatchQueueSummary(_0x805c('0x168'),_0x206f14));}else{notSendMessagesCampaign(_0x206f14);}}}};function getCallerIdRandom(_0x482778,_0x190727){var _0x202f8a,_0x208a0b,_0x1d44ca;if(_0x190727<=0x0){_0x190727=0x1;}_0x202f8a=new RegExp(_0x805c('0x169')+_0x190727+'}$');_0x208a0b=Math[_0x805c('0x16a')](0xa,_0x190727-0x1);_0x1d44ca=Math[_0x805c('0x16a')](0xa,_0x190727)-0x1;return util[_0x805c('0x7e')]('%s',_[_0x805c('0x16b')](_0x482778,_0x202f8a,_[_0x805c('0x16c')](_0x208a0b,_0x1d44ca)));}function extractCalleridName(_0x1147b2){var _0x1dc259=_0x1147b2[_0x805c('0x16d')](/"(.*?)"/);return _0x1dc259?_0x1dc259[0x1]:_0x1147b2;}function extractCalleridNumber(_0x192904){var _0x587915=_0x192904['match'](/<(.*?)>/);return _0x587915?_0x587915[0x1]:_0x192904;}Dialer['prototype']['actionOriginate']=function(_0xacc201,_0x58e10){var _0x555b50=this;var _0x5b9342=uuid['v4']();this['actions'][_0x5b9342]=new Action(_0xacc201,_0x58e10,_0x5b9342);return new BPromise(function(_0x5de34e,_0x3a41f9){if(_['isUndefined'](_0xacc201)&&'object'!==typeof _0xacc201){return _0x3a41f9(msgResponse(_0x805c('0x16e'),'Failure',_0x805c('0x16f')));}if(_[_0x805c('0x44')](_0x58e10[_0x805c('0x170')][_0x805c('0x171')])||_0x58e10[_0x805c('0x170')]['phone']===null){return _0x3a41f9(msgResponse(_0x805c('0x16e'),_0x805c('0x148'),'contact\x20is\x20undefine'));}var _0x4a5f10={'XMD-CALLERID':_0x555b50[_0x805c('0x2c')][_0x5b9342][_0x805c('0x172')](),'XMD-AGI':_0xacc201['dialQueueProject']?util[_0x805c('0x7e')](_0x805c('0x173'),ipAgi,_0xacc201['dialQueueProject']):_0x805c('0x174'),'XMD-AGIAFTER':_0xacc201[_0x805c('0x10f')]?util[_0x805c('0x7e')](_0x805c('0x173'),ipAgi,_0xacc201[_0x805c('0x10f')]):_0x805c('0x174'),'XMD-QUEUE':_0xacc201[_0x805c('0x55')]===_0x805c('0x175')?util[_0x805c('0x7e')](_0x805c('0x176'),_0xacc201[_0x805c('0x46')],_0xacc201[_0x805c('0x177')]||'',_0xacc201[_0x805c('0x110')]?'c':'',_0xacc201[_0x805c('0x118')]||0x3):_0x805c('0x174'),'XMD-CONTACTID':_0x58e10[_0x805c('0xd3')],'XMD-CDRTYPE':_0x805c('0x178'),'CALLERID(all)':_0x555b50[_0x805c('0x2c')][_0x5b9342][_0x805c('0x172')](),'XMD-AMD':_0xacc201[_0x805c('0xe4')]?_0x805c('0x179'):_0x805c('0x174'),'XMD-DESTINATION':_0x805c('0xe3')};if(_0xacc201[_0x805c('0xe4')]){_0x4a5f10[_0x805c('0x17a')]=_0xacc201[_0x805c('0x17b')]||0x9c4;_0x4a5f10[_0x805c('0x17c')]=_0xacc201[_0x805c('0x17d')]||0x5dc;_0x4a5f10[_0x805c('0x17e')]=_0xacc201['dialAMDAfterGreetingSilence']||0x320;_0x4a5f10[_0x805c('0x17f')]=_0xacc201[_0x805c('0x180')]||0x1388;_0x4a5f10['XMD-AMDMINWORDLENGTH']=_0xacc201[_0x805c('0x181')]||0x64;_0x4a5f10['XMD-AMDBETWEENWORDSSILENCE']=_0xacc201[_0x805c('0x182')]||0x32;_0x4a5f10[_0x805c('0x183')]=_0xacc201['dialAMDMaximumNumberOfWords']||0x3;_0x4a5f10[_0x805c('0x184')]=_0xacc201[_0x805c('0x185')]||0x100;_0x4a5f10[_0x805c('0x186')]=_0xacc201[_0x805c('0x187')]||0x1388;}if(_0xacc201[_0x805c('0x55')]===_0x805c('0x175')){_0x4a5f10[_0x805c('0x188')]=_0x58e10[_0x805c('0xd6')];}else{_0x4a5f10[_0x805c('0x189')]=_0x58e10[_0x805c('0xd7')];}for(var _0x1f46cb in _0x58e10[_0x805c('0x170')]){if(_0x58e10['Contact'][_0x805c('0x9f')](_0x1f46cb)){if(isNotNull(_0x58e10[_0x805c('0x170')][_0x1f46cb])&&_0x1f46cb!=='id'&&_0x1f46cb!=='tags'&&_0x1f46cb!==_0x805c('0x18a')&&_0x1f46cb!==_0x805c('0x18b')){_0x4a5f10[util['format']('%s%s','XMD-',_[_0x805c('0x18c')](_0x1f46cb))]=_0x58e10[_0x805c('0x170')][_0x1f46cb];}}}var _0x47a09f=_0x555b50['isTrunkReachable'](_0xacc201[_0x805c('0x7b')])?getCallerId(_0xacc201[_0x805c('0x7b')][_0x805c('0x7d')],_0xacc201[_0x805c('0x18d')],_0xacc201['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0xacc201[_0x805c('0x61')],_0xacc201['dialRandomLastDigitCallerIdNumber']):_0xacc201[_0x805c('0x61')]):getCallerId(_[_0x805c('0xb2')](_0xacc201[_0x805c('0x143')])?_0xacc201[_0x805c('0x7b')]['callerid']:_0xacc201[_0x805c('0x143')][_0x805c('0x7d')],_0xacc201[_0x805c('0x18d')],_0xacc201[_0x805c('0x18e')]>0x0?getCallerIdRandom(_0xacc201[_0x805c('0x61')],_0xacc201[_0x805c('0x18e')]):_0xacc201[_0x805c('0x61')]);if(_0x47a09f){_0x4a5f10[_0x805c('0x18f')]=_0x555b50['actions'][_0x5b9342]['originatecalleridname']=extractCalleridName(_0x47a09f);_0x4a5f10['XMD-ORIGINATECALLERIDNUM']=_0x555b50[_0x805c('0x2c')][_0x5b9342]['originatecalleridnum']=extractCalleridNumber(_0x47a09f);}return ami[_0x805c('0xb3')]({'actionid':_0x5b9342,'action':_0x805c('0x16e'),'channel':_0x555b50[_0x805c('0xdb')](_0xacc201[_0x805c('0x7b')])?util[_0x805c('0x7e')](_0x805c('0x190'),_0xacc201[_0x805c('0x7b')][_0x805c('0x46')],isNotNull(_0xacc201[_0x805c('0x191')])?_0xacc201[_0x805c('0x191')]['trim']()||'':'',_0xacc201['dialCutDigit']>0x0?_0x58e10['Contact'][_0x805c('0x171')][_0x805c('0x192')](_0xacc201[_0x805c('0x193')]):_0x58e10[_0x805c('0x170')][_0x805c('0x171')]):util[_0x805c('0x7e')](_0x805c('0x190'),_[_0x805c('0xb2')](_0xacc201[_0x805c('0x143')])?_0xacc201[_0x805c('0x7b')][_0x805c('0x46')]:_0xacc201[_0x805c('0x143')]['name'],isNotNull(_0xacc201[_0x805c('0x191')])?_0xacc201[_0x805c('0x191')][_0x805c('0x194')]()||'':'',_0xacc201['dialCutDigit']>0x0?_0x58e10[_0x805c('0x170')][_0x805c('0x171')][_0x805c('0x192')](_0xacc201['dialCutDigit']):_0x58e10['Contact']['phone']),'callerid':_0x47a09f,'Exten':_0x805c('0xe3'),'Context':'from-sip','Priority':'1','variable':_0x4a5f10,'timeout':(_0xacc201[_0x805c('0x62')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5b9342})[_0x805c('0xbc')](function(_0x2343f2){return _0x5de34e(_0x2343f2);})[_0x805c('0xb5')](function(_0x3e8aba){_0xacc201[_0x805c('0x195')]+=0x1;var _0x489964=new History(_0x555b50['actions'][_0x5b9342]);logger[_0x805c('0x9b')](util[_0x805c('0x7e')]('[originateError]:\x20%s',JSON['stringify'](_0x3e8aba)));_0x489964[_0x805c('0xac')]=0xe;_0x489964['statedesc']=_0x805c('0x196');_0x489964[_0x805c('0x121')]=moment()[_0x805c('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');_0x489964[_0x805c('0xad')]=_0x489964[_0x805c('0x121')];_0x555b50[_0x805c('0xcc')](_0x489964)[_0x805c('0xb5')](loggerCatch(_0x805c('0x197')));_0x555b50[_0x805c('0xca')](_0x489964)[_0x805c('0xb5')](loggerCatch('[originate][error]'))[_0x805c('0x23')](function(){delete _0x555b50[_0x805c('0x2c')][_0x5b9342];return _0x3a41f9(msgResponse(_0x805c('0x16e'),_0x805c('0x198'),_0x805c('0x199')));});});});};Dialer[_0x805c('0x21')][_0x805c('0x36')]=function(_0x6bf81b){var _0x1ad003=this[_0x805c('0x2c')][_0x6bf81b[_0x805c('0x12d')]];var _0x1aef56=this;if(_0x1ad003){delete this[_0x805c('0x2c')][_0x6bf81b['actionid']];_0x1ad003['responsetime']=moment()[_0x805c('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1a2f4d=_0x1ad003[_0x805c('0x55')]===_0x805c('0x81')?this[_0x805c('0x27')][_0x1ad003[_0x805c('0xb8')]]:this['voiceQueues'][_0x1ad003['getQueue']()];if(!this[_0x805c('0x19a')](_0x6bf81b[_0x805c('0x19b')])){this[_0x805c('0xb9')](_0x1a2f4d);return this[_0x805c('0x19c')](_0x1ad003,_0x1a2f4d,_0x6bf81b)[_0x805c('0xbc')](function(_0x7a4534){})[_0x805c('0xb5')](loggerCatch(_0x805c('0x19d')));}else{this['uniqueId'][_0x6bf81b[_0x805c('0xed')]]=_0x1ad003;}}};Dialer[_0x805c('0x21')][_0x805c('0x19e')]=function(_0x2cdaed,_0x113830,_0x2a1524){var _0x3eb637=new History(_0x113830);if(_0x3eb637['countbusyretry']+_0x3eb637['countcongestionretry']+_0x3eb637[_0x805c('0xf3')]+_0x3eb637[_0x805c('0xf4')]+_0x3eb637[_0x805c('0xf5')]+_0x3eb637[_0x805c('0x105')]+_0x3eb637[_0x805c('0xf6')]+_0x3eb637[_0x805c('0xf7')]>=_0x2a1524[_0x805c('0x106')]-0x1){return!![];}switch(_0x2cdaed){case 0x3:if(_0x3eb637[_0x805c('0xf3')]>=_0x2a1524[_0x805c('0x19f')]-0x1){return!![];}else{this[_0x805c('0xc2')]({'active':![],'countnoanswerretry':_0x3eb637[_0x805c('0xf3')]+=0x1,'scheduledat':moment()['add'](_0x2a1524[_0x805c('0x1a0')],'minutes')[_0x805c('0x7e')](_0x805c('0x100')),'ContactId':_0x3eb637[_0x805c('0xd3')],'ListId':_0x3eb637[_0x805c('0xd4')],'VoiceQueueId':_0x3eb637[_0x805c('0xd6')]||undefined,'CampaignId':_0x3eb637[_0x805c('0xd7')]||undefined})[_0x805c('0xb5')](loggerCatch(_0x805c('0x1a1')));}break;case 0x5:if(_0x3eb637[_0x805c('0x104')]>=_0x2a1524[_0x805c('0x1a2')]-0x1){return!![];}else{this[_0x805c('0xc2')]({'active':![],'countbusyretry':_0x3eb637['countbusyretry']+=0x1,'scheduledat':moment()[_0x805c('0xfd')](_0x2a1524[_0x805c('0x1a3')],_0x805c('0xff'))['format'](_0x805c('0x100')),'ContactId':_0x3eb637['ContactId'],'ListId':_0x3eb637[_0x805c('0xd4')],'VoiceQueueId':_0x3eb637[_0x805c('0xd6')]||undefined,'CampaignId':_0x3eb637[_0x805c('0xd7')]||undefined})[_0x805c('0xb5')](loggerCatch(_0x805c('0x1a4')));}break;case 0x8:if(_0x3eb637[_0x805c('0xf2')]>=_0x2a1524[_0x805c('0x1a5')]-0x1){return!![];}else{this[_0x805c('0xc2')]({'active':![],'countcongestionretry':_0x3eb637[_0x805c('0xf2')]+=0x1,'scheduledat':moment()[_0x805c('0xfd')](_0x2a1524[_0x805c('0x1a6')],_0x805c('0xff'))['format'](_0x805c('0x100')),'ContactId':_0x3eb637[_0x805c('0xd3')],'ListId':_0x3eb637[_0x805c('0xd4')],'VoiceQueueId':_0x3eb637[_0x805c('0xd6')]||undefined,'CampaignId':_0x3eb637[_0x805c('0xd7')]||undefined})[_0x805c('0xb5')](loggerCatch(_0x805c('0x1a7')));}break;case 0x0:if(_0x3eb637[_0x805c('0xf4')]>=_0x2a1524[_0x805c('0x1a8')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x3eb637[_0x805c('0xf4')]+=0x1,'scheduledat':moment()[_0x805c('0xfd')](_0x2a1524['dialNoSuchNumberRetryFrequency'],_0x805c('0xff'))[_0x805c('0x7e')](_0x805c('0x100')),'ContactId':_0x3eb637[_0x805c('0xd3')],'ListId':_0x3eb637['ListId'],'VoiceQueueId':_0x3eb637[_0x805c('0xd6')]||undefined,'CampaignId':_0x3eb637[_0x805c('0xd7')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x3eb637[_0x805c('0xf5')]>=_0x2a1524[_0x805c('0x11e')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countdropretry':_0x3eb637[_0x805c('0xf5')]+=0x1,'scheduledat':moment()[_0x805c('0xfd')](_0x2a1524[_0x805c('0x11f')],_0x805c('0xff'))[_0x805c('0x7e')](_0x805c('0x100')),'ContactId':_0x3eb637[_0x805c('0xd3')],'ListId':_0x3eb637[_0x805c('0xd4')],'VoiceQueueId':_0x3eb637[_0x805c('0xd6')]||undefined,'CampaignId':_0x3eb637['CampaignId']||undefined})[_0x805c('0xb5')](loggerCatch(_0x805c('0x120')));}break;case 0xb:if(_0x3eb637[_0x805c('0x105')]>=_0x2a1524[_0x805c('0x127')]-0x1){return!![];}else{this[_0x805c('0xc2')]({'active':![],'countabandonedretry':_0x3eb637[_0x805c('0x105')]+=0x1,'scheduledat':moment()[_0x805c('0xfd')](_0x2a1524[_0x805c('0x128')],_0x805c('0xff'))[_0x805c('0x7e')](_0x805c('0x100')),'ContactId':_0x3eb637[_0x805c('0xd3')],'ListId':_0x3eb637[_0x805c('0xd4')],'VoiceQueueId':_0x3eb637[_0x805c('0xd6')]||undefined,'CampaignId':_0x3eb637[_0x805c('0xd7')]||undefined})[_0x805c('0xb5')](loggerCatch(_0x805c('0x129')));}break;case 0x13:if(_0x3eb637[_0x805c('0xf6')]>=_0x2a1524['dialMachineMaxRetry']-0x1){return!![];}else{this[_0x805c('0xc2')]({'active':![],'countmachineretry':_0x3eb637[_0x805c('0xf6')]+=0x1,'scheduledat':moment()['add'](_0x2a1524[_0x805c('0xfe')],_0x805c('0xff'))[_0x805c('0x7e')](_0x805c('0x100')),'ContactId':_0x3eb637['ContactId'],'ListId':_0x3eb637[_0x805c('0xd4')],'VoiceQueueId':_0x3eb637[_0x805c('0xd6')]||undefined,'CampaignId':_0x3eb637[_0x805c('0xd7')]||undefined})['catch'](loggerCatch(_0x805c('0x107')));}break;case 0x14:if(_0x3eb637[_0x805c('0xf7')]>=_0x2a1524[_0x805c('0x1a9')]-0x1){return!![];}else{this[_0x805c('0xc2')]({'active':![],'countagentrejectretry':_0x3eb637[_0x805c('0xf7')]+=0x1,'scheduledat':moment()[_0x805c('0xfd')](_0x2a1524['dialAgentRejectRetryFrequency'],_0x805c('0xff'))[_0x805c('0x7e')](_0x805c('0x100')),'ContactId':_0x3eb637[_0x805c('0xd3')],'ListId':_0x3eb637[_0x805c('0xd4')],'VoiceQueueId':_0x3eb637[_0x805c('0xd6')]||undefined,'CampaignId':_0x3eb637[_0x805c('0xd7')]||undefined})[_0x805c('0xb5')](loggerCatch('[rescheduleContact][AgentReject]'));}break;default:return!![];}};Dialer[_0x805c('0x21')][_0x805c('0x19c')]=function(_0x2d49d4,_0xb87c08,_0x335eef){var _0x1a3af7=this;var _0x51c9d7=new History(_0x2d49d4);return new BPromise(function(_0x349996,_0x447cb3){if(_[_0x805c('0x44')](_0xb87c08)&&_0x805c('0x1aa')!==typeof _0xb87c08){return _0x447cb3(msgResponse('[callProgressDetecting]',_0x805c('0x148'),_0x805c('0x1ab')));}if(_[_0x805c('0x44')](_0x335eef)&&_0x805c('0x1aa')!==typeof _0x335eef){return _0x447cb3(msgResponse(_0x805c('0x1ac'),_0x805c('0x148'),'evt\x20is\x20undefine'));}switch(_0x335eef[_0x805c('0x10d')]){case'0':_0xb87c08[_0x805c('0x69')]+=0x1;_0x51c9d7[_0x805c('0xac')]=0x0;_0x51c9d7['statedesc']=_0x805c('0x1ad');_0x51c9d7[_0x805c('0xf4')]+=0x1;_0x51c9d7[_0x805c('0xef')]+=0x1;ami[_0x805c('0x1ae')](_0x805c('0x1af'),ut['buildObj'](_0x2d49d4,_0x805c('0x1b0')));_0x1a3af7[_0x805c('0xcc')](_0x51c9d7)[_0x805c('0xb5')](loggerCatch(_0x805c('0xf1')));if(_0x1a3af7[_0x805c('0x19e')](0x0,_0x2d49d4,_0xb87c08)){if(_0x51c9d7[_0x805c('0xf4')]>=_0xb87c08['dialNoSuchNumberMaxRetry']){_0x1a3af7[_0x805c('0xfb')](_0x51c9d7,_0x349996,_0x447cb3,'reason\x200\x20no\x20such\x20number....');}else{_0x1a3af7[_0x805c('0xf8')](_0x51c9d7,_0x349996,_0x447cb3,_0x805c('0x1b1'));}}break;case'3':_0xb87c08[_0x805c('0x68')]+=0x1;_0x51c9d7['state']=0x3;_0x51c9d7['statedesc']='NoAnswer';_0x51c9d7[_0x805c('0xf3')]+=0x1;_0x51c9d7['countglobal']+=0x1;ami[_0x805c('0x1ae')](_0x805c('0x1b2'),ut[_0x805c('0x1b3')](_0x2d49d4,'noanswer'));_0x1a3af7[_0x805c('0xcc')](_0x51c9d7)[_0x805c('0xb5')](loggerCatch(_0x805c('0x1b4')));if(_0x1a3af7['checkRetriveMax'](0x3,_0x2d49d4,_0xb87c08)){if(_0x51c9d7['countnoanswerretry']>=_0xb87c08[_0x805c('0x19f')]){_0x1a3af7[_0x805c('0xfb')](_0x51c9d7,_0x349996,_0x447cb3,'reason\x203\x20ringing\x20no\x20answer');}else{_0x1a3af7['stateGlobal'](_0x51c9d7,_0x349996,_0x447cb3,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0xb87c08[_0x805c('0x65')]+=0x1;_0x51c9d7['state']=0x5;_0x51c9d7[_0x805c('0xe7')]='Busy';_0x51c9d7[_0x805c('0x104')]+=0x1;_0x51c9d7[_0x805c('0xef')]+=0x1;ami[_0x805c('0x1ae')](_0x805c('0x1b5'),ut['buildObj'](_0x2d49d4,_0x805c('0x1b6')));_0x1a3af7[_0x805c('0xcc')](_0x51c9d7)['catch'](loggerCatch(_0x805c('0x1b7')));if(_0x1a3af7[_0x805c('0x19e')](0x5,_0x2d49d4,_0xb87c08)){if(_0x51c9d7[_0x805c('0x104')]>=_0xb87c08['dialBusyMaxRetry']){_0x1a3af7['createStateFinal'](_0x51c9d7,_0x349996,_0x447cb3,_0x805c('0x1b8'));}else{_0x1a3af7[_0x805c('0xf8')](_0x51c9d7,_0x349996,_0x447cb3,_0x805c('0x1b8'));}}break;case'8':_0xb87c08[_0x805c('0x66')]+=0x1;_0x51c9d7['state']=0x8;_0x51c9d7[_0x805c('0xe7')]=_0x805c('0x1b9');_0x51c9d7[_0x805c('0xf2')]+=0x1;_0x51c9d7[_0x805c('0xef')]+=0x1;ami[_0x805c('0x1ae')](_0x805c('0x1ba'),ut[_0x805c('0x1b3')](_0x2d49d4,_0x805c('0x1bb')));_0x1a3af7[_0x805c('0xcc')](_0x51c9d7)[_0x805c('0xb5')](loggerCatch(_0x805c('0x1bc')));if(_0x1a3af7['checkRetriveMax'](0x8,_0x2d49d4,_0xb87c08)){if(_0x51c9d7[_0x805c('0xf2')]>=_0xb87c08[_0x805c('0x1a5')]){_0x1a3af7[_0x805c('0xfb')](_0x51c9d7,_0x349996,_0x447cb3,_0x805c('0x1bd'));}else{_0x1a3af7['stateGlobal'](_0x51c9d7,_0x349996,_0x447cb3,'reason\x208\x20congestion');}}break;case'11':_0xb87c08['outboundAbandonedCallsDay']+=0x1;_0x51c9d7[_0x805c('0xac')]=0xb;_0x51c9d7['statedesc']=_0x805c('0x12a');_0x51c9d7[_0x805c('0x105')]+=0x1;_0x51c9d7[_0x805c('0xef')]+=0x1;_0x1a3af7['createHistory'](_0x51c9d7)[_0x805c('0xb5')](loggerCatch(_0x805c('0x12b')));if(_0x1a3af7['checkRetriveMax'](0xb,_0x2d49d4,_0xb87c08)){if(_0x51c9d7[_0x805c('0x105')]>=_0xb87c08[_0x805c('0x127')]){_0x1a3af7[_0x805c('0xfb')](_0x51c9d7,_0x349996,_0x447cb3,_0x805c('0x1be'));}else{_0x1a3af7[_0x805c('0xf8')](_0x51c9d7,_0x349996,_0x447cb3,_0x805c('0x1be'));}}break;case'20':_0xb87c08[_0x805c('0x6a')]+=0x1;_0x51c9d7[_0x805c('0xac')]=0x14;_0x51c9d7[_0x805c('0xe7')]='AgentReject';_0x51c9d7[_0x805c('0xf7')]+=0x1;_0x51c9d7[_0x805c('0xef')]+=0x1;ami[_0x805c('0x1ae')]('custom:agentreject',ut[_0x805c('0x1b3')](_0x2d49d4,_0x805c('0x1bf')));_0x1a3af7[_0x805c('0xcc')](_0x51c9d7)[_0x805c('0xb5')](loggerCatch(_0x805c('0x1c0')));if(_0x1a3af7[_0x805c('0x19e')](0x14,_0x2d49d4,_0xb87c08)){if(_0x51c9d7[_0x805c('0xf7')]>=_0xb87c08['dialAgentRejectMaxRetry']){_0x1a3af7[_0x805c('0xfb')](_0x51c9d7,_0x349996,_0x447cb3,'reason\x2020\x20agentreject');}else{_0x1a3af7[_0x805c('0xf8')](_0x51c9d7,_0x349996,_0x447cb3,_0x805c('0x1c1'));}}break;default:_0xb87c08[_0x805c('0x6b')]+=0x1;_0x51c9d7['state']=0xc;_0x51c9d7[_0x805c('0xe7')]=_0x335eef[_0x805c('0x10d')];_0x1a3af7['createHistory'](_0x51c9d7)[_0x805c('0xb5')](loggerCatch(_0x805c('0x1c2')));if(_0x1a3af7[_0x805c('0x19e')](_0x335eef[_0x805c('0x10d')],_0x2d49d4,_0xb87c08)){if(_0x51c9d7[_0x805c('0x104')]+_0x51c9d7[_0x805c('0xf2')]+_0x51c9d7[_0x805c('0xf3')]+_0x51c9d7['countnosuchnumberretry']+_0x51c9d7[_0x805c('0xf5')]+_0x51c9d7['countabandonedretry']+_0x51c9d7[_0x805c('0xf6')]+_0x51c9d7['countagentrejectretry']>=_0xb87c08[_0x805c('0x106')]){_0x1a3af7[_0x805c('0xf8')](_0x51c9d7,_0x349996,_0x447cb3,_0x335eef[_0x805c('0x10d')]);}else{_0x1a3af7[_0x805c('0xfb')](_0x51c9d7,_0x349996,_0x447cb3,_0x335eef[_0x805c('0x10d')]);}}}});};Dialer['prototype'][_0x805c('0xf8')]=function(_0x3d180e,_0x1148e0,_0x4a664b,_0x3439e7){var _0x31f545=new Final(_0x3d180e);_0x31f545[_0x805c('0xac')]=0xf;_0x31f545['statedesc']=_0x805c('0x1c3');this['createStateFinal'](_0x31f545,_0x1148e0,_0x4a664b,_0x3439e7);};Dialer[_0x805c('0x21')]['createStateFinal']=function(_0x37310e,_0x52e2f2,_0x234e64,_0xe267de){this[_0x805c('0xca')](_0x37310e)[_0x805c('0xbc')](function(_0xeaf9cc){return _0x52e2f2(msgResponse(_0x805c('0x1ac'),_0x805c('0xda'),_0xe267de));})[_0x805c('0xb5')](function(_0x28e00c){return _0x234e64(msgResponse(_0x805c('0x1c4'),_0x805c('0x148'),_0x805c('0x1c5')));});};Dialer[_0x805c('0x21')][_0x805c('0xa')]=function(_0x163caf){var _0x1a24fb=this;var _0x57a5ea=_0x163caf[_0x805c('0x1c6')]/0x64;var _0x3ddf0e=_0x163caf[_0x805c('0x119')]/(_0x163caf['outboundDropCallsDayTimeout']+_0x163caf['outboundAnswerCallsDay']);var _0x4b7fa1=Math['round'](_0x163caf[_0x805c('0x75')]*(_0x163caf[_0x805c('0x1c7')]/0x64));var _0x1c9103=Math['round'](_0x163caf[_0x805c('0x75')]*(_0x163caf[_0x805c('0x1c8')]/0x64));var _0x174516=_0x163caf[_0x805c('0x56')]+_0x163caf[_0x805c('0x5a')];var _0x1a13a2=Math[_0x805c('0x1c9')](_0x163caf['erlangCalls']*_0x163caf[_0x805c('0x78')]*_0x163caf[_0x805c('0x72')]*_0x163caf[_0x805c('0x73')]);if(_[_0x805c('0x44')](_0x163caf[_0x805c('0x93')])){if(!_[_0x805c('0x44')](_0x163caf[_0x805c('0x7a')])){_0x163caf[_0x805c('0x7a')]=undefined;loggerPredictive[_0x805c('0x9b')]('[startMethodPredictive][StartProgressive]',_0x805c('0x1ca'));}if(!_[_0x805c('0x44')](_0x163caf[_0x805c('0x96')])){loggerPredictive[_0x805c('0x9b')](_0x805c('0x1cb'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x163caf[_0x805c('0x96')]);_0x163caf['handlePredictive']=undefined;}_0x163caf['startProgressive']=moment()['format'](_0x805c('0x100'));loggerPredictive['info'](_0x163caf[_0x805c('0x46')],_0x805c('0x1cc'),_0x163caf[_0x805c('0x93')]);this[_0x805c('0x15c')](_0x163caf,0x1);}else if(ifInterval(_0x163caf['dialPredictiveInterval'],_0x163caf[_0x805c('0x93')])){this[_0x805c('0x15c')](_0x163caf,0x1);loggerPredictiveCalls[_0x805c('0x83')](_0x805c('0x1cd'),_0x163caf[_0x805c('0x93')],_0x163caf[_0x805c('0x46')]);_0x163caf[_0x805c('0x77')]=0x0;_0x163caf[_0x805c('0x71')]=0x0;}else if(_0x57a5ea<_0x3ddf0e&&_0x163caf[_0x805c('0x1ce')]===_0x805c('0x1cf')){freeVariablesPredictive(_0x163caf);loggerPredictive[_0x805c('0x83')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x805c('0x1d0'),_0x3ddf0e,_0x805c('0x93'),_0x163caf[_0x805c('0x46')]);}else if(_0x1a13a2<_0x163caf[_0x805c('0x71')]&&_0x163caf['dialPredictiveOptimization']===_0x805c('0x1cf')){freeVariablesPredictive(_0x163caf);loggerPredictive[_0x805c('0x83')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x805c('0x1d1'),_0x1a13a2,_0x805c('0x1d2'),_0x163caf['predictiveIntervalErlangCallsDroppedCalls'],_0x805c('0x93'),_0x163caf['name']);}else if(!ifInterval(_0x163caf[_0x805c('0x1d3')],_0x163caf[_0x805c('0x93')])&&_[_0x805c('0x44')](_0x163caf[_0x805c('0x7a')])&&!_[_0x805c('0x44')](_0x163caf[_0x805c('0x93')])){_0x163caf[_0x805c('0x7a')]=moment()['format'](_0x805c('0x100'));loggerPredictive['info'](_0x163caf['name'],_0x805c('0x1d4'),_0x163caf[_0x805c('0x7a')]);this[_0x805c('0x1d5')](_0x163caf[_0x805c('0x1d3')])[_0x805c('0xbc')](this[_0x805c('0x1d6')](_0x163caf))[_0x805c('0xbc')](mergeDataErlangB(_0x163caf))[_0x805c('0xbc')](this['startMethodPredictive'](_0x163caf))[_0x805c('0xb5')](loggerCatchPredictive(_0x805c('0x1d7'),_0x163caf));}else if(!ifInterval(_0x163caf['dialPredictiveInterval'],_0x163caf['startPredictive'])){_0x163caf[_0x805c('0x71')]=0x0;_0x163caf[_0x805c('0x7a')]=moment()[_0x805c('0x7e')](_0x805c('0x100'));loggerPredictive['info'](_0x163caf[_0x805c('0x46')],_0x805c('0x1d8'),_0x163caf[_0x805c('0x7a')]);clearInterval(_0x163caf[_0x805c('0x96')]);_0x163caf[_0x805c('0x96')]=undefined;this['averageHandleTime'](_0x163caf[_0x805c('0x1d3')])['then'](this[_0x805c('0x1d6')](_0x163caf))[_0x805c('0xbc')](mergeDataErlangB(_0x163caf))[_0x805c('0xbc')](this[_0x805c('0x1d9')](_0x163caf))[_0x805c('0xb5')](loggerCatchPredictive(_0x805c('0x1da'),_0x163caf));}else if(_0x163caf['predictiveIntervalAvailable']&&_0x174516<_0x163caf['predictiveIntervalAvailable']-_0x1c9103){freeVariablesPredictive(_0x163caf);loggerPredictive[_0x805c('0x83')](_0x163caf[_0x805c('0x46')],_0x805c('0x1db'),_0x174516,_0x805c('0x1dc'),_0x163caf[_0x805c('0x75')],'-',_0x1c9103,'=',_0x163caf[_0x805c('0x75')]-_0x1c9103,')');}else if(_0x163caf[_0x805c('0x75')]&&_0x174516>_0x163caf[_0x805c('0x75')]+_0x4b7fa1){freeVariablesPredictive(_0x163caf);loggerPredictive[_0x805c('0x83')](_0x163caf[_0x805c('0x46')],_0x805c('0x1db'),_0x174516,_0x805c('0x1dd'),_0x163caf[_0x805c('0x75')],'+',_0x4b7fa1,'=',_0x163caf[_0x805c('0x75')]+_0x4b7fa1,')');}};Dialer[_0x805c('0x21')][_0x805c('0x1d6')]=function(_0x547749){var _0x16109d=this;return function(_0x220051){return new BPromise(function(_0x420164,_0x2359b6){_[_0x805c('0x92')](_0x547749,_0x220051[0x0]);if(checkGetDataPredictive(_0x220051[0x0])){var _0x50efe7=_0x547749[_0x805c('0x75')]=_0x547749[_0x805c('0x5a')]+_0x547749[_0x805c('0x56')];var _0x25f5dc=_0x547749[_0x805c('0x1d3')]*0x3c;var _0x2f4fce=_0x220051[0x0][_0x805c('0x89')]+_0x220051[0x0][_0x805c('0x6d')];var _0x25224b=(_0x220051[0x0]['predictiveIntervalAnsweredCalls']+_0x220051[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x220051[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x220051[0x0]['predictiveIntervalTotalCalls'];_0x547749[_0x805c('0x72')]=_0x25224b>0x0?_0x25224b:0x1;switch(_0x547749['dialPredictiveOptimization']){case _0x805c('0x1cf'):var _0x14aaa6=_0x547749[_0x805c('0x1c6')]/0x64;return _0x16109d['abandonmentRate'](_0x50efe7,_0x25f5dc,_0x2f4fce,_0x25224b,_0x14aaa6)[_0x805c('0xbc')](function(_0x564787){return _0x420164(_0x564787);});case _0x805c('0x1de'):var _0x47061a=_0x547749[_0x805c('0x1c6')]/0x64;return _0x16109d[_0x805c('0x1df')](_0x50efe7,_0x25f5dc,_0x2f4fce,_0x25224b,_0x47061a)[_0x805c('0xbc')](function(_0x400365){return _0x420164(_0x400365);});default:return _0x2359b6(msgResponse(_0x805c('0x1e0'),_0x805c('0x148'),'Unknown\x20Predictive'));}}else{return _0x2359b6(msgResponse(_0x805c('0x1e0'),_0x805c('0x148'),_0x805c('0x1e1')));}});};};Dialer[_0x805c('0x21')][_0x805c('0x1e2')]=function(_0x82afdb){var _0x46c90d=this;return function(_0x32cf8e){return new BPromise(function(_0x138d27,_0x475e1d){_['merge'](_0x82afdb,_0x32cf8e[0x0]);if(checkGetDataPredictive(_0x32cf8e[0x0])){loggerPredictive[_0x805c('0x83')](JSON['stringify'](_0x32cf8e[0x0]));if(_0x82afdb[_0x805c('0x1ce')]===_0x805c('0x1cf')){return _0x46c90d[_0x805c('0xc8')](_0x82afdb['id'])['then'](function(_0x13bb34){var _0x4b6e66=_0x82afdb[_0x805c('0x57')]-_0x13bb34[0x0][_0x805c('0x1e3')];var _0x3b4804=_0x82afdb['dialPredictiveInterval']*0x3c;var _0x22a996=_0x32cf8e[0x0][_0x805c('0x89')]+_0x32cf8e[0x0]['predictiveIntervalAvgHoldtime'];var _0x3c9c30=(_0x32cf8e[0x0][_0x805c('0x6c')]+_0x32cf8e[0x0][_0x805c('0x6f')]+_0x32cf8e[0x0][_0x805c('0x6e')])/_0x32cf8e[0x0]['predictiveIntervalTotalCalls'];var _0x5f209b=_0x82afdb[_0x805c('0x1c6')]/0x64;_0x82afdb[_0x805c('0x74')]=_0x13bb34[0x0][_0x805c('0x1e3')]||0x0;_0x82afdb[_0x805c('0x72')]=_0x3c9c30>0x0?_0x3c9c30:0x1;return _0x46c90d[_0x805c('0x1e4')](_0x4b6e66,_0x3b4804,_0x22a996,_0x3c9c30,_0x5f209b);})[_0x805c('0xbc')](function(_0x37f4cd){return _0x138d27(_0x37f4cd);})['catch'](function(_0x1a70b9){return _0x475e1d(msgResponse(_0x805c('0x1e5'),_0x805c('0x148'),JSON[_0x805c('0x51')](_0x1a70b9)));});}if(_0x82afdb['dialPredictiveOptimization']==='agentBusyFactor'){return _0x46c90d[_0x805c('0xc8')](_0x82afdb['id'])[_0x805c('0xbc')](function(_0x2aee5c){var _0x220e1c=_0x82afdb[_0x805c('0x57')]-_0x2aee5c[0x0][_0x805c('0x1e3')];var _0x149d75=_0x82afdb['dialPredictiveInterval']*0x3c;var _0x40d794=_0x32cf8e[0x0]['predictiveIntervalAvgTalktime']+_0x32cf8e[0x0]['predictiveIntervalAvgHoldtime'];var _0x7dd15=(_0x32cf8e[0x0][_0x805c('0x6c')]+_0x32cf8e[0x0][_0x805c('0x6f')]+_0x32cf8e[0x0][_0x805c('0x6e')])/_0x32cf8e[0x0]['predictiveIntervalTotalCalls'];var _0x42846f=_0x82afdb[_0x805c('0x1c6')]/0x64;_0x82afdb[_0x805c('0x74')]=_0x2aee5c[0x0][_0x805c('0x1e3')]||0x0;_0x82afdb[_0x805c('0x72')]=_0x7dd15>0x0?_0x7dd15:0x1;return _0x46c90d[_0x805c('0x1df')](_0x220e1c,_0x149d75,_0x40d794,_0x7dd15,_0x42846f);})[_0x805c('0xbc')](function(_0x4555fc){return _0x138d27(_0x4555fc);})[_0x805c('0xb5')](function(_0x3ebdbf){return _0x475e1d(msgResponse(_0x805c('0x1e5'),'Failure',JSON[_0x805c('0x51')](_0x3ebdbf)));});}}else{return _0x475e1d(msgResponse('[getDataPredictive]',_0x805c('0x148'),'check\x20failure'));}});};};Dialer[_0x805c('0x21')][_0x805c('0x1d9')]=function(_0x30e92d){var _0x4c4324=this;return function(){var _0xe45e7c=0x0;var _0x29c40b=Math[_0x805c('0x1c9')](_0x30e92d[_0x805c('0x1e6')]*0x3e8);if(_0x29c40b>0x0){_0x29c40b=_0x29c40b<0x64?0x64:_0x29c40b;loggerPredictive[_0x805c('0x83')](_0x30e92d[_0x805c('0x46')],_0x805c('0x1e7'),_0x29c40b,_0x805c('0x52'));_0x30e92d[_0x805c('0x96')]=setInterval(function(){_0x4c4324[_0x805c('0x96')](_0x30e92d);loggerPredictiveCalls['info'](_0x805c('0x1e8'),_0xe45e7c+=0x1);},_0x29c40b);}else{loggerPredictive[_0x805c('0x83')](_0x30e92d['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x805c('0x21')][_0x805c('0x1e9')]=function(_0x3134e5,_0x180525){var _0x5d124e=this;return function(_0x1a512c){if(_[_0x805c('0x4f')](_0x1a512c)){if(_['isNil'](_0x180525[_0x805c('0xd5')])||!_0x180525[_0x805c('0x1ea')]){if(_0x3134e5[_0x805c('0x60')]===_0x805c('0x9')){_0x3134e5[_0x805c('0x132')]=_[_0x805c('0x44')](_0x3134e5['queueStatusComplete'])?!![]:_0x3134e5[_0x805c('0x132')];var _0x6d5be6=uuid['v4']();_0x5d124e[_0x805c('0x2c')][_0x6d5be6]=new Action(_0x3134e5,_0x180525,_0x6d5be6);loggerBooked['info'](_0x805c('0x1eb'),_0x6d5be6,_0x805c('0x1ec'),JSON[_0x805c('0x51')](_0x3134e5[_0x805c('0x132')]),_0x805c('0x1ed'),_0x3134e5[_0x805c('0x46')]);if(_0x3134e5[_0x805c('0x132')]){_0x3134e5[_0x805c('0x132')]=![];_0x5d124e[_0x805c('0x31')][_0x5d124e[_0x805c('0x2c')][_0x6d5be6][_0x805c('0xb8')]]=[];ami['Action']({'actionid':_0x6d5be6,'action':'queuestatus','queue':_0x3134e5['name']})[_0x805c('0xb5')](function(_0x1b6963){_0x5d124e[_0x805c('0xb9')](_0x3134e5);_0x5d124e[_0x805c('0xc2')]({'active':![],'ContactId':_0x5d124e[_0x805c('0x2c')][_0x6d5be6]['ContactId'],'ListId':_0x5d124e[_0x805c('0x2c')][_0x6d5be6][_0x805c('0xd4')],'VoiceQueueId':_0x5d124e[_0x805c('0x2c')][_0x6d5be6][_0x805c('0xd6')]||undefined,'CampaignId':_0x5d124e[_0x805c('0x2c')][_0x6d5be6]['CampaignId']||undefined})[_0x805c('0xb5')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x5d124e[_0x805c('0x2c')][_0x6d5be6];});}else{loggerBooked[_0x805c('0x83')](_0x805c('0x1ee'),JSON[_0x805c('0x51')](_0x3134e5[_0x805c('0x132')]),'Queue:\x20',_0x3134e5['name']);_0x5d124e[_0x805c('0xb9')](_0x3134e5);_0x5d124e[_0x805c('0xc2')]({'active':![],'ContactId':_0x5d124e[_0x805c('0x2c')][_0x6d5be6][_0x805c('0xd3')],'ListId':_0x5d124e[_0x805c('0x2c')][_0x6d5be6][_0x805c('0xd4')],'VoiceQueueId':_0x5d124e[_0x805c('0x2c')][_0x6d5be6][_0x805c('0xd6')]||undefined,'CampaignId':_0x5d124e[_0x805c('0x2c')][_0x6d5be6][_0x805c('0xd7')]||undefined})[_0x805c('0xb5')](loggerCatch(_0x805c('0x1ef')));delete _0x5d124e[_0x805c('0x2c')][_0x6d5be6];}}else{return _0x5d124e[_0x805c('0x1f0')](_0x3134e5,_0x180525);}}else{if(getDiff(_0x180525[_0x805c('0x1f1')])<_0x3134e5[_0x805c('0x1f2')]*0x3c){if(_0x180525[_0x805c('0x1f3')]&&!_0x180525[_0x805c('0x1f3')][_0x805c('0x1f4')]){_0x5d124e['preview'][_0x805c('0x13b')](_0x180525['id'])['finally'](function(){_0x5d124e[_0x805c('0xb9')](_0x3134e5);});}else{_0x5d124e[_0x805c('0xc4')]({'active':![]},_0x180525['id'],0x1)[_0x805c('0x23')](function(){console[_0x805c('0x1f5')](_0x805c('0x1f6'));_0x5d124e[_0x805c('0xb9')](_0x3134e5);});}}else{_0x3134e5[_0x805c('0x1f7')]+=0x1;_0x5d124e[_0x805c('0xb9')](_0x3134e5);if(_0x3134e5['dialRecallInQueue']){_0x5d124e['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x180525[_0x805c('0xd3')],'ListId':_0x180525[_0x805c('0xd4')],'VoiceQueueId':_0x180525['VoiceQueueId']||undefined,'CampaignId':_0x180525[_0x805c('0xd7')]||undefined})[_0x805c('0xb5')](loggerCatch(_0x805c('0x1f8')));_0x5d124e[_0x805c('0xcc')](createObjHistory(_0x3134e5,_0x180525,_0x805c('0x1f9'),0x17,_0x805c('0x1fa')))['catch'](loggerCatch(_0x805c('0x1fb')));}else{_0x5d124e['saveInDb'](createObjHistory(_0x3134e5,_0x180525,_0x805c('0x1fc'),0x16,_0x805c('0x1fd')),'[Originate][HistoryRecallClose][historyCatch]',_0x805c('0x1fe'));}}}}else{_0x3134e5[_0x805c('0x1ff')]+=0x1;_0x5d124e[_0x805c('0xd1')](createObjHistory(_0x3134e5,_0x180525,_0x805c('0x200'),0xd,'Blacklist'),_0x805c('0x201'),_0x805c('0x202'));throw'inBlackList';}};};Dialer[_0x805c('0x21')][_0x805c('0x161')]=function(_0x4c0eb5){var _0x36f08d=this;var _0x4c204a=[];var _0x1a5062=_0x4c0eb5[_0x805c('0x203')]-_0x4c0eb5[_0x805c('0xa0')]-_0x4c0eb5[_0x805c('0x204')];emitCampaignSummary(_0x4c0eb5);if(_0x1a5062>0x0){if(_0x1a5062>this[_0x805c('0x2a')]){_0x1a5062=this[_0x805c('0x2a')];}_0x4c0eb5[_0x805c('0x204')]+=_0x1a5062;this[_0x805c('0xc6')](_0x4c0eb5['id'],_0x1a5062,_0x4c0eb5[_0x805c('0x205')])[_0x805c('0xbc')](function(_0x15e09f){_0x4c0eb5[_0x805c('0x204')]-=_0x1a5062;_0x4c0eb5['temp']=_0x4c0eb5[_0x805c('0x204')]>0x0?_0x4c0eb5[_0x805c('0x204')]:0x0;if(!checkContactEmpty(_0x15e09f)){_0x4c0eb5[_0x805c('0x48')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x805c('0x83')](_0x805c('0x206')+_0x4c0eb5[_0x805c('0x46')]);}else{_0x4c0eb5[_0x805c('0xa0')]+=_0x15e09f[_0x805c('0x9e')];_0x4c0eb5[_0x805c('0x48')]=_0x805c('0x207');for(var _0x1677ed=0x0;_0x1677ed<_0x15e09f['length'];_0x1677ed+=0x1){_0x4c0eb5[_0x805c('0x208')]+=0x1;if(_[_0x805c('0xb2')](_0x15e09f[_0x1677ed])||_[_0x805c('0xb2')](_0x15e09f[_0x1677ed][_0x805c('0x170')])||_[_0x805c('0xb2')](_0x15e09f[_0x1677ed][_0x805c('0x170')][_0x805c('0x171')])){_0x36f08d[_0x805c('0xcf')](_0x805c('0x209'),_0x4c0eb5,_0x15e09f[_0x1677ed]);}else{_0x36f08d['checkIsBlackListIvr'](_[_0x805c('0xd2')](_0x15e09f[_0x1677ed],[_0x805c('0xd7'),_0x805c('0x20a')]))[_0x805c('0xbc')](_0x36f08d[_0x805c('0x1e9')](_0x4c0eb5,_0x15e09f[_0x1677ed]))['catch'](_0x36f08d[_0x805c('0x20b')]('[actionOriginateIvr]\x20',_0x4c0eb5));}}}})[_0x805c('0xb5')](loggerGetContactDialer(_0x805c('0x20c'),_0x4c0eb5,_0x1a5062));}};Dialer[_0x805c('0x21')][_0x805c('0x15c')]=function(_0x19d761,_0x5ba2c5){var _0x23d7cd=this;var _0x4fc407=[];var _0x247791=_0x5ba2c5>=0x1?_0x5ba2c5:0x1;var _0xd0bdc0=[];if(_0x19d761[_0x805c('0x60')]===_0x805c('0x9')){_0x247791=0x1;}var _0x20a33b=Math[_0x805c('0x1c9')](_0x19d761['available']*_0x247791)-_0x19d761['originated']-_0x19d761['temp'];emitVoiceQueueSummary(_0x19d761);if(_0x19d761['dialLimitQueue']>0x0){var _0x29e9a9=_0x19d761['dialLimitQueue']-_0x19d761[_0x805c('0xa0')]-_0x19d761[_0x805c('0x5a')]-_0x19d761[_0x805c('0x204')]-_0x19d761['pTalking'];if(_0x20a33b>_0x29e9a9){_0x20a33b=_0x29e9a9;}}if(_0x20a33b>0x0){if(_0x19d761[_0x805c('0x60')]===_0x805c('0x9')){_0x20a33b=0x1;}if(_0x20a33b>this[_0x805c('0x2a')]){_0x20a33b=this[_0x805c('0x2a')];}_0x19d761['temp']+=_0x20a33b;for(var _0x104eb1 in this[_0x805c('0x28')]){if(this[_0x805c('0x28')][_0x805c('0x9f')](_0x104eb1)){if(this[_0x805c('0x28')][_0x104eb1][_0x805c('0xac')]==='not_inuse'&&this[_0x805c('0x28')][_0x104eb1][_0x805c('0xdd')]===_0x805c('0xde')){_0x4fc407['push'](this[_0x805c('0x28')][_0x104eb1]['id']);}}}this[_0x805c('0xc5')](_0x19d761['id'],_0x4fc407,_0x20a33b,_0x19d761[_0x805c('0x205')])['then'](function(_0x145b7b){_0x19d761['temp']-=_0x20a33b;_0x19d761[_0x805c('0x204')]=_0x19d761['temp']>0x0?_0x19d761[_0x805c('0x204')]:0x0;if(!checkContactEmpty(_0x145b7b)){_0x23d7cd['countReScheduled'](_0x19d761)[_0x805c('0xbc')](sendMessageReschedule(_0x19d761))[_0x805c('0xb5')](loggerCatch(_0x805c('0x20d')));}else{_0x19d761[_0x805c('0xa0')]+=_0x145b7b[_0x805c('0x9e')];_0x19d761[_0x805c('0x48')]=_0x19d761[_0x805c('0x60')]===_0x805c('0x9')?_0x805c('0x179'):_0x805c('0x207');for(var _0x4bab7b=0x0;_0x4bab7b<_0x145b7b['length'];_0x4bab7b+=0x1){if(_[_0x805c('0xb2')](_0x145b7b[_0x4bab7b])||_[_0x805c('0xb2')](_0x145b7b[_0x4bab7b][_0x805c('0x170')])||_[_0x805c('0xb2')](_0x145b7b[_0x4bab7b]['Contact'][_0x805c('0x171')])){_0x23d7cd[_0x805c('0xcf')](_0x805c('0x209'),_0x19d761,_0x145b7b[_0x4bab7b]);}else{_0x23d7cd['checkIsBlackList'](_[_0x805c('0xd2')](_0x145b7b[_0x4bab7b],[_0x805c('0xd6'),_0x805c('0x20a')]))[_0x805c('0xbc')](_0x23d7cd[_0x805c('0x1e9')](_0x19d761,_0x145b7b[_0x4bab7b]))['catch'](_0x23d7cd[_0x805c('0x20b')](_0x805c('0x209'),_0x19d761));}}}})['catch'](loggerGetContactDialer(_0x805c('0x20e'),_0x19d761,_0x20a33b));}};Dialer['prototype'][_0x805c('0x96')]=function(_0xf29a9d){var _0x15a91d=this;if(_0xf29a9d[_0x805c('0x20f')]>0x0){var _0xdbd03b=_0xf29a9d[_0x805c('0x20f')]-_0xf29a9d[_0x805c('0xa0')]-_0xf29a9d[_0x805c('0x5a')];if(_0xdbd03b>0x0){this[_0x805c('0x210')](_0xf29a9d);}else{loggerPredictiveCalls[_0x805c('0x83')]('[handlePredictive][limitChannel]');}}else{this[_0x805c('0x210')](_0xf29a9d);}};Dialer['prototype']['tryOriginatePredictive']=function(_0xf2587a){var _0x1121ea=this;var _0x3b9326=[];_0xf2587a[_0x805c('0xa0')]+=0x1;for(var _0x363756 in this[_0x805c('0x28')]){if(this[_0x805c('0x28')][_0x805c('0x9f')](_0x363756)){if(this[_0x805c('0x28')][_0x363756][_0x805c('0xac')]===_0x805c('0x211')&&this[_0x805c('0x28')][_0x363756][_0x805c('0xdd')]==='reachable'){_0x3b9326[_0x805c('0x151')](this['agents'][_0x363756]['id']);}}}this[_0x805c('0xc5')](_0xf2587a['id'],_0x3b9326,0x1,_0xf2587a['dialOrderByScheduledAt'])['then'](function(_0x413128){if(!checkContactEmpty(_0x413128)){checkContactLowerLimitOriginate(_0xf2587a,0x1,0x0);_0x1121ea['countReScheduled'](_0xf2587a)[_0x805c('0xbc')](sendMessageReschedule(_0xf2587a))[_0x805c('0xb5')](loggerCatch('[countReScheduled]\x20'));}else{_0xf2587a[_0x805c('0x48')]=_0x805c('0x207');if(_[_0x805c('0xb2')](_0x413128[0x0])||_['isNil'](_0x413128[0x0]['Contact'])||_[_0x805c('0xb2')](_0x413128[0x0][_0x805c('0x170')][_0x805c('0x171')])){_0x1121ea[_0x805c('0xcf')]('[actionOriginate]\x20',_0xf2587a,_0x413128[0x0]);}else{_0x1121ea[_0x805c('0xbd')](_[_0x805c('0xd2')](_0x413128[0x0],[_0x805c('0xd6'),_0x805c('0x20a')]))[_0x805c('0xbc')](_0x1121ea[_0x805c('0x1e9')](_0xf2587a,_0x413128[0x0]))['catch'](_0x1121ea['loggerHandler'](_0x805c('0x212'),_0xf2587a));}}})[_0x805c('0xb5')](loggerGetContactDialer('[getContactDialerPredictive]',_0xf2587a,0x1));emitVoiceQueueSummary(_0xf2587a);};Dialer[_0x805c('0x21')][_0x805c('0x1e4')]=function(_0x32bdaf,_0x1d3b49,_0x1d4846,_0x4fc7d2,_0x50eae8,_0x2b3806){loggerPredictive[_0x805c('0x83')](_0x805c('0x213'));loggerPredictive[_0x805c('0x83')]('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',_0x32bdaf);loggerPredictive[_0x805c('0x83')](_0x805c('0x214'),_0x1d3b49);loggerPredictive[_0x805c('0x83')](_0x805c('0x215'),_0x1d4846);loggerPredictive[_0x805c('0x83')](_0x805c('0x216'),_0x4fc7d2);loggerPredictive[_0x805c('0x83')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x50eae8);loggerPredictive[_0x805c('0x83')](_0x805c('0x8a'));return new BPromise(function(_0x4b4f5d,_0x525701){if(_0x32bdaf<=0x0||isNaN(_0x32bdaf)){return _0x525701(msgResponse('[abandonmentRate]',_0x805c('0x198'),'m\x20=\x20'+_0x32bdaf));}if(_0x1d4846<=0x0||isNaN(_0x1d4846)){return _0x525701(msgResponse(_0x805c('0x217'),'Error',_0x805c('0x218')+_0x1d4846));}if(_0x4fc7d2<=0x0||isNaN(_0x4fc7d2)){return _0x525701(msgResponse('[abandonmentRate]','Error',_0x805c('0x219')+_0x4fc7d2));}if(_0x1d3b49<=0x0||isNaN(_0x1d3b49)){return _0x525701(msgResponse(_0x805c('0x217'),_0x805c('0x198'),_0x805c('0x21a')+_0x1d3b49));}if(_0x50eae8<=0x0||isNaN(_0x50eae8)){return _0x525701(msgResponse('[abandonmentRate]',_0x805c('0x198'),_0x805c('0x21b')+_0x50eae8));}_0x2b3806=_0x2b3806||0x0;var _0x4c6624=0x1/_0x1d4846;var _0x66768a=0x0;var _0x177e48=0x0;var _0x20cc6d=0x0;var _0x20d3bd=0x0;for(var _0x3f48b5=0x0;_0x20cc6d<_0x50eae8;_0x3f48b5+=0x1){_0x177e48=_0x3f48b5/_0x1d3b49;_0x66768a=(_0x4fc7d2*_0x177e48+_0x2b3806)/_0x4c6624;_0x20cc6d=erlangb(_0x66768a,_0x32bdaf);_0x20d3bd=_0x66768a/_0x32bdaf*(0x1-erlangb(_0x66768a,_0x32bdaf));}return _0x4b4f5d({'erlangCalls':_0x3f48b5,'erlangCallToSecond':_0x1d3b49/_0x3f48b5,'erlangAbandonmentRate':_0x20cc6d,'erlangBusyFactor':_0x20d3bd});});};Dialer[_0x805c('0x21')][_0x805c('0x1df')]=function(_0x530118,_0x556cf4,_0x4008eb,_0x12fce6,_0x118e2d,_0x34543c){loggerPredictive['info'](_0x805c('0x21c'));loggerPredictive[_0x805c('0x83')](_0x805c('0x21d'),_0x530118);loggerPredictive['info'](_0x805c('0x214'),_0x556cf4);loggerPredictive['info'](_0x805c('0x215'),_0x4008eb);loggerPredictive[_0x805c('0x83')](_0x805c('0x216'),_0x12fce6);loggerPredictive['info'](_0x805c('0x21e'),_0x118e2d);loggerPredictive[_0x805c('0x83')]('---------------------------');return new BPromise(function(_0x5f12d5,_0x4c226b){if(_0x530118<=0x0||isNaN(_0x530118)){return _0x4c226b(msgResponse(_0x805c('0x21f'),_0x805c('0x198'),'m\x20=\x20'+_0x530118));}if(_0x4008eb<=0x0||isNaN(_0x4008eb)){return _0x4c226b(msgResponse(_0x805c('0x21f'),_0x805c('0x198'),'Ts\x20=\x20'+_0x4008eb));}if(_0x12fce6<=0x0||isNaN(_0x12fce6)){return _0x4c226b(msgResponse('[busyFactor]',_0x805c('0x198'),_0x805c('0x219')+_0x12fce6));}if(_0x556cf4<=0x0||isNaN(_0x556cf4)){return _0x4c226b(msgResponse(_0x805c('0x21f'),_0x805c('0x198'),_0x805c('0x21a')+_0x556cf4));}if(_0x118e2d<=0x0||isNaN(_0x118e2d)){return _0x4c226b(msgResponse(_0x805c('0x21f'),'Error',_0x805c('0x220')+_0x118e2d));}_0x34543c=_0x34543c||0x0;var _0x40c693=0x1/_0x4008eb;var _0x204319=0x0;var _0x56eccc=0x0;var _0x404a6e=0x0;var _0x357fd8=0x0;for(var _0x2f3ece=0x0;_0x357fd8<_0x118e2d;_0x2f3ece+=0x1){_0x56eccc=_0x2f3ece/_0x556cf4;_0x204319=(_0x12fce6*_0x56eccc+_0x34543c)/_0x40c693;_0x404a6e=erlangb(_0x204319,_0x530118);_0x357fd8=_0x204319/_0x530118*(0x1-erlangb(_0x204319,_0x530118));}return _0x5f12d5({'erlangCalls':_0x2f3ece,'erlangCallToSecond':_0x556cf4/_0x2f3ece,'erlangAbandonmentRate':_0x404a6e,'erlangBusyFactor':_0x357fd8});});};module[_0x805c('0x221')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index cbf45c5..ee66840 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 _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 +var _0x5e78=['originatecalleridname','util','moment','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x3e9984,_0x4cbdf7){var _0x54d672=function(_0x12b842){while(--_0x12b842){_0x3e9984['push'](_0x3e9984['shift']());}};_0x54d672(++_0x4cbdf7);}(_0x5e78,0xbf));var _0x85e7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e78[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x85e7('0x0'));var _=require('lodash');var moment=require(_0x85e7('0x1'));function getSeconds(_0x1d233f,_0x5144e2){var _0x226f64=moment(_0x1d233f)['milliseconds'](0x0);var _0x19fdbb=moment(_0x5144e2)['milliseconds'](0x0);return _0x226f64[_0x85e7('0x2')](_0x19fdbb,_0x85e7('0x3'));}function QueueCallerAbandon(_0x40d312,_0x36695e){this[_0x85e7('0x4')]=_0x40d312[_0x85e7('0x4')];this[_0x85e7('0x5')]=_0x40d312[_0x85e7('0x5')];this[_0x85e7('0x6')]=_0x40d312[_0x85e7('0x5')]===_0x85e7('0x7')?_0x85e7('0x8'):_0x40d312[_0x85e7('0x5')];this[_0x85e7('0x9')]=_0x40d312['countbusyretry'];this[_0x85e7('0xa')]=_0x40d312[_0x85e7('0xa')];this[_0x85e7('0xb')]=_0x40d312[_0x85e7('0xb')];this[_0x85e7('0xc')]=_0x40d312[_0x85e7('0x9')]+_0x40d312[_0x85e7('0xa')]+_0x40d312[_0x85e7('0xb')]+_0x40d312[_0x85e7('0xd')]+_0x40d312[_0x85e7('0xe')]+_0x40d312[_0x85e7('0xf')]+_0x40d312['countmachineretry']+_0x40d312[_0x85e7('0x10')];this['countnosuchnumberretry']=_0x40d312[_0x85e7('0xd')];this[_0x85e7('0xe')]=_0x40d312[_0x85e7('0xe')];this['countabandonedretry']=_0x40d312[_0x85e7('0xf')];this[_0x85e7('0x11')]=_0x40d312['countmachineretry'];this['countagentrejectretry']=_0x40d312[_0x85e7('0x10')];this[_0x85e7('0x12')]=_0x36695e[_0x85e7('0x12')];this['calleridname']=_0x40d312['name'];this['calleridnum']=_0x40d312['number'];this[_0x85e7('0x13')]=_0x40d312['starttime'];this[_0x85e7('0x14')]=_0x40d312[_0x85e7('0x14')];this['droptime']=_0x40d312[_0x85e7('0x15')];this[_0x85e7('0x16')]=this[_0x85e7('0x15')];this[_0x85e7('0x17')]=getSeconds(_0x40d312['responsetime'],_0x40d312[_0x85e7('0x13')]);this[_0x85e7('0x18')]=getSeconds(this[_0x85e7('0x15')],_0x40d312[_0x85e7('0x14')]);this[_0x85e7('0x19')]=0x0;this[_0x85e7('0x8')]=_0x36695e[_0x85e7('0x8')];this['membername']=_0x36695e[_0x85e7('0x1a')];this['reason']=_0x36695e[_0x85e7('0x1b')];this[_0x85e7('0x1c')]=_0x40d312[_0x85e7('0x1c')];this[_0x85e7('0x1d')]=_0x40d312[_0x85e7('0x1d')];this['callbackat']=_0x40d312[_0x85e7('0x1e')];this[_0x85e7('0x1f')]=_0x40d312[_0x85e7('0x1f')];this[_0x85e7('0x20')]=_0x40d312[_0x85e7('0x20')];this[_0x85e7('0x21')]=_0x40d312['ListId'];this[_0x85e7('0x22')]=_0x40d312[_0x85e7('0x22')];this['VoiceQueueId']=_0x40d312[_0x85e7('0x23')];this[_0x85e7('0x24')]=_0x40d312[_0x85e7('0x24')];this['originatecalleridnum']=_0x40d312['originatecalleridnum']||'';this[_0x85e7('0x25')]=_0x40d312[_0x85e7('0x25')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index d5bbae9..33f72c2 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 _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 +var _0x2272=['path','AttachmentId','util','lodash','moment','uniqueid','format','tech','fax','localstationid','headerinfo'];(function(_0x342f14,_0x313a28){var _0x482405=function(_0x4b1aaa){while(--_0x4b1aaa){_0x342f14['push'](_0x342f14['shift']());}};_0x482405(++_0x313a28);}(_0x2272,0x136));var _0x2227=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2272[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0x2227('0x0'));var _=require(_0x2227('0x1'));var moment=require(_0x2227('0x2'));function Action(_0xdf8a79,_0x4acb17,_0x351338){this[_0x2227('0x3')]=_0xdf8a79||undefined;this['channel']=util[_0x2227('0x4')]('%s/%s/%s',_0x4acb17[_0x2227('0x5')],_0x4acb17['Trunk']['name'],_0x351338[_0x2227('0x6')]);this['localstationid']=_0x4acb17[_0x2227('0x7')];this[_0x2227('0x8')]=_0x4acb17[_0x2227('0x8')];this[_0x2227('0x9')]=_0x351338[_0x2227('0x9')];this[_0x2227('0xa')]=_0x351338[_0x2227('0xa')];}module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index f2c662d..f60b99b 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 _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 +var _0xc8ed=['.pdf','application/pdf','notify','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate2]','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','isValid','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','format','%s/%s.tif','dir','XMF-PATH','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','./util/gs','../../../config/logger','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','syncNewState','faxstatus','syncFaxStatus','syncReceiveFax','syncHangup','syncOriginateResponse','prototype','context','from-voip-provider','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','hasOwnProperty','channelstate','channelstatedesc','syncNewExten','value','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse'];(function(_0x181f30,_0x59e7e0){var _0x175754=function(_0x5f0751){while(--_0x5f0751){_0x181f30['push'](_0x181f30['shift']());}};_0x175754(++_0x59e7e0);}(_0xc8ed,0x1a4));var _0xdc8e=function(_0x549a20,_0x4c58ab){_0x549a20=_0x549a20-0x0;var _0x537b8f=_0xc8ed[_0x549a20];return _0x537b8f;};'use strict';var util=require(_0xdc8e('0x0'));var _=require(_0xdc8e('0x1'));var BPromise=require(_0xdc8e('0x2'));var uuid=require(_0xdc8e('0x3'));var moment=require(_0xdc8e('0x4'));var path=require(_0xdc8e('0x5'));var tiff2pdf=require('tiff2pdf');var gs=require(_0xdc8e('0x6'));var logger=require(_0xdc8e('0x7'))('fax');var ami=require('../ami');var rpcDb=require(_0xdc8e('0x8'));var Channel=require(_0xdc8e('0x9'));var ut=require(_0xdc8e('0xa'));var Action=require(_0xdc8e('0xb'));var faxAccount=require(_0xdc8e('0xc'));var attachment=require(_0xdc8e('0xd'));var faxMessage=require(_0xdc8e('0xe'));function Fax(_0x108cc4){this[_0xdc8e('0xf')]={};this[_0xdc8e('0x10')]=_0x108cc4[_0xdc8e('0x10')];this[_0xdc8e('0x11')]=_0x108cc4['trunks'];this[_0xdc8e('0x12')]={};ami['on'](_0xdc8e('0x13'),this[_0xdc8e('0x14')][_0xdc8e('0x15')](this));ami['on'](_0xdc8e('0x16'),this[_0xdc8e('0x17')][_0xdc8e('0x15')](this));ami['on']('newstate',this[_0xdc8e('0x18')][_0xdc8e('0x15')](this));ami['on']('newexten',this['syncNewExten'][_0xdc8e('0x15')](this));ami['on'](_0xdc8e('0x19'),this[_0xdc8e('0x1a')][_0xdc8e('0x15')](this));ami['on']('receivefax',this[_0xdc8e('0x1b')][_0xdc8e('0x15')](this));ami['on']('hangup',this[_0xdc8e('0x1c')][_0xdc8e('0x15')](this));ami['on']('originateresponse',this[_0xdc8e('0x1d')][_0xdc8e('0x15')](this));}Fax[_0xdc8e('0x1e')][_0xdc8e('0x14')]=function(_0x4c8850){if(_0x4c8850[_0xdc8e('0x1f')]===_0xdc8e('0x20')){for(var _0x58b44d in this[_0xdc8e('0x10')]){if(this[_0xdc8e('0x10')]['hasOwnProperty'](_0x58b44d)){if(_0x4c8850[_0xdc8e('0x21')]===this[_0xdc8e('0x10')][_0x58b44d][_0xdc8e('0x22')]){this[_0xdc8e('0xf')][_0x4c8850[_0xdc8e('0x23')]]={};this[_0xdc8e('0xf')][_0x4c8850[_0xdc8e('0x23')]][_0xdc8e('0x24')]=_0x4c8850[_0xdc8e('0x24')];this[_0xdc8e('0xf')][_0x4c8850[_0xdc8e('0x23')]]['id']=this[_0xdc8e('0x10')][_0x58b44d]['id'];this['channels'][_0x4c8850[_0xdc8e('0x23')]][_0xdc8e('0x25')]=this[_0xdc8e('0x10')][_0x58b44d]['name'];logger[_0xdc8e('0x26')](_0x4c8850['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this[_0xdc8e('0x12')][_0x4c8850[_0xdc8e('0x23')]]){this[_0xdc8e('0xf')][_0x4c8850[_0xdc8e('0x23')]]={};this[_0xdc8e('0xf')][_0x4c8850[_0xdc8e('0x23')]]['channel']=_0x4c8850[_0xdc8e('0x24')];logger[_0xdc8e('0x26')](_0x4c8850['uniqueid'],_0xdc8e('0x27'));}};Fax[_0xdc8e('0x1e')][_0xdc8e('0x17')]=function(_0x21891c){if(this[_0xdc8e('0xf')][_0x21891c[_0xdc8e('0x23')]]){for(var _0x53b67f in _0x21891c['variable']){if(_0x21891c[_0xdc8e('0x28')][_0xdc8e('0x29')](_0x53b67f)){this[_0xdc8e('0xf')][_0x21891c[_0xdc8e('0x23')]][_0x53b67f]=_0x21891c['value'];}}}};Fax['prototype']['syncNewState']=function(_0x24b31e){if(this['channels'][_0x24b31e[_0xdc8e('0x23')]]){this[_0xdc8e('0xf')][_0x24b31e['uniqueid']][_0xdc8e('0x2a')]=_0x24b31e[_0xdc8e('0x2a')];this['channels'][_0x24b31e['uniqueid']][_0xdc8e('0x2b')]=_0x24b31e['channelstatedesc'];}};Fax['prototype'][_0xdc8e('0x2c')]=function(_0x3aca72){if(this[_0xdc8e('0xf')][_0x3aca72[_0xdc8e('0x23')]]){for(var _0x54d290 in _0x3aca72[_0xdc8e('0x28')]){if(_0x3aca72['variable']['hasOwnProperty'](_0x54d290)){this[_0xdc8e('0xf')][_0x3aca72[_0xdc8e('0x23')]][_0x54d290]=_0x3aca72[_0xdc8e('0x2d')];}}}};Fax['prototype'][_0xdc8e('0x1a')]=function(_0x1c1094){if(this['channels'][_0x1c1094[_0xdc8e('0x23')]]){this['channels'][_0x1c1094[_0xdc8e('0x23')]][_0xdc8e('0x2e')]=_0x1c1094[_0xdc8e('0x2e')];this[_0xdc8e('0xf')][_0x1c1094[_0xdc8e('0x23')]][_0xdc8e('0x2f')]=_0x1c1094[_0xdc8e('0x2f')];this[_0xdc8e('0xf')][_0x1c1094['uniqueid']][_0xdc8e('0x22')]=_0x1c1094['localstationid'];this[_0xdc8e('0xf')][_0x1c1094[_0xdc8e('0x23')]][_0xdc8e('0x30')]=_0x1c1094[_0xdc8e('0x30')];logger[_0xdc8e('0x26')](_0x1c1094[_0xdc8e('0x23')],_0xdc8e('0x31'));}};Fax[_0xdc8e('0x1e')][_0xdc8e('0x1b')]=function(_0x46a12d){var _0x2a9cb5=this;if(this['channels'][_0x46a12d[_0xdc8e('0x23')]]){var _0x5c8e8d=this['channels'][_0x46a12d[_0xdc8e('0x23')]]['id'];this['channels'][_0x46a12d[_0xdc8e('0x23')]][_0xdc8e('0x32')]=_0x46a12d[_0xdc8e('0x32')];this[_0xdc8e('0xf')][_0x46a12d[_0xdc8e('0x23')]][_0xdc8e('0x33')]=_0x46a12d['pagestransferred'];this[_0xdc8e('0xf')][_0x46a12d[_0xdc8e('0x23')]]['localstationid']=_0x46a12d['localstationid'];this[_0xdc8e('0xf')][_0x46a12d['uniqueid']]['resolution']=_0x46a12d[_0xdc8e('0x34')];this['channels'][_0x46a12d[_0xdc8e('0x23')]][_0xdc8e('0x35')]=_0x46a12d[_0xdc8e('0x35')];this[_0xdc8e('0xf')][_0x46a12d['uniqueid']][_0xdc8e('0x30')]=_0x46a12d[_0xdc8e('0x30')];this['channels'][_0x46a12d[_0xdc8e('0x23')]][_0xdc8e('0x36')]=_0x46a12d['calleridnum'];if(this[_0xdc8e('0xf')][_0x46a12d[_0xdc8e('0x23')]][_0xdc8e('0x33')]>0x0){tiff2pdf(_0x46a12d[_0xdc8e('0x30')],_0xdc8e('0x37'),function(_0x289f02){logger[_0xdc8e('0x26')](_0x46a12d[_0xdc8e('0x23')],_0xdc8e('0x38'),_0x289f02[_0xdc8e('0x39')]);attachment[_0xdc8e('0x3a')]({'name':path[_0xdc8e('0x3b')](_0x46a12d['filename'])[_0xdc8e('0x25')],'basename':path[_0xdc8e('0x3b')](_0x46a12d[_0xdc8e('0x30')])[_0xdc8e('0x25')]+_0xdc8e('0x3c'),'type':_0xdc8e('0x3d')})['then'](function(_0x59ce98){faxAccount[_0xdc8e('0x3e')](_0x5c8e8d,{'from':_0x46a12d[_0xdc8e('0x36')],'mapKey':_0xdc8e('0x3f'),'body':path[_0xdc8e('0x3b')](_0x46a12d[_0xdc8e('0x30')])[_0xdc8e('0x25')]+_0xdc8e('0x3c'),'AttachmentId':_0x59ce98['id']})[_0xdc8e('0x40')](function(_0x3e575e){logger[_0xdc8e('0x41')](_0x46a12d[_0xdc8e('0x23')],_0xdc8e('0x42'),JSON[_0xdc8e('0x43')](_0x3e575e));});})['catch'](function(_0x344b2f){logger[_0xdc8e('0x41')](_0x46a12d[_0xdc8e('0x23')],_0xdc8e('0x44'),JSON[_0xdc8e('0x43')](_0x344b2f));});});}logger[_0xdc8e('0x26')](_0x46a12d[_0xdc8e('0x23')],_0xdc8e('0x44'));}};Fax[_0xdc8e('0x1e')][_0xdc8e('0x1d')]=function(_0x3fb732){if(this[_0xdc8e('0x12')][_0x3fb732[_0xdc8e('0x23')]]){_[_0xdc8e('0x45')](this[_0xdc8e('0xf')][_0x3fb732[_0xdc8e('0x23')]],_[_0xdc8e('0x46')](_0x3fb732,[_0xdc8e('0x47'),_0xdc8e('0x48')]));}};function updateStatus(_0x54ecd1){if(_0x54ecd1[_0xdc8e('0x49')]){faxMessage[_0xdc8e('0x4a')](_0x54ecd1[_0xdc8e('0x49')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xdc8e('0x4b')](function(_0x202861){ut[_0xdc8e('0x4c')](_0xdc8e('0x4d'),_0x202861);})['catch'](function(_0xf83443){ut[_0xdc8e('0x4c')](_0xdc8e('0x4e'),_0xf83443);});}else{ut[_0xdc8e('0x4c')](_0xdc8e('0x4f'));}}Fax[_0xdc8e('0x1e')]['updateStatus']=function(_0x1bb707,_0x512475,_0x3766cf){var _0x17c1ae=this;var _0x48272d={};if(_0x512475){_0x48272d={'read':_0x512475};}else{_0x48272d={'failMessage':_0x3766cf};}if(this[_0xdc8e('0x12')][_0x1bb707][_0xdc8e('0x49')]){faxMessage[_0xdc8e('0x4a')](this[_0xdc8e('0x12')][_0x1bb707][_0xdc8e('0x49')],_0x48272d)['then'](function(_0xd4b26d){ut['logger'](_0xdc8e('0x50'),_0xd4b26d);})[_0xdc8e('0x40')](function(_0x4a0e0c){ut[_0xdc8e('0x4c')]('[Fax][Message][NoUpdate1]',_0x4a0e0c);})['finally'](function(){delete _0x17c1ae['channels'][_0x1bb707];delete _0x17c1ae[_0xdc8e('0x12')][_0x1bb707];});}else{ut[_0xdc8e('0x4c')](_0xdc8e('0x51'));delete this[_0xdc8e('0xf')][_0x1bb707];delete this['actions'][_0x1bb707];}};Fax[_0xdc8e('0x1e')][_0xdc8e('0x1c')]=function(_0x1f0a96){var _0x3f440e=this;if(this[_0xdc8e('0xf')][_0x1f0a96['uniqueid']]){if(this[_0xdc8e('0x12')][_0x1f0a96[_0xdc8e('0x23')]]){this['channels'][_0x1f0a96['uniqueid']]['id']=this[_0xdc8e('0x12')][_0x1f0a96[_0xdc8e('0x23')]]['id'];this[_0xdc8e('0xf')][_0x1f0a96['uniqueid']][_0xdc8e('0x25')]=this[_0xdc8e('0x12')][_0x1f0a96[_0xdc8e('0x23')]][_0xdc8e('0x25')];}logger[_0xdc8e('0x26')](_0x1f0a96[_0xdc8e('0x23')],this[_0xdc8e('0x12')][_0x1f0a96[_0xdc8e('0x23')]]?'\x20hangup\x20sendFile\x20':'\x20hangup\x20faxRiceive\x20',JSON['stringify'](this['channels'][_0x1f0a96['uniqueid']]));if(this['actions'][_0x1f0a96[_0xdc8e('0x23')]]){if(this[_0xdc8e('0xf')][_0x1f0a96[_0xdc8e('0x23')]][_0xdc8e('0x52')]>0x0&&this[_0xdc8e('0xf')][_0x1f0a96['uniqueid']]['faxstatus']===_0xdc8e('0x53')){this['updateStatus'](_0x1f0a96['uniqueid'],!![]);}else{this[_0xdc8e('0x54')](_0x1f0a96['uniqueid'],![],this['channels'][_0x1f0a96['uniqueid']][_0xdc8e('0x55')]?'SENDING\x20FAILED:\x20'+this[_0xdc8e('0xf')][_0x1f0a96[_0xdc8e('0x23')]][_0xdc8e('0x55')]:_0xdc8e('0x56'));}}}};Fax[_0xdc8e('0x1e')][_0xdc8e('0x57')]=function(_0x57337d){var _0x17a777=this;return new BPromise(function(_0x2ea102,_0x52c574){_0x17a777[_0xdc8e('0x58')](_0x57337d,_0x17a777[_0xdc8e('0x10')][_0x57337d[_0xdc8e('0x59')]])[_0xdc8e('0x4b')](function(_0x2826c2){ut['logger'](_0xdc8e('0x5a'),_0x2826c2);_0x2ea102(ut[_0xdc8e('0x39')]('Fax\x20received'));})[_0xdc8e('0x40')](function(_0x3d4da7){ut[_0xdc8e('0x4c')](_0xdc8e('0x5b'),_0x3d4da7);updateStatus(_0x57337d);_0x52c574(ut[_0xdc8e('0x39')](_0xdc8e('0x5c')));});});};Fax[_0xdc8e('0x1e')][_0xdc8e('0x5d')]=function(_0x27b291){var _0x4c3b6e=this;return new BPromise(function(_0x5227c0,_0x2f4b7b){var _0x9fd684=_0x4c3b6e['checkTrunk'](_0x4c3b6e['faxAccounts'][_0x27b291[_0xdc8e('0x59')]][_0xdc8e('0x5e')],_0x27b291);if(_0x9fd684[_0xdc8e('0x5f')]){_0x5227c0(ut[_0xdc8e('0x39')](_0xdc8e('0x60')));}else{_0x2f4b7b(ut[_0xdc8e('0x39')](_0x9fd684[_0xdc8e('0x39')]));}});};function originate(_0x49ca53,_0x438df0,_0x4e480){return new BPromise(function(_0x33b71d,_0x5dedb1){if(_0x4e480){var _0x12e875=util['format'](_0xdc8e('0x61'),path[_0xdc8e('0x3b')](_0x49ca53[_0xdc8e('0x5')])[_0xdc8e('0x25')],_0x49ca53[_0xdc8e('0x5')]);gs[_0xdc8e('0x62')](_0x12e875)[_0xdc8e('0x4b')](function(){_0x49ca53[_0xdc8e('0x5')]=util[_0xdc8e('0x63')](_0xdc8e('0x64'),path[_0xdc8e('0x3b')](_0x49ca53[_0xdc8e('0x5')])[_0xdc8e('0x65')],path[_0xdc8e('0x3b')](_0x49ca53[_0xdc8e('0x5')])[_0xdc8e('0x25')]);_0x438df0[_0xdc8e('0x66')]=_0x49ca53[_0xdc8e('0x5')];ut[_0xdc8e('0x4c')]('Convert\x20pdf\x20to\x20tif','');ami[_0xdc8e('0x67')](ut[_0xdc8e('0x68')](_0x49ca53,_0x438df0))[_0xdc8e('0x4b')](function(_0x539027){_0x33b71d(_0x539027);})['catch'](function(_0x9b4cf3){_0x5dedb1(_0x9b4cf3);});})[_0xdc8e('0x40')](function(_0x252a8d){_0x5dedb1(_0x252a8d);});}else{ami[_0xdc8e('0x67')](ut['variablesAction'](_0x49ca53,_0x438df0))[_0xdc8e('0x4b')](function(_0x5b7820){_0x33b71d(_0x5b7820);})[_0xdc8e('0x40')](function(_0x20f5e0){_0x5dedb1(_0x20f5e0);});}});}Fax[_0xdc8e('0x1e')][_0xdc8e('0x58')]=function(_0x72c6e5,_0x138e94){var _0x2a2e07=this;return new BPromise(function(_0x3d42a6,_0x3ec2d5){var _0x1f954f=uuid['v4']();var _0x529744=ut['addVariables'](_0x72c6e5,_0x138e94);_0x2a2e07[_0xdc8e('0x12')][_0x1f954f]=new Action(_0x1f954f,_0x138e94,_0x72c6e5);var _0x15f1dd=_0x2a2e07[_0xdc8e('0x12')][_0x1f954f];if(path['parse'](_0x72c6e5[_0xdc8e('0x5')])[_0xdc8e('0x69')]===_0xdc8e('0x3c')){originate(_0x15f1dd,_0x529744,!![])[_0xdc8e('0x4b')](function(_0x1c2b6f){_0x3d42a6(_0x1c2b6f);})[_0xdc8e('0x40')](function(_0x3128e3){_0x3ec2d5(_0x3128e3);});}else{originate(_0x15f1dd,_0x529744,![])[_0xdc8e('0x4b')](function(_0x2eefb0){_0x3d42a6(_0x2eefb0);})[_0xdc8e('0x40')](function(_0x42ff1c){_0x3ec2d5(_0x42ff1c);});}});};Fax['prototype'][_0xdc8e('0x6a')]=function(_0x9fc6dd){return!_[_0xdc8e('0x6b')](_0x9fc6dd)&&!_[_0xdc8e('0x6b')](_0x9fc6dd[_0xdc8e('0x25')])&&!_[_0xdc8e('0x6b')](_0x9fc6dd[_0xdc8e('0x6c')])&&_0x9fc6dd['active']&&!_['isNil'](this['trunks'][util[_0xdc8e('0x63')]('SIP/%s',_0x9fc6dd['name'])])&&!_[_0xdc8e('0x6b')](this[_0xdc8e('0x11')][util['format'](_0xdc8e('0x6d'),_0x9fc6dd[_0xdc8e('0x25')])][_0xdc8e('0x2f')])&&(this[_0xdc8e('0x11')][util['format'](_0xdc8e('0x6d'),_0x9fc6dd[_0xdc8e('0x25')])][_0xdc8e('0x2f')]===_0xdc8e('0x6e')||this[_0xdc8e('0x11')][util[_0xdc8e('0x63')]('SIP/%s',_0x9fc6dd[_0xdc8e('0x25')])][_0xdc8e('0x2f')]===_0xdc8e('0x6f'));};Fax[_0xdc8e('0x1e')]['checkTrunk']=function(_0x1a832b,_0x5ed184){if(!this[_0xdc8e('0x6a')](_0x1a832b)){ut[_0xdc8e('0x4c')](_0xdc8e('0x70'),_[_0xdc8e('0x6b')](_0x1a832b)?'':_0x1a832b[_0xdc8e('0x25')]+_0xdc8e('0x71'));return{'isValid':![],'message':_0xdc8e('0x72')};}if(_['isNil'](_0x5ed184[_0xdc8e('0x3f')])){ut[_0xdc8e('0x4c')](_0xdc8e('0x73'),JSON[_0xdc8e('0x43')](_0x5ed184));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0x5ed184[_0xdc8e('0x5')])){ut['logger'](_0xdc8e('0x74'),JSON[_0xdc8e('0x43')](_0x5ed184));return{'isValid':![],'message':_0xdc8e('0x75')};}return{'isValid':!![],'message':_0xdc8e('0x76')};};module[_0xdc8e('0x77')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 7d95246..e8b6259 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 _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 +var _0x1ed6=['[Notify]\x20','util','../../../config/logger','preview','error','notify','catch'];(function(_0x175f52,_0x25fab3){var _0x16e957=function(_0x4202e8){while(--_0x4202e8){_0x175f52['push'](_0x175f52['shift']());}};_0x16e957(++_0x25fab3);}(_0x1ed6,0x174));var _0x61ed=function(_0x1d6150,_0x11ece5){_0x1d6150=_0x1d6150-0x0;var _0x11d850=_0x1ed6[_0x1d6150];return _0x11d850;};'use strict';var util=require(_0x61ed('0x0'));var BPromise=require('bluebird');var logger=require(_0x61ed('0x1'))(_0x61ed('0x2'));var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x27c267){return function(_0xaa946b){logger[_0x61ed('0x3')](_0x27c267,util['inspect'](_0xaa946b,{'showHidden':![],'depth':null}));};}exports[_0x61ed('0x4')]=function(_0x398a9e,_0x4130cf){return BPromise['resolve']()['then'](faxAccount[_0x61ed('0x4')](_0x398a9e,_0x4130cf))[_0x61ed('0x5')](loggerCatch(_0x61ed('0x6')));}; \ 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 6df911b..6abf7cd 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 _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 +var _0xca87=['Exec\x20gs','inspect','util','../../../../config/logger','fax','bluebird','exec','info'];(function(_0x5282eb,_0x334de9){var _0x50c5da=function(_0xee8ec0){while(--_0xee8ec0){_0x5282eb['push'](_0x5282eb['shift']());}};_0x50c5da(++_0x334de9);}(_0xca87,0x1a2));var _0x7ca8=function(_0x163d47,_0x299557){_0x163d47=_0x163d47-0x0;var _0xb784cb=_0xca87[_0x163d47];return _0xb784cb;};'use strict';var util=require(_0x7ca8('0x0'));var logger=require(_0x7ca8('0x1'))(_0x7ca8('0x2'));var BPromise=require(_0x7ca8('0x3'));var exec=require('child_process')[_0x7ca8('0x4')];exports['execute']=function(_0x50a8e2){return new BPromise(function(_0x3965ab,_0x4b7c12){exec(_0x50a8e2,function(_0x3c1ec1,_0x22bb4f,_0x43c2a2){logger[_0x7ca8('0x5')](_0x7ca8('0x6'),_0x22bb4f);if(_0x3c1ec1){logger[_0x7ca8('0x5')]('Exec\x20gs','\x20Error\x20:',util[_0x7ca8('0x7')](_0x3c1ec1,{'showHidden':![],'depth':null}),_0x22bb4f,_0x43c2a2);_0x4b7c12(_0x3c1ec1);}_0x3965ab(_0x22bb4f);});});}; \ 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 468c1d4..17137ba 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 _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 +var _0xf45e=['xcally-motion-fax','from-sip','util','moment','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel'];(function(_0x303be1,_0x11dcfc){var _0x3e0191=function(_0x2a2b1a){while(--_0x2a2b1a){_0x303be1['push'](_0x303be1['shift']());}};_0x3e0191(++_0x11dcfc);}(_0xf45e,0x115));var _0xef45=function(_0xb815e,_0x3f3236){_0xb815e=_0xb815e-0x0;var _0x403b6=_0xf45e[_0xb815e];return _0x403b6;};'use strict';var util=require(_0xef45('0x0'));var _=require('lodash');var moment=require(_0xef45('0x1'));var logger=require('../../../../config/logger')(_0xef45('0x2'));exports[_0xef45('0x3')]=function(_0x1cd055){return{'message':_0x1cd055};};exports[_0xef45('0x4')]=function(_0x37772f,_0x8b048c){logger[_0xef45('0x5')](_0x37772f,util[_0xef45('0x6')](_0x8b048c,{'showHidden':![],'depth':null}));};exports[_0xef45('0x7')]=function(_0x315b84,_0x2f2e92){var _0x3303ad={'XMF-ECM':_0x2f2e92[_0xef45('0x8')],'XMF-HEADERINFO':_0x2f2e92[_0xef45('0x9')],'XMF-MINRATE':_0x2f2e92[_0xef45('0xa')],'XMF-MAXRATE':_0x2f2e92[_0xef45('0xb')],'XMF-MODEM':util[_0xef45('0xc')](_0xef45('0xd'),_0x2f2e92[_0xef45('0xe')]),'XMF-GATEWAY':_0x2f2e92['gateway'],'XMF-FAXDETECT':_0x2f2e92[_0xef45('0xf')],'XMF-T38TIMEOUT':_0x2f2e92[_0xef45('0x10')],'XMF-LOCALSTATIONID':_0x2f2e92[_0xef45('0x11')],'XMF-PATH':_0x315b84[_0xef45('0x12')]};return _0x3303ad;};exports[_0xef45('0x13')]=function(_0x2b429f,_0x48eaf3){return{'actionid':_0x2b429f[_0xef45('0x14')],'action':_0xef45('0x15'),'channel':_0x2b429f[_0xef45('0x16')],'Exten':_0xef45('0x17'),'Context':_0xef45('0x18'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x2b429f[_0xef45('0x9')]?_0x2b429f['headerinfo']:'',_0x2b429f[_0xef45('0x11')]),'variable':_0x48eaf3,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2b429f[_0xef45('0x14')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 877511e..3d537f8 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 _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 +var _0x95d7=['./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','getAgents','then','initAgents','getTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','catch','log','listen','sync','bluebird','util','./server','./report','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/sugarcrm'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x95d7,0xf0));var _0x795d=function(_0x1c03d8,_0xb20daf){_0x1c03d8=_0x1c03d8-0x0;var _0x4661a8=_0x95d7[_0x1c03d8];return _0x4661a8;};'use strict';var BPromise=require(_0x795d('0x0'));var util=require(_0x795d('0x1'));var moment=require('moment');var server=require(_0x795d('0x2'));var Realtime=require('./realtime');var Report=require(_0x795d('0x3'));var Acw=require('./acw');var Trigger=require(_0x795d('0x4'));var Dialer=require('./dialer');var Preview=require(_0x795d('0x5'));var Fax=require(_0x795d('0x6'));var user=require(_0x795d('0x7'));var voiceQueue=require(_0x795d('0x8'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x795d('0x9'));var trigger=require(_0x795d('0xa'));var template=require(_0x795d('0xb'));var cmHopperHistory=require(_0x795d('0xc'));var campaign=require(_0x795d('0xd'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x795d('0xe'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x795d('0xf'));var freshdesk=require(_0x795d('0x10'));var desk=require(_0x795d('0x11'));var zoho=require(_0x795d('0x12'));var vtiger=require(_0x795d('0x13'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x795d('0x14'));var dynamics365=require(_0x795d('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()[_0x795d('0x16')](_0x795d('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x795d('0x16')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x795d('0x18')]()['then'](user[_0x795d('0x19')]())[_0x795d('0x1a')](realtime[_0x795d('0x1b')]())[_0x795d('0x1a')](user[_0x795d('0x1c')]())[_0x795d('0x1a')](realtime['initTelephones']())[_0x795d('0x1a')](trunk['getTrunks']())[_0x795d('0x1a')](realtime[_0x795d('0x1d')]())[_0x795d('0x1a')](voiceQueue[_0x795d('0x1e')]())[_0x795d('0x1a')](realtime[_0x795d('0x1f')]())['then'](trigger[_0x795d('0x20')]())[_0x795d('0x1a')](realtime['initTriggers']())[_0x795d('0x1a')](template[_0x795d('0x21')]())[_0x795d('0x1a')](realtime[_0x795d('0x22')]())[_0x795d('0x1a')](zendesk[_0x795d('0x23')]())[_0x795d('0x1a')](realtime[_0x795d('0x24')]())[_0x795d('0x1a')](salesforce['getSalesforceAccounts']())[_0x795d('0x1a')](realtime[_0x795d('0x25')]())['then'](sugarcrm['getSugarcrmAccounts']())[_0x795d('0x1a')](realtime[_0x795d('0x26')]())[_0x795d('0x1a')](freshdesk[_0x795d('0x27')]())[_0x795d('0x1a')](realtime[_0x795d('0x28')]())[_0x795d('0x1a')](desk[_0x795d('0x29')]())[_0x795d('0x1a')](realtime[_0x795d('0x2a')]())[_0x795d('0x1a')](zoho[_0x795d('0x2b')]())[_0x795d('0x1a')](realtime[_0x795d('0x2c')]())[_0x795d('0x1a')](vtiger[_0x795d('0x2d')]())['then'](realtime[_0x795d('0x2e')]())['then'](freshsales[_0x795d('0x2f')]())[_0x795d('0x1a')](realtime['initFreshsalesAccounts']())[_0x795d('0x1a')](servicenow['getServicenowAccounts']())['then'](realtime[_0x795d('0x30')]())[_0x795d('0x1a')](dynamics365[_0x795d('0x31')]())[_0x795d('0x1a')](realtime[_0x795d('0x32')]())[_0x795d('0x1a')](campaign['getCampaigns']())['then'](realtime[_0x795d('0x33')]())['then'](voiceExtension['getVoiceExtensions']())[_0x795d('0x1a')](realtime[_0x795d('0x34')]())[_0x795d('0x1a')](faxAccount[_0x795d('0x35')]())['then'](realtime[_0x795d('0x36')]())[_0x795d('0x1a')](function(){return realtime;});}function initParams(){return BPromise[_0x795d('0x18')]()[_0x795d('0x1a')](voiceQueueReport['getVoiceQueueReports']())[_0x795d('0x1a')](realtime[_0x795d('0x37')]())[_0x795d('0x1a')](cmHopperHistory[_0x795d('0x38')]())[_0x795d('0x1a')](realtime[_0x795d('0x39')]())['then'](cmHopperHistory[_0x795d('0x3a')]())[_0x795d('0x1a')](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0x795d('0x3b')]())['then'](realtime['initVoiceCallReports']())[_0x795d('0x1a')](function(_0x5e9657){})[_0x795d('0x3c')](function(_0x294be0){console[_0x795d('0x3d')](_0x294be0);});}function main(){return server[_0x795d('0x3e')](realtime,preview,fax)[_0x795d('0x1a')](function(_0x40dd8d){return initRealtime();})['then'](function(){return initParams();})[_0x795d('0x1a')](function(){report[_0x795d('0x3f')]();setInterval(initRealtime,0x1388);})[_0x795d('0x3c')](function(_0x5287df){console[_0x795d('0x3d')](_0x5287df);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 67d63b1..f2095c0 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 _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 +var _0x7238=['state','unknown','stateTime','status','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','md5','prototype','toLowerCase','not_inuse','idle','inuse','talking','statePause','address','stringify','format','user:%s','user:save','lodash','moment','ioredis','redis','defaults','socket.io-emitter','name','email','accountcode','fullname'];(function(_0x2ed48f,_0xdfa062){var _0x51da97=function(_0x455f34){while(--_0x455f34){_0x2ed48f['push'](_0x2ed48f['shift']());}};_0x51da97(++_0xdfa062);}(_0x7238,0x18d));var _0x8723=function(_0x569d43,_0x346aec){_0x569d43=_0x569d43-0x0;var _0x3797d5=_0x7238[_0x569d43];return _0x3797d5;};'use strict';var _=require(_0x8723('0x0'));var util=require('util');var moment=require(_0x8723('0x1'));var md5=require('md5');var Redis=require(_0x8723('0x2'));var config=require('../../../config/environment');config[_0x8723('0x3')]=_[_0x8723('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8723('0x5'))(new Redis(config[_0x8723('0x3')]));function Agent(_0x37de9a){this['id']=_0x37de9a['id']||0x0;this[_0x8723('0x6')]=_0x37de9a[_0x8723('0x6')]||'';this['email']=_0x37de9a[_0x8723('0x7')]||'';this[_0x8723('0x8')]=_0x37de9a['accountcode']||'';this[_0x8723('0x9')]=_0x37de9a[_0x8723('0x9')]||'';this[_0x8723('0xa')]=_0x8723('0xb');this[_0x8723('0xc')]=0x0;this[_0x8723('0xd')]=_0x8723('0xb');this['address']='';this[_0x8723('0xe')]='';this[_0x8723('0xf')]='';this[_0x8723('0x10')]='';this[_0x8723('0x11')]=_0x37de9a[_0x8723('0x11')]||![];this[_0x8723('0x12')]=_0x8723('0xb');this[_0x8723('0x13')]=0x0;this[_0x8723('0x14')]='';this[_0x8723('0x15')]='';this[_0x8723('0x16')]=![];this[_0x8723('0x17')]=![];this[_0x8723('0x18')]='';}Agent[_0x8723('0x19')]['updateStatusRealtime']=function(_0x357b8f){var _0x19c604;if(_0x357b8f&&_0x357b8f['state']){_0x19c604=_0x357b8f[_0x8723('0xa')][_0x8723('0x1a')]();switch(_0x19c604){case _0x8723('0x1b'):_0x19c604=_0x8723('0x1c');break;case _0x8723('0x1d'):_0x19c604=_0x8723('0x1e');break;}}if(_0x19c604&&this[_0x8723('0x12')]!==_0x19c604||_0x357b8f[_0x8723('0x1f')]){this['voiceStatusTime']=_['toNumber'](moment()['format']('x'));}if(_0x19c604){this[_0x8723('0x12')]=_0x19c604;}var _0x476479={'id':this['id'],'name':this['name'],'email':this[_0x8723('0x7')],'accountcode':this[_0x8723('0x8')],'fullname':this[_0x8723('0x9')],'state':this[_0x8723('0xa')],'stateTime':this[_0x8723('0xc')],'status':this['status'],'address':this[_0x8723('0x20')],'online':this['online'],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x8723('0x13')],'voiceStatusCallerIdNumber':this[_0x8723('0x14')],'voiceStatusQueue':this[_0x8723('0x15')],'interface':this[_0x8723('0x10')],'onhold':this[_0x8723('0x16')]};var _0x28df74=md5(JSON[_0x8723('0x21')](_0x476479));if(this['md5']!==_0x28df74){this[_0x8723('0x18')]=_0x28df74;io['to'](util[_0x8723('0x22')](_0x8723('0x23'),_0x476479[_0x8723('0x6')]))['emit'](_0x8723('0x24'),_0x476479);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 43028f9..33ca6cd 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 _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 +var _0xe773=['dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','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','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold'];(function(_0x36882c,_0x322593){var _0x9fc407=function(_0x159036){while(--_0x159036){_0x36882c['push'](_0x36882c['shift']());}};_0x9fc407(++_0x322593);}(_0xe773,0x19a));var _0x3e77=function(_0x131e7e,_0x26e756){_0x131e7e=_0x131e7e-0x0;var _0x4cb3a8=_0xe773[_0x131e7e];return _0x4cb3a8;};'use strict';function Campaign(_0x22ba1e){this['id']=_0x22ba1e['id']||0x0;this[_0x3e77('0x0')]=_0x22ba1e[_0x3e77('0x0')]||'';this[_0x3e77('0x1')]=_0x22ba1e['type']||_0x3e77('0x2');this[_0x3e77('0x3')]=0x0;this[_0x3e77('0x4')]=0x0;this[_0x3e77('0x5')]=0x0;this[_0x3e77('0x6')]=0x0;this['message']='';this[_0x3e77('0x7')]=!![];this[_0x3e77('0x8')]=_0x22ba1e[_0x3e77('0x8')];this[_0x3e77('0x9')]=_0x22ba1e[_0x3e77('0x9')];this[_0x3e77('0xa')]=_0x22ba1e[_0x3e77('0xa')]||null;this[_0x3e77('0xb')]=_0x22ba1e[_0x3e77('0xb')]?_0x22ba1e[_0x3e77('0xb')]:null;this[_0x3e77('0xc')]=_0x22ba1e['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x22ba1e[_0x3e77('0xd')];this[_0x3e77('0xe')]=_0x22ba1e[_0x3e77('0xe')]||0x1e;this[_0x3e77('0xf')]=_0x22ba1e[_0x3e77('0xf')];this['dialCongestionRetryFrequency']=_0x22ba1e[_0x3e77('0x10')];this['dialBusyMaxRetry']=_0x22ba1e['dialBusyMaxRetry'];this[_0x3e77('0x11')]=_0x22ba1e['dialBusyRetryFrequency'];this['dialNoAnswerMaxRetry']=_0x22ba1e[_0x3e77('0x12')];this[_0x3e77('0x13')]=_0x22ba1e[_0x3e77('0x13')];this['dialGlobalMaxRetry']=_0x22ba1e[_0x3e77('0x14')];this['dialNoSuchNumberMaxRetry']=_0x22ba1e[_0x3e77('0x15')]||0x3;this[_0x3e77('0x16')]=_0x22ba1e['dialNoSuchNumberRetryFrequency']||0x96;this[_0x3e77('0x17')]=_0x22ba1e[_0x3e77('0x17')]||0x3;this[_0x3e77('0x18')]=_0x22ba1e[_0x3e77('0x18')]||0x96;this[_0x3e77('0x19')]=_0x22ba1e[_0x3e77('0x19')]||0x3;this['dialAbandonedRetryFrequency']=_0x22ba1e[_0x3e77('0x1a')]||0x96;this[_0x3e77('0x1b')]=_0x22ba1e[_0x3e77('0x1b')]||0x3;this[_0x3e77('0x1c')]=_0x22ba1e['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x22ba1e[_0x3e77('0x1d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x22ba1e[_0x3e77('0x1e')]||0x96;this[_0x3e77('0x1f')]=_0x22ba1e[_0x3e77('0x1f')]||_0x3e77('0x20');this[_0x3e77('0x21')]=_0x22ba1e[_0x3e77('0x21')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x22ba1e[_0x3e77('0x22')]||undefined;this[_0x3e77('0x23')]=_0x22ba1e[_0x3e77('0x23')]||undefined;this[_0x3e77('0x24')]=_0x22ba1e[_0x3e77('0x24')]?_0x22ba1e[_0x3e77('0x24')]:undefined;this[_0x3e77('0x25')]=_0x22ba1e[_0x3e77('0x25')]?_0x22ba1e['Trunk']:undefined;this[_0x3e77('0x26')]=_0x22ba1e[_0x3e77('0x26')]?_0x22ba1e[_0x3e77('0x26')]:undefined;this[_0x3e77('0x27')]=_0x22ba1e['SquareProject']?_0x22ba1e[_0x3e77('0x27')]:undefined;this[_0x3e77('0x28')]=_0x22ba1e[_0x3e77('0x27')]?_0x22ba1e[_0x3e77('0x27')][_0x3e77('0x0')]:undefined;this[_0x3e77('0x29')]=_0x22ba1e[_0x3e77('0x29')]||![];this[_0x3e77('0x2a')]=_0x22ba1e[_0x3e77('0x2a')];this[_0x3e77('0x2b')]=_0x22ba1e[_0x3e77('0x2b')];this[_0x3e77('0x2c')]=_0x22ba1e['dialAMDAfterGreetingSilence'];this[_0x3e77('0x2d')]=_0x22ba1e[_0x3e77('0x2d')];this['dialAMDMinWordLength']=_0x22ba1e['dialAMDMinWordLength'];this[_0x3e77('0x2e')]=_0x22ba1e[_0x3e77('0x2e')];this[_0x3e77('0x2f')]=_0x22ba1e[_0x3e77('0x2f')];this['dialAMDSilenceThreshold']=_0x22ba1e[_0x3e77('0x30')];this['dialAMDMaximumWordLength']=_0x22ba1e[_0x3e77('0x31')];}module[_0x3e77('0x32')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 2c179f3..ded7fe2 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 _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 +var _0xda2d=['tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','billableseconds','holdtime'];(function(_0x592c14,_0x34cf86){var _0x1cc2eb=function(_0x28b4ec){while(--_0x28b4ec){_0x592c14['push'](_0x592c14['shift']());}};_0x1cc2eb(++_0x34cf86);}(_0xda2d,0x102));var _0xdda2=function(_0xf7e318,_0x2ee4a3){_0xf7e318=_0xf7e318-0x0;var _0x277989=_0xda2d[_0xf7e318];return _0x277989;};'use strict';function Channel(){this['starttime']=null;this[_0xdda2('0x0')]='';this[_0xdda2('0x1')]='';this[_0xdda2('0x2')]=0x0;this[_0xdda2('0x3')]='';this[_0xdda2('0x4')]=undefined;this['connectedlinename']=undefined;this['accountcode']=0x0;this['context']='';this[_0xdda2('0x5')]=0x0;this[_0xdda2('0x6')]=0x0;this[_0xdda2('0x7')]=0x0;this[_0xdda2('0x8')]=![];this[_0xdda2('0x9')]=null;this[_0xdda2('0xa')]=null;this[_0xdda2('0xb')]=![];this[_0xdda2('0xc')]=![];this[_0xdda2('0xd')]='';this[_0xdda2('0xe')]='';this['duration']=0x0;this[_0xdda2('0xf')]=0x0;this[_0xdda2('0x10')]=0x0;this['type']=null;this[_0xdda2('0x11')]=null;this[_0xdda2('0x12')]=null;this[_0xdda2('0x13')]=![];this[_0xdda2('0x14')]=null;this[_0xdda2('0x15')]=null;this[_0xdda2('0x16')]=[];this[_0xdda2('0x17')]=undefined;this[_0xdda2('0x18')]=undefined;this['mohtime']=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index ff4c02b..d536c80 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 _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 +var _0x0faf=['consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey'];(function(_0x177f87,_0x5799d3){var _0x2dadb4=function(_0x162293){while(--_0x162293){_0x177f87['push'](_0x177f87['shift']());}};_0x2dadb4(++_0x5799d3);}(_0x0faf,0x132));var _0xf0fa=function(_0x9ac89b,_0x25b61d){_0x9ac89b=_0x9ac89b-0x0;var _0x40da74=_0x0faf[_0x9ac89b];return _0x40da74;};'use strict';function DeskAccount(_0x9ed8b6){this['id']=_0x9ed8b6['id']||0x0;this['name']=_0x9ed8b6[_0xf0fa('0x0')]||'';this[_0xf0fa('0x1')]=_0x9ed8b6[_0xf0fa('0x1')]||'';this[_0xf0fa('0x2')]=_0x9ed8b6[_0xf0fa('0x2')]||'';this[_0xf0fa('0x3')]=_0x9ed8b6[_0xf0fa('0x3')]||'';this[_0xf0fa('0x4')]=_0x9ed8b6[_0xf0fa('0x4')]||'';this['consumerKey']=_0x9ed8b6[_0xf0fa('0x5')]||'';this[_0xf0fa('0x6')]=_0x9ed8b6[_0xf0fa('0x6')]||'';this[_0xf0fa('0x7')]=_0x9ed8b6[_0xf0fa('0x7')]||'';this['tokenSecret']=_0x9ed8b6[_0xf0fa('0x8')]||'';this[_0xf0fa('0x9')]=_0x9ed8b6['type']||'';this['serverUrl']=_0x9ed8b6[_0xf0fa('0xa')]||'';this[_0xf0fa('0xb')]=_0x9ed8b6[_0xf0fa('0xb')]||{};}module[_0xf0fa('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index b6fbc18..9e9faba 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 _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 +var _0x9cb3=['tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x1cd47d,_0x55bc75){var _0x29d52f=function(_0x37737a){while(--_0x37737a){_0x1cd47d['push'](_0x1cd47d['shift']());}};_0x29d52f(++_0x55bc75);}(_0x9cb3,0xb0));var _0x39cb=function(_0x57b3df,_0x445081){_0x57b3df=_0x57b3df-0x0;var _0x206656=_0x9cb3[_0x57b3df];return _0x206656;};'use strict';function Dynamics365Account(_0x42af8f){this['id']=_0x42af8f['id']||0x0;this[_0x39cb('0x0')]=_0x42af8f[_0x39cb('0x0')]||'';this[_0x39cb('0x1')]=_0x42af8f[_0x39cb('0x1')]||'';this['password']=_0x42af8f[_0x39cb('0x2')]||'';this[_0x39cb('0x3')]=_0x42af8f[_0x39cb('0x3')]||'';this[_0x39cb('0x4')]=_0x42af8f['tenantId']||'';this['clientId']=_0x42af8f[_0x39cb('0x5')]||'';this[_0x39cb('0x6')]=_0x42af8f[_0x39cb('0x6')]||{};this[_0x39cb('0x7')]=_0x42af8f[_0x39cb('0x7')]||'';this[_0x39cb('0x8')]=_0x42af8f[_0x39cb('0x8')]||{};}module[_0x39cb('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 9954cda..8dea018 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 _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 +var _0x3759=['exports','name','description','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','tech','SIP','Trunk','ListId','key'];(function(_0xb5145f,_0x20796a){var _0xf49fa8=function(_0x634974){while(--_0x634974){_0xb5145f['push'](_0xb5145f['shift']());}};_0xf49fa8(++_0x20796a);}(_0x3759,0x131));var _0x9375=function(_0xcc3d76,_0x1e943d){_0xcc3d76=_0xcc3d76-0x0;var _0x4da2a5=_0x3759[_0xcc3d76];return _0x4da2a5;};'use strict';function FaxAccount(_0x4e25c8){this['id']=_0x4e25c8['id']||0x0;this[_0x9375('0x0')]=_0x4e25c8[_0x9375('0x0')]||'';this[_0x9375('0x1')]=_0x4e25c8[_0x9375('0x1')];this['ecm']=_0x4e25c8['ecm'];this[_0x9375('0x2')]=_0x4e25c8[_0x9375('0x2')];this['localstationid']=_0x4e25c8[_0x9375('0x3')];this[_0x9375('0x4')]=_0x4e25c8['minrate']||0x960;this[_0x9375('0x5')]=_0x4e25c8[_0x9375('0x5')]||0x3840;this[_0x9375('0x6')]=_0x4e25c8[_0x9375('0x6')]||_0x9375('0x7');this[_0x9375('0x8')]=_0x4e25c8[_0x9375('0x8')]||'no';this[_0x9375('0x9')]=_0x4e25c8['faxdetect']||'no';this['t38timeout']=_0x4e25c8['t38timeout']||0x1388;this[_0x9375('0xa')]=_0x4e25c8[_0x9375('0xa')]||_0x9375('0xb');this['Trunk']=_0x4e25c8[_0x9375('0xc')]?_0x4e25c8[_0x9375('0xc')]:undefined;this[_0x9375('0xd')]=_0x4e25c8[_0x9375('0xd')];this['key']=_0x4e25c8[_0x9375('0xe')];}module[_0x9375('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 865a349..eab02f7 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 _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 +var _0x7e32=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e32,0x175));var _0x27e3=function(_0x3a31c3,_0x4b2e4d){_0x3a31c3=_0x3a31c3-0x0;var _0x1ec91b=_0x7e32[_0x3a31c3];return _0x1ec91b;};'use strict';function FreshdeskAccount(_0xd89c69){this['id']=_0xd89c69['id']||0x0;this[_0x27e3('0x0')]=_0xd89c69[_0x27e3('0x0')]||'';this[_0x27e3('0x1')]=_0xd89c69[_0x27e3('0x1')]||'';this[_0x27e3('0x2')]=_0xd89c69[_0x27e3('0x3')]||'';this[_0x27e3('0x4')]=_0xd89c69[_0x27e3('0x4')]||'';this[_0x27e3('0x5')]=_0xd89c69[_0x27e3('0x5')]||'';this[_0x27e3('0x6')]=_0xd89c69[_0x27e3('0x6')]||{};}module[_0x27e3('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 608bc4e..27ccbd4 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 _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 +var _0x9506=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0xb6ddbd,_0x17187f){var _0x17727=function(_0x918fd3){while(--_0x918fd3){_0xb6ddbd['push'](_0xb6ddbd['shift']());}};_0x17727(++_0x17187f);}(_0x9506,0xa9));var _0x6950=function(_0x313659,_0x2fc55){_0x313659=_0x313659-0x0;var _0x4023e5=_0x9506[_0x313659];return _0x4023e5;};'use strict';function FreshsalesAccount(_0xf3ebe3){this['id']=_0xf3ebe3['id']||0x0;this[_0x6950('0x0')]=_0xf3ebe3[_0x6950('0x0')]||'';this[_0x6950('0x1')]=_0xf3ebe3[_0x6950('0x1')]||'';this[_0x6950('0x2')]=_0xf3ebe3[_0x6950('0x3')]||'';this[_0x6950('0x4')]=_0xf3ebe3[_0x6950('0x4')]||'';this[_0x6950('0x5')]=_0xf3ebe3[_0x6950('0x5')]||'';this[_0x6950('0x6')]=_0xf3ebe3['Configurations']||{};}module[_0x6950('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 0ed3b05..707785c 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 _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 +var _0x1bfa=['queuecallerexit','originalposition','connectedlinenum','connectedlinename','context','exten','priority','holdtime','assigned','lastAssignedTo','mohtime','variables','exports','type','uniqueid','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallercomplete'];(function(_0x3bbd6b,_0x498df1){var _0x1d27fc=function(_0x2d7be7){while(--_0x2d7be7){_0x3bbd6b['push'](_0x3bbd6b['shift']());}};_0x1d27fc(++_0x498df1);}(_0x1bfa,0x1c2));var _0xa1bf=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x1bfa[_0x55e08b];return _0xd1a7ff;};'use strict';function QueueReport(){this[_0xa1bf('0x0')]='inbound';this[_0xa1bf('0x1')]='';this['calleridnum']='';this[_0xa1bf('0x2')]='';this[_0xa1bf('0x3')]='';this[_0xa1bf('0x4')]=null;this[_0xa1bf('0x5')]=null;this[_0xa1bf('0x6')]=0x1;this[_0xa1bf('0x7')]=0x1;this[_0xa1bf('0x8')]=![];this['queuecallerabandonAt']=null;this[_0xa1bf('0x9')]=![];this['queuecallercompleteAt']=null;this[_0xa1bf('0xa')]=![];this['queuecallerexitAt']=null;this[_0xa1bf('0xb')]=0x1;this['channel']='';this[_0xa1bf('0xc')]='';this[_0xa1bf('0xd')]='';this['accountcode']='';this[_0xa1bf('0xe')]='';this[_0xa1bf('0xf')]='';this[_0xa1bf('0x10')]='';this[_0xa1bf('0x11')]=0x0;this[_0xa1bf('0x12')]=![];this[_0xa1bf('0x13')]='';this[_0xa1bf('0x14')]=0x0;this[_0xa1bf('0x15')]={};}module[_0xa1bf('0x16')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index d9f8e45..c6b9e38 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 _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 +var _0x517b=['integrationTab','serverUrl','Configurations','exports','name','username','password','clientId','clientSecret','securityToken','type'];(function(_0x1a136b,_0x159444){var _0xcb20cc=function(_0x1974a4){while(--_0x1974a4){_0x1a136b['push'](_0x1a136b['shift']());}};_0xcb20cc(++_0x159444);}(_0x517b,0x88));var _0xb517=function(_0x5ce936,_0x4c5ce1){_0x5ce936=_0x5ce936-0x0;var _0x36fff0=_0x517b[_0x5ce936];return _0x36fff0;};'use strict';function SalesforceAccount(_0x3016df){this['id']=_0x3016df['id']||0x0;this[_0xb517('0x0')]=_0x3016df[_0xb517('0x0')]||'';this[_0xb517('0x1')]=_0x3016df[_0xb517('0x1')]||'';this['remoteUri']=_0x3016df['remoteUri']||'';this['password']=_0x3016df[_0xb517('0x2')]||'';this[_0xb517('0x3')]=_0x3016df[_0xb517('0x3')]||'';this[_0xb517('0x4')]=_0x3016df['clientSecret']||'';this[_0xb517('0x5')]=_0x3016df[_0xb517('0x5')]||'';this[_0xb517('0x6')]=_0x3016df[_0xb517('0x6')]||_0xb517('0x7');this[_0xb517('0x8')]=_0x3016df[_0xb517('0x8')]||'';this['Configurations']=_0x3016df[_0xb517('0x9')]||{};}module[_0xb517('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 15adec7..1cbd1aa 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 _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 +var _0x5494=['username','password','remoteUri','serverUrl','Configurations','name'];(function(_0x2882c1,_0x13c1fb){var _0x476c10=function(_0x487742){while(--_0x487742){_0x2882c1['push'](_0x2882c1['shift']());}};_0x476c10(++_0x13c1fb);}(_0x5494,0x191));var _0x4549=function(_0x545fe3,_0x3b191f){_0x545fe3=_0x545fe3-0x0;var _0x480702=_0x5494[_0x545fe3];return _0x480702;};'use strict';function ServicenowAccount(_0x158a43){this['id']=_0x158a43['id']||0x0;this['name']=_0x158a43[_0x4549('0x0')]||'';this[_0x4549('0x1')]=_0x158a43[_0x4549('0x1')]||'';this[_0x4549('0x2')]=_0x158a43['password']||'';this[_0x4549('0x3')]=_0x158a43['remoteUri']||'';this[_0x4549('0x4')]=_0x158a43['serverUrl']||'';this[_0x4549('0x5')]=_0x158a43[_0x4549('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 c973d56..7e06d5b 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 _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 +var _0xec2f=['username','password','remoteUri','serverUrl','Configurations','name'];(function(_0x3bba4c,_0x1554b5){var _0xb90a9a=function(_0x271abe){while(--_0x271abe){_0x3bba4c['push'](_0x3bba4c['shift']());}};_0xb90a9a(++_0x1554b5);}(_0xec2f,0xe3));var _0xfec2=function(_0x3fadd1,_0x289fee){_0x3fadd1=_0x3fadd1-0x0;var _0x22cb57=_0xec2f[_0x3fadd1];return _0x22cb57;};'use strict';function SugarcrmAccount(_0x3b64e7){this['id']=_0x3b64e7['id']||0x0;this[_0xfec2('0x0')]=_0x3b64e7['name']||'';this[_0xfec2('0x1')]=_0x3b64e7[_0xfec2('0x1')]||'';this[_0xfec2('0x2')]=_0x3b64e7['password']||'';this['remoteUri']=_0x3b64e7[_0xfec2('0x3')]||'';this[_0xfec2('0x4')]=_0x3b64e7[_0xfec2('0x4')]||'';this[_0xfec2('0x5')]=_0x3b64e7['Configurations']||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 113ca85..a639f49 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 _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 +var _0x73dc=['status','address','exports','name','accountcode','state','unknown','stateTime'];(function(_0x37ee8a,_0x2732fe){var _0x10c406=function(_0x51d9fd){while(--_0x51d9fd){_0x37ee8a['push'](_0x37ee8a['shift']());}};_0x10c406(++_0x2732fe);}(_0x73dc,0x1e3));var _0xc73d=function(_0x43444b,_0x8cf95b){_0x43444b=_0x43444b-0x0;var _0x392fe5=_0x73dc[_0x43444b];return _0x392fe5;};'use strict';function Telephone(_0xff88c8){this['id']=_0xff88c8['id']||0x0;this[_0xc73d('0x0')]=_0xff88c8[_0xc73d('0x0')]||'';this['accountcode']=_0xff88c8[_0xc73d('0x1')]||'';this[_0xc73d('0x2')]=_0xc73d('0x3');this[_0xc73d('0x4')]=0x0;this[_0xc73d('0x5')]=_0xc73d('0x3');this[_0xc73d('0x6')]='';}module[_0xc73d('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index cb5f7de..4b5fd1c 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 _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 +var _0x4491=['html','exports','name'];(function(_0x396aec,_0x3f7f67){var _0x3a5691=function(_0x413e30){while(--_0x413e30){_0x396aec['push'](_0x396aec['shift']());}};_0x3a5691(++_0x3f7f67);}(_0x4491,0x1bb));var _0x1449=function(_0x482aa9,_0x340d80){_0x482aa9=_0x482aa9-0x0;var _0x2b2663=_0x4491[_0x482aa9];return _0x2b2663;};'use strict';function template(_0x8e450b){this['id']=_0x8e450b['id']||0x0;this['name']=_0x8e450b[_0x1449('0x0')]||'';this['html']=_0x8e450b[_0x1449('0x1')]||'';}module[_0x1449('0x2')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index b9a4abf..fa488d6 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 _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 +var _0x008c=['name','channel','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x3f1076,_0x23b6c1){var _0x21d34f=function(_0x3af4f4){while(--_0x3af4f4){_0x3f1076['push'](_0x3f1076['shift']());}};_0x21d34f(++_0x23b6c1);}(_0x008c,0x188));var _0xc008=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0x008c[_0x1a7550];return _0x426e22;};'use strict';function Trigger(_0x2be4ba){this['id']=_0x2be4ba['id']||0x0;this[_0xc008('0x0')]=_0x2be4ba[_0xc008('0x0')]||'';this[_0xc008('0x1')]=_0x2be4ba[_0xc008('0x1')]||'voice';this[_0xc008('0x2')]=_0x2be4ba[_0xc008('0x2')]||![];this[_0xc008('0x3')]=_0x2be4ba[_0xc008('0x3')]||[];this[_0xc008('0x4')]=_0x2be4ba[_0xc008('0x4')]||[];this[_0xc008('0x5')]=_0x2be4ba[_0xc008('0x5')]||[];}module[_0xc008('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 73a44f9..2d2ebdf 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 _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 +var _0xde4a=['port','domainport','refresh','stateRegistry','address','exports','name','status','unknown','registry','split','host'];(function(_0x135615,_0x1cac0f){var _0x2a73f5=function(_0x2aea7b){while(--_0x2aea7b){_0x135615['push'](_0x135615['shift']());}};_0x2a73f5(++_0x1cac0f);}(_0xde4a,0x1e6));var _0xade4=function(_0x342324,_0x3d8757){_0x342324=_0x342324-0x0;var _0x2b7edf=_0xde4a[_0x342324];return _0x2b7edf;};'use strict';function Trunk(_0x5942c0){this['id']=_0x5942c0['id']||0x0;this['active']=_0x5942c0['active']||![];this[_0xade4('0x0')]=_0x5942c0[_0xade4('0x0')]||'';this['state']='unknown';this['stateTime']=0x0;this[_0xade4('0x1')]=_0xade4('0x2');this[_0xade4('0x3')]=_0x5942c0[_0xade4('0x3')]&&_0x5942c0[_0xade4('0x3')]['indexOf'](':')?_0x5942c0['registry'][_0xade4('0x4')](':')[0x0]:'';this[_0xade4('0x5')]='';this[_0xade4('0x6')]='';this['domain']='';this[_0xade4('0x7')]='';this[_0xade4('0x8')]='';this[_0xade4('0x9')]='unknown';this['registrationtime']='';this[_0xade4('0xa')]='';}module[_0xade4('0xb')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 68fffa4..d578e3d 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 _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 +var _0x9e96=['recordingFormat','none','mandatoryDisposition','exports'];(function(_0x58e7a1,_0x46ab59){var _0x1d3571=function(_0x29807f){while(--_0x29807f){_0x58e7a1['push'](_0x58e7a1['shift']());}};_0x1d3571(++_0x46ab59);}(_0x9e96,0x140));var _0x69e9=function(_0x2496d6,_0x393abe){_0x2496d6=_0x2496d6-0x0;var _0x34c7d2=_0x9e96[_0x2496d6];return _0x34c7d2;};'use strict';function voiceExtension(_0x44160c){this['id']=_0x44160c['id']||0x0;this['exten']=_0x44160c['exten']||'';this[_0x69e9('0x0')]=_0x44160c[_0x69e9('0x0')]||_0x69e9('0x1');this[_0x69e9('0x2')]=_0x44160c['mandatoryDisposition']||![];}module[_0x69e9('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 9adbbb0..b4fb9dc 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 _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 +var _0x9eb9=['name','monitor_format','type','inbound','waiting','talking','total','sumDuration','sumHoldTime','sumBillable','unmanaged','loggedIn','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','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','mandatoryDisposition','mandatoryDispositionPause','unknown','not_inuse','inuse','busy','unavailable','ringing','onhold','wav49','gsm','rrmemory','roundrobin'];(function(_0x393c33,_0x52b38d){var _0x4a0c89=function(_0x20955c){while(--_0x20955c){_0x393c33['push'](_0x393c33['shift']());}};_0x4a0c89(++_0x52b38d);}(_0x9eb9,0x160));var _0x99eb=function(_0x47f849,_0x322cb6){_0x47f849=_0x47f849-0x0;var _0x3a95f1=_0x9eb9[_0x47f849];return _0x3a95f1;};'use strict';var statusDesc=[_0x99eb('0x0'),_0x99eb('0x1'),_0x99eb('0x2'),_0x99eb('0x3'),'invalid',_0x99eb('0x4'),_0x99eb('0x5'),'ringinuse',_0x99eb('0x6')];var monitorFormat={'wav':'wav','wav49':_0x99eb('0x7'),'gsm':_0x99eb('0x8')};var strategy={'rrmemory':_0x99eb('0x9'),'roundrobin':_0x99eb('0xa')};function VoiceQueue(_0x2ebb7d){this['id']=_0x2ebb7d['id']||0x0;this['name']=_0x2ebb7d[_0x99eb('0xb')]||'';this['monitor_format']=_0x2ebb7d[_0x99eb('0xc')]||'';this[_0x99eb('0xd')]=_0x2ebb7d['type']||_0x99eb('0xe');this[_0x99eb('0xf')]=0x0;this[_0x99eb('0x10')]=0x0;this[_0x99eb('0x11')]=0x0;this['answered']=0x0;this[_0x99eb('0x12')]=0x0;this[_0x99eb('0x13')]=0x0;this[_0x99eb('0x14')]=0x0;this[_0x99eb('0x15')]=0x0;this['abandoned']=0x0;this[_0x99eb('0x16')]=0x0;this['available']=0x0;this[_0x99eb('0x17')]=_0x2ebb7d[_0x99eb('0x17')]||![];this[_0x99eb('0x18')]=_0x2ebb7d[_0x99eb('0x18')]||0xa;this['autopause']=_0x2ebb7d[_0x99eb('0x19')]||'no';this[_0x99eb('0x1a')]=!![];this[_0x99eb('0x1b')]='';this[_0x99eb('0x1c')]=0x0;this[_0x99eb('0x1d')]=0x0;this[_0x99eb('0x1e')]=_0x2ebb7d[_0x99eb('0x1e')]||null;this[_0x99eb('0x1f')]=_0x2ebb7d[_0x99eb('0x1f')]?_0x2ebb7d[_0x99eb('0x1f')]:null;this[_0x99eb('0x20')]=_0x2ebb7d[_0x99eb('0x20')];this['dialMethod']=_0x2ebb7d[_0x99eb('0x21')]||_0x99eb('0x22');this[_0x99eb('0x23')]=_0x2ebb7d[_0x99eb('0x23')]||0x0;this['dialLimitQueue']=_0x2ebb7d[_0x99eb('0x24')]||0x0;this[_0x99eb('0x25')]=_0x2ebb7d['dialPowerLevel']||0x1;this[_0x99eb('0x26')]=_0x2ebb7d[_0x99eb('0x26')]||_0x99eb('0x27');this[_0x99eb('0x28')]=_0x2ebb7d['dialPredictiveOptimizationPercentage']||0.03;this[_0x99eb('0x29')]=_0x2ebb7d[_0x99eb('0x29')]||0x258;this[_0x99eb('0x2a')]=_0x2ebb7d[_0x99eb('0x2a')]||_0x99eb('0x2b');this[_0x99eb('0x2c')]=_0x2ebb7d[_0x99eb('0x2c')]||_0x99eb('0x2b');this[_0x99eb('0x2d')]=_0x2ebb7d['dialOriginateTimeout']||0x1e;this[_0x99eb('0x2e')]=_0x2ebb7d[_0x99eb('0x2e')]||_0x99eb('0x2f');this[_0x99eb('0x30')]=_0x2ebb7d[_0x99eb('0x30')]||0x3;this[_0x99eb('0x31')]=_0x2ebb7d[_0x99eb('0x31')]||undefined;this[_0x99eb('0x32')]=_0x2ebb7d[_0x99eb('0x32')]||0x3;this['dialCongestionRetryFrequency']=_0x2ebb7d[_0x99eb('0x33')]||0x96;this[_0x99eb('0x34')]=_0x2ebb7d[_0x99eb('0x34')]||0x3;this[_0x99eb('0x35')]=_0x2ebb7d['dialBusyRetryFrequency']||0x96;this[_0x99eb('0x36')]=_0x2ebb7d[_0x99eb('0x36')]||0x3;this[_0x99eb('0x37')]=_0x2ebb7d[_0x99eb('0x37')]||0x96;this[_0x99eb('0x38')]=_0x2ebb7d[_0x99eb('0x38')]||0x3;this[_0x99eb('0x39')]=_0x2ebb7d[_0x99eb('0x39')]||0x96;this['dialDropMaxRetry']=_0x2ebb7d['dialDropMaxRetry']||0x3;this[_0x99eb('0x3a')]=_0x2ebb7d[_0x99eb('0x3a')]||0x96;this[_0x99eb('0x3b')]=_0x2ebb7d['dialAbandonedMaxRetry']||0x3;this[_0x99eb('0x3c')]=_0x2ebb7d[_0x99eb('0x3c')]||0x96;this['dialMachineMaxRetry']=_0x2ebb7d[_0x99eb('0x3d')]||0x3;this[_0x99eb('0x3e')]=_0x2ebb7d[_0x99eb('0x3e')]||0x96;this['dialAgentRejectMaxRetry']=_0x2ebb7d['dialAgentRejectMaxRetry']||0x3;this[_0x99eb('0x3f')]=_0x2ebb7d['dialAgentRejectRetryFrequency']||0x96;this[_0x99eb('0x40')]=_0x2ebb7d[_0x99eb('0x40')]||0x4;this[_0x99eb('0x41')]=_0x2ebb7d[_0x99eb('0x41')]?_0x2ebb7d[_0x99eb('0x41')]:undefined;this['TrunkBackup']=_0x2ebb7d[_0x99eb('0x42')]?_0x2ebb7d[_0x99eb('0x42')]:undefined;this[_0x99eb('0x43')]=_0x2ebb7d[_0x99eb('0x43')]||undefined;this[_0x99eb('0x44')]=_0x2ebb7d[_0x99eb('0x44')]?_0x2ebb7d[_0x99eb('0x44')]:undefined;this['dialOrderByScheduledAt']=_0x2ebb7d[_0x99eb('0x45')]||_0x99eb('0x46');this['dialRandomLastDigitCallerIdNumber']=_0x2ebb7d['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x99eb('0x47')]=_0x2ebb7d['dialCutDigit']||undefined;this[_0x99eb('0x48')]=strategy[_0x2ebb7d[_0x99eb('0x48')]]||_0x99eb('0x9');this[_0x99eb('0x49')]=!![];this[_0x99eb('0x4a')]=_0x2ebb7d['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x2ebb7d[_0x99eb('0x4b')];this[_0x99eb('0x4c')]=_0x2ebb7d['dialAMDGreeting'];this[_0x99eb('0x4d')]=_0x2ebb7d[_0x99eb('0x4d')];this[_0x99eb('0x4e')]=_0x2ebb7d[_0x99eb('0x4e')];this[_0x99eb('0x4f')]=_0x2ebb7d[_0x99eb('0x4f')];this[_0x99eb('0x50')]=_0x2ebb7d[_0x99eb('0x50')];this[_0x99eb('0x51')]=_0x2ebb7d[_0x99eb('0x51')];this[_0x99eb('0x52')]=_0x2ebb7d[_0x99eb('0x52')];this['dialAMDMaximumWordLength']=_0x2ebb7d['dialAMDMaximumWordLength'];this[_0x99eb('0x53')]=0x0;this['pTalking']=0x0;this[_0x99eb('0x54')]=_0x2ebb7d[_0x99eb('0x54')];this[_0x99eb('0x55')]=0x0;this[_0x99eb('0x56')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x99eb('0x57')]=0x0;this[_0x99eb('0x58')]=0x0;this[_0x99eb('0x59')]=0x0;this[_0x99eb('0x5a')]=0x0;this[_0x99eb('0x5b')]=0x0;this[_0x99eb('0x5c')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x99eb('0x5d')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x99eb('0x5e')]=0x0;this[_0x99eb('0x5f')]=0x0;this[_0x99eb('0x60')]=undefined;this[_0x99eb('0x61')]=undefined;this[_0x99eb('0x62')]=undefined;this[_0x99eb('0x63')]=1.05;this[_0x99eb('0x64')]=0x0;this[_0x99eb('0x65')]=0x0;this[_0x99eb('0x66')]=0x0;this[_0x99eb('0x67')]=0x0;this[_0x99eb('0x68')]=0x0;this[_0x99eb('0x69')]=0x0;this[_0x99eb('0x6a')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x99eb('0x6b')]=_0x2ebb7d['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x99eb('0x6c')]=_0x2ebb7d['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x99eb('0x6d')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x99eb('0x6e')]=0x1;this[_0x99eb('0x6f')]=0x0;this[_0x99eb('0x70')]=0x0;this[_0x99eb('0x71')]=0x0;this[_0x99eb('0x72')]=0x0;this[_0x99eb('0x73')]=_0x2ebb7d[_0x99eb('0x73')]||0x1e;this['dialRecallInQueue']=_0x2ebb7d[_0x99eb('0x74')]||![];this[_0x99eb('0x75')]=_0x2ebb7d[_0x99eb('0x75')]||undefined;this[_0x99eb('0x76')]=_0x2ebb7d[_0x99eb('0x76')]||![];this['dialAgiAfterHangupAgent']=_0x2ebb7d['dialAgiAfterHangupAgent']||![];this[_0x99eb('0xc')]=monitorFormat[_0x2ebb7d[_0x99eb('0xc')]]?monitorFormat[_0x2ebb7d[_0x99eb('0xc')]]:undefined;this['mandatoryDisposition']=_0x2ebb7d[_0x99eb('0x77')]||![];this[_0x99eb('0x78')]=_0x2ebb7d[_0x99eb('0x78')]?_0x2ebb7d[_0x99eb('0x78')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index f01a87e..7677287 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 _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 +var _0x56e6=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x3a24b5,_0x313359){var _0x3c6702=function(_0x429bc4){while(--_0x429bc4){_0x3a24b5['push'](_0x3a24b5['shift']());}};_0x3c6702(++_0x313359);}(_0x56e6,0x6b));var _0x656e=function(_0x30a100,_0x5b8bfd){_0x30a100=_0x30a100-0x0;var _0x1bcba3=_0x56e6[_0x30a100];return _0x1bcba3;};'use strict';function VtigerAccount(_0x561b1e){this['id']=_0x561b1e['id']||0x0;this[_0x656e('0x0')]=_0x561b1e[_0x656e('0x0')]||'';this[_0x656e('0x1')]=_0x561b1e[_0x656e('0x1')]||'';this[_0x656e('0x2')]=_0x561b1e['accessKey']||'';this[_0x656e('0x3')]=_0x561b1e[_0x656e('0x3')]||'';this[_0x656e('0x4')]=_0x561b1e[_0x656e('0x4')]||'';this[_0x656e('0x5')]=_0x561b1e[_0x656e('0x5')]||{};}module[_0x656e('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 fc35a93..eabb3a9 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 _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 +var _0x5f2f=['authType','type','integrationTab','serverUrl','Configurations','name','username','password','token','remoteUri'];(function(_0x147a77,_0x4829d3){var _0x46b6f4=function(_0x2cac0f){while(--_0x2cac0f){_0x147a77['push'](_0x147a77['shift']());}};_0x46b6f4(++_0x4829d3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3f2ae8,_0x1e8db2){_0x3f2ae8=_0x3f2ae8-0x0;var _0x1f3159=_0x5f2f[_0x3f2ae8];return _0x1f3159;};'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 diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index c7047eb..5764121 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 _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 +var _0xdd4f=['Configurations','exports','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x396b91,_0x1cccac){var _0x13ca64=function(_0x50c496){while(--_0x50c496){_0x396b91['push'](_0x396b91['shift']());}};_0x13ca64(++_0x1cccac);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x35854a,_0x253f05){_0x35854a=_0x35854a-0x0;var _0x44dc56=_0xdd4f[_0x35854a];return _0x44dc56;};'use strict';function ZohoAccount(_0x447337){this['id']=_0x447337['id']||0x0;this['name']=_0x447337['name']||'';this['description']=_0x447337[_0xfdd4('0x0')]||'';this[_0xfdd4('0x1')]=_0x447337['host']||'';this[_0xfdd4('0x2')]=_0x447337[_0xfdd4('0x2')]||'';this[_0xfdd4('0x3')]=_0x447337['clientId']||'';this[_0xfdd4('0x4')]=_0x447337[_0xfdd4('0x4')]||'';this[_0xfdd4('0x5')]=_0x447337[_0xfdd4('0x5')]||'';this[_0xfdd4('0x6')]=_0x447337['code']||'';this[_0xfdd4('0x7')]=_0x447337['refreshToken']||'';this[_0xfdd4('0x8')]=_0x447337[_0xfdd4('0x8')]||{};}module[_0xfdd4('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 228fb40..8c2414f 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 _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 +var _0xbf69=['originatecalleridname','prototype','getCaller','calleridname','number','util','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','Contact','phone','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0xbf69,0x139));var _0x9bf6=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0xbf69[_0x3b5ad9];return _0x611ae9;};'use strict';var util=require(_0x9bf6('0x0'));var _=require('lodash');var moment=require(_0x9bf6('0x1'));function checkNameSurname(_0x517aac,_0x2357ff,_0x306921){var _0x5c0b5c='';if(!_[_0x9bf6('0x2')](_0x2357ff)&&_0x9bf6('0x3')===typeof _0x2357ff){_0x5c0b5c+=_0x2357ff;}if(!_['isNil'](_0x306921)&&_0x9bf6('0x3')===typeof _0x306921){_0x5c0b5c+='\x20'+_0x306921;}if(_0x5c0b5c!==''){return _0x5c0b5c;}return _0x517aac;}function Action(_0x197804,_0x2d16e3,_0x4f4520,_0x5285e7,_0x5de153){this[_0x9bf6('0x4')]=_0x4f4520||undefined;this[_0x9bf6('0x5')]=_0x197804['id'];this[_0x9bf6('0x6')]=_0x2d16e3[_0x9bf6('0x7')];this[_0x9bf6('0x8')]=_0x2d16e3[_0x9bf6('0x8')];this[_0x9bf6('0x9')]='queue';this[_0x9bf6('0xa')]=![];this[_0x9bf6('0xb')]=_[_0x9bf6('0x2')](_0x197804['Agent'])?undefined:_0x197804[_0x9bf6('0xc')][_0x9bf6('0x7')];this[_0x9bf6('0xd')]=this[_0x9bf6('0xb')]?util[_0x9bf6('0xe')](_0x9bf6('0xf'),this[_0x9bf6('0xb')]):_0x5285e7||undefined;this['calleridname']=checkNameSurname(_0x197804[_0x9bf6('0x10')][_0x9bf6('0x11')],_0x197804[_0x9bf6('0x10')]['firstName'],_0x197804[_0x9bf6('0x10')][_0x9bf6('0x12')]);this[_0x9bf6('0x13')]=_0x197804['active']||![];this['calleridnum']=_0x197804['Contact'][_0x9bf6('0x11')];this[_0x9bf6('0x14')]=_0x197804[_0x9bf6('0x14')];this[_0x9bf6('0x15')]=_0x197804['countbusyretry']||0x0;this[_0x9bf6('0x16')]=_0x197804[_0x9bf6('0x16')]||0x0;this[_0x9bf6('0x17')]=_0x197804['countnoanswerretry']||0x0;this[_0x9bf6('0x18')]=(_0x197804['countbusyretry']||0x0)+(_0x197804[_0x9bf6('0x16')]||0x0)+(_0x197804[_0x9bf6('0x17')]||0x0)+(_0x197804['countnosuchnumberretry']||0x0)+(_0x197804[_0x9bf6('0x19')]||0x0)+(_0x197804['countabandonedretry']||0x0)+(_0x197804[_0x9bf6('0x1a')]||0x0)+(_0x197804['countagentrejectretry']||0x0);this[_0x9bf6('0x1b')]=_0x197804[_0x9bf6('0x1b')]||0x0;this['countdropretry']=_0x197804['countdropretry']||0x0;this[_0x9bf6('0x1c')]=_0x197804['countabandonedretry']||0x0;this[_0x9bf6('0x1a')]=_0x197804[_0x9bf6('0x1a')]||0x0;this[_0x9bf6('0x1d')]=_0x197804['countagentrejectretry']||0x0;this[_0x9bf6('0x1e')]=_0x197804['callback'];this[_0x9bf6('0x1f')]=_0x197804[_0x9bf6('0x1f')];this[_0x9bf6('0x20')]=_0x197804[_0x9bf6('0x20')];this[_0x9bf6('0x21')]=_0x197804[_0x9bf6('0x21')];this[_0x9bf6('0x22')]=_0x197804['ContactId'];this['ListId']=_0x197804[_0x9bf6('0x23')];this['UserId']=_[_0x9bf6('0x2')](_0x197804[_0x9bf6('0xc')])?_0x197804[_0x9bf6('0x24')]:_0x197804['Agent']['id'];this[_0x9bf6('0x25')]=_0x197804[_0x9bf6('0x25')];this[_0x9bf6('0x26')]='';this[_0x9bf6('0x27')]='';}Action[_0x9bf6('0x28')][_0x9bf6('0x29')]=function(){return util[_0x9bf6('0xe')]('\x22%s\x22\x20<%s>',this[_0x9bf6('0x2a')],this[_0x9bf6('0x2b')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 4d395ab..837d2a7 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 _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 +var _0x529a=['emit','type','name','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','startPredictive','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','paused','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','logger','\x20is\x20disactive','syncCampaigns','hasOwnProperty','preview','booked','clockClearZombieChannels','clearZombieChannels','outbound','recallMe','clearZombieChannel','sequence','isNil','[clearZombieChannels][talking]','originated:\x20','queue','pTalking:\x20','dialAnswer','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','getContactRecallMe','then','length','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','logger2','[getContactRecallMe]','setMessage','sendMessageOneNotActive','IsNotLoggedIn','AGENTS_NOT_LOGGED','dialActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','buildObj','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','ANSWER','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','connect','acw','buildAcw','custom:agentcomplete','complete','answered','decrementTalkink','[16]','[callProgressDetectingCustomer][logAnswer]','talktime','[syncHangup][talking][decrement]','linkedid','Busy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','countbusyretry','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','callProgressDetectingAgent','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','Queue','lookAgent','execCall','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','[Preview][execCall][failure]','logBlacklist','createHistory','Contact\x20in\x20black\x20List','trunks','SIP/%s','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','isValid','checkIsBlackList','pick','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','SIP/%s/%s%s','trim','Contact','substring','dialCutDigit','phone','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerId','originatecalleridname','originatecalleridnum','addVariables','merge','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','Answer','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','isUndefined','transfer','[syncHangup][talking][transfer]','destlinkedid','addVariable','variables','syncVarSet','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','bluebird','uuid','moment','md5','../../../config/environment','../../../config/logger','./action','./util/util','defaults','redis','localhost','socket.io-emitter','prototype','enqueue','tail','campaignsPreview','voiceQueues','actions','agents','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns'];(function(_0x4b9abc,_0x25bb42){var _0x568162=function(_0x4a52f5){while(--_0x4a52f5){_0x4b9abc['push'](_0x4b9abc['shift']());}};_0x568162(++_0x25bb42);}(_0x529a,0x12a));var _0xa529=function(_0x202c61,_0x3673e0){_0x202c61=_0x202c61-0x0;var _0x540691=_0x529a[_0x202c61];return _0x540691;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0xa529('0x0'));var uuid=require(_0xa529('0x1'));var moment=require(_0xa529('0x2'));var md5=require(_0xa529('0x3'));var Redis=require('ioredis');var config=require(_0xa529('0x4'));var logger=require(_0xa529('0x5'))('preview');var loggerAction=require(_0xa529('0x5'))('actionPreview');var ami=require('../ami');var rpcDb=require('./rpcDb');var Action=require(_0xa529('0x6'));var ut=require(_0xa529('0x7'));config['redis']=_[_0xa529('0x8')](config[_0xa529('0x9')],{'host':_0xa529('0xa'),'port':0x18eb});var io=require(_0xa529('0xb'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xa529('0xc')][_0xa529('0xd')]=function(_0xa33b0){this[_0xa529('0xe')]=this[_0xa529('0xe')]?this[_0xa529('0xe')]['finally'](_0xa33b0):_0xa33b0();};function Preview(_0x4fca3d){this['sequence']=new Sequence();this[_0xa529('0xf')]=_0x4fca3d[_0xa529('0x10')];this['trunks']=_0x4fca3d['trunks'];this[_0xa529('0x11')]={};this[_0xa529('0x12')]=_0x4fca3d[_0xa529('0x12')];this['clockClearZombieChannels']=0x0;ami['on'](_0xa529('0x13'),this[_0xa529('0x14')][_0xa529('0x15')](this));ami['on'](_0xa529('0x16'),this[_0xa529('0x17')]['bind'](this));ami['on']('hanguprequest',this[_0xa529('0x18')]['bind'](this));ami['on'](_0xa529('0x19'),this[_0xa529('0x1a')][_0xa529('0x15')](this));ami['on'](_0xa529('0x1b'),this[_0xa529('0x1c')][_0xa529('0x15')](this));ami['on'](_0xa529('0x1d'),this['syncVarSet'][_0xa529('0x15')](this));ami['on'](_0xa529('0x1e'),this[_0xa529('0x1f')][_0xa529('0x15')](this));ami['on']('blindtransfer',this[_0xa529('0x20')][_0xa529('0x15')](this));this[_0xa529('0x21')](this[_0xa529('0xf')]);}function emit(_0x21b83f,_0xffa507,_0x366d11){io['to'](_0x21b83f)[_0xa529('0x22')](_0xffa507,_0x366d11);}function emitCampaignPreview(_0x544078){if(_0x544078[_0xa529('0x23')]==='outbound'){var _0x24ef01={'id':_0x544078['id'],'name':_0x544078[_0xa529('0x24')],'strategy':_0x544078[_0xa529('0x25')],'answered':_0x544078['answered'],'available':_0x544078[_0xa529('0x26')],'loggedIn':_0x544078[_0xa529('0x27')],'pTalking':_0x544078[_0xa529('0x28')],'sumBillable':_0x544078[_0xa529('0x29')],'sumDuration':_0x544078[_0xa529('0x2a')],'sumHoldTime':_0x544078[_0xa529('0x2b')]||0x0,'talking':_0x544078['talking'],'total':_0x544078[_0xa529('0x2c')],'type':_0x544078[_0xa529('0x23')],'unmanaged':_0x544078[_0xa529('0x2d')],'abandoned':_0x544078[_0xa529('0x2e')],'waiting':_0x544078['waiting'],'loggedInDb':_0x544078[_0xa529('0x2f')],'dialActive':_0x544078['dialActive'],'dialMethod':_0x544078[_0xa529('0x30')],'dialOriginateCallerIdName':_0x544078[_0xa529('0x31')],'dialOriginateCallerIdNumber':_0x544078['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x544078[_0xa529('0x32')],'dialPrefix':_0x544078[_0xa529('0x33')],'outboundAnswerAgiCallsDay':_0x544078[_0xa529('0x34')],'outboundAnswerCallsDay':_0x544078[_0xa529('0x35')],'outboundBlacklistCallsDay':_0x544078[_0xa529('0x36')],'outboundBusyCallsDay':_0x544078[_0xa529('0x37')],'outboundCongestionCallsDay':_0x544078[_0xa529('0x38')],'outboundDropCallsDayACS':_0x544078['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x544078[_0xa529('0x39')],'outboundDropCallsDayTimeout':_0x544078[_0xa529('0x3a')],'outboundNoAnswerCallsDay':_0x544078['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x544078[_0xa529('0x3b')],'outboundOriginateFailureCallsDay':_0x544078['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x544078['outboundReCallsDay'],'outboundRejectCallsDay':_0x544078['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x544078[_0xa529('0x3c')],'outboundAbandonedCallsDay':_0x544078[_0xa529('0x3d')],'predictiveIntervalAnsweredCalls':_0x544078[_0xa529('0x3e')],'predictiveIntervalAvgHoldtime':_0x544078[_0xa529('0x3f')],'predictiveIntervalAvgTalktime':_0x544078['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x544078[_0xa529('0x40')],'predictiveIntervalDroppedCallsTimeout':_0x544078['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x544078[_0xa529('0x41')],'predictiveIntervalErlangCallsDroppedCalls':_0x544078['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x544078['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x544078[_0xa529('0x42')],'predictiveIntervalPauses':_0x544078[_0xa529('0x43')],'predictiveIntervalAvailable':_0x544078['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x544078[_0xa529('0x44')],'message':_0x544078[_0xa529('0x45')],'originated':_0x544078[_0xa529('0x46')],'erlangCalls':_0x544078[_0xa529('0x47')],'erlangCallToSecond':_0x544078[_0xa529('0x48')],'erlangAbandonmentRate':_0x544078['erlangAbandonmentRate'],'erlangBusyFactor':_0x544078['erlangBusyFactor'],'startPredictive':_0x544078[_0xa529('0x49')],'startProgressive':_0x544078['startProgressive']};if(_0x544078['Trunk']){_0x24ef01[_0xa529('0x4a')]={'id':_0x544078[_0xa529('0x4a')]['id'],'name':_0x544078['Trunk'][_0xa529('0x24')],'active':_0x544078[_0xa529('0x4a')][_0xa529('0x4b')],'callerid':_0x544078[_0xa529('0x4a')][_0xa529('0x4c')]};}if(_0x544078[_0xa529('0x4d')]){_0x24ef01[_0xa529('0x4d')]={'id':_0x544078[_0xa529('0x4d')]['id'],'name':_0x544078[_0xa529('0x4d')][_0xa529('0x24')]};}var _0x229991=md5(JSON[_0xa529('0x4e')](_0x24ef01));if(_0x544078[_0xa529('0x3')]!==_0x229991){_0x544078[_0xa529('0x3')]=_0x229991;emit(util[_0xa529('0x4f')](_0xa529('0x50'),_0x24ef01[_0xa529('0x24')]),_0xa529('0x51'),_0x24ef01);}}}function emitVoiceQueueChannelRemove(_0x5e14f7){logger[_0xa529('0x52')](_0xa529('0x53'),JSON[_0xa529('0x4e')](_0x5e14f7));emit(util['format'](_0xa529('0x50'),_0x5e14f7[_0xa529('0x24')]),_0xa529('0x54'),_0x5e14f7);}function notSendMessagesQueue(_0xb26915){if(_0xb26915['sendMessageOneNotActive']){if(_0xb26915[_0xa529('0x46')]===0x0&&_0xb26915['pTalking']===0x0){_0xb26915['sendMessageOneNotActive']=![];_0xb26915[_0xa529('0x26')]=0x0;_0xb26915[_0xa529('0x55')]=0x0;_0xb26915[_0xa529('0x45')]='NOT_ACTIVE';ut['logger'](_0xa529('0x56'),_0xb26915[_0xa529('0x24')]+_0xa529('0x57'));}else{_0xb26915[_0xa529('0x45')]=_0xa529('0x58');ut[_0xa529('0x59')](_0xa529('0x56'),_0xb26915['name']+_0xa529('0x5a'));}emitCampaignPreview(_0xb26915);}}Preview['prototype'][_0xa529('0x21')]=function(){var _0x2b7d85=this;setInterval(function(){_0x2b7d85[_0xa529('0x5b')]();},0x7cf);};Preview[_0xa529('0xc')][_0xa529('0x5b')]=function(){var _0x1ccce2=this[_0xa529('0xf')];this['clockClearZombieChannels']+=0x1;for(var _0x53658b in _0x1ccce2){if(_0x1ccce2[_0xa529('0x5c')](_0x53658b)&&(_0x1ccce2[_0x53658b]['dialMethod']===_0xa529('0x5d')||_0x1ccce2[_0x53658b][_0xa529('0x30')]===_0xa529('0x5e'))&&_0x1ccce2[_0x53658b]['type']==='outbound'){if(this[_0xa529('0x5f')]>0x7){this[_0xa529('0x5f')]=0x0;this[_0xa529('0x60')]();}}if(_0x1ccce2['hasOwnProperty'](_0x53658b)&&_0x1ccce2[_0x53658b][_0xa529('0x30')]==='preview'&&_0x1ccce2[_0x53658b]['type']===_0xa529('0x61')){if(_0x1ccce2[_0x53658b]['dialActive']){this['setMessage'](_0x1ccce2[_0x53658b]);this[_0xa529('0x62')](_0x1ccce2[_0x53658b]);}else{notSendMessagesQueue(_0x1ccce2[_0x53658b]);}}}};Preview[_0xa529('0xc')][_0xa529('0x63')]=function(_0x3210f4){var _0x483adb=this;this[_0xa529('0x64')]['enqueue'](function(){if(!_[_0xa529('0x65')](_0x483adb[_0xa529('0x11')][_0x3210f4])){loggerAction[_0xa529('0x52')](_0xa529('0x66'),_0x3210f4,'Queue',_0x483adb[_0xa529('0x11')][_0x3210f4]['queue'],_0xa529('0x67'),JSON[_0xa529('0x4e')](_0x483adb[_0xa529('0xf')][_0x483adb[_0xa529('0x11')][_0x3210f4][_0xa529('0x68')]][_0xa529('0x46')]),_0xa529('0x69'),JSON[_0xa529('0x4e')](_0x483adb[_0xa529('0xf')][_0x483adb[_0xa529('0x11')][_0x3210f4][_0xa529('0x68')]]['pTalking']),JSON[_0xa529('0x4e')](_0x483adb[_0xa529('0x11')][_0x3210f4][_0xa529('0x6a')]),JSON[_0xa529('0x4e')](_['pick'](_0x483adb[_0xa529('0x11')][_0x3210f4],[_0xa529('0x6b'),_0xa529('0x6c'),_0xa529('0x6d'),_0xa529('0x6e')])));return ami[_0xa529('0x6f')]({'action':_0xa529('0x70'),'channel':_0x483adb[_0xa529('0x11')][_0x3210f4][_0xa529('0x71')]})[_0xa529('0x72')](function(_0xac60ff){if(_0xac60ff['message']===_0xa529('0x73')){setTimeout(function(){if(_0x483adb[_0xa529('0x11')][_0x3210f4]){ut['updateOriginated'](_0x483adb[_0xa529('0xf')][_0x483adb[_0xa529('0x11')][_0x3210f4][_0xa529('0x68')]],'[clearZombieChannel]');if(_0x483adb[_0xa529('0x11')][_0x3210f4][_0xa529('0x6a')]===!![]){ut['decrementTalkink'](_0x483adb[_0xa529('0xf')][_0x483adb['actions'][_0x3210f4]['queue']],_0xa529('0x74'));ut[_0xa529('0x75')](_0xa529('0x76')+_0x3210f4,_0x483adb[_0xa529('0x11')][_0x3210f4][_0xa529('0x68')]);}ut[_0xa529('0x75')](_0xa529('0x77')+_0x3210f4,_0x483adb[_0xa529('0x11')][_0x3210f4][_0xa529('0x68')]);delete _0x483adb['actions'][_0x3210f4];}},0x2328);}});}});};Preview[_0xa529('0xc')][_0xa529('0x60')]=function(){var _0x3e4d50=this;loggerAction['info']('[action]',_['size'](this[_0xa529('0x11')]));for(var _0x3c2eec in this['actions']){if(_0x3e4d50[_0xa529('0x11')]['hasOwnProperty'](_0x3c2eec)){_0x3e4d50[_0xa529('0x63')](_0x3c2eec);}}};Preview[_0xa529('0xc')][_0xa529('0x62')]=function(_0x183c24){var _0x48bbc8=this;rpcDb[_0xa529('0x78')](_0x183c24['id'],ut['agentReadyId'](this['agents']))[_0xa529('0x79')](function(_0x57f274){if(!_[_0xa529('0x65')](_0x57f274)){for(var _0x274ba7=0x0;_0x274ba7<_0x57f274[_0xa529('0x7a')];_0x274ba7+=0x1){if(ut['getDiff'](_0x57f274[_0x274ba7][_0xa529('0x7b')])<_0x183c24[_0xa529('0x7c')]*0x3c){if(_0x57f274[_0x274ba7][_0xa529('0x7d')]&&!_0x57f274[_0x274ba7][_0xa529('0x7d')][_0xa529('0x7e')]){_0x48bbc8[_0xa529('0x7f')](_0x57f274[_0x274ba7]['id'])[_0xa529('0x79')](ut['logger2'](_0xa529('0x80')))[_0xa529('0x72')](ut['logger2'](_0xa529('0x80')));}else{rpcDb[_0xa529('0x81')](_0x57f274[_0x274ba7]['id']);}}else{var _0x511a17=new Action(_0x57f274[_0x274ba7],_0x183c24);_0x511a17[_0xa529('0x82')]=moment()[_0xa529('0x4f')](_0xa529('0x83'));_0x183c24[_0xa529('0x84')]+=0x1;ut[_0xa529('0x85')](_0x511a17,0x17,_0xa529('0x86'));if(_0x183c24[_0xa529('0x87')]){rpcDb[_0xa529('0x88')](ut[_0xa529('0x89')](_0x57f274[_0x274ba7]));rpcDb[_0xa529('0x8a')](_0x511a17,_0xa529('0x8b'));}else{ut[_0xa529('0x85')](_0x511a17,0x16,'RecallFailedTimeout');rpcDb[_0xa529('0x8a')](_0x511a17,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x511a17,_0xa529('0x8c'));}}}}})[_0xa529('0x72')](ut[_0xa529('0x8d')](_0xa529('0x8e')));};Preview[_0xa529('0xc')][_0xa529('0x8f')]=function(_0x1c8e5e){_0x1c8e5e[_0xa529('0x90')]=!![];if(ut[_0xa529('0x91')](_0x1c8e5e['loggedIn'])){_0x1c8e5e['message']=_0xa529('0x92');}else if(!ut['isActive'](_0x1c8e5e[_0xa529('0x93')])){_0x1c8e5e[_0xa529('0x45')]=_0xa529('0x94');}else if(!this['isTrunkReachable'](_0x1c8e5e[_0xa529('0x4a')])){if(!this[_0xa529('0x95')](_0x1c8e5e[_0xa529('0x96')])){_0x1c8e5e[_0xa529('0x45')]='TRUNK_IS_NOT_REACHABLE';}else{_0x1c8e5e[_0xa529('0x45')]=_0xa529('0x97');}}else{_0x1c8e5e[_0xa529('0x45')]='ACTIVE';}emitCampaignPreview(_0x1c8e5e);};Preview[_0xa529('0xc')][_0xa529('0x98')]=function(_0x57699f,_0x520cb1,_0x7c73bf){var _0xbc58a0=this;var _0x3eac3d=this['actions'][_0x520cb1];var _0x542597=this[_0xa529('0xf')][_0x3eac3d[_0xa529('0x68')]];var _0x5ddc03;if(_0x542597){switch(_0x7c73bf){case'1':_0x542597[_0xa529('0x3b')]+=0x1;_0x3eac3d[_0xa529('0x99')]+=0x1;_0x3eac3d[_0xa529('0x9a')]=ut[_0xa529('0x9b')](_0x3eac3d);ut['logCustomer'](_0x3eac3d,0x0,'NoSuchNumber');ami[_0xa529('0x22')]('custom:agentnosuchnumber',ut[_0xa529('0x9c')](_0x3eac3d,'nosuchnumber'));rpcDb['createCustomerHistory'](_0x3eac3d,_0xa529('0x9d'));if(ut[_0xa529('0x9b')](_0x3eac3d)>=_0x542597[_0xa529('0x9e')]){_0x5ddc03=ut[_0xa529('0x9f')](_0x3eac3d,0xf,_0xa529('0xa0'));rpcDb[_0xa529('0xa1')](_0x5ddc03,_0xa529('0xa2'));}else{if(_0x3eac3d[_0xa529('0x99')]>=_0x542597['dialNoSuchNumberMaxRetry']){rpcDb[_0xa529('0xa1')](_0x3eac3d,_0xa529('0xa2'));}else{rpcDb[_0xa529('0xa3')](ut[_0xa529('0xa4')](_0x3eac3d,_0xa529('0x99'),_0x542597[_0xa529('0xa5')]),_0x3eac3d[_0xa529('0xa6')],_0x3eac3d[_0xa529('0xa7')]);}}delete this[_0xa529('0x11')][_0x57699f['linkedid']];break;case _0xa529('0xa8'):var _0x1fceea=moment()[_0xa529('0x4f')](_0xa529('0x83'));_0x3eac3d[_0xa529('0xa9')]=_0x1fceea;_0x3eac3d['answertime']=_0x1fceea;_0x3eac3d[_0xa529('0x6a')]=!![];_0x542597[_0xa529('0x28')]+=0x1;logger['info'](_0xa529('0xaa'),_0x3eac3d[_0xa529('0xab')],_0xa529('0xac'),_0x542597[_0xa529('0x24')],_0xa529('0x69'),_0x542597['pTalking']);ami['emit']('custom:agentconnect',ut[_0xa529('0x9c')](_0x3eac3d,_0xa529('0xad')));if(_0x542597[_0xa529('0xae')]){ami[_0xa529('0x22')]('custom:agentConnectPreview',ut[_0xa529('0xaf')](_0x3eac3d));}break;case'16':ami[_0xa529('0x22')](_0xa529('0xb0'),ut['buildObj'](_0x3eac3d,'complete'));emitVoiceQueueChannelRemove(ut[_0xa529('0x9c')](_0x3eac3d,_0xa529('0xb1')));_0x542597[_0xa529('0x35')]+=0x1;_0x542597[_0xa529('0x2c')]+=0x1;_0x542597[_0xa529('0xb2')]+=0x1;ut[_0xa529('0xb3')](_0x542597,_0xa529('0xb4'));_0x3eac3d[_0xa529('0x9a')]=ut[_0xa529('0x9b')](_0x3eac3d);ut['logCustomer'](_0x3eac3d,0x4,'Answer');rpcDb[_0xa529('0x8a')](_0x3eac3d,_0xa529('0xb5'));rpcDb[_0xa529('0xa1')](_0x3eac3d,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x3eac3d);_0x542597['sumDuration']+=_0x3eac3d[_0xa529('0xb6')];_0x542597[_0xa529('0x29')]+=_0x3eac3d['talktime'];logger[_0xa529('0x52')](_0xa529('0xb7'),_0x3eac3d[_0xa529('0xab')],'\x20Queue',_0x542597['name'],'pTalking:\x20',_0x542597[_0xa529('0x28')]);delete this[_0xa529('0x11')][_0x57699f[_0xa529('0xb8')]];break;case'BUSY':_0x542597[_0xa529('0x37')]+=0x1;_0x3eac3d['countbusyretry']+=0x1;_0x3eac3d[_0xa529('0x9a')]=ut[_0xa529('0x9b')](_0x3eac3d);ut[_0xa529('0x85')](_0x3eac3d,0x5,_0xa529('0xb9'));ami[_0xa529('0x22')]('custom:agentbusy',ut[_0xa529('0x9c')](_0x3eac3d,_0xa529('0xba')));rpcDb[_0xa529('0x8a')](_0x3eac3d,_0xa529('0xbb'));if(ut['totalGlobal'](_0x3eac3d)>=_0x542597['dialGlobalMaxRetry']){_0x5ddc03=ut[_0xa529('0x9f')](_0x3eac3d,0xf,_0xa529('0xa0'));rpcDb[_0xa529('0xa1')](_0x5ddc03,_0xa529('0xbc'));}else{if(_0x3eac3d['countbusyretry']>=_0x542597[_0xa529('0xbd')]){rpcDb[_0xa529('0xa1')](_0x3eac3d,_0xa529('0xbb'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x3eac3d,_0xa529('0xbe'),_0x542597[_0xa529('0xbf')]),_0x3eac3d[_0xa529('0xa6')],_0x3eac3d[_0xa529('0xa7')]);}}break;case _0xa529('0xc0'):_0x542597['outboundNoAnswerCallsDay']+=0x1;_0x3eac3d[_0xa529('0xc1')]+=0x1;_0x3eac3d['countglobal']=ut[_0xa529('0x9b')](_0x3eac3d);ut[_0xa529('0x85')](_0x3eac3d,0x3,_0xa529('0xc2'));ami[_0xa529('0x22')](_0xa529('0xc3'),ut['buildObj'](_0x3eac3d,_0xa529('0xc4')));rpcDb[_0xa529('0x8a')](_0x3eac3d,_0xa529('0xc5'));if(ut[_0xa529('0x9b')](_0x3eac3d)>=_0x542597[_0xa529('0x9e')]){_0x5ddc03=ut[_0xa529('0x9f')](_0x3eac3d,0xf,_0xa529('0xa0'));rpcDb[_0xa529('0xa1')](_0x5ddc03,_0xa529('0xc6'));}else{if(_0x3eac3d['countnoanswerretry']>=_0x542597['dialNoAnswerMaxRetry']){rpcDb[_0xa529('0xa1')](_0x3eac3d,_0xa529('0xc5'));}else{rpcDb[_0xa529('0xa3')](ut[_0xa529('0xa4')](_0x3eac3d,'countnoanswerretry',_0x542597[_0xa529('0xc7')]),_0x3eac3d[_0xa529('0xa6')],_0x3eac3d[_0xa529('0xa7')]);}}break;case _0xa529('0xc8'):_0x542597[_0xa529('0x38')]+=0x1;_0x3eac3d[_0xa529('0xc9')]+=0x1;_0x3eac3d[_0xa529('0x9a')]=ut['totalGlobal'](_0x3eac3d);ut[_0xa529('0x85')](_0x3eac3d,0x8,_0xa529('0xca'));ami[_0xa529('0x22')](_0xa529('0xcb'),ut['buildObj'](_0x3eac3d,_0xa529('0xcc')));rpcDb[_0xa529('0x8a')](_0x3eac3d,_0xa529('0xcd'));if(ut['totalGlobal'](_0x3eac3d)>=_0x542597[_0xa529('0x9e')]){_0x5ddc03=ut[_0xa529('0x9f')](_0x3eac3d,0xf,_0xa529('0xa0'));rpcDb['createCustomerFinal'](_0x5ddc03,_0xa529('0xce'));}else{if(_0x3eac3d[_0xa529('0xc9')]>=_0x542597[_0xa529('0xcf')]){rpcDb[_0xa529('0xa1')](_0x3eac3d,_0xa529('0xcd'));}else{rpcDb['rescheduleContact'](ut[_0xa529('0xa4')](_0x3eac3d,_0xa529('0xc9'),_0x542597[_0xa529('0xbf')]),_0x3eac3d['unlockAgent'],_0x3eac3d['activeContact']);}}break;case _0xa529('0xd0'):_0x542597[_0xa529('0xd1')]+=0x1;_0x3eac3d[_0xa529('0xd2')]+=0x1;_0x3eac3d['countglobal']=ut[_0xa529('0x9b')](_0x3eac3d);ut[_0xa529('0x85')](_0x3eac3d,0x14,'AgentReject');ami['emit'](_0xa529('0xd3'),ut[_0xa529('0x9c')](_0x3eac3d,_0xa529('0xd4')));rpcDb[_0xa529('0x8a')](_0x3eac3d,_0xa529('0xd5'));if(ut['totalGlobal'](_0x3eac3d)>=_0x542597['dialGlobalMaxRetry']){_0x5ddc03=ut[_0xa529('0x9f')](_0x3eac3d,0x14,_0xa529('0xd6'));rpcDb[_0xa529('0xa1')](_0x5ddc03,_0xa529('0xd7'));}else{if(_0x3eac3d['countagentrejectretry']>=_0x542597[_0xa529('0xd8')]){rpcDb[_0xa529('0xa1')](_0x3eac3d,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x3eac3d,_0xa529('0xd2'),_0x542597[_0xa529('0xd9')]),_0x3eac3d[_0xa529('0xa6')],_0x3eac3d[_0xa529('0xa7')]);}}break;case _0xa529('0xda'):_0x542597[_0xa529('0x3d')]+=0x1;_0x3eac3d[_0xa529('0xdb')]+=0x1;_0x3eac3d['countglobal']=ut[_0xa529('0x9b')](_0x3eac3d);ut[_0xa529('0x85')](_0x3eac3d,0xb,_0xa529('0xdc'));rpcDb[_0xa529('0x8a')](_0x3eac3d,'[callProgressDetectingCustomer][logAbandoned]');if(ut['totalGlobal'](_0x3eac3d)>=_0x542597[_0xa529('0x9e')]){_0x5ddc03=ut[_0xa529('0x9f')](_0x3eac3d,0xf,_0xa529('0xa0'));rpcDb['createCustomerFinal'](_0x5ddc03,_0xa529('0xdd'));}else{if(_0x3eac3d[_0xa529('0xde')]>=_0x542597[_0xa529('0xdf')]){rpcDb[_0xa529('0xa1')](_0x3eac3d,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xa529('0xa3')](ut[_0xa529('0xa4')](_0x3eac3d,_0xa529('0xdb'),_0x542597[_0xa529('0xe0')]),_0x3eac3d[_0xa529('0xa6')],_0x3eac3d[_0xa529('0xa7')]);}}break;default:if(_0x3eac3d[_0xa529('0x6a')]){ut[_0xa529('0xb3')](_0x542597,_0xa529('0xe1'));ut[_0xa529('0x75')](_0xa529('0xe2')+_0x542597[_0xa529('0x24')],_0x57699f);}_0x542597[_0xa529('0x3c')]+=0x1;_0x3eac3d[_0xa529('0x9a')]=ut['totalGlobal'](_0x3eac3d);ut[_0xa529('0x85')](_0x3eac3d,0xc,_0x57699f[_0xa529('0xe3')]||_0x57699f[_0xa529('0xe4')]);rpcDb[_0xa529('0x8a')](_0x3eac3d,_0xa529('0xe5'));if(ut['totalGlobal'](_0x3eac3d)>=_0x542597[_0xa529('0x9e')]){_0x5ddc03=ut['cloneAction'](_0x3eac3d,0xf,'Global');rpcDb[_0xa529('0xa1')](_0x5ddc03,_0xa529('0xe6'));}else{rpcDb[_0xa529('0xa1')](_0x3eac3d,_0xa529('0xe6'));}delete this[_0xa529('0x11')][_0x57699f[_0xa529('0xb8')]];}if(!(_0x3eac3d[_0xa529('0x6a')]&&_0x7c73bf==='16')){ut[_0xa529('0xe7')](_0x542597,_0xa529('0xe8'));logger[_0xa529('0x52')](_0xa529('0xe9'),_0x3eac3d[_0xa529('0xab')],_0xa529('0xac'),_0x542597[_0xa529('0x24')],'originated:\x20',_0x542597[_0xa529('0x46')]);}if(_0x7c73bf!==_0xa529('0xa8')){delete this['actions'][_0x57699f['linkedid']];delete this[_0xa529('0x11')][_0x57699f['destlinkedid']];}}};Preview[_0xa529('0xc')][_0xa529('0xea')]=function(_0x32f2a6,_0x47e50f,_0x57e0c4){if(_['isUndefined'](_0x47e50f)&&_0xa529('0xeb')!==typeof _0x47e50f){return;}if(_['isUndefined'](_0x57e0c4)&&_0xa529('0xeb')!==typeof _0x57e0c4){return;}switch(_0x57e0c4[_0xa529('0xec')]){case'0':ut[_0xa529('0xed')](_0x32f2a6,0x0,_0xa529('0xee'));rpcDb[_0xa529('0xef')](_0x32f2a6,_0xa529('0xf0'));break;case'3':ut[_0xa529('0xed')](_0x32f2a6,0x3,_0xa529('0xc2'));rpcDb[_0xa529('0xef')](_0x32f2a6,_0xa529('0xf1'));break;case'5':ut[_0xa529('0xed')](_0x32f2a6,0x5,_0xa529('0xb9'));rpcDb['createAgentHistory'](_0x32f2a6,_0xa529('0xf2'));break;case'8':ut['logAgent'](_0x32f2a6,0x8,_0xa529('0xca'));rpcDb[_0xa529('0xef')](_0x32f2a6,_0xa529('0xf3'));break;case'22':ut[_0xa529('0xed')](_0x32f2a6,0x16,'AnswerAGI');rpcDb[_0xa529('0xef')](_0x32f2a6,_0xa529('0xf4'));break;default:ut[_0xa529('0xed')](_0x32f2a6,0xc,_0x57e0c4['reason']);rpcDb['createAgentHistory'](_0x32f2a6,_0xa529('0xf3'));}ut[_0xa529('0xe7')](_0x47e50f,_0xa529('0xf5'));logger[_0xa529('0x52')](_0xa529('0xf6'),_0x32f2a6[_0xa529('0xab')],_0xa529('0xac'),_0x47e50f[_0xa529('0x24')],'originated:\x20',_0x47e50f[_0xa529('0x46')]);delete this[_0xa529('0x11')][_0x32f2a6[_0xa529('0xab')]];};Preview['prototype']['checkInBlack']=function(_0x59acd8,_0x288e66,_0x215d69,_0x324d6f,_0x5133c4){var _0x54af9c=this;return new BPromise(function(_0x4f7c9e,_0x45cd25){if(_[_0xa529('0x65')](_0x288e66)||_['isNil'](_0x288e66['Contact'])||_['isNil'](_0x288e66['Contact']['phone'])||_['isNil'](_0x288e66[_0xa529('0x6d')])){_0x45cd25(ut['message']('Contact\x20is\x20undefined',_0x324d6f,_0x5133c4));return;}var _0xfb805c=uuid['v4']();var _0x116f35=_0x54af9c[_0xa529('0xf')][_0x288e66[_0xa529('0xf7')]['name']];var _0x39fed0=_0x215d69?_0x54af9c['agents'][_0x215d69]['id']:undefined;_0x54af9c[_0xa529('0x11')][_0xfb805c]=new Action(_0x288e66,_0x116f35,_0xfb805c,_0x215d69,_0x39fed0);var _0x160764=_0x54af9c[_0xa529('0x11')][_0xfb805c];_0x160764[_0xa529('0xa6')]=_0x324d6f;_0x160764[_0xa529('0xa7')]=_0x5133c4;_0x160764[_0xa529('0xf8')]=_0x215d69;if(_['isEmpty'](_0x59acd8)){_0x54af9c[_0xa529('0xf9')](_0x160764,_0x116f35,_0x288e66,_0x215d69)['then'](function(_0x4f3d0e){logger['info']('[Preview][execCall][success]',_0xa529('0xfa')+_0x160764[_0xa529('0x68')]+_0xa529('0xfb')+_0x160764[_0xa529('0xfc')],JSON[_0xa529('0x4e')](_0x4f3d0e));ami['emit'](_0xa529('0xfd'),ut[_0xa529('0x9c')](_0x160764,_0xa529('0xfe')));_0x4f7c9e(ut[_0xa529('0x45')]('Calling'));})[_0xa529('0x72')](function(_0x17a1d4){ut['logger'](_0xa529('0xff'),_0x17a1d4);_0x45cd25(ut['message']('Call\x20failed',_0x324d6f,_0x5133c4));});}else{_0x116f35[_0xa529('0x36')]+=0x1;ut[_0xa529('0x100')](_0x160764);rpcDb[_0xa529('0x101')](_0x160764,'[Blacklist][error]');delete _0x54af9c[_0xa529('0x11')][_0xfb805c];_0x45cd25(ut[_0xa529('0x45')](_0xa529('0x102'),_0x324d6f,_0x5133c4));}});};Preview['prototype']['isTrunkReachable']=function(_0x25d319){return!_[_0xa529('0x65')](_0x25d319)&&!_[_0xa529('0x65')](_0x25d319[_0xa529('0x24')])&&!_['isNil'](_0x25d319[_0xa529('0x4b')])&&_0x25d319[_0xa529('0x4b')]&&!_[_0xa529('0x65')](this[_0xa529('0x103')][util[_0xa529('0x4f')]('SIP/%s',_0x25d319[_0xa529('0x24')])])&&!_[_0xa529('0x65')](this['trunks'][util[_0xa529('0x4f')](_0xa529('0x104'),_0x25d319[_0xa529('0x24')])][_0xa529('0x70')])&&(this['trunks'][util[_0xa529('0x4f')]('SIP/%s',_0x25d319[_0xa529('0x24')])][_0xa529('0x70')]==='reachable'||this[_0xa529('0x103')][util[_0xa529('0x4f')](_0xa529('0x104'),_0x25d319[_0xa529('0x24')])][_0xa529('0x70')]===_0xa529('0x105'));};Preview[_0xa529('0xc')][_0xa529('0x7f')]=function(_0x27452b,_0x3f9b1f){var _0x3b106b=this;return new BPromise(function(_0x4c05e0,_0x3bf7bf){_0x3b106b[_0xa529('0x106')](_0x27452b,_0x3f9b1f)[_0xa529('0x79')](function(_0x214bc2){_0x4c05e0(_['pick'](_0x214bc2,[_0xa529('0x45')]));})[_0xa529('0x72')](function(_0x38ac82){if(_0x38ac82[_0xa529('0x107')]){rpcDb[_0xa529('0x108')](_0x27452b);}if(_0x38ac82['active']){rpcDb[_0xa529('0x81')](_0x27452b);}_0x3bf7bf(_['pick'](_0x38ac82,[_0xa529('0x45')]));});});};Preview['prototype'][_0xa529('0x106')]=function(_0x1e2c9a,_0x57b612){var _0x596c42=this;return new BPromise(function(_0x53ed26,_0x4950f8){var _0x209cea,_0x3efda9;rpcDb['getContactPreview'](_0x1e2c9a)[_0xa529('0x79')](function(_0x48ab40){if(!_[_0xa529('0x65')](_0x48ab40[0x0])){_0x3efda9=_0x48ab40[0x0][_0xa529('0x109')]?![]:!![];_0x209cea=_0x48ab40[0x0][_0xa529('0x109')]?!![]:![];_0x209cea=_0x57b612?!![]:_0x209cea;}var _0x2886e=_0x596c42[_0xa529('0x10a')](_0x48ab40);if(_0x2886e[_0xa529('0x10b')]){rpcDb[_0xa529('0x10c')](_[_0xa529('0x10d')](_0x48ab40[0x0],[_0xa529('0x6d'),'Contact.phone']))[_0xa529('0x79')](function(_0x39b964){_0x596c42[_0xa529('0x10e')](_0x39b964,_0x48ab40[0x0],_0x57b612,_0x3efda9,_0x209cea)[_0xa529('0x79')](function(_0x2ce9da){_0x53ed26(_0x2ce9da);})['catch'](function(_0x845f3f){_0x4950f8(_0x845f3f);});})['catch'](function(_0x345acf){ut[_0xa529('0x59')](_0xa529('0x10f'),_0x345acf);_0x4950f8(ut[_0xa529('0x45')](_0xa529('0x110'),_0x3efda9,_0x209cea));});}else{_0x4950f8(ut[_0xa529('0x45')](_0x2886e[_0xa529('0x45')],_0x3efda9,_0x209cea));}})[_0xa529('0x72')](function(_0x5ae736){ut[_0xa529('0x59')](_0xa529('0x111'),_0x5ae736);_0x4950f8(ut['message'](_0xa529('0x110'),![],!![]));});});};Preview[_0xa529('0xc')]['validateContact']=function(_0x10f947){if(_[_0xa529('0x65')](_0x10f947)||_['isEmpty'](_0x10f947)||!_[_0xa529('0x65')](_0x10f947[0x0][_0xa529('0x7d')])&&_['isNil'](_0x10f947[0x0][_0xa529('0x7d')][_0xa529('0x24')])){ut[_0xa529('0x59')](_0xa529('0x112'),_0x10f947);return{'isValid':![],'message':_0xa529('0x113')};}var _0x5a83d0=this[_0xa529('0xf')][_0x10f947[0x0][_0xa529('0xf7')][_0xa529('0x24')]];_0x5a83d0[_0xa529('0x45')]='ACTIVE';if(_[_0xa529('0x65')](_0x5a83d0)){ut[_0xa529('0x59')](_0xa529('0x114'),_0x5a83d0);return{'isValid':![],'message':_0xa529('0x115')};}if(!this[_0xa529('0x95')](_0x5a83d0[_0xa529('0x4a')])){ut[_0xa529('0x59')](_0xa529('0x116'),'campaign\x20Name:\x20'+_0x5a83d0[_0xa529('0x24')]+_0xa529('0x117'));if(!this[_0xa529('0x95')](_0x5a83d0[_0xa529('0x96')])){ut[_0xa529('0x59')](_0xa529('0x116'),_0x5a83d0[_0xa529('0x24')]+_0xa529('0x118'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut['isActive'](_0x5a83d0[_0xa529('0x93')])){ut[_0xa529('0x59')](_0xa529('0x119'),_0x5a83d0[_0xa529('0x24')]+_0xa529('0x11a'));return{'isValid':![],'message':_0xa529('0x11b')+_0x5a83d0[_0xa529('0x24')]+_0xa529('0x11a')};}return{'isValid':!![],'message':_0xa529('0x11c')};};Preview[_0xa529('0xc')]['execCall']=function(_0x3dc774,_0x319874,_0x5afe3f,_0x4e1799){var _0x36f3a8=this;return new BPromise(function(_0x5e9d13,_0xf83205){var _0x5d9fd2=_0x3dc774[_0xa529('0xab')];var _0xdbd2cf=_0x36f3a8['isTrunkReachable'](_0x319874[_0xa529('0x4a')])?util[_0xa529('0x4f')](_0xa529('0x11d'),_0x319874['Trunk']['name'],_[_0xa529('0x65')](_0x319874[_0xa529('0x33')])?'':_0x319874['dialPrefix'][_0xa529('0x11e')]()||'',_0x319874['dialCutDigit']>0x0?_0x5afe3f[_0xa529('0x11f')]['phone'][_0xa529('0x120')](_0x319874[_0xa529('0x121')]):_0x5afe3f[_0xa529('0x11f')]['phone']):util[_0xa529('0x4f')](_0xa529('0x11d'),_['isNil'](_0x319874[_0xa529('0x96')])?_0x319874[_0xa529('0x4a')][_0xa529('0x24')]:_0x319874[_0xa529('0x96')][_0xa529('0x24')],_[_0xa529('0x65')](_0x319874[_0xa529('0x33')])?'':_0x319874[_0xa529('0x33')][_0xa529('0x11e')]()||'',_0x319874[_0xa529('0x121')]>0x0?_0x5afe3f[_0xa529('0x11f')][_0xa529('0x122')]['substring'](_0x319874[_0xa529('0x121')]):_0x5afe3f[_0xa529('0x11f')]['phone']);var _0x1064bf=_0x36f3a8['isTrunkReachable'](_0x319874[_0xa529('0x4a')])?ut['getCallerId'](_0x319874['Trunk'][_0xa529('0x4c')],_0x319874['dialOriginateCallerIdName'],_0x319874['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xa529('0x123')](_0x319874['dialOriginateCallerIdNumber'],_0x319874[_0xa529('0x124')]):_0x319874[_0xa529('0x125')]):ut[_0xa529('0x126')](_[_0xa529('0x65')](_0x319874[_0xa529('0x96')])?_0x319874[_0xa529('0x4a')][_0xa529('0x4c')]:_0x319874[_0xa529('0x96')][_0xa529('0x4c')],_0x319874['dialOriginateCallerIdName'],_0x319874[_0xa529('0x124')]>0x0?ut[_0xa529('0x123')](_0x319874[_0xa529('0x125')],_0x319874[_0xa529('0x124')]):_0x319874[_0xa529('0x125')]);if(_0x1064bf){_0x3dc774[_0xa529('0x127')]=ut['extractCalleridName'](_0x1064bf);_0x3dc774[_0xa529('0x128')]=ut['extractCalleridNumber'](_0x1064bf);}var _0x2d7818=ut[_0xa529('0x129')](_0x319874,_0x5afe3f,_0xdbd2cf,_0x1064bf,_0x5d9fd2,_0x3dc774);_[_0xa529('0x12a')](_0x3dc774,ut['toLowerVariables'](_0x2d7818));_0x3dc774['starttime']=moment()[_0xa529('0x4f')](_0xa529('0x83'));ami[_0xa529('0x6f')](ut['variablesAction'](_0x3dc774,_0x319874,_0x2d7818,_0x3dc774['activeContact'],_0x4e1799))[_0xa529('0x79')](function(_0x4833f1){_0x319874[_0xa529('0x46')]+=0x1;logger['info'](_0xa529('0x12b'),_0x5d9fd2,_0xa529('0xac'),_0x319874[_0xa529('0x24')],_0xa529('0x67'),_0x319874['originated']);_0x5e9d13(_0x4833f1);})[_0xa529('0x72')](function(_0x51ea79){ut['logAgent'](_0x3dc774,0xe,_0xa529('0x12c'));rpcDb[_0xa529('0xef')](_0x3dc774,_0xa529('0x12d'));_0xf83205(_0x51ea79);});});};Preview[_0xa529('0xc')][_0xa529('0x1c')]=function(_0x2dcd37){if(this[_0xa529('0x11')][_0x2dcd37[_0xa529('0xb8')]]){this['actions'][_0x2dcd37[_0xa529('0xb8')]][_0xa529('0x71')]=_0x2dcd37[_0xa529('0x71')];}};Preview[_0xa529('0xc')][_0xa529('0x14')]=function(_0x466ba4){var _0x54cdef=this;var _0xe37260=this['actions'][_0x466ba4[_0xa529('0x12e')]];if(_0xe37260){if(_0xe37260['lookAgent']&&this[_0xa529('0x12')][_0xe37260[_0xa529('0xf8')]]){ut[_0xa529('0x12f')](_0xe37260,this[_0xa529('0x12')][_0xe37260[_0xa529('0xf8')]][_0xa529('0x24')],this[_0xa529('0x12')][_0xe37260['lookAgent']]['id']);}var _0x4bb360=_[_0xa529('0x130')](_0xe37260);_0x4bb360[_0xa529('0xa9')]=moment()[_0xa529('0x4f')](_0xa529('0x83'));var _0x316dbf=_0x54cdef[_0xa529('0xf')][_0xe37260[_0xa529('0x68')]];if(ut[_0xa529('0x131')](_0x466ba4[_0xa529('0x132')])){if(_0xe37260[_0xa529('0xa6')]){rpcDb[_0xa529('0x108')](_0xe37260[_0xa529('0xfc')]);}if(_0xe37260[_0xa529('0xa7')]){rpcDb['disableContact'](_0xe37260[_0xa529('0xfc')]);}ami[_0xa529('0x22')](_0xa529('0x133'),ut[_0xa529('0x9c')](_0xe37260,_0xa529('0x134')));this[_0xa529('0xea')](_0x4bb360,_0x316dbf,_0x466ba4);}else{_0xe37260[_0xa529('0x82')]=moment()['format'](_0xa529('0x83'));ut[_0xa529('0xed')](_0x4bb360,0x4,_0xa529('0x135'));rpcDb[_0xa529('0xef')](_0x4bb360,'[callProgressDetectingAgent][logAnswer]');}}};Preview['prototype'][_0xa529('0x17')]=function(_0x51099e){var _0x15dbfa=this;var _0x406d38=this[_0xa529('0x11')][_0x51099e[_0xa529('0xb8')]];var _0x1adc70;if(_0x406d38){_0x1adc70=this['campaignsPreview'][_0x406d38['queue']];logger[_0xa529('0x52')](_0xa529('0x136'),_0x51099e[_0xa529('0xb8')],_0xa529('0xac'),_0x1adc70[_0xa529('0x24')],_0xa529('0x69'),_0x1adc70['pTalking']);}if(this['actions'][_0x51099e[_0xa529('0xb8')]]&&_0x51099e[_0xa529('0xb8')]!==_0x51099e[_0xa529('0xab')]){if(_0x51099e[_0xa529('0x137')]==='16'&&this[_0xa529('0x11')][_0x51099e[_0xa529('0xb8')]]['dialAnswer']){this[_0xa529('0x98')](_0x51099e,_0x51099e[_0xa529('0xb8')],_0x51099e[_0xa529('0x137')]);}else if(this[_0xa529('0x11')][_0x51099e['linkedid']][_0xa529('0x6a')]){logger[_0xa529('0x52')](_0xa529('0x138'),_0x51099e[_0xa529('0xb8')],_0x51099e[_0xa529('0x137')],_0xa529('0xac'),_0x1adc70['name'],_0xa529('0x69'),_0x1adc70[_0xa529('0x28')]);this[_0xa529('0x98')](_0x51099e,_0x51099e['linkedid'],_0x51099e[_0xa529('0x137')]);}}else if(_0x406d38&&_[_0xa529('0x65')](_0x406d38['statedesc'])&&_0x1adc70[_0xa529('0x139')]&&_0x51099e[_0xa529('0xb8')]===_0x51099e[_0xa529('0xab')]&&_[_0xa529('0x65')](_0x51099e[_0xa529('0xec')])&&_0x51099e[_0xa529('0x137')]==='16'&&_0x51099e[_0xa529('0x13a')]==='6'&&_[_0xa529('0x13b')](_0x406d38[_0xa529('0x13c')])){if(_0x406d38[_0xa529('0xa6')]){rpcDb[_0xa529('0x108')](_0x406d38[_0xa529('0xfc')]);}if(_0x406d38['activeContact']){rpcDb['disableContact'](_0x406d38[_0xa529('0xfc')]);}_0x51099e['reason']='22';this[_0xa529('0xea')](_0x406d38,_0x1adc70,_0x51099e);}else if(_0x406d38&&_0x406d38[_0xa529('0x13c')]){if(_0x51099e['cause']==='16'&&this[_0xa529('0x11')][_0x51099e[_0xa529('0xb8')]][_0xa529('0x6a')]){logger['info'](_0xa529('0x13d'),_0x51099e['linkedid'],_0x51099e[_0xa529('0x137')],'\x20Queue',_0x1adc70[_0xa529('0x24')],_0xa529('0x69'),_0x1adc70[_0xa529('0x28')]);this[_0xa529('0x98')](_0x51099e,_0x51099e[_0xa529('0xb8')],_0x51099e[_0xa529('0x137')]);}else if(this[_0xa529('0x11')][_0x51099e[_0xa529('0xb8')]][_0xa529('0x6a')]){logger[_0xa529('0x52')](_0xa529('0x138'),_0x51099e[_0xa529('0xb8')],_0x51099e[_0xa529('0x137')],_0xa529('0xac'),_0x1adc70[_0xa529('0x24')],_0xa529('0x69'),_0x1adc70[_0xa529('0x28')]);this[_0xa529('0x98')](_0x51099e,_0x51099e[_0xa529('0xb8')],_0x51099e[_0xa529('0x137')]);}}};Preview[_0xa529('0xc')][_0xa529('0x1a')]=function(_0x342816){if(this['actions'][_0x342816[_0xa529('0x13e')]]&&_0x342816[_0xa529('0x13e')]!==_0x342816['destuniqueid']){this[_0xa529('0x98')](_0x342816,_0x342816[_0xa529('0x13e')],_0x342816[_0xa529('0xe4')]);}};Preview['prototype'][_0xa529('0x18')]=function(_0x791d99){if(this[_0xa529('0x11')][_0x791d99['linkedid']]&&_0x791d99[_0xa529('0xb8')]!==_0x791d99[_0xa529('0xab')]&&!this['actions'][_0x791d99[_0xa529('0xb8')]][_0xa529('0x6a')]){if(_0x791d99[_0xa529('0x137')]==='1'){this['callProgressDetectingCustomer'](_0x791d99,_0x791d99[_0xa529('0xb8')],_0x791d99[_0xa529('0x137')]);}}};Preview[_0xa529('0xc')][_0xa529('0x13f')]=function(_0x275f12,_0x19d182,_0x451a8e){if(this[_0xa529('0x11')][_0x275f12]){if(_[_0xa529('0x65')](this[_0xa529('0x11')][_0x275f12][_0xa529('0x140')])){this[_0xa529('0x11')][_0x275f12][_0xa529('0x140')]={};}this[_0xa529('0x11')][_0x275f12][_0xa529('0x140')][_0x19d182]=_0x451a8e;}};Preview[_0xa529('0xc')][_0xa529('0x141')]=function(_0x45c564){try{if(!_[_0xa529('0x65')](_0x45c564)){if(ut[_0xa529('0x142')](_[_0xa529('0x143')](_0x45c564[_0xa529('0x144')])[0x0])){this[_0xa529('0x13f')](_0x45c564[_0xa529('0xab')],_[_0xa529('0x143')](_0x45c564[_0xa529('0x144')])[0x0],_0x45c564[_0xa529('0x145')]);}}}catch(_0x4b856b){logger[_0xa529('0x146')](_0xa529('0x147'),util[_0xa529('0x148')](_0x4b856b,{'showHidden':![],'depth':null}));}};Preview[_0xa529('0xc')][_0xa529('0x1f')]=function(_0x303743){if(_0x303743){if(this[_0xa529('0x11')][_0x303743['transfertargetlinkedid']]){this[_0xa529('0x11')][_0x303743[_0xa529('0x149')]][_0xa529('0x13c')]=!![];}}};Preview[_0xa529('0xc')][_0xa529('0x20')]=function(_0x21aa1c){if(_0x21aa1c){if(this[_0xa529('0x11')][_0x21aa1c[_0xa529('0x14a')]]){this['actions'][_0x21aa1c[_0xa529('0x14a')]]['transfer']=!![];}}};module[_0xa529('0x14b')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index c204291..d815a34 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 _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 +var _0x425d=['[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','context','from-sip','xcally-motion-preview','holdtime','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact'];(function(_0x2472a6,_0x5f2d82){var _0x5c04b9=function(_0x184f77){while(--_0x184f77){_0x2472a6['push'](_0x2472a6['shift']());}};_0x5c04b9(++_0x5f2d82);}(_0x425d,0x1e0));var _0xd425=function(_0x1335f5,_0x1d6f12){_0x1335f5=_0x1335f5-0x0;var _0xa78c23=_0x425d[_0x1335f5];return _0xa78c23;};'use strict';var util=require(_0xd425('0x0'));var BPromise=require('bluebird');var logger=require(_0xd425('0x1'))(_0xd425('0x2'));var _=require(_0xd425('0x3'));var cmHopper=require(_0xd425('0x4'));var cmHopperFinal=require(_0xd425('0x5'));var cmHopperHistory=require(_0xd425('0x6'));var cmHopperBlack=require(_0xd425('0x7'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0xd425('0x8'));var voiceQueueReport=require(_0xd425('0x9'));function loggerCatch(_0xc4e080){return function(_0x36866e){logger[_0xd425('0xa')](_0xc4e080,util[_0xd425('0xb')](_0x36866e,{'showHidden':![],'depth':null}));};}function create(_0x50b061){return BPromise[_0xd425('0xc')]()[_0xd425('0xd')](cmHopperHistory[_0xd425('0xe')](_0x50b061))[_0xd425('0xf')](loggerCatch(_0xd425('0x10')));}function createAgent(_0x2beb20){return BPromise[_0xd425('0xc')]()[_0xd425('0xd')](agentReportPreview[_0xd425('0xe')](_0x2beb20))[_0xd425('0xf')](loggerCatch(_0xd425('0x10')));}function moveContact(_0x10d463){return BPromise[_0xd425('0xc')]()[_0xd425('0xd')](cmHopper[_0xd425('0x11')](_0x10d463,!![]))[_0xd425('0xf')](loggerCatch(_0xd425('0x12')));}exports[_0xd425('0x13')]=function(_0x3b5de8){return BPromise[_0xd425('0xc')]()['then'](cmHopperBlack[_0xd425('0x13')](_0x3b5de8))[_0xd425('0xf')](loggerCatch(_0xd425('0x14')));};exports['getContactPreview']=function(_0x309263){return BPromise[_0xd425('0xc')]()[_0xd425('0xd')](cmHopper[_0xd425('0x15')](_0x309263))[_0xd425('0xf')](loggerCatch('[getContactPreview]\x20'));};exports[_0xd425('0xe')]=function(_0x471267,_0x7e267e){create(_0x471267)[_0xd425('0xf')](loggerCatch(_0x7e267e));moveContact(_0x471267)['catch'](loggerCatch(_0x7e267e));};exports[_0xd425('0x16')]=function(_0x434d97,_0x467a6c){createAgent(_0x434d97)[_0xd425('0xf')](loggerCatch(_0x467a6c));};exports['createCustomerHistory']=function(_0x58a0c1,_0x5debc3){create(_0x58a0c1)['catch'](loggerCatch(_0x5debc3));};exports[_0xd425('0x17')]=function(_0xb92870,_0x3c98db){moveContact(_0xb92870)['catch'](loggerCatch(_0x3c98db));};exports[_0xd425('0x18')]=function(_0x7e982e,_0x5f1e7e,_0x2e1ec4){if(_0x5f1e7e){_0x7e982e[_0xd425('0x19')]=null;}if(_0x2e1ec4){_0x7e982e[_0xd425('0x1a')]=![];}return BPromise[_0xd425('0xc')]()[_0xd425('0xd')](cmHopper[_0xd425('0x18')](_0x7e982e))[_0xd425('0xf')](loggerCatch(_0xd425('0x1b')));};exports[_0xd425('0x1c')]=function(_0x2b030b){return BPromise[_0xd425('0xc')]()[_0xd425('0xd')](cmHopper['countReScheduled'](_0x2b030b))[_0xd425('0xf')](loggerCatch(_0xd425('0x1d')));};exports[_0xd425('0x1e')]=function(_0x1908a5){return BPromise[_0xd425('0xc')]()[_0xd425('0xd')](cmHopper[_0xd425('0x1e')]({'UserId':null},_0x1908a5,0x1))['catch'](loggerCatch(_0xd425('0x1f')));};exports[_0xd425('0x20')]=function(_0x1d8861){return BPromise['resolve']()[_0xd425('0xd')](cmHopper[_0xd425('0x1e')]({'active':![]},_0x1d8861,0x1))[_0xd425('0xf')](loggerCatch(_0xd425('0x21')));};exports[_0xd425('0x22')]=function(_0x185d7e){var _0x2fd17a={};_0x2fd17a[_0xd425('0x23')]=_0x185d7e[_0xd425('0x23')];_0x2fd17a[_0xd425('0x24')]=_0x185d7e['uniqueid'];_0x2fd17a[_0xd425('0x25')]=_0x185d7e[_0xd425('0x25')];_0x2fd17a[_0xd425('0x26')]=_0x185d7e[_0xd425('0x26')];_0x2fd17a[_0xd425('0x27')]=_0x185d7e[_0xd425('0x27')];_0x2fd17a[_0xd425('0x28')]=_0x185d7e[_0xd425('0x29')];_0x2fd17a[_0xd425('0x2a')]=_0x185d7e[_0xd425('0x29')];_0x2fd17a[_0xd425('0x2b')]=0x1;_0x2fd17a['queuecallercompleteAt']=_0x185d7e[_0xd425('0x2c')];_0x2fd17a[_0xd425('0x2d')]=_0x185d7e[_0xd425('0x2e')];_0x2fd17a[_0xd425('0x2f')]=_0xd425('0x30');_0x2fd17a['exten']=_0xd425('0x31');_0x2fd17a[_0xd425('0x32')]=0x0;_0x2fd17a['assigned']=0x1;_0x2fd17a['lastAssignedTo']=_0x185d7e['membername'];_0x2fd17a[_0xd425('0x33')]=_0xd425('0x34');return BPromise[_0xd425('0xc')]()[_0xd425('0xd')](voiceQueueReport['create'](_0x2fd17a))[_0xd425('0xf')](loggerCatch(_0xd425('0x35')));};exports[_0xd425('0x36')]=function(_0x1c7f72,_0x27b9e2){return BPromise[_0xd425('0xc')]()[_0xd425('0xd')](cmHopper['getContactRecallMe'](_0x1c7f72,_0x27b9e2))[_0xd425('0xf')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xd425('0x37')]=function(_0x29cca9){return BPromise[_0xd425('0xc')]()['then'](cmHopper[_0xd425('0x18')](_0x29cca9,!![],!![]))[_0xd425('0xf')](loggerCatch(_0xd425('0x38')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 65b2b97..ddb9910 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 _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 +var _0x676c=['logger2','message','getCallerId','string','isEmpty','\x22%s\x22\x20<%s>','format','isUndefined','isActive','addVariables','calleridname','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','isNil','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','logAgent','responsetime','ringtime','starttime','logLookAgent','UserId','logCustomer','endtime','talktime','answertime','isFailure','Failure','BOOKED','uniqueid','channelAgent','calleridnum','from-sip','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','minutes','ContactId','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','buildObj','lastevent','queue','buildAcw','interface','not_inuse','status','reachable','push','getDiff','createBody','CampaignId','filterKey','idContact','campaigntype','dialAnswer','membername','countglobal','callback','callbackuniqueid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','extractCalleridName','match','util','lodash','moment','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','inspect','logger','info','loggerError','error'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x676c,0x198));var _0xc676=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x676c[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0xc676('0x0'));var _=require(_0xc676('0x1'));var moment=require(_0xc676('0x2'));var logger=require('../../../../config/logger')(_0xc676('0x3'));var ipAgi=process[_0xc676('0x4')][_0xc676('0x5')]||_0xc676('0x6');function getSeconds(_0x22b173,_0x2802bf){var _0x4e82ea=moment(_0x22b173)[_0xc676('0x7')](0x0);var _0x228e07=moment(_0x2802bf)[_0xc676('0x7')](0x0);return _0x4e82ea[_0xc676('0x8')](_0x228e07,_0xc676('0x9'));}exports['loggerCatch']=function(_0x26ad9c){return function(_0x5e8ad4){logger['error'](_0x26ad9c,util[_0xc676('0xa')](_0x5e8ad4,{'showHidden':![],'depth':null}));};};exports[_0xc676('0xb')]=function(_0x4aa733,_0x5085b6){logger[_0xc676('0xc')](_0x4aa733,util[_0xc676('0xa')](_0x5085b6,{'showHidden':![],'depth':null}));};exports[_0xc676('0xd')]=function(_0x4e72ff,_0x5c9329){logger[_0xc676('0xe')](_0x4e72ff,util[_0xc676('0xa')](_0x5c9329,{'showHidden':![],'depth':null}));};exports[_0xc676('0xf')]=function(_0x1e06ec){return function(_0x5e8565){logger[_0xc676('0xc')](_0x1e06ec,util[_0xc676('0xa')](_0x5e8565,{'showHidden':![],'depth':null}));};};exports[_0xc676('0x10')]=function(_0x23184f,_0x47adff,_0xcee1c5){return{'message':_0x23184f,'unlock':_0x47adff,'active':_0xcee1c5};};exports[_0xc676('0x11')]=function(_0x4f8832,_0x274463,_0x4fbfb7){if(!_['isUndefined'](_0x4fbfb7)&&_0xc676('0x12')===typeof _0x4fbfb7&&!_['isEmpty'](_0x4fbfb7)){if(!_['isUndefined'](_0x274463)&&'string'===typeof _0x274463&&!_[_0xc676('0x13')](_0x274463)){return util['format'](_0xc676('0x14'),_0x274463,_0x4fbfb7);}return util[_0xc676('0x15')](_0xc676('0x14'),_0x4fbfb7,_0x4fbfb7);}if(!_[_0xc676('0x16')](_0x4f8832)&&_0xc676('0x12')===typeof _0x4f8832&&!_[_0xc676('0x13')](_0x4f8832)){return _0x4f8832;}return'\x22\x22\x20<>';};exports[_0xc676('0x17')]=function(_0x289ed9){if(_['isNil'](_0x289ed9)){return![];}return _0x289ed9;};exports[_0xc676('0x18')]=function(_0xfc64cb,_0x1bd9d9,_0x27afd,_0x26a00b,_0x87b27d,_0x474ad2){var _0xc533a9={'XMD-QUEUE':_0x1bd9d9['Queue']?_0x1bd9d9['Queue']['name']:'','XMD-CALLERID':_0x26a00b,'XMD-CALLERID-PREVIEW':_0x474ad2?util[_0xc676('0x15')]('\x22%s\x22\x20<%s>',_0x474ad2[_0xc676('0x19')],_0x474ad2['calleridnum']):_0x26a00b,'XMD-DIALID':_0x87b27d,'XMD-CONTACTID':_0x1bd9d9['ContactId'],'XMD-CDRTYPE':_0xc676('0x1a'),'CALLERID(all)':_0x26a00b,'XMD-VOICEQUEUEID':_0x1bd9d9['VoiceQueueId'],'XMD-DIALCHANNEL':_0x27afd,'XMD-DIALTIMEOUT':_0xfc64cb[_0xc676('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0xc676('0x15')](_0xc676('0x1c'),_0xfc64cb[_0xc676('0x1d')]?'g':'',_[_0xc676('0x13')](_0xfc64cb['monitor_format'])?'':_0xc676('0x1e')),'XMD-DIALURL':_0xfc64cb[_0xc676('0x1f')]||'','XMD-AGI':_0xfc64cb[_0xc676('0x20')]?util['format'](_0xc676('0x21'),ipAgi,_0xfc64cb['dialQueueProject']):_0xc676('0x22'),'XMD-AGIAFTER':_0xfc64cb[_0xc676('0x1d')]?util['format'](_0xc676('0x21'),ipAgi,_0xfc64cb[_0xc676('0x1d')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x474ad2?_0x474ad2[_0xc676('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x474ad2?_0x474ad2[_0xc676('0x24')]:'','XMD-DESTINATION':_0xc676('0x25')};if(!_['isEmpty'](_0xfc64cb[_0xc676('0x26')])){_0xc533a9[util[_0xc676('0x15')]('%s',_0xc676('0x27'))]=_0xfc64cb[_0xc676('0x26')];_0xc533a9[util[_0xc676('0x15')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x87b27d;}if(_0x1bd9d9&&_0x1bd9d9[_0xc676('0x28')]){for(var _0x19338b in _0x1bd9d9[_0xc676('0x28')]){if(_0x1bd9d9[_0xc676('0x28')][_0xc676('0x29')](_0x19338b)){if(!_['isNil'](_0x1bd9d9[_0xc676('0x28')][_0x19338b])&&_0x19338b!=='id'&&_0x19338b!==_0xc676('0x2a')&&_0x19338b!==_0xc676('0x2b')&&_0x19338b!==_0xc676('0x2c')){_0xc533a9[util['format'](_0xc676('0x2d'),_0xc676('0x2e'),_[_0xc676('0x2f')](_0x19338b))]=_0x1bd9d9[_0xc676('0x28')][_0x19338b];}}}}return _0xc533a9;};exports[_0xc676('0x30')]=function(_0x3a38e0){var _0x1662c5={};for(var _0x30b018 in _0x3a38e0){if(_0x3a38e0[_0xc676('0x29')](_0x30b018)){_0x1662c5[util['format']('%s',_['toLower'](_0x30b018))]=_0x3a38e0[_0x30b018];}}return{'variables':_0x1662c5};};exports['updateOriginated']=function(_0x1c4120,_0x3cd065){if(!_[_0xc676('0x31')](_0x1c4120)){if(_0x1c4120[_0xc676('0x29')]('originated')){if(_0x1c4120[_0xc676('0x32')]>0x0){_0x1c4120[_0xc676('0x32')]-=0x1;}else{logger[_0xc676('0xe')](_0xc676('0x33'),_0x3cd065);}}}else{logger[_0xc676('0xe')](_0xc676('0x34'),_0x3cd065);}};exports['logBlacklist']=function(_0x51d533){var _0x41a3d8=moment()['format'](_0xc676('0x35'));_0x51d533[_0xc676('0x36')]=0xd;_0x51d533[_0xc676('0x37')]=_0xc676('0x38');_0x51d533['starttime']=_0x41a3d8;_0x51d533['responsetime']=_0x41a3d8;_0x51d533['endtime']=_0x41a3d8;};exports[_0xc676('0x39')]=function(_0x25e35f,_0xde0c55,_0x2704b1){var _0x2d40bc=moment()[_0xc676('0x15')](_0xc676('0x35'));_0x25e35f[_0xc676('0x36')]=_0xde0c55;_0x25e35f[_0xc676('0x37')]=_0x2704b1;_0x25e35f[_0xc676('0x3a')]=_0x2d40bc;_0x25e35f[_0xc676('0x3b')]=getSeconds(_0x25e35f[_0xc676('0x3a')],_0x25e35f[_0xc676('0x3c')]);};exports[_0xc676('0x3d')]=function(_0x455c7a,_0x2cba1a,_0x2b23a5){_0x455c7a['membername']=_0x2cba1a;_0x455c7a[_0xc676('0x3e')]=_0x2b23a5;};exports[_0xc676('0x3f')]=function(_0x2020d7,_0x584058,_0x2ce4a2){var _0x1373b6=moment()[_0xc676('0x15')](_0xc676('0x35'));_0x2020d7[_0xc676('0x36')]=_0x584058;_0x2020d7[_0xc676('0x37')]=_0x2ce4a2;_0x2020d7[_0xc676('0x3a')]=_0x2020d7['responsetime']?_0x2020d7[_0xc676('0x3a')]:_0x1373b6;_0x2020d7['endtime']=_0x2020d7[_0xc676('0x40')]?_0x2020d7[_0xc676('0x40')]:_0x1373b6;_0x2020d7['ringtime']=getSeconds(_0x2020d7[_0xc676('0x3a')]||0x0,_0x2020d7[_0xc676('0x3c')]||0x0);_0x2020d7[_0xc676('0x41')]=_0x2020d7[_0xc676('0x42')]?getSeconds(_0x2020d7[_0xc676('0x40')],_0x2020d7['answertime']):0x0;};exports[_0xc676('0x43')]=function(_0x2a5be2){return _0x2a5be2===_0xc676('0x44');};exports['variablesAction']=function(_0x78dbea,_0x3c3b91,_0xf3fbd1,_0x40cbeb,_0x488087){var _0x138f11=_0x40cbeb?'RECALL':_0x78dbea[_0xc676('0x19')];_0x138f11=_0x488087?_0xc676('0x45'):_0x138f11;return{'actionid':_0x78dbea[_0xc676('0x46')],'action':'originate','channel':_0x78dbea[_0xc676('0x47')],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x138f11,_0x78dbea[_0xc676('0x48')]),'Exten':'xcally-motion-preview','Context':_0xc676('0x49'),'Priority':'1','variable':_0xf3fbd1,'timeout':(_0x3c3b91['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x78dbea['uniqueid']};};exports[_0xc676('0x4a')]=function(_0x55bbdf){return _0x55bbdf[_0xc676('0x4b')]+_0x55bbdf['countcongestionretry']+_0x55bbdf[_0xc676('0x4c')]+_0x55bbdf[_0xc676('0x4d')]+_0x55bbdf[_0xc676('0x4e')];};exports[_0xc676('0x4f')]=function(_0x4d8d1d){var _0x4e3329=_[_0xc676('0x50')](_0x4d8d1d);_0x4e3329[_0xc676('0x36')]=0xf;_0x4e3329['statedesc']=_0xc676('0x51');return _0x4e3329;};exports[_0xc676('0x52')]=function(_0x59be1a,_0x38d1bc,_0x28d937){var _0xa9b988={};_0xa9b988[_0x38d1bc]=_0x59be1a[_0x38d1bc];_0xa9b988[_0xc676('0x53')]=![];_0xa9b988[_0xc676('0x54')]=moment()['add'](_0x28d937,_0xc676('0x55'))[_0xc676('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0xa9b988[_0xc676('0x56')]=_0x59be1a[_0xc676('0x56')];_0xa9b988[_0xc676('0x57')]=_0x59be1a[_0xc676('0x57')];_0xa9b988['VoiceQueueId']=_0x59be1a[_0xc676('0x58')]||undefined;return _0xa9b988;};exports[_0xc676('0x59')]=function(_0x3e0e1d,_0x42ea7a){if(!_['isNil'](_0x3e0e1d)){if(_0x3e0e1d[_0xc676('0x5a')]>0x0){_0x3e0e1d[_0xc676('0x5a')]-=0x1;}else{logger[_0xc676('0xe')](_0x42ea7a,_0xc676('0x5b'));}}else{logger[_0xc676('0xe')](_0x42ea7a,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xc676('0x5c')]=function(_0x25c3f8){if(_0x25c3f8<=0x0){return!![];}return![];};exports[_0xc676('0x5d')]=function(_0x4b8ede,_0x447311){_0x4b8ede[_0xc676('0x5e')]=_0x447311;_0x4b8ede['name']=_0x4b8ede[_0xc676('0x5f')];_0x4b8ede['interface']=_0x4b8ede[_0xc676('0x47')];return _0x4b8ede;};exports[_0xc676('0x60')]=function(_0x3ac42f){var _0x2c2b1a={};_0x2c2b1a[_0xc676('0x5f')]=_0x3ac42f[_0xc676('0x5f')];_0x2c2b1a[_0xc676('0x61')]=_0x3ac42f[_0xc676('0x47')];_0x2c2b1a[_0xc676('0x46')]=_0x3ac42f['uniqueid'];return _0x2c2b1a;};exports['agentReadyId']=function(_0x365dd3){var _0x1b4a16=[];for(var _0x7e6447 in _0x365dd3){if(_0x365dd3['hasOwnProperty'](_0x7e6447)){if(!_[_0xc676('0x31')](_0x365dd3[_0x7e6447])&&_0x365dd3[_0x7e6447]['state']===_0xc676('0x62')&&_0x365dd3[_0x7e6447][_0xc676('0x63')]===_0xc676('0x64')){_0x1b4a16[_0xc676('0x65')](_0x365dd3[_0x7e6447]['id']);}}}return _0x1b4a16;};exports[_0xc676('0x66')]=function(_0x2f3c5d){var _0xd9eead=moment()[_0xc676('0x7')](0x0);var _0x2a1025=moment(_0x2f3c5d)[_0xc676('0x7')](0x0);return _0xd9eead[_0xc676('0x8')](_0x2a1025,_0xc676('0x9'));};exports[_0xc676('0x67')]=function(_0x4fadac){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4fadac['ContactId'],'ListId':_0x4fadac['ListId'],'VoiceQueueId':_0x4fadac[_0xc676('0x58')]||undefined,'CampaignId':_0x4fadac[_0xc676('0x68')]||undefined};};exports[_0xc676('0x69')]=function(_0x3f4f17){if(_0x3f4f17===_0xc676('0x46')||_0x3f4f17===_0xc676('0x6a')||_0x3f4f17==='queue'||_0x3f4f17==='type'||_0x3f4f17===_0xc676('0x6b')||_0x3f4f17===_0xc676('0x6c')||_0x3f4f17===_0xc676('0x6d')||_0x3f4f17===_0xc676('0x47')||_0x3f4f17===_0xc676('0x19')||_0x3f4f17===_0xc676('0x53')||_0x3f4f17===_0xc676('0x48')||_0x3f4f17===_0xc676('0x54')||_0x3f4f17===_0xc676('0x4b')||_0x3f4f17==='countcongestionretry'||_0x3f4f17===_0xc676('0x4c')||_0x3f4f17===_0xc676('0x6e')||_0x3f4f17===_0xc676('0x6f')||_0x3f4f17===_0xc676('0x70')||_0x3f4f17==='callbackat'||_0x3f4f17==='recallme'||_0x3f4f17===_0xc676('0x56')||_0x3f4f17===_0xc676('0x57')||_0x3f4f17===_0xc676('0x3e')||_0x3f4f17===_0xc676('0x58')||_0x3f4f17==='sipcallid'||_0x3f4f17===_0xc676('0x71')||_0x3f4f17===_0xc676('0x72')||_0x3f4f17===_0xc676('0x73')||_0x3f4f17===_0xc676('0x74')||_0x3f4f17===_0xc676('0x75')||_0x3f4f17===_0xc676('0x76')||_0x3f4f17===_0xc676('0x77')||_0x3f4f17===_0xc676('0x78')||_0x3f4f17==='xmd-dialchannel'||_0x3f4f17===_0xc676('0x79')||_0x3f4f17===_0xc676('0x7a')||_0x3f4f17===_0xc676('0x7b')||_0x3f4f17===_0xc676('0x7c')||_0x3f4f17===_0xc676('0x7d')||_0x3f4f17===_0xc676('0x7e')||_0x3f4f17===_0xc676('0x7f')||_0x3f4f17===_0xc676('0x80')||_0x3f4f17===_0xc676('0x81')||_0x3f4f17===_0xc676('0x82')||_0x3f4f17===_0xc676('0x83')||_0x3f4f17===_0xc676('0x84')||_0x3f4f17===_0xc676('0x85')||_0x3f4f17==='rtpaudioqos'||_0x3f4f17==='rtpaudioqosbridged'||_0x3f4f17===_0xc676('0x80')||_0x3f4f17==='rtpaudioqosjitterbridged'||_0x3f4f17===_0xc676('0x82')||_0x3f4f17===_0xc676('0x83')||_0x3f4f17===_0xc676('0x84')||_0x3f4f17===_0xc676('0x85')||_0x3f4f17===_0xc676('0x86')||_0x3f4f17===_0xc676('0x87')||_0x3f4f17===_0xc676('0x36')||_0x3f4f17===_0xc676('0x37')){return![];}return!![];};exports[_0xc676('0x88')]=function(_0x409a18,_0x18219d){var _0x4ab37a,_0x1c6699,_0x4c3d34;if(_0x18219d<=0x0){_0x18219d=0x1;}_0x4ab37a=new RegExp(_0xc676('0x89')+_0x18219d+'}$');_0x1c6699=Math[_0xc676('0x8a')](0xa,_0x18219d-0x1);_0x4c3d34=Math['pow'](0xa,_0x18219d)-0x1;return util[_0xc676('0x15')]('%s',_['replace'](_0x409a18,_0x4ab37a,_['random'](_0x1c6699,_0x4c3d34)));};exports[_0xc676('0x8b')]=function(_0x38f9ac){var _0x387c57=_0x38f9ac[_0xc676('0x8c')](/"(.*?)"/);return _0x387c57?_0x387c57[0x1]:_0x38f9ac;};exports['extractCalleridNumber']=function(_0x21b860){var _0x51fdec=_0x21b860[_0xc676('0x8c')](/<(.*?)>/);return _0x51fdec?_0x51fdec[0x1]:_0x21b860;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 3269d39..bf28f7b 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(_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 +var _0x7a54=['number','boolean','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x196b99,_0x1a5fb1){var _0x56ba4a=function(_0x3da098){while(--_0x3da098){_0x196b99['push'](_0x196b99['shift']());}};_0x56ba4a(++_0x1a5fb1);}(_0x7a54,0x106));var _0x47a5=function(_0x187da0,_0x5964c0){_0x187da0=_0x187da0-0x0;var _0x2bbf97=_0x7a54[_0x187da0];return _0x2bbf97;};'use strict';exports[_0x47a5('0x0')]={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x47a5('0x2'),'required':![]},'paused':{'type':_0x47a5('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]}};exports[_0x47a5('0x4')]={'interface':{'type':_0x47a5('0x1'),'required':!![]},'paused':{'type':_0x47a5('0x3')},'reason':{'type':'string','required':![]}};exports[_0x47a5('0x5')]={'module':{'type':'string','required':![]}};exports[_0x47a5('0x6')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x47a5('0x7')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 8509d6d..e918d97 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 _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 +var _0x98a5=['outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','voiceExtensions','channels','outboundChannels','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','SIP/%s','name','hasOwnProperty','isNil','format','interface','total','sumDuration','isEmpty','answered','unmanaged','abandoned','sumHoldTime','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isUndefined','initTelephones','initTrunks','initVoiceQueues','initTriggers','initSalesforceAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','uniqueid','queue','queuecallerexit','diff','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','seconds','queuecallerleaveAt','initVoiceCallReports'];(function(_0x4c84bf,_0xcae335){var _0x438e62=function(_0x25112e){while(--_0x25112e){_0x4c84bf['push'](_0x4c84bf['shift']());}};_0x438e62(++_0xcae335);}(_0x98a5,0x1aa));var _0x598a=function(_0x459423,_0x3416a8){_0x459423=_0x459423-0x0;var _0x42ed14=_0x98a5[_0x459423];return _0x42ed14;};'use strict';var BPromise=require(_0x598a('0x0'));var util=require(_0x598a('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require(_0x598a('0x2'));var Telephone=require(_0x598a('0x3'));var Trunk=require(_0x598a('0x4'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x598a('0x5'));var Template=require(_0x598a('0x6'));var Campaign=require(_0x598a('0x7'));var VoiceExtension=require(_0x598a('0x8'));var ZendeskAccount=require(_0x598a('0x9'));var SalesforceAccount=require(_0x598a('0xa'));var FreshdeskAccount=require(_0x598a('0xb'));var SugarcrmAccount=require(_0x598a('0xc'));var ZohoAccount=require(_0x598a('0xd'));var DeskAccount=require(_0x598a('0xe'));var VtigerAccount=require(_0x598a('0xf'));var ServicenowAccount=require(_0x598a('0x10'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x598a('0x11'));var FaxAccount=require(_0x598a('0x12'));var Realtime=function(){this[_0x598a('0x13')]={};this[_0x598a('0x14')]={};this[_0x598a('0x15')]={};this[_0x598a('0x16')]={};this[_0x598a('0x17')]={};this[_0x598a('0x18')]={};this[_0x598a('0x19')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x598a('0x1a')]={};this[_0x598a('0x1b')]={};this['queueChannels']={};this[_0x598a('0x1c')]={};this['timers']={};this[_0x598a('0x1d')]={};this[_0x598a('0x1e')]={};this[_0x598a('0x1f')]={};this['freshdeskAccounts']={};this[_0x598a('0x20')]={};this[_0x598a('0x21')]={};this[_0x598a('0x22')]={};this[_0x598a('0x23')]={};this[_0x598a('0x24')]={};this[_0x598a('0x25')]={};this[_0x598a('0x26')]={};};function freeIsNotKey(_0x176010,_0x3bf9a6,_0x5c83e5){var _0x24dd78=_[_0x598a('0x27')](_0x176010,function(_0xadaa72,_0x4cf50a){return _0xadaa72[_0x5c83e5];});for(var _0x586709 in _0x3bf9a6){if(_0x3bf9a6['hasOwnProperty'](_0x586709)){if(!_0x24dd78[_0x586709]){delete _0x3bf9a6[_0x586709];}}}}function freeIsNotKeySip(_0x502cdf,_0x28d8e6){var _0x35b6a8=_[_0x598a('0x27')](_0x502cdf,function(_0x17f19c,_0x4141f2){return util['format'](_0x598a('0x28'),_0x17f19c[_0x598a('0x29')]);});for(var _0x4f1593 in _0x28d8e6){if(_0x28d8e6[_0x598a('0x2a')](_0x4f1593)){if(!_0x35b6a8[_0x4f1593]){delete _0x28d8e6[_0x4f1593];}}}}function freeIsNotKeyAgent(_0x285812,_0x3887b5){var _0x6aaa66=_[_0x598a('0x27')](_0x285812,function(_0x43ddd5,_0x281d30){var _0x13bf02=_[_0x598a('0x2b')](_0x43ddd5['interface'])?util[_0x598a('0x2c')](_0x598a('0x28'),_0x43ddd5[_0x598a('0x29')]):_0x43ddd5[_0x598a('0x2d')];return _0x13bf02;});for(var _0x377b16 in _0x3887b5){if(_0x3887b5['hasOwnProperty'](_0x377b16)){if(!_0x6aaa66[_0x377b16]){delete _0x3887b5[_0x377b16];}}}}function clearVoiceCallReports(_0x28a8b8){_0x28a8b8[_0x598a('0x2e')]=0x0;_0x28a8b8['answered']=0x0;_0x28a8b8['sumHoldTime']=0x0;_0x28a8b8[_0x598a('0x2f')]=0x0;_0x28a8b8['sumBillable']=0x0;}function clearCampaigns(_0x20d183){if(!_[_0x598a('0x30')](_0x20d183)){for(var _0x2f8512 in _0x20d183){if(_0x20d183[_0x598a('0x2a')](_0x2f8512)){_0x20d183[_0x2f8512]['ivrTotalCallsDays']=0x0;_0x20d183[_0x2f8512]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2f683a){if(!_['isEmpty'](_0x2f683a)){for(var _0x410501 in _0x2f683a){if(_0x2f683a[_0x598a('0x2a')](_0x410501)){_0x2f683a[_0x410501][_0x598a('0x2e')]=0x0;_0x2f683a[_0x410501][_0x598a('0x31')]=0x0;_0x2f683a[_0x410501][_0x598a('0x32')]=0x0;_0x2f683a[_0x410501][_0x598a('0x33')]=0x0;_0x2f683a[_0x410501][_0x598a('0x34')]=0x0;_0x2f683a[_0x410501]['sumDuration']=0x0;_0x2f683a[_0x410501][_0x598a('0x35')]=0x0;_0x2f683a[_0x410501][_0x598a('0x36')]=0x0;_0x2f683a[_0x410501][_0x598a('0x37')]=0x0;_0x2f683a[_0x410501][_0x598a('0x38')]=0x0;_0x2f683a[_0x410501][_0x598a('0x39')]=0x0;_0x2f683a[_0x410501]['outboundNoSuchCallsDay']=0x0;_0x2f683a[_0x410501][_0x598a('0x3a')]=0x0;_0x2f683a[_0x410501][_0x598a('0x3b')]=0x0;_0x2f683a[_0x410501]['outboundDropCallsDayCallersExit']=0x0;_0x2f683a[_0x410501][_0x598a('0x3c')]=0x0;_0x2f683a[_0x410501][_0x598a('0x3d')]=0x0;_0x2f683a[_0x410501][_0x598a('0x3e')]=0x0;_0x2f683a[_0x410501][_0x598a('0x3f')]=0x0;_0x2f683a[_0x410501][_0x598a('0x36')]=0x0;_0x2f683a[_0x410501][_0x598a('0x40')]=0x0;_0x2f683a[_0x410501][_0x598a('0x41')]=!![];}}}}Realtime['prototype'][_0x598a('0x42')]=function(_0x13fa74,_0x3d7441){for(var _0x2da52f in _0x3d7441){if(_0x13fa74[_0x598a('0x2a')](_0x2da52f)){_0x13fa74[_0x2da52f]=_0x3d7441[_0x2da52f];}}};Realtime[_0x598a('0x43')][_0x598a('0x44')]=function(){var _0x4df1ac=this;return function(_0x45209e){if(_0x45209e){freeIsNotKeyAgent(_0x45209e,_0x4df1ac[_0x598a('0x13')]);for(var _0x4a0a58=0x0,_0x33365d={},_0x49f0f6={};_0x4a0a58<_0x45209e[_0x598a('0x45')];_0x4a0a58+=0x1){_0x33365d=_0x45209e[_0x4a0a58];var _0x2851dc=_[_0x598a('0x2b')](_0x33365d['interface'])?util[_0x598a('0x2c')](_0x598a('0x28'),_0x33365d[_0x598a('0x29')]):_0x33365d[_0x598a('0x2d')];if(_[_0x598a('0x46')](_0x4df1ac[_0x598a('0x13')][_0x2851dc])){_0x4df1ac[_0x598a('0x13')][_0x2851dc]=new Agent(_0x33365d);}else{_0x4df1ac[_0x598a('0x42')](_0x4df1ac[_0x598a('0x13')][_0x2851dc],_0x33365d);}}}return _0x4df1ac['agents'];};};Realtime[_0x598a('0x43')][_0x598a('0x47')]=function(){var _0x17dd28=this;return function(_0x41eaea){if(_0x41eaea){freeIsNotKeySip(_0x41eaea,_0x17dd28[_0x598a('0x14')]);for(var _0x380f4f=0x0,_0x13c0d1={},_0x386426={};_0x380f4f<_0x41eaea[_0x598a('0x45')];_0x380f4f+=0x1){_0x13c0d1=_0x41eaea[_0x380f4f];if(_[_0x598a('0x46')](_0x17dd28[_0x598a('0x14')][util[_0x598a('0x2c')](_0x598a('0x28'),_0x13c0d1['name'])])){_0x17dd28[_0x598a('0x14')][util[_0x598a('0x2c')](_0x598a('0x28'),_0x13c0d1['name'])]=new Telephone(_0x13c0d1);}else{_0x17dd28[_0x598a('0x42')](_0x17dd28[_0x598a('0x14')][util[_0x598a('0x2c')](_0x598a('0x28'),_0x13c0d1['name'])],_0x13c0d1);}}}return _0x17dd28[_0x598a('0x14')];};};Realtime[_0x598a('0x43')][_0x598a('0x48')]=function(){var _0x219307=this;return function(_0x50d9d9){if(_0x50d9d9){freeIsNotKeySip(_0x50d9d9,_0x219307[_0x598a('0x15')]);for(var _0x22c8a9=0x0,_0x3b3672={},_0x43518f={};_0x22c8a9<_0x50d9d9[_0x598a('0x45')];_0x22c8a9+=0x1){_0x3b3672=_0x50d9d9[_0x22c8a9];if(_[_0x598a('0x46')](_0x219307[_0x598a('0x15')][util[_0x598a('0x2c')](_0x598a('0x28'),_0x3b3672[_0x598a('0x29')])])){_0x219307[_0x598a('0x15')][util[_0x598a('0x2c')](_0x598a('0x28'),_0x3b3672[_0x598a('0x29')])]=new Trunk(_0x3b3672);}else{_0x219307['mergeFromDatabase'](_0x219307[_0x598a('0x15')][util[_0x598a('0x2c')](_0x598a('0x28'),_0x3b3672[_0x598a('0x29')])],_0x3b3672);}}}return _0x219307['trunks'];};};Realtime[_0x598a('0x43')][_0x598a('0x49')]=function(){var _0x3ba2f5=this;return function(_0x2cc5cd){if(_0x2cc5cd){freeIsNotKey(_0x2cc5cd,_0x3ba2f5['voiceQueues'],_0x598a('0x29'));for(var _0x20dfa5=0x0,_0x384462={},_0x5c2292={};_0x20dfa5<_0x2cc5cd['length'];_0x20dfa5+=0x1){_0x384462=_0x2cc5cd[_0x20dfa5];if(_[_0x598a('0x46')](_0x3ba2f5[_0x598a('0x16')][_0x384462['name']])){_0x3ba2f5['voiceQueues'][_0x384462[_0x598a('0x29')]]=new VoiceQueue(_0x384462);}else{_0x3ba2f5[_0x598a('0x42')](_0x3ba2f5[_0x598a('0x16')][_0x384462[_0x598a('0x29')]],_0x384462);}}}return _0x3ba2f5[_0x598a('0x16')];};};Realtime[_0x598a('0x43')][_0x598a('0x4a')]=function(){var _0x5a64b1=this;return function(_0x4a1e60){if(_0x4a1e60){freeIsNotKey(_0x4a1e60,_0x5a64b1[_0x598a('0x17')],'id');for(var _0x5a5b80=0x0,_0x319f2b={},_0x4d530c={};_0x5a5b80<_0x4a1e60['length'];_0x5a5b80+=0x1){_0x319f2b=_0x4a1e60[_0x5a5b80];if(_['isUndefined'](_0x5a64b1[_0x598a('0x17')][_0x319f2b['id']])){_0x5a64b1['triggers'][_0x319f2b['id']]=new Trigger(_0x319f2b);}else{_0x5a64b1[_0x598a('0x42')](_0x5a64b1['triggers'][_0x319f2b['id']],_0x319f2b);}}}return _0x5a64b1[_0x598a('0x17')];};};Realtime['prototype']['initTemplates']=function(){var _0x2a4712=this;return function(_0x13a1cb){if(_0x13a1cb){freeIsNotKey(_0x13a1cb,_0x2a4712[_0x598a('0x19')],'id');for(var _0x450777=0x0,_0x276f44={},_0x1c7014={};_0x450777<_0x13a1cb[_0x598a('0x45')];_0x450777+=0x1){_0x276f44=_0x13a1cb[_0x450777];if(_[_0x598a('0x46')](_0x2a4712[_0x598a('0x19')][_0x276f44['id']])){_0x2a4712[_0x598a('0x19')][_0x276f44['id']]=new Template(_0x276f44);}else{_0x2a4712[_0x598a('0x42')](_0x2a4712[_0x598a('0x19')][_0x276f44['id']],_0x276f44);}}}return _0x2a4712[_0x598a('0x19')];};};Realtime[_0x598a('0x43')]['initZendeskAccounts']=function(){var _0x3170e1=this;return function(_0x1e20e1){if(_0x1e20e1){freeIsNotKey(_0x1e20e1,_0x3170e1[_0x598a('0x1d')],'id');for(var _0x2d40d3=0x0,_0x373458={},_0x2d8fb6={};_0x2d40d3<_0x1e20e1[_0x598a('0x45')];_0x2d40d3+=0x1){_0x373458=_0x1e20e1[_0x2d40d3];if(_['isUndefined'](_0x3170e1['zendeskAccounts'][_0x373458['id']])){_0x3170e1['zendeskAccounts'][_0x373458['id']]=new ZendeskAccount(_0x373458);}else{_0x3170e1[_0x598a('0x42')](_0x3170e1[_0x598a('0x1d')][_0x373458['id']],_0x373458);}}}return _0x3170e1['zendeskAccounts'];};};Realtime[_0x598a('0x43')][_0x598a('0x4b')]=function(){var _0x271e5d=this;return function(_0x28570b){if(_0x28570b){freeIsNotKey(_0x28570b,_0x271e5d['salesforceAccounts'],'id');for(var _0x5b7e31=0x0,_0x182f7e={},_0x28c397={};_0x5b7e31<_0x28570b[_0x598a('0x45')];_0x5b7e31+=0x1){_0x182f7e=_0x28570b[_0x5b7e31];if(_[_0x598a('0x46')](_0x271e5d[_0x598a('0x1e')][_0x182f7e['id']])){_0x271e5d['salesforceAccounts'][_0x182f7e['id']]=new SalesforceAccount(_0x182f7e);}else{_0x271e5d['mergeFromDatabase'](_0x271e5d[_0x598a('0x1e')][_0x182f7e['id']],_0x182f7e);}}}return _0x271e5d[_0x598a('0x1e')];};};Realtime[_0x598a('0x43')]['initFreshdeskAccounts']=function(){var _0x5d6abb=this;return function(_0x4afb43){if(_0x4afb43){freeIsNotKey(_0x4afb43,_0x5d6abb[_0x598a('0x4c')],'id');for(var _0x69fbaa=0x0,_0xf92d28={},_0x6656={};_0x69fbaa<_0x4afb43['length'];_0x69fbaa+=0x1){_0xf92d28=_0x4afb43[_0x69fbaa];if(_['isUndefined'](_0x5d6abb[_0x598a('0x4c')][_0xf92d28['id']])){_0x5d6abb['freshdeskAccounts'][_0xf92d28['id']]=new FreshdeskAccount(_0xf92d28);}else{_0x5d6abb[_0x598a('0x42')](_0x5d6abb[_0x598a('0x4c')][_0xf92d28['id']],_0xf92d28);}}}return _0x5d6abb[_0x598a('0x4c')];};};Realtime[_0x598a('0x43')][_0x598a('0x4d')]=function(){var _0x4060e0=this;return function(_0x57d26f){if(_0x57d26f){freeIsNotKey(_0x57d26f,_0x4060e0[_0x598a('0x20')],'id');for(var _0x2f4b83=0x0,_0x4b224e={},_0x499653={};_0x2f4b83<_0x57d26f[_0x598a('0x45')];_0x2f4b83+=0x1){_0x4b224e=_0x57d26f[_0x2f4b83];if(_['isUndefined'](_0x4060e0['zohoAccounts'][_0x4b224e['id']])){_0x4060e0[_0x598a('0x20')][_0x4b224e['id']]=new ZohoAccount(_0x4b224e);}else{_0x4060e0[_0x598a('0x42')](_0x4060e0['zohoAccounts'][_0x4b224e['id']],_0x4b224e);}}}return _0x4060e0[_0x598a('0x20')];};};Realtime[_0x598a('0x43')][_0x598a('0x4e')]=function(){var _0xb20b21=this;return function(_0x324c22){if(_0x324c22){freeIsNotKey(_0x324c22,_0xb20b21[_0x598a('0x21')],'id');for(var _0x587660=0x0,_0xd38ff={},_0x4ccd02={};_0x587660<_0x324c22[_0x598a('0x45')];_0x587660+=0x1){_0xd38ff=_0x324c22[_0x587660];if(_['isUndefined'](_0xb20b21[_0x598a('0x21')][_0xd38ff['id']])){_0xb20b21[_0x598a('0x21')][_0xd38ff['id']]=new DeskAccount(_0xd38ff);}else{_0xb20b21[_0x598a('0x42')](_0xb20b21[_0x598a('0x21')][_0xd38ff['id']],_0xd38ff);}}}return _0xb20b21[_0x598a('0x21')];};};Realtime['prototype'][_0x598a('0x4f')]=function(){var _0x262b57=this;return function(_0x4f83de){if(_0x4f83de){freeIsNotKey(_0x4f83de,_0x262b57[_0x598a('0x1f')],'id');for(var _0x1ca9c5=0x0,_0x40ad8b={},_0x547d92={};_0x1ca9c5<_0x4f83de[_0x598a('0x45')];_0x1ca9c5+=0x1){_0x40ad8b=_0x4f83de[_0x1ca9c5];if(_[_0x598a('0x46')](_0x262b57[_0x598a('0x1f')][_0x40ad8b['id']])){_0x262b57[_0x598a('0x1f')][_0x40ad8b['id']]=new SugarcrmAccount(_0x40ad8b);}else{_0x262b57[_0x598a('0x42')](_0x262b57[_0x598a('0x1f')][_0x40ad8b['id']],_0x40ad8b);}}}return _0x262b57[_0x598a('0x1f')];};};Realtime[_0x598a('0x43')]['initVtigerAccounts']=function(){var _0x3c4376=this;return function(_0x284df6){if(_0x284df6){freeIsNotKey(_0x284df6,_0x3c4376[_0x598a('0x22')],'id');for(var _0x3e753d=0x0,_0x5b8926={},_0x24f6aa={};_0x3e753d<_0x284df6['length'];_0x3e753d+=0x1){_0x5b8926=_0x284df6[_0x3e753d];if(_[_0x598a('0x46')](_0x3c4376[_0x598a('0x22')][_0x5b8926['id']])){_0x3c4376[_0x598a('0x22')][_0x5b8926['id']]=new VtigerAccount(_0x5b8926);}else{_0x3c4376[_0x598a('0x42')](_0x3c4376[_0x598a('0x22')][_0x5b8926['id']],_0x5b8926);}}}return _0x3c4376[_0x598a('0x22')];};};Realtime['prototype'][_0x598a('0x50')]=function(){var _0x44f98d=this;return function(_0x1bf476){if(_0x1bf476){freeIsNotKey(_0x1bf476,_0x44f98d[_0x598a('0x23')],'id');for(var _0x4fb85f=0x0,_0x4ac0ff={},_0x123897={};_0x4fb85f<_0x1bf476[_0x598a('0x45')];_0x4fb85f+=0x1){_0x4ac0ff=_0x1bf476[_0x4fb85f];if(_[_0x598a('0x46')](_0x44f98d['servicenowAccounts'][_0x4ac0ff['id']])){_0x44f98d['servicenowAccounts'][_0x4ac0ff['id']]=new ServicenowAccount(_0x4ac0ff);}else{_0x44f98d['mergeFromDatabase'](_0x44f98d[_0x598a('0x23')][_0x4ac0ff['id']],_0x4ac0ff);}}}return _0x44f98d[_0x598a('0x23')];};};Realtime[_0x598a('0x43')]['initDynamics365Accounts']=function(){var _0x34d963=this;return function(_0x1c5539){if(_0x1c5539){freeIsNotKey(_0x1c5539,_0x34d963[_0x598a('0x24')],'id');for(var _0x3faa1b=0x0,_0x32e6da={},_0x13e58b={};_0x3faa1b<_0x1c5539['length'];_0x3faa1b+=0x1){_0x32e6da=_0x1c5539[_0x3faa1b];if(_[_0x598a('0x46')](_0x34d963['dynamics365Accounts'][_0x32e6da['id']])){_0x34d963[_0x598a('0x24')][_0x32e6da['id']]=new Dynamics365Account(_0x32e6da);}else{_0x34d963[_0x598a('0x42')](_0x34d963[_0x598a('0x24')][_0x32e6da['id']],_0x32e6da);}}}return _0x34d963['dynamics365Accounts'];};};Realtime[_0x598a('0x43')][_0x598a('0x51')]=function(){var _0x3d3381=this;return function(_0x49ebeb){if(_0x49ebeb){freeIsNotKey(_0x49ebeb,_0x3d3381[_0x598a('0x25')],'id');for(var _0x4ccfc5=0x0,_0x5ee572={},_0x1cdb68={};_0x4ccfc5<_0x49ebeb['length'];_0x4ccfc5+=0x1){_0x5ee572=_0x49ebeb[_0x4ccfc5];if(_[_0x598a('0x46')](_0x3d3381['freshsalesAccounts'][_0x5ee572['id']])){_0x3d3381['freshsalesAccounts'][_0x5ee572['id']]=new FreshsalesAccount(_0x5ee572);}else{_0x3d3381['mergeFromDatabase'](_0x3d3381['freshsalesAccounts'][_0x5ee572['id']],_0x5ee572);}}}return _0x3d3381[_0x598a('0x25')];};};Realtime[_0x598a('0x43')][_0x598a('0x52')]=function(){var _0x148936=this;return function(_0x591532){for(var _0x2b0985=0x0;_0x2b0985<_0x591532['length'];_0x2b0985+=0x1){_['merge'](_0x148936[_0x598a('0x16')][_0x591532[_0x2b0985]['name']],_0x591532[_0x2b0985]);}return _0x148936['voiceQueues'];};};Realtime[_0x598a('0x43')][_0x598a('0x53')]=function(){var _0xd0b5d8=this;return function(_0x3de017){clearVoiceQueues(_0xd0b5d8[_0x598a('0x16')]);if(_0x3de017){_0x3de017=_['groupBy'](_0x3de017,_0x598a('0x54'));for(var _0x48e7c9 in _0x3de017){if(_0x3de017['hasOwnProperty'](_0x48e7c9)){var _0x467c80={};for(var _0x9adae1=0x0;_0x9adae1<_0x3de017[_0x48e7c9][_0x598a('0x45')];_0x9adae1+=0x1){var _0x1b77d8=_0x3de017[_0x48e7c9][_0x9adae1][_0x598a('0x55')];if(_0xd0b5d8['voiceQueues'][_0x1b77d8]){if(_0x3de017[_0x48e7c9][_0x9adae1][_0x598a('0x56')]){_0xd0b5d8[_0x598a('0x16')][_0x1b77d8]['unmanaged']+=0x1;}if(_0x3de017[_0x48e7c9][_0x9adae1]['queuecallerabandon']){_0xd0b5d8[_0x598a('0x16')][_0x1b77d8][_0x598a('0x33')]+=0x1;}_0xd0b5d8[_0x598a('0x16')][_0x1b77d8]['sumHoldTime']+=moment(_0x3de017[_0x48e7c9][_0x9adae1]['queuecallerleaveAt'])[_0x598a('0x57')](moment(_0x3de017[_0x48e7c9][_0x9adae1]['queuecallerjoinAt']),'seconds')||0x0;if(_0x9adae1===_0x3de017[_0x48e7c9][_0x598a('0x45')]-0x1){_0xd0b5d8[_0x598a('0x16')][_0x1b77d8][_0x598a('0x2f')]+=moment(_0x3de017[_0x48e7c9][_0x9adae1][_0x598a('0x58')]||_0x3de017[_0x48e7c9][_0x9adae1][_0x598a('0x59')]||_0x3de017[_0x48e7c9][_0x9adae1][_0x598a('0x5a')])[_0x598a('0x57')](moment(_0x3de017[_0x48e7c9][_0x9adae1]['queuecallerjoinAt']),_0x598a('0x5b'))||0x0;_0xd0b5d8[_0x598a('0x16')][_0x1b77d8]['total']+=0x1;if(_0x3de017[_0x48e7c9][_0x9adae1]['queuecallercomplete']){_0xd0b5d8[_0x598a('0x16')][_0x1b77d8][_0x598a('0x31')]+=0x1;_0xd0b5d8['voiceQueues'][_0x1b77d8][_0x598a('0x35')]+=moment(_0x3de017[_0x48e7c9][_0x9adae1][_0x598a('0x58')])[_0x598a('0x57')](moment(_0x3de017[_0x48e7c9][_0x9adae1][_0x598a('0x5c')]),_0x598a('0x5b'))||0x0;}}else{_0xd0b5d8[_0x598a('0x16')][_0x1b77d8][_0x598a('0x2f')]+=_0xd0b5d8[_0x598a('0x16')][_0x1b77d8]['sumHoldTime']||0x0;}}}}}}return _0xd0b5d8[_0x598a('0x16')];};};Realtime[_0x598a('0x43')][_0x598a('0x5d')]=function(){var _0xe7e76f=this;return function(_0x710c30){clearVoiceCallReports(_0xe7e76f['outbound']);if(_0x710c30){for(var _0x43cd5b=0x0;_0x43cd5b<_0x710c30[_0x598a('0x45')];_0x43cd5b+=0x1){_0xe7e76f[_0x598a('0x5e')][_0x598a('0x2e')]+=0x1;_0xe7e76f[_0x598a('0x5e')][_0x598a('0x2f')]+=_0x710c30[_0x43cd5b][_0x598a('0x5f')];if(_0x710c30[_0x43cd5b][_0x598a('0x60')]===_0x598a('0x61')){_0xe7e76f[_0x598a('0x5e')]['answered']+=0x1;_0xe7e76f[_0x598a('0x5e')][_0x598a('0x34')]+=_0x710c30[_0x43cd5b][_0x598a('0x5f')]-_0x710c30[_0x43cd5b][_0x598a('0x62')]||0x0;_0xe7e76f[_0x598a('0x5e')][_0x598a('0x35')]+=_0x710c30[_0x43cd5b][_0x598a('0x62')];}}}return _0xe7e76f[_0x598a('0x5e')];};};Realtime[_0x598a('0x43')][_0x598a('0x63')]=function(){var _0xe9e98=this;return function(_0x3289af){if(_0x3289af){freeIsNotKey(_0x3289af,_0xe9e98['campaigns'],_0x598a('0x29'));for(var _0x5ccb3a=0x0,_0x29974b={};_0x5ccb3a<_0x3289af[_0x598a('0x45')];_0x5ccb3a+=0x1){_0x29974b=_0x3289af[_0x5ccb3a];if(_[_0x598a('0x46')](_0xe9e98[_0x598a('0x18')][_0x29974b[_0x598a('0x29')]])){_0xe9e98[_0x598a('0x18')][_0x29974b[_0x598a('0x29')]]=new Campaign(_0x29974b);}else{_0xe9e98['mergeFromDatabase'](_0xe9e98['campaigns'][_0x29974b[_0x598a('0x29')]],_0x29974b);_0xe9e98[_0x598a('0x18')][_0x29974b[_0x598a('0x29')]][_0x598a('0x64')]=_0x29974b['SquareProject']?_0x29974b['SquareProject'][_0x598a('0x29')]:undefined;}}}return _0xe9e98['campaigns'];};};Realtime[_0x598a('0x43')]['initVoiceExtensions']=function(){var _0x5cf6f1=this;return function(_0x1131e1){if(_0x1131e1){freeIsNotKey(_0x1131e1,_0x5cf6f1[_0x598a('0x1a')],'id');for(var _0x9c4ba=0x0,_0x1b76dd={};_0x9c4ba<_0x1131e1[_0x598a('0x45')];_0x9c4ba+=0x1){_0x1b76dd=_0x1131e1[_0x9c4ba];if(_[_0x598a('0x46')](_0x5cf6f1[_0x598a('0x1a')][_0x1b76dd['id']])){_0x5cf6f1[_0x598a('0x1a')][_0x1b76dd['id']]=new VoiceExtension(_0x1b76dd);}else{_0x5cf6f1[_0x598a('0x42')](_0x5cf6f1[_0x598a('0x1a')][_0x1b76dd['id']],_0x1b76dd);}}}return _0x5cf6f1[_0x598a('0x1a')];};};Realtime[_0x598a('0x43')][_0x598a('0x65')]=function(){var _0x15f545=this;return function(_0x335c7c){clearCampaigns(_0x15f545[_0x598a('0x18')]);for(var _0x234c08=0x0;_0x234c08<_0x335c7c[_0x598a('0x45')];_0x234c08+=0x1){_['merge'](_0x15f545[_0x598a('0x18')][_0x335c7c[_0x234c08][_0x598a('0x29')]],_0x335c7c[_0x234c08]);}return _0x15f545[_0x598a('0x18')];};};Realtime['prototype'][_0x598a('0x66')]=function(){var _0x377a94=this;return function(_0x4ffd23){if(_0x4ffd23){freeIsNotKey(_0x4ffd23,_0x377a94['faxAccounts'],'id');for(var _0x3c0d6e=0x0,_0x17677f={},_0x37591f={};_0x3c0d6e<_0x4ffd23[_0x598a('0x45')];_0x3c0d6e+=0x1){_0x17677f=_0x4ffd23[_0x3c0d6e];if(_['isUndefined'](_0x377a94[_0x598a('0x26')][_0x17677f['id']])){_0x377a94['faxAccounts'][_0x17677f['id']]=new FaxAccount(_0x17677f);}else{_0x377a94['mergeFromDatabase'](_0x377a94[_0x598a('0x26')][_0x17677f['id']],_0x17677f);}}}return _0x377a94[_0x598a('0x26')];};};module[_0x598a('0x67')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 04996cb..2acb994 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 _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 +var _0xb12b=['accountcode','name','isNil','interface','SIP/%s','length','assigned','lastAssignedTo','format','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','voiceCallReport','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','xcally-motion-preview','calleridpreview','calleridnum','destinationchannel','channel','originatecalleridnum','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','monitors','monitorFilename','filename','createdAt','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','Local','indexOf','mobile','phone','lastIndexOf','exports','bluebird','moment','util','../../../config/environment','../../../config/logger','ami','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find'];(function(_0x3d5351,_0x27bc80){var _0x1db4db=function(_0x3f572b){while(--_0x3f572b){_0x3d5351['push'](_0x3d5351['shift']());}};_0x1db4db(++_0x27bc80);}(_0xb12b,0x135));var _0xbb12=function(_0x3ccfe2,_0x5b30e5){_0x3ccfe2=_0x3ccfe2-0x0;var _0x3811f8=_0xb12b[_0x3ccfe2];return _0x3811f8;};'use strict';var BPromise=require(_0xbb12('0x0'));var _=require('lodash');var moment=require(_0xbb12('0x1'));var util=require(_0xbb12('0x2'));var config=require(_0xbb12('0x3'));var logger=require(_0xbb12('0x4'))(_0xbb12('0x5'));var ami=require(_0xbb12('0x6'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0xbb12('0x7'));var RpcVoiceDialReport=require(_0xbb12('0x8'));var RpcMemberReport=require(_0xbb12('0x9'));var RpcVoiceQueueReport=require(_0xbb12('0xa'));var RpcVoiceRecording=require(_0xbb12('0xb'));var RpcVoiceTransferReport=require(_0xbb12('0xc'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xbb12('0xd'));var VoiceAgentReport=require(_0xbb12('0xe'));var VoiceDialReport=require(_0xbb12('0xf'));var UserReport=require(_0xbb12('0x10'));function Report(_0x2ec9cb){this[_0xbb12('0x11')]=_0x2ec9cb;this[_0xbb12('0x12')]=_0x2ec9cb[_0xbb12('0x12')];this[_0xbb12('0x13')]=_0x2ec9cb['telephones'];}Report[_0xbb12('0x14')]['sync']=function(_0x4769bf){var _0x1f38bf=new VoiceQueueReport(this[_0xbb12('0x11')]);var _0x5ca66a=new VoiceAgentReport(this['realtime']);var _0x1113f3=new VoiceDialReport(this[_0xbb12('0x11')]);var _0x2fc1a1=new VoiceCallReport(this[_0xbb12('0x11')]);var _0x4989e7=new UserReport(this['realtime']);if(config[_0xbb12('0x15')]&&config[_0xbb12('0x15')][_0xbb12('0x16')]){ami['on']('custom:voiceQueueReport',this[_0xbb12('0x17')][_0xbb12('0x18')](this));ami['on'](_0xbb12('0x19'),this['voiceCallReport'][_0xbb12('0x18')](this));ami['on']('custom:voiceAgentReport',this[_0xbb12('0x1a')][_0xbb12('0x18')](this));ami['on'](_0xbb12('0x1b'),this[_0xbb12('0x1c')][_0xbb12('0x18')](this));ami['on'](_0xbb12('0x1d'),this[_0xbb12('0x1e')][_0xbb12('0x18')](this));ami['on'](_0xbb12('0x1f'),this[_0xbb12('0x20')][_0xbb12('0x18')](this));}};Report[_0xbb12('0x14')][_0xbb12('0x21')]=function(_0x5ce871){var _0x5107c3=undefined;_0x5107c3=_[_0xbb12('0x22')](this[_0xbb12('0x12')],function(_0x3f3619){return _0x3f3619[_0xbb12('0x23')]==_0x5ce871||_0x3f3619[_0xbb12('0x24')]==_0x5ce871;});if(_[_0xbb12('0x25')](_0x5107c3)){var _0x37eda2=_[_0xbb12('0x22')](this[_0xbb12('0x13')],function(_0x29783b){return _0x29783b['accountcode']==_0x5ce871||_0x29783b['name']==_0x5ce871;});if(_0x37eda2){_0x5107c3=_['find'](this[_0xbb12('0x12')],function(_0x12ad69){return _0x12ad69[_0xbb12('0x26')]==util['format'](_0xbb12('0x27'),_0x37eda2[_0xbb12('0x24')]);});}}return _0x5107c3;};Report[_0xbb12('0x14')]['voiceQueueReport']=function(_0x1fda16){for(var _0x4b04d9=0x0;_0x4b04d9<_0x1fda16[_0xbb12('0x28')];_0x4b04d9+=0x1){var _0x1a1c0d=this[_0xbb12('0x21')](_0x1fda16[_0x4b04d9]['connectedlinenum']);if(_0x1a1c0d){_0x1fda16[_0x4b04d9][_0xbb12('0x23')]=_0x1a1c0d[_0xbb12('0x23')];_0x1fda16[_0x4b04d9][_0xbb12('0x29')]=!![];_0x1fda16[_0x4b04d9][_0xbb12('0x2a')]=_0x1a1c0d[_0xbb12('0x24')];_0x1fda16[_0x4b04d9][_0xbb12('0x26')]=_[_0xbb12('0x25')](_0x1a1c0d[_0xbb12('0x26')])?util[_0xbb12('0x2b')](_0xbb12('0x27'),_0x1a1c0d[_0xbb12('0x24')]):_0x1a1c0d[_0xbb12('0x26')];if(_0x1fda16[_0x4b04d9]['queuecallercomplete']){_0x1fda16[_0x4b04d9][_0xbb12('0x2c')]=moment()[_0xbb12('0x2b')](_0xbb12('0x2d'));}if(_0x1fda16[_0x4b04d9][_0xbb12('0x2e')]){_0x1fda16[_0x4b04d9][_0xbb12('0x2f')]=moment()['format'](_0xbb12('0x2d'));}RpcMemberReport[_0xbb12('0x17')](_0x1fda16[_0x4b04d9]);}RpcVoiceQueueReport[_0xbb12('0x30')](_0x1fda16[_0x4b04d9]);}};function extractCalleridNumber(_0x56bf8d){var _0x4177b7=_0x56bf8d[_0xbb12('0x31')](/<(.*?)>/);return _0x4177b7?_0x4177b7[0x1]:_0x56bf8d;}Report[_0xbb12('0x14')][_0xbb12('0x32')]=function(_0x4e9bd4){_0x4e9bd4[_0xbb12('0x33')]=_0x4e9bd4[_0xbb12('0x33')]||_0x4e9bd4[_0xbb12('0x34')];if(_0x4e9bd4[_0xbb12('0x35')]==_0xbb12('0x36')){_0x4e9bd4[_0xbb12('0x37')]=_0xbb12('0x38');_0x4e9bd4[_0xbb12('0x39')]=_0x4e9bd4['queue'];if(_0x4e9bd4[_0xbb12('0x3a')]==_0xbb12('0x3b')){_0x4e9bd4['accountcode']='';_0x4e9bd4['destination']=extractCalleridNumber(_0x4e9bd4[_0xbb12('0x3c')]);}else if(_0x4e9bd4[_0xbb12('0x3a')]=='from-sip'){if(_0x4e9bd4[_0xbb12('0x33')]==_0xbb12('0x3d')){_0x4e9bd4['destination']=extractCalleridNumber(_0x4e9bd4[_0xbb12('0x3e')]);_0x4e9bd4[_0xbb12('0x3f')]=_0x4e9bd4['originatecalleridnum'];_0x4e9bd4[_0xbb12('0x40')]=[_0x4e9bd4[_0xbb12('0x41')],_0x4e9bd4[_0xbb12('0x41')]=_0x4e9bd4['destinationchannel']][0x0];_0x4e9bd4[_0xbb12('0x3c')]=_0x4e9bd4['calleridpreview'];}else{_0x4e9bd4['destination']=_0x4e9bd4[_0xbb12('0x3f')];_0x4e9bd4[_0xbb12('0x3f')]=_0x4e9bd4[_0xbb12('0x42')];if(_0x4e9bd4['disposition']==_0xbb12('0x43')){_0x4e9bd4[_0xbb12('0x23')]=_0x4e9bd4[_0xbb12('0x44')];}else{_0x4e9bd4[_0xbb12('0x23')]='';}}}}else{_0x4e9bd4[_0xbb12('0x3c')]=util[_0xbb12('0x2b')](_0xbb12('0x45'),_0x4e9bd4[_0xbb12('0x46')],_0x4e9bd4[_0xbb12('0x3f')]);}RpcVoiceCallReport[_0xbb12('0x30')](_0x4e9bd4);if(_0x4e9bd4['monitor']){for(var _0x89bd82=0x0;_0x89bd82<_0x4e9bd4[_0xbb12('0x47')]['length'];_0x89bd82+=0x1){_0x4e9bd4[_0xbb12('0x48')]=_0x4e9bd4[_0xbb12('0x47')][_0x89bd82][_0xbb12('0x49')];_0x4e9bd4[_0xbb12('0x4a')]=_0x4e9bd4['monitors'][_0x89bd82][_0xbb12('0x4a')];if(_0x4e9bd4['exten']=='xcally-motion-preview'){_0x4e9bd4['calleridnum']=_0x4e9bd4[_0xbb12('0x44')];_0x4e9bd4['calleridname']=_0x4e9bd4[_0xbb12('0x4b')];_0x4e9bd4['connectedlinenum']=_0x4e9bd4[_0xbb12('0x23')];_0x4e9bd4[_0xbb12('0x4b')]=_0x4e9bd4[_0xbb12('0x4c')];_0x4e9bd4['exten']=_0x4e9bd4['originatecalleridnum'];}else if(_0x4e9bd4['exten']==_0xbb12('0x4d')){_0x4e9bd4['calleridnum']=_0x4e9bd4[_0xbb12('0x33')];_0x4e9bd4[_0xbb12('0x34')]=_0x4e9bd4['originatecalleridnum'];}RpcVoiceRecording[_0xbb12('0x30')](_0x4e9bd4);}}};Report[_0xbb12('0x14')][_0xbb12('0x1a')]=function(_0x7812d8){if(_[_0xbb12('0x4e')](_0x7812d8)){_0x7812d8[_0xbb12('0x4f')](function(_0x40999f){RpcVoiceAgentReport[_0xbb12('0x30')](_0x40999f);});}else{RpcVoiceAgentReport[_0xbb12('0x30')](_0x7812d8);}};Report[_0xbb12('0x14')][_0xbb12('0x1c')]=function(_0x325857){RpcVoiceDialReport['create'](_0x325857);var _0x2cd40b=undefined;var _0x1c7ad1=_0x325857[_0xbb12('0x41')];if(_['startsWith'](_0x1c7ad1,_0xbb12('0x50'))){var _0x22ea7c=_0x1c7ad1['substring'](_0x1c7ad1['indexOf']('/')+0x1,_0x1c7ad1[_0xbb12('0x51')]('@'));_0x2cd40b=_[_0xbb12('0x22')](this[_0xbb12('0x12')],function(_0x87c9fa){return _0x87c9fa[_0xbb12('0x52')]==_0x22ea7c||_0x87c9fa[_0xbb12('0x53')]==_0x22ea7c||_0x87c9fa[_0xbb12('0x23')]==_0x22ea7c;});}else{var _0x22ea7c=_0x1c7ad1['substring'](_0x1c7ad1[_0xbb12('0x51')]('/')+0x1,_0x1c7ad1[_0xbb12('0x54')]('-'));_0x2cd40b=this[_0xbb12('0x21')](_0x22ea7c);}if(_0x2cd40b){_0x325857[_0xbb12('0x26')]=_[_0xbb12('0x25')](_0x2cd40b[_0xbb12('0x26')])?util[_0xbb12('0x2b')](_0xbb12('0x27'),_0x2cd40b[_0xbb12('0x24')]):_0x2cd40b['interface'];_0x325857[_0xbb12('0x4c')]=_0x2cd40b[_0xbb12('0x24')];_0x325857[_0xbb12('0x23')]=_0x2cd40b['accountcode'];RpcMemberReport[_0xbb12('0x1c')](_0x325857);}};Report[_0xbb12('0x14')][_0xbb12('0x1e')]=function(_0x233f43){RpcVoiceTransferReport[_0xbb12('0x1e')](_0x233f43);};Report[_0xbb12('0x14')][_0xbb12('0x20')]=function(_0x1b526d){RpcVoiceTransferReport[_0xbb12('0x20')](_0x1b526d);};module[_0xbb12('0x55')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index ebdd3a0..7d8ed31 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 _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 +var _0x5716=['toNumber','updateStatusRealtime','telephones','format','telephone:%s','telephone:save','startsWith','Local','substring','indexOf','mobile','phone','accountcode','peer','registered','address','status','[syncPeerStatus][UserReport]','exports','lodash','moment','bluebird','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','trunks','registryentry','syncRegistry','bind','registry','devicestatechange','peerstatus','syncPeerStatus','loopSyncRealTimeShow','resolve','then','actionDeviceStateList','actionSipPeerStatus','catch','[loopSyncRealTimeShow]','inspect','prototype','isNotNull','emit','find','stateRegistry','state','event','actionid','username','trunk:%s','name','trunk:save','error','[syncRegistry][UserReport]','syncDeviceState','agents','device','local','toLowerCase','stateTime'];(function(_0x296897,_0x4d23ea){var _0x2b44ab=function(_0xdf90d8){while(--_0xdf90d8){_0x296897['push'](_0x296897['shift']());}};_0x2b44ab(++_0x4d23ea);}(_0x5716,0x11b));var _0x6571=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0x5716[_0x15ea09];return _0x3e9c78;};'use strict';var _=require(_0x6571('0x0'));var moment=require(_0x6571('0x1'));var BPromise=require(_0x6571('0x2'));var util=require(_0x6571('0x3'));var Redis=require(_0x6571('0x4'));var config=require(_0x6571('0x5'));var logger=require(_0x6571('0x6'))(_0x6571('0x7'));var ami=require(_0x6571('0x8'));config[_0x6571('0x9')]=_[_0x6571('0xa')](config[_0x6571('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6571('0x9')]));function UserReport(_0x1e4568){this[_0x6571('0xb')]=_0x1e4568['trunks'];this['agents']=_0x1e4568['agents'];this['telephones']=_0x1e4568['telephones'];ami['on'](_0x6571('0xc'),this[_0x6571('0xd')][_0x6571('0xe')](this));ami['on'](_0x6571('0xf'),this['syncRegistry']['bind'](this));ami['on'](_0x6571('0x10'),this['syncDeviceState'][_0x6571('0xe')](this));ami['on'](_0x6571('0x11'),this[_0x6571('0x12')][_0x6571('0xe')](this));this[_0x6571('0x13')]();return BPromise[_0x6571('0x14')]()[_0x6571('0x15')](ami['actionSipShowRegistry']())['then'](ami[_0x6571('0x16')]())['then'](ami[_0x6571('0x17')]())[_0x6571('0x18')](loggerCatch(_0x6571('0x19')));}function loggerCatch(_0x4b8f3f){return function(_0x158a1a){logger['error'](_0x4b8f3f,util[_0x6571('0x1a')](_0x158a1a,{'showHidden':![],'depth':null}));};}UserReport['prototype'][_0x6571('0x13')]=function(){setInterval(function(){BPromise[_0x6571('0x14')]()[_0x6571('0x15')](ami['actionSipShowRegistry']())[_0x6571('0x15')](ami[_0x6571('0x16')]())[_0x6571('0x15')](ami[_0x6571('0x17')]())['catch'](loggerCatch(_0x6571('0x19')));},0x32c8);};UserReport[_0x6571('0x1b')][_0x6571('0x1c')]=function(_0x27d195){return _0x27d195!==null&&!_['isUndefined'](_0x27d195);};UserReport['prototype'][_0x6571('0x1d')]=function(_0x3fc7e6,_0x418da0,_0x526347){io['to'](_0x3fc7e6)['emit'](_0x418da0,_0x526347);};UserReport[_0x6571('0x1b')]['syncRegistry']=function(_0xe0b974){try{if(this[_0x6571('0x1c')](_0xe0b974)){var _0xe0abde=_[_0x6571('0x1e')](this[_0x6571('0xb')],{'registry':_0xe0b974['username']});if(_0xe0abde){_0xe0b974[_0x6571('0x1f')]=_0xe0b974[_0x6571('0x20')];_['merge'](_0xe0abde,_['omit'](_0xe0b974,[_0x6571('0x21'),_0x6571('0x22'),_0x6571('0x23'),_0x6571('0x20')]));this[_0x6571('0x1d')](util['format'](_0x6571('0x24'),_0xe0abde[_0x6571('0x25')]),_0x6571('0x26'),_0xe0abde);}}}catch(_0x2ac96f){logger[_0x6571('0x27')](_0x6571('0x28'),util[_0x6571('0x1a')](_0x2ac96f,{'showHidden':![],'depth':null}));}};UserReport[_0x6571('0x1b')][_0x6571('0x29')]=function(_0x49aa1d){try{if(this[_0x6571('0x1c')](_0x49aa1d)){if(this[_0x6571('0x2a')][_0x49aa1d['device']]){if(!this['agents'][_0x49aa1d[_0x6571('0x2b')]][_0x6571('0x2c')]||_0x49aa1d[_0x6571('0x20')]['toLowerCase']()=='inuse'){this[_0x6571('0x2a')][_0x49aa1d[_0x6571('0x2b')]]['local']=![];if(this[_0x6571('0x2a')][_0x49aa1d[_0x6571('0x2b')]][_0x6571('0x20')]!==_0x49aa1d[_0x6571('0x20')][_0x6571('0x2d')]()){this[_0x6571('0x2a')][_0x49aa1d[_0x6571('0x2b')]][_0x6571('0x2e')]=_[_0x6571('0x2f')](moment()['format']('x'));}this[_0x6571('0x2a')][_0x49aa1d[_0x6571('0x2b')]][_0x6571('0x20')]=_0x49aa1d[_0x6571('0x20')]['toLowerCase']();this[_0x6571('0x2a')][_0x49aa1d['device']][_0x6571('0x30')](_0x49aa1d);}}else if(this[_0x6571('0x31')][_0x49aa1d[_0x6571('0x2b')]]){if(this[_0x6571('0x31')][_0x49aa1d[_0x6571('0x2b')]][_0x6571('0x20')]!==_0x49aa1d['state'][_0x6571('0x2d')]()){this[_0x6571('0x31')][_0x49aa1d[_0x6571('0x2b')]]['stateTime']=_[_0x6571('0x2f')](moment()['format']('x'));}this[_0x6571('0x31')][_0x49aa1d[_0x6571('0x2b')]][_0x6571('0x20')]=_0x49aa1d[_0x6571('0x20')]['toLowerCase']();this[_0x6571('0x1d')](util[_0x6571('0x32')](_0x6571('0x33'),this['telephones'][_0x49aa1d[_0x6571('0x2b')]][_0x6571('0x25')]),_0x6571('0x34'),this[_0x6571('0x31')][_0x49aa1d[_0x6571('0x2b')]]);}else if(this['trunks'][_0x49aa1d['device']]){if(this[_0x6571('0xb')][_0x49aa1d[_0x6571('0x2b')]][_0x6571('0x20')]!==_0x49aa1d[_0x6571('0x20')][_0x6571('0x2d')]()){this[_0x6571('0xb')][_0x49aa1d[_0x6571('0x2b')]][_0x6571('0x2e')]=_[_0x6571('0x2f')](moment()[_0x6571('0x32')]('x'));}this['trunks'][_0x49aa1d[_0x6571('0x2b')]][_0x6571('0x20')]=_0x49aa1d[_0x6571('0x20')]['toLowerCase']();this['emit'](util[_0x6571('0x32')](_0x6571('0x24'),this[_0x6571('0xb')][_0x49aa1d[_0x6571('0x2b')]][_0x6571('0x25')]),_0x6571('0x26'),this[_0x6571('0xb')][_0x49aa1d[_0x6571('0x2b')]]);}else if(_[_0x6571('0x35')](_0x49aa1d['device'],'Queue')){}else if(_[_0x6571('0x35')](_0x49aa1d[_0x6571('0x2b')],_0x6571('0x36'))){var _0x3b3d45=_0x49aa1d['device'];var _0x125311=_0x3b3d45[_0x6571('0x37')](_0x3b3d45[_0x6571('0x38')]('/')+0x1,_0x3b3d45[_0x6571('0x38')]('@'));var _0x1e57ad=_[_0x6571('0x1e')](this[_0x6571('0x2a')],function(_0x36a19e){return _0x36a19e[_0x6571('0x39')]==_0x125311||_0x36a19e[_0x6571('0x3a')]==_0x125311||_0x36a19e[_0x6571('0x3b')]==_0x125311;});if(_0x1e57ad){if(_0x1e57ad['state']!==_0x49aa1d[_0x6571('0x20')]['toLowerCase']()){_0x1e57ad[_0x6571('0x2e')]=_['toNumber'](moment()[_0x6571('0x32')]('x'));}_0x1e57ad[_0x6571('0x20')]=_0x49aa1d[_0x6571('0x20')][_0x6571('0x2d')]();_0x1e57ad[_0x6571('0x2c')]=!![];_0x1e57ad[_0x6571('0x30')](_0x49aa1d);}}else{}}}catch(_0x4e1048){logger[_0x6571('0x27')]('[syncDeviceState][UserReport]',util[_0x6571('0x1a')](_0x4e1048,{'showHidden':![],'depth':null}));}};UserReport[_0x6571('0x1b')][_0x6571('0x12')]=function(_0x3b6036){try{if(this[_0x6571('0x1c')](_0x3b6036)&&this[_0x6571('0x1c')](_0x3b6036[_0x6571('0x11')])){if(this['agents'][_0x3b6036[_0x6571('0x3c')]]){if(!this['agents'][_0x3b6036[_0x6571('0x3c')]][_0x6571('0x2c')]||_0x3b6036[_0x6571('0x11')][_0x6571('0x2d')]()==_0x6571('0x3d')){this[_0x6571('0x2a')][_0x3b6036['peer']][_0x6571('0x2c')]=![];this['agents'][_0x3b6036[_0x6571('0x3c')]]['status']=_0x3b6036[_0x6571('0x11')][_0x6571('0x2d')]();this['agents'][_0x3b6036['peer']][_0x6571('0x3e')]=_0x3b6036[_0x6571('0x3e')];this[_0x6571('0x2a')][_0x3b6036[_0x6571('0x3c')]][_0x6571('0x30')](_0x3b6036);}}else if(this[_0x6571('0x31')][_0x3b6036[_0x6571('0x3c')]]){this[_0x6571('0x31')][_0x3b6036['peer']][_0x6571('0x3f')]=_0x3b6036[_0x6571('0x11')][_0x6571('0x2d')]();this['telephones'][_0x3b6036['peer']][_0x6571('0x3e')]=_0x3b6036[_0x6571('0x3e')];this[_0x6571('0x1d')](util[_0x6571('0x32')]('telephone:%s',this[_0x6571('0x31')][_0x3b6036['peer']][_0x6571('0x25')]),'telephone:save',this[_0x6571('0x31')][_0x3b6036[_0x6571('0x3c')]]);}else if(this[_0x6571('0xb')][_0x3b6036[_0x6571('0x3c')]]){this[_0x6571('0xb')][_0x3b6036['peer']][_0x6571('0x3f')]=_0x3b6036[_0x6571('0x11')][_0x6571('0x2d')]();this[_0x6571('0xb')][_0x3b6036[_0x6571('0x3c')]][_0x6571('0x3e')]=_0x3b6036['address'];this['emit'](util[_0x6571('0x32')](_0x6571('0x24'),this[_0x6571('0xb')][_0x3b6036[_0x6571('0x3c')]][_0x6571('0x25')]),_0x6571('0x26'),this['trunks'][_0x3b6036[_0x6571('0x3c')]]);}else{}}}catch(_0x10dc46){logger[_0x6571('0x27')](_0x6571('0x40'),util[_0x6571('0x1a')](_0x10dc46,{'showHidden':![],'depth':null}));}};module[_0x6571('0x41')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 7a1cb38..5839aa0 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 _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 +var _0xaefc=['keys','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','custom:voiceAgentReport','[syncHangup][VoiceAgentReport]','transfereeuniqueid','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','transfereruniqueid','diff','[syncBlindTransfer][VoiceAgentReport]','channel','substring','lastIndexOf','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','defaults','redis','localhost','channels','voiceQueues','agents','variables','syncAgentCalled','bind','agentconnect','syncAgentConnect','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','syncBlindTransfer','emit','isNotNull','isUndefined','prototype','uniqueid','destuniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','type','inbound','omit','event','privilege','custom:agentcalled','format','user:%s','membername','user:called','[syncAgentCalled][VoiceAgentReport]','hasOwnProperty','agentconnectAt','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','pick','destconnectedlinenum','user:agentconnect','custom:agentconnect','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','inspect','agentringnoanswer','agentringnoanswerAt','rejected','custom:agentringnoanswer','error','[syncAgentRingNoAnswer][VoiceAgentReport]','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','agentcompleteAt','complete','talktime','transfer','agent','agentacw','acwTimeout','interface','user:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable'];(function(_0x1b3d02,_0x2d32fe){var _0x34ed31=function(_0x60649f){while(--_0x60649f){_0x1b3d02['push'](_0x1b3d02['shift']());}};_0x34ed31(++_0x2d32fe);}(_0xaefc,0x199));var _0xcaef=function(_0x1d7377,_0x25a864){_0x1d7377=_0x1d7377-0x0;var _0x2d4c15=_0xaefc[_0x1d7377];return _0x2d4c15;};'use strict';var _=require(_0xcaef('0x0'));var moment=require(_0xcaef('0x1'));var util=require(_0xcaef('0x2'));var Redis=require(_0xcaef('0x3'));var config=require(_0xcaef('0x4'));var logger=require(_0xcaef('0x5'))(_0xcaef('0x6'));var ami=require('../ami');config['redis']=_[_0xcaef('0x7')](config[_0xcaef('0x8')],{'host':_0xcaef('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcaef('0x8')]));function VoiceAgentReport(_0x3c2199){this[_0xcaef('0xa')]={};this[_0xcaef('0xb')]=_0x3c2199[_0xcaef('0xb')];this[_0xcaef('0xc')]=_0x3c2199[_0xcaef('0xc')];this[_0xcaef('0xd')]={};ami['on']('agentcalled',this[_0xcaef('0xe')][_0xcaef('0xf')](this));ami['on'](_0xcaef('0x10'),this[_0xcaef('0x11')][_0xcaef('0xf')](this));ami['on']('agentringnoanswer',this[_0xcaef('0x12')]['bind'](this));ami['on'](_0xcaef('0x13'),this[_0xcaef('0x14')][_0xcaef('0xf')](this));ami['on'](_0xcaef('0x15'),this[_0xcaef('0x16')][_0xcaef('0xf')](this));ami['on'](_0xcaef('0x17'),this[_0xcaef('0x18')]['bind'](this));ami['on'](_0xcaef('0x19'),this[_0xcaef('0x1a')][_0xcaef('0xf')](this));ami['on']('musiconholdstart',this[_0xcaef('0x1b')][_0xcaef('0xf')](this));ami['on'](_0xcaef('0x1c'),this[_0xcaef('0x1d')]['bind'](this));ami['on']('attendedtransfer',this[_0xcaef('0x1e')][_0xcaef('0xf')](this));ami['on']('blindtransfer',this[_0xcaef('0x1f')][_0xcaef('0xf')](this));}VoiceAgentReport['prototype'][_0xcaef('0x20')]=function(_0x37d2e7,_0xc78c2c,_0x5a98c6){io['to'](_0x37d2e7)[_0xcaef('0x20')](_0xc78c2c,_0x5a98c6);};VoiceAgentReport['prototype'][_0xcaef('0x21')]=function(_0x151324){return _0x151324!==null&&!_[_0xcaef('0x22')](_0x151324);};VoiceAgentReport[_0xcaef('0x23')]['syncAgentCalled']=function(_0x433245){try{if(this['isNotNull'](_0x433245)){if(_[_0xcaef('0x22')](this['channels'][_0x433245[_0xcaef('0x24')]])){this[_0xcaef('0xa')][_0x433245[_0xcaef('0x24')]]={};}if(_['isUndefined'](this['channels'][_0x433245['uniqueid']][_0x433245[_0xcaef('0x25')]])){this[_0xcaef('0xa')][_0x433245['uniqueid']][_0x433245[_0xcaef('0x25')]]={'agentcalledAt':moment()['format'](_0xcaef('0x26')),'lastevent':'called','variables':this[_0xcaef('0xd')][_0x433245[_0xcaef('0x24')]],'type':this['voiceQueues'][_0x433245[_0xcaef('0x27')]]?this[_0xcaef('0xb')][_0x433245['queue']][_0xcaef('0x28')]||_0xcaef('0x29'):'inbound'};}_['merge'](this[_0xcaef('0xa')][_0x433245[_0xcaef('0x24')]][_0x433245[_0xcaef('0x25')]],_[_0xcaef('0x2a')](_0x433245,[_0xcaef('0x2b'),_0xcaef('0x2c')]));ami[_0xcaef('0x20')](_0xcaef('0x2d'),this[_0xcaef('0xa')][_0x433245[_0xcaef('0x24')]][_0x433245[_0xcaef('0x25')]]);this[_0xcaef('0x20')](util[_0xcaef('0x2e')](_0xcaef('0x2f'),_0x433245[_0xcaef('0x30')]),_0xcaef('0x31'),this[_0xcaef('0xa')][_0x433245[_0xcaef('0x24')]][_0x433245[_0xcaef('0x25')]]);}}catch(_0x143dba){logger['error'](_0xcaef('0x32'),util['inspect'](_0x143dba,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xcaef('0x11')]=function(_0x482931){try{if(this[_0xcaef('0x21')](_0x482931)){if(this['channels'][_0x482931[_0xcaef('0x24')]]){for(var _0x5d066f in this[_0xcaef('0xa')][_0x482931[_0xcaef('0x24')]]){if(this[_0xcaef('0xa')][_0x482931[_0xcaef('0x24')]][_0xcaef('0x33')](_0x5d066f)){if(_0x482931[_0xcaef('0x25')]===_0x5d066f){this[_0xcaef('0xa')][_0x482931['uniqueid']][_0x5d066f][_0xcaef('0x34')]=moment()['format'](_0xcaef('0x26'));this[_0xcaef('0xa')][_0x482931[_0xcaef('0x24')]][_0x5d066f][_0xcaef('0x35')]=_0xcaef('0x36');this['channels'][_0x482931[_0xcaef('0x24')]][_0x5d066f]['holdtime']=_0x482931[_0xcaef('0x37')];this[_0xcaef('0xa')][_0x482931[_0xcaef('0x24')]][_0x5d066f]['connectedlinenum']=_0x482931[_0xcaef('0x38')];this[_0xcaef('0xa')][_0x482931['uniqueid']][_0x5d066f]['connectedlinename']=_0x482931[_0xcaef('0x39')];this['channels'][_0x482931[_0xcaef('0x24')]][_0x5d066f]['destchannelstate']=_0x482931[_0xcaef('0x3a')];this[_0xcaef('0xa')][_0x482931[_0xcaef('0x24')]][_0x5d066f]['destchannelstatedesc']=_0x482931[_0xcaef('0x3b')];_['merge'](this[_0xcaef('0xc')][_0x482931['interface']],_[_0xcaef('0x3c')](_0x482931,['queue',_0xcaef('0x3d')]));this['emit'](util[_0xcaef('0x2e')](_0xcaef('0x2f'),_0x482931['membername']),_0xcaef('0x3e'),this['channels'][_0x482931[_0xcaef('0x24')]][_0x482931[_0xcaef('0x25')]]);ami[_0xcaef('0x20')](_0xcaef('0x3f'),this[_0xcaef('0xa')][_0x482931['uniqueid']][_0x5d066f]);}else if(!this[_0xcaef('0xa')][_0x482931[_0xcaef('0x24')]][_0x5d066f]['agentringnoanswer']&&!this[_0xcaef('0xa')][_0x482931['uniqueid']][_0x5d066f][_0xcaef('0x15')]){this[_0xcaef('0xa')][_0x482931[_0xcaef('0x24')]][_0x5d066f]['agentringnoanswer']=!![];this['channels'][_0x482931['uniqueid']][_0x5d066f]['agentringnoanswerAt']=moment()[_0xcaef('0x2e')](_0xcaef('0x26'));this[_0xcaef('0xa')][_0x482931['uniqueid']][_0x5d066f][_0xcaef('0x40')]='answered_elsewhere';this[_0xcaef('0xa')][_0x482931[_0xcaef('0x24')]][_0x5d066f][_0xcaef('0x35')]=_0xcaef('0x41');this[_0xcaef('0xa')][_0x482931['uniqueid']][_0x5d066f][_0xcaef('0x42')]=_0x482931[_0xcaef('0x25')];this[_0xcaef('0xa')][_0x482931[_0xcaef('0x24')]][_0x5d066f][_0xcaef('0x43')]=_0x482931[_0xcaef('0x30')];ami['emit'](_0xcaef('0x44'),this[_0xcaef('0xa')][_0x482931[_0xcaef('0x24')]][_0x5d066f]);}}}}}}catch(_0x216216){logger['error'](_0xcaef('0x45'),util[_0xcaef('0x46')](_0x216216,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcaef('0x23')][_0xcaef('0x12')]=function(_0x4bdf46){try{if(this[_0xcaef('0x21')](_0x4bdf46)){if(this[_0xcaef('0xa')][_0x4bdf46[_0xcaef('0x24')]]&&this['channels'][_0x4bdf46[_0xcaef('0x24')]][_0x4bdf46[_0xcaef('0x25')]]){this[_0xcaef('0xa')][_0x4bdf46[_0xcaef('0x24')]][_0x4bdf46[_0xcaef('0x25')]][_0xcaef('0x47')]=!![];this[_0xcaef('0xa')][_0x4bdf46[_0xcaef('0x24')]][_0x4bdf46[_0xcaef('0x25')]][_0xcaef('0x48')]=moment()['format'](_0xcaef('0x26'));this[_0xcaef('0xa')][_0x4bdf46['uniqueid']][_0x4bdf46[_0xcaef('0x25')]]['reason']=_0xcaef('0x49');this['channels'][_0x4bdf46[_0xcaef('0x24')]][_0x4bdf46['destuniqueid']][_0xcaef('0x35')]=_0xcaef('0x49');ami['emit'](_0xcaef('0x4a'),this['channels'][_0x4bdf46[_0xcaef('0x24')]][_0x4bdf46[_0xcaef('0x25')]]);}}}catch(_0x356af6){logger[_0xcaef('0x4b')](_0xcaef('0x4c'),util[_0xcaef('0x46')](_0x356af6,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xcaef('0x14')]=function(_0x534975){try{if(this[_0xcaef('0x21')](_0x534975)){if(this[_0xcaef('0xa')][_0x534975['uniqueid']]){for(var _0x1ca922 in this[_0xcaef('0xa')][_0x534975[_0xcaef('0x24')]]){if(this[_0xcaef('0xa')][_0x534975[_0xcaef('0x24')]][_0xcaef('0x33')](_0x1ca922)&&!this[_0xcaef('0xa')][_0x534975[_0xcaef('0x24')]][_0x1ca922][_0xcaef('0x47')]&&!this['channels'][_0x534975[_0xcaef('0x24')]][_0x1ca922][_0xcaef('0x15')]){this[_0xcaef('0xa')][_0x534975[_0xcaef('0x24')]][_0x1ca922][_0xcaef('0x47')]=!![];this[_0xcaef('0xa')][_0x534975[_0xcaef('0x24')]][_0x1ca922]['agentringnoanswerAt']=moment()[_0xcaef('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xcaef('0xa')][_0x534975['uniqueid']][_0x1ca922][_0xcaef('0x40')]='abandoned';this['channels'][_0x534975[_0xcaef('0x24')]][_0x1ca922][_0xcaef('0x35')]=_0xcaef('0x4d');ami[_0xcaef('0x20')](_0xcaef('0x4e'),this[_0xcaef('0xa')][_0x534975[_0xcaef('0x24')]][_0x1ca922]);}}}}}catch(_0x288ab3){logger[_0xcaef('0x4b')](_0xcaef('0x4f'),util[_0xcaef('0x46')](_0x288ab3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcaef('0x23')]['syncAgentComplete']=function(_0x37fd74){try{if(this[_0xcaef('0x21')](_0x37fd74)){if(this[_0xcaef('0xa')][_0x37fd74[_0xcaef('0x24')]]){for(var _0x9812dd in this[_0xcaef('0xa')][_0x37fd74['uniqueid']]){if(this[_0xcaef('0xa')][_0x37fd74[_0xcaef('0x24')]][_0xcaef('0x33')](_0x9812dd)){if(this['channels'][_0x37fd74[_0xcaef('0x24')]][_0x9812dd][_0xcaef('0x34')]&&!this[_0xcaef('0xa')][_0x37fd74[_0xcaef('0x24')]][_0x9812dd][_0xcaef('0x15')]){this[_0xcaef('0xa')][_0x37fd74['uniqueid']][_0x9812dd][_0xcaef('0x15')]=!![];this[_0xcaef('0xa')][_0x37fd74[_0xcaef('0x24')]][_0x9812dd][_0xcaef('0x50')]=moment()[_0xcaef('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xcaef('0xa')][_0x37fd74['uniqueid']][_0x9812dd]['lastevent']=_0xcaef('0x51');this[_0xcaef('0xa')][_0x37fd74[_0xcaef('0x24')]][_0x9812dd][_0xcaef('0x52')]=_0x37fd74[_0xcaef('0x52')];this['channels'][_0x37fd74['uniqueid']][_0x9812dd][_0xcaef('0x40')]=_0x37fd74[_0xcaef('0x40')]==_0xcaef('0x53')?_0xcaef('0x54'):_0x37fd74[_0xcaef('0x40')];if(this[_0xcaef('0xb')][_0x37fd74['queue']]&&this[_0xcaef('0xb')][_0x37fd74[_0xcaef('0x27')]]['acw']){this[_0xcaef('0xa')][_0x37fd74['uniqueid']][_0x9812dd][_0xcaef('0x55')]=!![];this[_0xcaef('0xa')][_0x37fd74[_0xcaef('0x24')]][_0x9812dd]['acwtime']=this['voiceQueues'][_0x37fd74['queue']][_0xcaef('0x56')];}this[_0xcaef('0xc')][_0x37fd74[_0xcaef('0x57')]]=_['omit'](this['agents'][_0x37fd74[_0xcaef('0x57')]],['queue','destconnectedlinenum']);this[_0xcaef('0x20')](util[_0xcaef('0x2e')](_0xcaef('0x2f'),_0x37fd74[_0xcaef('0x30')]),_0xcaef('0x58'),this['channels'][_0x37fd74['uniqueid']][_0x9812dd]);ami[_0xcaef('0x20')]('custom:agentcomplete',this[_0xcaef('0xa')][_0x37fd74['uniqueid']][_0x9812dd]);}}}}}}catch(_0x343594){logger['error'](_0xcaef('0x59'),util[_0xcaef('0x46')](_0x343594,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xcaef('0x18')]=function(_0x92c14){try{if(this[_0xcaef('0x21')](_0x92c14)){this[_0xcaef('0x5a')](_0x92c14[_0xcaef('0x24')],_[_0xcaef('0x5b')](_0x92c14[_0xcaef('0x5c')])[0x0],_0x92c14[_0xcaef('0x5d')]);if(this[_0xcaef('0xa')][_0x92c14[_0xcaef('0x24')]]){for(var _0x32fb6d in this['channels'][_0x92c14[_0xcaef('0x24')]]){if(this[_0xcaef('0xa')][_0x92c14[_0xcaef('0x24')]]['hasOwnProperty'](_0x32fb6d)){if(_['isUndefined'](this[_0xcaef('0xa')][_0x92c14[_0xcaef('0x24')]][_0x32fb6d][_0xcaef('0xd')])){this['channels'][_0x92c14[_0xcaef('0x24')]][_0x32fb6d]['variables']={};}this[_0xcaef('0xa')][_0x92c14['uniqueid']][_0x32fb6d][_0xcaef('0xd')]=this[_0xcaef('0xd')][_0x92c14[_0xcaef('0x24')]];}}}}}catch(_0x32cdf5){logger['error'](_0xcaef('0x5e'),util[_0xcaef('0x46')](_0x32cdf5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcaef('0x23')][_0xcaef('0x5a')]=function(_0x85b04d,_0x4725bc,_0x51eaac){var _0x53652c=['rtpaudioqos','rtpaudioqosbridged',_0xcaef('0x5f'),_0xcaef('0x60'),_0xcaef('0x61'),_0xcaef('0x62'),_0xcaef('0x63'),_0xcaef('0x64'),_0xcaef('0x65'),_0xcaef('0x66'),_0xcaef('0x67'),'bridgepvtcallid',_0xcaef('0x68'),_0xcaef('0x69'),_0xcaef('0x6a'),'memberlastcall',_0xcaef('0x30'),_0xcaef('0x6b'),_0xcaef('0x6c')];if(!_[_0xcaef('0x6d')](_0x4725bc)&&!_[_0xcaef('0x6e')](_0x53652c,_0x4725bc)){if(_[_0xcaef('0x22')](this[_0xcaef('0xd')][_0x85b04d])){this[_0xcaef('0xd')][_0x85b04d]={};}this[_0xcaef('0xd')][_0x85b04d][_0x4725bc]=_0x51eaac;}};VoiceAgentReport[_0xcaef('0x23')][_0xcaef('0x1a')]=function(_0x2cc25d){try{if(this[_0xcaef('0x21')](_0x2cc25d)){if(this['channels'][_0x2cc25d['uniqueid']]){for(var _0x17b66f in this[_0xcaef('0xa')][_0x2cc25d[_0xcaef('0x24')]]){if(this['channels'][_0x2cc25d[_0xcaef('0x24')]][_0xcaef('0x33')](_0x17b66f)){if(this[_0xcaef('0xa')][_0x2cc25d[_0xcaef('0x24')]][_0x17b66f]['reason']==_0xcaef('0x53')&&this[_0xcaef('0xa')][_0x2cc25d['uniqueid']][_0x17b66f][_0xcaef('0x15')]){this[_0xcaef('0xa')][_0x2cc25d[_0xcaef('0x24')]][_0x17b66f][_0xcaef('0x50')]=moment()[_0xcaef('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');}}}ami[_0xcaef('0x20')](_0xcaef('0x6f'),_['values'](this[_0xcaef('0xa')][_0x2cc25d['uniqueid']]));delete this['channels'][_0x2cc25d[_0xcaef('0x24')]];}if(this[_0xcaef('0xd')][_0x2cc25d[_0xcaef('0x24')]]){delete this[_0xcaef('0xd')][_0x2cc25d[_0xcaef('0x24')]];}}}catch(_0x1dccf1){logger[_0xcaef('0x4b')](_0xcaef('0x70'),util[_0xcaef('0x46')](_0x1dccf1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcaef('0x23')][_0xcaef('0x1e')]=function(_0x342f80){try{if(this[_0xcaef('0x21')](_0x342f80)){if(this[_0xcaef('0xa')][_0x342f80['transfereeuniqueid']]){for(var _0x34d511 in this[_0xcaef('0xa')][_0x342f80['transfereeuniqueid']]){if(this[_0xcaef('0xa')][_0x342f80[_0xcaef('0x71')]][_0xcaef('0x33')](_0x34d511)){if(_0x342f80['origtransfereruniqueid']===_0x34d511){var _0x52ccf9=moment();this[_0xcaef('0xa')][_0x342f80['transfereeuniqueid']][_0x34d511][_0xcaef('0x15')]=!![];this[_0xcaef('0xa')][_0x342f80[_0xcaef('0x71')]][_0x34d511][_0xcaef('0x50')]=moment()['format'](_0xcaef('0x26'));this[_0xcaef('0xa')][_0x342f80[_0xcaef('0x71')]][_0x34d511]['reason']=_0xcaef('0x53');this[_0xcaef('0xa')][_0x342f80[_0xcaef('0x71')]][_0x34d511][_0xcaef('0x35')]=_0xcaef('0x51');this[_0xcaef('0xa')][_0x342f80[_0xcaef('0x71')]][_0x34d511][_0xcaef('0x52')]=_0x52ccf9['diff'](this['channels'][_0x342f80['transfereeuniqueid']][_0x34d511][_0xcaef('0x34')],_0xcaef('0x72'));}}}}if(this[_0xcaef('0xa')][_0x342f80[_0xcaef('0x73')]]){var _0x38de9a=this[_0xcaef('0xa')][_0x342f80[_0xcaef('0x73')]];this[_0xcaef('0xa')][_0x342f80[_0xcaef('0x73')]]=this[_0xcaef('0xa')][_0x342f80[_0xcaef('0x71')]];this[_0xcaef('0xa')][_0x342f80[_0xcaef('0x71')]]=_0x38de9a;}}}catch(_0x379ea5){logger[_0xcaef('0x4b')](_0xcaef('0x74'),util['inspect'](_0x379ea5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcaef('0x23')]['syncBlindTransfer']=function(_0x47b192){try{if(this['isNotNull'](_0x47b192)){if(this[_0xcaef('0xa')][_0x47b192['transfereeuniqueid']]){for(var _0x22a1b4 in this[_0xcaef('0xa')][_0x47b192[_0xcaef('0x71')]]){if(this['channels'][_0x47b192[_0xcaef('0x71')]][_0xcaef('0x33')](_0x22a1b4)){if(_0x47b192[_0xcaef('0x75')]===_0x22a1b4){var _0x23f1eb=moment();this[_0xcaef('0xa')][_0x47b192[_0xcaef('0x71')]][_0x22a1b4][_0xcaef('0x15')]=!![];this['channels'][_0x47b192['transfereeuniqueid']][_0x22a1b4][_0xcaef('0x50')]=_0x23f1eb;this[_0xcaef('0xa')][_0x47b192[_0xcaef('0x71')]][_0x22a1b4][_0xcaef('0x40')]=_0xcaef('0x53');this[_0xcaef('0xa')][_0x47b192[_0xcaef('0x71')]][_0x22a1b4][_0xcaef('0x35')]='complete';this[_0xcaef('0xa')][_0x47b192['transfereeuniqueid']][_0x22a1b4][_0xcaef('0x52')]=_0x23f1eb[_0xcaef('0x76')](this[_0xcaef('0xa')][_0x47b192['transfereeuniqueid']][_0x22a1b4][_0xcaef('0x34')],_0xcaef('0x72'));}}}}}}catch(_0x8f5924){logger[_0xcaef('0x4b')](_0xcaef('0x77'),util['inspect'](_0x8f5924,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xcaef('0x1b')]=function(_0x5d9722){var _0x4351b7='';try{if(this[_0xcaef('0x21')](_0x5d9722)){if(_0x5d9722[_0xcaef('0x78')]){_0x4351b7=_0x5d9722['channel'][_0xcaef('0x79')](0x0,_0x5d9722[_0xcaef('0x78')][_0xcaef('0x7a')]('-'));if(this['agents'][_0x4351b7]){this[_0xcaef('0xc')][_0x4351b7][_0xcaef('0x7b')]=!![];}}}}catch(_0xfccb26){logger[_0xcaef('0x4b')](_0xcaef('0x7c'),util[_0xcaef('0x46')](_0xfccb26,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xcaef('0x1d')]=function(_0x2dce65){var _0x5e0a1f='';try{if(this[_0xcaef('0x21')](_0x2dce65)){if(_0x2dce65[_0xcaef('0x78')]){_0x5e0a1f=_0x2dce65[_0xcaef('0x78')][_0xcaef('0x79')](0x0,_0x2dce65['channel'][_0xcaef('0x7a')]('-'));if(this[_0xcaef('0xc')][_0x5e0a1f]){this[_0xcaef('0xc')][_0x5e0a1f][_0xcaef('0x7b')]=![];}}}}catch(_0x7220d4){logger['error']('[syncMusicOnHoldStop][VoiceAgentReport]',util[_0xcaef('0x46')](_0x7220d4,{'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 45dae1c..d2d7f50 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 _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 +var _0xf098=['syncMusicOnHoldStop','then','actionCoreShowChannels','catch','log','prototype','isNotNull','isUndefined','emit','syncNewCallerId','uniqueid','linkedid','pick','keys','error','[syncNewCallerId][VoiceCallReport]','inspect','channel','starttime','format','YYYY-MM-DD\x20HH:mm:ss','channelstate','merge','context','from-sip','split','destconnectedlinenum','exten','user:%s','accountcode','[syncNewChannel][VoiceCallReport]','OutgoingSpoolFailed','application','applicationdata','toLowerCase','duration','subtract','disposition','lastapplication','startsWith','cdr(','match','queue','answered','holdtime','diff','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','calleridname','destinationchannel','toNumber','UserId','membername','name','[syncNewState][VoiceCallReport]','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','monitors','isNil','push','rec','variable','mixmonitor_filename','syncMixMonitorFilename','xmd-phone','value','xmd-callerid','xmd-queue','xmd-originatecalleridnum','xmd-destination','xmd-callerid-preview','calleridpreview','sipcallid','parse','sipcalllinkedid','endtime','seconds','billableseconds','answertime','omit','user:agentcomplete','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','syncBlindTransfer','transfereecalleridnum','extension','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','mohstarttime','mohtime','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','set','agi','dial','NO\x20ANSWER','FAILED','redis','defaults','localhost','socket.io-emitter','channels','agents','syncNewExten','newexten','syncNewChannel','bind','newstate','syncNewState','syncVarSet','hangup','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart'];(function(_0x58719f,_0x42ed40){var _0x2d2b3c=function(_0xf4590d){while(--_0xf4590d){_0x58719f['push'](_0x58719f['shift']());}};_0x2d2b3c(++_0x42ed40);}(_0xf098,0x194));var _0x8f09=function(_0x5a674f,_0x14a558){_0x5a674f=_0x5a674f-0x0;var _0x2da376=_0xf098[_0x5a674f];return _0x2da376;};'use strict';var BPromise=require(_0x8f09('0x0'));var _=require(_0x8f09('0x1'));var moment=require(_0x8f09('0x2'));var util=require(_0x8f09('0x3'));var path=require('path');var Redis=require('ioredis');var config=require(_0x8f09('0x4'));var logger=require(_0x8f09('0x5'))(_0x8f09('0x6'));var ami=require('../ami');var Channel=require(_0x8f09('0x7'));var statusDesc=[_0x8f09('0x8'),_0x8f09('0x9'),_0x8f09('0xa'),_0x8f09('0xb'),_0x8f09('0xc'),_0x8f09('0xd'),_0x8f09('0xe'),_0x8f09('0xf'),_0x8f09('0x10')];var applications=[_0x8f09('0x11'),'queue',_0x8f09('0x12'),_0x8f09('0x13'),'playback','voicemail'];var dispositions=[_0x8f09('0x14'),'FAILED',_0x8f09('0x15'),_0x8f09('0x14'),_0x8f09('0x14'),_0x8f09('0x14'),'ANSWERED','BUSY',_0x8f09('0x15'),'FAILED',_0x8f09('0x15')];var actions={};config[_0x8f09('0x16')]=_[_0x8f09('0x17')](config[_0x8f09('0x16')],{'host':_0x8f09('0x18'),'port':0x18eb});var io=require(_0x8f09('0x19'))(new Redis(config[_0x8f09('0x16')]));function VoiceCallReport(_0x115643){this[_0x8f09('0x1a')]=_0x115643[_0x8f09('0x1a')];this[_0x8f09('0x1b')]=_0x115643[_0x8f09('0x1b')];ami['on']('coreshowchannel',this[_0x8f09('0x1c')]['bind'](this));ami['on'](_0x8f09('0x1d'),this[_0x8f09('0x1c')]['bind'](this));ami['on']('newchannel',this[_0x8f09('0x1e')][_0x8f09('0x1f')](this));ami['on'](_0x8f09('0x20'),this[_0x8f09('0x21')][_0x8f09('0x1f')](this));ami['on']('varset',this[_0x8f09('0x22')][_0x8f09('0x1f')](this));ami['on'](_0x8f09('0x23'),this[_0x8f09('0x24')][_0x8f09('0x1f')](this));ami['on'](_0x8f09('0x25'),this['syncNewCallerId'][_0x8f09('0x1f')](this));ami['on'](_0x8f09('0x26'),this[_0x8f09('0x27')][_0x8f09('0x1f')](this));ami['on'](_0x8f09('0x28'),this['syncBlindTransfer'][_0x8f09('0x1f')](this));ami['on'](_0x8f09('0x29'),this[_0x8f09('0x2a')][_0x8f09('0x1f')](this));ami['on']('musiconholdstop',this[_0x8f09('0x2b')][_0x8f09('0x1f')](this));return BPromise['resolve']()[_0x8f09('0x2c')](ami[_0x8f09('0x2d')]())[_0x8f09('0x2e')](function(_0x50d024){console[_0x8f09('0x2f')](_0x50d024);});}VoiceCallReport[_0x8f09('0x30')][_0x8f09('0x31')]=function(_0x23d47c){return _0x23d47c!==null&&!_[_0x8f09('0x32')](_0x23d47c);};VoiceCallReport[_0x8f09('0x30')][_0x8f09('0x33')]=function(_0x1104db,_0xf41fda,_0x5284b0){io['to'](_0x1104db)['emit'](_0xf41fda,_0x5284b0);};VoiceCallReport['prototype'][_0x8f09('0x34')]=function(_0x4289a5){try{if(this[_0x8f09('0x31')](_0x4289a5)){if(_0x4289a5[_0x8f09('0x35')]===_0x4289a5[_0x8f09('0x36')]){if(!_['isUndefined'](this['channels'][_0x4289a5[_0x8f09('0x35')]])){_['merge'](this[_0x8f09('0x1a')][_0x4289a5[_0x8f09('0x35')]],_[_0x8f09('0x37')](_0x4289a5,_[_0x8f09('0x38')](this[_0x8f09('0x1a')][_0x4289a5['uniqueid']])));}}}}catch(_0x4d0c3b){logger[_0x8f09('0x39')](_0x8f09('0x3a'),util[_0x8f09('0x3b')](_0x4d0c3b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8f09('0x30')]['syncNewChannel']=function(_0x1cc0b9){try{if(this['isNotNull'](_0x1cc0b9)){if(_0x1cc0b9['uniqueid']===_0x1cc0b9[_0x8f09('0x36')]&&_0x1cc0b9[_0x8f09('0x3c')]!='OutgoingSpoolFailed'){if(_[_0x8f09('0x32')](this['channels'][_0x1cc0b9[_0x8f09('0x35')]])){this[_0x8f09('0x1a')][_0x1cc0b9['uniqueid']]=new Channel();this[_0x8f09('0x1a')][_0x1cc0b9[_0x8f09('0x35')]][_0x8f09('0x3d')]=moment()[_0x8f09('0x3e')](_0x8f09('0x3f'));this[_0x8f09('0x1a')][_0x1cc0b9[_0x8f09('0x35')]]['disposition']=dispositions[_['toNumber'](_0x1cc0b9[_0x8f09('0x40')])];_[_0x8f09('0x41')](this[_0x8f09('0x1a')][_0x1cc0b9[_0x8f09('0x35')]],_[_0x8f09('0x37')](_0x1cc0b9,_[_0x8f09('0x38')](this[_0x8f09('0x1a')][_0x1cc0b9[_0x8f09('0x35')]])));if(_0x1cc0b9[_0x8f09('0x42')]===_0x8f09('0x43')){if(this[_0x8f09('0x1b')][_0x1cc0b9['channel'][_0x8f09('0x44')]('-')[0x0]]){this[_0x8f09('0x1b')][_0x1cc0b9[_0x8f09('0x3c')]['split']('-')[0x0]][_0x8f09('0x45')]=_0x1cc0b9[_0x8f09('0x46')];this[_0x8f09('0x33')](util['format'](_0x8f09('0x47'),this[_0x8f09('0x1b')][_0x1cc0b9[_0x8f09('0x3c')][_0x8f09('0x44')]('-')[0x0]]['name']),'user:agentconnect',{'destaccountcode':this['agents'][_0x1cc0b9[_0x8f09('0x3c')][_0x8f09('0x44')]('-')[0x0]][_0x8f09('0x48')],'destconnectedlinenum':_0x1cc0b9['exten']});}}}}}}catch(_0x388871){logger['error'](_0x8f09('0x49'),util[_0x8f09('0x3b')](_0x388871,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8f09('0x30')][_0x8f09('0x1c')]=function(_0x78fb10){try{if(this[_0x8f09('0x31')](_0x78fb10)){if(_0x78fb10[_0x8f09('0x35')]===_0x78fb10['linkedid']&&_0x78fb10[_0x8f09('0x46')]!='h'&&_0x78fb10[_0x8f09('0x3c')]!=_0x8f09('0x4a')){_0x78fb10[_0x8f09('0x4b')]=_0x78fb10[_0x8f09('0x4b')]['toLowerCase']();_0x78fb10['applicationdata']=(_0x78fb10['appdata']||_0x78fb10[_0x8f09('0x4c')])[_0x8f09('0x4d')]();if(_['isUndefined'](this[_0x8f09('0x1a')][_0x78fb10['uniqueid']])){this[_0x8f09('0x1a')][_0x78fb10['uniqueid']]=new Channel();this[_0x8f09('0x1a')][_0x78fb10['uniqueid']][_0x8f09('0x3d')]=_0x78fb10[_0x8f09('0x4e')]?moment()[_0x8f09('0x4f')](moment[_0x8f09('0x4e')](_0x78fb10[_0x8f09('0x4e')])['seconds'](),'seconds')[_0x8f09('0x3e')](_0x8f09('0x3f')):moment()[_0x8f09('0x3e')](_0x8f09('0x3f'));this['channels'][_0x78fb10[_0x8f09('0x35')]][_0x8f09('0x50')]=_0x8f09('0x14');}_['merge'](this['channels'][_0x78fb10[_0x8f09('0x35')]],_['pick'](_0x78fb10,_['keys'](this[_0x8f09('0x1a')][_0x78fb10[_0x8f09('0x35')]])));if(_['includes'](applications,_0x78fb10[_0x8f09('0x4b')])){this[_0x8f09('0x1a')][_0x78fb10[_0x8f09('0x35')]][_0x8f09('0x51')]=_0x78fb10['application'];this[_0x8f09('0x1a')][_0x78fb10[_0x8f09('0x35')]]['lastdata']=_0x78fb10[_0x8f09('0x4c')];if(_0x78fb10[_0x8f09('0x4b')]===_0x8f09('0x11')&&_[_0x8f09('0x52')](_0x78fb10[_0x8f09('0x4c')],_0x8f09('0x53'))){var _0xab9370=_0x78fb10[_0x8f09('0x4c')][_0x8f09('0x44')]('=');var _0x4faf10=_0xab9370[0x0][_0x8f09('0x54')](/cdr\((.*)\)/);if(_0x4faf10){this[_0x8f09('0x1a')][_0x78fb10[_0x8f09('0x35')]][_0x4faf10[0x1]]=_0xab9370[0x1];}}else if(_0x78fb10[_0x8f09('0x4b')]===_0x8f09('0x55')){this[_0x8f09('0x1a')][_0x78fb10[_0x8f09('0x35')]]['queue']=_0x78fb10[_0x8f09('0x4c')]['split'](',')[0x0];}}}}}catch(_0x4993c1){logger['error']('[syncNewExten][VoiceCallReport]',util['inspect'](_0x4993c1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8f09('0x30')][_0x8f09('0x21')]=function(_0x1a8545){try{if(this[_0x8f09('0x31')](_0x1a8545)){if(_0x1a8545[_0x8f09('0x35')]!==_0x1a8545[_0x8f09('0x36')]){if(this[_0x8f09('0x1a')][_0x1a8545[_0x8f09('0x36')]]){if(_0x1a8545['channelstate']==='6'){if(!this[_0x8f09('0x1a')][_0x1a8545[_0x8f09('0x36')]][_0x8f09('0x56')]){var _0x31ea6d=moment();this[_0x8f09('0x1a')][_0x1a8545[_0x8f09('0x36')]]['answered']=!![];this[_0x8f09('0x1a')][_0x1a8545[_0x8f09('0x36')]]['answertime']=_0x31ea6d['format'](_0x8f09('0x3f'));if(this[_0x8f09('0x1a')][_0x1a8545[_0x8f09('0x36')]]['starttime']){this[_0x8f09('0x1a')][_0x1a8545['linkedid']][_0x8f09('0x57')]=_0x31ea6d[_0x8f09('0x58')](this['channels'][_0x1a8545['linkedid']][_0x8f09('0x3d')],'seconds');}}this[_0x8f09('0x1a')][_0x1a8545[_0x8f09('0x36')]][_0x8f09('0x36')]=_0x1a8545[_0x8f09('0x35')];if(_0x1a8545[_0x8f09('0x59')]!==_0x8f09('0x5a')){this[_0x8f09('0x1a')][_0x1a8545[_0x8f09('0x36')]][_0x8f09('0x5b')]=_0x1a8545[_0x8f09('0x59')];}this[_0x8f09('0x1a')][_0x1a8545[_0x8f09('0x36')]][_0x8f09('0x5c')]=_0x1a8545[_0x8f09('0x5d')];this[_0x8f09('0x1a')][_0x1a8545['linkedid']][_0x8f09('0x5e')]=_0x1a8545[_0x8f09('0x3c')];this[_0x8f09('0x1a')][_0x1a8545[_0x8f09('0x36')]][_0x8f09('0x50')]=dispositions[_[_0x8f09('0x5f')](_0x1a8545[_0x8f09('0x40')])];if(this[_0x8f09('0x1b')][_0x1a8545[_0x8f09('0x3c')][_0x8f09('0x44')]('-')[0x0]]){this[_0x8f09('0x1a')][_0x1a8545[_0x8f09('0x36')]][_0x8f09('0x60')]=this[_0x8f09('0x1b')][_0x1a8545[_0x8f09('0x3c')][_0x8f09('0x44')]('-')[0x0]]['id'];this[_0x8f09('0x1a')][_0x1a8545[_0x8f09('0x36')]][_0x8f09('0x61')]=this[_0x8f09('0x1b')][_0x1a8545[_0x8f09('0x3c')]['split']('-')[0x0]][_0x8f09('0x62')];}}}}else{if(this[_0x8f09('0x1a')][_0x1a8545['uniqueid']]){if(_0x1a8545[_0x8f09('0x40')]==='6'){if(this[_0x8f09('0x1b')][_0x1a8545[_0x8f09('0x3c')][_0x8f09('0x44')]('-')[0x0]]){this['channels'][_0x1a8545[_0x8f09('0x35')]]['UserId']=this[_0x8f09('0x1b')][_0x1a8545['channel'][_0x8f09('0x44')]('-')[0x0]]['id'];this[_0x8f09('0x1a')][_0x1a8545[_0x8f09('0x35')]][_0x8f09('0x61')]=this[_0x8f09('0x1b')][_0x1a8545['channel']['split']('-')[0x0]][_0x8f09('0x62')];}}}}}}catch(_0x3968d1){logger['error'](_0x8f09('0x63'),util[_0x8f09('0x3b')](_0x3968d1,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMixMonitorFilename']=function(_0x5ca7d3,_0x1de480){if(this[_0x8f09('0x1a')][_0x5ca7d3]){this['channels'][_0x5ca7d3][_0x8f09('0x64')]=!![];if(_[_0x8f09('0x65')](_0x1de480,_0x8f09('0x66'))){_0x1de480=_0x1de480[_0x8f09('0x67')]('.wav49',_0x8f09('0x68'));}this['channels'][_0x5ca7d3][_0x8f09('0x69')]=_0x1de480;var _0x43e3aa=_['find'](this[_0x8f09('0x1a')][_0x5ca7d3][_0x8f09('0x6a')],{'filename':_0x1de480});if(_[_0x8f09('0x6b')](_0x43e3aa)){this[_0x8f09('0x1a')][_0x5ca7d3][_0x8f09('0x6a')][_0x8f09('0x6c')]({'filename':_0x1de480,'createdAt':moment()[_0x8f09('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x8f09('0x6d')});}}};VoiceCallReport[_0x8f09('0x30')][_0x8f09('0x22')]=function(_0x3b0c9c){try{if(this['isNotNull'](_0x3b0c9c)){if(this['channels'][_0x3b0c9c[_0x8f09('0x35')]]&&_0x3b0c9c[_0x8f09('0x3c')]!=_0x8f09('0x4a')){if(this[_0x8f09('0x31')](_0x3b0c9c[_0x8f09('0x6e')])){if(this[_0x8f09('0x31')](_0x3b0c9c[_0x8f09('0x6e')][_0x8f09('0x6f')])){this[_0x8f09('0x70')](_0x3b0c9c['uniqueid'],_0x3b0c9c['value']);}else if(this['isNotNull'](_0x3b0c9c[_0x8f09('0x6e')][_0x8f09('0x71')])){this['channels'][_0x3b0c9c[_0x8f09('0x35')]][_0x8f09('0x59')]=_0x3b0c9c[_0x8f09('0x72')];}else if(this[_0x8f09('0x31')](_0x3b0c9c[_0x8f09('0x6e')][_0x8f09('0x73')])){this[_0x8f09('0x1a')][_0x3b0c9c[_0x8f09('0x35')]]['callerid']=_0x3b0c9c[_0x8f09('0x72')];}else if(this['isNotNull'](_0x3b0c9c[_0x8f09('0x6e')]['xmd-cdrtype'])){this[_0x8f09('0x1a')][_0x3b0c9c[_0x8f09('0x35')]]['type']=_0x3b0c9c[_0x8f09('0x72')];}else if(this[_0x8f09('0x31')](_0x3b0c9c[_0x8f09('0x6e')][_0x8f09('0x74')])){this['channels'][_0x3b0c9c[_0x8f09('0x35')]]['queue']=_0x3b0c9c[_0x8f09('0x72')]['split'](',')[0x0];}else if(this[_0x8f09('0x31')](_0x3b0c9c[_0x8f09('0x6e')][_0x8f09('0x75')])){this[_0x8f09('0x1a')][_0x3b0c9c[_0x8f09('0x35')]]['originatecalleridnum']=_0x3b0c9c[_0x8f09('0x72')];}else if(this[_0x8f09('0x31')](_0x3b0c9c[_0x8f09('0x6e')][_0x8f09('0x76')])){this['channels'][_0x3b0c9c['uniqueid']]['destination']=_0x3b0c9c[_0x8f09('0x72')];}else if(this[_0x8f09('0x31')](_0x3b0c9c[_0x8f09('0x6e')][_0x8f09('0x77')])){this[_0x8f09('0x1a')][_0x3b0c9c[_0x8f09('0x35')]][_0x8f09('0x78')]=_0x3b0c9c[_0x8f09('0x72')];}else if(this[_0x8f09('0x31')](_0x3b0c9c[_0x8f09('0x6e')]['xmcs-queue'])){this[_0x8f09('0x1a')][_0x3b0c9c['uniqueid']][_0x8f09('0x55')]=_0x3b0c9c[_0x8f09('0x72')];}else if(this[_0x8f09('0x31')](_0x3b0c9c['variable'][_0x8f09('0x79')])){this[_0x8f09('0x1a')][_0x3b0c9c[_0x8f09('0x35')]]['sipcalluniqueid']=_0x3b0c9c[_0x8f09('0x72')];}}}else if(this['isNotNull'](_0x3b0c9c[_0x8f09('0x6e')][_0x8f09('0x6f')])){if(_0x3b0c9c[_0x8f09('0x72')]){var _0x15eb25=path[_0x8f09('0x7a')](_0x3b0c9c['value'])[_0x8f09('0x62')];this[_0x8f09('0x70')](_0x15eb25,_0x3b0c9c[_0x8f09('0x72')]);}}else if(this[_0x8f09('0x1a')][_0x3b0c9c[_0x8f09('0x36')]]){if(this['isNotNull'](_0x3b0c9c[_0x8f09('0x6e')])){if(this[_0x8f09('0x31')](_0x3b0c9c[_0x8f09('0x6e')][_0x8f09('0x79')])){this[_0x8f09('0x1a')][_0x3b0c9c['linkedid']][_0x8f09('0x7b')]=_0x3b0c9c[_0x8f09('0x72')];}}}}}catch(_0x266ea5){logger['error']('[syncVarSet][VoiceCallReport]',util[_0x8f09('0x3b')](_0x266ea5,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x8f09('0x24')]=function(_0x8cc285){try{if(this[_0x8f09('0x31')](_0x8cc285)){if(this['channels'][_0x8cc285[_0x8f09('0x35')]]){var _0x4cf5df=moment();this[_0x8f09('0x1a')][_0x8cc285[_0x8f09('0x35')]][_0x8f09('0x7c')]=_0x4cf5df[_0x8f09('0x3e')](_0x8f09('0x3f'));this[_0x8f09('0x1a')][_0x8cc285[_0x8f09('0x35')]]['duration']=_0x4cf5df[_0x8f09('0x58')](this[_0x8f09('0x1a')][_0x8cc285[_0x8f09('0x35')]][_0x8f09('0x3d')],_0x8f09('0x7d'));if(this[_0x8f09('0x1a')][_0x8cc285[_0x8f09('0x35')]][_0x8f09('0x56')]){this[_0x8f09('0x1a')][_0x8cc285[_0x8f09('0x35')]][_0x8f09('0x7e')]=_0x4cf5df['diff'](this[_0x8f09('0x1a')][_0x8cc285[_0x8f09('0x35')]][_0x8f09('0x7f')],_0x8f09('0x7d'));this[_0x8f09('0x1a')][_0x8cc285['uniqueid']][_0x8f09('0x57')]=this['channels'][_0x8cc285[_0x8f09('0x35')]][_0x8f09('0x4e')]-this[_0x8f09('0x1a')][_0x8cc285[_0x8f09('0x35')]][_0x8f09('0x7e')];}if(_0x8cc285[_0x8f09('0x42')]===_0x8f09('0x43')){if(this[_0x8f09('0x1b')][_0x8cc285[_0x8f09('0x3c')][_0x8f09('0x44')]('-')[0x0]]){this[_0x8f09('0x1b')][_0x8cc285[_0x8f09('0x3c')]['split']('-')[0x0]]=_[_0x8f09('0x80')](this[_0x8f09('0x1b')][_0x8cc285[_0x8f09('0x3c')][_0x8f09('0x44')]('-')[0x0]],['destconnectedlinenum']);this[_0x8f09('0x33')](util['format'](_0x8f09('0x47'),this[_0x8f09('0x1b')][_0x8cc285[_0x8f09('0x3c')]['split']('-')[0x0]][_0x8f09('0x62')]),_0x8f09('0x81'),{'destaccountcode':this[_0x8f09('0x1b')][_0x8cc285[_0x8f09('0x3c')][_0x8f09('0x44')]('-')[0x0]]['accountcode']});}}ami[_0x8f09('0x33')]('custom:voiceCallReport',this[_0x8f09('0x1a')][_0x8cc285[_0x8f09('0x35')]]);delete this[_0x8f09('0x1a')][_0x8cc285[_0x8f09('0x35')]];}}}catch(_0x238b5f){logger[_0x8f09('0x39')]('[syncHangup][VoiceCallReport]',util['inspect'](_0x238b5f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8f09('0x30')][_0x8f09('0x27')]=function(_0xc161b2){try{if(this[_0x8f09('0x31')](_0xc161b2)){if(this[_0x8f09('0x1a')][_0xc161b2['transfereeuniqueid']]){this[_0x8f09('0x1a')][_0xc161b2[_0x8f09('0x82')]][_0x8f09('0x83')]=_0xc161b2[_0x8f09('0x84')];this[_0x8f09('0x1a')][_0xc161b2[_0x8f09('0x82')]][_0x8f09('0x85')]=_0xc161b2[_0x8f09('0x86')];if(this[_0x8f09('0x1a')][_0xc161b2[_0x8f09('0x87')]]){var _0x241f91=this['channels'][_0xc161b2['secondtransfereruniqueid']];this['channels'][_0xc161b2[_0x8f09('0x87')]]=this[_0x8f09('0x1a')][_0xc161b2[_0x8f09('0x82')]];this['channels'][_0xc161b2[_0x8f09('0x82')]]=_0x241f91;}}else if(this[_0x8f09('0x1a')][_0xc161b2[_0x8f09('0x88')]]){this[_0x8f09('0x1a')][_0xc161b2[_0x8f09('0x88')]]['transfercalleridnum']=_0xc161b2[_0x8f09('0x84')];this[_0x8f09('0x1a')][_0xc161b2[_0x8f09('0x88')]][_0x8f09('0x85')]=_0xc161b2[_0x8f09('0x86')];if(this[_0x8f09('0x1a')][_0xc161b2[_0x8f09('0x89')]]){var _0x241f91=this[_0x8f09('0x1a')][_0xc161b2[_0x8f09('0x89')]];this[_0x8f09('0x1a')][_0xc161b2[_0x8f09('0x89')]]=this[_0x8f09('0x1a')][_0xc161b2['transfertargetuniqueid']];this[_0x8f09('0x1a')][_0xc161b2[_0x8f09('0x88')]]=_0x241f91;}}}}catch(_0x4bd33e){logger['error'](_0x8f09('0x8a'),util[_0x8f09('0x3b')](_0x4bd33e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8f09('0x30')][_0x8f09('0x8b')]=function(_0x3a54a0){try{if(this[_0x8f09('0x31')](_0x3a54a0)){if(this[_0x8f09('0x1a')][_0x3a54a0[_0x8f09('0x82')]]){this[_0x8f09('0x1a')][_0x3a54a0[_0x8f09('0x82')]][_0x8f09('0x83')]=_0x3a54a0[_0x8f09('0x8c')];this[_0x8f09('0x1a')][_0x3a54a0[_0x8f09('0x82')]][_0x8f09('0x85')]=_0x3a54a0[_0x8f09('0x8d')];this[_0x8f09('0x24')]({'event':_0x8f09('0x8e'),'uniqueid':_0x3a54a0[_0x8f09('0x82')],'context':_0x3a54a0['context'],'channel':_0x3a54a0[_0x8f09('0x8f')]});}}}catch(_0x35a83d){logger[_0x8f09('0x39')](_0x8f09('0x90'),util[_0x8f09('0x3b')](_0x35a83d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8f09('0x30')][_0x8f09('0x2a')]=function(_0x22ced3){try{if(this[_0x8f09('0x31')](_0x22ced3)){if(this[_0x8f09('0x1a')][_0x22ced3[_0x8f09('0x35')]]){if(!_[_0x8f09('0x6b')](this[_0x8f09('0x1a')][_0x22ced3[_0x8f09('0x35')]][_0x8f09('0x7f')])){this[_0x8f09('0x1a')][_0x22ced3['uniqueid']][_0x8f09('0x91')]=moment()[_0x8f09('0x3e')](_0x8f09('0x3f'));}}}}catch(_0x1f6148){logger[_0x8f09('0x39')]('[syncMusicOnHoldStart][VoiceCallReport]',util[_0x8f09('0x3b')](_0x1f6148,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8f09('0x30')][_0x8f09('0x2b')]=function(_0x33cc71){try{if(this['isNotNull'](_0x33cc71)){if(this[_0x8f09('0x1a')][_0x33cc71[_0x8f09('0x35')]]){if(!_[_0x8f09('0x6b')](this[_0x8f09('0x1a')][_0x33cc71[_0x8f09('0x35')]][_0x8f09('0x91')])){this[_0x8f09('0x1a')][_0x33cc71[_0x8f09('0x35')]][_0x8f09('0x92')]+=moment()['milliseconds'](0x0)[_0x8f09('0x58')](this[_0x8f09('0x1a')][_0x33cc71[_0x8f09('0x35')]][_0x8f09('0x91')],_0x8f09('0x7d'));delete this['channels'][_0x33cc71['uniqueid']][_0x8f09('0x91')];}}}}catch(_0x4e3626){logger[_0x8f09('0x39')](_0x8f09('0x93'),util['inspect'](_0x4e3626,{'showHidden':![],'depth':null}));}};module[_0x8f09('0x94')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index c50519f..0d55511 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 _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 +var _0x09f1=['total','answered','holdtime','starttime','seconds','billableseconds','sumHoldTime','sumDuration','voice_outbound:save','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','bind','dialend','syncDialEnd','varset','syncVarSet','syncHangup','prototype','isUndefined','emit','syncDialBegin','uniqueid','merge','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','voice:outbound','voice_outbound_channel:save','error','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','format','custom:dialconnect','[syncDialEnd][VoiceDialReport]','isNotNull','addVariable','keys','variable','value','variables','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','duration','endtime','diff','lastevent','complete'];(function(_0x30c53c,_0x1c93f4){var _0x42500f=function(_0x1ba019){while(--_0x1ba019){_0x30c53c['push'](_0x30c53c['shift']());}};_0x42500f(++_0x1c93f4);}(_0x09f1,0xbf));var _0x109f=function(_0x359cf5,_0x4c6775){_0x359cf5=_0x359cf5-0x0;var _0x23b25c=_0x09f1[_0x359cf5];return _0x23b25c;};'use strict';var _=require(_0x109f('0x0'));var moment=require(_0x109f('0x1'));var util=require('util');var Redis=require(_0x109f('0x2'));var config=require(_0x109f('0x3'));var logger=require(_0x109f('0x4'))(_0x109f('0x5'));var ami=require(_0x109f('0x6'));config[_0x109f('0x7')]=_[_0x109f('0x8')](config[_0x109f('0x7')],{'host':_0x109f('0x9'),'port':0x18eb});var io=require(_0x109f('0xa'))(new Redis(config['redis']));function VoiceDialReport(_0x3aa5b5){this[_0x109f('0xb')]=_0x3aa5b5[_0x109f('0xc')];this[_0x109f('0xd')]=_0x3aa5b5[_0x109f('0xd')];this['variables']={};ami['on']('dialbegin',this['syncDialBegin'][_0x109f('0xe')](this));ami['on'](_0x109f('0xf'),this[_0x109f('0x10')][_0x109f('0xe')](this));ami['on'](_0x109f('0x11'),this[_0x109f('0x12')][_0x109f('0xe')](this));ami['on']('hangup',this[_0x109f('0x13')]['bind'](this));}VoiceDialReport[_0x109f('0x14')]['isNotNull']=function(_0x15d179){return _0x15d179!==null&&!_[_0x109f('0x15')](_0x15d179);};VoiceDialReport['prototype'][_0x109f('0x16')]=function(_0x464aff,_0x5a439d,_0x15dbe6){io['to'](_0x464aff)[_0x109f('0x16')](_0x5a439d,_0x15dbe6);};VoiceDialReport[_0x109f('0x14')][_0x109f('0x17')]=function(_0x268a3b){try{if(this['isNotNull'](_0x268a3b)){if(this[_0x109f('0xb')][_0x268a3b[_0x109f('0x18')]]){_[_0x109f('0x19')](this[_0x109f('0xb')][_0x268a3b[_0x109f('0x18')]],{'starttime':moment()['format'](_0x109f('0x1a')),'lastevent':_0x109f('0x1b'),'interface':_0x268a3b[_0x109f('0x1c')][_0x109f('0x1d')](0x0,_0x268a3b[_0x109f('0x1c')][_0x109f('0x1e')]('-')),'membername':_0x268a3b['channel']['substring'](_0x268a3b[_0x109f('0x1c')][_0x109f('0x1e')]('/')+0x1,_0x268a3b[_0x109f('0x1c')]['lastIndexOf']('-'))},_[_0x109f('0x1f')](_0x268a3b,[_0x109f('0x20'),'privilege']));this['emit'](_0x109f('0x21'),_0x109f('0x22'),this[_0x109f('0xb')][_0x268a3b['uniqueid']]);ami[_0x109f('0x16')]('custom:dialbegin',this[_0x109f('0xb')][_0x268a3b[_0x109f('0x18')]]);}}}catch(_0x379dac){logger[_0x109f('0x23')](_0x109f('0x24'),util[_0x109f('0x25')](_0x379dac,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncDialEnd']=function(_0x386289){try{if(this['isNotNull'](_0x386289)){if(this['channels'][_0x386289['uniqueid']]){this[_0x109f('0xb')][_0x386289['uniqueid']][_0x109f('0x26')]=_0x386289[_0x109f('0x26')];if(_0x386289[_0x109f('0x26')]===_0x109f('0x27')){this[_0x109f('0xb')][_0x386289['uniqueid']][_0x109f('0x28')]=_0x386289[_0x109f('0x28')];this[_0x109f('0xb')][_0x386289[_0x109f('0x18')]]['connectedlinename']=_0x386289[_0x109f('0x29')];this[_0x109f('0xb')][_0x386289[_0x109f('0x18')]][_0x109f('0x2a')]=moment()[_0x109f('0x2b')](_0x109f('0x1a'));this['channels'][_0x386289[_0x109f('0x18')]]['lastevent']='connect';ami[_0x109f('0x16')](_0x109f('0x2c'),this[_0x109f('0xb')][_0x386289['uniqueid']]);}this['emit']('voice:outbound',_0x109f('0x22'),this[_0x109f('0xb')][_0x386289[_0x109f('0x18')]]);}}}catch(_0x63b745){logger[_0x109f('0x23')](_0x109f('0x2d'),util[_0x109f('0x25')](_0x63b745,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x109f('0x14')][_0x109f('0x12')]=function(_0x1a11f3){try{if(this[_0x109f('0x2e')](_0x1a11f3)){this[_0x109f('0x2f')](_0x1a11f3[_0x109f('0x18')],_[_0x109f('0x30')](_0x1a11f3[_0x109f('0x31')])[0x0],_0x1a11f3[_0x109f('0x32')]);if(this[_0x109f('0x2e')](_0x1a11f3[_0x109f('0x31')])&&this['isNotNull'](_0x1a11f3[_0x109f('0x31')]['outboundrouteid'])){if(_['isUndefined'](this[_0x109f('0xb')][_0x1a11f3[_0x109f('0x18')]])){this[_0x109f('0xb')][_0x1a11f3[_0x109f('0x18')]]={'routeId':_0x1a11f3['value'],'variables':this[_0x109f('0x33')][_0x1a11f3['uniqueid']]};this[_0x109f('0x16')](_0x109f('0x21'),_0x109f('0x22'),this[_0x109f('0xb')][_0x1a11f3[_0x109f('0x18')]]);}}}}catch(_0x42085c){logger[_0x109f('0x23')]('[syncVarSet][VoiceDialReport]',util['inspect'](_0x42085c,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x109f('0x2f')]=function(_0x126b69,_0x47900b,_0x25e746){var _0x2f4285=['rtpaudioqos',_0x109f('0x34'),_0x109f('0x35'),'rtpaudioqosjitterbridged',_0x109f('0x36'),_0x109f('0x37'),'rtpaudioqosrtt',_0x109f('0x38'),_0x109f('0x39'),'sipuri',_0x109f('0x3a'),_0x109f('0x3b'),_0x109f('0x3c'),_0x109f('0x3d'),'memberinterface',_0x109f('0x3e'),_0x109f('0x3f'),_0x109f('0x40'),_0x109f('0x41')];if(!_[_0x109f('0x42')](_0x47900b)&&!_[_0x109f('0x43')](_0x2f4285,_0x47900b)){if(_['isUndefined'](this[_0x109f('0x33')][_0x126b69])){this['variables'][_0x126b69]={};}this[_0x109f('0x33')][_0x126b69][_0x47900b]=_0x25e746;}};VoiceDialReport[_0x109f('0x14')]['syncHangup']=function(_0x906240){try{if(this[_0x109f('0x2e')](_0x906240)){if(this[_0x109f('0xb')][_0x906240[_0x109f('0x18')]]){this[_0x109f('0xb')][_0x906240[_0x109f('0x18')]]['endtime']=moment()[_0x109f('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x109f('0xb')][_0x906240[_0x109f('0x18')]][_0x109f('0x44')]=moment(this['channels'][_0x906240[_0x109f('0x18')]][_0x109f('0x45')])[_0x109f('0x46')](this['channels'][_0x906240[_0x109f('0x18')]]['starttime'],'seconds');this[_0x109f('0xb')][_0x906240[_0x109f('0x18')]][_0x109f('0x47')]=_0x109f('0x48');this[_0x109f('0xd')][_0x109f('0x49')]+=0x1;if(this[_0x109f('0xb')][_0x906240[_0x109f('0x18')]][_0x109f('0x2a')]){this[_0x109f('0xd')][_0x109f('0x4a')]+=0x1;this['channels'][_0x906240[_0x109f('0x18')]][_0x109f('0x4b')]=moment(this['channels'][_0x906240[_0x109f('0x18')]]['answertime'])[_0x109f('0x46')](this[_0x109f('0xb')][_0x906240[_0x109f('0x18')]][_0x109f('0x4c')],_0x109f('0x4d'));this[_0x109f('0xb')][_0x906240['uniqueid']][_0x109f('0x4e')]=moment(this[_0x109f('0xb')][_0x906240[_0x109f('0x18')]][_0x109f('0x45')])[_0x109f('0x46')](this[_0x109f('0xb')][_0x906240['uniqueid']][_0x109f('0x2a')],_0x109f('0x4d'));this[_0x109f('0xd')][_0x109f('0x4f')]+=this[_0x109f('0xb')][_0x906240[_0x109f('0x18')]][_0x109f('0x4b')]||0x0;this['outbound']['sumBillable']+=this[_0x109f('0xb')][_0x906240[_0x109f('0x18')]][_0x109f('0x4e')];}this[_0x109f('0xd')][_0x109f('0x50')]+=this[_0x109f('0xb')][_0x906240['uniqueid']][_0x109f('0x44')];ami[_0x109f('0x16')]('custom:voiceDialReport',this['channels'][_0x906240['uniqueid']]);ami[_0x109f('0x16')]('custom:dialend',this['channels'][_0x906240[_0x109f('0x18')]]);this[_0x109f('0x16')](_0x109f('0x21'),_0x109f('0x51'),this[_0x109f('0xd')]);logger[_0x109f('0x52')](_0x109f('0x53'),JSON[_0x109f('0x54')](this['channels'][_0x906240[_0x109f('0x18')]]));this[_0x109f('0x16')](_0x109f('0x21'),_0x109f('0x55'),this['channels'][_0x906240[_0x109f('0x18')]]);delete this[_0x109f('0xb')][_0x906240[_0x109f('0x18')]];}if(this[_0x109f('0x33')][_0x906240['uniqueid']]){delete this[_0x109f('0x33')][_0x906240['uniqueid']];}}}catch(_0x28cd47){logger[_0x109f('0x23')](_0x109f('0x56'),util[_0x109f('0x25')](_0x28cd47,{'showHidden':![],'depth':null}));}};module[_0x109f('0x57')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 0a34552..ea08d57 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 _0xcb93=['lastevent','custom:timeout','queueposition','[syncVarSet][VoiceQueueReport]','rtpaudioqos','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberpenalty','includes','diff','milliseconds','custom:queuecallerabandon','custom:voiceQueueReport','[syncHangup][VoiceQueueReport]','transfereeuniqueid','secondtransfereruniqueid','ATTENDEDTRANSFER','transfertargetuniqueid','origtransfereruniqueid','ATTENDED','[syncAttendedTransfer][VoiceQueueReport]','syncBlindTransfer','BLINDTRANSFER','BLIND','syncHangup','BlindTransfer','context','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','[syncMusicOnHoldStart][VoiceQueueReport]','mohstarttime','mohtime','[syncMusicOnHoldStop][VoiceQueueReport]','exports','bluebird','util','md5','ioredis','../../../config/environment','ami','../ami','../model/queueReport','redis','defaults','localhost','prototype','enqueue','tail','finally','sequence','queueReports','agents','queueChannels','voiceQueues','flagQueueSummary','campaigns','syncQueueSummary','queuesummarycomplete','syncQueueSummaryComplete','bind','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','varset','hangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','clearZombieChannels','channels','switch','isNil','status','channel','catch','message','No\x20such\x20channel','error','[voiceQueueReport][checkChannel]','[voiceQueueReport][checkQueueReport]','variables','[voiceQueueReport][checkVariables]','syncFullyBooted','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','inspect','emit','emitVoiceQueueChannelSave','format','voice:queue:%s','name','voice_queue_channel:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_channel:remove','type','inbound','strategy','answered','loggedIn','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','Trunk','active','Interval','voice_queue:save','isNotNull','isUndefined','loopQueueShow','Action','queues','[queues]','loopQueueSummary','queuesummary','then','queue','countBy','toNumber','callers','loggedin','available','emitVoiceQueueSummary','custom:queuesummary','[syncQueueSummary][VoiceQueueReport]','syncNewExten','uniqueid','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','count','merge','push','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerexitreason','ABANDONED','[syncQueueCallerAbandon][VoiceQueueReport]','last','queuecallerleaveAt','[syncQueueCallerLeave][VoiceQueueReport]','syncAgentConnect','COMPLETEDBYAGENT','[syncAgentConnect][VoiceQueueReport]','queuecallerabandonAt','assigned','membername','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','startsWith','linkedid','add','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','transferuniqueid','COMPLETEDBY','toUpperCase','[syncAgentComplete][VoiceQueueReport]','keys','variable','value','queuestatus','CONTINUE','TIMEOUT'];(function(_0xacec56,_0x22afc0){var _0x1def97=function(_0x570798){while(--_0x570798){_0xacec56['push'](_0xacec56['shift']());}};_0x1def97(++_0x22afc0);}(_0xcb93,0xf0));var _0x3cb9=function(_0x5bcf0b,_0x55bdfa){_0x5bcf0b=_0x5bcf0b-0x0;var _0x33e5c1=_0xcb93[_0x5bcf0b];return _0x33e5c1;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0x3cb9('0x0'));var util=require(_0x3cb9('0x1'));var md5=require(_0x3cb9('0x2'));var Redis=require(_0x3cb9('0x3'));var config=require(_0x3cb9('0x4'));var logger=require('../../../config/logger')(_0x3cb9('0x5'));var ami=require(_0x3cb9('0x6'));var QueueReport=require(_0x3cb9('0x7'));config[_0x3cb9('0x8')]=_[_0x3cb9('0x9')](config[_0x3cb9('0x8')],{'host':_0x3cb9('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3cb9('0x8')]));var Sequence=function(){};Sequence[_0x3cb9('0xb')][_0x3cb9('0xc')]=function(_0x49fec3){this[_0x3cb9('0xd')]=this[_0x3cb9('0xd')]?this[_0x3cb9('0xd')][_0x3cb9('0xe')](_0x49fec3):_0x49fec3();};function VoiceQueueReport(_0x122613){this[_0x3cb9('0xf')]=new Sequence();this[_0x3cb9('0x10')]={};this[_0x3cb9('0x11')]=_0x122613['agents'];this['channels']=_0x122613[_0x3cb9('0x12')];this[_0x3cb9('0x13')]=_0x122613['voiceQueues'];this[_0x3cb9('0x14')]=!![];this[_0x3cb9('0x15')]=_0x122613[_0x3cb9('0x15')];this['variables']={};ami['on']('queuesummary',this[_0x3cb9('0x16')]['bind'](this));ami['on'](_0x3cb9('0x17'),this[_0x3cb9('0x18')][_0x3cb9('0x19')](this));ami['on']('queuecallerjoin',this[_0x3cb9('0x1a')][_0x3cb9('0x19')](this));ami['on'](_0x3cb9('0x1b'),this[_0x3cb9('0x1c')][_0x3cb9('0x19')](this));ami['on']('queuecallerleave',this[_0x3cb9('0x1d')][_0x3cb9('0x19')](this));ami['on'](_0x3cb9('0x1e'),this[_0x3cb9('0x1f')][_0x3cb9('0x19')](this));ami['on'](_0x3cb9('0x20'),this['syncAgentConnect']['bind'](this));ami['on'](_0x3cb9('0x21'),this['syncVarSet'][_0x3cb9('0x19')](this));ami['on'](_0x3cb9('0x22'),this['syncHangup'][_0x3cb9('0x19')](this));ami['on']('fullybooted',this['syncFullyBooted'][_0x3cb9('0x19')](this));ami['on'](_0x3cb9('0x23'),this[_0x3cb9('0x24')]['bind'](this));ami['on'](_0x3cb9('0x25'),this[_0x3cb9('0x26')][_0x3cb9('0x19')](this));ami['on'](_0x3cb9('0x27'),this[_0x3cb9('0x28')]['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x3cb9('0x19')](this));this['loopQueueSummary']();this['loopQueueShow']();}function isNotNull(_0x5d8740){return _0x5d8740!==null&&!_['isUndefined'](_0x5d8740);}function clearChannels(_0x2aa53d){if(!_[_0x3cb9('0x29')](_0x2aa53d)){for(var _0x27e500 in _0x2aa53d){if(_0x2aa53d[_0x3cb9('0x2a')](_0x27e500)){delete _0x2aa53d[_0x27e500];}}}}function clearCampaigns(_0x2dd849){if(!_['isEmpty'](_0x2dd849)){for(var _0x3569b2 in _0x2dd849){if(_0x2dd849[_0x3cb9('0x2a')](_0x3569b2)){_0x2dd849[_0x3569b2][_0x3cb9('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x2faebb){if(!_[_0x3cb9('0x29')](_0x2faebb)){for(var _0x36aa8f in _0x2faebb){if(_0x2faebb[_0x3cb9('0x2a')](_0x36aa8f)){_0x2faebb[_0x36aa8f]['originated']=0x0;_0x2faebb[_0x36aa8f][_0x3cb9('0x2c')]=0x0;_0x2faebb[_0x36aa8f][_0x3cb9('0x2d')]=0x0;_0x2faebb[_0x36aa8f][_0x3cb9('0x2e')]=0x0;_0x2faebb[_0x36aa8f][_0x3cb9('0x2f')]=!![];}}}}function clearAgentBooked(_0x2d4755){if(!_['isEmpty'](_0x2d4755)){for(var _0x317699 in _0x2d4755){if(_0x2d4755[_0x3cb9('0x2a')](_0x317699)){_0x2d4755[_0x317699][_0x3cb9('0x30')]=!![];}}}}VoiceQueueReport[_0x3cb9('0xb')][_0x3cb9('0x31')]=function(){var _0x2ab4c0=this;for(var _0x4d239e in this[_0x3cb9('0x32')]){if(this[_0x3cb9('0x32')][_0x3cb9('0x2a')](_0x4d239e)&&!this['channels'][_0x4d239e][_0x3cb9('0x33')]){this[_0x3cb9('0xf')]['enqueue'](function(){if(!_[_0x3cb9('0x34')](_0x2ab4c0[_0x3cb9('0x32')][_0x4d239e])){return ami['Action']({'action':_0x3cb9('0x35'),'channel':_0x2ab4c0[_0x3cb9('0x32')][_0x4d239e][_0x3cb9('0x36')]})[_0x3cb9('0x37')](function(_0x32dab4){if(_0x32dab4[_0x3cb9('0x38')]===_0x3cb9('0x39')){setTimeout(function(){if(_0x2ab4c0['channels'][_0x4d239e]){delete _0x2ab4c0[_0x3cb9('0x32')][_0x4d239e];logger[_0x3cb9('0x3a')](_0x3cb9('0x3b'),_0x4d239e);}if(_0x2ab4c0[_0x3cb9('0x10')][_0x4d239e]){delete _0x2ab4c0[_0x3cb9('0x10')][_0x4d239e];logger[_0x3cb9('0x3a')](_0x3cb9('0x3c'),_0x4d239e);}if(_0x2ab4c0[_0x3cb9('0x3d')][_0x4d239e]){delete _0x2ab4c0[_0x3cb9('0x3d')][_0x4d239e];logger['error'](_0x3cb9('0x3e'),_0x4d239e);}},0x1f40);}});}});}}};VoiceQueueReport[_0x3cb9('0xb')][_0x3cb9('0x3f')]=function(){logger[_0x3cb9('0x3a')](_0x3cb9('0x40'));clearChannels(this[_0x3cb9('0x32')]);this[_0x3cb9('0x41')](this[_0x3cb9('0x10')]);clearAgentBooked(this[_0x3cb9('0x11')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0x3cb9('0x15')]);};VoiceQueueReport[_0x3cb9('0xb')][_0x3cb9('0x41')]=function(_0x58b1b0){var _0x587a89=this;if(!_['isEmpty'](_0x58b1b0)){for(var _0x33b5d9 in _0x58b1b0){if(_0x58b1b0[_0x3cb9('0x2a')](_0x33b5d9)){_0x587a89[_0x3cb9('0x42')](_0x58b1b0[_0x33b5d9]);delete _0x58b1b0[_0x33b5d9];}}}};function loggerCatch(_0x406913){return function(_0x3f9013){logger[_0x3cb9('0x3a')](_0x406913,util[_0x3cb9('0x43')](_0x3f9013,{'showHidden':![],'depth':null}));};}VoiceQueueReport['prototype'][_0x3cb9('0x44')]=function(_0x50c52b,_0x23d3d2,_0x135b2d){io['to'](_0x50c52b)[_0x3cb9('0x44')](_0x23d3d2,_0x135b2d);};VoiceQueueReport[_0x3cb9('0xb')][_0x3cb9('0x45')]=function(_0x3f2b70){this[_0x3cb9('0x44')](util[_0x3cb9('0x46')](_0x3cb9('0x47'),_0x3f2b70[_0x3cb9('0x48')]),_0x3cb9('0x49'),_0x3f2b70);};VoiceQueueReport[_0x3cb9('0xb')][_0x3cb9('0x42')]=function(_0x385881){logger[_0x3cb9('0x4a')](_0x3cb9('0x4b'),JSON[_0x3cb9('0x4c')](_0x385881));this[_0x3cb9('0x44')](util[_0x3cb9('0x46')]('voice:queue:%s',_0x385881[_0x3cb9('0x48')]),_0x3cb9('0x4d'),_0x385881);};VoiceQueueReport[_0x3cb9('0xb')]['emitVoiceQueueSummary']=function(_0x29488f){if(_0x29488f[_0x3cb9('0x4e')]===_0x3cb9('0x4f')){var _0xc19265={'id':_0x29488f['id'],'name':_0x29488f[_0x3cb9('0x48')],'strategy':_0x29488f[_0x3cb9('0x50')],'answered':_0x29488f[_0x3cb9('0x51')],'available':_0x29488f['available'],'loggedIn':_0x29488f[_0x3cb9('0x52')],'pTalking':_0x29488f[_0x3cb9('0x2d')],'sumBillable':_0x29488f[_0x3cb9('0x53')],'sumDuration':_0x29488f[_0x3cb9('0x54')],'sumHoldTime':_0x29488f[_0x3cb9('0x55')]||0x0,'talking':_0x29488f[_0x3cb9('0x2c')],'total':_0x29488f[_0x3cb9('0x56')],'type':_0x29488f[_0x3cb9('0x4e')],'unmanaged':_0x29488f[_0x3cb9('0x57')],'abandoned':_0x29488f[_0x3cb9('0x58')],'waiting':_0x29488f[_0x3cb9('0x2e')]};if(_0x29488f[_0x3cb9('0x59')]){_0xc19265[_0x3cb9('0x59')]={'id':_0x29488f[_0x3cb9('0x59')]['id'],'name':_0x29488f[_0x3cb9('0x59')][_0x3cb9('0x48')],'active':_0x29488f[_0x3cb9('0x59')][_0x3cb9('0x5a')],'callerid':_0x29488f[_0x3cb9('0x59')]['callerid']};}if(_0x29488f['Interval']){_0xc19265[_0x3cb9('0x5b')]={'id':_0x29488f['Interval']['id'],'name':_0x29488f[_0x3cb9('0x5b')][_0x3cb9('0x48')]};}var _0x1bea9a=md5(JSON['stringify'](_0xc19265));if(_0x29488f[_0x3cb9('0x2')]!==_0x1bea9a){_0x29488f['md5']=_0x1bea9a;this['emit'](util[_0x3cb9('0x46')](_0x3cb9('0x47'),_0xc19265[_0x3cb9('0x48')]),_0x3cb9('0x5c'),_0xc19265);}}};VoiceQueueReport[_0x3cb9('0xb')][_0x3cb9('0x5d')]=function(_0x2b22b3){return _0x2b22b3!==null&&!_[_0x3cb9('0x5e')](_0x2b22b3);};VoiceQueueReport[_0x3cb9('0xb')][_0x3cb9('0x5f')]=function(){var _0x358d9e=this;setInterval(function(){_0x358d9e[_0x3cb9('0x31')]();ami[_0x3cb9('0x60')]({'action':_0x3cb9('0x61')})[_0x3cb9('0x37')](loggerCatch(_0x3cb9('0x62')));},0x2710);};VoiceQueueReport[_0x3cb9('0xb')][_0x3cb9('0x63')]=function(){var _0x2a92fe=this;setInterval(function(){if(_0x2a92fe[_0x3cb9('0x14')]){return ami[_0x3cb9('0x60')]({'action':_0x3cb9('0x64')})[_0x3cb9('0x65')](function(_0x27e4e5){_0x2a92fe[_0x3cb9('0x14')]=![];})[_0x3cb9('0x37')](loggerCatch('[queuesummary]'));}},0x3e8);};VoiceQueueReport[_0x3cb9('0xb')]['syncQueueSummary']=function(_0x265d09){try{if(this['isNotNull'](_0x265d09)&&this['isNotNull'](_0x265d09[_0x3cb9('0x66')])){if(this[_0x3cb9('0x13')][_0x265d09[_0x3cb9('0x66')]]){var _0x294f99=_[_0x3cb9('0x67')](this[_0x3cb9('0x32')],_0x3cb9('0x66'))[_0x265d09[_0x3cb9('0x66')]]||0x0;var _0x116555=_0x294f99-_0x265d09['callers'];if(this[_0x3cb9('0x13')][_0x265d09[_0x3cb9('0x66')]][_0x3cb9('0x2e')]!==_[_0x3cb9('0x68')](_0x265d09[_0x3cb9('0x69')])||this[_0x3cb9('0x13')][_0x265d09[_0x3cb9('0x66')]]['loggedIn']!==_[_0x3cb9('0x68')](_0x265d09[_0x3cb9('0x6a')])||this[_0x3cb9('0x13')][_0x265d09['queue']][_0x3cb9('0x6b')]!==_[_0x3cb9('0x68')](_0x265d09[_0x3cb9('0x6b')])||this['voiceQueues'][_0x265d09['queue']][_0x3cb9('0x2c')]!==_0x116555){this[_0x3cb9('0x13')][_0x265d09[_0x3cb9('0x66')]][_0x3cb9('0x2e')]=_[_0x3cb9('0x68')](_0x265d09[_0x3cb9('0x69')]);this[_0x3cb9('0x13')][_0x265d09[_0x3cb9('0x66')]][_0x3cb9('0x52')]=_['toNumber'](_0x265d09[_0x3cb9('0x6a')]);this[_0x3cb9('0x13')][_0x265d09[_0x3cb9('0x66')]][_0x3cb9('0x6b')]=_[_0x3cb9('0x68')](_0x265d09['available']);this[_0x3cb9('0x13')][_0x265d09[_0x3cb9('0x66')]][_0x3cb9('0x2c')]=_0x116555>0x0?_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={};_0x4d71e90x0?_0x34a141:0x0;this[_0xed1d('0x11')][_0x1bf2ea[_0xed1d('0x67')]][_0xed1d('0x32')]=this[_0xed1d('0x11')][_0x1bf2ea[_0xed1d('0x67')]][_0xed1d('0x32')]>_[_0xed1d('0x6a')](_0x1bf2ea[_0xed1d('0x6b')])?_[_0xed1d('0x6a')](_0x1bf2ea[_0xed1d('0x6b')]):this[_0xed1d('0x11')][_0x1bf2ea[_0xed1d('0x67')]]['talking'];this[_0xed1d('0x50')](this[_0xed1d('0x11')][_0x1bf2ea[_0xed1d('0x67')]]);}ami[_0xed1d('0x48')](_0xed1d('0x6c'),this[_0xed1d('0x11')][_0x1bf2ea[_0xed1d('0x67')]]);}}}catch(_0x2c9fad){logger[_0xed1d('0x3f')]('[syncQueueSummary][VoiceQueueReport]',util[_0xed1d('0x47')](_0x2c9fad,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0x44a0e0){this[_0xed1d('0x12')]=!![];};VoiceQueueReport[_0xed1d('0xb')][_0xed1d('0x6d')]=function(_0x9aa8db){};VoiceQueueReport[_0xed1d('0xb')][_0xed1d('0x1a')]=function(_0x2e0a14){try{if(this[_0xed1d('0x66')](_0x2e0a14)){if(_['isUndefined'](this[_0xed1d('0x41')][_0x2e0a14[_0xed1d('0x6e')]])){this['queueReports'][_0x2e0a14[_0xed1d('0x6e')]]=[];this[_0xed1d('0x37')][_0x2e0a14['uniqueid']]={};}var _0x261830=new QueueReport();_0x261830[_0xed1d('0x4f')]=_0x2e0a14[_0xed1d('0x67')];_0x261830['type']=this['voiceQueues'][_0x261830['name']]&&this[_0xed1d('0x11')][_0x261830[_0xed1d('0x4f')]][_0xed1d('0x51')]?this['voiceQueues'][_0x261830[_0xed1d('0x4f')]][_0xed1d('0x51')]||_0xed1d('0x52'):_0xed1d('0x52');_0x261830['queue']=_0x2e0a14[_0xed1d('0x67')];_0x261830[_0xed1d('0x6f')]=moment()[_0xed1d('0x4a')](_0xed1d('0x70'));_0x261830['position']=_0x2e0a14[_0xed1d('0x71')];_0x261830[_0xed1d('0x72')]=_0x2e0a14[_0xed1d('0x72')];_[_0xed1d('0x73')](_0x261830,_[_0xed1d('0x74')](_0x2e0a14,_[_0xed1d('0x75')](_0x261830)));this[_0xed1d('0x41')][_0x2e0a14['uniqueid']][_0xed1d('0x76')](_0x261830);this[_0xed1d('0x37')][_0x2e0a14[_0xed1d('0x6e')]]=_0x261830;this[_0xed1d('0x49')](_0x261830);}}catch(_0x1bb3a8){logger[_0xed1d('0x3f')]('[syncQueueCallerJoin][VoiceQueueReport]',util[_0xed1d('0x47')](_0x1bb3a8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xed1d('0xb')]['syncQueueCallerAbandon']=function(_0x1f44b0){try{if(this[_0xed1d('0x66')](_0x1f44b0)){if(this['queueReports'][_0x1f44b0['uniqueid']]){var _0x263f50=_[_0xed1d('0x77')](this[_0xed1d('0x41')][_0x1f44b0[_0xed1d('0x6e')]]);_0x263f50[_0xed1d('0x78')]=![];_0x263f50[_0xed1d('0x79')]=null;_0x263f50[_0xed1d('0x7a')]=_0x1f44b0[_0xed1d('0x7a')];_0x263f50[_0xed1d('0x7b')]=_0x1f44b0['originalposition'];_0x263f50['queuecallerabandon']=!![];_0x263f50[_0xed1d('0x7c')]=moment()[_0xed1d('0x4a')](_0xed1d('0x70'));_0x263f50[_0xed1d('0x7d')]=_0xed1d('0x7e');_0x263f50[_0xed1d('0x7f')]=null;this[_0xed1d('0x37')][_0x1f44b0[_0xed1d('0x6e')]]=_0x263f50;this[_0xed1d('0x46')](_0x263f50);}}}catch(_0x584a9b){logger[_0xed1d('0x3f')](_0xed1d('0x80'),util[_0xed1d('0x47')](_0x584a9b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x46d921){try{if(this[_0xed1d('0x66')](_0x46d921)){if(this[_0xed1d('0x41')][_0x46d921['uniqueid']]){var _0x4c6a05=_[_0xed1d('0x77')](this[_0xed1d('0x41')][_0x46d921['uniqueid']]);_0x4c6a05[_0xed1d('0x81')]=moment()[_0xed1d('0x4a')](_0xed1d('0x70'));_0x4c6a05[_0xed1d('0x82')]=_0x46d921[_0xed1d('0x82')];_0x4c6a05['connectedlinename']=_0x46d921[_0xed1d('0x83')];this[_0xed1d('0x37')][_0x46d921[_0xed1d('0x6e')]]=_0x4c6a05;this['emitVoiceQueueChannelSave'](_0x4c6a05);}}}catch(_0x729fa6){logger[_0xed1d('0x3f')](_0xed1d('0x84'),util['inspect'](_0x729fa6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xed1d('0xb')][_0xed1d('0x21')]=function(_0x59b351){try{if(this[_0xed1d('0x66')](_0x59b351)){if(this['queueReports'][_0x59b351[_0xed1d('0x6e')]]){var _0x262148=_[_0xed1d('0x77')](this[_0xed1d('0x41')][_0x59b351['uniqueid']]);_0x262148[_0xed1d('0x78')]=!![];_0x262148['queuecallerexitreason']=_0xed1d('0x85');}}}catch(_0x29fc59){logger[_0xed1d('0x3f')](_0xed1d('0x86'),util[_0xed1d('0x47')](_0x29fc59,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xed1d('0xb')][_0xed1d('0x1f')]=function(_0x555424){try{if(this['isNotNull'](_0x555424)){if(this[_0xed1d('0x41')][_0x555424['uniqueid']]){var _0x2e5401=_[_0xed1d('0x77')](this[_0xed1d('0x41')][_0x555424['uniqueid']]);_0x2e5401[_0xed1d('0x1b')]=![];_0x2e5401['queuecallerabandonAt']=null;_0x2e5401[_0xed1d('0x87')]=!![];_0x2e5401['lastAssignedTo']=_0x555424[_0xed1d('0x88')];_0x2e5401['holdtime']=_0x555424['holdtime'];_0x2e5401['queuecallercomplete']=!![];_0x2e5401[_0xed1d('0x89')]=![];_0x2e5401[_0xed1d('0x8a')]=null;if(!_0x2e5401[_0xed1d('0x8b')]){if(_0x555424[_0xed1d('0x8c')]==_0xed1d('0x8b')){_0x2e5401[_0xed1d('0x7d')]='COMPLETED';}else{if(_[_0xed1d('0x8d')](_0x555424[_0xed1d('0x8e')][_0xed1d('0x8f')](),_0xed1d('0x90'))){if(this[_0xed1d('0x41')][_0x555424['linkedid']]){var _0x52629d=_[_0xed1d('0x77')](this[_0xed1d('0x41')][_0x555424[_0xed1d('0x91')]]);_0x52629d[_0xed1d('0x78')]=![];_0x52629d[_0xed1d('0x89')]=!![];_0x52629d[_0xed1d('0x8a')]=moment(_0x2e5401['queuecallerjoinAt'])[_0xed1d('0x92')](_0x555424[_0xed1d('0x7a')],_0xed1d('0x93'))[_0xed1d('0x4a')](_0xed1d('0x70'));_0x52629d[_0xed1d('0x7d')]=_0xed1d('0x94');_0x52629d['transfer']=!![];_0x52629d['transfertype']=_0xed1d('0x95');_0x52629d[_0xed1d('0x96')]=_0x555424[_0xed1d('0x97')];_0x52629d[_0xed1d('0x98')]=_0x555424['uniqueid'];var _0x1d977f=this[_0xed1d('0x41')][_0x555424['linkedid']];this['queueReports'][_0x555424[_0xed1d('0x91')]]=this[_0xed1d('0x41')][_0x555424[_0xed1d('0x6e')]];this['queueReports'][_0x555424[_0xed1d('0x6e')]]=_0x1d977f;}}else{_0x2e5401[_0xed1d('0x7d')]=_0xed1d('0x99')+_0x555424[_0xed1d('0x8c')][_0xed1d('0x9a')]();}}}this[_0xed1d('0x37')][_0x555424[_0xed1d('0x6e')]]=_0x2e5401;this[_0xed1d('0x46')](_0x2e5401);}}}catch(_0x5f13bf){logger[_0xed1d('0x3f')](_0xed1d('0x9b'),util[_0xed1d('0x47')](_0x5f13bf,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xed1d('0xb')][_0xed1d('0x23')]=function(_0x26f2b9){try{if(this['isNotNull'](_0x26f2b9)){this['addVariable'](_0x26f2b9['uniqueid'],_[_0xed1d('0x75')](_0x26f2b9[_0xed1d('0x9c')])[0x0],_0x26f2b9[_0xed1d('0x9d')]);if(this[_0xed1d('0x41')][_0x26f2b9[_0xed1d('0x6e')]]){var _0x40da85=_[_0xed1d('0x77')](this[_0xed1d('0x41')][_0x26f2b9[_0xed1d('0x6e')]]);if(_0x40da85){if(this[_0xed1d('0x66')](_0x26f2b9[_0xed1d('0x9c')])&&this['isNotNull'](_0x26f2b9[_0xed1d('0x9c')][_0xed1d('0x9e')])){switch(_0x26f2b9[_0xed1d('0x9d')]){case _0xed1d('0x9f'):_0x40da85[_0xed1d('0x89')]=![];_0x40da85[_0xed1d('0x8a')]=null;break;case'TIMEOUT':_0x40da85[_0xed1d('0xa0')]=_0xed1d('0xa1');ami['emit'](_0xed1d('0xa2'),_0x40da85);break;default:_0x40da85[_0xed1d('0x89')]=!![];_0x40da85[_0xed1d('0x8a')]=moment()[_0xed1d('0x4a')](_0xed1d('0x70'));_0x40da85[_0xed1d('0x81')]=moment()['format'](_0xed1d('0x70'));}_0x40da85[_0xed1d('0x1b')]=![];_0x40da85['queuecallerabandonAt']=null;_0x40da85['queuecallerexitreason']=_0x26f2b9[_0xed1d('0x9d')];this[_0xed1d('0x37')][_0x26f2b9[_0xed1d('0x6e')]]=_0x40da85;this[_0xed1d('0x46')](_0x40da85);}else if(this['isNotNull'](_0x26f2b9[_0xed1d('0x9c')])&&this['isNotNull'](_0x26f2b9[_0xed1d('0x9c')]['queueposition'])){if(!_0x40da85[_0xed1d('0x1b')]){_0x40da85[_0xed1d('0x89')]=!![];_0x40da85[_0xed1d('0x8a')]=moment()[_0xed1d('0x4a')](_0xed1d('0x70'));_0x40da85[_0xed1d('0x7d')]=_0xed1d('0xa3');_0x40da85[_0xed1d('0x81')]=moment()[_0xed1d('0x4a')](_0xed1d('0x70'));this[_0xed1d('0x37')][_0x26f2b9[_0xed1d('0x6e')]]=_0x40da85;}}_0x40da85[_0xed1d('0x14')]=this[_0xed1d('0x14')][_0x26f2b9[_0xed1d('0x6e')]];}}}}catch(_0x206b90){logger[_0xed1d('0x3f')]('[syncVarSet][VoiceQueueReport]',util['inspect'](_0x206b90,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xed1d('0xb')]['addVariable']=function(_0x4437db,_0x265c02,_0x2350f0){var _0x314b5b=[_0xed1d('0xa4'),_0xed1d('0xa5'),_0xed1d('0xa6'),_0xed1d('0xa7'),'rtpaudioqosloss',_0xed1d('0xa8'),_0xed1d('0xa9'),_0xed1d('0xaa'),_0xed1d('0xab'),'sipuri','bridgepeer',_0xed1d('0xac'),_0xed1d('0xad'),'memberdynamic',_0xed1d('0xae'),_0xed1d('0xaf'),'membername',_0xed1d('0xb0'),_0xed1d('0xb1')];if(!_[_0xed1d('0x39')](_0x265c02)&&!_[_0xed1d('0xb2')](_0x314b5b,_0x265c02)){if(_[_0xed1d('0x5f')](this[_0xed1d('0x14')][_0x4437db])){this['variables'][_0x4437db]={};}this['variables'][_0x4437db][_0x265c02]=_0x2350f0;}};VoiceQueueReport[_0xed1d('0xb')][_0xed1d('0x25')]=function(_0x122ecf){try{if(this[_0xed1d('0x66')](_0x122ecf)){if(this['queueReports'][_0x122ecf[_0xed1d('0x6e')]]){for(var _0x4b5f7d=0x0,_0x49120e={};_0x4b5f7d=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 +var _0xcafb=['lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','inbound','queue','agent','toNumber','accountcode','uniqueid','voiceDialReport','membername','endtime','outbound','exten','dialstring','moment','lodash','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport'];(function(_0x18c271,_0x51f88a){var _0x5e8e3a=function(_0x448791){while(--_0x448791){_0x18c271['push'](_0x18c271['shift']());}};_0x5e8e3a(++_0x51f88a);}(_0xcafb,0x137));var _0xbcaf=function(_0x20cf79,_0x2e390c){_0x20cf79=_0x20cf79-0x0;var _0x19dbc0=_0xcafb[_0x20cf79];return _0x19dbc0;};'use strict';var moment=require(_0xbcaf('0x0'));var _=require(_0xbcaf('0x1'));var util=require('util');var client=require(_0xbcaf('0x2'));exports[_0xbcaf('0x3')]=function(_0x25c603){var _0x155150=_0x25c603[_0xbcaf('0x4')]||_0x25c603[_0xbcaf('0x5')];return client[_0xbcaf('0x6')](_0xbcaf('0x7'),{'body':{'channel':'voice','membername':_0x25c603[_0xbcaf('0x8')],'interface':_[_0xbcaf('0x9')](_0x25c603[_0xbcaf('0xa')])?util[_0xbcaf('0xb')](_0xbcaf('0xc'),_0x25c603[_0xbcaf('0x8')]):_0x25c603[_0xbcaf('0xa')],'type':_0xbcaf('0xd'),'enterAt':_0x25c603[_0xbcaf('0xe')],'exitAt':_0x155150,'duration':moment(_0x155150)[_0xbcaf('0xf')](_0x25c603['queuecallerleaveAt'],_0xbcaf('0x10')),'data1':_0xbcaf('0x11'),'data2':_0x25c603['calleridnum'],'data3':_0x25c603['exten'],'data4':null,'data5':_0x25c603[_0xbcaf('0x12')],'role':_0xbcaf('0x13'),'internal':_0x25c603['accountcode']?_[_0xbcaf('0x14')](_0x25c603[_0xbcaf('0x15')]):undefined,'uniqueid':_0x25c603[_0xbcaf('0x16')]},'log':'CreateMemberReport'});};exports[_0xbcaf('0x17')]=function(_0x5559d2){return client[_0xbcaf('0x6')](_0xbcaf('0x7'),{'body':{'channel':'voice','membername':_0x5559d2[_0xbcaf('0x18')],'interface':_0x5559d2[_0xbcaf('0xa')],'type':_0xbcaf('0xd'),'enterAt':_0x5559d2['starttime'],'exitAt':_0x5559d2[_0xbcaf('0x19')],'duration':moment(_0x5559d2['endtime'])[_0xbcaf('0xf')](_0x5559d2['starttime'],'seconds')>=0x0?moment(_0x5559d2[_0xbcaf('0x19')])[_0xbcaf('0xf')](_0x5559d2['starttime'],'seconds'):null,'data1':_0xbcaf('0x1a'),'data2':_0x5559d2[_0xbcaf('0x15')],'data3':_0x5559d2[_0xbcaf('0x1b')],'data4':_0x5559d2[_0xbcaf('0x1c')]||null,'role':_0xbcaf('0x13'),'internal':_0x5559d2[_0xbcaf('0x15')]?_['toNumber'](_0x5559d2['accountcode']):undefined,'uniqueid':_0x5559d2[_0xbcaf('0x16')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index e1d97a7..ca8d836 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 _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 +var _0xb6b1=['Request','GetTemplate','html','../client'];(function(_0x3508f3,_0x4945f6){var _0x620cb0=function(_0x29e643){while(--_0x29e643){_0x3508f3['push'](_0x3508f3['shift']());}};_0x620cb0(++_0x4945f6);}(_0xb6b1,0x17b));var _0x1b6b=function(_0x207811,_0x3420a6){_0x207811=_0x207811-0x0;var _0x170d56=_0xb6b1[_0x207811];return _0x170d56;};'use strict';var client=require(_0x1b6b('0x0'));exports['getTemplates']=function(_0x669faa){return function(_0x4fc13d){return client[_0x1b6b('0x1')](_0x1b6b('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0x1b6b('0x3')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 44c394a..9e4a8c6 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 _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 +var _0xdccd=['data1','data2','data3','data5','data6','../client','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','operator','value','AnyConditions','field','Action','Actions','action'];(function(_0x4550f1,_0xcb817b){var _0x5c57b3=function(_0x108159){while(--_0x108159){_0x4550f1['push'](_0x4550f1['shift']());}};_0x5c57b3(++_0xcb817b);}(_0xdccd,0x12b));var _0xddcc=function(_0x45e1c6,_0x1ef39d){_0x45e1c6=_0x45e1c6-0x0;var _0x5e52ca=_0xdccd[_0x45e1c6];return _0x5e52ca;};'use strict';var client=require(_0xddcc('0x0'));exports[_0xddcc('0x1')]=function(_0x3570cf){return function(_0x54cb2a){return client[_0xddcc('0x2')](_0xddcc('0x3'),{'options':{'raw':![],'attributes':['id',_0xddcc('0x4'),_0xddcc('0x5'),_0xddcc('0x6')],'include':[{'model':_0xddcc('0x7'),'as':_0xddcc('0x8'),'attributes':['id','field',_0xddcc('0x9'),_0xddcc('0xa')]},{'model':_0xddcc('0x7'),'as':_0xddcc('0xb'),'attributes':['id',_0xddcc('0xc'),'operator',_0xddcc('0xa')]},{'model':_0xddcc('0xd'),'as':_0xddcc('0xe'),'attributes':['id',_0xddcc('0xf'),_0xddcc('0x10'),_0xddcc('0x11'),_0xddcc('0x12'),'data4',_0xddcc('0x13'),_0xddcc('0x14'),'data7']}]},'log':_0xddcc('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 087817c..a4e606d 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 _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 +var _0xc1a2=['GetTrunk','name','registry','../client','getTrunks'];(function(_0x3f8920,_0x73187b){var _0x2c3682=function(_0x2d5295){while(--_0x2d5295){_0x3f8920['push'](_0x3f8920['shift']());}};_0x2c3682(++_0x73187b);}(_0xc1a2,0x1e3));var _0x2c1a=function(_0x2be788,_0x30582c){_0x2be788=_0x2be788-0x0;var _0x33576a=_0xc1a2[_0x2be788];return _0x33576a;};'use strict';var client=require(_0x2c1a('0x0'));exports[_0x2c1a('0x1')]=function(_0x7aa4bc){return function(_0x161a29){return client['Request'](_0x2c1a('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x2c1a('0x3'),_0x2c1a('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index e78bdf6..43f9552 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 _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 +var _0x8c31=['../client','getAgents','GetUser','agent','name','email','accountcode','fullname','online','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','savePause','Request','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x8c31,0xdc));var _0x18c3=function(_0xa2d152,_0x5555e6){_0xa2d152=_0xa2d152-0x0;var _0x3e973a=_0x8c31[_0xa2d152];return _0x3e973a;};'use strict';var client=require(_0x18c3('0x0'));exports[_0x18c3('0x1')]=function(){return function(){return client['Request'](_0x18c3('0x2'),{'options':{'raw':![],'where':{'role':_0x18c3('0x3')},'attributes':['id',_0x18c3('0x4'),_0x18c3('0x5'),_0x18c3('0x6'),_0x18c3('0x7'),_0x18c3('0x8'),'lastLoginAt',_0x18c3('0x9'),_0x18c3('0xa'),_0x18c3('0xb'),_0x18c3('0xc'),_0x18c3('0xd'),_0x18c3('0xe')]},'log':_0x18c3('0x1')});};};exports['getTelephones']=function(){return function(){return client['Request'](_0x18c3('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x18c3('0x4'),_0x18c3('0x6'),'internal']},'log':_0x18c3('0xf')});};};exports[_0x18c3('0x10')]=function(_0x4e44b3,_0x2d93be,_0x3bd619){return client[_0x18c3('0x11')]('PauseUser',{'body':{'type':_0x2d93be,'uniqueid':_0x3bd619},'options':{'where':{'id':_0x4e44b3['id']}},'log':_0x18c3('0x10')});};exports[_0x18c3('0x12')]=function(_0x2fd322){return client[_0x18c3('0x11')](_0x18c3('0x13'),{'body':{},'options':{'where':{'id':_0x2fd322['id']}},'log':'savePause'});};exports[_0x18c3('0x14')]=function(_0x5f184a){return client[_0x18c3('0x11')](_0x18c3('0x15'),{'options':{'raw':![],'where':{'role':_0x18c3('0x3'),'id':_0x5f184a},'attributes':['id','name',_0x18c3('0x5'),'accountcode',_0x18c3('0x7'),_0x18c3('0x8'),'lastLoginAt',_0x18c3('0x9'),'lastPauseAt',_0x18c3('0xb'),'interface']},'log':_0x18c3('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index ded5621..e965e13 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 _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 +var _0x613c=['update','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x5a3e85,_0x1c6294){var _0x1e1021=function(_0x496e11){while(--_0x496e11){_0x5a3e85['push'](_0x5a3e85['shift']());}};_0x1e1021(++_0x1c6294);}(_0x613c,0xd9));var _0xc613=function(_0xb1362b,_0x571fcd){_0xb1362b=_0xb1362b-0x0;var _0x50507b=_0x613c[_0xb1362b];return _0x50507b;};'use strict';var client=require(_0xc613('0x0'));exports[_0xc613('0x1')]=function(_0x51361d){return client[_0xc613('0x2')]('CreateVoiceAgentReport',{'body':_0x51361d,'log':'CreateVoiceAgentReport'});};exports[_0xc613('0x3')]=function(_0x23ca9b,_0x377732,_0x1e33a2){return client['Request'](_0xc613('0x4'),{'body':_0x23ca9b,'options':{'where':{'uniqueid':_0x377732,'interface':_0x1e33a2,'agentcomplete':!![]}},'log':_0xc613('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 5df7b8c..d349570 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 _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 +var _0x34b7=['Request','CreateVoiceCallReport','merge','calleridnum','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','disposition','moment','util','lodash','../client'];(function(_0xd9d38e,_0x3c90ef){var _0x376fc0=function(_0x7e9cef){while(--_0x7e9cef){_0xd9d38e['push'](_0xd9d38e['shift']());}};_0x376fc0(++_0x3c90ef);}(_0x34b7,0x16c));var _0x734b=function(_0x146edd,_0x2be255){_0x146edd=_0x146edd-0x0;var _0x46079b=_0x34b7[_0x146edd];return _0x46079b;};'use strict';var moment=require(_0x734b('0x0'));var util=require(_0x734b('0x1'));var _=require(_0x734b('0x2'));var client=require(_0x734b('0x3'));exports['create']=function(_0x397708){return client[_0x734b('0x4')](_0x734b('0x5'),{'body':_[_0x734b('0x6')](_0x397708,{'source':_0x397708[_0x734b('0x7')],'destinationcontext':_0x397708['context'],'callerid':_0x397708['callerid'],'amaflags':_0x734b('0x8')}),'log':_0x734b('0x5')});};exports[_0x734b('0x9')]=function(){return function(){return client['Request'](_0x734b('0xa'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x734b('0xb')](_0x734b('0xc'))[_0x734b('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0x734b('0xc'))[_0x734b('0xd')](_0x734b('0xe'))]}},'attributes':['type',_0x734b('0xf'),'duration','billableseconds']},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 9354587..e69d294 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 _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 +var _0x9450=['CreateVoiceDialReport','../client','create','Request'];(function(_0x4c8a8f,_0x997ef){var _0x404500=function(_0x1c6072){while(--_0x1c6072){_0x4c8a8f['push'](_0x4c8a8f['shift']());}};_0x404500(++_0x997ef);}(_0x9450,0xed));var _0x0945=function(_0x910e82,_0x560fcc){_0x910e82=_0x910e82-0x0;var _0x4fb7a9=_0x9450[_0x910e82];return _0x4fb7a9;};'use strict';var client=require(_0x0945('0x0'));exports[_0x0945('0x1')]=function(_0x4c30d3){return client[_0x0945('0x2')](_0x0945('0x3'),{'body':_0x4c30d3,'log':_0x0945('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 6f0c0e9..1ccbd3e 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 _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 +var _0x47fd=['Request','GetVoiceExtension','exten','recordingFormat','../client','getVoiceExtensions'];(function(_0x47242d,_0x13f993){var _0x30273a=function(_0x322cd2){while(--_0x322cd2){_0x47242d['push'](_0x47242d['shift']());}};_0x30273a(++_0x13f993);}(_0x47fd,0x13c));var _0xd47f=function(_0x3a0dbc,_0x52e9c2){_0x3a0dbc=_0x3a0dbc-0x0;var _0x2b9ea3=_0x47fd[_0x3a0dbc];return _0x2b9ea3;};'use strict';var client=require(_0xd47f('0x0'));exports[_0xd47f('0x1')]=function(){return function(){return client[_0xd47f('0x2')](_0xd47f('0x3'),{'options':{'raw':!![],'attributes':['id',_0xd47f('0x4'),_0xd47f('0x5')],'where':{'VoiceExtensionId':null}},'log':_0xd47f('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 69fce3b..6987fa0 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 _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 +var _0x486d=['dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','active','callerid','Interval','name','interval','getVoiceQueues','GetVoiceQueue','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPowerLevel'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x486d,0xdd));var _0xd486=function(_0x49e134,_0x2c789f){_0x49e134=_0x49e134-0x0;var _0x13ff4d=_0x486d[_0x49e134];return _0x13ff4d;};'use strict';var client=require('../client');exports[_0xd486('0x0')]=function(){return function(){return client['Request'](_0xd486('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xd486('0x2'),_0xd486('0x3'),_0xd486('0x4'),_0xd486('0x5'),_0xd486('0x6'),_0xd486('0x7'),_0xd486('0x8'),'dialLimitChannel',_0xd486('0x9'),_0xd486('0xa'),'dialPredictiveOptimization',_0xd486('0xb'),_0xd486('0xc'),_0xd486('0xd'),_0xd486('0xe'),_0xd486('0xf'),'dialQueueOptions',_0xd486('0x10'),'dialQueueProject',_0xd486('0x11'),_0xd486('0x12'),_0xd486('0x13'),_0xd486('0x14'),_0xd486('0x15'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone',_0xd486('0x16'),_0xd486('0x17'),_0xd486('0x18'),_0xd486('0x19'),_0xd486('0x1a'),_0xd486('0x1b'),_0xd486('0x1c'),_0xd486('0x1d'),'dialAMDMinWordLength','dialAMDBetweenWordsSilence',_0xd486('0x1e'),_0xd486('0x1f'),'dialAMDMaximumWordLength',_0xd486('0x20'),_0xd486('0x21'),_0xd486('0x22'),_0xd486('0x23'),_0xd486('0x24'),_0xd486('0x25'),_0xd486('0x26'),_0xd486('0x5'),_0xd486('0x27'),_0xd486('0x28'),_0xd486('0x29'),_0xd486('0x2a'),_0xd486('0x2b'),_0xd486('0x2c'),'dialDropRetryFrequency',_0xd486('0x2d'),_0xd486('0x2e'),_0xd486('0x2f'),_0xd486('0x30'),_0xd486('0x31'),'dialAgentRejectRetryFrequency',_0xd486('0x32'),_0xd486('0x33'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':_0xd486('0x34'),'as':_0xd486('0x34'),'attributes':['id','name','callerid',_0xd486('0x35')]},{'model':'Pause','as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0xd486('0x34'),'as':'TrunkBackup','attributes':['id','name',_0xd486('0x36'),'active']},{'model':_0xd486('0x37'),'as':_0xd486('0x37'),'attributes':['id',_0xd486('0x38')],'include':[{'model':_0xd486('0x37'),'as':'Intervals','attributes':['id','name',_0xd486('0x39')]}]}]},'log':_0xd486('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index b736e3f..d2c49a8 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 _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 +var _0x0b1b=['queuecallerexitAt','queuecallerabandonAt','GetVoiceQueueReports','moment','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x0b1b,0x6f));var _0xb0b1=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x0b1b[_0x1da527];return _0x40fc7c;};'use strict';var moment=require(_0xb0b1('0x0'));var _=require('lodash');var client=require('../client');exports[_0xb0b1('0x1')]=function(_0x289b4d){return client[_0xb0b1('0x2')](_0xb0b1('0x3'),{'body':_0x289b4d,'log':_0xb0b1('0x3')});};exports[_0xb0b1('0x4')]=function(){return function(){return client['Request']('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0xb0b1('0x5')]('day')[_0xb0b1('0x6')](_0xb0b1('0x7')),moment()[_0xb0b1('0x8')]('day')['format'](_0xb0b1('0x7'))]}},'attributes':['uniqueid',_0xb0b1('0x9'),_0xb0b1('0xa'),_0xb0b1('0xb'),_0xb0b1('0xc'),_0xb0b1('0xd'),_0xb0b1('0xe'),_0xb0b1('0xf'),'queuecallerabandon',_0xb0b1('0x10')]},'log':_0xb0b1('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 683a440..20372d5 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 _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 +var _0xbddd=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x2a6880,_0xc4f0d8){var _0x391945=function(_0x135df8){while(--_0x135df8){_0x2a6880['push'](_0x2a6880['shift']());}};_0x391945(++_0xc4f0d8);}(_0xbddd,0x1e8));var _0xdbdd=function(_0x571991,_0x349e23){_0x571991=_0x571991-0x0;var _0xe90fd9=_0xbddd[_0x571991];return _0xe90fd9;};'use strict';var client=require(_0xdbdd('0x0'));exports[_0xdbdd('0x1')]=function(_0x5d698d){return function(){return client[_0xdbdd('0x2')](_0xdbdd('0x3'),{'options':{'where':{'VoiceQueueId':_0x5d698d,'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 6c2bc3d..c821ad9 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 _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 +var _0xf2c8=['lodash','../client','Request','CreateVoiceRecording','merge','monitorFilename'];(function(_0x55b588,_0x406c55){var _0xc1a320=function(_0x5a7b43){while(--_0x5a7b43){_0x55b588['push'](_0x55b588['shift']());}};_0xc1a320(++_0x406c55);}(_0xf2c8,0x13e));var _0x8f2c=function(_0x2878fc,_0x1cb098){_0x2878fc=_0x2878fc-0x0;var _0x1a1acd=_0xf2c8[_0x2878fc];return _0x1a1acd;};'use strict';var _=require(_0x8f2c('0x0'));var client=require(_0x8f2c('0x1'));exports['create']=function(_0x55ce4f){return client[_0x8f2c('0x2')](_0x8f2c('0x3'),{'body':_[_0x8f2c('0x4')](_0x55ce4f,{'value':_0x55ce4f[_0x8f2c('0x5')]}),'log':_0x8f2c('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 39b19ad..3fc909f 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 _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 +var _0x9323=['secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','attendedTransfer','Request','result','origtransfererchannel','origtransferercalleridname'];(function(_0x4efe5a,_0x42fd6f){var _0x1a5cf1=function(_0x233e46){while(--_0x233e46){_0x4efe5a['push'](_0x4efe5a['shift']());}};_0x1a5cf1(++_0x42fd6f);}(_0x9323,0xd0));var _0x3932=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x9323[_0x4e676e];return _0x336a3c;};'use strict';var client=require(_0x3932('0x0'));exports[_0x3932('0x1')]=function(_0x2b8ff1){return client['Request'](_0x3932('0x2'),{'body':{'result':_0x2b8ff1['result'],'transfererchannel':_0x2b8ff1[_0x3932('0x3')],'transferercalleridnum':_0x2b8ff1[_0x3932('0x4')],'transferercalleridname':_0x2b8ff1[_0x3932('0x5')],'transfererconnectedlinenum':_0x2b8ff1[_0x3932('0x6')],'transfererconnectedlinename':_0x2b8ff1[_0x3932('0x7')],'transfereraccountcode':_0x2b8ff1[_0x3932('0x8')],'transferercontext':_0x2b8ff1[_0x3932('0x9')],'transfererexten':_0x2b8ff1[_0x3932('0xa')],'transfererlinkedid':_0x2b8ff1[_0x3932('0xb')],'transfereechannel':_0x2b8ff1['transfereechannel'],'transfereecalleridnum':_0x2b8ff1[_0x3932('0xc')],'transfereecalleridname':_0x2b8ff1[_0x3932('0xd')],'transfereeconnectedlinenum':_0x2b8ff1['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x2b8ff1['transfereeconnectedlinename'],'transfereeaccountcode':_0x2b8ff1[_0x3932('0xe')],'transfereecontext':_0x2b8ff1[_0x3932('0xf')],'transfereeexten':_0x2b8ff1[_0x3932('0x10')],'transfereelinkedid':_0x2b8ff1[_0x3932('0x11')],'isexternal':_0x2b8ff1[_0x3932('0x12')],'context':_0x2b8ff1[_0x3932('0x13')],'extension':_0x2b8ff1[_0x3932('0x14')],'type':'blind'},'log':_0x3932('0x2')});};exports[_0x3932('0x15')]=function(_0x2f5fa9){return client[_0x3932('0x16')]('CreateVoiceTransferReport',{'body':{'result':_0x2f5fa9[_0x3932('0x17')],'transfererchannel':_0x2f5fa9[_0x3932('0x18')],'transferercalleridnum':_0x2f5fa9['origtransferercalleridnum'],'transferercalleridname':_0x2f5fa9[_0x3932('0x19')],'transfererconnectedlinenum':_0x2f5fa9['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x2f5fa9[_0x3932('0x1a')],'transfereraccountcode':_0x2f5fa9[_0x3932('0x1b')],'transferercontext':_0x2f5fa9[_0x3932('0x1c')],'transfererexten':_0x2f5fa9[_0x3932('0x1d')],'transfererlinkedid':_0x2f5fa9['origtransfererlinkedid'],'transfereechannel':_0x2f5fa9['transfertargetchannel'],'transfereecalleridnum':_0x2f5fa9['transfertargetcalleridnum'],'transfereecalleridname':_0x2f5fa9[_0x3932('0x1e')],'transfereeconnectedlinenum':_0x2f5fa9[_0x3932('0x1f')],'transfereeconnectedlinename':_0x2f5fa9[_0x3932('0x20')],'transfereeaccountcode':_0x2f5fa9['transfertargetaccountcode'],'transfereecontext':_0x2f5fa9[_0x3932('0x21')],'transfereeexten':_0x2f5fa9[_0x3932('0x22')],'transfereelinkedid':_0x2f5fa9[_0x3932('0x23')],'isexternal':_0x2f5fa9[_0x3932('0x12')],'context':_0x2f5fa9[_0x3932('0x24')],'extension':_0x2f5fa9[_0x3932('0x25')],'type':_0x3932('0x26')},'log':_0x3932('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 324ea68..019e355 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 _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 +var _0x9923=['predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','startPredictive','startProgressive','Trunk','callerid','Interval','length','values','channels','voicechannel','uniqueid','channel','filename','wav','MixMonitor','ai(mixmonitorid)','find','monitors','toLowerCase','isNil','push','/var/spool/asterisk/monitor/','rec','status','mixmonitorid','resolve','destinationchannel','StopMixMonitor','%s.%s','stop','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicequeuechannel','map','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','trunks','campaigns','run','event','Event\x20name\x20mandatory','emit','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','bluebird','moment','../../../config/environment','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','username','ami\x20disconnected','join','pick','keys','module','Reload','then','catch','message','error','command','action','Command','Action','content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','talking','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate'];(function(_0x502ca3,_0x36be36){var _0x27f42c=function(_0x1e3045){while(--_0x1e3045){_0x502ca3['push'](_0x502ca3['shift']());}};_0x27f42c(++_0x36be36);}(_0x9923,0x150));var _0x3992=function(_0x31bbf7,_0x292c9a){_0x31bbf7=_0x31bbf7-0x0;var _0x1469f3=_0x9923[_0x31bbf7];return _0x1469f3;};'use strict';var _=require(_0x3992('0x0'));var util=require('util');var jayson=require(_0x3992('0x1'));var schema=require(_0x3992('0x2'));var BPromise=require(_0x3992('0x3'));var moment=require(_0x3992('0x4'));var config=require(_0x3992('0x5'));var properties=require('../properties');var ami=require('../ami');exports[_0x3992('0x6')]=function(_0x5e5524,_0x524a02,_0x5ea3a7){return new BPromise(function(_0x2f3689,_0xb6d6a7){var _0x1cf5a8={'QueuePause':function(_0x1afff8){return new Promise(function(_0x1d0823,_0x6c4e80){var _0x4c1d55=util[_0x3992('0x7')](_0x3992('0x8'),_0x3992('0x9'),_0x1afff8[_0x3992('0xa')]);if(_0x5e5524[_0x3992('0xb')]&&_0x5e5524['timers'][_0x4c1d55]&&_0x5e5524[_0x3992('0xb')][_0x4c1d55][_0x3992('0xc')]){_0x5e5524[_0x3992('0xb')][_0x4c1d55][_0x3992('0xd')]();}if(_0x5e5524['agents'][_0x4c1d55]){_0x5e5524[_0x3992('0xe')][_0x4c1d55][_0x3992('0xf')]({'statePause':_0x1afff8[_0x3992('0x10')]?!![]:![]});}_0x1d0823({'code':0xc8,'message':_0x3992('0x11')});});},'Reload':function(_0x168766){var _0x261d72=this;return new Promise(function(_0x55d288,_0x1a78b3){if(ami[_0x3992('0x12')]()==![]){return _0x1a78b3(_0x261d72['error'](0x1f4,[config['asterisk']['ip'],config[_0x3992('0x13')][_0x3992('0x14')],_0x3992('0x15')][_0x3992('0x16')]('\x20')));}_0x168766=_[_0x3992('0x17')](_0x168766,_[_0x3992('0x18')](properties[_0x3992('0x19')]));_0x168766['action']=_0x3992('0x1a');return ami['Action'](_0x168766)[_0x3992('0x1b')](function(_0x387691){_0x55d288({'code':0xc8,'message':_0x387691['message']});})[_0x3992('0x1c')](function(_0xceaabf){_0x1a78b3(_0x261d72['error'](0x1f5,_0xceaabf[_0x3992('0x1d')]));});});},'Command':function(_0x98857f){var _0x9460dd=this;return new Promise(function(_0x3ec1ea,_0x3a5aae){if(ami['isConnected']()==![]){return _0x3a5aae(_0x9460dd[_0x3992('0x1e')](0x1f4,[config[_0x3992('0x13')]['ip'],config[_0x3992('0x13')][_0x3992('0x14')],_0x3992('0x15')]['join']('\x20')));}_0x98857f=_['pick'](_0x98857f,_0x3992('0x1f'));_0x98857f[_0x3992('0x20')]=_0x3992('0x21');return ami[_0x3992('0x22')](_0x98857f)[_0x3992('0x1b')](function(_0x800721){_0x3ec1ea({'code':0xc8,'message':_0x800721[_0x3992('0x23')]});})['catch'](function(_0xa55d8c){_0x3a5aae(_0x9460dd['error'](0x1f5,_0xa55d8c[_0x3992('0x1d')]));});});},'VoiceQueues':function(_0x1bef86){return new Promise(function(_0x2217aa,_0xfbb708){var _0x959c41=[];for(var _0xddfd7e in _0x5e5524[_0x3992('0x24')]){if(_0x5e5524['voiceQueues'][_0x3992('0x25')](_0xddfd7e)){var _0x52b27c=_0x5e5524[_0x3992('0x24')][_0xddfd7e];var _0x3a535a={'id':_0x52b27c['id'],'name':_0x52b27c[_0x3992('0xa')],'strategy':_0x52b27c[_0x3992('0x26')],'answered':_0x52b27c[_0x3992('0x27')],'available':_0x52b27c[_0x3992('0x28')],'loggedIn':_0x52b27c[_0x3992('0x29')],'pTalking':_0x52b27c[_0x3992('0x2a')],'sumBillable':_0x52b27c[_0x3992('0x2b')],'sumDuration':_0x52b27c[_0x3992('0x2c')],'sumHoldTime':_0x52b27c['sumHoldTime']||0x0,'talking':_0x52b27c[_0x3992('0x2d')],'total':_0x52b27c['total'],'type':_0x52b27c[_0x3992('0x2e')],'unmanaged':_0x52b27c[_0x3992('0x2f')],'abandoned':_0x52b27c[_0x3992('0x30')],'waiting':_0x52b27c[_0x3992('0x31')],'loggedInDb':_0x52b27c[_0x3992('0x32')]};if(_0x52b27c[_0x3992('0x2e')]===_0x3992('0x33')){_0x3a535a['dialActive']=_0x52b27c['dialActive'];_0x3a535a[_0x3992('0x34')]=_0x52b27c[_0x3992('0x34')];_0x3a535a[_0x3992('0x35')]=_0x52b27c[_0x3992('0x35')];_0x3a535a[_0x3992('0x36')]=_0x52b27c[_0x3992('0x36')];_0x3a535a[_0x3992('0x37')]=_0x52b27c['dialOriginateTimeout'];_0x3a535a['dialPrefix']=_0x52b27c[_0x3992('0x38')];_0x3a535a['outboundAnswerAgiCallsDay']=_0x52b27c[_0x3992('0x39')];_0x3a535a[_0x3992('0x3a')]=_0x52b27c[_0x3992('0x3a')];_0x3a535a[_0x3992('0x3b')]=_0x52b27c[_0x3992('0x3b')];_0x3a535a['outboundBusyCallsDay']=_0x52b27c[_0x3992('0x3c')];_0x3a535a['outboundCongestionCallsDay']=_0x52b27c[_0x3992('0x3d')];_0x3a535a[_0x3992('0x3e')]=_0x52b27c['outboundDropCallsDayACS'];_0x3a535a[_0x3992('0x3f')]=_0x52b27c[_0x3992('0x3f')];_0x3a535a[_0x3992('0x40')]=_0x52b27c[_0x3992('0x40')];_0x3a535a[_0x3992('0x41')]=_0x52b27c[_0x3992('0x41')];_0x3a535a['outboundNoSuchCallsDay']=_0x52b27c[_0x3992('0x42')];_0x3a535a['outboundOriginateFailureCallsDay']=_0x52b27c['outboundOriginateFailureCallsDay'];_0x3a535a[_0x3992('0x43')]=_0x52b27c['outboundReCallsDay'];_0x3a535a[_0x3992('0x44')]=_0x52b27c[_0x3992('0x44')];_0x3a535a[_0x3992('0x45')]=_0x52b27c['outboundUnknownCallsDay'];_0x3a535a[_0x3992('0x46')]=_0x52b27c[_0x3992('0x46')];_0x3a535a[_0x3992('0x47')]=_0x52b27c[_0x3992('0x47')];_0x3a535a[_0x3992('0x48')]=_0x52b27c[_0x3992('0x48')];_0x3a535a[_0x3992('0x49')]=_0x52b27c[_0x3992('0x49')];_0x3a535a[_0x3992('0x4a')]=_0x52b27c[_0x3992('0x4a')];_0x3a535a[_0x3992('0x4b')]=_0x52b27c[_0x3992('0x4b')];_0x3a535a[_0x3992('0x4c')]=_0x52b27c['predictiveIntervalErlangCallsDroppedCalls'];_0x3a535a[_0x3992('0x4d')]=_0x52b27c[_0x3992('0x4d')];_0x3a535a[_0x3992('0x4e')]=_0x52b27c[_0x3992('0x4e')];_0x3a535a[_0x3992('0x4f')]=_0x52b27c[_0x3992('0x4f')];_0x3a535a[_0x3992('0x50')]=_0x52b27c[_0x3992('0x50')];_0x3a535a[_0x3992('0x51')]=_0x52b27c[_0x3992('0x51')];_0x3a535a[_0x3992('0x1d')]=_0x52b27c[_0x3992('0x1d')];_0x3a535a[_0x3992('0x52')]=_0x52b27c[_0x3992('0x52')];_0x3a535a[_0x3992('0x53')]=_0x52b27c['erlangCalls'];_0x3a535a[_0x3992('0x54')]=_0x52b27c[_0x3992('0x54')];_0x3a535a['erlangAbandonmentRate']=_0x52b27c['erlangAbandonmentRate'];_0x3a535a['erlangBusyFactor']=_0x52b27c['erlangBusyFactor'];_0x3a535a[_0x3992('0x55')]=_0x52b27c['startPredictive'];_0x3a535a['startProgressive']=_0x52b27c[_0x3992('0x56')];}if(_0x52b27c[_0x3992('0x57')]){_0x3a535a[_0x3992('0x57')]={'id':_0x52b27c[_0x3992('0x57')]['id'],'name':_0x52b27c[_0x3992('0x57')][_0x3992('0xa')],'active':_0x52b27c[_0x3992('0x57')]['active'],'callerid':_0x52b27c[_0x3992('0x57')][_0x3992('0x58')]};}if(_0x52b27c[_0x3992('0x59')]){_0x3a535a['Interval']={'id':_0x52b27c[_0x3992('0x59')]['id'],'name':_0x52b27c[_0x3992('0x59')][_0x3992('0xa')]};}_0x959c41['push'](_0x3a535a);}}_0x2217aa({'count':_0x959c41[_0x3992('0x5a')],'rows':_0x959c41});});},'VoiceChannels':function(_0x5b1bb6){return new Promise(function(_0x42d54a,_0x2baec0){var _0x47b8c6=_[_0x3992('0x5b')](_0x5e5524[_0x3992('0x5c')]);_0x42d54a({'count':_0x47b8c6[_0x3992('0x5a')],'rows':_0x47b8c6});});},'VoiceChannelMixMonitor':function(_0x333f66){var _0x322ab2=this;return new Promise(function(_0x470da6,_0x50f1e5){if(ami[_0x3992('0x12')]()==![]){return _0x50f1e5(_0x322ab2[_0x3992('0x1e')](0x1f4,[config['asterisk']['ip'],config[_0x3992('0x13')][_0x3992('0x14')],_0x3992('0x15')][_0x3992('0x16')]('\x20')));}var _0x117106=schema(properties[_0x3992('0x5d')])['validate'](_0x333f66);if(_0x117106[_0x3992('0x5a')]>0x0){return _0x50f1e5(_0x322ab2[_0x3992('0x1e')](0x1f4,_['map'](_0x117106,_0x3992('0x1d'))['join'](',\x20')));}var _0x5d9c01=_['find'](_0x5e5524[_0x3992('0x5c')],{'uniqueid':_0x333f66[_0x3992('0x5e')]});if(_0x5d9c01&&_0x5d9c01[_0x3992('0x5f')]){var _0x3bd0d3=util[_0x3992('0x7')]('%s.%s',_0x333f66[_0x3992('0x60')]||_0x333f66[_0x3992('0x5e')],_0x333f66[_0x3992('0x7')]||_0x3992('0x61'));return ami[_0x3992('0x22')]({'action':_0x3992('0x62'),'channel':_0x5d9c01[_0x3992('0x5f')],'file':_0x3bd0d3,'options':_0x3992('0x63')})[_0x3992('0x1b')](function(_0x5cc380){var _0xa69939=_[_0x3992('0x64')](_0x5d9c01[_0x3992('0x65')],{'filename':'/var/spool/asterisk/monitor/'+_0x3bd0d3[_0x3992('0x66')]()});if(_[_0x3992('0x67')](_0xa69939)){_0x5d9c01[_0x3992('0x65')][_0x3992('0x68')]({'filename':_0x3992('0x69')+_0x3bd0d3[_0x3992('0x66')](),'createdAt':moment()[_0x3992('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x5cc380['mixmonitorid'],'status':_0x3992('0x6a')});}else{_0xa69939['mixmonitorid']=_0x5cc380['mixmonitorid'];_0xa69939[_0x3992('0x6b')]=_0x3992('0x6a');}_0x470da6({'code':0xc8,'message':[_0x333f66[_0x3992('0x5e')],'MixMonitor\x20Success',_0x5cc380[_0x3992('0x6c')]]['join']('\x20'),'mixmonitorid':_0x5cc380[_0x3992('0x6c')]});})[_0x3992('0x1c')](function(_0x2a5839){_0x50f1e5(_0x322ab2[_0x3992('0x1e')](0x1f5,[_0x333f66[_0x3992('0x5e')],_0x2a5839['message'][_0x3992('0x66')]()][_0x3992('0x16')]('\x20')));});}else{return _0x50f1e5(_0x322ab2[_0x3992('0x1e')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x3362ed){var _0x243b24=this;return new Promise(function(_0x2f379f,_0x335b2f){if(ami['isConnected']()==![]){return _0x335b2f(_0x243b24[_0x3992('0x1e')](0x1f4,[config[_0x3992('0x13')]['ip'],config['asterisk'][_0x3992('0x14')],_0x3992('0x15')][_0x3992('0x16')]('\x20')));}var _0x17ea47=schema(properties[_0x3992('0x5d')])[_0x3992('0x2')](_0x3362ed);if(_0x17ea47[_0x3992('0x5a')]>0x0){return _0x335b2f(_0x243b24[_0x3992('0x1e')](0x1f4,_['map'](_0x17ea47,_0x3992('0x1d'))[_0x3992('0x16')](',\x20')));}var _0x9090a9=_['find'](_0x5e5524[_0x3992('0x5c')],{'uniqueid':_0x3362ed[_0x3992('0x5e')]});if(_0x9090a9){return BPromise[_0x3992('0x6d')]()['then'](function(){if(_0x9090a9['channel']){return ami[_0x3992('0x22')]({'action':'StopMixMonitor','channel':_0x9090a9[_0x3992('0x5f')],'mixmonitorid':_0x3362ed[_0x3992('0x6c')]})[_0x3992('0x1c')](function(_0x532051){});}})[_0x3992('0x1b')](function(){if(_0x9090a9[_0x3992('0x6e')]){return ami[_0x3992('0x22')]({'action':_0x3992('0x6f'),'channel':_0x9090a9[_0x3992('0x6e')],'mixmonitorid':_0x3362ed[_0x3992('0x6c')]})[_0x3992('0x1c')](function(_0x290285){});}})[_0x3992('0x1b')](function(_0x4a7ff1){var _0x468964=_['find'](_0x9090a9[_0x3992('0x65')],{'mixmonitorid':_0x3362ed['mixmonitorid']});if(_0x468964){_0x468964[_0x3992('0x6b')]='stop';}})[_0x3992('0x1b')](function(){var _0x263417=util[_0x3992('0x7')](_0x3992('0x70'),_0x3362ed[_0x3992('0x60')]||_0x3362ed[_0x3992('0x5e')],_0x3362ed[_0x3992('0x7')]||_0x3992('0x61'));var _0x5af13f=_[_0x3992('0x64')](_0x9090a9[_0x3992('0x65')],{'filename':'/var/spool/asterisk/monitor/'+_0x263417[_0x3992('0x66')]()});if(_0x5af13f){_0x5af13f[_0x3992('0x6b')]=_0x3992('0x71');}})['then'](function(){_0x2f379f({'code':0xc8,'message':[_0x3362ed[_0x3992('0x5e')],_0x3992('0x72')][_0x3992('0x16')]('\x20')});})['catch'](function(_0x424a73){_0x335b2f(_0x243b24[_0x3992('0x1e')](0x1f5,[_0x3362ed['uniqueid'],_0x424a73['message'][_0x3992('0x66')]()][_0x3992('0x16')]('\x20')));});}else{return _0x335b2f(_0x243b24[_0x3992('0x1e')](0x1f5,_0x3992('0x73')));}});},'VoiceQueuesChannels':function(_0x30058d){return new Promise(function(_0x749692,_0x2cd7d6){var _0x183e70=_[_0x3992('0x5b')](_0x5e5524['queueChannels']);_0x749692({'count':_0x183e70[_0x3992('0x5a')],'rows':_0x183e70});});},'VoiceQueuesChannel':function(_0x5dc2b5){var _0x55fcb0=this;return new Promise(function(_0x37f0da,_0x4ba780){var _0x5636c0=schema(properties[_0x3992('0x74')])['validate'](_0x5dc2b5);if(_0x5636c0[_0x3992('0x5a')]>0x0){return _0x4ba780(_0x55fcb0['error'](0x1f4,_[_0x3992('0x75')](_0x5636c0,'message')[_0x3992('0x16')](',\x20')));}var _0x4ad53a=_[_0x3992('0x64')](_0x5e5524['queueChannels'],{'uniqueid':_0x5dc2b5[_0x3992('0x5e')]});if(_0x4ad53a){_0x37f0da(_0x4ad53a);}else{return _0x4ba780(_0x55fcb0[_0x3992('0x1e')](0x1f5,_0x3992('0x73')));}});},'VoiceQueuesChannelHangup':function(_0x17739f){var _0x1189b1=this;return new Promise(function(_0x4c51b1,_0xe65042){if(ami['isConnected']()==![]){return _0xe65042(_0x1189b1[_0x3992('0x1e')](0x1f4,[config['asterisk']['ip'],config[_0x3992('0x13')][_0x3992('0x14')],_0x3992('0x15')]['join']('\x20')));}var _0xfa35c4=schema(properties[_0x3992('0x76')])[_0x3992('0x2')](_0x17739f);if(_0xfa35c4[_0x3992('0x5a')]>0x0){return _0xe65042(_0x1189b1[_0x3992('0x1e')](0x1f4,_['map'](_0xfa35c4,_0x3992('0x1d'))['join'](',\x20')));}var _0x420f46=_[_0x3992('0x64')](_0x5e5524['queueChannels'],{'uniqueid':_0x17739f[_0x3992('0x5e')]});if(_0x420f46&&_0x420f46[_0x3992('0x5f')]){return ami[_0x3992('0x22')]({'action':_0x3992('0x77'),'channel':_0x420f46['channel']})[_0x3992('0x1b')](function(_0xaa5fc8){_0x4c51b1({'code':0xc8,'message':[_0x17739f['uniqueid'],_0xaa5fc8[_0x3992('0x1d')][_0x3992('0x66')]()][_0x3992('0x16')]('\x20')});})[_0x3992('0x1c')](function(_0x58ce2f){_0xe65042(_0x1189b1[_0x3992('0x1e')](0x1f5,[_0x17739f[_0x3992('0x5e')],_0x58ce2f[_0x3992('0x1d')][_0x3992('0x66')]()][_0x3992('0x16')]('\x20')));});}else{return _0xe65042(_0x1189b1[_0x3992('0x1e')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x18d15f){var _0x545a3d=this;return new Promise(function(_0x54dfcd,_0x4d0ba6){if(ami['isConnected']()==![]){return _0x4d0ba6(_0x545a3d['error'](0x1f4,[config[_0x3992('0x13')]['ip'],config[_0x3992('0x13')][_0x3992('0x14')],_0x3992('0x15')][_0x3992('0x16')]('\x20')));}var _0x147ba2=schema(properties[_0x3992('0x78')])[_0x3992('0x2')](_0x18d15f);if(_0x147ba2[_0x3992('0x5a')]>0x0){return _0x4d0ba6(_0x545a3d[_0x3992('0x1e')](0x1f4,_[_0x3992('0x75')](_0x147ba2,'message')[_0x3992('0x16')](',\x20')));}var _0x4849e2=_[_0x3992('0x64')](_0x5e5524['queueChannels'],{'uniqueid':_0x18d15f['uniqueid']});if(_0x4849e2&&_0x4849e2['channel']){return ami['Action']({'action':_0x3992('0x79'),'channel':_0x4849e2[_0x3992('0x5f')],'exten':_0x18d15f[_0x3992('0x7a')],'context':_0x18d15f[_0x3992('0x7b')]||_0x4849e2['context'],'priority':0x1})[_0x3992('0x1b')](function(_0x15dcd6){_0x54dfcd({'code':0xc8,'message':[_0x18d15f['uniqueid'],_0x15dcd6[_0x3992('0x1d')]['toLowerCase']()][_0x3992('0x16')]('\x20')});})[_0x3992('0x1c')](function(_0x9d1751){_0x4d0ba6(_0x545a3d[_0x3992('0x1e')](0x1f5,[_0x18d15f['uniqueid'],_0x9d1751['message'][_0x3992('0x66')]()]['join']('\x20')));});}else{return _0x4d0ba6(_0x545a3d[_0x3992('0x1e')](0x1f5,_0x3992('0x73')));}});},'Agents':function(_0x4665f9){return new Promise(function(_0x4e05e8,_0x3d3f69){var _0x3df1fa=_[_0x3992('0x5b')](_0x5e5524[_0x3992('0xe')]);_0x4e05e8({'count':_0x3df1fa[_0x3992('0x5a')],'rows':_0x3df1fa});});},'Telephones':function(_0x32b333){return new Promise(function(_0x100f2d,_0x5adaed){var _0x5a6ddc=_['values'](_0x5e5524['telephones']);_0x100f2d({'count':_0x5a6ddc['length'],'rows':_0x5a6ddc});});},'Trunks':function(_0x2c7986){return new Promise(function(_0x31d3ea,_0x29f65f){var _0x26cd07=_[_0x3992('0x5b')](_0x5e5524[_0x3992('0x7c')]);_0x31d3ea({'count':_0x26cd07['length'],'rows':_0x26cd07});});},'OutboundChannels':function(_0x3b1cf1){return new Promise(function(_0x59bc30,_0x10695f){var _0x2189da=_[_0x3992('0x5b')](_0x5e5524['outboundChannels']);_0x59bc30({'count':_0x2189da[_0x3992('0x5a')],'rows':_0x2189da});});},'Outbound':function(_0x23ab83){return new Promise(function(_0x2a92ba,_0x542f84){_0x2a92ba(_0x5e5524['outbound']);});},'Campaigns':function(_0x4a06f4){return new Promise(function(_0xcb34c2,_0x28d4cf){var _0x34521d=_[_0x3992('0x5b')](_0x5e5524[_0x3992('0x7d')]);_0xcb34c2({'count':_0x34521d['length'],'rows':_0x34521d});});},'VoiceQueuesPreview':function(_0x4ac26f){var _0x2a0f99=this;return new Promise(function(_0x3837cf,_0x4fa32b){_0x524a02[_0x3992('0x7e')](_0x4ac26f['id'])[_0x3992('0x1b')](function(_0xdfc72d){_0x3837cf({'code':0xc8,'message':_0xdfc72d['message']});})[_0x3992('0x1c')](function(_0x2fa17e){_0x4fa32b(_0x2a0f99['error'](0x1f4,_0x2fa17e['message']));});});},'EventManager':function(_0x2f19ac){var _0x510534=this;return new Promise(function(_0x92239c,_0x570adb){if(!_0x2f19ac[_0x3992('0x7f')]){return _0x570adb(_0x510534[_0x3992('0x1e')](0x1f4,_0x3992('0x80')));}ami[_0x3992('0x81')]('custom:'+_0x2f19ac[_0x3992('0x7f')],_0x2f19ac[_0x3992('0x1d')]);_0x92239c({'code':0xc8,'message':_0x2f19ac});});},'FaxAccounts':function(_0xd1f3bd){return new Promise(function(_0x2e0a30,_0x2b2b03){var _0x94e767=_[_0x3992('0x5b')](_0x5e5524[_0x3992('0x82')]);_0x2e0a30({'count':_0x94e767[_0x3992('0x5a')],'rows':_0x94e767});});},'SendFax':function(_0x3b7b8b){var _0x28f74f=this;return new Promise(function(_0x133048,_0x34e716){_0x5ea3a7[_0x3992('0x83')](_0x3b7b8b)[_0x3992('0x1b')](function(_0x3afcaa){_0x133048({'code':0xc8,'message':_0x3afcaa[_0x3992('0x1d')]});})[_0x3992('0x1c')](function(_0x3efff3){_0x34e716(_0x28f74f[_0x3992('0x1e')](0x1f4,_0x3efff3[_0x3992('0x1d')]));});});},'CheckAfterSend':function(_0x4c0c9a){var _0x37e673=this;return new Promise(function(_0x3a2843,_0x4211fc){_0x5ea3a7[_0x3992('0x84')](_0x4c0c9a)['then'](function(_0x2345a0){_0x3a2843({'code':0xc8,'message':_0x2345a0[_0x3992('0x1d')]});})['catch'](function(_0x28a99d){_0x4211fc(_0x37e673[_0x3992('0x1e')](0x1f4,_0x28a99d[_0x3992('0x1d')]));});});}};var _0x5315c7=jayson[_0x3992('0x85')](_0x1cf5a8)[_0x3992('0x86')]();_0x5315c7['on'](_0x3992('0x1e'),function(_0x27148f){return _0xb6d6a7(_0x27148f);});_0x5315c7[_0x3992('0x6')](0x232a,_0x3992('0x87'),function(){console[_0x3992('0x88')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x2f3689(_0x3992('0x89')+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 c900e9a..1282da5 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 _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 +var _0x7a54=['map','calleridnum','getContacts','then','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Contact\x20not\x20found','[CM][%s][%s]\x20Autocreate\x20enabled','data4','isNil','routeId','destcalleridnum','calleridname','','Unknown','firstName','destcalleridname','resolve','createContact','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','toLowerCase','merge','lodash','bluebird','ioredis','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','defaults','localhost','emit','exec','data1','data2','xmd-contactid2','isEmpty','ListId','data3','split','phone','$or'];(function(_0x556473,_0x3d6b76){var _0x151f27=function(_0x1d60a5){while(--_0x1d60a5){_0x556473['push'](_0x556473['shift']());}};_0x151f27(++_0x3d6b76);}(_0x7a54,0x106));var _0x47a5=function(_0x275d3f,_0x3e3a47){_0x275d3f=_0x275d3f-0x0;var _0x35624a=_0x7a54[_0x275d3f];return _0x35624a;};'use strict';var _=require(_0x47a5('0x0'));var BPromise=require(_0x47a5('0x1'));var Redis=require(_0x47a5('0x2'));var util=require('util');var config=require(_0x47a5('0x3'));var logger=require(_0x47a5('0x4'))('trigger');var cmContactRpc=require(_0x47a5('0x5'));config[_0x47a5('0x6')]=_[_0x47a5('0x7')](config[_0x47a5('0x6')],{'host':_0x47a5('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x47a5('0x6')]));function emit(_0x59199c,_0x343372,_0x30e405,_0x506eda,_0x194fb0){logger['info']('[CM][%s][%s]',_0x59199c,_0x343372['id'],_0x30e405,_0x506eda,JSON['stringify'](_0x194fb0));io['to'](_0x30e405)[_0x47a5('0x9')](_0x506eda,_0x194fb0);}exports[_0x47a5('0xa')]=function(_0x5e31dd,_0x2eb0dd,_0x49e844,_0x5de6d7){var _0x1f47f4,_0x69e4d4;var _0x2f399b={};var _0x250fad=Number(_0x49e844[_0x47a5('0xb')]);var _0xd308b8=_0x49e844[_0x47a5('0xc')]?Boolean(Number(_0x49e844['data2'])):![];if(_0x5de6d7[_0x47a5('0xd')]&&!_[_0x47a5('0xe')](_0x5de6d7[_0x47a5('0xd')]))_0x2f399b['id']=_0x5de6d7[_0x47a5('0xd')];if(!_0x2f399b['id']){_0x2f399b[_0x47a5('0xf')]=_0x250fad;var _0x620ee9=_0x49e844[_0x47a5('0x10')]&&_0x49e844[_0x47a5('0x10')]!=='0'?_0x49e844['data3'][_0x47a5('0x11')](','):[_0x47a5('0x12')];_0x2f399b[_0x47a5('0x13')]=_[_0x47a5('0x14')](_0x620ee9,function(_0x1ef44c){return{['field']:_0x5de6d7['routeId']?_0x5de6d7['destcalleridnum']:_0x5de6d7[_0x47a5('0x15')]};});}BPromise['resolve']()['then'](cmContactRpc[_0x47a5('0x16')]({'where':_0x2f399b}))[_0x47a5('0x17')](function(_0x2ce454){_0x69e4d4=_0x2ce454;if(!_[_0x47a5('0xe')](_0x69e4d4)){if(_0x69e4d4[_0x47a5('0x18')]===0x1){_0x1f47f4=_0x69e4d4[0x0];logger[_0x47a5('0x19')](_0x47a5('0x1a'),_0x5de6d7[_0x47a5('0x1b')],_0x2eb0dd['id'],_0x1f47f4['id']);}else{logger[_0x47a5('0x19')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x5de6d7[_0x47a5('0x1b')],_0x2eb0dd['id'],_[_0x47a5('0x14')](_0x69e4d4,'id')['join'](','));}return;}else{logger[_0x47a5('0x19')](_0x47a5('0x1c'),_0x5de6d7[_0x47a5('0x1b')],_0x2eb0dd['id']);if(_0xd308b8){logger['info'](_0x47a5('0x1d'),_0x5de6d7[_0x47a5('0x1b')],_0x2eb0dd['id']);var _0x23db32=_0x49e844[_0x47a5('0x1e')]&&_0x49e844['data4']!=='0'?_0x49e844[_0x47a5('0x1e')]:_0x47a5('0x12');var _0x513981={'ListId':_0x250fad,['creationField']:_[_0x47a5('0x1f')](_0x5de6d7[_0x47a5('0x20')])?_0x5de6d7[_0x47a5('0x15')]:_0x5de6d7[_0x47a5('0x21')]};if(_[_0x47a5('0x1f')](_0x5de6d7['routeId'])){_0x513981['firstName']=_0x5de6d7[_0x47a5('0x22')]&&_0x5de6d7['calleridname']!==_0x47a5('0x23')?_0x5de6d7['calleridname']:_0x47a5('0x24');}else{_0x513981[_0x47a5('0x25')]=_0x5de6d7[_0x47a5('0x26')]&&_0x5de6d7[_0x47a5('0x26')]!==_0x47a5('0x23')?_0x5de6d7[_0x47a5('0x26')]:_0x47a5('0x24');}return BPromise[_0x47a5('0x27')]()[_0x47a5('0x17')](cmContactRpc[_0x47a5('0x28')](_0x513981))[_0x47a5('0x17')](function(_0x11a4fa){_0x1f47f4=_0x11a4fa;if(_0x1f47f4){logger[_0x47a5('0x19')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x5de6d7[_0x47a5('0x1b')],_0x2eb0dd['id'],_0x1f47f4['id']);}return;});}else{logger['info'](_0x47a5('0x29'),_0x5de6d7[_0x47a5('0x1b')],_0x2eb0dd['id']);return;}}})[_0x47a5('0x17')](function(){if(_0x5e31dd){emit(_0x5de6d7['uniqueid'],_0x2eb0dd,util[_0x47a5('0x2a')](_0x47a5('0x2b'),_0x5e31dd[_0x47a5('0x2c')]),util[_0x47a5('0x2a')]('trigger:%s',_0x49e844['action'][_0x47a5('0x2d')]()),{'evt':_[_0x47a5('0x2e')](_0x5de6d7,{'autoCreate':_0xd308b8}),'contact':_0x1f47f4,'contacts':!_0x1f47f4?_0x69e4d4:undefined});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index ba3ef0a..dae0008 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 _0xc8c3=['exports','util','lodash','url','./urlforward','./integration','./cmContact','../../../config/logger','trigger','../ami','localhost','socket.io-emitter','popup','triggers','agents','templates','voiceExtensions','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','emit','info','prototype','clone','checkTriggers','interface','hasOwnProperty','checkTrigger','merge','variables','Actions','length','toLowerCase','contactmanager','motionbar','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','data5','800','windowHeight','data6','600','winapp','winArguments','format','user:%s','name','action','data1','trigger:%s','exec','integration','voiceQueues','queue','urlforward','query','search','replace','AllConditions','every','checkConditions','channel','some','AnyConditions','field','account','ChatWebsiteId','operator','AccountId','value','interaction','message','event','agent','membername','lastevent','routeId'];(function(_0x269641,_0x412ab3){var _0x181231=function(_0x800c23){while(--_0x800c23){_0x269641['push'](_0x269641['shift']());}};_0x181231(++_0x412ab3);}(_0xc8c3,0x1c1));var _0x3c8c=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xc8c3[_0xea8947];return _0x2455e9;};'use strict';var util=require(_0x3c8c('0x0'));var _=require(_0x3c8c('0x1'));var url=require(_0x3c8c('0x2'));var Mustache=require('mustache');var Redis=require('ioredis');var urlforward=require(_0x3c8c('0x3'));var integration=require(_0x3c8c('0x4'));var cmContact=require(_0x3c8c('0x5'));var script=require('./script');var config=require('../../../config/environment');var logger=require(_0x3c8c('0x6'))(_0x3c8c('0x7'));var ami=require(_0x3c8c('0x8'));config['redis']=_['defaults'](config['redis'],{'host':_0x3c8c('0x9'),'port':0x18eb});var io=require(_0x3c8c('0xa'))(new Redis(config['redis']));var operators={'equals':function(_0x548926,_0x52e3ba){return _0x548926==_0x52e3ba;},'not_equals':function(_0x5ede0a,_0x344dda){return _0x5ede0a!=_0x344dda;}};var barAndWebActions=[_0x3c8c('0xb'),_0x3c8c('0x2'),'winapp'];function Trigger(_0x19a68e){this[_0x3c8c('0xc')]=_0x19a68e['triggers'];this[_0x3c8c('0xd')]=_0x19a68e['agents'];this['voiceQueues']=_0x19a68e['voiceQueues'];this['templates']=_0x19a68e[_0x3c8c('0xe')];this[_0x3c8c('0xf')]=_0x19a68e[_0x3c8c('0xf')];this[_0x3c8c('0x10')]=_0x19a68e[_0x3c8c('0x10')];this['freshdeskAccounts']=_0x19a68e['freshdeskAccounts'];this[_0x3c8c('0x11')]=_0x19a68e[_0x3c8c('0x11')];this[_0x3c8c('0x12')]=_0x19a68e[_0x3c8c('0x12')];this[_0x3c8c('0x13')]=_0x19a68e[_0x3c8c('0x13')];this[_0x3c8c('0x14')]=_0x19a68e[_0x3c8c('0x14')];this[_0x3c8c('0x15')]=_0x19a68e[_0x3c8c('0x15')];this[_0x3c8c('0x16')]=_0x19a68e['servicenowAccounts'];this[_0x3c8c('0x17')]=_0x19a68e[_0x3c8c('0x17')];this['freshsalesAccounts']=_0x19a68e[_0x3c8c('0x18')];this[_0x3c8c('0x19')]={'zendesk':this['zendeskAccounts'],'salesforce':this['salesforceAccounts'],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0x3c8c('0x12')],'zoho':this[_0x3c8c('0x13')],'desk':this['deskAccounts'],'vtiger':this[_0x3c8c('0x15')],'dynamics365':this[_0x3c8c('0x17')],'freshsales':this[_0x3c8c('0x18')],'servicenow':this[_0x3c8c('0x16')]};ami['on'](_0x3c8c('0x1a'),this[_0x3c8c('0x1b')][_0x3c8c('0x1c')](this));ami['on'](_0x3c8c('0x1d'),this[_0x3c8c('0x1b')]['bind'](this));ami['on'](_0x3c8c('0x1e'),this[_0x3c8c('0x1b')][_0x3c8c('0x1c')](this));ami['on'](_0x3c8c('0x1f'),this[_0x3c8c('0x1b')][_0x3c8c('0x1c')](this));ami['on'](_0x3c8c('0x20'),this[_0x3c8c('0x1b')]['bind'](this));ami['on'](_0x3c8c('0x21'),this[_0x3c8c('0x1b')][_0x3c8c('0x1c')](this));ami['on'](_0x3c8c('0x22'),this[_0x3c8c('0x1b')][_0x3c8c('0x1c')](this));ami['on'](_0x3c8c('0x23'),this[_0x3c8c('0x1b')]['bind'](this));ami['on'](_0x3c8c('0x24'),this[_0x3c8c('0x1b')][_0x3c8c('0x1c')](this));ami['on'](_0x3c8c('0x25'),this[_0x3c8c('0x1b')][_0x3c8c('0x1c')](this));ami['on'](_0x3c8c('0x26'),this[_0x3c8c('0x1b')][_0x3c8c('0x1c')](this));ami['on'](_0x3c8c('0x27'),this[_0x3c8c('0x28')][_0x3c8c('0x1c')](this));ami['on']('custom:dialconnect',this[_0x3c8c('0x28')][_0x3c8c('0x1c')](this));ami['on']('custom:dialend',this[_0x3c8c('0x28')][_0x3c8c('0x1c')](this));ami['on'](_0x3c8c('0x29'),this[_0x3c8c('0x1b')]['bind'](this));ami['on'](_0x3c8c('0x2a'),this[_0x3c8c('0x1b')][_0x3c8c('0x1c')](this));ami['on'](_0x3c8c('0x2b'),this[_0x3c8c('0x1b')]['bind'](this));ami['on'](_0x3c8c('0x2c'),this[_0x3c8c('0x1b')]['bind'](this));ami['on']('custom:acceptmessage',this['syncCustomEvent'][_0x3c8c('0x1c')](this));ami['on'](_0x3c8c('0x2d'),this[_0x3c8c('0x1b')][_0x3c8c('0x1c')](this));}Trigger['prototype'][_0x3c8c('0x2e')]=function(_0x1a43dd,_0x15084e,_0x5a3bba){logger[_0x3c8c('0x2f')](_0x1a43dd,_0x15084e,JSON['stringify'](_0x5a3bba));io['to'](_0x1a43dd)[_0x3c8c('0x2e')](_0x15084e,_0x5a3bba);};Trigger[_0x3c8c('0x30')]['syncCustomEvent']=function(_0x11d4ec){var _0x1a8a4e=_[_0x3c8c('0x31')](_0x11d4ec);this[_0x3c8c('0x32')](_0x1a8a4e);};Trigger[_0x3c8c('0x30')][_0x3c8c('0x28')]=function(_0x52d02e){if(this[_0x3c8c('0xd')][_0x52d02e[_0x3c8c('0x33')]]){this[_0x3c8c('0x1b')](_0x52d02e);}};Trigger[_0x3c8c('0x30')][_0x3c8c('0x32')]=function(_0xe87f69){var _0x299bc6;for(var _0x1d53f2 in this[_0x3c8c('0xc')]){if(this[_0x3c8c('0xc')][_0x3c8c('0x34')](_0x1d53f2)){if(this[_0x3c8c('0xc')][_0x1d53f2]['status']){_0x299bc6=this[_0x3c8c('0x35')](this[_0x3c8c('0xc')][_0x1d53f2],_0xe87f69);if(_0x299bc6){_[_0x3c8c('0x36')](_0xe87f69,_0xe87f69[_0x3c8c('0x37')]);for(var _0x12f621=0x0,_0x2c5105,_0x2c739a,_0x1255e4;_0x12f6210x0){_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(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 da5e449..419c568 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 _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 +var _0xe94a=['ticketType','incident','assign','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields','phonecalls','callDirection','queue','odata-entityid','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','format','%s/api/data/v9.0/','tenantId','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','outbound','destcalleridnum','calleridnum','contacts','4.0','headers','lastIndexOf','contacts?$select=telephone1','toLowerCase','telephone1','enduserId','contactid','info',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','string','nameField','customField','substring','indexOf','content'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0xe94a,0x87));var _0xae94=function(_0x81dcac,_0x8ff7db){_0x81dcac=_0x81dcac-0x0;var _0xc7803b=_0xe94a[_0x81dcac];return _0xc7803b;};'use strict';var _=require(_0xae94('0x0'));var BPromise=require(_0xae94('0x1'));var rp=require(_0xae94('0x2'));var util=require(_0xae94('0x3'));var intUtil=require(_0xae94('0x4'));var md5=require(_0xae94('0x5'));var Redis=require(_0xae94('0x6'));var logger=require(_0xae94('0x7'))('dynamics365');var config=require(_0xae94('0x8'));config[_0xae94('0x9')]=_[_0xae94('0xa')](config[_0xae94('0x9')],{'host':_0xae94('0xb'),'port':0x18eb});var io=require(_0xae94('0xc'))(new Redis(config[_0xae94('0x9')]));function getAuthToken(_0xb7489b,_0x587b86,_0x2cbf55){var _0x30b292={'method':_0xae94('0xd'),'uri':_0x587b86,'form':{'client_id':_0xb7489b[_0xae94('0xe')],'resource':_0xb7489b[_0xae94('0xf')],'username':_0xb7489b[_0xae94('0x10')],'password':_0xb7489b['password'],'grant_type':_0xae94('0x11'),'client_secret':_0xb7489b[_0xae94('0x12')]},'json':!![]};return rp(_0x30b292)[_0xae94('0x13')](function(_0x18df14){return _0x18df14[_0xae94('0x14')];})[_0xae94('0x15')](function(_0x100f9a){logger[_0xae94('0x16')]('['+[_0x2cbf55['toUpperCase']()]+_0xae94('0x17'));return _0x100f9a[_0xae94('0x18')];});}function getUser(_0x38dc4f,_0x3bca3a,_0x51b4fb,_0x4d2261,_0x44bbf0,_0x190cef){return new BPromise(function(_0x1db87f,_0x3272ff){return getAuthToken(_0x3bca3a,_0x4d2261,_0x190cef)[_0xae94('0x13')](function(_0xca358d){var _0x3d407f={'method':_0xae94('0x19'),'uri':_0x44bbf0+_0xae94('0x1a'),'headers':{'Authorization':_0xae94('0x1b')+_0xca358d,'OData-Version':'4.0'},'json':!![]};return rp(_0x3d407f);})[_0xae94('0x13')](function(_0x5bbd21){var _0x2ba14b=_0x5bbd21['value'];var _0x57bdfb=![];var _0x129478=null;if(!_['isNil'](_0x51b4fb)){if(intUtil[_0xae94('0x1c')](_0x51b4fb[_0xae94('0x1d')])){_0x38dc4f[_0xae94('0x1e')]=_0x51b4fb[_0xae94('0x1d')];for(_0x129478=0x0;_0x129478<_0x2ba14b[_0xae94('0x1f')];_0x129478++){if(_0x2ba14b[_0x129478][_0xae94('0x20')]===_0x51b4fb['email']&&!_0x2ba14b[_0x129478][_0xae94('0x21')]){_0x57bdfb=!![];logger['info']('['+[_0x190cef[_0xae94('0x22')]()]+_0xae94('0x23')+_0x2ba14b[_0x129478][_0xae94('0x24')]+'!');_0x38dc4f[_0xae94('0x25')]=_0x2ba14b[_0x129478][_0xae94('0x24')];}}}}if(!_0x57bdfb){logger['info']('['+[_0x190cef[_0xae94('0x22')]()]+_0xae94('0x26'));_0x38dc4f[_0xae94('0x1e')]=_0x3bca3a['username'];for(_0x129478=0x0;_0x129478<_0x2ba14b[_0xae94('0x1f')];_0x129478++){if(_0x2ba14b[_0x129478][_0xae94('0x20')]===_0x3bca3a[_0xae94('0x10')]){_0x38dc4f[_0xae94('0x25')]=_0x2ba14b[_0x129478][_0xae94('0x24')];}}}_0x1db87f(_0x38dc4f);})['catch'](function(_0x16322d){_0x3272ff(_0x16322d[_0xae94('0x18')]);});});}function createEndUser(_0x4afe41,_0xdd475f,_0x53a509,_0x25477c,_0x41a7b2,_0x3241cb){return new BPromise(function(_0xdc4adf,_0x28fa81){return getAuthToken(_0xdd475f,_0x53a509,_0x3241cb)[_0xae94('0x13')](function(_0x4b9c93){var _0x4fd30e=_0x3241cb['toLowerCase']()===_0xae94('0x27')?_0x41a7b2[_0xae94('0x28')]:_0x41a7b2[_0xae94('0x29')];var _0x4741c6={'method':_0xae94('0xd'),'uri':_0x25477c+_0xae94('0x2a'),'body':{'telephone1':_0x4fd30e,'fullname':_0x4fd30e,'firstname':_0x4fd30e,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x4afe41[_0xae94('0x25')]+')'},'headers':{'Authorization':_0xae94('0x1b')+_0x4b9c93,'OData-Version':_0xae94('0x2b')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x4741c6);})['then'](function(_0x51645d){var _0x516b53=_0x51645d[_0xae94('0x2c')]['odata-entityid'];var _0x31f9bb=_0x516b53['substring'](_0x516b53[_0xae94('0x2d')]('(')+0x1,_0x516b53[_0xae94('0x2d')](')'));_0x4afe41['enduserId']=_0x31f9bb;_0xdc4adf(_0x4afe41);})['catch'](function(_0x48c7df){_0x28fa81(_0x48c7df[_0xae94('0x18')]);});});}function getEndUser(_0x1bb10c,_0x324d49,_0x549917,_0x57edf6,_0x5eb4f4,_0x2c00ba){return new BPromise(function(_0xd9ba5a,_0x35abc1){return getAuthToken(_0x324d49,_0x549917,_0x2c00ba)[_0xae94('0x13')](function(_0x427e0b){var _0x2f1c2b={'method':'GET','uri':_0x57edf6+_0xae94('0x2e'),'headers':{'Authorization':_0xae94('0x1b')+_0x427e0b,'If-None-Match':null,'OData-Version':_0xae94('0x2b')},'json':!![]};return rp(_0x2f1c2b);})[_0xae94('0x13')](function(_0x1438a4){var _0x2a63a9=null;if(_0x1438a4){var _0x13d796=_0x1438a4['value'];var _0x3614bf=![];for(_0x2a63a9=0x0;_0x2a63a9<_0x13d796[_0xae94('0x1f')];_0x2a63a9++){var _0x2442de=_0x2c00ba[_0xae94('0x2f')]()===_0xae94('0x27')?_0x5eb4f4['destcalleridnum']:_0x5eb4f4[_0xae94('0x29')];if(_0x13d796[_0x2a63a9][_0xae94('0x30')]===_0x2442de){_0x3614bf=!![];_0x1bb10c[_0xae94('0x31')]=_0x13d796[_0x2a63a9][_0xae94('0x32')];}}if(_0x3614bf){_0xd9ba5a(_0x1bb10c);}else{return createEndUser(_0x1bb10c,_0x324d49,_0x549917,_0x57edf6,_0x5eb4f4,_0x2c00ba)['then'](function(_0x15f249){logger[_0xae94('0x33')]('['+[_0x2c00ba['toUpperCase']()]+_0xae94('0x34'),_0x15f249[_0xae94('0x31')]);_0xd9ba5a(_0x15f249);});}}else{return createEndUser(_0x1bb10c,_0x324d49,_0x549917,_0x57edf6,_0x5eb4f4,_0x2c00ba)['then'](function(_0x46bd2c){logger[_0xae94('0x33')]('['+[_0x2c00ba[_0xae94('0x22')]()]+_0xae94('0x35'),_0x46bd2c['enduserId']);_0xd9ba5a(_0x46bd2c);});}});});}function getCustomFields(_0x132b46,_0x5a9d39,_0x1b6f04){var _0x4a1de4={};if(_0x132b46['length']>0x0){_[_0xae94('0x36')](_0x132b46,function(_0xd5b1b4){if(_0xd5b1b4['type']===_0xae94('0x37')&&_0xd5b1b4[_0xae94('0x38')]&&!_0xd5b1b4[_0xae94('0x39')]){var _0x3ad666=_0xd5b1b4['idField'][_0xae94('0x2f')]();var _0x5d3775=_0x3ad666[_0xae94('0x3a')](0x0,_0x3ad666[_0xae94('0x3b')]('_'));var _0x44df08=_0x3ad666[_0xae94('0x3a')](_0x3ad666[_0xae94('0x3b')]('_')+0x1);if(_0x5d3775===_0x1b6f04){_0x4a1de4[_0x44df08]=_0xd5b1b4[_0xae94('0x3c')];}}});}return _0x4a1de4;}function getTicket(_0x5eb988,_0x545aec,_0x495aa3,_0x3f8e53,_0x4b8a65,_0x4dc8ec,_0x13b5bb){return new BPromise(function(_0x404249,_0x509aa2){var _0xe95087;return getAuthToken(_0x545aec,_0x495aa3,_0x13b5bb)[_0xae94('0x13')](function(_0x4862c2){if(_0x4dc8ec[_0xae94('0x3d')]===_0xae94('0x3e')){_0xe95087={'method':_0xae94('0xd'),'uri':_0x3f8e53+'incidents','body':Object[_0xae94('0x3f')]({},{'title':intUtil[_0xae94('0x40')](_0x4dc8ec[_0xae94('0x41')],_0x4b8a65,'\x20'),'description':intUtil[_0xae94('0x40')](_0x4dc8ec[_0xae94('0x42')],_0x4b8a65,'\x0a'),'customerid_contact@odata.bind':_0xae94('0x43')+_0x5eb988['enduserId']+')','ownerid@odata.bind':_0xae94('0x44')+_0x5eb988[_0xae94('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x4dc8ec[_0xae94('0x45')],_0x4b8a65,_0x4dc8ec[_0xae94('0x3d')])),'headers':{'Authorization':_0xae94('0x1b')+_0x4862c2,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4dc8ec[_0xae94('0x3d')]==='phonecall'){_0xe95087={'method':_0xae94('0xd'),'uri':_0x3f8e53+_0xae94('0x46'),'body':Object[_0xae94('0x3f')]({},{'subject':intUtil[_0xae94('0x40')](_0x4dc8ec[_0xae94('0x41')],_0x4b8a65,'\x20'),'phonenumber':String(_0x4b8a65['calleridnum']),'description':intUtil[_0xae94('0x40')](_0x4dc8ec[_0xae94('0x42')],_0x4b8a65,'\x0a'),'regardingobjectid_contact@odata.bind':_0xae94('0x43')+_0x5eb988['enduserId']+')','ownerid@odata.bind':_0xae94('0x44')+_0x5eb988['userId']+')','directioncode':_0x5eb988[_0xae94('0x47')]===_0xae94('0x48')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xae94('0x44')+_0x5eb988[_0xae94('0x25')]+')','participationtypemask':_0x5eb988[_0xae94('0x47')]===_0xae94('0x48')?0x2:0x1},{'partyid_contact@odata.bind':_0xae94('0x43')+_0x5eb988[_0xae94('0x31')]+')','participationtypemask':_0x5eb988['callDirection']===_0xae94('0x48')?0x1:0x2}]},getCustomFields(_0x4dc8ec['Fields'],_0x4b8a65,_0x4dc8ec[_0xae94('0x3d')])),'headers':{'Authorization':_0xae94('0x1b')+_0x4862c2,'OData-Version':_0xae94('0x2b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xe95087);})[_0xae94('0x13')](function(_0x502e34){var _0x4b5493=_0x502e34[_0xae94('0x2c')][_0xae94('0x49')];var _0x45afd2=_0x4b5493[_0xae94('0x3a')](_0x4b5493[_0xae94('0x2d')]('(')+0x1,_0x4b5493[_0xae94('0x2d')](')'));_0x5eb988[_0xae94('0x4a')]=_0x45afd2;_0x404249(_0x5eb988);})[_0xae94('0x15')](function(_0x5b2260){_0x509aa2(_0x5b2260[_0xae94('0x18')]);});});}function emit(_0x2088a6,_0x5e4dc5,_0x364917,_0x20c215){var _0x32a306={'uri':util['format'](_0xae94('0x4b'),_0x2088a6,_0x364917,_0x20c215)};io['to'](util['format'](_0xae94('0x4c'),_0x5e4dc5))['emit'](_0xae94('0x4d'),_0x32a306);}exports['cs']=function(_0x39d7b0,_0x1a3f8a,_0x25bdae,_0x6a2f21,_0x55f75b,_0x28998b,_0x853e9f,_0x4eda9b){var _0x408592={};_0x28998b['remoteUri']=intUtil[_0xae94('0x4e')](_0x28998b[_0xae94('0xf')]);_0x28998b['serverUrl']=intUtil[_0xae94('0x4e')](_0x28998b[_0xae94('0x4f')]);_0x408592[_0xae94('0x47')]=_0x4eda9b===_0xae94('0x48')||_0x4eda9b===_0xae94('0x50')?_0xae94('0x48'):_0xae94('0x27');var _0x129233=util[_0xae94('0x51')](_0xae94('0x52'),_0x28998b[_0xae94('0xf')]);var _0x797863=util[_0xae94('0x51')]('https://login.microsoftonline.com/%s/oauth2/token',_0x28998b[_0xae94('0x53')]);var _0x572daf=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x28998b['serverUrl'],_0x1a3f8a['uniqueid'],md5(_0x1a3f8a[_0xae94('0x54')]));if(_0x55f75b&&_0x55f75b[_0xae94('0x55')]){logger[_0xae94('0x33')](_0xae94('0x56'),_0xae94('0x57'));_0x1a3f8a[_0xae94('0x58')]=_0x572daf;}else if(_0x853e9f&&_0x853e9f[_0xae94('0x59')]&&_0x853e9f[_0xae94('0x59')]!=='none'){logger[_0xae94('0x33')]('[OUTBOUND]',_0xae94('0x57'));_0x1a3f8a[_0xae94('0x58')]=_0x572daf;}else{_0x1a3f8a[_0xae94('0x58')]='';}return getUser(_0x408592,_0x28998b,_0x6a2f21,_0x797863,_0x129233,_0x4eda9b)[_0xae94('0x13')](function(_0x180dc0){logger[_0xae94('0x33')]('['+_0x4eda9b[_0xae94('0x22')]()+']\x20The\x20User\x20ID\x20is:',_0x180dc0[_0xae94('0x25')]);logger[_0xae94('0x33')]('['+_0x4eda9b[_0xae94('0x22')]()+_0xae94('0x5a'),_0x180dc0[_0xae94('0x1e')]);return getEndUser(_0x180dc0,_0x28998b,_0x797863,_0x129233,_0x1a3f8a,_0x4eda9b);})[_0xae94('0x13')](function(_0x5ed941){logger[_0xae94('0x33')]('['+_0x4eda9b[_0xae94('0x22')]()+_0xae94('0x5b'),_0x5ed941['enduserId']);logger[_0xae94('0x33')]('['+_0x4eda9b[_0xae94('0x22')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x1a3f8a[_0xae94('0x29')]);return getTicket(_0x5ed941,_0x28998b,_0x797863,_0x129233,_0x1a3f8a,_0x25bdae,_0x4eda9b);})[_0xae94('0x13')](function(_0x19ccd0){logger['info'](util[_0xae94('0x51')]('['+_0x4eda9b[_0xae94('0x22')]()+_0xae94('0x5c'),_0x25bdae[_0xae94('0x3d')],_0x19ccd0[_0xae94('0x4a')]));logger[_0xae94('0x33')](util['format']('['+_0x4eda9b['toUpperCase']()+_0xae94('0x5d'),_0x4eda9b));if(_0x4eda9b!==_0xae94('0x50')){logger[_0xae94('0x33')]('['+_0x4eda9b['toUpperCase']()+']',_0xae94('0x5e'));emit(_0x28998b[_0xae94('0xf')],_0x6a2f21[_0xae94('0x5f')],_0x25bdae[_0xae94('0x3d')],_0x19ccd0[_0xae94('0x4a')]);}})[_0xae94('0x15')](function(_0x197c11){logger['error']('['+_0x4eda9b[_0xae94('0x22')]()+_0xae94('0x60'),util[_0xae94('0x61')](_0x197c11,{'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 91b9e10..9b37e8d 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 _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 +var _0x8fa8=['Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','stringify','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','error','unmanaged','monitor_format','lastevent','Authorization','catch','toUpperCase','lodash','request-promise','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','calleridname','calleridnum','getString','Subjects','
','Tags','name','custom_fields','mapValues','value','remoteUri','POST','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.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','base64','[HTTP]','GET','forEach','type','nameField','customField','string','push','idField','toString','variable','variableName','customVariable','Variable','toLowerCase','stripTrailingSlash','serverUrl','[QUEUE]'];(function(_0x439621,_0x30104f){var _0x4ab3b0=function(_0x580b88){while(--_0x580b88){_0x439621['push'](_0x439621['shift']());}};_0x4ab3b0(++_0x30104f);}(_0x8fa8,0xcc));var _0x88fa=function(_0xcd8b90,_0x4bd816){_0xcd8b90=_0xcd8b90-0x0;var _0x57a0ab=_0x8fa8[_0xcd8b90];return _0x57a0ab;};'use strict';var _=require(_0x88fa('0x0'));var rp=require(_0x88fa('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0x88fa('0x2'));var intUtil=require(_0x88fa('0x3'));var config=require(_0x88fa('0x4'));var logger=require('../../../../config/logger')(_0x88fa('0x5'));config[_0x88fa('0x6')]=_[_0x88fa('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x88fa('0x8'))(new Redis(config[_0x88fa('0x6')]));var headers={'Content-Type':_0x88fa('0x9'),'Accept':'application/json'};function emit(_0xa7bff,_0x29f465,_0xe1e387){io['to'](_0xa7bff)[_0x88fa('0xa')](_0x29f465,_0xe1e387);}function getTicket(_0x201a1f,_0x1afca6,_0x78fe03,_0x1bcbd2,_0x5b1aae){logger[_0x88fa('0xb')](_0x88fa('0xc'));var _0x5b4442=_[_0x88fa('0xd')]({'responder_id':_0x1afca6['id'],'requester_id':_0x78fe03['id'],'name':util[_0x88fa('0xe')]('Caller\x20-\x20%s',_0x5b1aae[_0x88fa('0xf')]),'phone':_0x5b1aae[_0x88fa('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x88fa('0x11')](_0x1bcbd2[_0x88fa('0x12')],_0x5b1aae,'\x20'),'description':intUtil['getString'](_0x1bcbd2['Descriptions'],_0x5b1aae,_0x88fa('0x13')),'tags':getTags(_0x1bcbd2[_0x88fa('0x14')],_0x88fa('0x15'))},getCustomFields(_0x1bcbd2['Fields'],_0x5b1aae));_0x5b4442[_0x88fa('0x16')]=_[_0x88fa('0x17')](_['keyBy'](_0x5b4442[_0x88fa('0x16')],'id'),_0x88fa('0x18'));return request({'uri':util[_0x88fa('0xe')]('%s/api/v2/tickets',_0x201a1f[_0x88fa('0x19')]),'method':_0x88fa('0x1a'),'body':_0x5b4442})['then'](function(_0x5d5789){logger[_0x88fa('0xb')]('Ticket\x20created!');return _0x5d5789;});}function getUser(_0x41a263,_0x1946f3){if(intUtil[_0x88fa('0x1b')](_0x1946f3)){return request({'uri':util['format'](_0x88fa('0x1c'),_0x41a263[_0x88fa('0x19')]),'qs':{'email':_0x1946f3}})[_0x88fa('0x1d')](function(_0x44766a){if(_0x44766a[_0x88fa('0x1e')]){logger[_0x88fa('0xb')]('Agent\x20found!');return _[_0x88fa('0x1f')](_0x44766a,function(_0x2ac438){return _0x2ac438[_0x88fa('0x20')][_0x88fa('0x21')]===_0x1946f3;});}else{logger[_0x88fa('0xb')](_0x88fa('0x22'));return request({'uri':util[_0x88fa('0xe')](_0x88fa('0x23'),_0x41a263[_0x88fa('0x19')])})[_0x88fa('0x1d')](function(_0x236e1a){logger[_0x88fa('0xb')](_0x88fa('0x24'));return _0x236e1a;});}});}else{logger[_0x88fa('0xb')](_0x88fa('0x25'));return request({'uri':util['format'](_0x88fa('0x23'),_0x41a263[_0x88fa('0x19')])})[_0x88fa('0x1d')](function(_0x176a9c){logger[_0x88fa('0xb')](_0x88fa('0x24'));return _0x176a9c;});}}function getEndUser(_0x1ca374,_0x1eb45f,_0x1dd0c2){logger['info'](_0x88fa('0x26'),_0x1dd0c2);return request({'uri':util[_0x88fa('0xe')](_0x88fa('0x27'),_0x1ca374[_0x88fa('0x19')]),'qs':{'phone':_0x1dd0c2}})['then'](function(_0x2e9921){if(_0x2e9921[_0x88fa('0x1e')]){logger[_0x88fa('0xb')](_0x88fa('0x28'));return _['find'](_0x2e9921,{'phone':_0x1dd0c2});}else{logger[_0x88fa('0xb')](_0x88fa('0x29'));return request({'uri':util[_0x88fa('0xe')]('%s/api/v2/contacts',_0x1ca374['remoteUri']),'method':_0x88fa('0x1a'),'body':{'name':_0x1eb45f,'phone':_0x1dd0c2}})[_0x88fa('0x1d')](function(_0x53b861){logger['info'](_0x88fa('0x2a'));return _0x53b861;});}});}function getAuth(_0x3fa8d4){return util[_0x88fa('0xe')](_0x88fa('0x2b'),new Buffer(_0x3fa8d4['apiKey']+':X')['toString'](_0x88fa('0x2c')));}function request(_0x25f048){logger['debug'](_0x88fa('0x2d'),JSON['stringify'](_0x25f048));return rp(_[_0x88fa('0x7')](_0x25f048,{'method':_0x88fa('0x2e'),'headers':headers,'json':!![]}));}function getTags(_0x197812,_0x1bc29a){var _0x211dc0=[];if(_0x197812&&_0x197812[_0x88fa('0x1e')]>0x0){_0x211dc0=_['map'](_0x197812,_0x1bc29a);}return _0x211dc0;}function getCustomFields(_0x12c62f,_0x2ceb39){var _0xbca7be=[];var _0x42ea4b={'custom_fields':[]};if(_0x12c62f['length']>0x0){_[_0x88fa('0x2f')](_0x12c62f,function(_0x4cf503){if(_0x4cf503[_0x88fa('0x30')]==='string'&&_0x4cf503[_0x88fa('0x31')]&&!_0x4cf503[_0x88fa('0x32')]){_0x42ea4b[_0x4cf503[_0x88fa('0x31')]['toLowerCase']()]=_0x4cf503['content']['toString']();}else if(_0x4cf503['type']===_0x88fa('0x33')&&_0x4cf503['idField']&&_0x4cf503[_0x88fa('0x32')]){_0x42ea4b[_0x88fa('0x16')][_0x88fa('0x34')]({'id':_0x4cf503[_0x88fa('0x35')],'value':_0x4cf503['content'][_0x88fa('0x36')]()});}else if(_0x4cf503[_0x88fa('0x30')]===_0x88fa('0x37')&&_0x4cf503[_0x88fa('0x38')]&&_0x4cf503[_0x88fa('0x35')]&&_0x4cf503[_0x88fa('0x32')]){_0x2ceb39[_0x4cf503[_0x88fa('0x38')]]&&_0x42ea4b[_0x88fa('0x16')][_0x88fa('0x34')]({'id':_0x4cf503[_0x88fa('0x35')],'value':_0x2ceb39[_0x4cf503[_0x88fa('0x38')]][_0x88fa('0x36')]()});}else if(_0x4cf503['type']===_0x88fa('0x39')&&_0x4cf503[_0x88fa('0x3a')]&&_0x4cf503[_0x88fa('0x3a')][_0x88fa('0x15')]&&_0x4cf503[_0x88fa('0x35')]&&_0x4cf503['customField']){_0x2ceb39[_0x4cf503[_0x88fa('0x3a')][_0x88fa('0x15')][_0x88fa('0x3b')]()]&&_0x42ea4b[_0x88fa('0x16')][_0x88fa('0x34')]({'id':_0x4cf503[_0x88fa('0x35')],'value':_0x2ceb39[_0x4cf503[_0x88fa('0x3a')][_0x88fa('0x15')][_0x88fa('0x3b')]()][_0x88fa('0x36')]()});}});}return _0x42ea4b;}exports['queue']=function(_0x39a912,_0x44db63,_0x4025ee,_0x38f27a,_0x2f96e3,_0x4c5543){var _0xc68a2a,_0x5545d0;_0x4c5543[_0x88fa('0x19')]=intUtil[_0x88fa('0x3c')](_0x4c5543[_0x88fa('0x19')]);_0x4c5543[_0x88fa('0x3d')]=intUtil['stripTrailingSlash'](_0x4c5543['serverUrl']);if(_0x2f96e3&&_0x2f96e3['monitor_format']){logger[_0x88fa('0xb')](_0x88fa('0x3e'),_0x88fa('0x3f'));_0x44db63[_0x88fa('0x40')]=util[_0x88fa('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4c5543[_0x88fa('0x3d')],_0x44db63[_0x88fa('0x41')],md5(_0x44db63[_0x88fa('0x41')]));}else{_0x44db63['recordingURL']='';}headers['Authorization']=getAuth(_0x4c5543);return getUser(_0x4c5543,_0x38f27a[_0x88fa('0x21')])['then'](function(_0x273833){_0xc68a2a=_0x273833;logger[_0x88fa('0xb')](_0x88fa('0x42'),_0xc68a2a['id']);return getEndUser(_0x4c5543,_0x44db63[_0x88fa('0xf')],_0x44db63[_0x88fa('0x10')]);})[_0x88fa('0x1d')](function(_0x184521){_0x5545d0=_0x184521;logger[_0x88fa('0xb')](_0x88fa('0x43'),_0x5545d0['id']);return getTicket(_0x4c5543,_0xc68a2a,_0x5545d0,_0x4025ee,_0x44db63);})[_0x88fa('0x1d')](function(_0x1672fc){if(_0x1672fc&&_0x1672fc['id']){logger[_0x88fa('0xb')](_0x88fa('0x44'));logger[_0x88fa('0xb')](_0x88fa('0x45'),_0x1672fc['id']);logger[_0x88fa('0xb')](_0x88fa('0x3e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x88fa('0x46'),_0x38f27a['name']),_0x88fa('0x47'),{'uri':util['format'](_0x88fa('0x48'),_0x4c5543[_0x88fa('0x19')],_0x1672fc['id'])});}})['catch'](function(_0x5c976f){logger['error']('[QUEUE]',JSON[_0x88fa('0x49')](_0x5c976f));});};exports[_0x88fa('0x4a')]=function(_0x38d786,_0x3ae6d5,_0x258978,_0x18bd31,_0x503d25,_0x4ac1e3,_0x27f3b9){var _0x3b655e,_0x30ef03;_0x4ac1e3[_0x88fa('0x19')]=intUtil['stripTrailingSlash'](_0x4ac1e3['remoteUri']);_0x4ac1e3['serverUrl']=intUtil['stripTrailingSlash'](_0x4ac1e3[_0x88fa('0x3d')]);if(_0x27f3b9&&_0x27f3b9['recordingFormat']&&_0x27f3b9[_0x88fa('0x4b')]!==_0x88fa('0x4c')){logger[_0x88fa('0xb')](_0x88fa('0x4d'),_0x88fa('0x3f'));_0x3ae6d5[_0x88fa('0x40')]=util[_0x88fa('0xe')](_0x88fa('0x4e'),_0x4ac1e3[_0x88fa('0x3d')],_0x3ae6d5[_0x88fa('0x41')],md5(_0x3ae6d5[_0x88fa('0x41')]));}headers['Authorization']=getAuth(_0x4ac1e3);return getUser(_0x4ac1e3,_0x18bd31[_0x88fa('0x21')])[_0x88fa('0x1d')](function(_0x2aac75){_0x3b655e=_0x2aac75;logger[_0x88fa('0xb')](_0x88fa('0x42'),_0x3b655e['id']);return getEndUser(_0x4ac1e3,_0x3ae6d5[_0x88fa('0x4f')],_0x3ae6d5[_0x88fa('0x50')]);})[_0x88fa('0x1d')](function(_0x16351a){_0x30ef03=_0x16351a;logger[_0x88fa('0xb')](_0x88fa('0x43'),_0x30ef03['id']);return getTicket(_0x4ac1e3,_0x3b655e,_0x30ef03,_0x258978,_0x3ae6d5);})[_0x88fa('0x1d')](function(_0x1008a8){if(_0x1008a8&&_0x1008a8['id']){logger['info']('Ticket\x20created!');logger[_0x88fa('0xb')](_0x88fa('0x45'),_0x1008a8['id']);logger[_0x88fa('0xb')](_0x88fa('0x4d'),_0x88fa('0x51'));emit(util[_0x88fa('0xe')](_0x88fa('0x46'),_0x18bd31['name']),_0x88fa('0x47'),{'uri':util[_0x88fa('0xe')](_0x88fa('0x48'),_0x4ac1e3[_0x88fa('0x19')],_0x1008a8['id'])});}})['catch'](function(_0x4ab4da){logger[_0x88fa('0x52')](_0x88fa('0x4d'),JSON[_0x88fa('0x49')](_0x4ab4da));});};exports[_0x88fa('0x53')]=function(_0x57a2ee,_0x3d9d28,_0x4980c7,_0x45a0f5,_0x5594a5,_0x3af1cf){var _0x9640ac,_0x42fc69;_0x3af1cf['remoteUri']=intUtil[_0x88fa('0x3c')](_0x3af1cf[_0x88fa('0x19')]);_0x3af1cf[_0x88fa('0x3d')]=intUtil[_0x88fa('0x3c')](_0x3af1cf[_0x88fa('0x3d')]);if(_0x5594a5&&_0x5594a5[_0x88fa('0x54')]){logger[_0x88fa('0xb')]('['+_0x3d9d28[_0x88fa('0x55')]['toUpperCase']()+']',_0x88fa('0x3f'));_0x3d9d28[_0x88fa('0x40')]=util[_0x88fa('0xe')](_0x88fa('0x4e'),_0x3af1cf[_0x88fa('0x3d')],_0x3d9d28[_0x88fa('0x41')],md5(_0x3d9d28[_0x88fa('0x41')]));}else{_0x3d9d28[_0x88fa('0x40')]='';}headers[_0x88fa('0x56')]=getAuth(_0x3af1cf);return getUser(_0x3af1cf,'')[_0x88fa('0x1d')](function(_0x26a2f0){_0x9640ac=_0x26a2f0;logger[_0x88fa('0xb')](_0x88fa('0x42'),_0x9640ac['id']);return getEndUser(_0x3af1cf,_0x3d9d28[_0x88fa('0xf')],_0x3d9d28[_0x88fa('0x10')]);})[_0x88fa('0x1d')](function(_0x1f123b){_0x42fc69=_0x1f123b;logger[_0x88fa('0xb')](_0x88fa('0x43'),_0x42fc69['id']);return getTicket(_0x3af1cf,_0x9640ac,_0x42fc69,_0x4980c7,_0x3d9d28);})[_0x88fa('0x1d')](function(_0x13274b){if(_0x13274b){logger[_0x88fa('0xb')](_0x88fa('0x44'));logger['info'](_0x88fa('0x45'),_0x13274b['id']);}})[_0x88fa('0x57')](function(_0x18f0fa){logger[_0x88fa('0x52')]('['+_0x3d9d28[_0x88fa('0x55')][_0x88fa('0x58')]()+']',JSON[_0x88fa('0x49')](_0x18f0fa));});}; \ 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 b12c29d..741ba02 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 _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 +var _0xc284=['user:%s','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','request-promise','md5','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','users','length','email','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','message','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','forEach','name','Getting\x20contact\x20list','/api/contacts/view/','contacts','work_number','contactNumber','mobile_number','endUserId','Contact\x20created:','POST','format','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','Task\x20created:','toUpperCase'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0xc284,0x70));var _0x4c28=function(_0x4e9ec3,_0xab9d7e){_0x4e9ec3=_0x4e9ec3-0x0;var _0x1d813b=_0xc284[_0x4e9ec3];return _0x1d813b;};'use strict';var _=require('lodash');var rp=require(_0x4c28('0x0'));var md5=require(_0x4c28('0x1'));var util=require('util');var moment=require(_0x4c28('0x2'));var Promise=require(_0x4c28('0x3'));var Redis=require(_0x4c28('0x4'));var intUtil=require(_0x4c28('0x5'));var config=require(_0x4c28('0x6'));var logger=require(_0x4c28('0x7'))(_0x4c28('0x8'));config[_0x4c28('0x9')]=_[_0x4c28('0xa')](config[_0x4c28('0x9')],{'host':_0x4c28('0xb'),'port':0x18eb});var io=require(_0x4c28('0xc'))(new Redis(config[_0x4c28('0x9')]));function getAdminId(_0x1e7a18,_0x11512a,_0x3d6bf7,_0x49793f){return new Promise(function(_0x3277a0,_0x5ac31b){var _0x16cce1=![];var _0x1cf53c={'method':_0x4c28('0xd'),'uri':_0x49793f+_0x4c28('0xe'),'json':!![]};_0x1cf53c[_0x4c28('0xf')]=_0x3d6bf7;logger[_0x4c28('0x10')](_0x4c28('0x11'));return rp(_0x1cf53c)['then'](function(_0x232339){if(_0x232339){var _0x4efb87=_0x232339[_0x4c28('0x12')];var _0x5063fc=null;for(_0x5063fc=0x0;_0x5063fc<_0x4efb87[_0x4c28('0x13')];_0x5063fc++){if(_0x4efb87[_0x5063fc][_0x4c28('0x14')]===_0x1e7a18[_0x4c28('0x15')]){_0x1e7a18['adminId']=_0x4efb87[_0x5063fc]['id'];_0x16cce1=!![];}}if(_0x16cce1){logger[_0x4c28('0x10')](_0x4c28('0x16'),_0x1e7a18[_0x4c28('0x17')]);_0x3277a0(_0x1e7a18);}else{_0x5ac31b({'statusCode':0x194,'message':_0x4c28('0x18')});}}else{_0x5ac31b({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x4c28('0x19')](function(_0x8e7085){logger[_0x4c28('0x1a')]('['+[_0x11512a['toUpperCase']()]+']',_0x8e7085[_0x4c28('0x1b')]);_0x5ac31b(_0x8e7085);});});}function getUser(_0x2b5bab,_0x1017f8,_0x3ca305){return function(_0x92eb07){return new Promise(function(_0x2e15d3,_0x53b18e){var _0xdaf597={'method':_0x4c28('0xd'),'uri':_0x3ca305+'/api/selector/owners','json':!![]};_0xdaf597[_0x4c28('0xf')]=_0x1017f8;logger[_0x4c28('0x10')]('Getting\x20user\x20list');return rp(_0xdaf597)[_0x4c28('0x1c')](function(_0x3c7229){if(_0x3c7229){var _0x2d3a56=_0x3c7229[_0x4c28('0x12')];var _0x2845bf=![];var _0x9f30f8=null;if(_0x92eb07[_0x4c28('0x1d')]!==null){logger[_0x4c28('0x10')](_0x4c28('0x1e'),_0x92eb07[_0x4c28('0x1d')]);_0x92eb07[_0x4c28('0x1f')]=_0x92eb07[_0x4c28('0x1d')];for(_0x9f30f8=0x0;_0x9f30f8<_0x2d3a56[_0x4c28('0x13')];_0x9f30f8++){if(_0x2d3a56[_0x9f30f8][_0x4c28('0x14')]===_0x92eb07[_0x4c28('0x1d')]){_0x2845bf=!![];_0x92eb07[_0x4c28('0x20')]=_0x2d3a56[_0x9f30f8]['id'];logger[_0x4c28('0x10')](_0x4c28('0x21'),_0x92eb07[_0x4c28('0x20')]);}}}if(!_0x2845bf){logger[_0x4c28('0x10')](_0x4c28('0x22'));_0x92eb07['userEmail']=_0x92eb07[_0x4c28('0x15')];_0x92eb07[_0x4c28('0x20')]=_0x92eb07[_0x4c28('0x17')];_0x2845bf=!![];}if(_0x2845bf){_0x2e15d3(_0x92eb07);}else{_0x53b18e({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x53b18e({'statusCode':0x194,'message':_0x4c28('0x18')});}})[_0x4c28('0x19')](function(_0x4d6d17){logger[_0x4c28('0x1a')]('['+[_0x2b5bab['toUpperCase']()]+']',_0x4d6d17['message']);_0x53b18e(_0x4d6d17);});});};}function getEndUser(_0x1b60d3,_0x2a0204,_0x50fb4e){return function(_0x4ac3cc){return new Promise(function(_0x1831ef,_0x53d0fb){var _0x3a275c=0x0;var _0x1d9e4b={'method':_0x4c28('0xd'),'uri':_0x50fb4e+'/api/contacts/filters','json':!![]};_0x1d9e4b[_0x4c28('0xf')]=_0x2a0204;logger[_0x4c28('0x10')]('Getting\x20contacts\x20filter');return rp(_0x1d9e4b)[_0x4c28('0x1c')](function(_0x2c6454){_0x2c6454['filters'][_0x4c28('0x23')](function(_0x52f42f){if(_0x52f42f[_0x4c28('0x24')]==='All\x20Contacts'){_0x3a275c=_0x52f42f['id'];}});})[_0x4c28('0x1c')](function(){logger[_0x4c28('0x10')](_0x4c28('0x25'));var _0x283c1d={'method':_0x4c28('0xd'),'uri':_0x50fb4e+_0x4c28('0x26')+_0x3a275c,'json':!![]};_0x283c1d[_0x4c28('0xf')]=_0x2a0204;return rp(_0x283c1d);})[_0x4c28('0x1c')](function(_0x5056ec){logger[_0x4c28('0x10')]('Searching\x20contact\x20with\x20phone',_0x4ac3cc['contactNumber']);if(_0x5056ec[_0x4c28('0x27')]['length']>0x0){var _0x2e27bc=_['find'](_0x5056ec[_0x4c28('0x27')],function(_0x5c2b3e){if(_0x5c2b3e[_0x4c28('0x28')]===_0x4ac3cc[_0x4c28('0x29')]||_0x5c2b3e[_0x4c28('0x2a')]===_0x4ac3cc['contactNumber']){return _0x5c2b3e;}});if(_0x2e27bc){_0x4ac3cc[_0x4c28('0x2b')]=_0x2e27bc['id'];logger[_0x4c28('0x10')]('Contact\x20found:',_0x4ac3cc[_0x4c28('0x2b')]);_0x1831ef(_0x4ac3cc);}else{return createEndUser(_0x4ac3cc,_0x1b60d3,_0x2a0204,_0x50fb4e)[_0x4c28('0x1c')](function(_0x96c1a0){logger['info'](_0x4c28('0x2c'),_0x4ac3cc[_0x4c28('0x2b')]);_0x1831ef(_0x96c1a0);});}}else{return createEndUser(_0x4ac3cc,_0x1b60d3,_0x2a0204,_0x50fb4e)['then'](function(_0x207747){logger['info']('Contact\x20created:',_0x4ac3cc['endUserId']);_0x1831ef(_0x207747);});}})[_0x4c28('0x19')](function(_0x34736f){throw new Error(_0x34736f[_0x4c28('0x1b')]);});});};}function createEndUser(_0x54ba04,_0x4f9d54,_0x3b7ad5,_0x9fd5fc){return new Promise(function(_0x13292a,_0x1dacac){var _0x165b4a=moment();var _0x17f3d8={'method':_0x4c28('0x2d'),'uri':_0x9fd5fc+'/api/contacts','body':{'contact':{'last_name':_0x54ba04[_0x4c28('0x29')],'work_number':_0x54ba04['contactNumber'],'mobile_number':_0x54ba04[_0x4c28('0x29')],'owner_id':_0x54ba04[_0x4c28('0x20')],'created_at':_0x165b4a[_0x4c28('0x2e')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x17f3d8[_0x4c28('0xf')]=_0x3b7ad5;logger['info'](_0x4c28('0x2f'));return rp(_0x17f3d8)[_0x4c28('0x1c')](function(_0x22d154){_0x54ba04['endUserId']=_0x22d154[_0x4c28('0x30')]['id'];_0x13292a(_0x54ba04);})['catch'](function(_0x19e5cc){logger[_0x4c28('0x1a')]('['+[_0x4f9d54['toUpperCase']()]+']',_0x19e5cc[_0x4c28('0x1b')]);_0x1dacac(_0x19e5cc[_0x4c28('0x1b')]);});});}function getTicket(_0x5e31e7,_0x4070b3,_0x55b6d7,_0x2dc2fe,_0x3cd5c2){return function(_0x532769){logger['info'](_0x4c28('0x31'));return new Promise(function(_0x4b9952,_0x338d03){var _0x57e9b8=moment();var _0xb3e1e={'method':_0x4c28('0x2d'),'uri':_0x55b6d7+'/api/tasks','body':{'title':intUtil[_0x4c28('0x32')](_0x2dc2fe['Subjects'],_0x3cd5c2,'\x20'),'description':intUtil[_0x4c28('0x32')](_0x2dc2fe[_0x4c28('0x33')],_0x3cd5c2,'\x0a'),'owner_id':_0x532769[_0x4c28('0x20')],'creater_id':_0x532769[_0x4c28('0x17')],'targetable_id':_0x532769[_0x4c28('0x2b')],'targetable_type':_0x4c28('0x34'),'created_at':_0x57e9b8['format'](_0x4c28('0x35')),'due_date':_0x57e9b8[_0x4c28('0x36')](0x1e,'m')[_0x4c28('0x2e')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0xb3e1e['headers']=_0x4070b3;return rp(_0xb3e1e)[_0x4c28('0x1c')](function(_0x4d8671){_0x532769[_0x4c28('0x37')]=_0x4d8671['task']['id'];logger['info'](_0x4c28('0x38'),_0x532769[_0x4c28('0x37')]);_0x4b9952(_0x532769);})[_0x4c28('0x19')](function(_0x4b4a26){logger[_0x4c28('0x1a')]('['+[_0x5e31e7[_0x4c28('0x39')]()]+']',_0x4b4a26[_0x4c28('0x1b')]);_0x338d03(_0x4b4a26['message']);});});};}function emit(_0xace259,_0x516fb7,_0x2f0089){var _0x55efa5={'uri':_0xace259+'/contacts/'+_0x2f0089};io['to'](util[_0x4c28('0x2e')](_0x4c28('0x3a'),_0x516fb7))[_0x4c28('0x3b')](_0x4c28('0x3c'),_0x55efa5);}exports['cs']=function(_0x2ccbe7,_0x47ebfb,_0x4a243d,_0x54550e,_0x17a3e1,_0x53967b,_0x312dc6,_0x3b29e4){var _0x23b311={};var _0x2dc7e2={'Authorization':_0x4c28('0x3d')+_0x53967b['apiKey']};_0x53967b[_0x4c28('0x3e')]=intUtil[_0x4c28('0x3f')](_0x53967b[_0x4c28('0x3e')]);_0x53967b['serverUrl']=intUtil[_0x4c28('0x3f')](_0x53967b['serverUrl']);var _0x47ba3a=_0x53967b[_0x4c28('0x3e')];_0x23b311[_0x4c28('0x15')]=_0x53967b[_0x4c28('0x40')];_0x23b311[_0x4c28('0x29')]=_0x3b29e4[_0x4c28('0x41')]()===_0x4c28('0x42')?_0x47ebfb[_0x4c28('0x43')]:_0x47ebfb[_0x4c28('0x44')];_0x23b311[_0x4c28('0x45')]=_0x3b29e4===_0x4c28('0x46')||_0x3b29e4==='unmanaged'?_0x4c28('0x46'):_0x4c28('0x42');if(_0x54550e){_0x23b311['agentEmail']=_0x54550e[_0x4c28('0x14')];}var _0x2261fd=util[_0x4c28('0x2e')](_0x4c28('0x47'),_0x53967b[_0x4c28('0x48')],_0x47ebfb[_0x4c28('0x49')],md5(_0x47ebfb[_0x4c28('0x49')]));if(_0x17a3e1&&_0x17a3e1[_0x4c28('0x4a')]){logger[_0x4c28('0x10')](_0x4c28('0x4b'),_0x4c28('0x4c'));_0x47ebfb[_0x4c28('0x4d')]=_0x2261fd;}else if(_0x312dc6&&_0x312dc6[_0x4c28('0x4e')]&&_0x312dc6[_0x4c28('0x4e')]!==_0x4c28('0x4f')){logger['info'](_0x4c28('0x50'),_0x4c28('0x4c'));_0x47ebfb[_0x4c28('0x4d')]=_0x2261fd;}else{_0x47ebfb[_0x4c28('0x4d')]='';}return getAdminId(_0x23b311,_0x3b29e4,_0x2dc7e2,_0x47ba3a)[_0x4c28('0x1c')](getUser(_0x3b29e4,_0x2dc7e2,_0x47ba3a))[_0x4c28('0x1c')](getEndUser(_0x3b29e4,_0x2dc7e2,_0x47ba3a))[_0x4c28('0x1c')](getTicket(_0x3b29e4,_0x2dc7e2,_0x47ba3a,_0x4a243d,_0x47ebfb))['then'](function(_0x7f7630){logger[_0x4c28('0x10')](util[_0x4c28('0x2e')](_0x4c28('0x51'),_0x7f7630['ticketId']));if(_0x3b29e4!==_0x4c28('0x52')){logger['info']('['+[_0x3b29e4[_0x4c28('0x39')]()]+']',_0x4c28('0x53'));emit(_0x47ba3a,_0x54550e[_0x4c28('0x24')],_0x7f7630['endUserId']);}})[_0x4c28('0x19')](function(_0x21892f){logger[_0x4c28('0x1a')]('['+[_0x3b29e4[_0x4c28('0x39')]()]+_0x4c28('0x54'),util['inspect'](_0x21892f,{'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 3114e0e..b502d65 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 _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 +var _0x5f66=['dynamics365','freshsales','toLowerCase','data1','data2','find','Configurations','data3','queue','outbound','unmanaged','salesforce','sugarcrm','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','util','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./servicenow','./freshsales','zendesk','freshdesk','zoho','desk','vtiger'];(function(_0x101645,_0x4c4dea){var _0x563807=function(_0x5854aa){while(--_0x5854aa){_0x101645['push'](_0x101645['shift']());}};_0x563807(++_0x4c4dea);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var zendesk=require('./zendesk');var salesforce=require(_0x65f6('0x1'));var sugarcrm=require(_0x65f6('0x2'));var freshdesk=require(_0x65f6('0x3'));var zoho=require(_0x65f6('0x4'));var desk=require(_0x65f6('0x5'));var vtiger=require('./vtiger');var servicenow=require(_0x65f6('0x6'));var dynamics365=require('./dynamics365');var freshsales=require(_0x65f6('0x7'));var integrations=[_0x65f6('0x8'),'salesforce','sugarcrm',_0x65f6('0x9'),_0x65f6('0xa'),_0x65f6('0xb'),_0x65f6('0xc'),_0x65f6('0xd'),_0x65f6('0xe'),'servicenow'];exports['exec']=function(_0x18fea1,_0x2f6d5b,_0x264647,_0x25c416,_0x50d26d,_0x41a7fd){if(_0x264647){if(_['includes'](integrations,_0x18fea1['data1'][_0x65f6('0xf')]())){try{var _0x576875=null;var _0x419819='';var _0x4862a5=_0x264647[_0x18fea1[_0x65f6('0x10')][_0x65f6('0xf')]()];if(_0x4862a5){var _0x2c4ee5=_0x4862a5[_0x18fea1[_0x65f6('0x11')]];if(_0x2c4ee5){var _0x369f96=_[_0x65f6('0x12')](_0x2c4ee5[_0x65f6('0x13')],{'id':parseInt(_0x18fea1[_0x65f6('0x14')],0xa)});if(_0x369f96){if(_0x25c416){if(_0x50d26d&&_0x2f6d5b[_0x65f6('0x15')]){_0x419819=_0x65f6('0x15');}else if(_0x2f6d5b['routeId']){_0x419819=_0x65f6('0x16');}else{console['log']('EVENT\x20UNKNOWN',_0x2f6d5b);}}else{_0x419819=_0x65f6('0x17');}switch(_0x18fea1[_0x65f6('0x10')][_0x65f6('0xf')]()){case _0x65f6('0x8'):zendesk[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case _0x65f6('0x18'):salesforce[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case _0x65f6('0x19'):sugarcrm[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case _0x65f6('0x9'):freshdesk[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case _0x65f6('0xa'):zoho[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case'desk':desk[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case'vtiger':vtiger[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case _0x65f6('0xe'):freshsales['cs'](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd,_0x419819);break;case'servicenow':servicenow['cs'](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd,_0x419819);break;case'dynamics365':dynamics365['cs'](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd,_0x419819);break;default:console['log'](_0x65f6('0x1a'));}}else{_0x576875=require(_0x65f6('0x1b'))(_0x18fea1['data1'][_0x65f6('0xf')]());_0x576875[_0x65f6('0x1c')](_0x65f6('0x1d'),util[_0x65f6('0x1e')](_0x65f6('0x1f'),_0x18fea1[_0x65f6('0x10')]['toLowerCase'](),_0x18fea1[_0x65f6('0x14')]));}}else{_0x576875=require('../../../../config/logger')(_0x18fea1['data1'][_0x65f6('0xf')]());_0x576875[_0x65f6('0x1c')]('[EXEC]',util[_0x65f6('0x1e')](_0x65f6('0x20'),_0x18fea1[_0x65f6('0x10')][_0x65f6('0xf')](),_0x18fea1['data2']));}}else{}}catch(_0x9d7bb0){console[_0x65f6('0x1c')](_0x9d7bb0);}}}}; \ 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 447d7f4..c144982 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 _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 +var _0x56bc=['./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','ticketType','Task','assign','utc','getString','Subjects','Descriptions','WhoId','Case','sobject','create','isNil','validateEmail','find','then','length','Email','Agent\x20%s\x20found.','Name','info','identity','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','Contact','execute','contact','lead','Phone','Enduser\x20with\x20phone\x20%s\x20found.','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','upperFirst','forEach','type','string','idField','content','variableName','toString','Variable','name','toLowerCase','concat','Connection','remoteUri','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','user:%s','trigger:salesforce:display','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','[QUEUE]','stringify','outbound','recordingFormat','none','[OUTBOUND]','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','newTab','trigger:browser:url','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','Recording\x20is\x20enabled!',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','md5','jsforce','util','ioredis'];(function(_0x20f987,_0x3e02b0){var _0x39393d=function(_0x27342e){while(--_0x27342e){_0x20f987['push'](_0x20f987['shift']());}};_0x39393d(++_0x3e02b0);}(_0x56bc,0xcd));var _0xc56b=function(_0x3212e6,_0x3ef4a2){_0x3212e6=_0x3212e6-0x0;var _0xc25ada=_0x56bc[_0x3212e6];return _0xc25ada;};'use strict';var _=require(_0xc56b('0x0'));var rp=require('request-promise');var moment=require(_0xc56b('0x1'));var BPromise=require(_0xc56b('0x2'));var md5=require(_0xc56b('0x3'));var jsforce=require(_0xc56b('0x4'));var util=require(_0xc56b('0x5'));var Redis=require(_0xc56b('0x6'));var intUtil=require(_0xc56b('0x7'));var config=require(_0xc56b('0x8'));var logger=require(_0xc56b('0x9'))(_0xc56b('0xa'));config['redis']=_['defaults'](config[_0xc56b('0xb')],{'host':_0xc56b('0xc'),'port':0x18eb});var io=require(_0xc56b('0xd'))(new Redis(config[_0xc56b('0xb')]));function emit(_0x3268d0,_0x96beca,_0x474473){io['to'](_0x3268d0)['emit'](_0x96beca,_0x474473);}function getTicket(_0x4b3462,_0x29e45d,_0x4f626e,_0x2e4723,_0x1cb460,_0xaff2dd,_0x47b39e,_0x4f6f5a){var _0x40157e={};if(_0x2e4723[_0xc56b('0xe')]===_0xc56b('0xf')){_0x40157e=Object[_0xc56b('0x10')]({},{'OwnerId':_0x29e45d['id'],'ActivityDate':moment[_0xc56b('0x11')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xc56b('0x12')](_0x2e4723[_0xc56b('0x13')],_0x1cb460,'\x20'),'Description':intUtil[_0xc56b('0x12')](_0x2e4723[_0xc56b('0x14')],_0x1cb460,'\x0a')},getCustomFields(_0xaff2dd,_0x1cb460));if(_0x4f626e){_0x40157e[_0xc56b('0x15')]=_0x4f626e['id'];}}else if(_0x2e4723['ticketType']===_0xc56b('0x16')){_0x40157e=Object['assign']({},{'OwnerId':_0x29e45d['id'],'Subject':intUtil[_0xc56b('0x12')](_0x2e4723[_0xc56b('0x13')],_0x1cb460,'\x20'),'Description':intUtil[_0xc56b('0x12')](_0x2e4723[_0xc56b('0x14')],_0x1cb460,'\x0a')},getCustomFields(_0xaff2dd,_0x1cb460));if(_0x4f626e){_0x40157e['ContactId']=_0x4f626e['id'];}}return _0x47b39e[_0xc56b('0x17')](_0x2e4723[_0xc56b('0xe')])[_0xc56b('0x18')](_0x40157e);}function getUser(_0x383766,_0x399cf8,_0x3ee85b){if(!_[_0xc56b('0x19')](_0x399cf8)&&intUtil[_0xc56b('0x1a')](_0x399cf8)){var _0x428449={'Email':_0x399cf8};var _0x50f194={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3ee85b[_0xc56b('0x17')]('User')[_0xc56b('0x1b')](_0x428449,_0x50f194)['execute']()[_0xc56b('0x1c')](function(_0x2c6d47){if(_0x2c6d47[_0xc56b('0x1d')]){var _0x4d8257=_[_0xc56b('0x1b')](_0x2c6d47,function(_0x3c5ccf){return _0x3c5ccf[_0xc56b('0x1e')]===_0x399cf8;});if(_0x4d8257){logger['info'](_0xc56b('0x1f'),_0x399cf8);return BPromise['resolve']({'id':_0x4d8257['Id'],'name':_0x4d8257[_0xc56b('0x20')]});}}else{logger[_0xc56b('0x21')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x399cf8);return _0x3ee85b[_0xc56b('0x22')]()[_0xc56b('0x1c')](function(_0x387b09){return BPromise['resolve']({'id':_0x387b09[_0xc56b('0x23')],'name':_0x387b09[_0xc56b('0x24')]});});}});}else{logger[_0xc56b('0x21')](_0xc56b('0x25'),_0x399cf8);return _0x3ee85b[_0xc56b('0x22')]()[_0xc56b('0x1c')](function(_0x3a4155){return BPromise[_0xc56b('0x26')]({'id':_0x3a4155['user_id'],'name':_0x3a4155[_0xc56b('0x24')]});});}}function getEndUser(_0x1ea7f7,_0x19f558,_0x538383,_0x444e91,_0x1202cf){var _0x52bcf0={'Phone':_0x444e91};var _0x320aa5={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){if(_0x19f558['ticketType']===_0xc56b('0xf')){logger[_0xc56b('0x21')](_0xc56b('0x27'),_0x444e91,_0x19f558[_0xc56b('0x28')]);switch(_0x19f558[_0xc56b('0x28')]){case'contact_lead':return _0x1202cf['sobject'](_0xc56b('0x29'))['find'](_0x52bcf0,_0x320aa5)[_0xc56b('0x2a')]()['then'](function(_0x49c47b){if(_0x49c47b&&_0x49c47b[_0xc56b('0x1d')]){return _0x49c47b;}else{return _0x1202cf[_0xc56b('0x17')]('Lead')[_0xc56b('0x1b')](_0x52bcf0,_0x320aa5);}});case _0xc56b('0x2b'):return _0x1202cf[_0xc56b('0x17')](_0xc56b('0x29'))[_0xc56b('0x1b')](_0x52bcf0,_0x320aa5)[_0xc56b('0x2a')]();case _0xc56b('0x2c'):return _0x1202cf[_0xc56b('0x17')]('Lead')[_0xc56b('0x1b')](_0x52bcf0,_0x320aa5);default:return null;}}else if(_0x19f558['ticketType']===_0xc56b('0x16')){logger['info'](_0xc56b('0x27'),_0x444e91,_0xc56b('0x2b'));return _0x1202cf['sobject'](_0xc56b('0x29'))[_0xc56b('0x1b')](_0x52bcf0,_0x320aa5)[_0xc56b('0x2a')]();}})['then'](function(_0x25e120){if(_0x25e120&&_0x25e120[_0xc56b('0x1d')]){var _0x226dac=_['find'](_0x25e120,function(_0x642343){return _0x642343[_0xc56b('0x2d')]===_0x444e91;});if(_0x226dac){return BPromise[_0xc56b('0x26')]({'id':_0x226dac['Id'],'name':_0x226dac[_0xc56b('0x20')],'phone':_0x226dac[_0xc56b('0x2d')]});}}})[_0xc56b('0x1c')](function(_0x383595){if(_0x383595){logger['info'](_0xc56b('0x2e'),_0x444e91);return BPromise[_0xc56b('0x26')](_0x383595);}else{logger[_0xc56b('0x21')](_0xc56b('0x2f'),_0x444e91);var _0x3b3208={'LastName':_0x538383!==''?_0x538383:util[_0xc56b('0x30')](_0xc56b('0x31'),_0x444e91),'Phone':_0x444e91};if(_0x19f558[_0xc56b('0x32')]){if(_0x19f558[_0xc56b('0x32')]==='contact'){logger[_0xc56b('0x21')](_0xc56b('0x33'),_0x444e91,_0x19f558['moduleCreate']);}else if(_0x19f558[_0xc56b('0x32')]===_0xc56b('0x2c')&&_0x19f558['ticketType']===_0xc56b('0xf')){logger[_0xc56b('0x21')](_0xc56b('0x33'),_0x444e91,_0x19f558['moduleCreate']);_0x3b3208[_0xc56b('0x34')]=_0xc56b('0x35');}else{return null;}}return _0x1202cf[_0xc56b('0x17')](_[_0xc56b('0x36')](_0x19f558[_0xc56b('0x32')]))['create'](_0x3b3208);}});}function getCustomFields(_0x1aac63,_0x22959e){var _0x13f37b={};if(_0x1aac63[_0xc56b('0x1d')]>0x0){_[_0xc56b('0x37')](_0x1aac63,function(_0x46dd5e){if(_0x46dd5e[_0xc56b('0x38')]===_0xc56b('0x39')&&_0x46dd5e['idField']){_0x13f37b[_0x46dd5e[_0xc56b('0x3a')]]=_0x46dd5e[_0xc56b('0x3b')]['toString']();}else if(_0x46dd5e[_0xc56b('0x38')]==='variable'&&_0x46dd5e[_0xc56b('0x3c')]&&_0x46dd5e['idField']){_0x22959e[_0x46dd5e[_0xc56b('0x3c')]]&&(_0x13f37b[_0x46dd5e['idField']]=_0x22959e[_0x46dd5e[_0xc56b('0x3c')]][_0xc56b('0x3d')]());}else if(_0x46dd5e[_0xc56b('0x38')]==='customVariable'&&_0x46dd5e['Variable']&&_0x46dd5e[_0xc56b('0x3e')][_0xc56b('0x3f')]&&_0x46dd5e['idField']){_0x22959e[_0x46dd5e[_0xc56b('0x3e')][_0xc56b('0x3f')]['toLowerCase']()]&&(_0x13f37b[_0x46dd5e['idField']]=_0x22959e[_0x46dd5e[_0xc56b('0x3e')]['name'][_0xc56b('0x40')]()][_0xc56b('0x3d')]());}});}return _0x13f37b;}function getConnection(_0x4f2cc6){var _0x3383a8=_0x4f2cc6['password'][_0xc56b('0x41')](_0x4f2cc6['securityToken']);var _0x496159=new jsforce[(_0xc56b('0x42'))]({'oauth2':{'loginUrl':_0x4f2cc6[_0xc56b('0x43')]||'https://login.salesforce.com','clientId':_0x4f2cc6['clientId'],'clientSecret':_0x4f2cc6[_0xc56b('0x44')]}});return _0x496159[_0xc56b('0x45')](_0x4f2cc6[_0xc56b('0x46')],_0x3383a8)[_0xc56b('0x1c')](function(){logger[_0xc56b('0x21')](_0xc56b('0x47'));return _0x496159;});}exports[_0xc56b('0x48')]=function(_0x585d32,_0x1262b7,_0x1fca95,_0x236515,_0x541aa5,_0x409180){var _0x169607,_0x3ad3a2,_0x107382,_0x29d016;_0x409180[_0xc56b('0x49')]=intUtil[_0xc56b('0x4a')](_0x409180[_0xc56b('0x49')]);_0x409180[_0xc56b('0x43')]=intUtil[_0xc56b('0x4a')](_0x409180[_0xc56b('0x43')]);if(_0x541aa5&&_0x541aa5[_0xc56b('0x4b')]){logger[_0xc56b('0x21')]('[QUEUE]','Recording\x20is\x20enabled!');_0x1262b7[_0xc56b('0x4c')]=util[_0xc56b('0x30')](_0xc56b('0x4d'),_0x409180['serverUrl'],_0x1262b7[_0xc56b('0x4e')],md5(_0x1262b7[_0xc56b('0x4e')]));}else{_0x1262b7['recordingURL']='';}return getConnection(_0x409180)[_0xc56b('0x1c')](function(_0x44ca47){_0x29d016=_0x44ca47;return getUser(_0x409180,_0x236515[_0xc56b('0x4f')],_0x29d016);})[_0xc56b('0x1c')](function(_0x2f9685){_0x169607=_0x2f9685;return getEndUser(_0x409180,_0x1fca95,_0x1262b7[_0xc56b('0x50')],_0x1262b7[_0xc56b('0x51')],_0x29d016);})[_0xc56b('0x1c')](function(_0x18f913){_0x3ad3a2=_0x18f913;return getTicket(_0x409180,_0x169607,_0x3ad3a2,_0x1fca95,_0x1262b7,_0x1fca95['Fields'],_0x29d016,_0xc56b('0x48'));})[_0xc56b('0x1c')](function(_0x32ead5){_0x107382=_0x32ead5;logger['info'](_0xc56b('0x52'),_0x107382['id']);logger['info']('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x107382['id'],_0x236515[_0xc56b('0x3f')],_0x409180[_0xc56b('0x38')]);switch(_0x409180[_0xc56b('0x38')]){case'integrationTab':emit(util[_0xc56b('0x30')](_0xc56b('0x53'),_0x236515[_0xc56b('0x3f')]),_0xc56b('0x54'),{'recordId':_0x107382['id']});break;case'newTab':emit(util[_0xc56b('0x30')](_0xc56b('0x53'),_0x236515[_0xc56b('0x3f')]),'trigger:browser:url',{'uri':util['format'](_0xc56b('0x55'),_0x29d016[_0xc56b('0x56')],_0x107382['id'])});break;default:logger[_0xc56b('0x57')](_0xc56b('0x58'));}})['catch'](function(_0x19e9b9){logger[_0xc56b('0x57')](_0xc56b('0x59'),JSON[_0xc56b('0x5a')](_0x19e9b9));});};exports[_0xc56b('0x5b')]=function(_0xc38bc7,_0x4f75ee,_0x65f1ac,_0x28c147,_0x1efc62,_0x323f7d,_0x2bbbba){var _0x59903b,_0x17462d,_0x9db06d,_0x52a982;_0x323f7d[_0xc56b('0x49')]=intUtil[_0xc56b('0x4a')](_0x323f7d[_0xc56b('0x49')]);_0x323f7d[_0xc56b('0x43')]=intUtil[_0xc56b('0x4a')](_0x323f7d[_0xc56b('0x43')]);if(_0x2bbbba&&_0x2bbbba[_0xc56b('0x5c')]&&_0x2bbbba[_0xc56b('0x5c')]!==_0xc56b('0x5d')){logger[_0xc56b('0x21')](_0xc56b('0x5e'),'Recording\x20is\x20enabled!');_0x4f75ee['recordingURL']=util[_0xc56b('0x30')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x323f7d[_0xc56b('0x49')],_0x4f75ee['uniqueid'],md5(_0x4f75ee[_0xc56b('0x4e')]));}return getConnection(_0x323f7d)[_0xc56b('0x1c')](function(_0x1f8f8b){_0x52a982=_0x1f8f8b;return getUser(_0x323f7d,_0x28c147[_0xc56b('0x4f')],_0x52a982);})[_0xc56b('0x1c')](function(_0x288c5a){_0x59903b=_0x288c5a;return getEndUser(_0x323f7d,_0x65f1ac,_0x4f75ee['destcalleridname'],_0x4f75ee['destcalleridnum'],_0x52a982);})[_0xc56b('0x1c')](function(_0x2238ef){_0x17462d=_0x2238ef;return getTicket(_0x323f7d,_0x59903b,_0x17462d,_0x65f1ac,_0x4f75ee,_0x65f1ac['Fields'],_0x52a982,'outbound');})[_0xc56b('0x1c')](function(_0x420227){_0x9db06d=_0x420227;logger[_0xc56b('0x21')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x9db06d['id']);logger[_0xc56b('0x21')](_0xc56b('0x5f'),_0x9db06d['id'],_0x28c147['name'],_0x323f7d[_0xc56b('0x38')]);switch(_0x323f7d[_0xc56b('0x38')]){case _0xc56b('0x60'):emit(util[_0xc56b('0x30')](_0xc56b('0x53'),_0x28c147['name']),_0xc56b('0x54'),{'recordId':_0x9db06d['id']});break;case _0xc56b('0x61'):emit(util[_0xc56b('0x30')](_0xc56b('0x53'),_0x28c147['name']),_0xc56b('0x62'),{'uri':util[_0xc56b('0x30')](_0xc56b('0x55'),_0x52a982[_0xc56b('0x56')],_0x9db06d['id'])});break;default:logger[_0xc56b('0x57')](_0xc56b('0x5e'),_0xc56b('0x63'));}})['catch'](function(_0x3f838c){logger[_0xc56b('0x57')]('[OUTBOUND]',JSON['stringify'](_0x3f838c));});};exports[_0xc56b('0x64')]=function(_0x4371f9,_0x1f3aac,_0x2544d3,_0x2e9e05,_0x2f9c94,_0x114e1a){var _0x5a48be,_0x37684b,_0x5791e5,_0x4108f6;_0x114e1a['serverUrl']=intUtil[_0xc56b('0x4a')](_0x114e1a[_0xc56b('0x49')]);_0x114e1a[_0xc56b('0x43')]=intUtil[_0xc56b('0x4a')](_0x114e1a[_0xc56b('0x43')]);if(_0x2f9c94&&_0x2f9c94[_0xc56b('0x4b')]){logger['info']('['+_0x1f3aac[_0xc56b('0x65')][_0xc56b('0x66')]()+']',_0xc56b('0x67'));_0x1f3aac[_0xc56b('0x4c')]=util[_0xc56b('0x30')](_0xc56b('0x4d'),_0x114e1a['serverUrl'],_0x1f3aac[_0xc56b('0x4e')],md5(_0x1f3aac[_0xc56b('0x4e')]));}else{_0x1f3aac['recordingURL']='';}return getConnection(_0x114e1a)[_0xc56b('0x1c')](function(_0x146885){_0x4108f6=_0x146885;if(!_[_0xc56b('0x19')](_0x2e9e05)){return getUser(_0x114e1a,_0x2e9e05[_0xc56b('0x3f')],_0x4108f6);}else{return getUser(_0x114e1a,null,_0x4108f6);}})['then'](function(_0xb1df31){_0x5a48be=_0xb1df31;return getEndUser(_0x114e1a,_0x2544d3,_0x1f3aac[_0xc56b('0x50')],_0x1f3aac[_0xc56b('0x51')],_0x4108f6);})[_0xc56b('0x1c')](function(_0xde3172){_0x37684b=_0xde3172;return getTicket(_0x114e1a,_0x5a48be,_0x37684b,_0x2544d3,_0x1f3aac,_0x2544d3['Fields'],_0x4108f6);})['then'](function(_0x280192){_0x5791e5=_0x280192;logger[_0xc56b('0x21')]('['+_0x1f3aac[_0xc56b('0x65')][_0xc56b('0x66')]()+_0xc56b('0x68'),_0x5791e5['id']);logger['info']('['+_0x1f3aac['lastevent'][_0xc56b('0x66')]()+_0xc56b('0x69'),_0x114e1a[_0xc56b('0x38')]);})['catch'](function(_0x172e97){logger[_0xc56b('0x57')]('['+_0x1f3aac['lastevent'][_0xc56b('0x66')]()+']',JSON['stringify'](_0x172e97));});}; \ 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 42f86c2..7d3cc3f 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(_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 +var _0x7a54=['getString','Descriptions','Fields','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','GET','result','length','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','true','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','type','string','nameField','customField','idField','toLowerCase','content','toString','variable','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign'];(function(_0x41f96e,_0x333851){var _0x48a4ac=function(_0xdad934){while(--_0xdad934){_0x41f96e['push'](_0x41f96e['shift']());}};_0x48a4ac(++_0x333851);}(_0x7a54,0x106));var _0x47a5=function(_0x5b0dac,_0x5da18d){_0x5b0dac=_0x5b0dac-0x0;var _0x17f34d=_0x7a54[_0x5b0dac];return _0x17f34d;};'use strict';var _=require(_0x47a5('0x0'));var Promise=require(_0x47a5('0x1'));var rp=require(_0x47a5('0x2'));var util=require('util');var md5=require(_0x47a5('0x3'));var Redis=require(_0x47a5('0x4'));var intUtil=require('./util');var config=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));config[_0x47a5('0x8')]=_[_0x47a5('0x9')](config['redis'],{'host':_0x47a5('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x47a5('0x8')]));function getAdminUser(_0x30e405,_0x506eda,_0x194fb0,_0x5077f3,_0x5d90b3,_0x582352){return new Promise(function(_0x2a0e98,_0x2baee7){var _0x5e31dd={'method':_0x47a5('0xb'),'uri':_0x5077f3+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x5d90b3+'&'+_0x582352,'auth':_0x506eda,'json':!![]};return rp(_0x5e31dd)['then'](function(_0x1f47f4){if(_0x1f47f4[_0x47a5('0xc')][_0x47a5('0xd')]>0x0){_0x194fb0[_0x47a5('0xe')]=_0x1f47f4[_0x47a5('0xc')][0x0][_0x47a5('0xf')];}logger[_0x47a5('0x10')]('['+[_0x30e405['toUpperCase']()]+_0x47a5('0x11'),_0x194fb0);_0x2a0e98(_0x194fb0);})[_0x47a5('0x12')](function(_0x1cf309){logger[_0x47a5('0x13')]('['+[_0x30e405[_0x47a5('0x14')]()]+']',_0x1cf309[_0x47a5('0x15')]);_0x2baee7(_0x1cf309[_0x47a5('0x15')]);});});}function getUser(_0x190faa,_0x4e99a8,_0x362359,_0x11faf5,_0x3b001e){return function(_0x2a2cbb){logger[_0x47a5('0x10')]('['+[_0x190faa['toUpperCase']()]+'],\x20getUser\x20input\x20crm',_0x2a2cbb);return new Promise(function(_0x138bc0,_0x4b966e){if(intUtil['validateEmail'](_0x2a2cbb[_0x47a5('0x16')])){var _0xaf70a6={'method':_0x47a5('0xb'),'uri':_0x362359+_0x47a5('0x17')+_0x2a2cbb[_0x47a5('0x16')]+'&'+_0x11faf5+'&'+_0x3b001e,'auth':_0x4e99a8,'json':!![]};logger[_0x47a5('0x10')]('['+[_0x190faa[_0x47a5('0x14')]()]+_0x47a5('0x18'),_0xaf70a6);return rp(_0xaf70a6)[_0x47a5('0x19')](function(_0x4a9fcb){logger[_0x47a5('0x10')]('['+[_0x190faa[_0x47a5('0x14')]()]+'],\x20getUser\x20entity',_0x4a9fcb);if(_0x4a9fcb[_0x47a5('0xc')][_0x47a5('0xd')]>0x0&&String(_0x4a9fcb[_0x47a5('0xc')][0x0]['active'])===_0x47a5('0x1a')){_0x2a2cbb[_0x47a5('0x1b')]=_0x4a9fcb[_0x47a5('0xc')][0x0][_0x47a5('0xf')];}else{_0x2a2cbb['userId']=_0x2a2cbb[_0x47a5('0xe')];_0x2a2cbb[_0x47a5('0x16')]=_0x2a2cbb['adminEmail'];}logger[_0x47a5('0x10')]('['+[_0x190faa[_0x47a5('0x14')]()]+_0x47a5('0x1c'),_0x2a2cbb);_0x138bc0(_0x2a2cbb);})[_0x47a5('0x12')](function(_0x3abd6a){logger['error']('['+[_0x190faa['toUpperCase']()]+']',_0x3abd6a[_0x47a5('0x15')]);_0x4b966e(_0x3abd6a['message']);});}else{logger[_0x47a5('0x10')]('['+[_0x190faa['toUpperCase']()]+_0x47a5('0x1d'));_0x2a2cbb[_0x47a5('0x1b')]=_0x2a2cbb[_0x47a5('0xe')];_0x2a2cbb[_0x47a5('0x16')]=_0x2a2cbb[_0x47a5('0x1e')];_0x138bc0(_0x2a2cbb);}});};}function createEndUser(_0x3ba0b7,_0x24b162,_0x136b14,_0x16631f,_0x361bfa){logger[_0x47a5('0x10')]('['+[_0x3ba0b7[_0x47a5('0x14')]()]+_0x47a5('0x1f'),_0x136b14);return new Promise(function(_0x528582,_0x243210){var _0x51833b={'method':_0x47a5('0x20'),'uri':_0x16631f+_0x47a5('0x21')+_0x361bfa,'body':{'user_name':_0x136b14[_0x47a5('0x22')],'roles':'user','first_name':_0x136b14[_0x47a5('0x22')],'active':_0x47a5('0x1a'),'date_format':_0x47a5('0x23'),'phone':_0x136b14[_0x47a5('0x22')]},'auth':_0x24b162,'json':!![]};return rp(_0x51833b)['then'](function(_0x50d875){logger[_0x47a5('0x10')]('['+[_0x3ba0b7[_0x47a5('0x14')]()]+'],\x20EndUser\x20schema',_0x50d875['result']);_0x136b14[_0x47a5('0x24')]=_0x50d875[_0x47a5('0xc')]['sys_id'];_0x528582(_0x136b14);})[_0x47a5('0x12')](function(_0x53119b){logger[_0x47a5('0x13')]('['+[_0x3ba0b7[_0x47a5('0x14')]()]+']',_0x53119b['message']);_0x243210(_0x53119b['message']);});});}function getEndUser(_0x274e34,_0x5910bb,_0x403028,_0x87e4c9,_0xf269a8){return function(_0x52749b){logger[_0x47a5('0x10')]('['+[_0x274e34['toUpperCase']()]+'],\x20getEndUser\x20input\x20crm',_0x52749b);return new Promise(function(_0x65542e,_0x5a8a7c){var _0x25cce0={'method':'GET','uri':_0x403028+_0x47a5('0x25')+_0x52749b[_0x47a5('0x22')]+'&'+_0x87e4c9+'&'+_0xf269a8,'auth':_0x5910bb,'json':!![]};return rp(_0x25cce0)[_0x47a5('0x19')](function(_0x199698){if(_0x199698[_0x47a5('0xc')][_0x47a5('0xd')]>0x0){_0x52749b[_0x47a5('0x24')]=_0x199698[_0x47a5('0xc')][0x0][_0x47a5('0xf')];logger['info']('['+[_0x274e34[_0x47a5('0x14')]()]+_0x47a5('0x26'),_0x52749b);_0x65542e(_0x52749b);}else{return createEndUser(_0x274e34,_0x5910bb,_0x52749b,_0x403028,_0x87e4c9)['then'](function(_0x2c50d6){logger[_0x47a5('0x10')]('['+[_0x274e34[_0x47a5('0x14')]()]+'],\x20createEndUser\x20crm',_0x2c50d6);_0x65542e(_0x2c50d6);});}})[_0x47a5('0x12')](function(_0x10f660){logger['error']('['+[_0x274e34[_0x47a5('0x14')]()]+']',_0x10f660[_0x47a5('0x15')]);_0x5a8a7c(_0x10f660['message']);});});};}function getCustomFields(_0x55c5eb,_0x5ebd8c){var _0x12d9f2={};if(_0x55c5eb['length']>0x0){_[_0x47a5('0x27')](_0x55c5eb,function(_0x1f9631){if(_0x1f9631[_0x47a5('0x28')]===_0x47a5('0x29')&&_0x1f9631[_0x47a5('0x2a')]&&!_0x1f9631[_0x47a5('0x2b')]){_0x12d9f2[_0x1f9631[_0x47a5('0x2c')][_0x47a5('0x2d')]()]=_0x1f9631[_0x47a5('0x2e')][_0x47a5('0x2f')]();}else if(_0x1f9631[_0x47a5('0x28')]===_0x47a5('0x29')&&_0x1f9631[_0x47a5('0x2c')]&&_0x1f9631['customField']){_0x12d9f2[_0x1f9631[_0x47a5('0x2c')][_0x47a5('0x2d')]()]=_0x1f9631[_0x47a5('0x2e')][_0x47a5('0x2f')]();}else if(_0x1f9631['type']===_0x47a5('0x30')&&_0x1f9631['variableName']&&_0x1f9631['idField']&&_0x1f9631['customField']){_0x12d9f2[_0x1f9631['idField'][_0x47a5('0x2d')]()]=_0x5ebd8c[_0x1f9631['variableName']][_0x47a5('0x2f')]();}else if(_0x1f9631[_0x47a5('0x28')]===_0x47a5('0x31')&&_0x1f9631['Variable']&&_0x1f9631[_0x47a5('0x32')][_0x47a5('0x33')]&&_0x1f9631['idField']&&_0x1f9631['customField']){_0x12d9f2[_0x1f9631[_0x47a5('0x2c')]['toLowerCase']()]=_0x5ebd8c[_0x1f9631[_0x47a5('0x32')][_0x47a5('0x33')][_0x47a5('0x2d')]()][_0x47a5('0x2f')]();}});}return _0x12d9f2;}function getTicket(_0x34a9ae,_0xf0edbb,_0x434227,_0x17cc42,_0xac9c15,_0x162fa0){return function(_0x24ecb1){logger[_0x47a5('0x10')]('['+[_0x34a9ae[_0x47a5('0x14')]()]+_0x47a5('0x34'),_0x24ecb1);return new Promise(function(_0x4e5e7,_0x3a2b38){var _0x512e65=_0x34a9ae[_0x47a5('0x2d')]()===_0x47a5('0x35')?_0x24ecb1['userId']:_0x24ecb1['endUserId'];var _0x3d0a88={'method':'POST','uri':_0x434227+_0x47a5('0x36')+'?'+_0x162fa0,'body':Object[_0x47a5('0x37')]({},{'active':'true','caller_id':_0x512e65,'assigned_to':_0x24ecb1['userId'],'short_description':intUtil[_0x47a5('0x38')](_0x17cc42['Subjects'],_0xac9c15,'\x20'),'description':intUtil[_0x47a5('0x38')](_0x17cc42[_0x47a5('0x39')],_0xac9c15,'\x0a')},getCustomFields(_0x17cc42[_0x47a5('0x3a')],_0xac9c15)),'auth':_0xf0edbb,'json':!![]};return rp(_0x3d0a88)[_0x47a5('0x19')](function(_0x44fe8a){logger[_0x47a5('0x10')]('['+[_0x34a9ae[_0x47a5('0x14')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x44fe8a['result']);_0x24ecb1[_0x47a5('0x3b')]=_0x44fe8a[_0x47a5('0xc')][_0x47a5('0xf')];_0x24ecb1[_0x47a5('0x3c')]=_0x44fe8a[_0x47a5('0xc')][_0x47a5('0x3d')];logger[_0x47a5('0x10')]('['+[_0x34a9ae['toUpperCase']()]+_0x47a5('0x3e'),_0x24ecb1);_0x4e5e7(_0x24ecb1);})[_0x47a5('0x12')](function(_0x5f6a){logger['error']('['+[_0x34a9ae[_0x47a5('0x14')]()]+']',_0x5f6a['message']);_0x3a2b38(_0x5f6a[_0x47a5('0x15')]);});});};}function createRemoteTag(_0xe31817,_0x46e90b,_0xf03bd5,_0x588551){return new Promise(function(_0x3adf14,_0x1e6de3){var _0x2f66e9={'method':_0x47a5('0x20'),'uri':_0xf03bd5+_0x47a5('0x3f')+'?'+_0x588551,'body':{'short_description':_0xe31817,'global':!![],'active':!![],'name':_0xe31817},'auth':_0x46e90b,'json':!![]};return rp(_0x2f66e9)[_0x47a5('0x19')](function(_0x24e9f4){var _0x481089=_0x24e9f4[_0x47a5('0xc')][_0x47a5('0xf')];_0x3adf14(_0x481089);});});}function getRemoteTag(_0x187d7e,_0x8da9fb,_0x3329aa,_0x1ab0bf,_0x572233){return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581={'method':'GET','uri':_0x3329aa+_0x47a5('0x3f')+_0x47a5('0x40')+_0x187d7e+'&'+_0x1ab0bf,'auth':_0x8da9fb,'json':!![]};return rp(_0x1aa581)[_0x47a5('0x19')](function(_0x5d8d4a){if(_0x5d8d4a['result'][_0x47a5('0xd')]>0x0){var _0x376e1d=_0x5d8d4a['result'][0x0]['sys_id'];_0x1ad6a9(_0x376e1d);}else{return createRemoteTag(_0x187d7e,_0x8da9fb,_0x3329aa,_0x1ab0bf)[_0x47a5('0x19')](function(_0x4d6a82){_0x1ad6a9(_0x4d6a82);});}});});}function assignTagToIncident(_0x16bb8a,_0x5d383d,_0x482de6,_0x389ed9,_0x46d2d3){return new Promise(function(_0x53eedf,_0x1b958b){var _0x72fe={'method':'POST','uri':_0x482de6+'label_entry'+'?'+_0x46d2d3,'body':{'label':_0x16bb8a,'table':_0x47a5('0x36'),'id_type':_0x47a5('0x41'),'table_key':_0x389ed9[_0x47a5('0x3b')],'title':_0x47a5('0x42')+_0x389ed9['ticketNumber'],'id_display':_0x389ed9[_0x47a5('0x3c')]},'auth':_0x5d383d,'json':!![]};return rp(_0x72fe)[_0x47a5('0x19')](function(_0x1af800){_0x53eedf();})['catch'](function(){_0x53eedf();});});}function manageTags(_0x30ea7a,_0x4db625,_0x485e3c,_0x470da6,_0x943a15,_0x1c485b,_0x3603b7){return new Promise(function(_0x4966af,_0x144af9){var _0x5d1550=[];_0x4db625['forEach'](function(_0x5eb150){_0x5d1550['push'](getRemoteTag(_0x5eb150,_0x485e3c,_0x470da6,_0x1c485b,_0x3603b7));});return Promise[_0x47a5('0x43')](_0x5d1550)[_0x47a5('0x19')](function(_0x1e2bb4){if(_0x1e2bb4['length']){logger['info']('['+[_0x30ea7a[_0x47a5('0x14')]()]+_0x47a5('0x44'),_0x1e2bb4);var _0x45d4b6=[];_0x1e2bb4[_0x47a5('0x27')](function(_0xc45e25){_0x45d4b6['push'](assignTagToIncident(_0xc45e25,_0x485e3c,_0x470da6,_0x943a15,_0x1c485b));});return Promise[_0x47a5('0x43')](_0x45d4b6)['then'](function(){_0x4966af();})[_0x47a5('0x12')](function(){_0x4966af();});}else{_0x4966af();}});});}function getTags(_0x274d31,_0x4d545f,_0x32b4de,_0x345104,_0x132854,_0x3e8274){return function(_0x2d6494){return new Promise(function(_0x215634,_0x35cca8){var _0x3ac38c=[];var _0x57ed0a=_0x345104[_0x47a5('0x45')];if(_0x57ed0a&&_0x57ed0a[_0x47a5('0xd')]>0x0){_0x3ac38c=_[_0x47a5('0x46')](_0x57ed0a,_0x47a5('0x33'));}if(_0x3ac38c[_0x47a5('0xd')]>0x0){return manageTags(_0x274d31,_0x3ac38c,_0x4d545f,_0x32b4de,_0x2d6494,_0x132854,_0x3e8274)['then'](function(){_0x215634(_0x2d6494);});}else{_0x215634(_0x2d6494);}});};}function emit(_0xbec033,_0xdfcecc,_0x1224bc){var _0x144aaa=_0x47a5('0x47')+_0x47a5('0x48')+_0x47a5('0x49')+_0x47a5('0x4a');var _0x350af8={'uri':_0xbec033+_0x47a5('0x4b')+_0x1224bc+_0x144aaa};io['to'](util[_0x47a5('0x4c')](_0x47a5('0x4d'),_0xdfcecc))[_0x47a5('0x4e')](_0x47a5('0x4f'),_0x350af8);}exports['cs']=function(_0x3edd17,_0x5a6161,_0x42dd7d,_0x284fb8,_0x30504e,_0x4b42f3,_0x37ac59,_0x2e46af){var _0x36c67={};var _0x26f1ac={'user':_0x4b42f3['username'],'pass':_0x4b42f3[_0x47a5('0x50')]};var _0x522ccf=_0x47a5('0x51');var _0x487e21=_0x47a5('0x52');_0x4b42f3['remoteUri']=intUtil[_0x47a5('0x53')](_0x4b42f3[_0x47a5('0x54')]);_0x4b42f3[_0x47a5('0x55')]=intUtil['stripTrailingSlash'](_0x4b42f3['serverUrl']);var _0x4b8084=util[_0x47a5('0x4c')](_0x47a5('0x56'),_0x4b42f3[_0x47a5('0x54')]);_0x36c67[_0x47a5('0x16')]=!_['isNil'](_0x284fb8)?_0x284fb8[_0x47a5('0x57')]:null;_0x36c67[_0x47a5('0x1e')]=_0x4b42f3[_0x47a5('0x57')];_0x36c67[_0x47a5('0x22')]=_0x2e46af[_0x47a5('0x2d')]()===_0x47a5('0x35')?_0x5a6161[_0x47a5('0x58')]:_0x5a6161[_0x47a5('0x59')];_0x36c67[_0x47a5('0x5a')]=_0x2e46af===_0x47a5('0x5b')||_0x2e46af===_0x47a5('0x5c')?_0x47a5('0x5b'):'outbound';var _0x1e3212=util['format'](_0x47a5('0x5d'),_0x4b42f3[_0x47a5('0x55')],_0x5a6161[_0x47a5('0x5e')],md5(_0x5a6161[_0x47a5('0x5e')]));if(_0x30504e&&_0x30504e[_0x47a5('0x5f')]){logger[_0x47a5('0x10')](_0x47a5('0x60'),_0x47a5('0x61'));_0x5a6161[_0x47a5('0x62')]=_0x1e3212;}else if(_0x37ac59&&_0x37ac59[_0x47a5('0x63')]&&_0x37ac59[_0x47a5('0x63')]!==_0x47a5('0x64')){logger[_0x47a5('0x10')](_0x47a5('0x65'),_0x47a5('0x61'));_0x5a6161['recordingURL']=_0x1e3212;}else{_0x5a6161['recordingURL']='';}return getAdminUser(_0x2e46af,_0x26f1ac,_0x36c67,_0x4b8084,_0x487e21,_0x522ccf)['then'](getUser(_0x2e46af,_0x26f1ac,_0x4b8084,_0x487e21,_0x522ccf))['then'](getEndUser(_0x2e46af,_0x26f1ac,_0x4b8084,_0x487e21,_0x522ccf))[_0x47a5('0x19')](getTicket(_0x2e46af,_0x26f1ac,_0x4b8084,_0x42dd7d,_0x5a6161,_0x487e21))[_0x47a5('0x19')](function(_0x5d6916){logger[_0x47a5('0x10')](util[_0x47a5('0x4c')](_0x47a5('0x66'),_0x5d6916[_0x47a5('0x3b')]));logger[_0x47a5('0x10')](util[_0x47a5('0x4c')](_0x47a5('0x67'),_0x2e46af));if(_0x2e46af!==_0x47a5('0x5c')){logger[_0x47a5('0x10')]('['+[_0x2e46af[_0x47a5('0x14')]()]+']',_0x47a5('0x68'));emit(_0x4b42f3['remoteUri'],_0x284fb8[_0x47a5('0x33')],_0x5d6916[_0x47a5('0x3b')]);}})[_0x47a5('0x12')](function(_0x4f35ff){logger[_0x47a5('0x13')]('['+[_0x2e46af[_0x47a5('0x14')]()]+_0x47a5('0x69'),util['inspect'](_0x4f35ff,{'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 dd3a79e..8e446cd 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 _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 +var _0x8b8e=['outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','The\x20Ticket\x20ID\x20is:','version','unmanaged','lastevent','isNil','Ticket\x20created!','toUpperCase','lodash','bluebird','util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','toISOString','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','variableName','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','get_entry_list','Employees','user_name','then','entry_list','name_value_list','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Enduser\x20created.','debug','merge','map','forEach','string','nameField','customField','toLowerCase','content','type','custom_fields','variable','push','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','[QUEUE]'];(function(_0x4433fd,_0x4319a7){var _0x5270ef=function(_0x4e5296){while(--_0x4e5296){_0x4433fd['push'](_0x4433fd['shift']());}};_0x5270ef(++_0x4319a7);}(_0x8b8e,0x108));var _0xe8b8=function(_0x38f1a4,_0x66148d){_0x38f1a4=_0x38f1a4-0x0;var _0x453a1a=_0x8b8e[_0x38f1a4];return _0x453a1a;};'use strict';var _=require(_0xe8b8('0x0'));var rp=require('request-promise');var BPromise=require(_0xe8b8('0x1'));var md5=require('md5');var util=require(_0xe8b8('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xe8b8('0x3'));var logger=require(_0xe8b8('0x4'))(_0xe8b8('0x5'));config[_0xe8b8('0x6')]=_[_0xe8b8('0x7')](config[_0xe8b8('0x6')],{'host':_0xe8b8('0x8'),'port':0x18eb});var io=require(_0xe8b8('0x9'))(new Redis(config[_0xe8b8('0x6')]));var def={'method':_0xe8b8('0xa'),'json':!![]};function emit(_0x4ce796,_0x2a4ccd,_0x5cd238){io['to'](_0x4ce796)[_0xe8b8('0xb')](_0x2a4ccd,_0x5cd238);}function getTicket(_0x4ea70a,_0x48b59f,_0x2ccbeb,_0xcf1e01,_0x568241,_0x54eb14,_0x259a1a,_0x42bb8a){logger[_0xe8b8('0xc')](_0xe8b8('0xd'));var _0xf5b5b1=new Date();var _0x298bae=[{'name':_0xe8b8('0xe'),'value':intUtil[_0xe8b8('0xf')](_0xcf1e01[_0xe8b8('0x10')],_0x568241,'\x20')},{'name':_0xe8b8('0x11'),'value':_0x48b59f['id']},{'name':_0xe8b8('0x12'),'value':_0x48b59f['id']},{'name':_0xe8b8('0x13'),'value':intUtil[_0xe8b8('0xf')](_0xcf1e01[_0xe8b8('0x14')],_0x568241,'\x0a')},{'name':'date_start','value':_0xf5b5b1[_0xe8b8('0x15')]()['slice'](0x0,0x13)[_0xe8b8('0x16')]('T','\x20')},{'name':_0xe8b8('0x17'),'value':'0'},{'name':_0xe8b8('0x18'),'value':'15'},{'name':_0xe8b8('0x19'),'value':_0x2ccbeb['id']},{'name':_0xe8b8('0x1a'),'value':_0xe8b8('0x1b')},{'name':_0xe8b8('0x1c'),'value':_0x2ccbeb[_0xe8b8('0xe')]},{'name':_0xe8b8('0x1d'),'value':_0x42bb8a}];if(_0x54eb14[_0xe8b8('0x1e')]){_['forEach'](_0x54eb14,function(_0xbaca4a){if(_0x568241[_0xbaca4a[_0xe8b8('0x1f')]]){_0x298bae['push']({'name':_0xbaca4a[_0xe8b8('0x20')],'value':_0x568241[_0xbaca4a[_0xe8b8('0x1f')]]});}});}return request({'form':{'method':_0xe8b8('0x21'),'input_type':_0xe8b8('0x22'),'response_type':_0xe8b8('0x22'),'rest_data':JSON[_0xe8b8('0x23')]({'session':_0x259a1a['id'],'module_name':_0xe8b8('0x24'),'name_value_list':_0x298bae})}});}function getAuth(_0x36c273){return util[_0xe8b8('0x25')](_0xe8b8('0x26'),new Buffer(_0x36c273[_0xe8b8('0x27')]+':X')[_0xe8b8('0x28')](_0xe8b8('0x29')));}function getServerInfo(_0x15abeb){return request({'form':{'method':_0xe8b8('0x2a'),'input_type':_0xe8b8('0x22'),'response_type':_0xe8b8('0x22'),'rest_data':JSON['stringify']({'session':_0x15abeb['id']})}});}function getUser(_0x57faf7,_0x566721,_0x4769fe){if(!_['isNil'](_0x566721)){logger[_0xe8b8('0xc')]('Getting\x20agent\x20with\x20name',_0x566721);return request({'form':{'method':_0xe8b8('0x2b'),'input_type':_0xe8b8('0x22'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x4769fe['id'],'module_name':_0xe8b8('0x2c'),'query':util[_0xe8b8('0x25')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x566721),'order_by':'','offset':'0','select_fields':['id',_0xe8b8('0xe'),_0xe8b8('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe8b8('0x2e')](function(_0x46b2dc){if(_0x46b2dc[_0xe8b8('0x2f')]['length']){var _0x2e9ca5=_['find'](_0x46b2dc[_0xe8b8('0x2f')],function(_0x402e6c){return _0x402e6c[_0xe8b8('0x30')][_0xe8b8('0x2d')]['value']===_0x566721;});if(_0x2e9ca5){logger['info'](_0xe8b8('0x31'));return BPromise[_0xe8b8('0x32')]({'id':_0x2e9ca5[_0xe8b8('0x30')]['id'][_0xe8b8('0x33')],'name':_0x2e9ca5[_0xe8b8('0x30')]['name'][_0xe8b8('0x33')]});}}logger[_0xe8b8('0xc')](_0xe8b8('0x34'));return BPromise[_0xe8b8('0x32')]({'id':_0x4769fe[_0xe8b8('0x30')][_0xe8b8('0x35')][_0xe8b8('0x33')],'name':_0x4769fe[_0xe8b8('0x30')][_0xe8b8('0x2d')][_0xe8b8('0x33')]});});}else{logger[_0xe8b8('0xc')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xe8b8('0x32')]({'id':_0x4769fe[_0xe8b8('0x30')][_0xe8b8('0x35')]['value'],'name':_0x4769fe[_0xe8b8('0x30')][_0xe8b8('0x2d')][_0xe8b8('0x33')]});}}function getEndUser(_0x30d02c,_0x2ceb8b,_0x472753,_0x2e949c){logger[_0xe8b8('0xc')](_0xe8b8('0x36'),_0x472753);return request({'form':{'method':'get_entry_list','input_type':_0xe8b8('0x22'),'response_type':_0xe8b8('0x22'),'rest_data':JSON['stringify']({'session':_0x2e949c['id'],'module_name':_0xe8b8('0x1b'),'query':util[_0xe8b8('0x25')](_0xe8b8('0x37'),_0x472753),'order_by':'','offset':'0','select_fields':['id',_0xe8b8('0xe'),_0xe8b8('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x2b2127){if(_0x2b2127[_0xe8b8('0x2f')][_0xe8b8('0x1e')]){var _0x16f8fa=_[_0xe8b8('0x39')](_0x2b2127[_0xe8b8('0x2f')],function(_0x4d617b){return _0x4d617b[_0xe8b8('0x30')]['phone_home'][_0xe8b8('0x33')]===_0x472753;});if(_0x16f8fa){logger[_0xe8b8('0xc')]('Enduser\x20found!');return BPromise['resolve']({'id':_0x16f8fa[_0xe8b8('0x30')]['id'][_0xe8b8('0x33')],'name':_0x16f8fa[_0xe8b8('0x30')][_0xe8b8('0xe')]['value'],'phone':_0x16f8fa[_0xe8b8('0x30')][_0xe8b8('0x38')][_0xe8b8('0x33')]});}}else{logger[_0xe8b8('0xc')](_0xe8b8('0x3a'));return request({'form':{'method':_0xe8b8('0x21'),'input_type':_0xe8b8('0x22'),'response_type':_0xe8b8('0x22'),'rest_data':JSON['stringify']({'session':_0x2e949c['id'],'module_name':'Contacts','name_value_list':[{'name':_0xe8b8('0x3b'),'value':_0x2ceb8b!==_0xe8b8('0x3c')?_0x2ceb8b:util[_0xe8b8('0x25')]('Caller\x20-\x20%s',_0x472753)},{'name':_0xe8b8('0x38'),'value':_0x472753}]})}})[_0xe8b8('0x2e')](function(_0x7a96fd){logger[_0xe8b8('0xc')](_0xe8b8('0x3d'));return BPromise[_0xe8b8('0x32')]({'id':_0x7a96fd['id'],'name':_0x7a96fd[_0xe8b8('0x2f')]['first_name']['value'],'phone':_0x7a96fd['entry_list'][_0xe8b8('0x38')][_0xe8b8('0x33')]});});}});}function request(_0x1068eb){logger[_0xe8b8('0x3e')]('[HTTP]',JSON[_0xe8b8('0x23')](_0x1068eb));return rp(_[_0xe8b8('0x3f')](def,_0x1068eb));}function getTags(_0x34a6a1,_0x1c51f7){var _0x5484f5=[];if(_0x34a6a1&&_0x34a6a1['length']>0x0){_0x5484f5=_[_0xe8b8('0x40')](_0x34a6a1,_0x1c51f7);}return _0x5484f5;}function getCustomFields(_0x376c8c,_0x19d4f4){var _0x51cfc1=[];var _0x1cd734={'custom_fields':[]};if(_0x376c8c[_0xe8b8('0x1e')]>0x0){_[_0xe8b8('0x41')](_0x376c8c,function(_0x5391f5){if(_0x5391f5['type']===_0xe8b8('0x42')&&_0x5391f5[_0xe8b8('0x43')]&&!_0x5391f5[_0xe8b8('0x44')]){_0x1cd734[_0x5391f5[_0xe8b8('0x43')][_0xe8b8('0x45')]()]=_0x5391f5[_0xe8b8('0x46')][_0xe8b8('0x28')]();}else if(_0x5391f5[_0xe8b8('0x47')]===_0xe8b8('0x42')&&_0x5391f5[_0xe8b8('0x20')]&&_0x5391f5[_0xe8b8('0x44')]){_0x1cd734[_0xe8b8('0x48')]['push']({'id':_0x5391f5['idField'],'value':_0x5391f5[_0xe8b8('0x46')][_0xe8b8('0x28')]()});}else if(_0x5391f5[_0xe8b8('0x47')]===_0xe8b8('0x49')&&_0x5391f5[_0xe8b8('0x1f')]&&_0x5391f5[_0xe8b8('0x20')]&&_0x5391f5[_0xe8b8('0x44')]){_0x19d4f4[_0x5391f5['variableName']]&&_0x1cd734['custom_fields'][_0xe8b8('0x4a')]({'id':_0x5391f5[_0xe8b8('0x20')],'value':_0x19d4f4[_0x5391f5['variableName']][_0xe8b8('0x28')]()});}else if(_0x5391f5[_0xe8b8('0x47')]===_0xe8b8('0x4b')&&_0x5391f5[_0xe8b8('0x4c')]&&_0x5391f5[_0xe8b8('0x4c')][_0xe8b8('0xe')]&&_0x5391f5[_0xe8b8('0x20')]&&_0x5391f5[_0xe8b8('0x44')]){_0x19d4f4[_0x5391f5[_0xe8b8('0x4c')][_0xe8b8('0xe')][_0xe8b8('0x45')]()]&&_0x1cd734[_0xe8b8('0x48')]['push']({'id':_0x5391f5[_0xe8b8('0x20')],'value':_0x19d4f4[_0x5391f5['Variable'][_0xe8b8('0xe')][_0xe8b8('0x45')]()][_0xe8b8('0x28')]()});}});}return _0x1cd734;}function getConnection(_0x11fc39){return request({'method':'POST','form':{'method':_0xe8b8('0x4d'),'input_type':_0xe8b8('0x22'),'response_type':'JSON','rest_data':JSON[_0xe8b8('0x23')]({'user_auth':{'user_name':_0x11fc39[_0xe8b8('0x4e')],'password':_0x11fc39[_0xe8b8('0x4f')],'encryption':_0xe8b8('0x50')},'application':_0xe8b8('0x51')})}})[_0xe8b8('0x2e')](function(_0x487e3a){var _0x163b6d=_0x487e3a;if(_0x163b6d['id']){def['sessionID']=_0x163b6d['id'];return BPromise['resolve'](_0x163b6d);}else{throw new Error(util[_0xe8b8('0x25')](_0xe8b8('0x52'),_0x11fc39['id']));}});}function setRelationship(_0x4743c3,_0x152c65,_0x1b30ac,_0x17d0e0){return request({'form':{'method':_0xe8b8('0x53'),'input_type':_0xe8b8('0x22'),'response_type':_0xe8b8('0x22'),'rest_data':JSON[_0xe8b8('0x23')]({'session':_0x4743c3['id'],'module_name':_0xe8b8('0x24'),'module_id':_0x1b30ac['id'],'link_field_name':_0x17d0e0,'related_ids':[_0x152c65['id']]})}});}exports['queue']=function(_0x8cb41b,_0x1ddef8,_0x98f10f,_0x3de2d4,_0x4dfd76,_0x330be9){var _0x4c419a,_0x385e35,_0x46ff8d,_0x4ab15e;_0x330be9[_0xe8b8('0x54')]=intUtil['stripTrailingSlash'](_0x330be9[_0xe8b8('0x54')]);_0x330be9[_0xe8b8('0x55')]=intUtil[_0xe8b8('0x56')](_0x330be9['serverUrl']);def[_0xe8b8('0x57')]=util[_0xe8b8('0x25')](_0xe8b8('0x58'),_0x330be9[_0xe8b8('0x54')]);if(_0x4dfd76&&_0x4dfd76[_0xe8b8('0x59')]){logger[_0xe8b8('0xc')]('[QUEUE]',_0xe8b8('0x5a'));_0x1ddef8[_0xe8b8('0x5b')]=util[_0xe8b8('0x25')](_0xe8b8('0x5c'),_0x330be9[_0xe8b8('0x55')],_0x1ddef8[_0xe8b8('0x5d')],md5(_0x1ddef8[_0xe8b8('0x5d')]));}else{_0x1ddef8[_0xe8b8('0x5b')]='';}return getConnection(_0x330be9)[_0xe8b8('0x2e')](function(_0x497844){_0x4ab15e=_0x497844;return getUser(_0x330be9,_0x3de2d4['name'],_0x4ab15e);})['then'](function(_0x537907){_0x4c419a=_0x537907;logger[_0xe8b8('0xc')](_0xe8b8('0x5e'),_0x4c419a['id']);return getEndUser(_0x330be9,_0x1ddef8[_0xe8b8('0x5f')],_0x1ddef8[_0xe8b8('0x60')],_0x4ab15e);})[_0xe8b8('0x2e')](function(_0x3387e7){_0x385e35=_0x3387e7;logger[_0xe8b8('0xc')](_0xe8b8('0x61'),_0x385e35['id']);return getTicket(_0x330be9,_0x4c419a,_0x385e35,_0x98f10f,_0x1ddef8,_0x98f10f[_0xe8b8('0x62')],_0x4ab15e,_0xe8b8('0x63'));})[_0xe8b8('0x2e')](function(_0x290764){_0x46ff8d=_0x290764;logger[_0xe8b8('0xc')]('Ticket\x20created!');logger[_0xe8b8('0xc')]('The\x20Ticket\x20ID\x20is:',_0x46ff8d['id']);return setRelationship(_0x4ab15e,_0x4c419a,_0x46ff8d,_0xe8b8('0x64'));})['then'](function(){return setRelationship(_0x4ab15e,_0x385e35,_0x46ff8d,_0xe8b8('0x65'));})[_0xe8b8('0x2e')](function(){return getServerInfo(_0x4ab15e);})[_0xe8b8('0x2e')](function(_0x261af8){var _0x3b52ab=parseInt(_0x261af8['version'][_0xe8b8('0x66')](0x0));var _0x39c471=util['format'](_0xe8b8('0x67'),_0x330be9[_0xe8b8('0x54')],_0x46ff8d['id']);if(_0x3b52ab>0x6){_0x39c471=util['format'](_0xe8b8('0x68'),_0x330be9[_0xe8b8('0x54')],_0x46ff8d['id']);}logger[_0xe8b8('0xc')]('[QUEUE]',_0xe8b8('0x69'));emit(util[_0xe8b8('0x25')](_0xe8b8('0x6a'),_0x3de2d4[_0xe8b8('0xe')]),_0xe8b8('0x6b'),{'uri':_0x39c471});})[_0xe8b8('0x6c')](function(_0x2be0a0){logger[_0xe8b8('0x6d')](_0xe8b8('0x6e'),JSON[_0xe8b8('0x23')](_0x2be0a0));});};exports[_0xe8b8('0x6f')]=function(_0x35a30b,_0x813d30,_0x118b6a,_0x4de7d1,_0x3f5a9f,_0x4d632b,_0x49d044){var _0x4f08e0,_0x1dc6fb,_0x1b382a,_0x2d739c;_0x4d632b[_0xe8b8('0x54')]=intUtil['stripTrailingSlash'](_0x4d632b[_0xe8b8('0x54')]);_0x4d632b['serverUrl']=intUtil[_0xe8b8('0x56')](_0x4d632b['serverUrl']);def[_0xe8b8('0x57')]=util[_0xe8b8('0x25')](_0xe8b8('0x58'),_0x4d632b[_0xe8b8('0x54')]);if(_0x49d044&&_0x49d044['recordingFormat']&&_0x49d044[_0xe8b8('0x70')]!==_0xe8b8('0x71')){logger['info'](_0xe8b8('0x72'),'Recording\x20is\x20enabled!');_0x813d30['recordingURL']=util[_0xe8b8('0x25')](_0xe8b8('0x5c'),_0x4d632b[_0xe8b8('0x55')],_0x813d30[_0xe8b8('0x5d')],md5(_0x813d30[_0xe8b8('0x5d')]));}return getConnection(_0x4d632b)[_0xe8b8('0x2e')](function(_0x1a0334){_0x2d739c=_0x1a0334;return getUser(_0x4d632b,_0x4de7d1[_0xe8b8('0xe')],_0x2d739c);})[_0xe8b8('0x2e')](function(_0x459f99){_0x4f08e0=_0x459f99;logger[_0xe8b8('0xc')]('The\x20User\x20ID\x20is:',_0x4f08e0['id']);return getEndUser(_0x4d632b,_0x813d30[_0xe8b8('0x73')],_0x813d30[_0xe8b8('0x74')],_0x2d739c);})['then'](function(_0x376a5c){_0x1dc6fb=_0x376a5c;logger['info'](_0xe8b8('0x61'),_0x1dc6fb['id']);return getTicket(_0x4d632b,_0x4f08e0,_0x1dc6fb,_0x118b6a,_0x813d30,_0x118b6a[_0xe8b8('0x62')],_0x2d739c,_0xe8b8('0x75'));})[_0xe8b8('0x2e')](function(_0x8e64f7){_0x1b382a=_0x8e64f7;logger[_0xe8b8('0xc')]('Ticket\x20created!');logger[_0xe8b8('0xc')](_0xe8b8('0x76'),_0x1b382a['id']);return setRelationship(_0x2d739c,_0x4f08e0,_0x1b382a,'users');})[_0xe8b8('0x2e')](function(){return setRelationship(_0x2d739c,_0x1dc6fb,_0x1b382a,_0xe8b8('0x65'));})[_0xe8b8('0x2e')](function(){return getServerInfo(_0x2d739c);})[_0xe8b8('0x2e')](function(_0x525d66){var _0x8eba01=parseInt(_0x525d66[_0xe8b8('0x77')][_0xe8b8('0x66')](0x0));var _0x30e7fd=util['format'](_0xe8b8('0x67'),_0x4d632b[_0xe8b8('0x54')],_0x1b382a['id']);if(_0x8eba01>0x6){_0x30e7fd=util[_0xe8b8('0x25')](_0xe8b8('0x68'),_0x4d632b['remoteUri'],_0x1b382a['id']);}logger['info']('[OUTBOUND]',_0xe8b8('0x69'));emit(util[_0xe8b8('0x25')](_0xe8b8('0x6a'),_0x4de7d1[_0xe8b8('0xe')]),_0xe8b8('0x6b'),{'uri':_0x30e7fd});})[_0xe8b8('0x6c')](function(_0x5cf5b3){logger[_0xe8b8('0x6d')]('[OUTBOUND]',JSON[_0xe8b8('0x23')](_0x5cf5b3));});};exports[_0xe8b8('0x78')]=function(_0x5ab64e,_0x2d2580,_0x765bd,_0x28f1c4,_0x3268bf,_0x522de9){var _0x203e63,_0x11a911,_0x8515a9,_0x536bc3;_0x522de9['remoteUri']=intUtil['stripTrailingSlash'](_0x522de9[_0xe8b8('0x54')]);_0x522de9[_0xe8b8('0x55')]=intUtil[_0xe8b8('0x56')](_0x522de9[_0xe8b8('0x55')]);def[_0xe8b8('0x57')]=util[_0xe8b8('0x25')](_0xe8b8('0x58'),_0x522de9[_0xe8b8('0x54')]);if(_0x3268bf&&_0x3268bf[_0xe8b8('0x59')]){logger[_0xe8b8('0xc')]('['+_0x2d2580[_0xe8b8('0x79')]['toUpperCase']()+']',_0xe8b8('0x5a'));_0x2d2580[_0xe8b8('0x5b')]=util[_0xe8b8('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x522de9[_0xe8b8('0x55')],_0x2d2580['uniqueid'],md5(_0x2d2580[_0xe8b8('0x5d')]));}else{_0x2d2580[_0xe8b8('0x5b')]='';}return getConnection(_0x522de9)[_0xe8b8('0x2e')](function(_0xd5cb61){_0x536bc3=_0xd5cb61;if(!_[_0xe8b8('0x7a')](_0x28f1c4)){return getUser(_0x522de9,_0x28f1c4['name'],_0x536bc3);}else{return getUser(_0x522de9,null,_0x536bc3);}})[_0xe8b8('0x2e')](function(_0x41c34b){_0x203e63=_0x41c34b;logger['info'](_0xe8b8('0x5e'),_0x203e63['id']);return getEndUser(_0x522de9,_0x2d2580[_0xe8b8('0x5f')],_0x2d2580[_0xe8b8('0x60')],_0x536bc3);})[_0xe8b8('0x2e')](function(_0x5a75b5){_0x11a911=_0x5a75b5;logger[_0xe8b8('0xc')](_0xe8b8('0x61'),_0x11a911['id']);return getTicket(_0x522de9,_0x203e63,_0x11a911,_0x765bd,_0x2d2580,_0x765bd[_0xe8b8('0x62')],_0x536bc3,_0xe8b8('0x63'));})[_0xe8b8('0x2e')](function(_0x45d463){_0x8515a9=_0x45d463;logger[_0xe8b8('0xc')](_0xe8b8('0x7b'));logger[_0xe8b8('0xc')](_0xe8b8('0x76'),_0x8515a9['id']);return setRelationship(_0x536bc3,_0x203e63,_0x8515a9,_0xe8b8('0x64'));})[_0xe8b8('0x2e')](function(){return setRelationship(_0x536bc3,_0x11a911,_0x8515a9,'contacts');})['then'](function(){return getServerInfo(_0x536bc3);})[_0xe8b8('0x6c')](function(_0x3232d4){logger['error']('['+_0x2d2580[_0xe8b8('0x79')][_0xe8b8('0x7c')]()+']',JSON[_0xe8b8('0x23')](_0x3232d4));});}; \ 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 7846cd8..64b2e91 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 _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 +var _0xcd93=['util','getString','length','sortBy','type','string','content','variable','variableName','Variable','name','toLowerCase','push','toString','keyValue','keyType','key','%s:\x20%s','keyContent','format','customVariable','join','stripTrailingSlash','slice','substring','test'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xcd93,0x186));var _0x3cd9=function(_0x4a2c82,_0x3a7eeb){_0x4a2c82=_0x4a2c82-0x0;var _0x5d7462=_0xcd93[_0x4a2c82];return _0x5d7462;};'use strict';var _=require('lodash');var util=require(_0x3cd9('0x0'));exports[_0x3cd9('0x1')]=function(_0x25b74f,_0x1286be,_0x173e54){var _0x3ba1a9=[];if(_0x25b74f[_0x3cd9('0x2')]>0x0){var _0x102312=_[_0x3cd9('0x3')](_0x25b74f,['id']);for(var _0x4ff201=0x0;_0x4ff201<_0x102312[_0x3cd9('0x2')];_0x4ff201++){var _0x478ce5=_0x102312[_0x4ff201];if(_0x478ce5[_0x3cd9('0x4')]===_0x3cd9('0x5')){_0x3ba1a9['push'](_0x478ce5[_0x3cd9('0x6')]);}else if(_0x478ce5[_0x3cd9('0x4')]===_0x3cd9('0x7')&&_0x478ce5[_0x3cd9('0x8')]){_0x1286be[_0x478ce5[_0x3cd9('0x8')]]&&_0x3ba1a9['push'](_0x1286be[_0x478ce5['variableName']]['toString']());}else if(_0x478ce5[_0x3cd9('0x4')]==='customVariable'&&_0x478ce5[_0x3cd9('0x9')]&&_0x478ce5[_0x3cd9('0x9')][_0x3cd9('0xa')]){_0x1286be[_0x478ce5['Variable'][_0x3cd9('0xa')][_0x3cd9('0xb')]()]&&_0x3ba1a9[_0x3cd9('0xc')](_0x1286be[_0x478ce5['Variable'][_0x3cd9('0xa')]['toLowerCase']()][_0x3cd9('0xd')]());}else if(_0x478ce5[_0x3cd9('0x4')]===_0x3cd9('0xe')){if(_0x478ce5[_0x3cd9('0xf')]===_0x3cd9('0x5')&&_0x478ce5[_0x3cd9('0x10')]){_0x3ba1a9[_0x3cd9('0xc')](util['format'](_0x3cd9('0x11'),_0x478ce5[_0x3cd9('0x10')],_0x478ce5[_0x3cd9('0x12')]));}else if(_0x478ce5[_0x3cd9('0xf')]==='variable'&&_0x478ce5[_0x3cd9('0x8')]&&_0x478ce5[_0x3cd9('0x10')]){_0x1286be[_0x478ce5[_0x3cd9('0x8')]]&&_0x3ba1a9[_0x3cd9('0xc')](util[_0x3cd9('0x13')](_0x3cd9('0x11'),_0x478ce5[_0x3cd9('0x10')],_0x1286be[_0x478ce5[_0x3cd9('0x8')]]));}else if(_0x478ce5[_0x3cd9('0xf')]===_0x3cd9('0x14')&&_0x478ce5[_0x3cd9('0x9')]&&_0x478ce5['Variable'][_0x3cd9('0xa')]&&_0x478ce5[_0x3cd9('0x10')]){_0x1286be[_0x478ce5['Variable'][_0x3cd9('0xa')][_0x3cd9('0xb')]()]&&_0x3ba1a9[_0x3cd9('0xc')](util[_0x3cd9('0x13')]('%s:\x20%s',_0x478ce5[_0x3cd9('0x10')],_0x1286be[_0x478ce5[_0x3cd9('0x9')][_0x3cd9('0xa')][_0x3cd9('0xb')]()]));}}}}return _0x3ba1a9[_0x3cd9('0x15')](_0x173e54);};exports[_0x3cd9('0x16')]=function(_0x67682e){var _0x43f456=_0x67682e[_0x3cd9('0x17')](-0x1);if(_0x43f456==='/'){_0x67682e=_0x67682e[_0x3cd9('0x18')](0x0,_0x67682e['lastIndexOf'](_0x43f456));}return _0x67682e;};exports['validateEmail']=function(_0xf9a43f){if(!_['isNil'](_0xf9a43f)&&_0xf9a43f!==''){var _0x1f1310=/^(([^<>()\[\]\\.,;:\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 _0x1f1310[_0x3cd9('0x19')](String(_0xf9a43f)[_0x3cd9('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 61c29a2..6806445 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 _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 +var _0xf749=['createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','format','length','Agent\x20found!','resolve','email1','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','success','Enduser\x20found!','firstname','lastname','Enduser\x20created.','getEndUser','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','user:%s','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','monitor_format','lastevent','toUpperCase','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','defaults','redis','forEach','type','string','idField','content','toString','variableName','customVariable','Variable','name','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','Descriptions','POST','remoteUri','create','username','sessionName','HelpDesk','stringify','then','result','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x129327,_0x3ada11){var _0x53a8c3=function(_0x52f008){while(--_0x52f008){_0x129327['push'](_0x129327['shift']());}};_0x53a8c3(++_0x3ada11);}(_0xf749,0xf7));var _0x9f74=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xf749[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x9f74('0x0'));var md5=require(_0x9f74('0x1'));var util=require(_0x9f74('0x2'));var Redis=require(_0x9f74('0x3'));var intUtil=require(_0x9f74('0x4'));var config=require(_0x9f74('0x5'));var logger=require(_0x9f74('0x6'))(_0x9f74('0x7'));config['redis']=_[_0x9f74('0x8')](config[_0x9f74('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9f74('0x9')]));function emit(_0xe45a23,_0x137007,_0x1825cd){io['to'](_0xe45a23)['emit'](_0x137007,_0x1825cd);}function getCustomFields(_0x37ae58,_0x273545){var _0x506e43={};if(_0x37ae58['length']>0x0){_[_0x9f74('0xa')](_0x37ae58,function(_0x420295){if(_0x420295[_0x9f74('0xb')]===_0x9f74('0xc')&&_0x420295[_0x9f74('0xd')]){_0x506e43[_0x420295['idField']]=_0x420295[_0x9f74('0xe')][_0x9f74('0xf')]();}else if(_0x420295[_0x9f74('0xb')]==='variable'&&_0x420295[_0x9f74('0x10')]&&_0x420295[_0x9f74('0xd')]&&_0x273545[_0x420295[_0x9f74('0x10')]]){_0x506e43[_0x420295[_0x9f74('0xd')]]=_0x273545[_0x420295[_0x9f74('0x10')]][_0x9f74('0xf')]();}else if(_0x420295['type']===_0x9f74('0x11')&&_0x420295['Variable']&&_0x420295[_0x9f74('0x12')][_0x9f74('0x13')]&&_0x420295[_0x9f74('0xd')]&&_0x273545[_0x420295['Variable'][_0x9f74('0x13')]['toLowerCase']()]){_0x506e43[_0x420295[_0x9f74('0xd')]]=_0x273545[_0x420295[_0x9f74('0x12')][_0x9f74('0x13')]['toLowerCase']()][_0x9f74('0xf')]();}});}return _0x506e43;}function createTicket(_0x32250f,_0x1a508c,_0x4db3e3,_0x6864d0,_0x4fde97,_0x193872,_0x3d89b8){logger[_0x9f74('0x14')](_0x9f74('0x15'));var _0x4af72f=_[_0x9f74('0x16')]({'parent_id':'','assigned_user_id':_0x1a508c['id'],'ticketpriorities':_0x9f74('0x17'),'ticketstatus':_0x9f74('0x18'),'ticket_title':intUtil[_0x9f74('0x19')](_0x6864d0[_0x9f74('0x1a')],_0x4fde97,'\x20'),'description':intUtil[_0x9f74('0x19')](_0x6864d0[_0x9f74('0x1b')],_0x4fde97,'\x0a'),'contact_id':_0x4db3e3['id']},getCustomFields(_0x193872,_0x4fde97));var _0x5c3db7={'method':_0x9f74('0x1c'),'uri':util['format']('%s/webservice.php',_0x32250f[_0x9f74('0x1d')]),'form':{'operation':_0x9f74('0x1e'),'username':_0x32250f[_0x9f74('0x1f')],'sessionName':_0x3d89b8[_0x9f74('0x20')],'elementType':_0x9f74('0x21'),'element':JSON[_0x9f74('0x22')](_0x4af72f)},'json':!![]};return request(_0x5c3db7)[_0x9f74('0x23')](function(_0x4fabac){if(_0x4fabac['success']){return BPromise['resolve']({'id':_0x4fabac[_0x9f74('0x24')]['id']});}else{throw new Error(util['format']('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON['stringify'](_0x4fabac[_0x9f74('0x25')])));}})[_0x9f74('0x26')](function(_0x4b89ca){var _0x1548ef=_0x4b89ca[_0x9f74('0x27')]||0x1f4;logger['error'](_0x9f74('0x28'),_0x9f74('0x29'),_0x1548ef,JSON[_0x9f74('0x22')](_0x4b89ca));});}function getUser(_0x1a1f58,_0x178ad6,_0xb87292){if(intUtil[_0x9f74('0x2a')](_0x178ad6)){logger[_0x9f74('0x14')](_0x9f74('0x2b'),_0x178ad6);return request({'method':_0x9f74('0x2c'),'uri':util['format'](_0x9f74('0x2d'),_0x1a1f58[_0x9f74('0x1d')]),'qs':{'operation':_0x9f74('0x2e'),'username':_0x1a1f58[_0x9f74('0x1f')],'sessionName':_0xb87292[_0x9f74('0x20')],'query':util[_0x9f74('0x2f')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x178ad6)},'json':!![]})[_0x9f74('0x23')](function(_0x588ff5){if(_0x588ff5['success']&&_0x588ff5[_0x9f74('0x24')][_0x9f74('0x30')]){logger[_0x9f74('0x14')](_0x9f74('0x31'));return BPromise[_0x9f74('0x32')]({'id':_0x588ff5['result'][0x0]['id'],'email':_0x588ff5[_0x9f74('0x24')][0x0][_0x9f74('0x33')],'name':_0x588ff5['result'][0x0]['first_name']+'\x20'+_0x588ff5[_0x9f74('0x24')]['last_name']});}else{logger[_0x9f74('0x14')](_0x9f74('0x34'));return BPromise['resolve']({'id':_0xb87292[_0x9f74('0x35')],'email':_0x1a1f58[_0x9f74('0x1f')],'name':_0x9f74('0x36')});}})[_0x9f74('0x26')](function(_0x3e5456){var _0x2996c4=_0x3e5456[_0x9f74('0x27')]||0x1f4;logger['error'](_0x9f74('0x28'),'getUser',_0x2996c4,JSON['stringify'](_0x3e5456));});}else{logger[_0x9f74('0x14')](_0x9f74('0x34'));return BPromise[_0x9f74('0x32')]({'id':_0xb87292[_0x9f74('0x35')],'email':_0x1a1f58[_0x9f74('0x1f')],'name':_0x9f74('0x36')})[_0x9f74('0x26')](function(_0x84ab1d){var _0x5d70a7=_0x84ab1d[_0x9f74('0x27')]||0x1f4;logger['error'](_0x9f74('0x28'),_0x9f74('0x37'),_0x5d70a7,JSON[_0x9f74('0x22')](_0x84ab1d));});}}function getEndUser(_0x3573fb,_0x2ddad8,_0x4cd251,_0x3a11e1){logger['info'](_0x9f74('0x38'),_0x4cd251);return request({'method':'GET','uri':util['format']('%s/webservice.php',_0x3573fb['remoteUri']),'qs':{'operation':_0x9f74('0x2e'),'username':_0x3573fb[_0x9f74('0x1f')],'sessionName':_0x3a11e1[_0x9f74('0x20')],'query':util['format'](_0x9f74('0x39'),_0x4cd251,_0x4cd251,_0x4cd251,_0x4cd251,_0x4cd251)},'json':!![]})['then'](function(_0x2f61c3){if(_0x2f61c3[_0x9f74('0x3a')]&&_0x2f61c3[_0x9f74('0x24')][_0x9f74('0x30')]){logger[_0x9f74('0x14')](_0x9f74('0x3b'));return BPromise[_0x9f74('0x32')]({'id':_0x2f61c3['result'][0x0]['id'],'name':_0x2f61c3[_0x9f74('0x24')][0x0][_0x9f74('0x3c')]+'\x20'+_0x2f61c3[_0x9f74('0x24')][0x0][_0x9f74('0x3d')],'phone':_0x4cd251});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0x9f74('0x1c'),'uri':util[_0x9f74('0x2f')]('%s/webservice.php',_0x3573fb[_0x9f74('0x1d')]),'form':{'operation':_0x9f74('0x1e'),'sessionName':_0x3a11e1[_0x9f74('0x20')],'elementType':'Contacts','element':JSON['stringify']({'lastname':_0x2ddad8,'phone':_0x4cd251,'assigned_user_id':'\x20'})},'json':!![]})[_0x9f74('0x23')](function(_0x2913e2){logger[_0x9f74('0x14')](_0x9f74('0x3e'));return BPromise[_0x9f74('0x32')]({'id':_0x2913e2['result']['id'],'name':_0x2913e2[_0x9f74('0x24')]['lastname'],'phone':_0x2913e2[_0x9f74('0x24')]['phone']});})[_0x9f74('0x26')](function(_0x1b3a15){var _0x36c237=_0x1b3a15[_0x9f74('0x27')]||0x1f4;logger[_0x9f74('0x25')](_0x9f74('0x28'),_0x9f74('0x3f'),_0x36c237,JSON['stringify'](_0x1b3a15));});}});}function getConnection(_0x4dd3e1){var _0x592cf7=_0x4dd3e1[_0x9f74('0x1f')];var _0x3ac78a=_0x4dd3e1['accessKey'];return request({'method':_0x9f74('0x2c'),'uri':util[_0x9f74('0x2f')]('%s/webservice.php',_0x4dd3e1['remoteUri']),'qs':{'operation':'getchallenge','username':_0x592cf7},'json':!![]})['then'](function(_0x54c8ed){if(_0x54c8ed['success']){return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x4dd3e1[_0x9f74('0x1d')]),'form':{'operation':_0x9f74('0x40'),'username':_0x592cf7,'accessKey':md5(_0x54c8ed[_0x9f74('0x24')][_0x9f74('0x41')]+_0x3ac78a)},'json':!![]});}})[_0x9f74('0x23')](function(_0x19e179){if(_0x19e179['success']){return BPromise['resolve'](_0x19e179[_0x9f74('0x24')]);}else{throw new Error(util[_0x9f74('0x2f')](_0x9f74('0x42'),_0x4dd3e1['id']));}})[_0x9f74('0x26')](function(_0x5bf9ed){var _0x1de1c5=_0x5bf9ed[_0x9f74('0x27')]||0x1f4;logger['error'](_0x9f74('0x28'),_0x9f74('0x43'),_0x1de1c5,JSON['stringify'](_0x5bf9ed));});}function request(_0x466de2){logger[_0x9f74('0x14')](_0x9f74('0x44'),JSON[_0x9f74('0x22')](_0x466de2));return rp(_0x466de2);}exports[_0x9f74('0x45')]=function(_0x51a2eb,_0x57c165,_0x3454ec,_0x43f8db,_0x4580d1,_0x11c2dd){var _0x4a676f,_0x261dc0,_0x2437a5,_0x11c8f8;_0x11c2dd['remoteUri']=intUtil[_0x9f74('0x46')](_0x11c2dd[_0x9f74('0x1d')]);if(_0x4580d1&&_0x4580d1['monitor_format']){logger[_0x9f74('0x14')](_0x9f74('0x47'),_0x9f74('0x48'));_0x57c165[_0x9f74('0x49')]=util[_0x9f74('0x2f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x11c2dd[_0x9f74('0x4a')],_0x57c165[_0x9f74('0x4b')],md5(_0x57c165[_0x9f74('0x4b')]));}else{_0x57c165[_0x9f74('0x49')]='';}return getConnection(_0x11c2dd)[_0x9f74('0x23')](function(_0x2d294b){_0x11c8f8=_0x2d294b;return getUser(_0x11c2dd,_0x43f8db[_0x9f74('0x4c')],_0x11c8f8);})[_0x9f74('0x23')](function(_0x33b1a2){_0x4a676f=_0x33b1a2;logger[_0x9f74('0x14')](_0x9f74('0x4d'),_0x4a676f['id']);return getEndUser(_0x11c2dd,_0x57c165[_0x9f74('0x4e')],_0x57c165[_0x9f74('0x4f')],_0x11c8f8);})['then'](function(_0x165e36){_0x261dc0=_0x165e36;logger['info'](_0x9f74('0x50'),_0x261dc0['id']);return createTicket(_0x11c2dd,_0x4a676f,_0x261dc0,_0x3454ec,_0x57c165,_0x3454ec[_0x9f74('0x51')],_0x11c8f8);})[_0x9f74('0x23')](function(_0x452052){_0x2437a5=_0x452052;logger['info']('Ticket\x20created!');logger[_0x9f74('0x14')]('The\x20Ticket\x20ID\x20is:',_0x2437a5['id']);var _0x755588=util['format'](_0x9f74('0x52'),_0x11c2dd[_0x9f74('0x1d')],_[_0x9f74('0x53')](_0x2437a5['id'],'x')[0x1]);logger[_0x9f74('0x14')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9f74('0x2f')](_0x9f74('0x54'),_0x43f8db['name']),_0x9f74('0x55'),{'uri':_0x755588});})['catch'](function(_0x8ecdad){logger['error'](_0x9f74('0x47'),JSON[_0x9f74('0x22')](_0x8ecdad));});};exports[_0x9f74('0x56')]=function(_0x257508,_0x4102d3,_0x275402,_0x240729,_0x18376f,_0xa41a1b,_0x8c7f38){var _0x12c7f5,_0x44cc83,_0x2ea4c8,_0x48b0d1;_0xa41a1b['remoteUri']=intUtil['stripTrailingSlash'](_0xa41a1b[_0x9f74('0x1d')]);_0xa41a1b[_0x9f74('0x4a')]=intUtil['stripTrailingSlash'](_0xa41a1b['serverUrl']);if(_0x8c7f38&&_0x8c7f38[_0x9f74('0x57')]&&_0x8c7f38['recordingFormat']!==_0x9f74('0x58')){logger[_0x9f74('0x14')](_0x9f74('0x59'),_0x9f74('0x48'));_0x4102d3[_0x9f74('0x49')]=util[_0x9f74('0x2f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xa41a1b['serverUrl'],_0x4102d3[_0x9f74('0x4b')],md5(_0x4102d3[_0x9f74('0x4b')]));}return getConnection(_0xa41a1b)['then'](function(_0x528423){_0x48b0d1=_0x528423;return getUser(_0xa41a1b,_0x240729['email'],_0x48b0d1);})['then'](function(_0x446c56){_0x12c7f5=_0x446c56;logger['info'](_0x9f74('0x4d'),_0x12c7f5['id']);return getEndUser(_0xa41a1b,_0x4102d3[_0x9f74('0x5a')],_0x4102d3['destcalleridnum'],_0x48b0d1);})[_0x9f74('0x23')](function(_0x9d4c56){_0x44cc83=_0x9d4c56;logger[_0x9f74('0x14')](_0x9f74('0x50'),_0x44cc83['id']);return createTicket(_0xa41a1b,_0x12c7f5,_0x44cc83,_0x275402,_0x4102d3,_0x275402[_0x9f74('0x51')],_0x48b0d1);})[_0x9f74('0x23')](function(_0x553b48){_0x2ea4c8=_0x553b48;logger['info'](_0x9f74('0x5b'));logger[_0x9f74('0x14')](_0x9f74('0x5c'),_0x2ea4c8['id']);var _0x37956c=util[_0x9f74('0x2f')](_0x9f74('0x52'),_0xa41a1b[_0x9f74('0x1d')],_[_0x9f74('0x53')](_0x2ea4c8['id'],'x')[0x1]);logger['info'](_0x9f74('0x59'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9f74('0x2f')](_0x9f74('0x54'),_0x240729[_0x9f74('0x13')]),_0x9f74('0x55'),{'uri':_0x37956c});})[_0x9f74('0x26')](function(_0x5be924){logger[_0x9f74('0x25')](_0x9f74('0x59'),JSON['stringify'](_0x5be924));});};exports['unmanaged']=function(_0x3760a4,_0x1827c2,_0x14cbb3,_0x149b19,_0x4dff5a,_0x2a5460){var _0x5404cd,_0x21f099,_0x205641,_0x20fed5;_0x2a5460['remoteUri']=intUtil[_0x9f74('0x46')](_0x2a5460[_0x9f74('0x1d')]);_0x2a5460[_0x9f74('0x4a')]=intUtil[_0x9f74('0x46')](_0x2a5460['serverUrl']);if(_0x4dff5a&&_0x4dff5a[_0x9f74('0x5d')]){logger['info']('['+_0x1827c2[_0x9f74('0x5e')][_0x9f74('0x5f')]()+']',_0x9f74('0x48'));_0x1827c2[_0x9f74('0x49')]=util[_0x9f74('0x2f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2a5460[_0x9f74('0x4a')],_0x1827c2[_0x9f74('0x4b')],md5(_0x1827c2[_0x9f74('0x4b')]));}else{_0x1827c2[_0x9f74('0x49')]='';}return getConnection(_0x2a5460)[_0x9f74('0x23')](function(_0xe30aab){_0x20fed5=_0xe30aab;return getUser(_0x2a5460,'',_0x20fed5);})[_0x9f74('0x23')](function(_0x5757c0){_0x5404cd=_0x5757c0;logger[_0x9f74('0x14')](_0x9f74('0x4d'),_0x5404cd['id']);return getEndUser(_0x2a5460,_0x1827c2[_0x9f74('0x4e')],_0x1827c2['calleridnum'],_0x20fed5);})[_0x9f74('0x23')](function(_0x3b4842){_0x21f099=_0x3b4842;logger['info']('The\x20Enduser\x20ID\x20is:',_0x21f099['id']);return createTicket(_0x2a5460,_0x5404cd,_0x21f099,_0x14cbb3,_0x1827c2,_0x14cbb3[_0x9f74('0x51')],_0x20fed5);})[_0x9f74('0x23')](function(_0x3f16d1){_0x205641=_0x3f16d1;logger[_0x9f74('0x14')](_0x9f74('0x5b'));logger[_0x9f74('0x14')]('The\x20Ticket\x20ID\x20is:',_0x205641['id']);})[_0x9f74('0x26')](function(_0x24f709){logger[_0x9f74('0x25')]('['+_0x1827c2[_0x9f74('0x5e')][_0x9f74('0x5f')]()+']',JSON['stringify'](_0x24f709));});}; \ 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 26a6476..f52755a 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 _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 +var _0x7341=['catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','trigger:browser:url','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','calleridname','md5','ioredis','./util','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','Agent\x20found!','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','filter','length','Enduser\x20found!','%s/users.json','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','Basic\x20%s','toString','base64','debug','stringify','GET','forEach','type','nameField','toLowerCase','content','string','idField','customField','custom_fields','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','error'];(function(_0x3c270c,_0x43c16e){var _0x374145=function(_0x25287d){while(--_0x25287d){_0x3c270c['push'](_0x3c270c['shift']());}};_0x374145(++_0x43c16e);}(_0x7341,0xe4));var _0x1734=function(_0x546a71,_0x283a88){_0x546a71=_0x546a71-0x0;var _0x331d01=_0x7341[_0x546a71];return _0x331d01;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x1734('0x0'));var util=require('util');var Redis=require(_0x1734('0x1'));var intUtil=require(_0x1734('0x2'));var config=require('../../../../config/environment');var logger=require(_0x1734('0x3'))(_0x1734('0x4'));config[_0x1734('0x5')]=_[_0x1734('0x6')](config[_0x1734('0x5')],{'host':_0x1734('0x7'),'port':0x18eb});var io=require(_0x1734('0x8'))(new Redis(config['redis']));function emit(_0x1ca30b,_0x2c223d,_0x45c529){io['to'](_0x1ca30b)['emit'](_0x2c223d,_0x45c529);}var headers={'Content-Type':_0x1734('0x9'),'Accept':'application/json'};function getTicket(_0x56f0d5,_0x55b846,_0xcf0632,_0x11b325,_0x23d8d2){logger[_0x1734('0xa')](_0x1734('0xb'));return request({'uri':util[_0x1734('0xc')](_0x1734('0xd'),_0x56f0d5[_0x1734('0xe')]),'method':_0x1734('0xf'),'body':{'ticket':_['merge']({'requester_id':_0xcf0632['id'],'submitter_id':_0x55b846?_0x55b846['id']:undefined,'assignee_id':_0x55b846?_0x55b846['id']:undefined,'tags':getTags(_0x11b325[_0x1734('0x10')],_0x1734('0x11')),'subject':intUtil[_0x1734('0x12')](_0x11b325[_0x1734('0x13')],_0x23d8d2,'\x20'),'description':intUtil[_0x1734('0x12')](_0x11b325[_0x1734('0x14')],_0x23d8d2,'\x0a'),'comment':{'public':![],'body':intUtil[_0x1734('0x12')](_0x11b325[_0x1734('0x14')],_0x23d8d2,'\x0a')}},getCustomFields(_0x11b325[_0x1734('0x15')],_0x23d8d2))}})[_0x1734('0x16')](function(_0x444527){logger[_0x1734('0xa')](_0x1734('0x17'));return _0x444527[_0x1734('0x18')];});}function getUser(_0x3989a6,_0x24bbf3){if(intUtil[_0x1734('0x19')](_0x24bbf3)){logger[_0x1734('0xa')](_0x1734('0x1a'),_0x24bbf3);return request({'uri':util['format']('%s/search.json',_0x3989a6[_0x1734('0xe')]),'qs':{'query':util[_0x1734('0xc')]('type:user\x20role:agent\x20email:%s',_0x24bbf3)}})[_0x1734('0x16')](function(_0x58f566){if(_0x58f566['count']){logger['info'](_0x1734('0x1b'));return _['find'](_0x58f566[_0x1734('0x1c')],{'email':_0x24bbf3,'role':_0x1734('0x1d')});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x1734('0x1e'),_0x3989a6['remoteUri'])})[_0x1734('0x16')](function(_0x5ad801){logger[_0x1734('0xa')](_0x1734('0x1f'));return _0x5ad801[_0x1734('0x20')];});}});}else{logger[_0x1734('0xa')](_0x1734('0x21'));return request({'uri':util[_0x1734('0xc')](_0x1734('0x1e'),_0x3989a6[_0x1734('0xe')])})[_0x1734('0x16')](function(_0x5c1be3){logger[_0x1734('0xa')]('Admin\x20account\x20selected.');return _0x5c1be3['user'];});}}function getEndUser(_0x7478fd,_0x46b2fa,_0x309d3f){logger[_0x1734('0xa')](_0x1734('0x22'),_0x309d3f);return request({'uri':util[_0x1734('0xc')](_0x1734('0x23'),_0x7478fd[_0x1734('0xe')]),'qs':{'query':util['format'](_0x1734('0x24'),_0x309d3f)}})['then'](function(_0x17e068){var _0x16a35f;if(_0x17e068[_0x1734('0x1c')]['length']){_0x17e068[_0x1734('0x1c')]=_[_0x1734('0x25')](_0x17e068[_0x1734('0x1c')],{'suspended':![],'role':'end-user'});if(_0x17e068[_0x1734('0x1c')][_0x1734('0x26')]){_0x16a35f=_['first'](_0x17e068[_0x1734('0x1c')]);}}if(_0x16a35f){logger[_0x1734('0xa')](_0x1734('0x27'));return _0x16a35f;}else{logger[_0x1734('0xa')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x1734('0xc')](_0x1734('0x28'),_0x7478fd['remoteUri']),'method':'POST','body':{'user':{'role':_0x1734('0x29'),'name':util[_0x1734('0xc')](_0x1734('0x2a'),_0x46b2fa||_0x309d3f),'phone':_0x309d3f}}})[_0x1734('0x16')](function(_0x2c95d2){logger[_0x1734('0xa')](_0x1734('0x2b'));return _0x2c95d2[_0x1734('0x20')];});}});}function getAuth(_0x1ae386){var _0x2921c8;if(_0x1ae386[_0x1734('0x2c')]===_0x1734('0x2d')){_0x2921c8=util[_0x1734('0xc')](_0x1734('0x2e'),_0x1ae386[_0x1734('0x2f')],_0x1ae386[_0x1734('0x2d')]);}else if(_0x1ae386[_0x1734('0x2c')]==='token'){_0x2921c8=util[_0x1734('0xc')]('%s/token:%s',_0x1ae386[_0x1734('0x2f')],_0x1ae386[_0x1734('0x30')]);}return util[_0x1734('0xc')](_0x1734('0x31'),new Buffer(_0x2921c8)[_0x1734('0x32')](_0x1734('0x33')));}function request(_0x14760f){logger[_0x1734('0x34')]('[HTTP]',JSON[_0x1734('0x35')](_0x14760f));return rp(_[_0x1734('0x6')](_0x14760f,{'method':_0x1734('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x16d081,_0x30817d){var _0x1b7caa=[];if(_0x16d081&&_0x16d081[_0x1734('0x26')]>0x0){_0x1b7caa=_['map'](_0x16d081,_0x30817d);}return _0x1b7caa;}function getCustomFields(_0x1f67b4,_0x44c5cc){var _0x283a8c=[];var _0x3a9bcd={'custom_fields':[]};if(_0x1f67b4[_0x1734('0x26')]>0x0){_[_0x1734('0x37')](_0x1f67b4,function(_0x29590b){if(_0x29590b[_0x1734('0x38')]==='string'&&_0x29590b[_0x1734('0x39')]&&!_0x29590b['customField']){_0x3a9bcd[_0x29590b[_0x1734('0x39')][_0x1734('0x3a')]()]=_0x29590b[_0x1734('0x3b')][_0x1734('0x32')]();}else if(_0x29590b[_0x1734('0x38')]===_0x1734('0x3c')&&_0x29590b[_0x1734('0x3d')]&&_0x29590b[_0x1734('0x3e')]){_0x3a9bcd[_0x1734('0x3f')][_0x1734('0x40')]({'id':_0x29590b[_0x1734('0x3d')],'value':_0x29590b['content'][_0x1734('0x32')]()});}else if(_0x29590b[_0x1734('0x38')]===_0x1734('0x41')&&_0x29590b[_0x1734('0x42')]&&_0x29590b['idField']&&_0x29590b[_0x1734('0x3e')]){_0x44c5cc[_0x29590b['variableName']]&&_0x3a9bcd['custom_fields'][_0x1734('0x40')]({'id':_0x29590b[_0x1734('0x3d')],'value':_0x44c5cc[_0x29590b[_0x1734('0x42')]][_0x1734('0x32')]()});}else if(_0x29590b['type']===_0x1734('0x43')&&_0x29590b[_0x1734('0x44')]&&_0x29590b['Variable'][_0x1734('0x11')]&&_0x29590b[_0x1734('0x3d')]&&_0x29590b['customField']){_0x44c5cc[_0x29590b[_0x1734('0x44')]['name'][_0x1734('0x3a')]()]&&_0x3a9bcd[_0x1734('0x3f')][_0x1734('0x40')]({'id':_0x29590b[_0x1734('0x3d')],'value':_0x44c5cc[_0x29590b[_0x1734('0x44')][_0x1734('0x11')][_0x1734('0x3a')]()]['toString']()});}});}return _0x3a9bcd;}exports[_0x1734('0x45')]=function(_0xbf1023,_0x4f6d90,_0x23537e,_0x9e37e5,_0x1ebfec,_0x3b300b){var _0x57bf4b,_0x6f821f;_0x3b300b[_0x1734('0xe')]=intUtil[_0x1734('0x46')](_0x3b300b['remoteUri']);_0x3b300b[_0x1734('0x47')]=intUtil[_0x1734('0x46')](_0x3b300b[_0x1734('0x47')]);if(_0x1ebfec&&_0x1ebfec[_0x1734('0x48')]){logger[_0x1734('0xa')](_0x1734('0x49'),_0x1734('0x4a'));_0x4f6d90[_0x1734('0x4b')]=util[_0x1734('0xc')](_0x1734('0x4c'),_0x3b300b[_0x1734('0x47')],_0x4f6d90[_0x1734('0x4d')],md5(_0x4f6d90[_0x1734('0x4d')]));}else{_0x4f6d90[_0x1734('0x4b')]='';}headers[_0x1734('0x4e')]=getAuth(_0x3b300b);return getUser(_0x3b300b,_0x9e37e5[_0x1734('0x4f')])[_0x1734('0x16')](function(_0x1b4ea1){_0x57bf4b=_0x1b4ea1;logger['info'](_0x1734('0x50'),_0x57bf4b['id']);return getEndUser(_0x3b300b,_0x4f6d90['calleridname'],_0x4f6d90[_0x1734('0x51')]);})[_0x1734('0x16')](function(_0x95d24f){_0x6f821f=_0x95d24f;logger[_0x1734('0xa')]('The\x20Enduser\x20ID\x20is:',_0x6f821f['id']);return getTicket(_0x3b300b,_0x57bf4b,_0x6f821f,_0x23537e,_0x4f6d90);})['then'](function(_0x294097){if(_0x294097){logger[_0x1734('0xa')]('The\x20Ticket\x20ID\x20is:',_0x294097['id']);switch(_0x3b300b[_0x1734('0x38')]){case _0x1734('0x52'):logger[_0x1734('0xa')](_0x1734('0x49'),_0x1734('0x53'));return request({'uri':util[_0x1734('0xc')](_0x1734('0x54'),_0x3b300b['remoteUri'],_0x57bf4b['id'],_0x294097['id']),'method':_0x1734('0xf')});case _0x1734('0x55'):logger[_0x1734('0xa')]('[QUEUE]',_0x1734('0x56'));emit(util[_0x1734('0xc')](_0x1734('0x57'),_0x9e37e5[_0x1734('0x11')]),'trigger:browser:url',{'uri':util[_0x1734('0xc')](_0x1734('0x58'),_0x3b300b[_0x1734('0xe')],_0x294097['id'])});break;default:logger[_0x1734('0x59')](_0x1734('0x49'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x1734('0x5a')](function(_0x480a5a){logger['error'](_0x1734('0x5b'),util[_0x1734('0x5c')](_0x480a5a,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x4ff6a9,_0x36492b,_0x30bc47,_0x553fc0,_0x515e39,_0x4fb75c,_0x28510e){var _0x6fbdf0,_0x881d5a;_0x4fb75c[_0x1734('0xe')]=intUtil['stripTrailingSlash'](_0x4fb75c['remoteUri']);_0x4fb75c[_0x1734('0x47')]=intUtil[_0x1734('0x46')](_0x4fb75c['serverUrl']);if(_0x28510e&&_0x28510e[_0x1734('0x5d')]&&_0x28510e[_0x1734('0x5d')]!==_0x1734('0x5e')){logger['info'](_0x1734('0x5f'),_0x1734('0x4a'));_0x36492b[_0x1734('0x4b')]=util[_0x1734('0xc')](_0x1734('0x4c'),_0x4fb75c[_0x1734('0x47')],_0x36492b[_0x1734('0x4d')],md5(_0x36492b[_0x1734('0x4d')]));}headers[_0x1734('0x4e')]=getAuth(_0x4fb75c);return getUser(_0x4fb75c,_0x553fc0['email'])[_0x1734('0x16')](function(_0x25f886){_0x6fbdf0=_0x25f886;logger[_0x1734('0xa')](_0x1734('0x50'),_0x6fbdf0['id']);return getEndUser(_0x4fb75c,_0x36492b[_0x1734('0x60')],_0x36492b[_0x1734('0x61')]);})[_0x1734('0x16')](function(_0x30848e){_0x881d5a=_0x30848e;logger[_0x1734('0xa')](_0x1734('0x62'),_0x881d5a['id']);return getTicket(_0x4fb75c,_0x6fbdf0,_0x881d5a,_0x30bc47,_0x36492b);})[_0x1734('0x16')](function(_0x568861){if(_0x568861){logger[_0x1734('0xa')](_0x1734('0x63'),_0x568861['id']);switch(_0x4fb75c[_0x1734('0x38')]){case _0x1734('0x52'):logger[_0x1734('0xa')](_0x1734('0x5f'),_0x1734('0x53'));return request({'uri':util['format'](_0x1734('0x54'),_0x4fb75c['remoteUri'],_0x6fbdf0['id'],_0x568861['id']),'method':_0x1734('0xf')});case _0x1734('0x55'):logger[_0x1734('0xa')](_0x1734('0x5f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x1734('0x57'),_0x553fc0['name']),_0x1734('0x64'),{'uri':util[_0x1734('0xc')](_0x1734('0x58'),_0x4fb75c[_0x1734('0xe')],_0x568861['id'])});break;default:logger['error']('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x1734('0x5a')](function(_0x314023){logger[_0x1734('0x59')](_0x1734('0x65'),util[_0x1734('0x5c')](_0x314023,{'showHidden':!![],'depth':null}));});};exports[_0x1734('0x66')]=function(_0x17c177,_0x2d3a75,_0x5a02cc,_0x37d04f,_0x4fd501,_0x5dc7ba){var _0x319918,_0x476f8e;_0x5dc7ba[_0x1734('0xe')]=intUtil['stripTrailingSlash'](_0x5dc7ba[_0x1734('0xe')]);_0x5dc7ba[_0x1734('0x47')]=intUtil['stripTrailingSlash'](_0x5dc7ba[_0x1734('0x47')]);if(_0x4fd501&&_0x4fd501[_0x1734('0x48')]){logger[_0x1734('0xa')]('['+_0x2d3a75[_0x1734('0x67')][_0x1734('0x68')]()+']','Recording\x20is\x20enabled!');_0x2d3a75['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5dc7ba[_0x1734('0x47')],_0x2d3a75['uniqueid'],md5(_0x2d3a75[_0x1734('0x4d')]));}else{_0x2d3a75[_0x1734('0x4b')]='';}headers[_0x1734('0x4e')]=getAuth(_0x5dc7ba);return getUser(_0x5dc7ba)[_0x1734('0x16')](function(_0x18509a){_0x319918=_0x18509a;logger[_0x1734('0xa')](_0x1734('0x50'),_0x319918['id']);return getEndUser(_0x5dc7ba,_0x2d3a75[_0x1734('0x69')],_0x2d3a75['calleridnum']);})[_0x1734('0x16')](function(_0x589fcb){_0x476f8e=_0x589fcb;logger[_0x1734('0xa')](_0x1734('0x62'),_0x476f8e['id']);return getTicket(_0x5dc7ba,_0x319918,_0x476f8e,_0x5a02cc,_0x2d3a75);})['then'](function(_0x6cafb4){if(_0x6cafb4){logger[_0x1734('0xa')]('The\x20Ticket\x20ID\x20is:',_0x6cafb4['id']);}})['catch'](function(_0x616d03){logger[_0x1734('0x59')]('['+_0x2d3a75[_0x1734('0x67')][_0x1734('0x68')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x1734('0x5c')](_0x616d03,{'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 6fa6271..1ecd189 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 _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 +var _0xfff0=['none','zoho.eu','Outbound','[OUTBOUND]','user:%s','https://crm.','toUpperCase','request-promise','md5','util','moment','ioredis','bluebird','../../../../config/logger','zoho','defaults','redis','localhost','emit','[HTTP]','stringify','length','forEach','type','string','idField','content','variable','variableName','Variable','name','toLowerCase','toString','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','isArrayLikeObject','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','https://www.zohoapis.','startCase','moduleCreate','role','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','enduserType','Error:\x20','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','Leads','nothing','contact','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Owner','administrator','first_name','Subject','getString','Subjects','Descriptions','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','called','Call_Result','Called','connect','rejected','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','starttime','agentcalledAt','merge','Fields','Call\x20created!','stack','err','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','/crm/EntityInfo.do?module=Calls&id=','recordingFormat'];(function(_0x3962bf,_0x64c428){var _0x33f85d=function(_0x518abc){while(--_0x518abc){_0x3962bf['push'](_0x3962bf['shift']());}};_0x33f85d(++_0x64c428);}(_0xfff0,0x139));var _0x0fff=function(_0x180123,_0x2854d2){_0x180123=_0x180123-0x0;var _0x37542b=_0xfff0[_0x180123];return _0x37542b;};'use strict';var _=require('lodash');var rp=require(_0x0fff('0x0'));var md5=require(_0x0fff('0x1'));var util=require(_0x0fff('0x2'));var intUtil=require('./util');var moment=require(_0x0fff('0x3'));var Redis=require(_0x0fff('0x4'));var BPromise=require(_0x0fff('0x5'));var config=require('../../../../config/environment');var logger=require(_0x0fff('0x6'))(_0x0fff('0x7'));config['redis']=_[_0x0fff('0x8')](config[_0x0fff('0x9')],{'host':_0x0fff('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0fff('0x9')]));function emit(_0x5e9672,_0x1f2658,_0x5304a5){io['to'](_0x5e9672)[_0x0fff('0xb')](_0x1f2658,_0x5304a5);}function request(_0x3db6f6){logger['debug'](_0x0fff('0xc'),JSON[_0x0fff('0xd')](_0x3db6f6));return rp(_0x3db6f6);}function getCustomFields(_0x1de923,_0x289e01){var _0x209b6d={};if(_0x1de923[_0x0fff('0xe')]>0x0){_[_0x0fff('0xf')](_0x1de923,function(_0x288aee){if(_0x288aee[_0x0fff('0x10')]===_0x0fff('0x11')&&_0x288aee[_0x0fff('0x12')]){_0x209b6d[_0x288aee['idField']]=_0x288aee[_0x0fff('0x13')]['toString']();}else if(_0x288aee[_0x0fff('0x10')]===_0x0fff('0x14')&&_0x288aee[_0x0fff('0x15')]&&_0x288aee[_0x0fff('0x12')]&&_0x289e01[_0x288aee['variableName']]){_0x209b6d[_0x288aee['idField']]=_0x289e01[_0x288aee[_0x0fff('0x15')]]['toString']();}else if(_0x288aee['type']==='customVariable'&&_0x288aee[_0x0fff('0x16')]&&_0x288aee[_0x0fff('0x16')]['name']&&_0x288aee[_0x0fff('0x12')]&&_0x289e01[_0x288aee[_0x0fff('0x16')]['name']['toLowerCase']()]){_0x209b6d[_0x288aee['idField']]=_0x289e01[_0x288aee[_0x0fff('0x16')][_0x0fff('0x17')][_0x0fff('0x18')]()][_0x0fff('0x19')]();}});}return _0x209b6d;}function getName(_0x253de9){if(_0x253de9[_0x0fff('0x1a')]('\x20')>0x0){var _0x4c88ae=_0x253de9[_0x0fff('0x1b')](/ (.+)/);if(_0x4c88ae[0x1]){return _0x4c88ae;}}return[_0x253de9,_0x253de9];}var accountsTokens={};function getAccessToken(_0x136520){return new Promise(function(_0x48e6f9,_0x49d211){if(!_['isNil'](accountsTokens[_0x136520['id']])&&!_[_0x0fff('0x1c')](accountsTokens[_0x136520['id']][_0x0fff('0x1d')])){if(moment()[_0x0fff('0x1e')](accountsTokens[_0x136520['id']][_0x0fff('0x1f')])){_0x48e6f9(accountsTokens[_0x136520['id']]['access_token']);}}var _0x155132;switch(_0x136520[_0x0fff('0x20')]){case'US':_0x155132=_0x0fff('0x21');break;case'AU':_0x155132=_0x0fff('0x22');break;case'EU':_0x155132=_0x0fff('0x23');break;case'IN':_0x155132=_0x0fff('0x24');break;case'CN':_0x155132='https://accounts.zoho.com.cn';break;default:_0x155132=_0x0fff('0x23');break;}var _0x29f702={'method':_0x0fff('0x25'),'uri':_0x155132+_0x0fff('0x26'),'qs':{'refresh_token':_0x136520[_0x0fff('0x27')],'client_id':_0x136520[_0x0fff('0x28')],'client_secret':_0x136520['clientSecret'],'grant_type':_0x0fff('0x29')},'json':!![]};return rp(_0x29f702)[_0x0fff('0x2a')](function(_0x2d1610){accountsTokens[_0x136520['id']]={'access_token':_0x2d1610[_0x0fff('0x1d')],'expires_in':moment()[_0x0fff('0x2b')](_0x2d1610[_0x0fff('0x1f')],_0x0fff('0x2c'))};_0x48e6f9(_0x2d1610[_0x0fff('0x1d')]);})[_0x0fff('0x2d')](function(_0xc32a61){logger[_0x0fff('0x2e')](_0x0fff('0x2f'),_0xc32a61['stack']);_0x49d211(_0xc32a61);});});}function getUser(_0x7046a3,_0x2d1800,_0x17ab6f,_0x42441e){logger[_0x0fff('0x30')](_0x0fff('0x31'));return request({'method':'GET','uri':util[_0x0fff('0x32')](_0x0fff('0x33'),_0x2d1800),'qs':{'type':_0x0fff('0x34')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x7046a3},'json':!![]})[_0x0fff('0x2a')](function(_0x3fa6fc){if(_0x3fa6fc['users']){var _0x3daf51=-0x1;if(_[_0x0fff('0x35')](_0x3fa6fc[_0x0fff('0x36')])){if(!_[_0x0fff('0x1c')](_0x42441e)){_0x3daf51=_[_0x0fff('0x37')](_0x3fa6fc[_0x0fff('0x36')],function(_0x1da352){return _0x1da352[_0x0fff('0x38')]===_0x42441e;});}if(_0x3daf51>=0x0){logger[_0x0fff('0x30')](_0x0fff('0x39'));}else{logger['info'](_0x0fff('0x3a'));_0x3daf51=_[_0x0fff('0x37')](_0x3fa6fc[_0x0fff('0x36')],function(_0x1bbb9e){return _0x1bbb9e[_0x0fff('0x3b')]['name']==='Administrator';});}return _0x3fa6fc[_0x0fff('0x36')][_0x3daf51];}else{if(_0x3fa6fc[_0x0fff('0x3c')][_0x0fff('0x3b')][_0x0fff('0x17')]==='Administrator'){logger[_0x0fff('0x30')](_0x0fff('0x3a'));user=_0x3fa6fc[_0x0fff('0x3c')];return user;}else{logger[_0x0fff('0x2e')]('The\x20failing\x20result\x20is',JSON[_0x0fff('0xd')](_0x3fa6fc));throw new Error(_0x0fff('0x3d')+JSON[_0x0fff('0xd')](_0x3fa6fc));}}}else{logger[_0x0fff('0x2e')](_0x0fff('0x3e'),JSON[_0x0fff('0xd')](_0x3fa6fc));throw new Error(_0x0fff('0x3d')+JSON[_0x0fff('0xd')](_0x3fa6fc));}})[_0x0fff('0x2d')](function(_0x388193){console[_0x0fff('0x2e')](_0x388193);});}function getZohoUser(_0xeea9a7,_0x53a026){return new BPromise(function(_0x114e9a,_0xe6bdb0){request(_0xeea9a7)[_0x0fff('0x2a')](function(_0x312b0d){var _0xd65638=null;if(_0x312b0d){_0xd65638=_0x312b0d[_0x0fff('0x3f')][0x0];_0xd65638['enduserType']=_0x53a026;}_0x114e9a(_0xd65638);})[_0x0fff('0x2d')](function(_0x44e547){_0xe6bdb0(_0x44e547);});});}function createEndUser(_0x8e13e7,_0x6d47f9,_0x1e7128,_0x101151,_0x3dc0b8,_0x425ec1){var _0x1e7128=getName(_0x1e7128);return request({'method':'POST','uri':_0x0fff('0x40')+_0x6d47f9+'/crm/v2/'+_[_0x0fff('0x41')](_0x425ec1[_0x0fff('0x42')])+'s','body':{'data':[{'Last_Name':_0x1e7128[0x1],'First_Name':_0x1e7128[0x0],'Phone':_0x101151,'Owner':{'name':!_[_0x0fff('0x1c')](_0x3dc0b8['role']['name'])?_0x3dc0b8[_0x0fff('0x43')][_0x0fff('0x17')]:!_[_0x0fff('0x1c')](_0x3dc0b8['first_name'])?_0x3dc0b8['first_name']+'\x20'+_0x3dc0b8[_0x0fff('0x44')]:_0x3dc0b8['last_name'],'id':_0x3dc0b8['id']}}]},'headers':{'Authorization':_0x0fff('0x45')+_0x8e13e7},'json':!![]})[_0x0fff('0x2a')](function(_0x8352c1){if(_0x8352c1&&_0x8352c1[_0x0fff('0x3f')][0x0][_0x0fff('0x46')]===_0x0fff('0x47')){var _0x543bcb=_0x8352c1[_0x0fff('0x3f')][0x0][_0x0fff('0x48')];_0x543bcb[_0x0fff('0x49')]=_[_0x0fff('0x41')](_0x425ec1[_0x0fff('0x42')])+'s';return _0x543bcb;}logger[_0x0fff('0x2e')](_0x0fff('0x3e'),JSON['stringify'](data));throw new Error(_0x0fff('0x4a')+JSON[_0x0fff('0xd')](data));})[_0x0fff('0x2d')](function(_0x56a121){console[_0x0fff('0x4b')](_0x0fff('0x4c'),_0x56a121);});}function getEndUser(_0x227b9a,_0x1fbbbf,_0x3c5cc0,_0x451b47,_0x2f73cf,_0x2059f2,_0x29b210){var _0x1ab27d={'method':_0x0fff('0x4d'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x227b9a},'json':!![]};switch(_0x29b210[_0x0fff('0x4e')]){case _0x0fff('0x4f'):_0x1ab27d['uri']=_0x0fff('0x40')+_0x1fbbbf+_0x0fff('0x50')+_0x2f73cf+'))';return getZohoUser(_0x1ab27d,_0x0fff('0x51'))['then'](function(_0x502037){if(_0x502037)return _0x502037;_0x1ab27d[_0x0fff('0x52')]='https://www.zohoapis.'+_0x1fbbbf+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2f73cf+'))';return getZohoUser(_0x1ab27d,_0x0fff('0x53'))[_0x0fff('0x2a')](function(_0x29524d){if(_0x29524d)return _0x29524d;if(_0x29b210[_0x0fff('0x42')]!=_0x0fff('0x54')){return createEndUser(_0x227b9a,_0x1fbbbf,_0x451b47,_0x2f73cf,_0x2059f2,_0x29b210);}else{return{};}});});break;case _0x0fff('0x55'):_0x1ab27d['uri']=_0x0fff('0x40')+_0x1fbbbf+_0x0fff('0x50')+_0x2f73cf+'))';return getZohoUser(_0x1ab27d,_0x0fff('0x51'))[_0x0fff('0x2a')](function(_0x30c4d6){if(_0x30c4d6)return _0x30c4d6;if(_0x29b210[_0x0fff('0x42')]!='nothing'){return createEndUser(_0x227b9a,_0x1fbbbf,_0x451b47,_0x2f73cf,_0x2059f2,_0x29b210);}else{return{};}});break;case _0x0fff('0x56'):_0x1ab27d[_0x0fff('0x52')]='https://www.zohoapis.'+_0x1fbbbf+_0x0fff('0x57')+_0x2f73cf+'))';return getZohoUser(_0x1ab27d,'Leads')['then'](function(_0x5aa5d3){if(_0x5aa5d3)return _0x5aa5d3;if(_0x29b210[_0x0fff('0x42')]!=_0x0fff('0x54')){return createEndUser(_0x227b9a,_0x1fbbbf,_0x451b47,_0x2f73cf,_0x2059f2,_0x29b210);}else{return{};}});break;}}function getCall(_0x15f725,_0x194ed8,_0x579291,_0x4bf98d,_0x2524ad,_0x2c765f,_0x2cbe43,_0x3b6c98){logger[_0x0fff('0x30')]('Creating\x20new\x20call...');var _0x3b401c={};_0x3b401c[_0x0fff('0x58')]={'name':!_[_0x0fff('0x1c')](_0x4bf98d[_0x0fff('0x43')][_0x0fff('0x17')])&&!_[_0x0fff('0x1c')](_0x4bf98d[_0x0fff('0x3b')][_0x0fff('0x17')])&&_0x4bf98d[_0x0fff('0x3b')][_0x0fff('0x17')]===_0x0fff('0x59')?_0x4bf98d[_0x0fff('0x43')][_0x0fff('0x17')]:!_[_0x0fff('0x1c')](_0x4bf98d[_0x0fff('0x5a')])?_0x4bf98d[_0x0fff('0x5a')]+'\x20'+_0x4bf98d[_0x0fff('0x44')]:_0x4bf98d[_0x0fff('0x44')],'id':_0x4bf98d['id']};_0x3b401c[_0x0fff('0x5b')]=intUtil[_0x0fff('0x5c')](_0x2c765f[_0x0fff('0x5d')],_0x2cbe43,'\x20');_0x3b401c['Description']=intUtil[_0x0fff('0x5c')](_0x2c765f[_0x0fff('0x5e')],_0x2cbe43,'\x0a');if(_0x2524ad[_0x0fff('0x49')]===_0x0fff('0x51')){_0x3b401c['Who_Id']={'name':!_[_0x0fff('0x1c')](_0x2524ad['Full_Name'])?_0x2524ad[_0x0fff('0x5f')]:!_[_0x0fff('0x1c')](_0x2524ad[_0x0fff('0x60')])?_0x2524ad[_0x0fff('0x60')]+'\x20'+_0x2524ad['Last_Name']:_0x2524ad[_0x0fff('0x61')],'id':_0x2524ad['id']};}if(_0x2524ad[_0x0fff('0x49')]===_0x0fff('0x53')){_0x3b401c[_0x0fff('0x62')]={'name':!_['isNil'](_0x2524ad['Full_Name'])?_0x2524ad[_0x0fff('0x5f')]:!_[_0x0fff('0x1c')](_0x2524ad[_0x0fff('0x60')])?_0x2524ad[_0x0fff('0x60')]+'\x20'+_0x2524ad[_0x0fff('0x61')]:_0x2524ad[_0x0fff('0x61')],'id':_0x2524ad['id']};_0x3b401c['$se_module']=_['startCase'](_0x2524ad[_0x0fff('0x49')]);}if(_0x2cbe43[_0x0fff('0x63')]){_0x3b401c[_0x0fff('0x64')]=moment[_0x0fff('0x65')](parseInt(_0x2cbe43[_0x0fff('0x63')])*0x3e8)[_0x0fff('0x32')](_0x0fff('0x66'));}else if(_0x2cbe43[_0x0fff('0x67')]&&_0x2cbe43['endtime']){_0x3b401c[_0x0fff('0x64')]=moment['utc'](moment(_0x2cbe43[_0x0fff('0x68')],_0x0fff('0x69'))[_0x0fff('0x6a')](moment(_0x2cbe43['starttime'],'YYYY-MM-DDTHH:mm:ss')))[_0x0fff('0x32')]('mm:ss');}switch(_0x2cbe43[_0x0fff('0x6b')]){case _0x0fff('0x6c'):_0x3b401c[_0x0fff('0x6d')]=_0x0fff('0x6e');break;case'complete':case _0x0fff('0x6f'):_0x3b401c[_0x0fff('0x6d')]='Answered';break;case _0x0fff('0x70'):_0x3b401c[_0x0fff('0x6d')]=_0x0fff('0x71');break;case'abandoned':_0x3b401c[_0x0fff('0x6d')]=_0x0fff('0x72');break;case _0x0fff('0x73'):_0x3b401c[_0x0fff('0x6d')]=_0x0fff('0x74');default:}_0x3b401c[_0x0fff('0x75')]=(_0x3b6c98===_0x0fff('0x76')?moment(_0x2cbe43[_0x0fff('0x77')])[_0x0fff('0x32')](_0x0fff('0x69')):moment(_0x2cbe43[_0x0fff('0x78')])[_0x0fff('0x32')]('YYYY-MM-DDTHH:mm:ss'))||moment()['format'](_0x0fff('0x69'));_0x3b401c['Call_Type']=_0x3b6c98||'Inbound';_0x3b401c=_[_0x0fff('0x79')](_0x3b401c,getCustomFields(_0x2c765f[_0x0fff('0x7a')],_0x2cbe43));return request({'method':_0x0fff('0x25'),'uri':'https://www.zohoapis.'+_0x194ed8+'/crm/v2/Calls','headers':{'Authorization':_0x0fff('0x45')+_0x15f725},'body':{'data':[_0x3b401c]},'json':!![]})[_0x0fff('0x2a')](function(_0x2e996c){if(_0x2e996c&&_0x2e996c[_0x0fff('0x3f')][0x0]['code']===_0x0fff('0x47')){logger[_0x0fff('0x30')](_0x0fff('0x7b'));return{'id':_0x2e996c[_0x0fff('0x3f')][0x0]['details']['id']};}})[_0x0fff('0x2d')](function(_0x1858fb){logger['info']('err',_0x1858fb[_0x0fff('0x7c')]);console[_0x0fff('0x4b')](_0x0fff('0x7d'),_0x1858fb);});}exports[_0x0fff('0x7e')]=function(_0x167e55,_0x50eaa6,_0x27cb67,_0x7b040,_0x2c97c8,_0x2d77bd){var _0x256246,_0x522a4c,_0x5d57fc;_0x2d77bd[_0x0fff('0x7f')]=intUtil['stripTrailingSlash'](_0x2d77bd[_0x0fff('0x7f')]);_0x2d77bd[_0x0fff('0x80')]=intUtil[_0x0fff('0x81')](_0x2d77bd[_0x0fff('0x80')]);if(_0x2c97c8&&_0x2c97c8[_0x0fff('0x82')]){logger['info'](_0x0fff('0x83'),_0x0fff('0x84'));_0x50eaa6[_0x0fff('0x85')]=_0x2d77bd[_0x0fff('0x80')]+_0x0fff('0x86')+_0x50eaa6[_0x0fff('0x87')]+_0x0fff('0x88')+md5(_0x50eaa6[_0x0fff('0x87')]);}else{_0x50eaa6[_0x0fff('0x85')]='';}var _0xfac929=_0x2d77bd[_0x0fff('0x7f')]==='zoho.eu'?'eu':_0x0fff('0x89');return getAccessToken(_0x2d77bd)[_0x0fff('0x2a')](function(_0x5d2411){_0x5d57fc=_0x5d2411;return getUser(_0x5d57fc,_0xfac929,_0x2d77bd,_0x7b040[_0x0fff('0x38')]);})['then'](function(_0x27dc72){_0x256246=_0x27dc72;logger[_0x0fff('0x30')](_0x0fff('0x8a'),_0x256246['id']);return getEndUser(_0x5d57fc,_0xfac929,_0x2d77bd,_0x50eaa6[_0x0fff('0x8b')],_0x50eaa6[_0x0fff('0x8c')],_0x256246,_0x27cb67);})['then'](function(_0x1cd2b8){_0x522a4c=_0x1cd2b8;return getCall(_0x5d57fc,_0xfac929,_0x2d77bd,_0x256246,_0x522a4c,_0x27cb67,_0x50eaa6,_0x0fff('0x8d'));})['then'](function(_0x309cb9){if(_0x309cb9){logger[_0x0fff('0x30')](_0x0fff('0x8e'),_0x309cb9['id']);logger['info'](_0x0fff('0x83'),_0x0fff('0x8f'));emit(util['format']('user:%s',_0x7b040[_0x0fff('0x17')]),'trigger:browser:url',{'uri':'https://crm.'+_0x2d77bd[_0x0fff('0x7f')]+_0x0fff('0x90')+_0x309cb9['id']});}})[_0x0fff('0x2d')](function(_0x47b5d0){logger['error'](_0x0fff('0x83'),JSON['stringify'](_0x47b5d0));});};exports[_0x0fff('0x76')]=function(_0x299e95,_0x15c1cd,_0x130904,_0x14aaa6,_0x1e940c,_0x194712,_0x533d8a){var _0x38ff68,_0x38b027,_0x374701;_0x194712[_0x0fff('0x7f')]=intUtil[_0x0fff('0x81')](_0x194712[_0x0fff('0x7f')]);_0x194712['serverUrl']=intUtil[_0x0fff('0x81')](_0x194712['serverUrl']);if(_0x533d8a&&_0x533d8a[_0x0fff('0x91')]&&_0x533d8a[_0x0fff('0x91')]!==_0x0fff('0x92')){logger[_0x0fff('0x30')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x15c1cd[_0x0fff('0x85')]=_0x194712['serverUrl']+_0x0fff('0x86')+_0x15c1cd[_0x0fff('0x87')]+'/downloads?type=uniqueid&token='+md5(_0x15c1cd['uniqueid']);}var _0x36cc4e=_0x194712[_0x0fff('0x7f')]===_0x0fff('0x93')?'eu':_0x0fff('0x89');return getAccessToken(_0x194712)['then'](function(_0x407f0a){_0x374701=_0x407f0a;return getUser(_0x374701,_0x36cc4e,_0x194712,_0x14aaa6['email']);})[_0x0fff('0x2a')](function(_0x20d348){_0x38ff68=_0x20d348;logger[_0x0fff('0x30')]('The\x20User\x20ID\x20is:',_0x38ff68['id']);return getEndUser(_0x374701,_0x36cc4e,_0x194712,_0x15c1cd['destcalleridname'],_0x15c1cd['destcalleridnum'],_0x38ff68,_0x130904);})[_0x0fff('0x2a')](function(_0x547816){_0x38b027=_0x547816;return getCall(_0x374701,_0x36cc4e,_0x194712,_0x38ff68,_0x38b027,_0x130904,_0x15c1cd,_0x0fff('0x94'));})[_0x0fff('0x2a')](function(_0x12d309){if(_0x12d309){logger[_0x0fff('0x30')](_0x0fff('0x8e'),_0x12d309['id']);logger[_0x0fff('0x30')](_0x0fff('0x95'),_0x0fff('0x8f'));emit(util[_0x0fff('0x32')](_0x0fff('0x96'),_0x14aaa6[_0x0fff('0x17')]),'trigger:browser:url',{'uri':_0x0fff('0x97')+_0x194712[_0x0fff('0x7f')]+_0x0fff('0x90')+_0x12d309['id']});}})[_0x0fff('0x2d')](function(_0x1b15a0){logger['error'](_0x0fff('0x95'),JSON[_0x0fff('0xd')](_0x1b15a0));});};exports['unmanaged']=function(_0x35559c,_0x12673f,_0x45fe6e,_0x2c3b21,_0x139241,_0x2b1688){var _0xe06663,_0x9a3823,_0x40c4f3;_0x2b1688[_0x0fff('0x7f')]=intUtil['stripTrailingSlash'](_0x2b1688[_0x0fff('0x7f')]);_0x2b1688[_0x0fff('0x80')]=intUtil[_0x0fff('0x81')](_0x2b1688[_0x0fff('0x80')]);if(_0x139241&&_0x139241[_0x0fff('0x82')]){logger[_0x0fff('0x30')]('['+_0x12673f[_0x0fff('0x6b')]['toUpperCase']()+']',_0x0fff('0x84'));_0x12673f['recordingURL']=_0x2b1688[_0x0fff('0x80')]+_0x0fff('0x86')+_0x12673f[_0x0fff('0x87')]+_0x0fff('0x88')+md5(_0x12673f[_0x0fff('0x87')]);}else{_0x12673f['recordingURL']='';}var _0x359653=_0x2b1688['host']==='zoho.eu'?'eu':_0x0fff('0x89');return getAccessToken(_0x2b1688)[_0x0fff('0x2a')](function(_0x3d8df3){_0x40c4f3=_0x3d8df3;return getUser(_0x40c4f3,_0x359653,_0x2b1688);})[_0x0fff('0x2a')](function(_0x394cc4){_0xe06663=_0x394cc4;logger[_0x0fff('0x30')]('The\x20User\x20ID\x20is:',_0xe06663['id']);return getEndUser(_0x40c4f3,_0x359653,_0x2b1688,_0x12673f['calleridname'],_0x12673f['calleridnum'],_0xe06663,_0x45fe6e);})[_0x0fff('0x2a')](function(_0x41b755){_0x9a3823=_0x41b755;return getCall(_0x40c4f3,_0x359653,_0x2b1688,_0xe06663,_0x9a3823,_0x45fe6e,_0x12673f,_0x0fff('0x8d'));})[_0x0fff('0x2a')](function(_0x21c6ae){if(_0x21c6ae){logger[_0x0fff('0x30')](_0x0fff('0x8e'),_0x21c6ae['id']);}})[_0x0fff('0x2d')](function(_0xed7e93){logger[_0x0fff('0x2e')]('['+_0x12673f[_0x0fff('0x6b')][_0x0fff('0x98')]()+']',JSON[_0x0fff('0xd')](_0xed7e93));});}; \ 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 a724aac..ef5e79f 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(_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 +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(_0x5d1101,_0x7a03f4){var _0x5d75d1=function(_0x554ee0){while(--_0x554ee0){_0x5d1101['push'](_0x5d1101['shift']());}};_0x5d75d1(++_0x7a03f4);}(_0x7a54,0x106));var _0x47a5=function(_0x525833,_0x3d5fc3){_0x525833=_0x525833-0x0;var _0x1fcb29=_0x7a54[_0x525833];return _0x1fcb29;};'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 344bd02..5fb6f20 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(_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 +var _0x7a54=['data6','parse','stack','data1','GET','DELETE','POST','PUT','render','data7','body','error','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','request-promise','util','lodash','../../../../config/logger','trigger','toUpperCase','data2','data5'];(function(_0x3e0a5e,_0x3c2da2){var _0x4aa148=function(_0xc3d3d8){while(--_0xc3d3d8){_0x3e0a5e['push'](_0x3e0a5e['shift']());}};_0x4aa148(++_0x3c2da2);}(_0x7a54,0x106));var _0x47a5=function(_0x29bed6,_0x3a84b3){_0x29bed6=_0x29bed6-0x0;var _0xa1f450=_0x7a54[_0x29bed6];return _0xa1f450;};'use strict';var rp=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var Mustache=require('mustache');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));exports['exec']=function(_0x5f7f12,_0x11bf85){var _0x2a1a7e,_0x3717e1;var _0xfdf934={'method':_0x5f7f12['data1'][_0x47a5('0x5')](),'uri':Mustache['render'](_0x5f7f12[_0x47a5('0x6')],_0x11bf85),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5f7f12[_0x47a5('0x7')])==='number'&&parseInt(_0x5f7f12[_0x47a5('0x7')])>=0x1&&parseInt(_0x5f7f12['data5'])<=0xa?parseInt(_0x5f7f12['data5'])*0x3e8:0x5*0x3e8};try{_0xfdf934['headers']=_0x5f7f12[_0x47a5('0x8')]?JSON[_0x47a5('0x9')](Mustache['render'](_0x5f7f12[_0x47a5('0x8')],_0x11bf85)):{};}catch(_0x49e844){logger['error'](_0x49e844[_0x47a5('0xa')]);}switch(_0x5f7f12[_0x47a5('0xb')][_0x47a5('0x5')]()){case _0x47a5('0xc'):case _0x47a5('0xd'):_0x2a1a7e=null;_0xfdf934['qs']=_0x11bf85;break;case _0x47a5('0xe'):case _0x47a5('0xf'):if(_0x5f7f12['data7']){try{_0x2a1a7e=JSON[_0x47a5('0x9')](Mustache[_0x47a5('0x10')](_0x5f7f12[_0x47a5('0x11')],_0x11bf85));_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}catch(_0x139f25){logger[_0x47a5('0x13')](_0x139f25[_0x47a5('0xa')]);logger[_0x47a5('0x13')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2a1a7e=_0x11bf85;_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}break;}logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x16'),_0x5f7f12[_0x47a5('0xb')],_0x5f7f12['data2'],JSON['stringify'](_0xfdf934)));rp(_0xfdf934)[_0x47a5('0x17')](function(_0x4b966e){_0x2a1a7e=!_['isNil'](_0x2a1a7e)?_0x47a5('0x18')+_0x2a1a7e:'';_0x3717e1=typeof _0x4b966e[_0x47a5('0x12')]===_0x47a5('0x19')?JSON[_0x47a5('0x1a')](_0x4b966e[_0x47a5('0x12')]):_0x4b966e[_0x47a5('0x12')];logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x1b'),_0x5f7f12['data1'],_0x5f7f12[_0x47a5('0x6')],_0x4b966e[_0x47a5('0x1c')],_0x3717e1));})['catch'](function(_0x2b0360){logger[_0x47a5('0x13')](util[_0x47a5('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x5f7f12[_0x47a5('0xb')],_0x5f7f12[_0x47a5('0x6')],_0x2b0360[_0x47a5('0x1c')],_0x2b0360[_0x47a5('0x1d')],_0x2b0360['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index ee0ac61..8d2b5fa 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 _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 +var _0xac31=['debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','then'];(function(_0x2e2e2e,_0x4ef307){var _0x15f38f=function(_0x1c608d){while(--_0x1c608d){_0x2e2e2e['push'](_0x2e2e2e['shift']());}};_0x15f38f(++_0x4ef307);}(_0xac31,0xca));var _0x1ac3=function(_0x239a10,_0x5da00a){_0x239a10=_0x239a10-0x0;var _0x4f0a34=_0xac31[_0x239a10];return _0x4f0a34;};'use strict';var jayson=require(_0x1ac3('0x0'));var BPromise=require(_0x1ac3('0x1'));var logger=require(_0x1ac3('0x2'))(_0x1ac3('0x3'));var client=jayson[_0x1ac3('0x4')][_0x1ac3('0x5')]({'port':0x2329});client[_0x1ac3('0x6')]=function(_0x59b42c,_0x33b5ab){return new BPromise(function(_0x434b5e,_0x4dcc96){return client['request'](_0x59b42c,_0x33b5ab)[_0x1ac3('0x7')](function(_0x20027f){logger[_0x1ac3('0x8')](_0x1ac3('0x9'),_0x1ac3('0x3'),_0x59b42c,_0x33b5ab,_0x20027f);if(_0x20027f['error']){logger[_0x1ac3('0xa')]('rpc',_0x1ac3('0x3'),_0x59b42c,_0x20027f[_0x1ac3('0xa')][_0x1ac3('0xb')],_0x33b5ab);return _0x4dcc96(_0x20027f['error'][_0x1ac3('0xb')]);}else{return _0x434b5e(_0x20027f[_0x1ac3('0xc')]);}})[_0x1ac3('0xd')](function(_0x24f0d2){logger[_0x1ac3('0xa')](_0x1ac3('0x9'),'routing',_0x59b42c,_0x24f0d2,_0x33b5ab);return _0x4dcc96(_0x24f0d2);});});};module[_0x1ac3('0xe')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index daa9525..b293388 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 _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 +var _0x86f4=['loginMailFrequency','catch','log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','resolve','getMailAccounts','then','refresh','mailAccounts','listen','Setting','findOne'];(function(_0x2943c4,_0x47d2f1){var _0x1a21aa=function(_0x3342a3){while(--_0x3342a3){_0x2943c4['push'](_0x2943c4['shift']());}};_0x1a21aa(++_0x47d2f1);}(_0x86f4,0x18a));var _0x486f=function(_0x769e9d,_0xc7e55){_0x769e9d=_0x769e9d-0x0;var _0x4f3bd0=_0x86f4[_0x769e9d];return _0x4f3bd0;};'use strict';var BPromise=require(_0x486f('0x0'));var server=require(_0x486f('0x1'));var Realtime=require(_0x486f('0x2'));var EmailChannel=require(_0x486f('0x3'));var mailAccount=require(_0x486f('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x486f('0x5'))['db'];function initRealtime(){return BPromise[_0x486f('0x6')]()['then'](mailAccount[_0x486f('0x7')]())[_0x486f('0x8')](realtime['initMailAccounts']())[_0x486f('0x8')](function(){email[_0x486f('0x9')](realtime[_0x486f('0xa')]);return realtime;});}function main(){return server[_0x486f('0xb')](realtime,email)[_0x486f('0x8')](function(_0x3a0791){return initRealtime();})['then'](function(_0x33363d){return db[_0x486f('0xc')][_0x486f('0xd')]({'attributes':['id',_0x486f('0xe')],'raw':!![]});})[_0x486f('0x8')](function(_0x362036){return setInterval(initRealtime,_0x362036[_0x486f('0xe')]*0x3e8);})[_0x486f('0xf')](function(_0x37cf58){console[_0x486f('0x10')](_0x37cf58);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 78156eb..451369c 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 _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 +var _0x3e69=['key','active','Imap','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','imapAccounts','box','handleImapBox','handleImapEmail','bind','end','handleImapEnd','handleImapError','status','disabled','connected','messages','lastName','from','then','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','smtp','send','verifySmtp','Smtp','verify','exports','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','email','defaults','localhost','redis','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','prototype','emit','name'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x3e69,0x1dd));var _0x93e6=function(_0x8c6164,_0x1dc7db){_0x8c6164=_0x8c6164-0x0;var _0x1ca172=_0x3e69[_0x8c6164];return _0x1ca172;};'use strict';var _=require(_0x93e6('0x0'));var moment=require(_0x93e6('0x1'));var BPromise=require('bluebird');var md5=require(_0x93e6('0x2'));var Redis=require(_0x93e6('0x3'));var config=require(_0x93e6('0x4'));var logger=require(_0x93e6('0x5'))(_0x93e6('0x6'));config['redis']=_[_0x93e6('0x7')](config['redis'],{'host':_0x93e6('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x93e6('0x9')]));var EmailImap=require(_0x93e6('0xa'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x93e6('0xb'));var md5Accounts={};function EmailChannel(_0x441c41){logger[_0x93e6('0xc')](_0x93e6('0xd'));this['mailAccounts']=_0x441c41[_0x93e6('0xe')];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel[_0x93e6('0xf')][_0x93e6('0x10')]=function(_0x106ef6){var _0x24c93b=this[_0x93e6('0xe')][_0x106ef6];var _0x481997={'id':_0x24c93b['id'],'name':_0x24c93b[_0x93e6('0x11')],'key':_0x24c93b[_0x93e6('0x12')],'active':_0x24c93b[_0x93e6('0x13')],'Imap':{'status':_0x24c93b[_0x93e6('0x14')]['status'],'messageStatus':_0x24c93b['Imap'][_0x93e6('0x15')],'total':_0x24c93b[_0x93e6('0x14')][_0x93e6('0x16')]}};if(_[_0x93e6('0x17')](md5Accounts[_0x106ef6])){md5Accounts[_0x106ef6]={};}var _0x1c2260=md5(JSON[_0x93e6('0x18')](_0x481997));if(md5Accounts[_0x106ef6][_0x93e6('0x2')]!==_0x1c2260){md5Accounts[_0x106ef6]['md5']=_0x1c2260;io[_0x93e6('0x10')](_0x93e6('0x19'),_0x481997);}};EmailChannel[_0x93e6('0xf')][_0x93e6('0x1a')]=function(_0x3e0e44){for(var _0x5136c9 in _0x3e0e44){if(_0x3e0e44[_0x93e6('0x1b')](_0x5136c9)){if(_0x3e0e44[_0x5136c9][_0x93e6('0x14')]&&_0x3e0e44[_0x5136c9]['active']){var _0x547f86=_0x3e0e44[_0x5136c9][_0x93e6('0x14')];if(!this[_0x93e6('0x1c')][_0x93e6('0x1b')](_0x547f86['id'])){this[_0x93e6('0x1c')][_0x547f86['id']]=new EmailImap(_0x547f86,_0x3e0e44[_0x5136c9]['email']);this[_0x93e6('0x1c')][_0x547f86['id']]['on'](_0x93e6('0x1d'),this[_0x93e6('0x1e')]['bind'](this,_0x5136c9));this[_0x93e6('0x1c')][_0x547f86['id']]['on'](_0x93e6('0x6'),this[_0x93e6('0x1f')][_0x93e6('0x20')](this,_0x5136c9));this[_0x93e6('0x1c')][_0x547f86['id']]['on'](_0x93e6('0x21'),this[_0x93e6('0x22')][_0x93e6('0x20')](this,_0x5136c9));this[_0x93e6('0x1c')][_0x547f86['id']]['on']('error',this[_0x93e6('0x23')][_0x93e6('0x20')](this,_0x5136c9));}}else{if(_[_0x93e6('0x17')](this['mailAccounts'][_0x5136c9][_0x93e6('0x14')])){this['mailAccounts'][_0x5136c9][_0x93e6('0x14')]={};}this[_0x93e6('0xe')][_0x5136c9]['Imap'][_0x93e6('0x24')]=_0x93e6('0x25');this[_0x93e6('0xe')][_0x5136c9][_0x93e6('0x14')][_0x93e6('0x15')]='';this[_0x93e6('0x10')](_0x5136c9);}}}};EmailChannel['prototype'][_0x93e6('0x1e')]=function(_0x135230,_0x4b23f3){if(this[_0x93e6('0xe')][_0x135230]){this[_0x93e6('0xe')][_0x135230][_0x93e6('0x14')]['status']=_0x93e6('0x26');this['mailAccounts'][_0x135230][_0x93e6('0x14')][_0x93e6('0x15')]=_0x4b23f3[_0x93e6('0x11')];if(_0x4b23f3[_0x93e6('0x27')]){this['mailAccounts'][_0x135230]['Imap'][_0x93e6('0x16')]=_0x4b23f3[_0x93e6('0x27')][_0x93e6('0x16')];}return this[_0x93e6('0x10')](_0x135230);}};EmailChannel['prototype'][_0x93e6('0x1f')]=function(_0x3bab0d,_0x531538){logger[_0x93e6('0xc')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x531538['firstName'],_0x531538[_0x93e6('0x28')],_0x531538[_0x93e6('0x29')],_0x3bab0d);if(this[_0x93e6('0xe')][_0x3bab0d]){return mailAccount['notify'](_0x3bab0d,_0x531538)[_0x93e6('0x2a')](function(_0xbf9100){if(_0xbf9100){logger[_0x93e6('0xc')](_0x93e6('0x2b'));}})[_0x93e6('0x2c')](function(_0x46f767){logger[_0x93e6('0x2d')](_0x93e6('0x2e'),JSON['stringify'](_0x46f767));});}};EmailChannel['prototype'][_0x93e6('0x22')]=function(_0x11793a){if(this[_0x93e6('0xe')][_0x11793a]&&this[_0x93e6('0xe')][_0x11793a][_0x93e6('0x14')]){if(this['imapAccounts'][this[_0x93e6('0xe')][_0x11793a][_0x93e6('0x14')]['id']]){delete this[_0x93e6('0x1c')][this[_0x93e6('0xe')][_0x11793a]['Imap']['id']];}this[_0x93e6('0xe')][_0x11793a][_0x93e6('0x14')][_0x93e6('0x2f')]=moment();this[_0x93e6('0x10')](_0x11793a);}};EmailChannel[_0x93e6('0xf')][_0x93e6('0x23')]=function(_0x1dd9fc,_0x295157){if(this[_0x93e6('0xe')][_0x1dd9fc]){this['mailAccounts'][_0x1dd9fc][_0x93e6('0x14')][_0x93e6('0x24')]='error';this['mailAccounts'][_0x1dd9fc][_0x93e6('0x14')][_0x93e6('0x15')]=_0x295157;return this[_0x93e6('0x10')](_0x1dd9fc);}};EmailChannel[_0x93e6('0xf')][_0x93e6('0x30')]=function(_0x4e4e82,_0x2e0b17){return this[_0x93e6('0x31')][_0x93e6('0x32')](_0x4e4e82,_0x2e0b17);};EmailChannel['prototype'][_0x93e6('0x33')]=function(_0xa74c3b){var _0x20868d=this;if(this['mailAccounts'][_0xa74c3b['id']]){if(_['isNil'](this[_0x93e6('0xe')][_0xa74c3b['id']]['Smtp'])){this['mailAccounts'][_0xa74c3b['id']][_0x93e6('0x34')]={};}this[_0x93e6('0xe')][_0xa74c3b['id']]['Smtp'][_0x93e6('0x2f')]=moment();return new BPromise(function(_0x28b47f,_0x5cd5cc){return _0x20868d[_0x93e6('0x31')][_0x93e6('0x35')](_0xa74c3b)[_0x93e6('0x2a')](function(_0x273d37){_0x20868d['mailAccounts'][_0xa74c3b['id']][_0x93e6('0x34')][_0x93e6('0x24')]='verified';_0x20868d[_0x93e6('0xe')][_0xa74c3b['id']]['Smtp'][_0x93e6('0x15')]='';_0x20868d['emit'](_0xa74c3b['id']);_0x28b47f(_0x273d37);})['catch'](function(_0x321704){_0x20868d[_0x93e6('0xe')][_0xa74c3b['id']][_0x93e6('0x34')][_0x93e6('0x24')]=_0x93e6('0x2d');_0x20868d[_0x93e6('0xe')][_0xa74c3b['id']][_0x93e6('0x34')][_0x93e6('0x15')]=_0x321704;_0x20868d[_0x93e6('0x10')](_0xa74c3b['id']);_0x5cd5cc(_0x321704);});});}return this['smtp']['verify'](_0xa74c3b);};module[_0x93e6('0x36')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 55d7606..5d951af 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 _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 +var _0x4c51=['handleMessageEnd','handleSimpleParser','parser','handleCloseBox','stringify','textCode','hasOwnProperty','exports','util','imap','lodash','randomstring','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','once','handleReady','bind','end','handleEnd','error','connect','inherits','connTimeout','authTimeout','isNil','service','authentication','user','password','host','tls','getHost','port','anonymous@xcally.com','prototype','openBox','handleOpenBox','handleError','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchEnd','closeBox','body','handleMessageBody','attributes'];(function(_0x5b8a99,_0x2e0c12){var _0x31fa01=function(_0x21396c){while(--_0x21396c){_0x5b8a99['push'](_0x5b8a99['shift']());}};_0x31fa01(++_0x2e0c12);}(_0x4c51,0x182));var _0x14c5=function(_0x2393d2,_0x196e61){_0x2393d2=_0x2393d2-0x0;var _0x34d75f=_0x4c51[_0x2393d2];return _0x34d75f;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x14c5('0x0'));var Imap=require(_0x14c5('0x1'));var _=require(_0x14c5('0x2'));var rs=require(_0x14c5('0x3'));var simpleParser=require(_0x14c5('0x4'))[_0x14c5('0x5')];var Iconv=require(_0x14c5('0x6'))[_0x14c5('0x7')];var EventEmitter=require(_0x14c5('0x8'))[_0x14c5('0x9')];var utils=require(_0x14c5('0xa'));var logger=require(_0x14c5('0xb'))(_0x14c5('0xc'));function EmailImap(_0x139a3b,_0x2f830f){this[_0x14c5('0xd')]=_0x14c5('0xe');this['account']=this['getAccount'](_0x139a3b,_0x2f830f);this['imap']=new Imap(this[_0x14c5('0xf')]);this[_0x14c5('0x1')][_0x14c5('0x10')]('ready',this[_0x14c5('0x11')][_0x14c5('0x12')](this));this[_0x14c5('0x1')][_0x14c5('0x10')](_0x14c5('0x13'),this[_0x14c5('0x14')][_0x14c5('0x12')](this));this[_0x14c5('0x1')]['on'](_0x14c5('0x15'),this['handleError']['bind'](this));this[_0x14c5('0x1')][_0x14c5('0x16')]();}util[_0x14c5('0x17')](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x41e5b6,_0x304c41){var _0x4e6152={'connTimeout':_0x41e5b6[_0x14c5('0x18')]?_0x41e5b6[_0x14c5('0x18')]*0x3e8:0x2710,'authTimeout':_0x41e5b6[_0x14c5('0x19')]?_0x41e5b6[_0x14c5('0x19')]*0x3e8:0x1388};if(_[_0x14c5('0x1a')](_0x41e5b6[_0x14c5('0x1b')])){if(_0x41e5b6[_0x14c5('0x1c')]){_0x4e6152[_0x14c5('0x1d')]=_0x41e5b6[_0x14c5('0x1d')];_0x4e6152[_0x14c5('0x1e')]=_0x41e5b6['password'];}_0x4e6152[_0x14c5('0x1f')]=_0x41e5b6['host'];_0x4e6152['port']=_0x41e5b6['port']||0x3e1;if(_0x41e5b6['tls']){_0x4e6152[_0x14c5('0x20')]=!![];}else{_0x4e6152[_0x14c5('0x20')]=![];_0x4e6152['autotls']='required';}}else{_0x4e6152[_0x14c5('0x1d')]=_0x41e5b6['user'];_0x4e6152[_0x14c5('0x1e')]=_0x41e5b6[_0x14c5('0x1e')];_0x4e6152['host']=utils[_0x14c5('0x21')](_0x41e5b6[_0x14c5('0x1b')]);_0x4e6152[_0x14c5('0x22')]=0x3e1;_0x4e6152[_0x14c5('0x20')]=!![];}_0x4e6152[_0x14c5('0xc')]=_0x304c41||_0x41e5b6[_0x14c5('0x1d')]||_0x14c5('0x23');return _0x4e6152;};EmailImap[_0x14c5('0x24')][_0x14c5('0x11')]=function(){this[_0x14c5('0x1')][_0x14c5('0x25')](this[_0x14c5('0xd')],![],this[_0x14c5('0x26')]['bind'](this));};EmailImap[_0x14c5('0x24')][_0x14c5('0x26')]=function(_0x2844c1,_0x2a532a){if(_0x2844c1){this[_0x14c5('0x27')](_0x2844c1,!![]);}else{this[_0x14c5('0x28')](_0x14c5('0x29'),_0x2a532a);this['readUnseen']();}};EmailImap[_0x14c5('0x24')]['handleCloseBox']=function(_0x2a5818){if(_0x2a5818){this['handleError'](_0x2a5818,!![]);}else{this[_0x14c5('0x1')][_0x14c5('0x13')]();}};EmailImap['prototype'][_0x14c5('0x2a')]=function(){this[_0x14c5('0x1')][_0x14c5('0x2b')]([_0x14c5('0x2c')],this[_0x14c5('0x2d')][_0x14c5('0x12')](this));};EmailImap[_0x14c5('0x24')][_0x14c5('0x2d')]=function(_0x410e80,_0xefc6ed){if(_0x410e80){this[_0x14c5('0x27')](_0x410e80,!![]);}else{if(_0xefc6ed[_0x14c5('0x2e')]){try{var _0x317128=this[_0x14c5('0x1')][_0x14c5('0x2f')](_0xefc6ed,{'bodies':'','markSeen':!![]});_0x317128['on'](_0x14c5('0x30'),this[_0x14c5('0x31')][_0x14c5('0x12')](this));_0x317128[_0x14c5('0x10')](_0x14c5('0x15'),this['handleFetchError'][_0x14c5('0x12')](this));_0x317128[_0x14c5('0x10')](_0x14c5('0x13'),this[_0x14c5('0x32')][_0x14c5('0x12')](this));}catch(_0x302a2b){logger[_0x14c5('0x15')](_0x302a2b);}}else{this['imap'][_0x14c5('0x33')](!![],this['handleCloseBox'][_0x14c5('0x12')](this));}}};EmailImap['prototype'][_0x14c5('0x31')]=function(_0x3743d8,_0x4a2747){_0x3743d8['on'](_0x14c5('0x34'),this[_0x14c5('0x35')][_0x14c5('0x12')](this));_0x3743d8[_0x14c5('0x10')](_0x14c5('0x36'),this['handleMessageAttributes'][_0x14c5('0x12')](this));_0x3743d8[_0x14c5('0x10')](_0x14c5('0x13'),this[_0x14c5('0x37')]['bind'](this));};EmailImap['prototype']['handleMessageBody']=function(_0xe23045,_0x41a084){simpleParser(_0xe23045,{'Iconv':Iconv},this[_0x14c5('0x38')][_0x14c5('0x12')](this));};EmailImap[_0x14c5('0x24')]['handleMessageAttributes']=function(_0x1339ce){};EmailImap[_0x14c5('0x24')][_0x14c5('0x37')]=function(){};EmailImap[_0x14c5('0x24')][_0x14c5('0x38')]=function(_0x2a376a,_0x66b9bd){if(_0x2a376a){logger[_0x14c5('0x15')](_0x2a376a);}else{var _0x1b55ee=this;utils[_0x14c5('0x39')](this[_0x14c5('0xf')],_0x66b9bd,function(_0x1e6622){_0x1b55ee[_0x14c5('0x28')](_0x14c5('0xc'),_0x1e6622);});}};EmailImap[_0x14c5('0x24')][_0x14c5('0x32')]=function(){this[_0x14c5('0x1')]['closeBox'](!![],this[_0x14c5('0x3a')][_0x14c5('0x12')](this));};EmailImap[_0x14c5('0x24')]['handleFetchError']=function(_0x4c3118){this[_0x14c5('0x27')](_0x4c3118);this[_0x14c5('0x1')]['closeBox'](!![],this[_0x14c5('0x3a')][_0x14c5('0x12')](this));};EmailImap[_0x14c5('0x24')][_0x14c5('0x14')]=function(){this[_0x14c5('0x28')](_0x14c5('0x13'));};EmailImap[_0x14c5('0x24')]['handleError']=function(_0x1bef08,_0x22e9fe){logger[_0x14c5('0x15')]('handleError',this[_0x14c5('0xf')]['email'],JSON[_0x14c5('0x3b')](_0x1bef08));var _0x18f4e8='';if(_0x1bef08){if(_0x1bef08[_0x14c5('0x3c')]){_0x18f4e8=_0x1bef08[_0x14c5('0x3c')];}else{for(var _0x21b70c in _0x1bef08){if(_0x1bef08[_0x14c5('0x3d')](_0x21b70c)){_0x18f4e8+=_['upperFirst'](_0x21b70c)+':\x20'+_0x1bef08[_0x21b70c]+'\x0a';}}}}if(_0x22e9fe){this[_0x14c5('0x1')]['end']();}else{this[_0x14c5('0x28')]('error',_0x18f4e8);this['emit'](_0x14c5('0x13'));}};module[_0x14c5('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 28d1dbd..04a7101 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 _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 +var _0x8ab7=['prototype','send','createTransport','use','compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x8ab7,0x142));var _0x78ab=function(_0x48d5ad,_0x1f9e90){_0x48d5ad=_0x48d5ad-0x0;var _0x12f5fc=_0x8ab7[_0x48d5ad];return _0x12f5fc;};'use strict';var nodemailer=require(_0x78ab('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0x78ab('0x1'));function EmailSmtp(){}EmailSmtp[_0x78ab('0x2')][_0x78ab('0x3')]=function(_0x5b0db0,_0x790851){return new BPromise(function(_0x3bc3d9,_0x109713){var _0x13fd79=nodemailer[_0x78ab('0x4')](_0x5b0db0);_0x13fd79[_0x78ab('0x5')](_0x78ab('0x6'),inlineBase64());_0x13fd79[_0x78ab('0x7')](_0x790851,function(_0x3cfa89,_0x535054){if(_0x3cfa89){_0x109713(_0x3cfa89[_0x78ab('0x8')]());}else{_0x3bc3d9(_0x535054);}});});};EmailSmtp[_0x78ab('0x2')]['verify']=function(_0x32e033){return new BPromise(function(_0x382ffc,_0x589124){var _0x1ca373=nodemailer['createTransport'](_0x32e033);_0x1ca373[_0x78ab('0x9')](function(_0x805fe3,_0x3a9ab7){if(_0x805fe3){_0x589124(_0x805fe3[_0x78ab('0x8')]());}else{if(_0x3a9ab7){_0x382ffc(_0x3a9ab7);}else{_0x589124(_0x78ab('0xa'));}}});});};module[_0x78ab('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 2f19b8a..096e532 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 _0x0f42=['generate','html','replace','body','textAsHtml','Empty\x20message

','Attachments','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','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'](/Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util','../../../config/logger','../../../config/environment'];(function(_0x19a22c,_0x13c898){var _0x5e96b8=function(_0x40ad05){while(--_0x40ad05){_0x19a22c['push'](_0x19a22c['shift']());}};_0x5e96b8(++_0x13c898);}(_0xcd3a,0x179));var _0xacd3=function(_0x124555,_0x2f5784){_0x124555=_0x124555-0x0;var _0xb8690d=_0xcd3a[_0x124555];return _0xb8690d;};'use strict';var _=require(_0xacd3('0x0'));var moment=require(_0xacd3('0x1'));var random=require(_0xacd3('0x2'));var fs=require('fs');var path=require(_0xacd3('0x3'));var util=require(_0xacd3('0x4'));var tnef=require('node-tnef');var logger=require(_0xacd3('0x5'))('email');var config=require(_0xacd3('0x6'));function getAddress(_0x249faa){var _0x40373b=_['head'](_0x249faa['value']);return _0x40373b&&_0x40373b['address']?_0x40373b[_0xacd3('0x7')]:_0xacd3('0x8')+random['generate'](0x6)+_0xacd3('0x9');}function getFirstName(_0x35322e){var _0x45671b=_['head'](_0x35322e[_0xacd3('0xa')]);if(_0x45671b&&_0x45671b[_0xacd3('0xb')]){var _0x36c4d8=_0x45671b[_0xacd3('0xb')][_0xacd3('0xc')](/\s+/);return _0x36c4d8['length']?_0x36c4d8[_0xacd3('0xd')](0x0,-0x1)[_0xacd3('0xe')]('\x20'):_0x45671b[_0xacd3('0xb')];}return _0xacd3('0xf');}function getLastName(_0x2ec1a4){var _0x55adcd=_[_0xacd3('0x10')](_0x2ec1a4[_0xacd3('0xa')]);if(_0x55adcd&&_0x55adcd[_0xacd3('0xb')]){var _0x44b155=_0x55adcd['name'][_0xacd3('0xc')](/\s+/);return _0x44b155[_0xacd3('0x11')]>0x1?_0x44b155[_0xacd3('0x12')]():'';}return'';}function getMails(_0x25c4e5,_0xf4a192){var _0x379214='';for(var _0x311abd=0x0;_0x311abd<_0xf4a192[_0xacd3('0xa')]['length'];_0x311abd+=0x1){if(_0xf4a192[_0xacd3('0xa')][_0x311abd][_0xacd3('0x7')]!==_0x25c4e5){if(!_[_0xacd3('0x13')](_0x379214)){_0x379214+=',';}_0x379214+=_0xf4a192[_0xacd3('0xa')][_0x311abd][_0xacd3('0xb')]||_0xf4a192[_0xacd3('0xa')][_0x311abd][_0xacd3('0x7')]||'';_0x379214+='\x20<';_0x379214+=_0xf4a192[_0xacd3('0xa')][_0x311abd][_0xacd3('0x7')]?_0xf4a192[_0xacd3('0xa')][_0x311abd][_0xacd3('0x7')]:_0xacd3('0x8')+random[_0xacd3('0x14')](0x6)+_0xacd3('0x9');_0x379214+='>';}}return _0x379214;}function parseEmail(_0x2ff9ea,_0x35bacb,_0x190f2f){if(_0x35bacb[_0xacd3('0x15')]){var _0x1bb27d=/)<[^<]*)*<\/script>/gi;while(_0x1bb27d[_0xacd3('0x16')](_0x35bacb[_0xacd3('0x15')])){_0x35bacb[_0xacd3('0x15')]=_0x35bacb[_0xacd3('0x15')][_0xacd3('0x17')](_0x1bb27d,'');}_0x190f2f['body']=_0x35bacb[_0xacd3('0x15')];}else{_0x190f2f[_0xacd3('0x18')]=_0x35bacb['textAsHtml'];}if(_0x190f2f[_0xacd3('0x18')]){_0x190f2f['body']=_0x190f2f[_0xacd3('0x18')][_0xacd3('0x17')](/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 +var _0xe35d=['openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','md5','updateRealtime','prototype','getChannelStatus','CurrentCapacity','maxcapacity','working','chat','openchannel','fax','sms','whatsapp','length','StatusTime','toNumber','format','Status','chatCurrentCapacity','mailStatus','mailStatusTime','whatsappCurrentCapacity','openchannelStatus','emit','user:save','exports','lodash','moment','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','unknown','whatsappStatusTime','whatsappCapacity'];(function(_0x41df69,_0xafdc86){var _0x10f401=function(_0x30c851){while(--_0x30c851){_0x41df69['push'](_0x41df69['shift']());}};_0x10f401(++_0xafdc86);}(_0xe35d,0xd5));var _0xde35=function(_0x97998c,_0x46cbca){_0x97998c=_0x97998c-0x0;var _0x492e4f=_0xe35d[_0x97998c];return _0x492e4f;};'use strict';var _=require(_0xde35('0x0'));var moment=require(_0xde35('0x1'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0xde35('0x2'));config[_0xde35('0x3')]=_[_0xde35('0x4')](config[_0xde35('0x3')],{'host':_0xde35('0x5'),'port':0x18eb});var io=require(_0xde35('0x6'))(new Redis(config[_0xde35('0x3')]));function Agent(_0x1b3632){this['id']=_0x1b3632['id']||0x0;this[_0xde35('0x7')]=_0x1b3632[_0xde35('0x7')]||'';this['online']=_0x1b3632[_0xde35('0x8')]||!![];this[_0xde35('0x9')]=_0x1b3632[_0xde35('0x9')]||![];this[_0xde35('0xa')]=_0x1b3632[_0xde35('0xa')]||![];this['mailPause']=_0x1b3632[_0xde35('0xb')]||![];this[_0xde35('0xc')]=_0x1b3632[_0xde35('0xc')]||![];this['smsPause']=_0x1b3632[_0xde35('0xd')]||![];this[_0xde35('0xe')]=_0x1b3632['openchannelPause']||![];this[_0xde35('0xf')]='unknown';this[_0xde35('0x10')]=0x0;this['chatCapacity']=_0x1b3632[_0xde35('0x11')]||0x0;this['chatCurrentCapacity']=0x0;this['mailStatus']='unknown';this['mailStatusTime']=0x0;this['mailCapacity']=_0x1b3632[_0xde35('0x12')]||0x0;this[_0xde35('0x13')]=0x0;this['faxStatus']='unknown';this[_0xde35('0x14')]=0x0;this[_0xde35('0x15')]=_0x1b3632[_0xde35('0x15')]||0x0;this[_0xde35('0x16')]=0x0;this[_0xde35('0x17')]='unknown';this[_0xde35('0x18')]=0x0;this[_0xde35('0x19')]=_0x1b3632[_0xde35('0x19')]||0x0;this[_0xde35('0x1a')]=0x0;this[_0xde35('0x1b')]=_0xde35('0x1c');this[_0xde35('0x1d')]=0x0;this['whatsappCapacity']=_0x1b3632[_0xde35('0x1e')]||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']='unknown';this[_0xde35('0x1f')]=0x0;this['openchannelCapacity']=_0x1b3632[_0xde35('0x20')]||0x0;this[_0xde35('0x21')]=0x0;this[_0xde35('0x22')]=![];this[_0xde35('0x23')]=undefined;this[_0xde35('0x24')]='';this[_0xde35('0x25')]();}Agent[_0xde35('0x26')][_0xde35('0x27')]=function(_0x190ccd){if(this[_0x190ccd+'CurrentCapacity']>0x0){if(this[_0x190ccd+'Capacity']>0x0&&this[_0x190ccd+_0xde35('0x28')]>=this[_0x190ccd+'Capacity']){return _0xde35('0x29');}else{return _0xde35('0x2a');}}else{return'idle';}};Agent[_0xde35('0x26')][_0xde35('0x25')]=function(){var _0xbbb922=['mail',_0xde35('0x2b'),_0xde35('0x2c'),_0xde35('0x2d'),_0xde35('0x2e'),_0xde35('0x2f')];for(var _0x1b3a37=0x0;_0x1b3a37<_0xbbb922[_0xde35('0x30')];_0x1b3a37+=0x1){var _0x4a29a2=this[_0xde35('0x27')](_0xbbb922[_0x1b3a37]);if(this[_0xbbb922[_0x1b3a37]+'Status']!==_0x4a29a2){this[_0xbbb922[_0x1b3a37]+_0xde35('0x31')]=_[_0xde35('0x32')](moment()[_0xde35('0x33')]('x'));}this[_0xbbb922[_0x1b3a37]+_0xde35('0x34')]=_0x4a29a2;}var _0x52a08a={'id':this['id'],'name':this[_0xde35('0x7')],'online':this[_0xde35('0x8')],'voicePause':this[_0xde35('0x9')],'chatPause':this[_0xde35('0xa')],'mailPause':this[_0xde35('0xb')],'smsPause':this[_0xde35('0xd')],'faxPause':this[_0xde35('0xc')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xde35('0xf')],'chatStatusTime':this[_0xde35('0x10')],'chatCapacity':this[_0xde35('0x11')],'chatCurrentCapacity':this[_0xde35('0x35')],'mailStatus':this[_0xde35('0x36')],'mailStatusTime':this[_0xde35('0x37')],'mailCapacity':this[_0xde35('0x12')],'mailCurrentCapacity':this[_0xde35('0x13')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xde35('0x14')],'faxCapacity':this[_0xde35('0x15')],'faxCurrentCapacity':this[_0xde35('0x16')],'smsStatus':this[_0xde35('0x17')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xde35('0x1a')],'whatsappStatus':this[_0xde35('0x1b')],'whatsappStatusTime':this[_0xde35('0x1d')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0xde35('0x38')],'openchannelStatus':this[_0xde35('0x39')],'openchannelStatusTime':this[_0xde35('0x1f')],'openchannelCapacity':this[_0xde35('0x20')],'openchannelCurrentCapacity':this[_0xde35('0x21')],'busy':this['busy'],'busyQueue':this[_0xde35('0x23')]};var _0x2aae80=md5(JSON['stringify'](_0x52a08a));if(this[_0xde35('0x24')]!==_0x2aae80){this[_0xde35('0x24')]=_0x2aae80;io[_0xde35('0x3a')](_0xde35('0x3b'),_0x52a08a);}};module[_0xde35('0x3c')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 98557a6..9319830 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 _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 +var _0x3163=['md5','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','timeout','strategy','Agents','waiting','prototype','_rr','mapAgentsId','updateRealtime','loggedIn','paused','length','online','available','stringify','chat_queue:save','exports'];(function(_0x9b346f,_0x5218f7){var _0x1683a6=function(_0x56141c){while(--_0x56141c){_0x9b346f['push'](_0x9b346f['shift']());}};_0x1683a6(++_0x5218f7);}(_0x3163,0x159));var _0x3316=function(_0x1aa9bd,_0xb7e622){_0x1aa9bd=_0x1aa9bd-0x0;var _0x1260bb=_0x3163[_0x1aa9bd];return _0x1260bb;};'use strict';var _=require('lodash');var md5=require(_0x3316('0x0'));var util=require('util');var Redis=require(_0x3316('0x1'));var config=require(_0x3316('0x2'));config['redis']=_[_0x3316('0x3')](config[_0x3316('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x3316('0x5'))(new Redis(config[_0x3316('0x4')]));function ChatQueue(_0x2a6987){this['id']=_0x2a6987['id']||0x0;this[_0x3316('0x6')]=_0x2a6987[_0x3316('0x6')]||'';this[_0x3316('0x7')]=_0x2a6987['timeout']||0xa;this['strategy']=_0x2a6987[_0x3316('0x8')]||'beepall';this[_0x3316('0x9')]=_0x2a6987[_0x3316('0x9')];this['mapAgentsId']={};this[_0x3316('0xa')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0x3316('0xb')]['updateRouting']=function(){var _0x3c87c3=this['mapAgentsId'][_0x3316('0xc')];this[_0x3316('0xd')]=_['map'](this[_0x3316('0x9')],'id');this[_0x3316('0xd')][_0x3316('0xc')]=_0x3c87c3;};ChatQueue[_0x3316('0xb')][_0x3316('0xe')]=function(){this[_0x3316('0xf')]=0x0;this[_0x3316('0x10')]=0x0;for(var _0x5c6aa0=0x0;_0x5c6aa0=0x0?this[_0x3316('0x13')]:0x0;var _0x57d522={'id':this['id'],'available':this['available'],'loggedIn':this[_0x3316('0xf')],'name':this['name'],'paused':this[_0x3316('0x10')],'waiting':this['waiting']};var _0x597115=md5(JSON[_0x3316('0x14')](_0x57d522));if(this['md5']!==_0x597115){this[_0x3316('0x0')]=_0x597115;io['to'](util['format']('chat:queue:%s',_0x57d522[_0x3316('0x6')]))['emit'](_0x3316('0x15'),_0x57d522);}};module[_0x3316('0x16')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 97f7570..a85ac33 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(_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 +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(_0x32e3bd,_0x63121b){var _0x541ab9=function(_0xf41130){while(--_0xf41130){_0x32e3bd['push'](_0x32e3bd['shift']());}};_0x541ab9(++_0x63121b);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 15b6939..2c5e2bc 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 _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 +var _0xe2ca=['Intervals','exports','name'];(function(_0x216008,_0x2d1023){var _0x4d384f=function(_0x3fd7e2){while(--_0x3fd7e2){_0x216008['push'](_0x216008['shift']());}};_0x4d384f(++_0x2d1023);}(_0xe2ca,0x1e8));var _0xae2c=function(_0x4543cc,_0xb1ddeb){_0x4543cc=_0x4543cc-0x0;var _0x245a31=_0xe2ca[_0x4543cc];return _0x245a31;};'use strict';function Interval(_0x2707a3){this['id']=_0x2707a3['id']||0x0;this[_0xae2c('0x0')]=_0x2707a3[_0xae2c('0x0')]||'';this['Intervals']=_0x2707a3[_0xae2c('0x1')]||{};}module[_0xae2c('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 6203518..c3f17fb 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 _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 +var _0xb839=['updateRouting','updateRealtime','mapAgentsId','_rr','paused','length','mailPause','available','loggedIn','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','util','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall','Agents','md5'];(function(_0x13a96e,_0xfc4ed5){var _0x3b5bdc=function(_0x408d77){while(--_0x408d77){_0x13a96e['push'](_0x13a96e['shift']());}};_0x3b5bdc(++_0xfc4ed5);}(_0xb839,0x11d));var _0x9b83=function(_0x2e550d,_0x2d683c){_0x2e550d=_0x2e550d-0x0;var _0x13eafc=_0xb839[_0x2e550d];return _0x13eafc;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x9b83('0x0'));var Redis=require(_0x9b83('0x1'));var config=require(_0x9b83('0x2'));config['redis']=_[_0x9b83('0x3')](config[_0x9b83('0x4')],{'host':_0x9b83('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9b83('0x4')]));function MailQueue(_0x4e8d5f){this['id']=_0x4e8d5f['id']||0x0;this['name']=_0x4e8d5f[_0x9b83('0x6')]||'';this['timeout']=_0x4e8d5f[_0x9b83('0x7')]||0xa;this[_0x9b83('0x8')]=_0x4e8d5f[_0x9b83('0x8')]||_0x9b83('0x9');this['Agents']=_0x4e8d5f[_0x9b83('0xa')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x9b83('0xb')]='';this[_0x9b83('0xc')]();this[_0x9b83('0xd')]();}MailQueue['prototype'][_0x9b83('0xc')]=function(){var _0x52162d=this[_0x9b83('0xe')][_0x9b83('0xf')];this[_0x9b83('0xe')]=_['map'](this[_0x9b83('0xa')],'id');this['mapAgentsId']['_rr']=_0x52162d;};MailQueue['prototype'][_0x9b83('0xd')]=function(){this['loggedIn']=0x0;this[_0x9b83('0x10')]=0x0;for(var _0x303402=0x0;_0x303402=0x0?this['available']:0x0;var _0x1b5825={'id':this['id'],'available':this['available'],'loggedIn':this[_0x9b83('0x14')],'name':this[_0x9b83('0x6')],'paused':this[_0x9b83('0x10')],'waiting':this['waiting']};var _0xf2d0ed=md5(JSON[_0x9b83('0x15')](_0x1b5825));if(this['md5']!==_0xf2d0ed){this['md5']=_0xf2d0ed;io['to'](util[_0x9b83('0x16')](_0x9b83('0x17'),_0x1b5825[_0x9b83('0x6')]))[_0x9b83('0x18')](_0x9b83('0x19'),_0x1b5825);}};module[_0x9b83('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 397c4d6..fd40ab1 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 _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 +var _0xd030=['beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','online','available','format','emit','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x32ab72,_0x47dd1b){var _0x83eea5=function(_0x5dc26c){while(--_0x5dc26c){_0x32ab72['push'](_0x32ab72['shift']());}};_0x83eea5(++_0x47dd1b);}(_0xd030,0x161));var _0x0d03=function(_0x3daad4,_0x404a0b){_0x3daad4=_0x3daad4-0x0;var _0x128c0d=_0xd030[_0x3daad4];return _0x128c0d;};'use strict';var _=require(_0x0d03('0x0'));var md5=require(_0x0d03('0x1'));var util=require(_0x0d03('0x2'));var Redis=require(_0x0d03('0x3'));var config=require(_0x0d03('0x4'));config[_0x0d03('0x5')]=_['defaults'](config['redis'],{'host':_0x0d03('0x6'),'port':0x18eb});var io=require(_0x0d03('0x7'))(new Redis(config[_0x0d03('0x5')]));function OpenchannelQueue(_0x440b22){this['id']=_0x440b22['id']||0x0;this['name']=_0x440b22[_0x0d03('0x8')]||'';this[_0x0d03('0x9')]=_0x440b22[_0x0d03('0x9')]||0xa;this['strategy']=_0x440b22[_0x0d03('0xa')]||_0x0d03('0xb');this[_0x0d03('0xc')]=_0x440b22[_0x0d03('0xc')];this[_0x0d03('0xd')]={};this[_0x0d03('0xe')]=0x0;this[_0x0d03('0x1')]='';this['updateRouting']();this[_0x0d03('0xf')]();}OpenchannelQueue[_0x0d03('0x10')]['updateRouting']=function(){var _0x2dd78c=this[_0x0d03('0xd')]['_rr'];this['mapAgentsId']=_[_0x0d03('0x11')](this[_0x0d03('0xc')],'id');this['mapAgentsId'][_0x0d03('0x12')]=_0x2dd78c;};OpenchannelQueue[_0x0d03('0x10')][_0x0d03('0xf')]=function(){this[_0x0d03('0x13')]=0x0;this[_0x0d03('0x14')]=0x0;for(var _0x163416=0x0;_0x163416=0x0?this[_0x0d03('0x17')]:0x0;var _0x2ffdf8={'id':this['id'],'available':this[_0x0d03('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x0d03('0x8')],'paused':this[_0x0d03('0x14')],'waiting':this[_0x0d03('0xe')]};var _0x18360d=md5(JSON['stringify'](_0x2ffdf8));if(this[_0x0d03('0x1')]!==_0x18360d){this['md5']=_0x18360d;io['to'](util[_0x0d03('0x18')]('openchannel:queue:%s',_0x2ffdf8[_0x0d03('0x8')]))[_0x0d03('0x19')](_0x0d03('0x1a'),_0x2ffdf8);}};module[_0x0d03('0x1b')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 95e61e3..9f70d21 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 _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 +var _0x757a=['redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','length','online','loggedIn','smsPause','paused','available','format','sms:queue:%s','emit','md5','util','defaults'];(function(_0x42ab91,_0x2a0179){var _0x259d35=function(_0x2d48bf){while(--_0x2d48bf){_0x42ab91['push'](_0x42ab91['shift']());}};_0x259d35(++_0x2a0179);}(_0x757a,0xde));var _0xa757=function(_0x39ff0a,_0x377f81){_0x39ff0a=_0x39ff0a-0x0;var _0x2b0341=_0x757a[_0x39ff0a];return _0x2b0341;};'use strict';var _=require('lodash');var md5=require(_0xa757('0x0'));var util=require(_0xa757('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0xa757('0x2')](config[_0xa757('0x3')],{'host':_0xa757('0x4'),'port':0x18eb});var io=require(_0xa757('0x5'))(new Redis(config[_0xa757('0x3')]));function SmsQueue(_0x3caeb0){this['id']=_0x3caeb0['id']||0x0;this['name']=_0x3caeb0[_0xa757('0x6')]||'';this[_0xa757('0x7')]=_0x3caeb0['timeout']||0xa;this[_0xa757('0x8')]=_0x3caeb0[_0xa757('0x8')]||_0xa757('0x9');this[_0xa757('0xa')]=_0x3caeb0[_0xa757('0xa')];this['mapAgentsId']={};this[_0xa757('0xb')]=0x0;this[_0xa757('0x0')]='';this[_0xa757('0xc')]();this[_0xa757('0xd')]();}SmsQueue[_0xa757('0xe')][_0xa757('0xc')]=function(){var _0x17408b=this['mapAgentsId']['_rr'];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0xa757('0xf')]['_rr']=_0x17408b;};SmsQueue['prototype'][_0xa757('0xd')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x32112b=0x0;_0x32112b=0x0?this['available']:0x0;var _0x54b305={'id':this['id'],'available':this[_0xa757('0x15')],'loggedIn':this[_0xa757('0x12')],'name':this[_0xa757('0x6')],'paused':this[_0xa757('0x14')],'waiting':this[_0xa757('0xb')]};var _0xe2d567=md5(JSON['stringify'](_0x54b305));if(this[_0xa757('0x0')]!==_0xe2d567){this['md5']=_0xe2d567;io['to'](util[_0xa757('0x16')](_0xa757('0x17'),_0x54b305[_0xa757('0x6')]))[_0xa757('0x18')]('sms_queue:save',_0x54b305);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 29ffd52..4306bac 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 _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 +var _0xf777=['paused','online','available','stringify','whatsapp:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','updateRouting','_rr','map','prototype','loggedIn'];(function(_0x3abe5e,_0x515b4f){var _0x4c2e5e=function(_0x146f04){while(--_0x146f04){_0x3abe5e['push'](_0x3abe5e['shift']());}};_0x4c2e5e(++_0x515b4f);}(_0xf777,0x180));var _0x7f77=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf777[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7f77('0x0'));var md5=require(_0x7f77('0x1'));var util=require(_0x7f77('0x2'));var Redis=require(_0x7f77('0x3'));var config=require(_0x7f77('0x4'));config['redis']=_[_0x7f77('0x5')](config['redis'],{'host':_0x7f77('0x6'),'port':0x18eb});var io=require(_0x7f77('0x7'))(new Redis(config[_0x7f77('0x8')]));function WhatsappQueue(_0x3107f5){this['id']=_0x3107f5['id']||0x0;this[_0x7f77('0x9')]=_0x3107f5['name']||'';this[_0x7f77('0xa')]=_0x3107f5[_0x7f77('0xa')]||0xa;this[_0x7f77('0xb')]=_0x3107f5['strategy']||_0x7f77('0xc');this[_0x7f77('0xd')]=_0x3107f5[_0x7f77('0xd')];this[_0x7f77('0xe')]={};this[_0x7f77('0xf')]=0x0;this[_0x7f77('0x1')]='';this['updateRouting']();this[_0x7f77('0x10')]();}WhatsappQueue['prototype'][_0x7f77('0x11')]=function(){var _0x478468=this[_0x7f77('0xe')][_0x7f77('0x12')];this[_0x7f77('0xe')]=_[_0x7f77('0x13')](this[_0x7f77('0xd')],'id');this[_0x7f77('0xe')][_0x7f77('0x12')]=_0x478468;};WhatsappQueue[_0x7f77('0x14')][_0x7f77('0x10')]=function(){this[_0x7f77('0x15')]=0x0;this[_0x7f77('0x16')]=0x0;for(var _0x2174a2=0x0;_0x2174a2=0x0?this['available']:0x0;var _0x2b5fcb={'id':this['id'],'available':this[_0x7f77('0x18')],'loggedIn':this[_0x7f77('0x15')],'name':this['name'],'paused':this[_0x7f77('0x16')],'waiting':this['waiting']};var _0x5a02c8=md5(JSON[_0x7f77('0x19')](_0x2b5fcb));if(this[_0x7f77('0x1')]!==_0x5a02c8){this[_0x7f77('0x1')]=_0x5a02c8;io['to'](util['format'](_0x7f77('0x1a'),_0x2b5fcb['name']))[_0x7f77('0x1b')]('whatsapp_queue:save',_0x2b5fcb);}};module[_0x7f77('0x1c')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 30a46af..878c51f 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 _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 +var _0x7fbe=['../model/agent','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','mailQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','smsQueues','initMailQueues','initFaxQueues','initWhatsappQueues','lodash','moment'];(function(_0x382f53,_0x2b46e5){var _0x4071c7=function(_0x4ea716){while(--_0x4ea716){_0x382f53['push'](_0x382f53['shift']());}};_0x4071c7(++_0x2b46e5);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x1c90a7,_0x115e4d){_0x1c90a7=_0x1c90a7-0x0;var _0x408b33=_0x7fbe[_0x1c90a7];return _0x408b33;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xe7fb('0x0'));var moment=require(_0xe7fb('0x1'));var Agent=require(_0xe7fb('0x2'));var Interval=require(_0xe7fb('0x3'));var OpenchannelQueue=require(_0xe7fb('0x4'));var ChatQueue=require(_0xe7fb('0x5'));var SmsQueue=require(_0xe7fb('0x6'));var MailQueue=require(_0xe7fb('0x7'));var FaxQueue=require(_0xe7fb('0x8'));var WhatsappQueue=require(_0xe7fb('0x9'));var Realtime=function(){this[_0xe7fb('0xa')]={};this[_0xe7fb('0xb')]={};this[_0xe7fb('0xc')]={};this[_0xe7fb('0xd')]={};this['smsQueues']={};this[_0xe7fb('0xe')]={};this[_0xe7fb('0xf')]={};this[_0xe7fb('0x10')]={};this[_0xe7fb('0x11')]={};this['mailQueuesWaitingInteractions']={};this['openchannelQueuesWaitingInteractions']={};this[_0xe7fb('0x12')]={};this[_0xe7fb('0x13')]={};this[_0xe7fb('0x14')]={};};function freeIsNotKey(_0x348a73,_0x2a2223,_0x42435c){var _0x3e934b=_[_0xe7fb('0x15')](_0x348a73,function(_0x325035,_0x2fe8ab){return _0x325035[_0x42435c];});for(var _0x2437d4 in _0x2a2223){if(_0x2a2223[_0xe7fb('0x16')](_0x2437d4)){if(!_0x3e934b[_0x2437d4]){delete _0x2a2223[_0x2437d4];}}}}Realtime[_0xe7fb('0x17')][_0xe7fb('0x18')]=function(_0x7fe4d3,_0x598729){for(var _0x278b75 in _0x598729){if(_0x7fe4d3[_0xe7fb('0x16')](_0x278b75)){_0x7fe4d3[_0x278b75]=_0x598729[_0x278b75];}}};Realtime['prototype'][_0xe7fb('0x19')]=function(){var _0x37eb9f=this;return function(_0x482f7d){if(_0x482f7d){freeIsNotKey(_0x482f7d,_0x37eb9f[_0xe7fb('0xa')],'id');for(var _0x559129=0x0,_0x12fff6={},_0x18d23c={};_0x559129<_0x482f7d[_0xe7fb('0x1a')];_0x559129+=0x1){_0x12fff6=_0x482f7d[_0x559129];if(_[_0xe7fb('0x1b')](_0x37eb9f['agents'][_0x12fff6['id']])){_0x37eb9f[_0xe7fb('0xa')][_0x12fff6['id']]=new Agent(_0x12fff6);}else{_0x37eb9f['mergeFromDatabase'](_0x37eb9f[_0xe7fb('0xa')][_0x12fff6['id']],_0x12fff6);}}}return _0x37eb9f['agents'];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x1c')]=function(){var _0x3f96a7=this;return function(_0x182269){if(_0x182269){freeIsNotKey(_0x182269,_0x3f96a7['intervals'],'id');for(var _0x44466e=0x0,_0x5d1c87={},_0x11cae0={};_0x44466e<_0x182269['length'];_0x44466e+=0x1){_0x5d1c87=_0x182269[_0x44466e];if(_[_0xe7fb('0x1b')](_0x3f96a7['intervals'][_0x5d1c87['id']])){_0x3f96a7[_0xe7fb('0xb')][_0x5d1c87['id']]=new Interval(_0x5d1c87);}else{_0x3f96a7[_0xe7fb('0x18')](_0x3f96a7['intervals'][_0x5d1c87['id']],_0x5d1c87);}}}return _0x3f96a7[_0xe7fb('0xb')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x1d')]=function(){var _0x4dcb4b=this;return function(_0x469d50){if(_0x469d50){freeIsNotKey(_0x469d50,_0x4dcb4b[_0xe7fb('0xc')],'id');for(var _0x5da3d9=0x0,_0x5bea27={},_0x52f08b={};_0x5da3d9<_0x469d50[_0xe7fb('0x1a')];_0x5da3d9+=0x1){_0x5bea27=_0x469d50[_0x5da3d9];if(_['isUndefined'](_0x4dcb4b['openchannelQueues'][_0x5bea27['id']])){_0x4dcb4b[_0xe7fb('0xc')][_0x5bea27['id']]=new OpenchannelQueue(_0x5bea27);}else{_0x4dcb4b[_0xe7fb('0x18')](_0x4dcb4b[_0xe7fb('0xc')][_0x5bea27['id']],_0x5bea27);}_0x4dcb4b['openchannelQueues'][_0x5bea27['id']][_0xe7fb('0x1e')]();_0x4dcb4b[_0xe7fb('0xc')][_0x5bea27['id']][_0xe7fb('0x1f')]();}}return _0x4dcb4b[_0xe7fb('0xc')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x20')]=function(){var _0x380130=this;return function(_0x59e015){if(_0x59e015){freeIsNotKey(_0x59e015,_0x380130['chatQueues'],'id');for(var _0x1086e6=0x0,_0x3bdee9={},_0xead63={};_0x1086e6<_0x59e015['length'];_0x1086e6+=0x1){_0x3bdee9=_0x59e015[_0x1086e6];if(_[_0xe7fb('0x1b')](_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']])){_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']]=new ChatQueue(_0x3bdee9);}else{_0x380130[_0xe7fb('0x18')](_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']],_0x3bdee9);}_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']][_0xe7fb('0x1e')]();_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']]['updateRealtime']();}}return _0x380130[_0xe7fb('0xd')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x21')]=function(){var _0x547a04=this;return function(_0x517d70){if(_0x517d70){freeIsNotKey(_0x517d70,_0x547a04[_0xe7fb('0x22')],'id');for(var _0x4a9fea=0x0,_0xac56b4={},_0x2f8774={};_0x4a9fea<_0x517d70[_0xe7fb('0x1a')];_0x4a9fea+=0x1){_0xac56b4=_0x517d70[_0x4a9fea];if(_[_0xe7fb('0x1b')](_0x547a04['smsQueues'][_0xac56b4['id']])){_0x547a04[_0xe7fb('0x22')][_0xac56b4['id']]=new SmsQueue(_0xac56b4);}else{_0x547a04[_0xe7fb('0x18')](_0x547a04[_0xe7fb('0x22')][_0xac56b4['id']],_0xac56b4);}_0x547a04[_0xe7fb('0x22')][_0xac56b4['id']][_0xe7fb('0x1e')]();_0x547a04['smsQueues'][_0xac56b4['id']][_0xe7fb('0x1f')]();}}return _0x547a04[_0xe7fb('0x22')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x23')]=function(){var _0x46f430=this;return function(_0x25e925){if(_0x25e925){freeIsNotKey(_0x25e925,_0x46f430[_0xe7fb('0xe')],'id');for(var _0x147eb1=0x0,_0x389903={},_0x59f9df={};_0x147eb1<_0x25e925[_0xe7fb('0x1a')];_0x147eb1+=0x1){_0x389903=_0x25e925[_0x147eb1];if(_[_0xe7fb('0x1b')](_0x46f430[_0xe7fb('0xe')][_0x389903['id']])){_0x46f430['mailQueues'][_0x389903['id']]=new MailQueue(_0x389903);}else{_0x46f430[_0xe7fb('0x18')](_0x46f430[_0xe7fb('0xe')][_0x389903['id']],_0x389903);}_0x46f430[_0xe7fb('0xe')][_0x389903['id']][_0xe7fb('0x1e')]();_0x46f430[_0xe7fb('0xe')][_0x389903['id']][_0xe7fb('0x1f')]();}}return _0x46f430[_0xe7fb('0xe')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x24')]=function(){var _0xebfe1d=this;return function(_0x29c34a){if(_0x29c34a){freeIsNotKey(_0x29c34a,_0xebfe1d[_0xe7fb('0xf')],'id');for(var _0x1544f2=0x0,_0x1c81fe={},_0xeb7c29={};_0x1544f2<_0x29c34a[_0xe7fb('0x1a')];_0x1544f2+=0x1){_0x1c81fe=_0x29c34a[_0x1544f2];if(_[_0xe7fb('0x1b')](_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']])){_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']]=new FaxQueue(_0x1c81fe);}else{_0xebfe1d['mergeFromDatabase'](_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']],_0x1c81fe);}_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']][_0xe7fb('0x1e')]();_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']]['updateRealtime']();}}return _0xebfe1d[_0xe7fb('0xf')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x25')]=function(){var _0x413a13=this;return function(_0x49fe9d){if(_0x49fe9d){freeIsNotKey(_0x49fe9d,_0x413a13[_0xe7fb('0x10')],'id');for(var _0x451a6c=0x0,_0x34265f={},_0x62a8a1={};_0x451a6c<_0x49fe9d[_0xe7fb('0x1a')];_0x451a6c+=0x1){_0x34265f=_0x49fe9d[_0x451a6c];if(_[_0xe7fb('0x1b')](_0x413a13['whatsappQueues'][_0x34265f['id']])){_0x413a13[_0xe7fb('0x10')][_0x34265f['id']]=new WhatsappQueue(_0x34265f);}else{_0x413a13[_0xe7fb('0x18')](_0x413a13[_0xe7fb('0x10')][_0x34265f['id']],_0x34265f);}_0x413a13['whatsappQueues'][_0x34265f['id']][_0xe7fb('0x1e')]();_0x413a13[_0xe7fb('0x10')][_0x34265f['id']]['updateRealtime']();}}return _0x413a13['whatsappQueues'];};};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 91b5cf6..02e9dcc 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 _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 +var _0xa087=['Request','UpdateChatInteraction','updateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update'];(function(_0x1db481,_0x1627b2){var _0x3db95b=function(_0x2d54e4){while(--_0x2d54e4){_0x1db481['push'](_0x1db481['shift']());}};_0x3db95b(++_0x1627b2);}(_0xa087,0xd0));var _0x7a08=function(_0x8d274b,_0xbdfd29){_0x8d274b=_0x8d274b-0x0;var _0x30a202=_0xa087[_0x8d274b];return _0x30a202;};'use strict';var client=require(_0x7a08('0x0'));exports[_0x7a08('0x1')]=function(_0x2114f6,_0x10c739){return client[_0x7a08('0x2')](_0x7a08('0x3'),{'body':_0x10c739,'options':{'where':{'id':_0x2114f6}},'log':_0x7a08('0x4')});};exports['addTags']=function(_0x13951e,_0x3c9d6c){return client[_0x7a08('0x2')](_0x7a08('0x5'),{'body':_0x3c9d6c,'options':{'where':{'id':_0x13951e}},'log':_0x7a08('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 28d6bb8..cd19525 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 _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 +var _0x960a=['Request','createChatMessage','../client'];(function(_0x548382,_0x4625fc){var _0x46f525=function(_0x30042c){while(--_0x30042c){_0x548382['push'](_0x548382['shift']());}};_0x46f525(++_0x4625fc);}(_0x960a,0x9b));var _0xa960=function(_0x5aaefc,_0x582a57){_0x5aaefc=_0x5aaefc-0x0;var _0x2eb88a=_0x960a[_0x5aaefc];return _0x2eb88a;};'use strict';var client=require(_0xa960('0x0'));exports['create']=function(_0x417c4b){return client[_0xa960('0x1')]('CreateChatMessage',{'body':_0x417c4b,'log':_0xa960('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 8b862d1..9c2ad35 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 _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 +var _0x4cbd=['chatPause','../client','getChatQueues','Request','GetChatQueue','name','strategy','User','Agents'];(function(_0xa1fc86,_0x419a28){var _0x38c1a2=function(_0x433416){while(--_0x433416){_0xa1fc86['push'](_0xa1fc86['shift']());}};_0x38c1a2(++_0x419a28);}(_0x4cbd,0xac));var _0xd4cb=function(_0x55a101,_0x3df81b){_0x55a101=_0x55a101-0x0;var _0x43466b=_0x4cbd[_0x55a101];return _0x43466b;};'use strict';var client=require(_0xd4cb('0x0'));exports[_0xd4cb('0x1')]=function(){return function(){return client[_0xd4cb('0x2')](_0xd4cb('0x3'),{'options':{'raw':![],'attributes':['id',_0xd4cb('0x4'),'timeout',_0xd4cb('0x5')],'include':[{'model':_0xd4cb('0x6'),'as':_0xd4cb('0x7'),'attributes':['id',_0xd4cb('0x4'),'online',_0xd4cb('0x8')]}]},'log':_0xd4cb('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 58bf36a..e8bf328 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 _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 +var _0x8d53=['../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x22015c,_0x2aa7a4){var _0x251a91=function(_0x4d5058){while(--_0x4d5058){_0x22015c['push'](_0x22015c['shift']());}};_0x251a91(++_0x2aa7a4);}(_0x8d53,0x1c2));var _0x38d5=function(_0x2e0851,_0x4bcf4c){_0x2e0851=_0x2e0851-0x0;var _0xb79e84=_0x8d53[_0x2e0851];return _0xb79e84;};'use strict';var client=require(_0x38d5('0x0'));exports[_0x38d5('0x1')]=function(_0x5e0848){return client[_0x38d5('0x2')](_0x38d5('0x3'),{'body':_0x5e0848,'log':_0x38d5('0x3')});};exports[_0x38d5('0x4')]=function(_0x3a7660,_0x19c115){return client[_0x38d5('0x2')](_0x38d5('0x5'),{'body':_0x19c115,'options':{'where':{'uniqueid':_0x3a7660},'order':[['id','DESC']],'limit':0x1},'log':_0x38d5('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index ccc17a1..4a5cfe1 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 _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 +var _0xb48a=['../client','Request','UpdateFaxInteraction','updateFaxInteraction','AddTagsToFaxInteraction','addTagsToFaxInteraction'];(function(_0x4e8f33,_0x3edf1f){var _0x2bc1b8=function(_0x4dc6a6){while(--_0x4dc6a6){_0x4e8f33['push'](_0x4e8f33['shift']());}};_0x2bc1b8(++_0x3edf1f);}(_0xb48a,0x1d4));var _0xab48=function(_0x539d03,_0x4c32cd){_0x539d03=_0x539d03-0x0;var _0x51b31c=_0xb48a[_0x539d03];return _0x51b31c;};'use strict';var client=require(_0xab48('0x0'));exports['update']=function(_0x1e94fa,_0x38354b){return client[_0xab48('0x1')](_0xab48('0x2'),{'body':_0x38354b,'options':{'where':{'id':_0x1e94fa}},'log':_0xab48('0x3')});};exports['addTags']=function(_0x46fe12,_0x49f562){return client['Request'](_0xab48('0x4'),{'body':_0x49f562,'options':{'where':{'id':_0x46fe12}},'log':_0xab48('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 2b5349b..f1fba70 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 _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 +var _0xb556=['create','Request','../client'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xb556,0x1eb));var _0x6b55=function(_0x4fef03,_0x2099dd){_0x4fef03=_0x4fef03-0x0;var _0xd54639=_0xb556[_0x4fef03];return _0xd54639;};'use strict';var client=require(_0x6b55('0x0'));exports[_0x6b55('0x1')]=function(_0x364dc0){return client[_0x6b55('0x2')]('CreateFaxMessage',{'body':_0x364dc0,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 7178c89..5ff7375 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 _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 +var _0x2bec=['strategy','User','Agents','name','online','faxPause','getFaxQueues','GetFaxQueue'];(function(_0x4c260a,_0x148241){var _0x17bbdd=function(_0x4f3e9f){while(--_0x4f3e9f){_0x4c260a['push'](_0x4c260a['shift']());}};_0x17bbdd(++_0x148241);}(_0x2bec,0xb6));var _0xc2be=function(_0x2b434f,_0x290663){_0x2b434f=_0x2b434f-0x0;var _0x553180=_0x2bec[_0x2b434f];return _0x553180;};'use strict';var client=require('../client');exports[_0xc2be('0x0')]=function(){return function(){return client['Request'](_0xc2be('0x1'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xc2be('0x2')],'include':[{'model':_0xc2be('0x3'),'as':_0xc2be('0x4'),'attributes':['id',_0xc2be('0x5'),_0xc2be('0x6'),_0xc2be('0x7')]}]},'log':_0xc2be('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index a495e63..1ddf98b 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 _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 +var _0x4c01=['UpdateFaxQueueReport','../client','Request','CreateFaxQueueReport','update'];(function(_0x529be5,_0x20e047){var _0x50826a=function(_0x3cac56){while(--_0x3cac56){_0x529be5['push'](_0x529be5['shift']());}};_0x50826a(++_0x20e047);}(_0x4c01,0x13c));var _0x14c0=function(_0x433543,_0x54fae1){_0x433543=_0x433543-0x0;var _0x3ce2f3=_0x4c01[_0x433543];return _0x3ce2f3;};'use strict';var client=require(_0x14c0('0x0'));exports['create']=function(_0x33cf28){return client[_0x14c0('0x1')](_0x14c0('0x2'),{'body':_0x33cf28,'log':_0x14c0('0x2')});};exports[_0x14c0('0x3')]=function(_0x20f959,_0xccba62){return client[_0x14c0('0x1')]('UpdateFaxQueueReport',{'body':_0xccba62,'options':{'where':{'uniqueid':_0x20f959},'order':[['id','DESC']],'limit':0x1},'log':_0x14c0('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 9884c5c..b1005f6 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 _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 +var _0x06ef=['getIntervals','Request','name','interval'];(function(_0x47e9c2,_0x445d9d){var _0x53db04=function(_0x46180e){while(--_0x46180e){_0x47e9c2['push'](_0x47e9c2['shift']());}};_0x53db04(++_0x445d9d);}(_0x06ef,0x185));var _0xf06e=function(_0x5c8758,_0x581cf7){_0x5c8758=_0x5c8758-0x0;var _0x3b874a=_0x06ef[_0x5c8758];return _0x3b874a;};'use strict';var client=require('../client');exports['getIntervals']=function(){return function(){return client[_0xf06e('0x0')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0xf06e('0x1'),_0xf06e('0x2')]}]},'log':_0xf06e('0x3')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 376c4cc..7280da9 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 _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 +var _0x3fb5=['Request','AddTagsToMailInteraction','../client','addTags'];(function(_0x433993,_0x483f38){var _0x53eb75=function(_0x29372d){while(--_0x29372d){_0x433993['push'](_0x433993['shift']());}};_0x53eb75(++_0x483f38);}(_0x3fb5,0x1ea));var _0x53fb=function(_0x4e864f,_0x2488ec){_0x4e864f=_0x4e864f-0x0;var _0x7ca8ab=_0x3fb5[_0x4e864f];return _0x7ca8ab;};'use strict';var client=require(_0x53fb('0x0'));exports['update']=function(_0x33154d,_0x4a427c){return client['Request']('UpdateMailInteraction',{'body':_0x4a427c,'options':{'where':{'id':_0x33154d}},'log':'updateMailInteraction'});};exports[_0x53fb('0x1')]=function(_0x5757f2,_0x1e0ad3){return client[_0x53fb('0x2')](_0x53fb('0x3'),{'body':_0x1e0ad3,'options':{'where':{'id':_0x5757f2}},'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 fdb0cb9..d15876b 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 _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 +var _0x2cea=['create','Request','CreateMailMessage','createMailMessage','../client'];(function(_0x3869f6,_0x2ea2d5){var _0x536687=function(_0x335054){while(--_0x335054){_0x3869f6['push'](_0x3869f6['shift']());}};_0x536687(++_0x2ea2d5);}(_0x2cea,0x185));var _0xa2ce=function(_0x49fb87,_0x5d65bb){_0x49fb87=_0x49fb87-0x0;var _0x17db71=_0x2cea[_0x49fb87];return _0x17db71;};'use strict';var client=require(_0xa2ce('0x0'));exports[_0xa2ce('0x1')]=function(_0x49a64c){return client[_0xa2ce('0x2')](_0xa2ce('0x3'),{'body':_0x49a64c,'log':_0xa2ce('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index d1e912d..1924e17 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 _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 +var _0xdbf2=['name','User','Agents','online','mailPause','../client','getMailQueues','GetMailQueue'];(function(_0x2c00d2,_0x3b5392){var _0x4ce770=function(_0x29b4ea){while(--_0x29b4ea){_0x2c00d2['push'](_0x2c00d2['shift']());}};_0x4ce770(++_0x3b5392);}(_0xdbf2,0xed));var _0x2dbf=function(_0x154d73,_0x52a619){_0x154d73=_0x154d73-0x0;var _0x3ecd5e=_0xdbf2[_0x154d73];return _0x3ecd5e;};'use strict';var client=require(_0x2dbf('0x0'));exports[_0x2dbf('0x1')]=function(){return function(){return client['Request'](_0x2dbf('0x2'),{'options':{'raw':![],'attributes':['id',_0x2dbf('0x3'),'timeout','strategy'],'include':[{'model':_0x2dbf('0x4'),'as':_0x2dbf('0x5'),'attributes':['id',_0x2dbf('0x3'),_0x2dbf('0x6'),_0x2dbf('0x7')]}]},'log':_0x2dbf('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index d6ecd2b..ab1c8c1 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 _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 +var _0x12b0=['update','UpdateMailQueueReport','DESC','../client','create','CreateMailQueueReport'];(function(_0x1f7201,_0x141b79){var _0x289fd2=function(_0x20ce23){while(--_0x20ce23){_0x1f7201['push'](_0x1f7201['shift']());}};_0x289fd2(++_0x141b79);}(_0x12b0,0x111));var _0x012b=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x12b0[_0x40a045];return _0x1a687c;};'use strict';var client=require(_0x012b('0x0'));exports[_0x012b('0x1')]=function(_0x43b762){return client['Request']('CreateMailQueueReport',{'body':_0x43b762,'log':_0x012b('0x2')});};exports[_0x012b('0x3')]=function(_0x2c9d6b,_0x2e564e){return client['Request'](_0x012b('0x4'),{'body':_0x2e564e,'options':{'where':{'uniqueid':_0x2c9d6b},'order':[['id',_0x012b('0x5')]],'limit':0x1},'log':_0x012b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 4ef4171..54aa061 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 _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 +var _0x5cfb=['update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x465126,_0x4240d6){var _0xd92991=function(_0x57114a){while(--_0x57114a){_0x465126['push'](_0x465126['shift']());}};_0xd92991(++_0x4240d6);}(_0x5cfb,0x1e9));var _0xb5cf=function(_0x55e75c,_0x51cb2d){_0x55e75c=_0x55e75c-0x0;var _0x24f4bd=_0x5cfb[_0x55e75c];return _0x24f4bd;};'use strict';var client=require(_0xb5cf('0x0'));exports[_0xb5cf('0x1')]=function(_0x5bd5c8,_0x11bb55){return client[_0xb5cf('0x2')](_0xb5cf('0x3'),{'body':_0x11bb55,'options':{'where':{'id':_0x5bd5c8}},'log':_0xb5cf('0x4')});};exports['addTags']=function(_0x3fbda8,_0x4a3d6b){return client['Request'](_0xb5cf('0x5'),{'body':_0x4a3d6b,'options':{'where':{'id':_0x3fbda8}},'log':_0xb5cf('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 4bf70ee..0f8452d 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 _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 +var _0xf4eb=['../client','createOpenchannelMessage'];(function(_0x1fa31c,_0x1123bd){var _0x1aa48c=function(_0x34d17e){while(--_0x34d17e){_0x1fa31c['push'](_0x1fa31c['shift']());}};_0x1aa48c(++_0x1123bd);}(_0xf4eb,0xec));var _0xbf4e=function(_0x35d65a,_0xd366af){_0x35d65a=_0x35d65a-0x0;var _0x17e924=_0xf4eb[_0x35d65a];return _0x17e924;};'use strict';var client=require(_0xbf4e('0x0'));exports['create']=function(_0x50f2fc){return client['Request']('CreateOpenchannelMessage',{'body':_0x50f2fc,'log':_0xbf4e('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 26554a7..7a83a5a 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 _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 +var _0x0567=['online','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents'];(function(_0x319ca2,_0x45774a){var _0x243a33=function(_0x5c37b7){while(--_0x5c37b7){_0x319ca2['push'](_0x319ca2['shift']());}};_0x243a33(++_0x45774a);}(_0x0567,0x17e));var _0x7056=function(_0x2a37a7,_0x202763){_0x2a37a7=_0x2a37a7-0x0;var _0x3791e2=_0x0567[_0x2a37a7];return _0x3791e2;};'use strict';var client=require('../client');exports[_0x7056('0x0')]=function(){return function(){return client[_0x7056('0x1')](_0x7056('0x2'),{'options':{'raw':![],'attributes':['id',_0x7056('0x3'),_0x7056('0x4'),_0x7056('0x5')],'include':[{'model':_0x7056('0x6'),'as':_0x7056('0x7'),'attributes':['id',_0x7056('0x3'),_0x7056('0x8'),_0x7056('0x9')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 599a06e..70c795d 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 _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 +var _0x304e=['update','UpdateOpenchannelQueueReport','DESC','create','CreateOpenchannelQueueReport'];(function(_0x3b234d,_0x249d15){var _0x47788c=function(_0x13f513){while(--_0x13f513){_0x3b234d['push'](_0x3b234d['shift']());}};_0x47788c(++_0x249d15);}(_0x304e,0xf3));var _0xe304=function(_0x16ff93,_0x3b1a77){_0x16ff93=_0x16ff93-0x0;var _0x44f62a=_0x304e[_0x16ff93];return _0x44f62a;};'use strict';var client=require('../client');exports[_0xe304('0x0')]=function(_0x458b21){return client['Request']('CreateOpenchannelQueueReport',{'body':_0x458b21,'log':_0xe304('0x1')});};exports[_0xe304('0x2')]=function(_0x330fd1,_0x46b543){return client['Request'](_0xe304('0x3'),{'body':_0x46b543,'options':{'where':{'uniqueid':_0x330fd1},'order':[['id',_0xe304('0x4')]],'limit':0x1},'log':_0xe304('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index bde755b..6c993c1 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 _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 +var _0xaaab=['addTagsToSmsInteraction','../client','update','UpdateSmsInteraction','updateSmsInteraction','addTags','Request','AddTagsToSmsInteraction'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xaaab,0x121));var _0xbaaa=function(_0x724b06,_0x2b1082){_0x724b06=_0x724b06-0x0;var _0x21e9ad=_0xaaab[_0x724b06];return _0x21e9ad;};'use strict';var client=require(_0xbaaa('0x0'));exports[_0xbaaa('0x1')]=function(_0x13310b,_0x43abf2){return client['Request'](_0xbaaa('0x2'),{'body':_0x43abf2,'options':{'where':{'id':_0x13310b}},'log':_0xbaaa('0x3')});};exports[_0xbaaa('0x4')]=function(_0x42b5ac,_0x5e3fa6){return client[_0xbaaa('0x5')](_0xbaaa('0x6'),{'body':_0x5e3fa6,'options':{'where':{'id':_0x42b5ac}},'log':_0xbaaa('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 8dbb7f7..1181aa4 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 _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 +var _0xc090=['createSmsMessage','create','Request','CreateSmsMessage'];(function(_0x2b91c5,_0x3b6db5){var _0xbd5531=function(_0x54783d){while(--_0x54783d){_0x2b91c5['push'](_0x2b91c5['shift']());}};_0xbd5531(++_0x3b6db5);}(_0xc090,0x129));var _0x0c09=function(_0x44d8a1,_0x2e7674){_0x44d8a1=_0x44d8a1-0x0;var _0xc7f60c=_0xc090[_0x44d8a1];return _0xc7f60c;};'use strict';var client=require('../client');exports[_0x0c09('0x0')]=function(_0x229761){return client[_0x0c09('0x1')](_0x0c09('0x2'),{'body':_0x229761,'log':_0x0c09('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 1c89214..cc3eccc 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 _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 +var _0x121d=['name','timeout','strategy','User','Agents','online','../client','getSmsQueues','GetSmsQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x121d,0xf0));var _0xd121=function(_0x244837,_0x32e5dc){_0x244837=_0x244837-0x0;var _0x51bd5f=_0x121d[_0x244837];return _0x51bd5f;};'use strict';var client=require(_0xd121('0x0'));exports[_0xd121('0x1')]=function(){return function(){return client['Request'](_0xd121('0x2'),{'options':{'raw':![],'attributes':['id',_0xd121('0x3'),_0xd121('0x4'),_0xd121('0x5')],'include':[{'model':_0xd121('0x6'),'as':_0xd121('0x7'),'attributes':['id','name',_0xd121('0x8'),'smsPause']}]},'log':_0xd121('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 1e5bd05..b7e63a4 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 _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 +var _0x3b45=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x1bae6f,_0x558b79){var _0x11bc15=function(_0x2ccea0){while(--_0x2ccea0){_0x1bae6f['push'](_0x1bae6f['shift']());}};_0x11bc15(++_0x558b79);}(_0x3b45,0x68));var _0x53b4=function(_0x4f51af,_0x212b4d){_0x4f51af=_0x4f51af-0x0;var _0x3f79db=_0x3b45[_0x4f51af];return _0x3f79db;};'use strict';var client=require(_0x53b4('0x0'));exports[_0x53b4('0x1')]=function(_0x11d160){return client[_0x53b4('0x2')](_0x53b4('0x3'),{'body':_0x11d160,'log':'CreateSmsQueueReport'});};exports[_0x53b4('0x4')]=function(_0x2de921,_0x1bfd8e){return client[_0x53b4('0x2')](_0x53b4('0x5'),{'body':_0x1bfd8e,'options':{'where':{'uniqueid':_0x2de921},'order':[['id',_0x53b4('0x6')]],'limit':0x1},'log':_0x53b4('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 357633d..263aa50 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 _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 +var _0x5bc6=['getAgents','Request','GetUser','agent','name','online','pauseType','lastPauseAt','chatPause','mailPause','faxPause','smsPause','whatsappPause','chatCapacity','faxCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','../client'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x5bc6,0x12f));var _0x65bc=function(_0xcce8dd,_0x261b67){_0xcce8dd=_0xcce8dd-0x0;var _0x57672c=_0x5bc6[_0xcce8dd];return _0x57672c;};'use strict';var client=require(_0x65bc('0x0'));exports[_0x65bc('0x1')]=function(){return function(){return client[_0x65bc('0x2')](_0x65bc('0x3'),{'options':{'raw':!![],'where':{'role':_0x65bc('0x4')},'attributes':['id',_0x65bc('0x5'),_0x65bc('0x6'),_0x65bc('0x7'),_0x65bc('0x8'),'voicePause',_0x65bc('0x9'),_0x65bc('0xa'),_0x65bc('0xb'),_0x65bc('0xc'),_0x65bc('0xd'),'openchannelPause',_0x65bc('0xe'),'mailCapacity',_0x65bc('0xf'),_0x65bc('0x10'),_0x65bc('0x11'),_0x65bc('0x12')]},'log':'getAgents'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 16094c6..2c568c0 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 _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 +var _0x5ed2=['AddTagsToWhatsappInteraction','../client','UpdateWhatsappInteraction','updateWhatsappInteraction','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ed2,0x114));var _0x25ed=function(_0x3eb998,_0x4f5cee){_0x3eb998=_0x3eb998-0x0;var _0x272be1=_0x5ed2[_0x3eb998];return _0x272be1;};'use strict';var client=require(_0x25ed('0x0'));exports['update']=function(_0xf95d0a,_0x106489){return client['Request'](_0x25ed('0x1'),{'body':_0x106489,'options':{'where':{'id':_0xf95d0a}},'log':_0x25ed('0x2')});};exports['addTags']=function(_0x1ce8d8,_0x2e6fb6){return client[_0x25ed('0x3')](_0x25ed('0x4'),{'body':_0x2e6fb6,'options':{'where':{'id':_0x1ce8d8}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index f1708db..0ac2abf 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 _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 +var _0x0b9a=['createWhatsappMessage','create','Request'];(function(_0xc27236,_0x21b0f0){var _0x3473f1=function(_0x94f3d1){while(--_0x94f3d1){_0xc27236['push'](_0xc27236['shift']());}};_0x3473f1(++_0x21b0f0);}(_0x0b9a,0x76));var _0xa0b9=function(_0x382242,_0x33d33f){_0x382242=_0x382242-0x0;var _0x312cb4=_0x0b9a[_0x382242];return _0x312cb4;};'use strict';var client=require('../client');exports[_0xa0b9('0x0')]=function(_0x16df3a){return client[_0xa0b9('0x1')]('CreateWhatsappMessage',{'body':_0x16df3a,'log':_0xa0b9('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 8e8cd3f..efaae16 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 _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 +var _0x4f7b=['getWhatsappQueues','Request','GetWhatsappQueue','timeout','strategy','User','Agents','name','online','whatsappPause','../client'];(function(_0x2a61a8,_0x197215){var _0x1488b8=function(_0x500a62){while(--_0x500a62){_0x2a61a8['push'](_0x2a61a8['shift']());}};_0x1488b8(++_0x197215);}(_0x4f7b,0x13e));var _0xb4f7=function(_0x17bfaa,_0x5e6bf2){_0x17bfaa=_0x17bfaa-0x0;var _0x5df68c=_0x4f7b[_0x17bfaa];return _0x5df68c;};'use strict';var client=require(_0xb4f7('0x0'));exports[_0xb4f7('0x1')]=function(){return function(){return client[_0xb4f7('0x2')](_0xb4f7('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xb4f7('0x4'),_0xb4f7('0x5')],'include':[{'model':_0xb4f7('0x6'),'as':_0xb4f7('0x7'),'attributes':['id',_0xb4f7('0x8'),_0xb4f7('0x9'),_0xb4f7('0xa')]}]},'log':_0xb4f7('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 1b2b858..4aeebf8 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 _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 +var _0xd92d=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','create'];(function(_0x3fb6b2,_0x239e80){var _0x28f8b2=function(_0x41d655){while(--_0x41d655){_0x3fb6b2['push'](_0x3fb6b2['shift']());}};_0x28f8b2(++_0x239e80);}(_0xd92d,0x71));var _0xdd92=function(_0x4e44d6,_0x395d6d){_0x4e44d6=_0x4e44d6-0x0;var _0x1f328c=_0xd92d[_0x4e44d6];return _0x1f328c;};'use strict';var client=require('../client');exports[_0xdd92('0x0')]=function(_0x3b16d8){return client[_0xdd92('0x1')](_0xdd92('0x2'),{'body':_0x3b16d8,'log':_0xdd92('0x2')});};exports[_0xdd92('0x3')]=function(_0x381d3b,_0x148cb2){return client[_0xdd92('0x1')](_0xdd92('0x4'),{'body':_0x148cb2,'options':{'where':{'uniqueid':_0x381d3b},'order':[['id',_0xdd92('0x5')]],'limit':0x1},'log':_0xdd92('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 b8bf689..f7834e7 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 _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 +var _0x51e8=['[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','lodash','seq-queue','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','name','consequence','[%s][AGENT]\x20%s','message','join','stop','find','createQueue','atimeout','channel','START:%s','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','agent','error'];(function(_0x3c789a,_0x21708c){var _0x4f7bff=function(_0x6f91bf){while(--_0x6f91bf){_0x3c789a['push'](_0x3c789a['shift']());}};_0x4f7bff(++_0x21708c);}(_0x51e8,0x14d));var _0x851e=function(_0x33bcda,_0xd94d81){_0x33bcda=_0x33bcda-0x0;var _0x3ab3c8=_0x51e8[_0x33bcda];return _0x3ab3c8;};'use strict';var schema=require(_0x851e('0x0'));var _=require(_0x851e('0x1'));var util=require('util');var seqqueue=require(_0x851e('0x2'));var logger=require(_0x851e('0x3'))('routing');var strategy=require(_0x851e('0x4'));var queue=schema({'name':{'type':_0x851e('0x5'),'required':!![],'message':_0x851e('0x6')},'timeout':{'type':_0x851e('0x7'),'message':_0x851e('0x8')}});function writeLog(_0x4c82ef,_0x78dae3,_0x48f87d){return logger[_0x851e('0x9')](util[_0x851e('0xa')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x4c82ef,_0x78dae3[_0x851e('0xb')],_0x48f87d));}function handleFindAgent(_0x159acf){return function(_0x2793aa){return _0x2793aa[_0x851e('0xb')]['toLowerCase']()===_0x159acf['toLowerCase']();};}exports[_0x851e('0xc')]=function(_0x3179d1,_0xb1165e,_0x303640,_0xa99dc){return function(_0x2dcf04){try{var _0x44411f={'name':_0xb1165e[0x0],'timeout':_0xb1165e[0x1]};var _0x22b0f9=queue[_0x851e('0x0')](_0x44411f,{'typecast':!![]});if(_0x22b0f9['length']){logger['error'](_0x851e('0xd'),_0x3179d1,_['map'](_0x22b0f9,_0x851e('0xe'))[_0x851e('0xf')](',\x20'));_0x2dcf04[_0x851e('0x10')]();}else{var _0x252926=_[_0x851e('0x11')](_0x303640['agents'],handleFindAgent(_0x44411f[_0x851e('0xb')]));if(_0x252926){var _0x305769=(_0x44411f['timeout']||0xa)*0x3e8;var _0x54db37,_0x5ba105;var _0x534366=seqqueue[_0x851e('0x12')](_0x305769);_0x534366['id']=_0x3179d1;_0x534366[_0x851e('0x13')]=_0x305769;_0x534366[_0x851e('0x14')]=_0xa99dc['channel'];writeLog(_0x3179d1,_0x252926,util[_0x851e('0xa')](_0x851e('0x15'),_0x305769));_0x303640['rules'][_0x3179d1]['on']('end',function(){logger['info'](_0x851e('0x16'),_0x3179d1);clearTimeout(_0x5ba105);_0x5ba105=undefined;_0x534366[_0x851e('0x17')]();if(_0x303640['rules'][_0x3179d1]){delete _0x303640[_0x851e('0x18')][_0x3179d1];}_0x2dcf04[_0x851e('0x10')]();});_0x303640[_0x851e('0x18')][_0x3179d1]['on']('complete',function(){if(_0x303640[_0x851e('0x18')][_0x3179d1]){delete _0x303640[_0x851e('0x18')][_0x3179d1];}});_0x5ba105=setTimeout(function(){logger[_0x851e('0x9')]('[%s][AGENT]\x20ROUTING\x20END',_0x3179d1);clearTimeout(_0x5ba105);_0x534366['close']();_0x2dcf04['next']();},_0x305769);strategy[_0x851e('0x19')](_0x534366,_0x252926,_0x303640,_0xa99dc);}else{logger[_0x851e('0x1a')](_0x851e('0x1b'),_0x3179d1,_0x44411f[_0x851e('0xb')]);_0x2dcf04[_0x851e('0x10')]();}}}catch(_0x2a747a){console[_0x851e('0x1c')](_0x2a747a);logger[_0x851e('0x1a')]('[%s][QUEUE]\x20%s',_0x3179d1,_0x2a747a[_0x851e('0x1d')]);_0x2dcf04[_0x851e('0x10')]();}};}; \ 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 301fb07..8835d00 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 _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 +var _0xe2fe=['info','[%s][AMAZONLEX]\x20%s','next','account','upperFirst','AccountId','InteractionId','isEmpty','getMustacheRender','Message','create','then','catch','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','body','channel','toString','postText','error','amazonlex','Failed','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','interaction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0xee2f('0x1'));var logger=require('../../../../config/logger')(_0xee2f('0x2'));var rpc={'chatMessage':require(_0xee2f('0x3')),'openchannelMessage':require(_0xee2f('0x4')),'mailMessage':require(_0xee2f('0x5')),'smsMessage':require(_0xee2f('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xee2f('0x7'))};exports[_0xee2f('0x8')]=function(_0x49926b,_0x1533a0){return function(_0x2e1c8c){try{if(!_['isNil'](this[_0xee2f('0x9')]['UserId'])){logger[_0xee2f('0xa')](_0xee2f('0xb'),_0x49926b,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2e1c8c[_0xee2f('0xc')]();}var _0x43f451={'ContactId':this['contact']['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};var _0x2b8fb1=this['channel'];if(_0x2b8fb1==='chat'){_0x43f451['ChatWebsiteId']=this[_0xee2f('0xd')]['id'];}else{_0x43f451[_[_0xee2f('0xe')](_0x2b8fb1)+_0xee2f('0xf')]=this[_0xee2f('0xd')]['id'];}_0x43f451[_[_0xee2f('0xe')](_0x2b8fb1)+_0xee2f('0x10')]=this['interaction']['id'];if(this[_0xee2f('0x9')]['created']){var _0x36db10=_0x1533a0[0x4];if(!_[_0xee2f('0x11')](_0x36db10)){_0x43f451['body']=utils[_0xee2f('0x12')](_0x36db10,this);return rpc[_0x2b8fb1+_0xee2f('0x13')][_0xee2f('0x14')](_0x43f451)[_0xee2f('0x15')](function(_0x390c2c){logger['info'](_0xee2f('0xb'),_0x49926b,_0x43f451['body']);})[_0xee2f('0x16')](function(_0x3359ff){logger['error']('[%s][AMAZONLEX]\x20%s',_0x49926b,JSON[_0xee2f('0x17')](_0x3359ff));})['finally'](function(){logger[_0xee2f('0xa')](_0xee2f('0x18'),_0x49926b);_0x2e1c8c[_0xee2f('0x19')]();});}else{logger['info'](_0xee2f('0x1a'),_0x49926b);_0x2e1c8c[_0xee2f('0x19')]();}}else{var _0x4db2cc=this;var _0x21fdf4=new AWS[(_0xee2f('0x1b'))]({'accessKeyId':_0x1533a0[0x0],'secretAccessKey':_0x1533a0[0x1],'region':_0x1533a0[0x2]});var _0x5d36d4={'botAlias':'$LATEST','botName':_0x1533a0[0x3],'inputText':this[_0xee2f('0x1c')][_0xee2f('0x1d')],'userId':this[_0xee2f('0x1e')]+':'+this[_0xee2f('0x9')]['id'][_0xee2f('0x1f')]()};_0x21fdf4[_0xee2f('0x20')](_0x5d36d4,function(_0x39a39c,_0x4d68d3){if(_0x39a39c){logger[_0xee2f('0x21')](_0xee2f('0xb'),_0x49926b,_0x39a39c[_0xee2f('0x1c')]);_0x2e1c8c[_0xee2f('0xc')]();}else if(_0x4d68d3&&_0x4d68d3[_0xee2f('0x1c')]){_0x4db2cc[_0xee2f('0x1d')][_0xee2f('0x22')]=_0x4d68d3;_0x43f451[_0xee2f('0x1d')]=_0x4d68d3[_0xee2f('0x1c')];return rpc[_0x2b8fb1+_0xee2f('0x13')][_0xee2f('0x14')](_0x43f451)[_0xee2f('0x15')](function(_0x1c8454){logger[_0xee2f('0xa')]('[%s][AMAZONLEX]\x20%s',_0x49926b,_0x43f451['body']);if(_0x4d68d3['dialogState']==_0xee2f('0x23')){_0x2e1c8c[_0xee2f('0xc')]();}else{_0x2e1c8c[_0xee2f('0x19')]();}})[_0xee2f('0x16')](function(_0x892a4e){logger[_0xee2f('0x21')]('[%s][AMAZONLEX]\x20%s',_0x49926b,JSON[_0xee2f('0x17')](_0x892a4e));_0x2e1c8c['next']();});}else{_0x2e1c8c[_0xee2f('0xc')]();}});}}catch(_0x180429){logger[_0xee2f('0x21')](_0xee2f('0xb'),_0x49926b,JSON[_0xee2f('0x17')](_0x180429));_0x2e1c8c['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 4da82bc..4d77b47 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 _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 +var _0x9d5c=['error','[RPC][%s][AUTOREPLY]\x20%s','stringify','create','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','isNil','interaction','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','channel','getMustacheRender','contact','format','out','message','from','phone','subject','Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','Message','mail','Smtp','service','host','port','secure','authentication','user','inReplyTo','','';return mailRpc[_0xc9d5('0x2e')](_0x39f1bc,_0x41fa09)[_0xc9d5('0x2f')](function(_0xc550bc){logger['info'](_0xc9d5('0x30'),_0x34894f);_0x41fa09[_0xc9d5('0x31')]=_0xc550bc[_0xc9d5('0x15')][_0xc9d5('0x31')];return rpc[_0x16ae71+_0xc9d5('0x21')]['create'](_0x41fa09);})['then'](function(_0x27714c){logger[_0xc9d5('0xc')](_0xc9d5('0xd'),_0x34894f,JSON['stringify'](_0x27714c));})[_0xc9d5('0x32')](function(_0x947390){logger[_0xc9d5('0x33')](_0xc9d5('0x34'),_0x34894f,JSON[_0xc9d5('0x35')](_0x947390));})['finally'](function(){_0x455676[_0xc9d5('0xf')]();});}else{return rpc[this[_0xc9d5('0x10')]+_0xc9d5('0x21')][_0xc9d5('0x36')](_0x41fa09)[_0xc9d5('0x2f')](function(_0x24272c){logger[_0xc9d5('0xc')](_0xc9d5('0xd'),_0x34894f,_0x41fa09['body']);})['catch'](function(_0x3cc5aa){logger[_0xc9d5('0x33')]('[%s][AUTOREPLY]\x20%s',_0x34894f,JSON[_0xc9d5('0x35')](_0x3cc5aa));})['finally'](function(){_0x455676[_0xc9d5('0xf')]();});}}}catch(_0x895393){logger[_0xc9d5('0x33')](_0xc9d5('0xd'),_0x34894f,JSON[_0xc9d5('0x35')](_0x895393));_0x455676[_0xc9d5('0x37')]();}};}; \ 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 f4df9bf..8f48a3e 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 _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 +var _0xe260=['stringify','finally','stop','[%s][CLOSE]\x20%s','moment','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error'];(function(_0x9065f2,_0x35e146){var _0x4a35fd=function(_0x2ecb55){while(--_0x2ecb55){_0x9065f2['push'](_0x9065f2['shift']());}};_0x4a35fd(++_0x35e146);}(_0xe260,0x94));var _0x0e26=function(_0xcd9444,_0x411ed8){_0xcd9444=_0xcd9444-0x0;var _0x55105e=_0xe260[_0xcd9444];return _0x55105e;};'use strict';var moment=require(_0x0e26('0x0'));var logger=require('../../../../config/logger')(_0x0e26('0x1'));var rpc={'chatInteraction':require(_0x0e26('0x2')),'openchannelInteraction':require(_0x0e26('0x3')),'smsInteraction':require(_0x0e26('0x4')),'mailInteraction':require(_0x0e26('0x5')),'faxInteraction':require(_0x0e26('0x6')),'whatsappInteraction':require(_0x0e26('0x7'))};exports[_0x0e26('0x8')]=function(_0x141a58,_0x239f5e,_0x48cea9,_0x593669){return function(_0x15018a){try{logger[_0x0e26('0x9')](_0x0e26('0xa'),_0x141a58,_0x239f5e[0x0]);var _0x2ed98e={'closed':0x1,'closedAt':moment()[_0x0e26('0xb')](_0x0e26('0xc')),'closeReason':_0x0e26('0xd'),'disposition':_0x239f5e[0x0]};if(rpc[_0x593669['channel']+_0x0e26('0xe')]){rpc[_0x593669['channel']+_0x0e26('0xe')][_0x0e26('0xf')](_0x593669[_0x0e26('0x10')]['id'],_0x2ed98e)['then'](function(_0x5053fa){logger[_0x0e26('0x9')](_0x0e26('0x11'),_0x141a58,_0x593669['interaction']['id']);})[_0x0e26('0x12')](function(_0x6cf83e){logger[_0x0e26('0x13')]('[%s][CLOSE]\x20%s',_0x141a58,JSON[_0x0e26('0x14')](_0x6cf83e));})[_0x0e26('0x15')](function(){_0x15018a[_0x0e26('0x16')]();});}}catch(_0x3208a9){logger[_0x0e26('0x13')](_0x0e26('0x17'),_0x141a58,JSON[_0x0e26('0x14')](_0x3208a9));_0x15018a['stop']();}};}; \ 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 c9178fd..d82e9a9 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 _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 +var _0x7eda=['speech','result','metadata','endConversation','next','message','lodash','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','isNil','interaction','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','isEmpty','body','Message','create','then','[%s][DIALOGFLOW]\x20%s','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','fulfillment'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x7eda,0x1e6));var _0xa7ed=function(_0x30c14c,_0x32d8dd){_0x30c14c=_0x30c14c-0x0;var _0x2527d1=_0x7eda[_0x30c14c];return _0x2527d1;};'use strict';var _=require(_0xa7ed('0x0'));var moment=require('moment');var apiai=require('apiai-promise');var md5=require(_0xa7ed('0x1'));var utils=require('./utils');var logger=require(_0xa7ed('0x2'))(_0xa7ed('0x3'));var rpc={'chatMessage':require(_0xa7ed('0x4')),'openchannelMessage':require(_0xa7ed('0x5')),'mailMessage':require(_0xa7ed('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x36f3a6,_0x10fdcf){return function(_0x1f7eb3){try{if(!_[_0xa7ed('0x7')](this[_0xa7ed('0x8')]['UserId'])){logger[_0xa7ed('0x9')]('[%s][DIALOGFLOW]\x20%s',_0x36f3a6,_0xa7ed('0xa'));return _0x1f7eb3['next']();}var _0x390467={'ContactId':this[_0xa7ed('0xb')]['id'],'sentAt':moment()[_0xa7ed('0xc')](_0xa7ed('0xd')),'direction':'out'};var _0x41c62b=this[_0xa7ed('0xe')];if(_0x41c62b===_0xa7ed('0xf')){_0x390467[_0xa7ed('0x10')]=this[_0xa7ed('0x11')]['id'];}else{_0x390467[_[_0xa7ed('0x12')](_0x41c62b)+'AccountId']=this[_0xa7ed('0x11')]['id'];}_0x390467[_[_0xa7ed('0x12')](_0x41c62b)+_0xa7ed('0x13')]=this['interaction']['id'];if(this['interaction']['created']){var _0x188130=_0x10fdcf[0x2];if(!_[_0xa7ed('0x14')](_0x188130)){_0x390467[_0xa7ed('0x15')]=utils['getMustacheRender'](_0x188130,this);return rpc[_0x41c62b+_0xa7ed('0x16')][_0xa7ed('0x17')](_0x390467)[_0xa7ed('0x18')](function(_0x5ca8fb){logger[_0xa7ed('0x9')](_0xa7ed('0x19'),_0x36f3a6,_0x390467[_0xa7ed('0x15')]);})[_0xa7ed('0x1a')](function(_0x716034){logger[_0xa7ed('0x1b')](_0xa7ed('0x19'),_0x36f3a6,JSON[_0xa7ed('0x1c')](_0x716034));})[_0xa7ed('0x1d')](function(){logger[_0xa7ed('0x9')](_0xa7ed('0x1e'),_0x36f3a6);_0x1f7eb3[_0xa7ed('0x1f')]();});}else{logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x36f3a6);_0x1f7eb3[_0xa7ed('0x1f')]();}}else{var _0x524dcc=this;var _0x463db6=apiai(_0x10fdcf[0x0],{'language':_0x10fdcf[0x1]||'en'});return _0x463db6[_0xa7ed('0x20')](this['message'][_0xa7ed('0x15')],{'sessionId':md5(this[_0xa7ed('0x8')]['id'])})[_0xa7ed('0x18')](function(_0x2b7e7c){_0x524dcc[_0xa7ed('0x15')]['dialogflow']=_0x2b7e7c;_0x390467[_0xa7ed('0x15')]=_0x2b7e7c['result'][_0xa7ed('0x21')][_0xa7ed('0x22')];return rpc[_0x41c62b+_0xa7ed('0x16')][_0xa7ed('0x17')](_0x390467)[_0xa7ed('0x18')](function(_0x31c870){logger['info'](_0xa7ed('0x19'),_0x36f3a6,_0x390467[_0xa7ed('0x15')]);if(_0x2b7e7c[_0xa7ed('0x23')][_0xa7ed('0x24')][_0xa7ed('0x25')]){_0x1f7eb3[_0xa7ed('0x26')]();}else{_0x1f7eb3[_0xa7ed('0x1f')]();}})[_0xa7ed('0x1a')](function(_0x59c9d0){logger[_0xa7ed('0x1b')](_0xa7ed('0x19'),_0x36f3a6,JSON[_0xa7ed('0x1c')](_0x59c9d0));_0x1f7eb3['next']();});})['catch'](function(_0x1f99f3){logger[_0xa7ed('0x1b')](_0xa7ed('0x19'),_0x36f3a6,_0x1f99f3[_0xa7ed('0x27')]);_0x1f7eb3[_0xa7ed('0x26')]();});}}catch(_0x1bb6b3){logger[_0xa7ed('0x1b')](_0xa7ed('0x19'),_0x36f3a6,JSON['stringify'](_0x1bb6b3));_0x1f7eb3[_0xa7ed('0x1f')]();}};}; \ 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 2bfebfe..307c5b3 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 _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 +var _0x41cf=['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','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','html-to-text','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','error','[%s][GOTOIF]\x20%s','map','message','join','stop','priorityTrue','priorityFalse'];(function(_0x248b28,_0x775889){var _0x4d6ff5=function(_0x15bf75){while(--_0x15bf75){_0x248b28['push'](_0x248b28['shift']());}};_0x4d6ff5(++_0x775889);}(_0x41cf,0x1d8));var _0xf41c=function(_0xa8f24a,_0x48d7d3){_0xa8f24a=_0xa8f24a-0x0;var _0x3a1471=_0x41cf[_0xa8f24a];return _0x3a1471;};'use strict';var schema=require(_0xf41c('0x0'));var _=require(_0xf41c('0x1'));var htmlToText=require(_0xf41c('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xf41c('0x3'));var gotoif=schema({'condition':{'type':_0xf41c('0x4'),'required':!![],'message':_0xf41c('0x5')},'priorityTrue':{'type':_0xf41c('0x6'),'message':_0xf41c('0x7')},'priorityFalse':{'type':_0xf41c('0x6'),'message':_0xf41c('0x8')}});exports[_0xf41c('0x9')]=function(_0x3b2e06,_0x2165bb){return function(_0x1d600b){try{var _0x5ba56f={'condition':htmlToText[_0xf41c('0xa')](utils[_0xf41c('0xb')](_0x2165bb[0x0],this),{'wordwrap':![]})[_0xf41c('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2165bb[0x1],'priorityFalse':_0x2165bb[0x2]};var _0x3a32dc=gotoif[_0xf41c('0x0')](_0x5ba56f,{'typecast':!![]});if(_0x3a32dc['length']){logger[_0xf41c('0xd')](_0xf41c('0xe'),_0x3b2e06,_[_0xf41c('0xf')](_0x3a32dc,_0xf41c('0x10'))[_0xf41c('0x11')](',\x20'));_0x1d600b[_0xf41c('0x12')]();}else{try{var _0x393458=eval('('+_0x5ba56f['condition']+')');var _0x6d55d=_0x393458?_0x5ba56f[_0xf41c('0x13')]:_0x5ba56f[_0xf41c('0x14')];logger[_0xf41c('0x15')](_0xf41c('0x16'),_0x3b2e06,_0x5ba56f['condition'],_0x393458,_0x6d55d||_0xf41c('0x17'));if(_0x6d55d){var _0x77eba0=_[_0xf41c('0x18')](_0x1d600b[_0xf41c('0x19')](),{'p':_0x6d55d});if(_0x77eba0>=0x0){logger[_0xf41c('0x15')](_0xf41c('0x1a'),_0x3b2e06,_0x6d55d||_0xf41c('0x17'),_0x77eba0);_0x1d600b[_0xf41c('0x17')](_0x77eba0);}else{logger[_0xf41c('0x15')](_0xf41c('0x1b'),_0x3b2e06,_0x6d55d||'next');_0x1d600b['stop']();}}else{_0x1d600b['next']();}}catch(_0x21fcae){logger[_0xf41c('0xd')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x3b2e06,_0x21fcae[_0xf41c('0x10')]);_0x1d600b[_0xf41c('0x12')]();}}}catch(_0x2691a2){logger[_0xf41c('0xd')](_0xf41c('0xe'),_0x3b2e06,JSON[_0xf41c('0x1c')](_0x2691a2));_0x1d600b[_0xf41c('0x12')]();}};}; \ 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 d27091c..31f56fb 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 _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 +var _0x8e7e=['[%s][GOTOP]\x20%s','map','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error'];(function(_0x299cd2,_0xdac798){var _0x57c9e5=function(_0x162b51){while(--_0x162b51){_0x299cd2['push'](_0x299cd2['shift']());}};_0x57c9e5(++_0xdac798);}(_0x8e7e,0xc9));var _0xe8e7=function(_0x45cdbb,_0x2b59a9){_0x45cdbb=_0x45cdbb-0x0;var _0x3beaa1=_0x8e7e[_0x45cdbb];return _0x3beaa1;};'use strict';var schema=require('validate');var _=require(_0xe8e7('0x0'));var logger=require(_0xe8e7('0x1'))('routing');var gotop=schema({'priority':{'type':_0xe8e7('0x2'),'required':!![],'message':_0xe8e7('0x3')}});exports[_0xe8e7('0x4')]=function(_0x3ac90f,_0x263d50){return function(_0x50f922){try{var _0x498991={'priority':_0x263d50[0x0]};var _0x4b28c7=gotop[_0xe8e7('0x5')](_0x498991,{'typecast':!![]});if(_0x4b28c7[_0xe8e7('0x6')]){logger[_0xe8e7('0x7')](_0xe8e7('0x8'),_0x3ac90f,_[_0xe8e7('0x9')](_0x4b28c7,'message')[_0xe8e7('0xa')](',\x20'));_0x50f922[_0xe8e7('0xb')]();}else{logger[_0xe8e7('0xc')](_0xe8e7('0xd'),_0x3ac90f,_0x498991[_0xe8e7('0xe')]);if(_0x498991[_0xe8e7('0xe')]){var _0x2eaba7=_[_0xe8e7('0xf')](_0x50f922[_0xe8e7('0x10')](),{'p':_0x498991[_0xe8e7('0xe')]});if(_0x2eaba7>=0x0){logger[_0xe8e7('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x3ac90f,_0x498991['priority']||'next',_0x2eaba7);_0x50f922['next'](_0x2eaba7);}else{logger[_0xe8e7('0xc')](_0xe8e7('0x11'),_0x3ac90f,_0x498991[_0xe8e7('0xe')]||'next');_0x50f922[_0xe8e7('0xb')]();}}else{_0x50f922['next']();}}}catch(_0x25848e){logger[_0xe8e7('0x7')]('[%s][GOTOP]\x20%s',_0x3ac90f,JSON[_0xe8e7('0x12')](_0x25848e));_0x50f922[_0xe8e7('0xb')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 506e72f..fe31036 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 _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 +var _0x5d44=['consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage'];(function(_0x69c91e,_0x2ab08c){var _0x22cb44=function(_0x5402d8){while(--_0x5402d8){_0x69c91e['push'](_0x69c91e['shift']());}};_0x22cb44(++_0x2ab08c);}(_0x5d44,0x18e));var _0x45d4=function(_0x378544,_0xe4fc9a){_0x378544=_0x378544-0x0;var _0x5aafab=_0x5d44[_0x378544];return _0x5aafab;};'use strict';var _=require(_0x45d4('0x0'));var utils=require(_0x45d4('0x1'));var logger=require(_0x45d4('0x2'))(_0x45d4('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x45d4('0x4')),'mailMessage':require(_0x45d4('0x5')),'smsMessage':require(_0x45d4('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x45d4('0x7'))};exports[_0x45d4('0x8')]=function(_0x2d44ac,_0x599e9a){return function(_0x43e7af){try{var _0x28b4b4={'body':utils[_0x45d4('0x9')](_0x599e9a[0x0],this),'ContactId':this[_0x45d4('0xa')]['id']};if(this[_0x45d4('0xb')]===_0x45d4('0xc')){_0x28b4b4[_0x45d4('0xd')]=this[_0x45d4('0xe')]['id'];}else{_0x28b4b4[_['upperFirst'](this['channel'])+_0x45d4('0xf')]=this['account']['id'];}_0x28b4b4[_[_0x45d4('0x10')](this[_0x45d4('0xb')])+_0x45d4('0x11')]=this[_0x45d4('0x12')]['id'];if(rpc[this['channel']+'Message']){return rpc[this[_0x45d4('0xb')]+_0x45d4('0x13')][_0x45d4('0x14')](_0x28b4b4)[_0x45d4('0x15')](function(_0x156cec){logger[_0x45d4('0x16')](_0x45d4('0x17'),_0x2d44ac,_0x28b4b4[_0x45d4('0x18')]);_0x43e7af[_0x45d4('0x19')]();})['catch'](function(_0xe1de01){logger[_0x45d4('0x1a')](_0x45d4('0x17'),_0x2d44ac,JSON[_0x45d4('0x1b')](_0xe1de01));_0x43e7af['stop']();});}}catch(_0x4f2e5){logger[_0x45d4('0x1a')]('[%s][MESSAGE]\x20%s',_0x2d44ac,JSON[_0x45d4('0x1b')](_0x4f2e5));_0x43e7af[_0x45d4('0x1c')]();}};}; \ 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 f3d65b4..f0b5852 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 _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 +var _0xc0c2=['stringify','stop','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error'];(function(_0x25fded,_0x34216e){var _0x269156=function(_0x190fe0){while(--_0x190fe0){_0x25fded['push'](_0x25fded['shift']());}};_0x269156(++_0x34216e);}(_0xc0c2,0x1c5));var _0x2c0c=function(_0x1b51ea,_0x394fd9){_0x1b51ea=_0x1b51ea-0x0;var _0x18bbdc=_0xc0c2[_0x1b51ea];return _0x18bbdc;};'use strict';var utils=require(_0x2c0c('0x0'));var logger=require(_0x2c0c('0x1'))(_0x2c0c('0x2'));exports[_0x2c0c('0x3')]=function(_0x5b068a,_0x16a611){return function(_0x50bf62){try{logger[_0x2c0c('0x4')](_0x2c0c('0x5'),_0x5b068a,utils[_0x2c0c('0x6')](_0x16a611[0x0],this));_0x50bf62[_0x2c0c('0x7')]();}catch(_0x41bc5a){logger[_0x2c0c('0x8')](_0x2c0c('0x5'),_0x5b068a,JSON[_0x2c0c('0x9')](_0x41bc5a));_0x50bf62[_0x2c0c('0xa')]();}};}; \ 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 4c16c50..e0d9460 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 _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 +var _0x55ca=['../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','QueueId','interaction','channel','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','create','catch','error','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','QueueReport','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','map','join','find','Queues','createQueue','atimeout','rules','end','close','stop','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','ioredis','../../../../config/environment','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','from','joinAt','emit','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove'];(function(_0xa5a5d5,_0x15167e){var _0x4561a3=function(_0x296281){while(--_0x296281){_0xa5a5d5['push'](_0xa5a5d5['shift']());}};_0x4561a3(++_0x15167e);}(_0x55ca,0x126));var _0xa55c=function(_0x248703,_0xa58c07){_0x248703=_0x248703-0x0;var _0x12daa9=_0x55ca[_0x248703];return _0x12daa9;};'use strict';var schema=require(_0xa55c('0x0'));var _=require(_0xa55c('0x1'));var util=require('util');var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));var strategy=require(_0xa55c('0x5'));config[_0xa55c('0x6')]=_[_0xa55c('0x7')](config[_0xa55c('0x6')],{'host':_0xa55c('0x8'),'port':0x18eb});var io=require(_0xa55c('0x9'))(new Redis(config['redis']));var attributes=['id',_0xa55c('0xa'),_0xa55c('0xb'),'queue',_0xa55c('0xc'),_0xa55c('0xd')];function emit(_0x52a3bc,_0x5849ad,_0x473d0e){io['to'](_0x52a3bc)[_0xa55c('0xe')](_0x5849ad,_0x473d0e);}function emitChannelQueueInteraction(_0x381d07,_0x5d8e5a,_0x31646d,_0xe6d826,_0x508342,_0x70c2de,_0x3998f7,_0x15eec8){var _0x5d47ff=_['clone'](_0x31646d);_0x5d47ff[_0xa55c('0xa')]=_0x15eec8;_0x5d47ff['queue']=_0x5d8e5a;_0x5d47ff['account']=_0xe6d826;_0x5d47ff['id']=_0x508342;if(_0x70c2de){_0x3998f7[util['format'](_0xa55c('0xf'),_0x381d07)][_0x508342]=_[_0xa55c('0x10')](_0x5d47ff,attributes);}else{delete _0x3998f7[util[_0xa55c('0x11')](_0xa55c('0xf'),_0x381d07)][_0x508342];}emit(util[_0xa55c('0x11')](_0xa55c('0x12'),_0x381d07,_0x5d8e5a),util['format'](_0xa55c('0x13'),_0x381d07,_0x70c2de?_0xa55c('0x14'):_0xa55c('0x15')),_[_0xa55c('0x10')](_0x5d47ff,attributes));}var rpc={'openchannelQueueReport':require(_0xa55c('0x16')),'mailQueueReport':require(_0xa55c('0x17')),'chatQueueReport':require(_0xa55c('0x18')),'smsQueueReport':require(_0xa55c('0x19')),'faxQueueReport':require(_0xa55c('0x1a')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xa55c('0x1b'),'required':!![],'message':_0xa55c('0x1c')},'timeout':{'type':_0xa55c('0x1d'),'message':_0xa55c('0x1e')}});function startRouting(_0x23a1ae,_0x5426e5,_0x4c0daf,_0x5f5158){if(_0x23a1ae&&_0x5426e5&&_0x4c0daf){_0x5426e5[_0xa55c('0x1f')]+=0x1;var _0x3776ac={'uniqueid':_0x23a1ae,'from':_0x4c0daf[_0xa55c('0x20')]?_0x4c0daf['body'][_0xa55c('0xc')]:'','joinAt':moment()[_0xa55c('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4c0daf[_0xa55c('0x21')]?_0x4c0daf[_0xa55c('0x21')]['id']:null,'ListId':_0x4c0daf[_0xa55c('0x22')]?_0x4c0daf[_0xa55c('0x22')]['id']:null};_0x3776ac[_[_0xa55c('0x23')](_0x4c0daf['channel'])+_0xa55c('0x24')]=_0x5426e5['id']||null;_0x3776ac[_['upperFirst'](_0x4c0daf['channel'])+'InteractionId']=_0x4c0daf[_0xa55c('0x25')]?_0x4c0daf['interaction']['id']:null;_0x3776ac[_[_0xa55c('0x23')](_0x4c0daf[_0xa55c('0x26')])+_0xa55c('0x27')]=_0x4c0daf[_0xa55c('0x28')]?_0x4c0daf[_0xa55c('0x28')]['id']:null;_0x3776ac[_[_0xa55c('0x23')](_0x4c0daf[_0xa55c('0x26')])+(_0x4c0daf[_0xa55c('0x26')]!==_0xa55c('0x29')?_0xa55c('0x2a'):_0xa55c('0x2b'))]=_0x4c0daf['account']?_0x4c0daf[_0xa55c('0xb')]['id']:null;logger[_0xa55c('0x2c')](util[_0xa55c('0x11')](_0xa55c('0x2d'),_0x23a1ae,_0x5426e5['name']));emitChannelQueueInteraction(_0x4c0daf[_0xa55c('0x26')],_0x5426e5[_0xa55c('0x2e')],_0x3776ac,_0x4c0daf[_0xa55c('0xb')][_0xa55c('0x2e')],_0x4c0daf[_0xa55c('0x28')]['id'],!![],_0x5f5158,_0x5426e5['id']);if(rpc[_0x4c0daf[_0xa55c('0x26')]+'QueueReport']){return rpc[_0x4c0daf[_0xa55c('0x26')]+'QueueReport'][_0xa55c('0x2f')](_0x3776ac)[_0xa55c('0x30')](function(_0x1cc53e){logger[_0xa55c('0x31')]('create\x20queue\x20report');});}}}function stopRouting(_0x3d28fb,_0x2096ae,_0x331e58,_0x20da31){if(_0x3d28fb&&_0x2096ae){_0x2096ae[_0xa55c('0x1f')]-=0x1;var _0x1225c3={'leaveAt':moment()[_0xa55c('0x11')](_0xa55c('0x32')),'acceptAt':moment()[_0xa55c('0x11')](_0xa55c('0x32')),'reason':_0xa55c('0x33')};logger['info'](util['format'](_0xa55c('0x34'),_0x3d28fb,_0x2096ae[_0xa55c('0x2e')]));emitChannelQueueInteraction(_0x331e58['channel'],_0x2096ae[_0xa55c('0x2e')],_0x331e58[_0xa55c('0x20')],_0x331e58[_0xa55c('0xb')][_0xa55c('0x2e')],_0x331e58[_0xa55c('0x28')]['id'],![],_0x20da31,_0x2096ae['id']);if(rpc[_0x331e58[_0xa55c('0x26')]+_0xa55c('0x35')]){return rpc[_0x331e58[_0xa55c('0x26')]+_0xa55c('0x35')]['update'](_0x3d28fb,_0x1225c3)['catch'](function(_0x4b23d3){logger[_0xa55c('0x31')](_0xa55c('0x36'));});}}}function endRouting(_0x2bb4f0,_0x5802e4,_0x768408,_0x547930){if(_0x2bb4f0&&_0x5802e4){_0x5802e4[_0xa55c('0x1f')]-=0x1;var _0x4ad813={'leaveAt':moment()[_0xa55c('0x11')](_0xa55c('0x32')),'exitAt':moment()[_0xa55c('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xa55c('0x37')};logger[_0xa55c('0x2c')](util['format'](_0xa55c('0x38'),_0x2bb4f0,_0x5802e4[_0xa55c('0x2e')]));emitChannelQueueInteraction(_0x768408['channel'],_0x5802e4['name'],_0x768408[_0xa55c('0x20')],_0x768408['account'][_0xa55c('0x2e')],_0x768408[_0xa55c('0x28')]['id'],![],_0x547930);if(rpc[_0x768408['channel']+'QueueReport']){return rpc[_0x768408['channel']+'QueueReport'][_0xa55c('0x39')](_0x2bb4f0,_0x4ad813)[_0xa55c('0x30')](function(_0x429336){logger[_0xa55c('0x31')](_0xa55c('0x36'));});}}}function handleFindQueue(_0x56d17c){return function(_0x3d52d8){return _0x3d52d8[_0xa55c('0x2e')][_0xa55c('0x3a')]()===_0x56d17c[_0xa55c('0x3a')]();};}exports[_0xa55c('0x3b')]=function(_0x23cef5,_0x554620,_0x386e34,_0x5ee63d){return function(_0x57a972){try{var _0x404e7f={'name':_0x554620[0x0],'timeout':_0x554620[0x1]};var _0x1f63d8=queue['validate'](_0x404e7f,{'typecast':!![]});if(_0x1f63d8[_0xa55c('0x3c')]){logger['error']('[%s][QUEUE]\x20%s',_0x23cef5,_[_0xa55c('0x3d')](_0x1f63d8,_0xa55c('0x28'))[_0xa55c('0x3e')](',\x20'));_0x57a972['stop']();}else{var _0x1b2708=_[_0xa55c('0x3f')](_0x386e34[_0x5ee63d['channel']+_0xa55c('0x40')],handleFindQueue(_0x404e7f['name']));if(_0x1b2708){startRouting(_0x23cef5,_0x1b2708,_0x5ee63d,_0x386e34);var _0x39886a=(_0x1b2708[_0xa55c('0x37')]||0xa)*0x3e8;var _0x5be43f=(_0x404e7f[_0xa55c('0x37')]||0x14)*0x3e8;var _0x1dae70,_0x5d834d;if(_0x39886a>_0x5be43f){_0x5be43f=_0x39886a;}var _0x40c352=seqqueue[_0xa55c('0x41')](_0x39886a);_0x40c352['id']=_0x23cef5;_0x40c352[_0xa55c('0x42')]=_0x39886a;_0x40c352['qtimeout']=_0x5be43f;_0x40c352[_0xa55c('0x26')]=_0x5ee63d['channel'];_0x386e34[_0xa55c('0x43')][_0x23cef5]['on'](_0xa55c('0x44'),function(){logger[_0xa55c('0x2c')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x23cef5);stopRouting(_0x23cef5,_0x1b2708,_0x5ee63d,_0x386e34);clearTimeout(_0x1dae70);_0x1dae70=undefined;_0x40c352[_0xa55c('0x45')](!![]);if(_0x386e34[_0xa55c('0x43')][_0x23cef5]){delete _0x386e34['rules'][_0x23cef5];}_0x57a972[_0xa55c('0x46')]();});_0x386e34[_0xa55c('0x43')][_0x23cef5]['on']('complete',function(){if(_0x386e34[_0xa55c('0x43')][_0x23cef5]){delete _0x386e34[_0xa55c('0x43')][_0x23cef5];}});_0x1dae70=setTimeout(function(){logger['info'](_0xa55c('0x47'),_0x23cef5);endRouting(_0x23cef5,_0x1b2708,_0x5ee63d,_0x386e34);clearTimeout(_0x1dae70);_0x40c352[_0xa55c('0x45')](!![]);_0x57a972[_0xa55c('0x48')]();},_0x5be43f);switch(_0x1b2708[_0xa55c('0x49')]){case'rrmemory':strategy[_0xa55c('0x4a')](_0x40c352,_0x1b2708,_0x386e34,_0x5ee63d);break;default:strategy['beepall'](_0x40c352,_0x1b2708,_0x386e34,_0x5ee63d);}}else{logger[_0xa55c('0x31')](_0xa55c('0x4b'),_0x23cef5,_0x404e7f[_0xa55c('0x2e')]);_0x57a972['stop']();}}}catch(_0x39bd3d){console[_0xa55c('0x4c')](_0x39bd3d);logger['error'](_0xa55c('0x4d'),_0x23cef5,_0x39bd3d[_0xa55c('0x4e')]);_0x57a972[_0xa55c('0x46')]();}};}; \ 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 5eb16b3..edc3a5d 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 _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 +var _0x5f3a=['push','handleRun','bind','timeout','handleTimeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','realtime','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','agents','busy','writeLog','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','busyQueue','STOP','TIMEOUT','lodash','uuid','./util','notificationId','squeue','agent','routing'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x5f3a,0x16d));var _0xa5f3=function(_0x3f4bc1,_0x15ace5){_0x3f4bc1=_0x3f4bc1-0x0;var _0x46fcf6=_0x5f3a[_0x3f4bc1];return _0x46fcf6;};'use strict';var _=require(_0xa5f3('0x0'));var uuid=require(_0xa5f3('0x1'));var util=require(_0xa5f3('0x2'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0x370387,_0x285ad6,_0x28476a,_0x23ed55){this[_0xa5f3('0x3')]=uuid['v4']();this[_0xa5f3('0x4')]=_0x370387;this[_0xa5f3('0x5')]=_0x285ad6;this['realtime']=_0x28476a;this[_0xa5f3('0x6')]=_0x23ed55;this[_0xa5f3('0x4')][_0xa5f3('0x7')](this[_0xa5f3('0x8')]['bind'](this),this['handleTimeout'][_0xa5f3('0x9')](this));this[_0xa5f3('0x4')]['on'](_0xa5f3('0xa'),this[_0xa5f3('0xb')]['bind'](this));this['squeue']['on'](_0xa5f3('0xc'),this[_0xa5f3('0xd')][_0xa5f3('0x9')](this));};Agent[_0xa5f3('0xe')][_0xa5f3('0x7')]=function(){this[_0xa5f3('0x4')][_0xa5f3('0x7')](this['handleRun']['bind'](this),this['handleTimeout'][_0xa5f3('0x9')](this));};Agent[_0xa5f3('0xe')][_0xa5f3('0xd')]=function(){this[_0xa5f3('0xb')](!![]);};Agent['prototype'][_0xa5f3('0x8')]=function(_0x3fb7c9){logger[_0xa5f3('0xf')](_0xa5f3('0x10'),this[_0xa5f3('0x4')]['id'],this[_0xa5f3('0x5')]['id']);if(_['isNil'](this[_0xa5f3('0x11')]['agents'][this[_0xa5f3('0x5')]['id']])){logger['info'](_0xa5f3('0x12'),this[_0xa5f3('0x4')]['id'],this['agent']['id']);setTimeout(this[_0xa5f3('0x7')]['bind'](this),0x3e8);}else{if(this[_0xa5f3('0x6')]['forcedOwnership']||util['isAgentAvailable'](this[_0xa5f3('0x4')]['id'],this[_0xa5f3('0x11')][_0xa5f3('0x13')][this[_0xa5f3('0x5')]['id']],this['squeue']['channel'],![])){this[_0xa5f3('0x11')][_0xa5f3('0x13')][this['agent']['id']][_0xa5f3('0x14')]=!![];this[_0xa5f3('0x11')]['agents'][this[_0xa5f3('0x5')]['id']]['busyQueue']=undefined;util['showNotification'](this['notificationId'],this[_0xa5f3('0x4')]['id'],this[_0xa5f3('0x11')][_0xa5f3('0x13')][this['agent']['id']],null,this['routing']);util[_0xa5f3('0x15')](this[_0xa5f3('0x4')]['id'],this['realtime']['agents'][this[_0xa5f3('0x5')]['id']],_0xa5f3('0x16')+(this[_0xa5f3('0x6')][_0xa5f3('0x17')]?_0xa5f3('0x18'):''));}else{logger[_0xa5f3('0xf')](_0xa5f3('0x19'),this['squeue']['id'],this['agent']['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent['prototype'][_0xa5f3('0xb')]=function(_0x16f382){if(_[_0xa5f3('0x1a')](this['realtime'][_0xa5f3('0x13')][this['agent']['id']])){return logger[_0xa5f3('0xf')](_0xa5f3('0x12'),this['squeue']['id'],this[_0xa5f3('0x5')]['id']);}else{logger[_0xa5f3('0xf')](_0xa5f3('0x1b'),this['squeue']['id'],this[_0xa5f3('0x5')]['id']);util['hideNotification'](this[_0xa5f3('0x3')],this['squeue']['id'],this[_0xa5f3('0x11')][_0xa5f3('0x13')][this[_0xa5f3('0x5')]['id']],null,this[_0xa5f3('0x6')]);this[_0xa5f3('0x11')]['agents'][this['agent']['id']][_0xa5f3('0x14')]=![];this[_0xa5f3('0x11')]['agents'][this[_0xa5f3('0x5')]['id']][_0xa5f3('0x1c')]=undefined;util[_0xa5f3('0x15')](this['squeue']['id'],this[_0xa5f3('0x11')][_0xa5f3('0x13')][this[_0xa5f3('0x5')]['id']],_0x16f382?_0xa5f3('0x1d'):_0xa5f3('0x1e'));}if(!_0x16f382){setTimeout(this['push'][_0xa5f3('0x9')](this),0x3e8);}};function agent(_0x25f3d9,_0x463a7d,_0x21d6dd,_0x3d6f68){return new Agent(_0x25f3d9,_0x463a7d,_0x21d6dd,_0x3d6f68);}module['exports']=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 811bdbc..b8a3881 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 _0xf35e=['RINGING','busy','busyQueue','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','TIMEOUT','exports','lodash','uuid','../../../../../config/logger','routing','notificationId','queue','realtime','squeue','push','handleRun','bind','handleTimeout','timeout','drained','prototype','handleDrained','isNil','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog'];(function(_0xa6435a,_0x4e06a5){var _0x20c111=function(_0x2890d0){while(--_0x2890d0){_0xa6435a['push'](_0xa6435a['shift']());}};_0x20c111(++_0x4e06a5);}(_0xf35e,0x8c));var _0xef35=function(_0x5772d6,_0x1ca561){_0x5772d6=_0x5772d6-0x0;var _0x5ec6f6=_0xf35e[_0x5772d6];return _0x5ec6f6;};'use strict';var _=require(_0xef35('0x0'));var uuid=require(_0xef35('0x1'));var util=require('./util');var logger=require(_0xef35('0x2'))(_0xef35('0x3'));var Beepall=function(_0x53bfb1,_0x392b27,_0x15fe99,_0x4d0847){this[_0xef35('0x4')]=uuid['v4']();this['squeue']=_0x53bfb1;this[_0xef35('0x5')]=_0x392b27;this[_0xef35('0x6')]=_0x15fe99;this['routing']=_0x4d0847;this[_0xef35('0x7')][_0xef35('0x8')](this[_0xef35('0x9')][_0xef35('0xa')](this),this[_0xef35('0xb')][_0xef35('0xa')](this));this[_0xef35('0x7')]['on'](_0xef35('0xc'),this[_0xef35('0xb')][_0xef35('0xa')](this));this[_0xef35('0x7')]['on'](_0xef35('0xd'),this['handleDrained'][_0xef35('0xa')](this));};Beepall['prototype'][_0xef35('0x8')]=function(){this[_0xef35('0x7')][_0xef35('0x8')](this[_0xef35('0x9')][_0xef35('0xa')](this),this[_0xef35('0xb')][_0xef35('0xa')](this));};Beepall[_0xef35('0xe')][_0xef35('0xf')]=function(_0x313f77){this[_0xef35('0xb')](!![]);};Beepall[_0xef35('0xe')][_0xef35('0x9')]=function(_0x9ed2e9){var _0x15404b=!![];if(!_[_0xef35('0x10')](this['queue'])&&!_[_0xef35('0x10')](this[_0xef35('0x5')][_0xef35('0x11')])&&this[_0xef35('0x5')][_0xef35('0x11')][_0xef35('0x12')]>0x0){for(var _0xa1ddfc=0x0,_0x27de2b;_0xa1ddfc0x0){for(var _0x1acd77=0x0,_0x343283;_0x1acd770x0&&_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 +var _0xe9e2=['PAUSE','CurrentCapacity','Capacity','toUpperCase','showNotification','writeLog','lodash','util','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','format','user:%s','name','user:save','split','\x20interaction','notificationSound','account','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','[%s][QUEUE]\x20%s','emit','notification:%s','save','remove','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','online','OFFLINE','Pause'];(function(_0x54e1e3,_0x4fb1f7){var _0x152798=function(_0x3b8963){while(--_0x3b8963){_0x54e1e3['push'](_0x54e1e3['shift']());}};_0x152798(++_0x4fb1f7);}(_0xe9e2,0x13a));var _0x2e9e=function(_0x27ed41,_0xb780a1){_0x27ed41=_0x27ed41-0x0;var _0x507934=_0xe9e2[_0x27ed41];return _0x507934;};'use strict';var _=require(_0x2e9e('0x0'));var util=require(_0x2e9e('0x1'));var utils=require(_0x2e9e('0x2'));var Mustache=require(_0x2e9e('0x3'));var Redis=require(_0x2e9e('0x4'));var config=require(_0x2e9e('0x5'));var logger=require(_0x2e9e('0x6'))(_0x2e9e('0x7'));config[_0x2e9e('0x8')]=_[_0x2e9e('0x9')](config['redis'],{'host':_0x2e9e('0xa'),'port':0x18eb});var io=require(_0x2e9e('0xb'))(new Redis(config['redis']));function emit(_0x217435,_0x22a519,_0x1e70c0){io['to'](_0x217435)['emit'](_0x22a519,_0x1e70c0);}function sendNotification(_0xbfc54,_0x6e6201,_0x24b38a,_0x55691f,_0x3535e9,_0x449ede){io['to'](util[_0x2e9e('0xc')](_0x2e9e('0xd'),_0x55691f[_0x2e9e('0xe')]))['emit'](_0x2e9e('0xf'),_0x55691f);var _0x2ee845=_0x449ede||{};var _0x1b8302=_0x24b38a[_0x2e9e('0x10')]('.');var _0x558a38={'uniqueid':_0x6e6201,'channel':_0x1b8302[0x0],'id':_0x1b8302[0x1],'title':_0x1b8302[0x0]+_0x2e9e('0x11'),'interactionId':_0x1b8302[0x2],'queue':_0x3535e9?_0x3535e9[_0x2e9e('0xe')]:null,'sound':_0x2ee845['account'][_0x2e9e('0x12')],'shake':_0x2ee845[_0x2e9e('0x13')][_0x2e9e('0x14')]};try{if(!_0x2ee845[_0x2e9e('0x15')]){_0x2ee845['body']={};}if(_0x3535e9){_0x2ee845[_0x2e9e('0x15')][_0x2e9e('0x16')]=_0x3535e9;}else if(_0x2ee845[_0x2e9e('0x15')][_0x2e9e('0x16')]){delete _0x2ee845[_0x2e9e('0x15')]['queue'];}_0x558a38[_0x2e9e('0x17')]=utils[_0x2e9e('0x18')](_0x2ee845['account'][_0x2e9e('0x19')],_0x2ee845);}catch(_0x523c01){_0x558a38[_0x2e9e('0x17')]=_0x2e9e('0x1a');logger['error'](util[_0x2e9e('0xc')](_0x2e9e('0x1b'),_0x6e6201,_0x523c01['message']));}io['to'](util['format']('user:%s',_0x55691f[_0x2e9e('0xe')]))[_0x2e9e('0x1c')](util[_0x2e9e('0xc')](_0x2e9e('0x1d'),_0xbfc54?_0x2e9e('0x1e'):_0x2e9e('0x1f')),_0x558a38);}function writeLog(_0x5284c9,_0x21f7f4,_0x18b5ac){return logger['info'](util[_0x2e9e('0xc')](_0x2e9e('0x20'),_0x5284c9,_0x21f7f4[_0x2e9e('0xe')],_0x18b5ac));}exports[_0x2e9e('0x21')]=function(_0x11cd44,_0x81239b,_0x23208a,_0x4b51ce){if(_0x81239b[_0x2e9e('0x22')]){writeLog(_0x11cd44,_0x81239b,'BUSY');return![];}if(!_0x81239b[_0x2e9e('0x23')]){writeLog(_0x11cd44,_0x81239b,_0x2e9e('0x24'));return![];}if(_0x81239b[_0x23208a+_0x2e9e('0x25')]){writeLog(_0x11cd44,_0x81239b,_0x2e9e('0x26'));return![];}if(_0x4b51ce&&_0x81239b['hasOwnProperty'](_0x23208a+'Capacity')&&_0x81239b['hasOwnProperty'](_0x23208a+_0x2e9e('0x27'))){if(_0x81239b[_0x23208a+_0x2e9e('0x28')]>0x0&&_0x81239b[_0x23208a+_0x2e9e('0x27')]>=_0x81239b[_0x23208a+_0x2e9e('0x28')]){writeLog(_0x11cd44,_0x81239b,_0x23208a[_0x2e9e('0x29')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x2e9e('0x2a')]=function(_0x428f98,_0x35ee53,_0x4dea06,_0x251ea0,_0x42699c){return sendNotification(!![],_0x428f98,_0x35ee53,_0x4dea06,_0x251ea0,_0x42699c);};exports['hideNotification']=function(_0x5446ad,_0xde4011,_0x2b03c4,_0x1ea440,_0x3ea986){return sendNotification(![],_0x5446ad,_0xde4011,_0x2b03c4,_0x1ea440,_0x3ea986);};exports[_0x2e9e('0x2b')]=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 8abd8b0..73cfbde 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 _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 +var _0x7068=['consequence','length','error','[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','validate','shelljs','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7068,0x18b));var _0x8706=function(_0x10df1e,_0xf56f85){_0x10df1e=_0x10df1e-0x0;var _0x3e24fb=_0x7068[_0x10df1e];return _0x3e24fb;};'use strict';var schema=require(_0x8706('0x0'));var sh=require(_0x8706('0x1'));var _=require('lodash');var utils=require('./utils');var logger=require('../../../../config/logger')(_0x8706('0x2'));var system=schema({'command':{'type':_0x8706('0x3'),'required':!![],'message':_0x8706('0x4')}});exports[_0x8706('0x5')]=function(_0x2895b9,_0x1c4205){return function(_0x45775b){try{var _0xbba957={'command':_0x1c4205[0x0]};var _0x198a9d=system[_0x8706('0x0')](_0xbba957,{'typecast':!![]});if(_0x198a9d[_0x8706('0x6')]){logger[_0x8706('0x7')](_0x8706('0x8'),_0x2895b9,_[_0x8706('0x9')](_0x198a9d,'message')[_0x8706('0xa')](',\x20'));logger[_0x8706('0xb')](_0x8706('0xc'),_0x2895b9);_0x45775b[_0x8706('0xd')]();}else{var _0x14034e=this;var _0x477fde=utils[_0x8706('0xe')](_0x1c4205[0x0],this);logger[_0x8706('0xb')](_0x8706('0xf'),_0x2895b9,_0x477fde);sh[_0x8706('0x10')](_[_0x8706('0x11')](_0x477fde),function(_0x1dc386,_0x26739b){logger[_0x8706('0xb')](_0x8706('0x12'),_0x2895b9,_0x1dc386);if(_0x1dc386==0x0){var _0x240010=_0x26739b[_0x8706('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0x8706('0x14')](_0x1c4205[0x1])||_[_0x8706('0x15')](_0x1c4205[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0x2895b9);_0x14034e[_0x8706('0x16')][_0x1c4205[0x1]]=_0x240010;}else{logger[_0x8706('0xb')](_0x8706('0x17'),_0x2895b9,_0x1c4205[0x1],_0x240010);_0x14034e[_0x8706('0x16')][_0x1c4205[0x1]]=_0x240010;}}_0x45775b['next']();});}}catch(_0x56a77b){logger[_0x8706('0x7')](_0x8706('0x8'),_0x2895b9,_[_0x8706('0x18')](_0x56a77b)?JSON['stringify'](_0x56a77b):_0x56a77b);logger[_0x8706('0xb')](_0x8706('0xc'),_0x2895b9);_0x45775b[_0x8706('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 3b0ad0c..9ee8c1a 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 _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 +var _0x713a=['info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','catch','finally','isObject','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][TAG]\x20%s','map','message','join'];(function(_0x19dd32,_0x5b5417){var _0x501852=function(_0x2c04d5){while(--_0x2c04d5){_0x19dd32['push'](_0x19dd32['shift']());}};_0x501852(++_0x5b5417);}(_0x713a,0x1bc));var _0xa713=function(_0x5166bc,_0x359710){_0x5166bc=_0x5166bc-0x0;var _0x27684d=_0x713a[_0x5166bc];return _0x27684d;};'use strict';var schema=require(_0xa713('0x0'));var _=require(_0xa713('0x1'));var rpc={'chatInteraction':require(_0xa713('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xa713('0x3')),'faxInteraction':require(_0xa713('0x4')),'whatsappInteraction':require(_0xa713('0x5'))};var logger=require(_0xa713('0x6'))(_0xa713('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0xa713('0x8')}});exports[_0xa713('0x9')]=function(_0x100e28,_0x3fb240,_0x503345,_0x10b588){return function(_0x400dd9){try{var _0x145b86={'tag':_0x3fb240[0x0]};var _0x52e3c1=tag[_0xa713('0x0')](_0x145b86,{'typecast':!![]});if(_0x52e3c1['length']){logger[_0xa713('0xa')](_0xa713('0xb'),_0x100e28,_[_0xa713('0xc')](_0x52e3c1,_0xa713('0xd'))[_0xa713('0xe')](',\x20'));logger[_0xa713('0xf')](_0xa713('0x10'),_0x100e28);_0x400dd9[_0xa713('0x11')]();}else{var _0x39867f={'ids':[_0x3fb240[0x0]]};if(rpc[_0x10b588[_0xa713('0x12')]+_0xa713('0x13')]){rpc[_0x10b588[_0xa713('0x12')]+'Interaction'][_0xa713('0x14')](_0x10b588[_0xa713('0x15')]['id'],_0x39867f)[_0xa713('0x16')](function(_0x1b8c38){logger[_0xa713('0xf')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x100e28,_0x3fb240[0x1],_0x10b588[_0xa713('0x12')],_0x10b588['interaction']['id']);})[_0xa713('0x17')](function(_0xb11c80){logger['error']('[%s][TAG]\x20%s',_0x100e28,JSON['stringify'](_0xb11c80));logger[_0xa713('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x100e28);})[_0xa713('0x18')](function(){_0x400dd9[_0xa713('0x11')]();});}}}catch(_0x3d9598){logger['error'](_0xa713('0xb'),_0x100e28,_[_0xa713('0x19')](_0x3d9598)?JSON[_0xa713('0x1a')](_0x3d9598):_0x3d9598);logger[_0xa713('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x100e28);_0x400dd9['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 880ba82..419c11f 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 _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 +var _0xad95=['exports','render','merge','message','mustache','lodash'];(function(_0x1344d6,_0x2181e6){var _0xf45b24=function(_0x2d90c1){while(--_0x2d90c1){_0x1344d6['push'](_0x1344d6['shift']());}};_0xf45b24(++_0x2181e6);}(_0xad95,0x70));var _0x5ad9=function(_0x5ea0b4,_0x5396a4){_0x5ea0b4=_0x5ea0b4-0x0;var _0x3e89bd=_0xad95[_0x5ea0b4];return _0x3e89bd;};'use strict';var Mustache=require(_0x5ad9('0x0'));var _=require(_0x5ad9('0x1'));module[_0x5ad9('0x2')]={'getMustacheRender':function(_0x51c14c,_0x52ad89){return Mustache[_0x5ad9('0x3')](_0x51c14c,_[_0x5ad9('0x4')](_0x52ad89['body'],{'contact':_0x52ad89['contact'],'message':_0x52ad89[_0x5ad9('0x5')],'account':_0x52ad89['account'],'interaction':_0x52ad89['interaction'],'list':_0x52ad89['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 3ac4a70..3ca7eb7 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 _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 +var _0xccc1=['stringify','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/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','rules','message','interaction','isArray','applications','length','existsSync','app','toLowerCase','autoreply','appdata','split','push','slice','join','dialogflow','amazonlex','tag','TagId','format','%s:%s:%s','condition','intervals','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','.js','Applications\x20executed','emit','complete','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','channel','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','loggedIn','paused','waiting','mailQueues','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http'];(function(_0xf34484,_0x3b3953){var _0x3c2851=function(_0x2b45dc){while(--_0x2b45dc){_0xf34484['push'](_0xf34484['shift']());}};_0x3c2851(++_0x3b3953);}(_0xccc1,0x65));var _0x1ccc=function(_0x4070fe,_0x4f253b){_0x4070fe=_0x4070fe-0x0;var _0x430c8b=_0xccc1[_0x4070fe];return _0x430c8b;};'use strict';var _=require(_0x1ccc('0x0'));var util=require(_0x1ccc('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x1ccc('0x2'));var BPromise=require(_0x1ccc('0x3'));var uuid=require(_0x1ccc('0x4'));var config=require(_0x1ccc('0x5'));var logger=require(_0x1ccc('0x6'))(_0x1ccc('0x7'));var rpc={'openchannelQueueReport':require(_0x1ccc('0x8')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x1ccc('0x9')),'smsQueueReport':require(_0x1ccc('0xa')),'faxQueueReport':require(_0x1ccc('0xb')),'whatsappQueueReport':require(_0x1ccc('0xc'))};var RuleEngine=require(_0x1ccc('0xd'));function getId(_0x339c00,_0x4df419,_0x521746){return util['format'](_0x1ccc('0xe'),_0x339c00,_0x4df419||0x0,_0x521746||0x0);}function getIntervals(_0x2fdec7,_0x33bf8b){var _0x3df3ed=[];if(!_[_0x1ccc('0xf')](_0x33bf8b[_0x1ccc('0x10')])&&!_['isNil'](_0x2fdec7[_0x33bf8b[_0x1ccc('0x10')]])&&!_[_0x1ccc('0xf')](_0x2fdec7[_0x33bf8b[_0x1ccc('0x10')]][_0x1ccc('0x11')])){_0x3df3ed=_['map'](_0x2fdec7[_0x33bf8b[_0x1ccc('0x10')]][_0x1ccc('0x11')],_0x1ccc('0x12'));}else if(!_[_0x1ccc('0xf')](_0x33bf8b[_0x1ccc('0x12')])){_0x3df3ed=[_0x33bf8b[_0x1ccc('0x12')]];}return _0x3df3ed;}exports[_0x1ccc('0x13')]=function(_0x383278){_0x383278[_0x1ccc('0x14')]={};return new BPromise(function(_0x1e14d3,_0x11a69f){var _0x2f456b={'Start':function(_0x1eb940){var _0x340b6d=this;return new Promise(function(_0x1372ce,_0x331b52){if(_0x1eb940){try{var _0x29fff8=[];var _0x41b4bd=getId(_0x1eb940['channel'],_0x1eb940[_0x1ccc('0x15')]?_0x1eb940[_0x1ccc('0x15')]['id']:0x0,_0x1eb940[_0x1ccc('0x16')]?_0x1eb940[_0x1ccc('0x16')]['id']:0x0);if(_0x1eb940['applications']&&_[_0x1ccc('0x17')](_0x1eb940[_0x1ccc('0x18')])&&_0x1eb940[_0x1ccc('0x18')][_0x1ccc('0x19')]){for(var _0x841c1a=0x0;_0x841c1a<_0x1eb940[_0x1ccc('0x18')][_0x1ccc('0x19')];_0x841c1a+=0x1){var _0x808b5c=_0x1eb940[_0x1ccc('0x18')][_0x841c1a];if(fs[_0x1ccc('0x1a')](path['join'](__dirname,_0x1ccc('0x18'),_0x808b5c[_0x1ccc('0x1b')]+'.js'))){var _0x4b276e=[];switch(_0x808b5c[_0x1ccc('0x1b')][_0x1ccc('0x1c')]()){case _0x1ccc('0x1d'):var _0xf89bb3=_0x808b5c[_0x1ccc('0x1e')][_0x1ccc('0x1f')](',');_0x4b276e[_0x1ccc('0x20')](_0xf89bb3[0x0]);_0x4b276e[_0x1ccc('0x20')](_0xf89bb3[_0x1ccc('0x21')](0x1,_0xf89bb3[_0x1ccc('0x19')])[_0x1ccc('0x22')](','));break;case _0x1ccc('0x23'):var _0xdd49b6=_0x808b5c[_0x1ccc('0x1e')][_0x1ccc('0x1f')](',');_0x4b276e[_0x1ccc('0x20')](_0xdd49b6[0x0]);_0x4b276e['push'](_0xdd49b6[0x1]);_0x4b276e[_0x1ccc('0x20')](_0xdd49b6[_0x1ccc('0x21')](0x2,_0xdd49b6['length'])['join'](','));break;case _0x1ccc('0x24'):var _0x102d5e=_0x808b5c[_0x1ccc('0x1e')][_0x1ccc('0x1f')](',');_0x4b276e[_0x1ccc('0x20')](_0x102d5e[0x0]);_0x4b276e[_0x1ccc('0x20')](_0x102d5e[0x1]);_0x4b276e[_0x1ccc('0x20')](_0x102d5e[0x2]);_0x4b276e[_0x1ccc('0x20')](_0x102d5e[0x3]);_0x4b276e[_0x1ccc('0x20')](_0x102d5e[_0x1ccc('0x21')](0x4,_0x102d5e[_0x1ccc('0x19')])[_0x1ccc('0x22')](','));break;case'message':_0x4b276e[_0x1ccc('0x20')](_0x808b5c[_0x1ccc('0x1e')]);break;case _0x1ccc('0x25'):_0x4b276e['push'](_0x808b5c[_0x1ccc('0x26')]);_0x4b276e['push'](_0x808b5c[_0x1ccc('0x1e')]);break;default:_0x4b276e=_['isNil'](_0x808b5c[_0x1ccc('0x1e')])?[]:_0x808b5c[_0x1ccc('0x1e')][_0x1ccc('0x1f')](',');}var _0x34bee0={'id':util[_0x1ccc('0x27')](_0x1ccc('0x28'),_0x41b4bd,_0x808b5c['id'],_0x808b5c[_0x1ccc('0x1b')]),'condition':require('./interval')[_0x1ccc('0x29')](_0x41b4bd,getIntervals(_0x383278[_0x1ccc('0x2a')],_0x808b5c),_0x383278),'consequence':require('./applications/'+_0x808b5c['app'])[_0x1ccc('0x2b')](_0x41b4bd,_0x4b276e,_0x383278,_0x1eb940),'p':_0x808b5c[_0x1ccc('0x2c')]||0x0};logger[_0x1ccc('0x2d')](_0x1ccc('0x2e'),_0x34bee0['id'],_0x1ccc('0x2f'),getIntervals(_0x383278[_0x1ccc('0x2a')],_0x808b5c)[_0x1ccc('0x22')](_0x1ccc('0x30')));_0x29fff8[_0x1ccc('0x20')](_0x34bee0);}else{logger['error']('Please\x20create\x20a\x20new\x20file\x20under',path[_0x1ccc('0x22')](__dirname,_0x1ccc('0x18'),_0x808b5c['app']+_0x1ccc('0x31')));}}_0x383278['rules'][_0x41b4bd]=new RuleEngine(_0x29fff8);_0x383278[_0x1ccc('0x14')][_0x41b4bd]['execute'](_0x1eb940,function(_0x30515e){logger[_0x1ccc('0x2d')](_0x1ccc('0x32'),JSON['stringify'](_0x30515e['matchPath']));if(_0x383278[_0x1ccc('0x14')][_0x41b4bd]){_0x383278[_0x1ccc('0x14')][_0x41b4bd][_0x1ccc('0x33')](_0x1ccc('0x34'));}});return _0x1372ce({'code':0xc8,'message':_0x1eb940});}else{logger[_0x1ccc('0x2d')](_0x1ccc('0x35'));return _0x1372ce({'code':0xc8,'message':_0x1eb940});}}catch(_0x2e82cf){logger[_0x1ccc('0x36')](_0x2e82cf[_0x1ccc('0x37')]);return _0x331b52(_0x340b6d[_0x1ccc('0x36')](0x1f4,_0x2e82cf));}}return _0x331b52(_0x1ccc('0x38'));});},'AcceptMessage':function(_0x33b202){var _0xba19b=this;return new Promise(function(_0x209af3,_0x49735a){if(_0x33b202[_0x1ccc('0x15')]&&_0x33b202[_0x1ccc('0x15')]['id']){try{var _0x163363=getId(_0x33b202[_0x1ccc('0x39')],_0x33b202[_0x1ccc('0x15')]?_0x33b202['message']['id']:0x0,_0x33b202['interaction']?_0x33b202[_0x1ccc('0x16')]['id']:0x0);if(_0x383278[_0x1ccc('0x14')][_0x163363]){_0x383278[_0x1ccc('0x14')][_0x163363][_0x1ccc('0x33')](_0x1ccc('0x3a'));if(rpc[_0x33b202['channel']+_0x1ccc('0x3b')]){rpc[_0x33b202[_0x1ccc('0x39')]+_0x1ccc('0x3b')][_0x1ccc('0x3c')](_0x163363,{'UserId':_0x33b202[_0x1ccc('0x15')][_0x1ccc('0x3d')]})[_0x1ccc('0x3e')](function(_0x20fefd){logger[_0x1ccc('0x36')](_0x1ccc('0x3f'));});}}return _0x209af3({'code':0xc8,'message':_0x33b202});}catch(_0x336183){logger[_0x1ccc('0x36')](_0x336183[_0x1ccc('0x37')]);return _0x49735a(_0xba19b['error'](0x1f4,_0x336183));}}logger[_0x1ccc('0x36')](_0x1ccc('0x40'));return _0x49735a(_0xba19b['error'](0x1f4,_0x1ccc('0x40')));});},'RejectMessage':function(_0x1cdf50){var _0x53c345=this;return new Promise(function(_0x3ec897,_0x427d10){if(_0x1cdf50['agent']&&_0x1cdf50[_0x1ccc('0x41')]['id']){try{if(_0x383278[_0x1ccc('0x42')][_0x1cdf50['agent']['id']]){_0x383278[_0x1ccc('0x42')][_0x1cdf50[_0x1ccc('0x41')]['id']][_0x1ccc('0x43')]=![];_0x383278[_0x1ccc('0x42')][_0x1cdf50['agent']['id']][_0x1ccc('0x44')]=undefined;}return _0x3ec897({'code':0xc8,'message':_0x1cdf50});}catch(_0x5033e8){logger[_0x1ccc('0x36')](_0x5033e8['stack']);return _0x427d10(_0x53c345['error'](0x1f4,_0x5033e8));}}logger[_0x1ccc('0x36')]('message\x20is\x20empty');return _0x427d10(_0x53c345[_0x1ccc('0x36')](0x1f4,_0x1ccc('0x40')));});},'AbandonInteraction':function(_0xfe4af2){var _0x140f9c=this;return new Promise(function(_0x221cd1,_0x5a8516){if(_0xfe4af2[_0x1ccc('0x39')]&&_0xfe4af2['interaction']&&_0xfe4af2['interaction']['id']){try{var _0x5266f0=getId(_0xfe4af2[_0x1ccc('0x39')],_0xfe4af2['message']?_0xfe4af2[_0x1ccc('0x15')]['id']:0x0,_0xfe4af2[_0x1ccc('0x16')]?_0xfe4af2[_0x1ccc('0x16')]['id']:0x0);if(_0x383278[_0x1ccc('0x14')][_0x5266f0]){_0x383278[_0x1ccc('0x14')][_0x5266f0][_0x1ccc('0x33')]('end');}return _0x221cd1({'code':0xc8,'message':_0xfe4af2});}catch(_0xa179fd){logger[_0x1ccc('0x36')](_0xa179fd[_0x1ccc('0x37')]);return _0x5a8516(_0x140f9c[_0x1ccc('0x36')](0x1f4,_0xa179fd));}}logger[_0x1ccc('0x36')](_0x1ccc('0x40'));return _0x5a8516(_0x140f9c[_0x1ccc('0x36')](0x1f4,_0x1ccc('0x40')));});},'AgentCapacity':function(_0xe243c7){var _0x541ba3=this;return new Promise(function(_0x16434,_0x3fa57f){if(_0x383278[_0x1ccc('0x42')][_0x1ccc('0x45')](_0xe243c7['id'])){for(var _0x5e75b2 in _0xe243c7[_0x1ccc('0x46')]){if(_0xe243c7[_0x1ccc('0x46')][_0x1ccc('0x45')](_0x5e75b2)){if(_0x383278[_0x1ccc('0x42')][_0xe243c7['id']][_0x1ccc('0x45')](_0x5e75b2+_0x1ccc('0x47'))){_0x383278[_0x1ccc('0x42')][_0xe243c7['id']][_0x5e75b2+_0x1ccc('0x47')]=parseInt(_0xe243c7['capacity'][_0x5e75b2],0xa);}}}_0x383278[_0x1ccc('0x42')][_0xe243c7['id']]['updateRealtime']();return _0x16434({'code':0xc8,'message':_0x383278[_0x1ccc('0x42')][_0xe243c7['id']]});}else{return _0x3fa57f(_0x541ba3[_0x1ccc('0x36')](0x1f4,_0x1ccc('0x48')));}});},'Agents':function(_0x557855){return new Promise(function(_0x29da5a,_0x1141fd){var _0xd7d11b=_[_0x1ccc('0x49')](_0x383278['agents']);_0x29da5a({'count':_0xd7d11b[_0x1ccc('0x19')],'rows':_0xd7d11b});});},'ChatQueues':function(_0x4fe7bb){return new Promise(function(_0xb5e28f,_0x2e53fb){var _0x2c62e1=[];for(var _0x2affa7 in _0x383278['chatQueues']){if(_0x383278['chatQueues']['hasOwnProperty'](_0x2affa7)){var _0x419419=_0x383278[_0x1ccc('0x4a')][_0x2affa7];var _0x510bf0={'id':_0x419419['id'],'available':_0x419419[_0x1ccc('0x4b')],'loggedIn':_0x419419[_0x1ccc('0x4c')],'name':_0x419419['name'],'paused':_0x419419[_0x1ccc('0x4d')],'waiting':_0x419419[_0x1ccc('0x4e')]};_0x2c62e1[_0x1ccc('0x20')](_0x510bf0);}}_0xb5e28f({'count':_0x2c62e1[_0x1ccc('0x19')],'rows':_0x2c62e1});});},'MailQueues':function(_0x2d67f9){return new Promise(function(_0x2129cb,_0x3514f0){var _0x33cfc7=[];for(var _0x472913 in _0x383278['mailQueues']){if(_0x383278['mailQueues'][_0x1ccc('0x45')](_0x472913)){var _0x33d345=_0x383278[_0x1ccc('0x4f')][_0x472913];var _0x411447={'id':_0x33d345['id'],'available':_0x33d345[_0x1ccc('0x4b')],'loggedIn':_0x33d345[_0x1ccc('0x4c')],'name':_0x33d345[_0x1ccc('0x50')],'paused':_0x33d345['paused'],'waiting':_0x33d345[_0x1ccc('0x4e')]};_0x33cfc7['push'](_0x411447);}}_0x2129cb({'count':_0x33cfc7[_0x1ccc('0x19')],'rows':_0x33cfc7});});},'OpenchannelQueues':function(_0x3adcd7){return new Promise(function(_0x493811,_0x42b7ff){var _0x46dbce=[];for(var _0x3122c7 in _0x383278[_0x1ccc('0x51')]){if(_0x383278[_0x1ccc('0x51')][_0x1ccc('0x45')](_0x3122c7)){var _0x41eeef=_0x383278[_0x1ccc('0x51')][_0x3122c7];var _0x336651={'id':_0x41eeef['id'],'available':_0x41eeef[_0x1ccc('0x4b')],'loggedIn':_0x41eeef[_0x1ccc('0x4c')],'name':_0x41eeef[_0x1ccc('0x50')],'paused':_0x41eeef[_0x1ccc('0x4d')],'waiting':_0x41eeef[_0x1ccc('0x4e')]};_0x46dbce[_0x1ccc('0x20')](_0x336651);}}_0x493811({'count':_0x46dbce['length'],'rows':_0x46dbce});});},'SmsQueues':function(_0x4d22d5){return new Promise(function(_0x491e41,_0x2d0a4c){var _0x527b6e=[];for(var _0x31fa43 in _0x383278[_0x1ccc('0x52')]){if(_0x383278['smsQueues'][_0x1ccc('0x45')](_0x31fa43)){var _0x13a15c=_0x383278[_0x1ccc('0x52')][_0x31fa43];var _0x45639b={'id':_0x13a15c['id'],'available':_0x13a15c[_0x1ccc('0x4b')],'loggedIn':_0x13a15c[_0x1ccc('0x4c')],'name':_0x13a15c['name'],'paused':_0x13a15c[_0x1ccc('0x4d')],'waiting':_0x13a15c[_0x1ccc('0x4e')]};_0x527b6e['push'](_0x45639b);}}_0x491e41({'count':_0x527b6e[_0x1ccc('0x19')],'rows':_0x527b6e});});},'FaxQueues':function(_0x4e0741){return new Promise(function(_0x1ca483,_0x3b4b94){var _0x1da573=[];for(var _0x1ce314 in _0x383278[_0x1ccc('0x53')]){if(_0x383278[_0x1ccc('0x53')][_0x1ccc('0x45')](_0x1ce314)){var _0x407477=_0x383278[_0x1ccc('0x53')][_0x1ce314];var _0x30b89b={'id':_0x407477['id'],'available':_0x407477[_0x1ccc('0x4b')],'loggedIn':_0x407477[_0x1ccc('0x4c')],'name':_0x407477[_0x1ccc('0x50')],'paused':_0x407477[_0x1ccc('0x4d')],'waiting':_0x407477[_0x1ccc('0x4e')]};_0x1da573[_0x1ccc('0x20')](_0x30b89b);}}_0x1ca483({'count':_0x1da573[_0x1ccc('0x19')],'rows':_0x1da573});});},'WhatsappQueues':function(_0x1b0bdc){return new Promise(function(_0x4eadfa,_0x546348){var _0x4c0d9b=[];for(var _0x3e0b65 in _0x383278['whatsappQueues']){if(_0x383278[_0x1ccc('0x54')][_0x1ccc('0x45')](_0x3e0b65)){var _0x148ecd=_0x383278[_0x1ccc('0x54')][_0x3e0b65];var _0x202a22={'id':_0x148ecd['id'],'available':_0x148ecd[_0x1ccc('0x4b')],'loggedIn':_0x148ecd[_0x1ccc('0x4c')],'name':_0x148ecd[_0x1ccc('0x50')],'paused':_0x148ecd[_0x1ccc('0x4d')],'waiting':_0x148ecd['waiting']};_0x4c0d9b[_0x1ccc('0x20')](_0x202a22);}}_0x4eadfa({'count':_0x4c0d9b[_0x1ccc('0x19')],'rows':_0x4c0d9b});});},'ChatQueuesWaitingInteractions':function(_0x22b70){return new Promise(function(_0xc82a8e,_0x5ec62e){var _0x1b697a=_['values'](_0x383278['chatQueuesWaitingInteractions']);_0xc82a8e({'count':_0x1b697a[_0x1ccc('0x19')],'rows':_0x1b697a});});},'MailQueuesWaitingInteractions':function(_0x4c6e40){return new Promise(function(_0x497890,_0x294eaa){var _0xdfb68c=_[_0x1ccc('0x49')](_0x383278[_0x1ccc('0x55')]);_0x497890({'count':_0xdfb68c['length'],'rows':_0xdfb68c});});},'OpenchannelQueuesWaitingInteractions':function(_0x4eec91){return new Promise(function(_0x26d0d7,_0x7182d){var _0xa9a557=_[_0x1ccc('0x49')](_0x383278[_0x1ccc('0x56')]);_0x26d0d7({'count':_0xa9a557[_0x1ccc('0x19')],'rows':_0xa9a557});});},'SmsQueuesWaitingInteractions':function(_0x55235a){return new Promise(function(_0x182249,_0x53cce6){var _0x291142=_[_0x1ccc('0x49')](_0x383278[_0x1ccc('0x57')]);_0x182249({'count':_0x291142[_0x1ccc('0x19')],'rows':_0x291142});});},'FaxQueuesWaitingInteractions':function(_0x355ddd){return new Promise(function(_0x273b4b,_0x2ab129){var _0x4e9e8f=_[_0x1ccc('0x49')](_0x383278[_0x1ccc('0x58')]);_0x273b4b({'count':_0x4e9e8f[_0x1ccc('0x19')],'rows':_0x4e9e8f});});},'WhatsappQueuesWaitingInteractions':function(_0x1ede6c){return new Promise(function(_0x54bbbc,_0x3c8f30){var _0x23791a=_[_0x1ccc('0x49')](_0x383278['whatsappQueuesWaitingInteractions']);_0x54bbbc({'count':_0x23791a[_0x1ccc('0x19')],'rows':_0x23791a});});}};var _0x25acc8=jayson[_0x1ccc('0x59')](_0x2f456b)[_0x1ccc('0x5a')]();_0x25acc8['on']('error',function(_0x49d208){logger['error'](JSON[_0x1ccc('0x5b')](_0x49d208));return _0x11a69f(_0x49d208);});_0x25acc8[_0x1ccc('0x13')](0x232c,_0x1ccc('0x5c'),function(){console[_0x1ccc('0x5d')](_0x1ccc('0x5e'),0x232c);return _0x1e14d3(_0x1ccc('0x5f')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 0d48aa0..5b28cfe 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 _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 +var _0x991a=['message','result','condition','rules','info','stop','length','push','Command','iftime\x20%s','indexOf','catch','[%s][INTERVAL]\x20%s','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util','bluebird','lodash','../../../config/logger','routing','client','request','then','error'];(function(_0x2a606e,_0xc991c4){var _0x1fba0f=function(_0x3fa658){while(--_0x3fa658){_0x2a606e['push'](_0x2a606e['shift']());}};_0x1fba0f(++_0xc991c4);}(_0x991a,0x1ef));var _0xa991=function(_0x468e5f,_0x446fd0){_0x468e5f=_0x468e5f-0x0;var _0xb5be1b=_0x991a[_0x468e5f];return _0xb5be1b;};'use strict';var util=require(_0xa991('0x0'));var BPromise=require(_0xa991('0x1'));var jayson=require('jayson/promise');var _=require(_0xa991('0x2'));var logger=require(_0xa991('0x3'))(_0xa991('0x4'));var client=jayson[_0xa991('0x5')]['http']({'port':0x232a});function request(_0x40a83f,_0x1f53f1){return new BPromise(function(_0x10c2ac,_0x523b06){return client[_0xa991('0x6')](_0x40a83f,_0x1f53f1)[_0xa991('0x7')](function(_0x38711d){if(_0x38711d[_0xa991('0x8')]){return _0x523b06(_0x38711d[_0xa991('0x8')][_0xa991('0x9')]);}else{return _0x10c2ac(_0x38711d[_0xa991('0xa')]);}})['catch'](function(_0x3918f6){return _0x523b06(_0x3918f6);});});}exports[_0xa991('0xb')]=function(_0x75deee,_0x242283,_0x1f5784){return function(_0x3395ce){if(_0x1f5784[_0xa991('0xc')]&&!_0x1f5784['rules'][_0x75deee]){logger[_0xa991('0xd')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x75deee);return _0x3395ce[_0xa991('0xe')]();}var _0x3e1746=[];for(var _0x2f791d=0x0;_0x2f791d<_0x242283[_0xa991('0xf')];_0x2f791d+=0x1){_0x3e1746[_0xa991('0x10')](request(_0xa991('0x11'),{'command':util['format'](_0xa991('0x12'),_0x242283[_0x2f791d])})[_0xa991('0x7')](function(_0x49e663){return _0x49e663&&_0x49e663[_0xa991('0x9')]&&_0x49e663[_0xa991('0x9')][_0xa991('0x13')]('true')>=0x0?!![]:![];})[_0xa991('0x14')](function(_0x50326e){logger[_0xa991('0x8')](_0xa991('0x15'),_0x75deee,_0x242283[_0x2f791d]);}));}BPromise['all'](_0x3e1746)['then'](function(_0x5eacf0){var _0x43ac2b=_['some'](_0x5eacf0);logger[_0xa991('0xd')](_0xa991('0x16'),_0x75deee,_0x242283[_0xa991('0x17')](_0xa991('0x18')),_0x43ac2b);_0x3395ce[_0xa991('0x19')](_0x43ac2b);})['catch'](function(_0x3ae7ca){console[_0xa991('0x1a')](_0x3ae7ca);logger[_0xa991('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0x75deee,_0x242283[_0xa991('0x17')](_0xa991('0x18')),_0x3ae7ca[_0xa991('0x1b')]);_0x3395ce[_0xa991('0xe')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 88fbb9c..4ea14af 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 _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 +var _0xba28=['forIn','includes','abandoned','holdtime','agentconnect','agentconnectAt','connect','answered_elsewhere','answeredelsewheremembername','agentcompleteAt','diffTime','blindtransfer','transfereruniqueid','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfer','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','transfertargetuniqueid','rejected','indexOf','agent','complete','lodash','util','./utils','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','membername','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','CreateVoiceAgentReport','request','destuniqueid','agentcalled','agentcalledAt','now','called','connectedlinename','error','stack','agentringnoanswer','isNil','agentringnoanswerAt','timeout','reason','ringtime','talktime','queuecallerabandon'];(function(_0x1bb29c,_0x297df2){var _0x7262c6=function(_0x53057e){while(--_0x53057e){_0x1bb29c['push'](_0x1bb29c['shift']());}};_0x7262c6(++_0x297df2);}(_0xba28,0xb0));var _0x8ba2=function(_0x50e593,_0x3ae998){_0x50e593=_0x50e593-0x0;var _0x3821d0=_0xba28[_0x50e593];return _0x3821d0;};'use strict';var _=require(_0x8ba2('0x0'));var util=require(_0x8ba2('0x1'));var utils=require(_0x8ba2('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x4be17c,_0x2e587f){utils['info'](util[_0x8ba2('0x3')](_0x8ba2('0x4'),_0x4be17c[_0x8ba2('0x5')],_0x4be17c[_0x8ba2('0x6')],_0x4be17c[_0x8ba2('0x7')],_0x4be17c[_0x8ba2('0x8')],_0x4be17c['interface'],_0x4be17c[_0x8ba2('0x9')],_0x4be17c[_0x8ba2('0xa')],_0x4be17c[_0x8ba2('0xb')]));if(_0x4be17c['queue']){utils[_0x8ba2('0xc')](_0x4be17c[_0x8ba2('0x7')])['then'](function(_0x2f37a2){if(_0x2f37a2){_0x4be17c[_0x8ba2('0xd')]=_0x2f37a2[_0x8ba2('0xd')];_0x4be17c[_0x8ba2('0xe')]=_0x4be17c[_0x8ba2('0xf')]?_0x2f37a2[_0x8ba2('0x10')]:![];_0x4be17c[_0x8ba2('0x11')]=_0x4be17c['agentacw']?_0x2f37a2[_0x8ba2('0x12')]:0x0;}utils['request'](_0x8ba2('0x13'),_0x4be17c);});}else{utils[_0x8ba2('0x14')](_0x8ba2('0x13'),_0x4be17c);}if(_0x2e587f){delete transfers[_0x4be17c['uniqueid']];}else{delete agents[_0x4be17c[_0x8ba2('0x15')]];}}exports[_0x8ba2('0x16')]=function(_0x171580){try{agents[_0x171580[_0x8ba2('0x15')]]=_0x171580;agents[_0x171580['destuniqueid']][_0x8ba2('0x17')]=utils[_0x8ba2('0x18')]();agents[_0x171580[_0x8ba2('0x15')]][_0x8ba2('0xb')]=_0x8ba2('0x19');agents[_0x171580['destuniqueid']][_0x8ba2('0xa')]=null;agents[_0x171580[_0x8ba2('0x15')]][_0x8ba2('0x1a')]=null;}catch(_0x2a611e){utils[_0x8ba2('0x1b')](_0x2a611e[_0x8ba2('0x1c')]);}};exports[_0x8ba2('0x1d')]=function(_0x5c4f63){try{if(!_[_0x8ba2('0x1e')](agents[_0x5c4f63[_0x8ba2('0x15')]])){agents[_0x5c4f63['destuniqueid']]['agentringnoanswer']=!![];agents[_0x5c4f63['destuniqueid']][_0x8ba2('0x1f')]=utils[_0x8ba2('0x18')]();agents[_0x5c4f63[_0x8ba2('0x15')]][_0x8ba2('0xb')]=_0x8ba2('0x20');agents[_0x5c4f63['destuniqueid']][_0x8ba2('0x21')]=_0x8ba2('0x20');agents[_0x5c4f63[_0x8ba2('0x15')]]['holdtime']=_0x5c4f63['ringtime']?parseInt(_0x5c4f63[_0x8ba2('0x22')])/0x3e8:0x0;agents[_0x5c4f63[_0x8ba2('0x15')]][_0x8ba2('0x23')]=0x0;unanswered['push'](_0x5c4f63['destuniqueid']);}}catch(_0x53f6bc){utils[_0x8ba2('0x1b')](_0x53f6bc[_0x8ba2('0x1c')]);}};exports[_0x8ba2('0x24')]=function(_0x264550){try{_[_0x8ba2('0x25')](agents,function(_0x16a76a,_0x20af23){if(_0x16a76a[_0x8ba2('0x5')]==_0x264550['uniqueid']&&!_[_0x8ba2('0x26')](unanswered,_0x16a76a[_0x8ba2('0x15')])){_0x16a76a['agentringnoanswer']=!![];_0x16a76a[_0x8ba2('0x1f')]=utils[_0x8ba2('0x18')]();_0x16a76a[_0x8ba2('0xb')]=_0x8ba2('0x27');_0x16a76a['reason']='abandoned';_0x16a76a[_0x8ba2('0x28')]=_0x264550[_0x8ba2('0x28')];_0x16a76a[_0x8ba2('0x23')]=0x0;writeDB(_0x16a76a);}});}catch(_0x355f04){utils['error'](_0x355f04[_0x8ba2('0x1c')]);}};exports[_0x8ba2('0x29')]=function(_0x429e8b){try{if(agents[_0x429e8b[_0x8ba2('0x15')]]){agents[_0x429e8b[_0x8ba2('0x15')]][_0x8ba2('0x2a')]=utils[_0x8ba2('0x18')]();agents[_0x429e8b[_0x8ba2('0x15')]][_0x8ba2('0xa')]=_0x429e8b[_0x8ba2('0xa')];agents[_0x429e8b[_0x8ba2('0x15')]]['connectedlinename']=_0x429e8b[_0x8ba2('0x1a')];agents[_0x429e8b[_0x8ba2('0x15')]]['holdtime']=_0x429e8b['ringtime'];agents[_0x429e8b[_0x8ba2('0x15')]][_0x8ba2('0xb')]=_0x8ba2('0x2b');_[_0x8ba2('0x25')](agents,function(_0x372502,_0x781883){if(_0x372502['destuniqueid']!=_0x429e8b[_0x8ba2('0x15')]&&_0x372502['uniqueid']==_0x429e8b['uniqueid']){_0x372502[_0x8ba2('0x23')]=0x0;_0x372502['holdtime']=_0x429e8b['ringtime'];_0x372502[_0x8ba2('0x1d')]=!![];_0x372502[_0x8ba2('0x1f')]=utils[_0x8ba2('0x18')]();_0x372502[_0x8ba2('0xb')]=_0x8ba2('0x2c');_0x372502[_0x8ba2('0x21')]=_0x8ba2('0x2c');_0x372502['answeredelsewheredestinationuniqueid']=_0x429e8b['destuniqueid'];_0x372502[_0x8ba2('0x2d')]=_0x429e8b[_0x8ba2('0x8')];writeDB(_0x372502);}});}}catch(_0x185f60){utils[_0x8ba2('0x1b')](_0x185f60[_0x8ba2('0x1c')]);}};exports[_0x8ba2('0xf')]=function(_0x4b9a32){try{if(!_[_0x8ba2('0x1e')](agents[_0x4b9a32['destuniqueid']])){agents[_0x4b9a32['destuniqueid']]['agentcomplete']=!![];agents[_0x4b9a32['destuniqueid']][_0x8ba2('0x2e')]=utils[_0x8ba2('0x18')]();agents[_0x4b9a32['destuniqueid']][_0x8ba2('0x23')]=utils[_0x8ba2('0x2f')](agents[_0x4b9a32[_0x8ba2('0x15')]][_0x8ba2('0x2e')],agents[_0x4b9a32[_0x8ba2('0x15')]][_0x8ba2('0x2a')]);agents[_0x4b9a32[_0x8ba2('0x15')]][_0x8ba2('0x21')]=_0x4b9a32[_0x8ba2('0x21')];agents[_0x4b9a32[_0x8ba2('0x15')]][_0x8ba2('0xb')]='complete';writeDB(agents[_0x4b9a32[_0x8ba2('0x15')]]);}}catch(_0x1b1508){utils['error'](_0x1b1508[_0x8ba2('0x1c')]);}};exports[_0x8ba2('0x30')]=function(_0x471143){try{if(!_[_0x8ba2('0x1e')](agents[_0x471143[_0x8ba2('0x31')]])){agents[_0x471143[_0x8ba2('0x31')]]['transfer']=!![];agents[_0x471143[_0x8ba2('0x31')]][_0x8ba2('0x32')]=_0x8ba2('0x33');agents[_0x471143[_0x8ba2('0x31')]][_0x8ba2('0x34')]=_0x471143[_0x8ba2('0x35')];agents[_0x471143[_0x8ba2('0x31')]][_0x8ba2('0x36')]=agents[_0x471143[_0x8ba2('0x31')]][_0x8ba2('0x5')];}}catch(_0x2b1b80){utils[_0x8ba2('0x1b')](_0x2b1b80[_0x8ba2('0x1c')]);}};exports[_0x8ba2('0x37')]=function(_0x596153){try{if(_0x596153[_0x8ba2('0x38')]==_0x596153[_0x8ba2('0x39')]){if(!_['isNil'](agents[_0x596153[_0x8ba2('0x3a')]])){agents[_0x596153[_0x8ba2('0x3a')]][_0x8ba2('0x3b')]=!![];agents[_0x596153[_0x8ba2('0x3a')]][_0x8ba2('0x32')]=_0x8ba2('0x3c');agents[_0x596153['secondtransfereruniqueid']][_0x8ba2('0x34')]=_0x596153[_0x8ba2('0x3d')];agents[_0x596153[_0x8ba2('0x3a')]][_0x8ba2('0x36')]=_0x596153[_0x8ba2('0x38')];}if(_0x596153[_0x8ba2('0x3e')]&&agents[_0x596153[_0x8ba2('0x3e')]]){agents[_0x596153[_0x8ba2('0x3e')]][_0x8ba2('0x3f')]=0x1;transfers[_0x596153[_0x8ba2('0x3e')]]=_[_0x8ba2('0x40')](agents[_0x596153[_0x8ba2('0x3e')]]);transfers[_0x596153[_0x8ba2('0x3e')]][_0x8ba2('0x9')]=agents[_0x596153[_0x8ba2('0x3a')]][_0x8ba2('0x9')];transfers[_0x596153[_0x8ba2('0x3e')]]['calleridname']=agents[_0x596153[_0x8ba2('0x3a')]][_0x8ba2('0x41')];transfers[_0x596153['transfereeuniqueid']]['agentcalledAt']=utils[_0x8ba2('0x18')]();transfers[_0x596153[_0x8ba2('0x3e')]][_0x8ba2('0x2a')]=utils['now']();transfers[_0x596153[_0x8ba2('0x3e')]]['holdtime']=0x0;transfers[_0x596153[_0x8ba2('0x3e')]]['agententerreason']=0x2;}}else if(_0x596153[_0x8ba2('0x3a')]==_0x596153['secondtransfererlinkedid']){if(!_[_0x8ba2('0x1e')](agents[_0x596153[_0x8ba2('0x38')]])){agents[_0x596153['origtransfereruniqueid']]['transfer']=!![];agents[_0x596153[_0x8ba2('0x38')]][_0x8ba2('0x32')]=_0x8ba2('0x3c');agents[_0x596153[_0x8ba2('0x38')]][_0x8ba2('0x34')]=_0x596153['secondtransfererexten'];agents[_0x596153[_0x8ba2('0x38')]][_0x8ba2('0x36')]=_0x596153[_0x8ba2('0x3a')];}if(_0x596153[_0x8ba2('0x42')]&&agents[_0x596153[_0x8ba2('0x42')]]){agents[_0x596153[_0x8ba2('0x42')]]['agententerreason']=0x1;transfers[_0x596153[_0x8ba2('0x42')]]=_['clone'](agents[_0x596153[_0x8ba2('0x42')]]);transfers[_0x596153[_0x8ba2('0x42')]][_0x8ba2('0x9')]=agents[_0x596153[_0x8ba2('0x38')]]['calleridnum'];transfers[_0x596153[_0x8ba2('0x42')]][_0x8ba2('0x41')]=agents[_0x596153[_0x8ba2('0x38')]][_0x8ba2('0x41')];transfers[_0x596153[_0x8ba2('0x42')]]['agentcalledAt']=utils[_0x8ba2('0x18')]();transfers[_0x596153[_0x8ba2('0x42')]][_0x8ba2('0x2a')]=utils[_0x8ba2('0x18')]();transfers[_0x596153[_0x8ba2('0x42')]][_0x8ba2('0x28')]=0x0;transfers[_0x596153[_0x8ba2('0x42')]][_0x8ba2('0x3f')]=0x2;}}}catch(_0x484300){utils[_0x8ba2('0x1b')](_0x484300['stack']);}};exports['hangup']=function(_0x5c7c10){try{if(agents[_0x5c7c10['uniqueid']]&&agents[_0x5c7c10[_0x8ba2('0x5')]]['reason']===_0x8ba2('0x20')){if(_0x5c7c10['cause']==='21'){agents[_0x5c7c10['uniqueid']][_0x8ba2('0x21')]=_0x8ba2('0x43');agents[_0x5c7c10[_0x8ba2('0x5')]]['lastevent']='rejected';}writeDB(agents[_0x5c7c10['uniqueid']]);var _0x3f4a30=unanswered[_0x8ba2('0x44')](_0x5c7c10[_0x8ba2('0x5')]);if(_0x3f4a30>-0x1)unanswered['splice'](_0x3f4a30,0x1);}if(transfers[_0x5c7c10[_0x8ba2('0x5')]]){transfers[_0x5c7c10[_0x8ba2('0x5')]][_0x8ba2('0xf')]=!![];transfers[_0x5c7c10[_0x8ba2('0x5')]]['agentcompleteAt']=utils['now']();transfers[_0x5c7c10[_0x8ba2('0x5')]][_0x8ba2('0x23')]=utils[_0x8ba2('0x2f')](transfers[_0x5c7c10[_0x8ba2('0x5')]][_0x8ba2('0x2e')],transfers[_0x5c7c10[_0x8ba2('0x5')]][_0x8ba2('0x2a')]);transfers[_0x5c7c10['uniqueid']][_0x8ba2('0x21')]=_0x8ba2('0x45');transfers[_0x5c7c10[_0x8ba2('0x5')]][_0x8ba2('0xb')]='complete';writeDB(transfers[_0x5c7c10[_0x8ba2('0x5')]],!![]);}if(agents[_0x5c7c10[_0x8ba2('0x5')]]&&agents[_0x5c7c10[_0x8ba2('0x5')]]['agentconnectAt']){agents[_0x5c7c10['uniqueid']][_0x8ba2('0xf')]=!![];agents[_0x5c7c10[_0x8ba2('0x5')]][_0x8ba2('0x2e')]=utils[_0x8ba2('0x18')]();agents[_0x5c7c10[_0x8ba2('0x5')]]['talktime']=utils[_0x8ba2('0x2f')](agents[_0x5c7c10[_0x8ba2('0x5')]][_0x8ba2('0x2e')],agents[_0x5c7c10['uniqueid']][_0x8ba2('0x2a')]);agents[_0x5c7c10[_0x8ba2('0x5')]][_0x8ba2('0x21')]=agents[_0x5c7c10['uniqueid']][_0x8ba2('0x3b')]?_0x8ba2('0x3b'):_0x8ba2('0x45');agents[_0x5c7c10[_0x8ba2('0x5')]][_0x8ba2('0xb')]=_0x8ba2('0x46');writeDB(agents[_0x5c7c10[_0x8ba2('0x5')]]);}}catch(_0xf89abe){utils[_0x8ba2('0x1b')](_0xf89abe['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index b590e65..84ef4bc 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 _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 +var _0xe754=['billableseconds','attendedtransfer','localtwolinkedid','transfereechannel','destinationchannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','mohtime','varset','variable','xmd-originatecalleridnum','value','xmd-phone','destination','\x22\x20<','xmd-callerid','xmcs-queue','lastapplication','Queue','xmd-contactid','ContactId','xmd-cdrtype','outboundrouteid','sipcallid','application','set','startsWith','appdata','toLowerCase','cdr','substring','lastIndexOf','includes','noop','lastdata','lodash','util','NO\x20ANSWER','FAILED','BUSY','format','uniqueid','channel','type','accountcode','source','UserId','request','CreateVoiceCallReport','newchannel','calleridnum','exten','now','DOCUMENTATION','error','stack','newstate','isNil','systemanswertime','linkedid','channelstate','context','answertime','toNumber','hangup','callerid','calleridname','duration','diffTime','endtime','starttime'];(function(_0x37edaf,_0x399cda){var _0x21c4ae=function(_0x377a19){while(--_0x377a19){_0x37edaf['push'](_0x37edaf['shift']());}};_0x21c4ae(++_0x399cda);}(_0xe754,0x1f0));var _0x4e75=function(_0x39ebfb,_0x3e95ef){_0x39ebfb=_0x39ebfb-0x0;var _0x20f247=_0xe754[_0x39ebfb];return _0x20f247;};'use strict';var _=require(_0x4e75('0x0'));var util=require(_0x4e75('0x1'));var utils=require('./utils');var dispositions=[_0x4e75('0x2'),_0x4e75('0x3'),'FAILED','NO\x20ANSWER',_0x4e75('0x2'),_0x4e75('0x2'),'ANSWERED',_0x4e75('0x4'),'FAILED',_0x4e75('0x3'),'FAILED'];var channels={};function writeDB(_0x410d49){utils['info'](util[_0x4e75('0x5')]('CALL|%s|%s|%s|%s|%s|%s|%s|%s',_0x410d49[_0x4e75('0x6')],_0x410d49[_0x4e75('0x7')],_0x410d49[_0x4e75('0x8')],_0x410d49[_0x4e75('0x9')],_0x410d49[_0x4e75('0xa')],_0x410d49['destination'],_0x410d49['callerid'],_0x410d49['disposition']));if(_0x410d49[_0x4e75('0x9')]){utils['getUserByInternal'](_0x410d49[_0x4e75('0x9')])['then'](function(_0x410f0c){if(_0x410f0c){_0x410d49[_0x4e75('0xb')]=_0x410f0c['id'];}utils[_0x4e75('0xc')]('CreateVoiceCallReport',_0x410d49);});}else{utils[_0x4e75('0xc')](_0x4e75('0xd'),_0x410d49);}if(channels[_0x410d49[_0x4e75('0x6')]]){delete channels[_0x410d49[_0x4e75('0x6')]];}}exports[_0x4e75('0xe')]=function(_0x5142ad){try{if(_0x5142ad[_0x4e75('0x6')]==_0x5142ad['linkedid']&&_0x5142ad[_0x4e75('0x7')]!='OutgoingSpoolFailed'){channels[_0x5142ad['uniqueid']]={'uniqueid':_0x5142ad['uniqueid'],'accountcode':_0x5142ad['accountcode'],'source':_0x5142ad[_0x4e75('0xf')],'destination':_0x5142ad[_0x4e75('0x10')],'destinationcontext':_0x5142ad['context'],'channel':_0x5142ad[_0x4e75('0x7')],'starttime':utils[_0x4e75('0x11')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x4e75('0x12')};}}catch(_0x1fd072){utils[_0x4e75('0x13')](_0x1fd072[_0x4e75('0x14')]);}};exports[_0x4e75('0x15')]=function(_0x2e21a3){try{if(!_['isNil'](channels[_0x2e21a3[_0x4e75('0x6')]])&&_0x2e21a3['channelstate']==0x6){if(_[_0x4e75('0x16')](channels[_0x2e21a3['uniqueid']]['systemanswertime'])){channels[_0x2e21a3[_0x4e75('0x6')]][_0x4e75('0x17')]=utils[_0x4e75('0x11')]();}}else if(!_['isNil'](channels[_0x2e21a3[_0x4e75('0x18')]])&&_0x2e21a3[_0x4e75('0x19')]==0x6&&_0x2e21a3[_0x4e75('0x1a')]!='transfer'){channels[_0x2e21a3['linkedid']]['accountcode']=_0x2e21a3[_0x4e75('0x9')];channels[_0x2e21a3[_0x4e75('0x18')]]['destinationchannel']=_0x2e21a3[_0x4e75('0x7')];if(_['isNil'](channels[_0x2e21a3[_0x4e75('0x18')]]['answertime'])){channels[_0x2e21a3[_0x4e75('0x18')]][_0x4e75('0x1b')]=utils[_0x4e75('0x11')]();}channels[_0x2e21a3[_0x4e75('0x18')]]['disposition']=dispositions[_[_0x4e75('0x1c')](_0x2e21a3['channelstate'])]||'ANSWERED';}}catch(_0x423d37){utils[_0x4e75('0x13')](_0x423d37[_0x4e75('0x14')]);}};exports[_0x4e75('0x1d')]=function(_0x3f602d){try{if(!_['isNil'](channels[_0x3f602d['uniqueid']])){if(_['isNil'](channels[_0x3f602d['uniqueid']][_0x4e75('0x1e')])){channels[_0x3f602d[_0x4e75('0x6')]][_0x4e75('0x1e')]=_0x3f602d[_0x4e75('0x1f')]+'\x20<'+_0x3f602d[_0x4e75('0xf')]+'>';}channels[_0x3f602d[_0x4e75('0x6')]]['endtime']=utils['now']();channels[_0x3f602d['uniqueid']][_0x4e75('0x20')]=utils[_0x4e75('0x21')](channels[_0x3f602d['uniqueid']][_0x4e75('0x22')],channels[_0x3f602d[_0x4e75('0x6')]][_0x4e75('0x23')]);channels[_0x3f602d[_0x4e75('0x6')]][_0x4e75('0x24')]=channels[_0x3f602d['uniqueid']][_0x4e75('0x1b')]?utils['diffTime'](channels[_0x3f602d[_0x4e75('0x6')]][_0x4e75('0x22')],channels[_0x3f602d[_0x4e75('0x6')]][_0x4e75('0x1b')]):0x0;writeDB(channels[_0x3f602d[_0x4e75('0x6')]]);}}catch(_0xbe175b){utils[_0x4e75('0x13')](_0xbe175b[_0x4e75('0x14')]);}};exports[_0x4e75('0x25')]=function(_0x27a9f5){try{if(!_[_0x4e75('0x16')](channels[_0x27a9f5[_0x4e75('0x26')]])){if(channels[_0x27a9f5[_0x4e75('0x26')]][_0x4e75('0x7')]==_0x27a9f5[_0x4e75('0x27')]){channels[_0x27a9f5[_0x4e75('0x26')]][_0x4e75('0x28')]=_0x27a9f5[_0x4e75('0x29')];channels[_0x27a9f5[_0x4e75('0x26')]][_0x4e75('0x2a')]=_0x4e75('0x2b');}else if(channels[_0x27a9f5[_0x4e75('0x26')]][_0x4e75('0x7')]=_0x27a9f5[_0x4e75('0x2c')]){channels[_0x27a9f5['localtwolinkedid']][_0x4e75('0x28')]=_0x27a9f5[_0x4e75('0x2d')];channels[_0x27a9f5['localtwolinkedid']][_0x4e75('0x2a')]=_0x4e75('0x2b');}}}catch(_0x2fd2de){utils[_0x4e75('0x13')](_0x2fd2de[_0x4e75('0x14')]);}};exports[_0x4e75('0x2e')]=function(_0x16f1f1){try{if(!_[_0x4e75('0x16')](channels[_0x16f1f1[_0x4e75('0x6')]])){channels[_0x16f1f1[_0x4e75('0x6')]][_0x4e75('0x2f')]=utils[_0x4e75('0x11')]();}}catch(_0x18e54f){utils['error'](_0x18e54f[_0x4e75('0x14')]);}};exports['musiconholdstop']=function(_0x187281){try{if(!_['isNil'](channels[_0x187281[_0x4e75('0x6')]])){if(!_[_0x4e75('0x16')](channels[_0x187281[_0x4e75('0x6')]][_0x4e75('0x2f')])){channels[_0x187281[_0x4e75('0x6')]][_0x4e75('0x30')]+=utils['diffTime'](utils[_0x4e75('0x11')](),channels[_0x187281[_0x4e75('0x6')]][_0x4e75('0x2f')]);delete channels[_0x187281[_0x4e75('0x6')]][_0x4e75('0x2f')];}}}catch(_0x42f15f){utils['error'](_0x42f15f[_0x4e75('0x14')]);}};exports[_0x4e75('0x31')]=function(_0x5e175b){try{if(!_[_0x4e75('0x16')](channels[_0x5e175b['uniqueid']])){if(!_[_0x4e75('0x16')](_0x5e175b[_0x4e75('0x32')][_0x4e75('0x33')])){channels[_0x5e175b[_0x4e75('0x6')]]['source']=_0x5e175b[_0x4e75('0x34')];}if(!_[_0x4e75('0x16')](_0x5e175b[_0x4e75('0x32')][_0x4e75('0x35')])){channels[_0x5e175b['uniqueid']][_0x4e75('0x36')]=_0x5e175b[_0x4e75('0x34')];channels[_0x5e175b['uniqueid']][_0x4e75('0x1e')]='\x22'+_0x5e175b[_0x4e75('0x34')]+_0x4e75('0x37')+_0x5e175b[_0x4e75('0x34')]+'>';}if(!_['isNil'](_0x5e175b[_0x4e75('0x32')]['xmd-callerid-preview'])||!_[_0x4e75('0x16')](_0x5e175b[_0x4e75('0x32')][_0x4e75('0x38')])){channels[_0x5e175b[_0x4e75('0x6')]]['callerid']=_0x5e175b[_0x4e75('0x34')];}if(!_[_0x4e75('0x16')](_0x5e175b[_0x4e75('0x32')]['xmd-queue'])||!_[_0x4e75('0x16')](_0x5e175b['variable'][_0x4e75('0x39')])){channels[_0x5e175b[_0x4e75('0x6')]][_0x4e75('0x3a')]=_0x4e75('0x3b');channels[_0x5e175b[_0x4e75('0x6')]]['lastdata']=_0x5e175b[_0x4e75('0x34')];channels[_0x5e175b[_0x4e75('0x6')]]['queue']=!![];}if(!_[_0x4e75('0x16')](_0x5e175b[_0x4e75('0x32')][_0x4e75('0x3c')])){channels[_0x5e175b['uniqueid']][_0x4e75('0x3d')]=_0x5e175b[_0x4e75('0x34')];}if(!_[_0x4e75('0x16')](_0x5e175b[_0x4e75('0x32')][_0x4e75('0x3e')])){channels[_0x5e175b[_0x4e75('0x6')]][_0x4e75('0x8')]=_0x5e175b[_0x4e75('0x34')];}if(!_[_0x4e75('0x16')](_0x5e175b['variable'][_0x4e75('0x3f')])){channels[_0x5e175b[_0x4e75('0x6')]]['routeid']=_0x5e175b['value'];}if(!_[_0x4e75('0x16')](_0x5e175b[_0x4e75('0x32')][_0x4e75('0x40')])){channels[_0x5e175b[_0x4e75('0x6')]][_0x4e75('0x40')]=_0x5e175b[_0x4e75('0x34')];}}}catch(_0x13383d){utils[_0x4e75('0x13')](_0x13383d[_0x4e75('0x14')]);}};exports['newexten']=function(_0x32a1fa){try{if(!_['isNil'](channels[_0x32a1fa['uniqueid']])){if(_0x32a1fa[_0x4e75('0x41')]['toLowerCase']()==_0x4e75('0x42')&&_[_0x4e75('0x43')](_0x32a1fa[_0x4e75('0x44')][_0x4e75('0x45')](),_0x4e75('0x46'))){var _0x36b074=_0x32a1fa[_0x4e75('0x44')]['split']('=');var _0x380ccf=_0x36b074[0x0][_0x4e75('0x47')](_0x36b074[0x0][_0x4e75('0x48')]('(')+0x1,_0x36b074[0x0][_0x4e75('0x48')](')'));var _0x597b0e=_0x36b074[0x1];channels[_0x32a1fa[_0x4e75('0x6')]][_0x380ccf]=_0x597b0e;}if(!_[_0x4e75('0x49')]([_0x4e75('0x1d'),_0x4e75('0x4a'),'execif',_0x4e75('0x42'),'gotoif'],_0x32a1fa['application'][_0x4e75('0x45')]())){channels[_0x32a1fa[_0x4e75('0x6')]]['lastapplication']=_0x32a1fa[_0x4e75('0x41')];channels[_0x32a1fa[_0x4e75('0x6')]][_0x4e75('0x4b')]=_0x32a1fa[_0x4e75('0x44')];}}}catch(_0xf8147e){utils[_0x4e75('0x13')](_0xf8147e[_0x4e75('0x14')]);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 8e4fa87..7cfbba4 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 _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 +var _0xc6ac=['lodash','connect','info','CONNECTED','shutdown','SHUTDOWN','fullybooted','FULLYBOOTED','error','CLOSE','managerevent','./utils'];(function(_0x35805a,_0x25f3f2){var _0x48b5c4=function(_0x4bb7da){while(--_0x4bb7da){_0x35805a['push'](_0x35805a['shift']());}};_0x48b5c4(++_0x25f3f2);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x489efc,_0x1f1730){_0x489efc=_0x489efc-0x0;var _0x122a45=_0xc6ac[_0x489efc];return _0x122a45;};'use strict';var utils=require(_0xcc6a('0x0'));var _=require(_0xcc6a('0x1'));exports[_0xcc6a('0x2')]=function(){utils[_0xcc6a('0x3')](_0xcc6a('0x4'));};exports[_0xcc6a('0x5')]=function(){utils[_0xcc6a('0x3')](_0xcc6a('0x6'));};exports[_0xcc6a('0x7')]=function(){utils[_0xcc6a('0x3')](_0xcc6a('0x8'));};exports[_0xcc6a('0x9')]=function(_0x12330e){utils[_0xcc6a('0x9')](_0x12330e);};exports['close']=function(){utils[_0xcc6a('0x3')](_0xcc6a('0xa'));};exports[_0xcc6a('0xb')]=function(_0x560cc4){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index a46a04f..855f7ef 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 _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 +var _0xf116=['stack','ANSWER','answertime','hangup','endtime','holdtime','diffTime','util','./utils','info','format','DIAL|%s|%s|%s|%s|%s|%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','error','isNil','value','dialbegin','assign','starttime','now','lastevent','called'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf116,0x16f));var _0x6f11=function(_0x834bb6,_0x1c5e35){_0x834bb6=_0x834bb6-0x0;var _0xa35d00=_0xf116[_0x834bb6];return _0xa35d00;};'use strict';var _=require('lodash');var util=require(_0x6f11('0x0'));var utils=require(_0x6f11('0x1'));var dials={};function writeDB(_0x2f9f5b){utils[_0x6f11('0x2')](util[_0x6f11('0x3')](_0x6f11('0x4'),_0x2f9f5b['uniqueid'],_0x2f9f5b[_0x6f11('0x5')],_0x2f9f5b[_0x6f11('0x6')],_0x2f9f5b[_0x6f11('0x7')],_0x2f9f5b[_0x6f11('0x8')],_0x2f9f5b[_0x6f11('0x9')]));utils[_0x6f11('0xa')](_0x6f11('0xb'),_0x2f9f5b);delete dials[_0x2f9f5b[_0x6f11('0xc')]];}exports[_0x6f11('0xd')]=function(_0x407bdd){try{if(_0x407bdd[_0x6f11('0xe')][_0x6f11('0xf')]()==_0x6f11('0x10')&&_[_0x6f11('0x11')](_0x407bdd[_0x6f11('0x12')][_0x6f11('0xf')](),_0x6f11('0x13'))){var _0xb245b1=_0x407bdd[_0x6f11('0x12')]['split']('=');dials[_0x407bdd[_0x6f11('0xc')]]={'routeId':_0xb245b1[0x1]};}}catch(_0xad6aa0){utils[_0x6f11('0x14')](_0xad6aa0['stack']);}};exports['varset']=function(_0x5dcf13){try{if(!_[_0x6f11('0x15')](_0x5dcf13['variable']['outboundrouteid'])){dials[_0x5dcf13['uniqueid']]={'routeId':_0x5dcf13[_0x6f11('0x16')]};}}catch(_0x226f6f){utils[_0x6f11('0x14')](_0x226f6f['stack']);}};exports[_0x6f11('0x17')]=function(_0x3f80f8){try{if(!_[_0x6f11('0x15')](dials[_0x3f80f8['uniqueid']])){dials[_0x3f80f8[_0x6f11('0xc')]]=_[_0x6f11('0x18')](dials[_0x3f80f8['uniqueid']],_0x3f80f8);dials[_0x3f80f8['uniqueid']][_0x6f11('0x19')]=utils[_0x6f11('0x1a')]();dials[_0x3f80f8[_0x6f11('0xc')]][_0x6f11('0x1b')]=_0x6f11('0x1c');}}catch(_0x1c8976){utils['error'](_0x1c8976[_0x6f11('0x1d')]);}};exports['dialend']=function(_0x5bd928){try{if(!_[_0x6f11('0x15')](dials[_0x5bd928['uniqueid']])){dials[_0x5bd928[_0x6f11('0xc')]]['dialstatus']=_0x5bd928['dialstatus'];if(_0x5bd928['dialstatus']==_0x6f11('0x1e')){dials[_0x5bd928[_0x6f11('0xc')]]=_[_0x6f11('0x18')](dials[_0x5bd928[_0x6f11('0xc')]],_0x5bd928);dials[_0x5bd928[_0x6f11('0xc')]][_0x6f11('0x1f')]=utils[_0x6f11('0x1a')]();dials[_0x5bd928[_0x6f11('0xc')]][_0x6f11('0x1b')]='connect';}}}catch(_0xd17d07){utils[_0x6f11('0x14')](_0xd17d07[_0x6f11('0x1d')]);}};exports[_0x6f11('0x20')]=function(_0x4ef5d7){try{if(!_[_0x6f11('0x15')](dials[_0x4ef5d7[_0x6f11('0xc')]])){dials[_0x4ef5d7[_0x6f11('0xc')]]=_[_0x6f11('0x18')](dials[_0x4ef5d7[_0x6f11('0xc')]],{'endtime':utils[_0x6f11('0x1a')](),'lastevent':'complete'});dials[_0x4ef5d7['uniqueid']]['duration']=utils['diffTime'](dials[_0x4ef5d7[_0x6f11('0xc')]][_0x6f11('0x21')],dials[_0x4ef5d7[_0x6f11('0xc')]][_0x6f11('0x19')]);dials[_0x4ef5d7[_0x6f11('0xc')]][_0x6f11('0x22')]=utils[_0x6f11('0x23')](dials[_0x4ef5d7[_0x6f11('0xc')]]['answertime']||dials[_0x4ef5d7['uniqueid']][_0x6f11('0x21')],dials[_0x4ef5d7[_0x6f11('0xc')]]['starttime']);dials[_0x4ef5d7[_0x6f11('0xc')]]['billableseconds']=dials[_0x4ef5d7[_0x6f11('0xc')]][_0x6f11('0x1f')]?utils[_0x6f11('0x23')](dials[_0x4ef5d7[_0x6f11('0xc')]][_0x6f11('0x21')],dials[_0x4ef5d7[_0x6f11('0xc')]][_0x6f11('0x1f')]):0x0;writeDB(dials[_0x4ef5d7[_0x6f11('0xc')]]);}}catch(_0x14aef0){utils[_0x6f11('0x14')](_0x14aef0[_0x6f11('0x1d')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index b3d9103..39aa497 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 _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 +var _0x3009=['fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','asterisk-manager','../../config/environment','asterisk','username','password','keepConnected','xdr','info','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x3009,0x14f));var _0x9300=function(_0x411ce2,_0x4dbe79){_0x411ce2=_0x411ce2-0x0;var _0xa4a520=_0x3009[_0x411ce2];return _0xa4a520;};var AsteriskManager=require(_0x9300('0x0'));var config=require(_0x9300('0x1'));var utils=require('./utils');var ami=new AsteriskManager(config[_0x9300('0x2')]['port'],config[_0x9300('0x2')]['ip'],config[_0x9300('0x2')][_0x9300('0x3')],config['asterisk'][_0x9300('0x4')],!![]);ami[_0x9300('0x5')]();if(config[_0x9300('0x6')]&&config[_0x9300('0x6')]['disabled']){utils[_0x9300('0x7')]('XDR\x20DISABLED');}else{var agents=require('./agents.controller');var calls=require(_0x9300('0x8'));var queues=require(_0x9300('0x9'));var recordings=require(_0x9300('0xa'));var members=require(_0x9300('0xb'));var dials=require('./dials.controller');var transfers=require(_0x9300('0xc'));var core=require(_0x9300('0xd'));ami['on'](_0x9300('0xe'),core[_0x9300('0xe')]);ami['on'](_0x9300('0xf'),core['shutdown']);ami['on']('fullybooted',core[_0x9300('0x10')]);ami['on'](_0x9300('0x11'),core[_0x9300('0x11')]);ami['on'](_0x9300('0x12'),core['close']);ami['on'](_0x9300('0x13'),core[_0x9300('0x13')]);ami['on'](_0x9300('0x14'),function(_0x57c5fd){try{members[_0x9300('0x14')](_0x57c5fd);}catch(_0x3586fb){utils[_0x9300('0x11')](_0x3586fb);}});ami['on'](_0x9300('0x15'),function(_0x23128e){try{agents[_0x9300('0x15')](_0x23128e);}catch(_0x20a7b2){utils[_0x9300('0x11')](_0x20a7b2);}});ami['on'](_0x9300('0x16'),function(_0x355eb1){try{agents[_0x9300('0x16')](_0x355eb1);}catch(_0x178ef9){utils[_0x9300('0x11')](_0x178ef9);}});ami['on']('agentconnect',function(_0x186ebe){try{agents[_0x9300('0x17')](_0x186ebe);queues['agentconnect'](_0x186ebe);}catch(_0x32b528){utils['error'](_0x32b528);}});ami['on']('agentcomplete',function(_0x2e0e14){try{agents['agentcomplete'](_0x2e0e14);queues[_0x9300('0x18')](_0x2e0e14);members['agentcomplete'](_0x2e0e14);}catch(_0x391f8a){utils['error'](_0x391f8a);}});ami['on'](_0x9300('0x19'),function(_0x149e7e){try{agents[_0x9300('0x19')](_0x149e7e);queues[_0x9300('0x19')](_0x149e7e);}catch(_0x37dad0){utils[_0x9300('0x11')](_0x37dad0);}});ami['on'](_0x9300('0x1a'),function(_0x60e440){try{queues[_0x9300('0x1a')](_0x60e440);recordings['queuecallerjoin'](_0x60e440);}catch(_0x5b5aad){utils[_0x9300('0x11')](_0x5b5aad);}});ami['on'](_0x9300('0x1b'),function(_0x5d2536){try{queues[_0x9300('0x1b')](_0x5d2536);}catch(_0x4aedcf){utils['error'](_0x4aedcf);}});ami['on']('musiconholdstart',function(_0x1d6a2b){try{queues[_0x9300('0x1c')](_0x1d6a2b);calls[_0x9300('0x1c')](_0x1d6a2b);}catch(_0x1678f7){utils[_0x9300('0x11')](_0x1678f7);}});ami['on'](_0x9300('0x1d'),function(_0x40f8f4){try{queues[_0x9300('0x1d')](_0x40f8f4);calls[_0x9300('0x1d')](_0x40f8f4);}catch(_0x28a1c7){utils[_0x9300('0x11')](_0x28a1c7);}});ami['on'](_0x9300('0x1e'),function(_0x36c9c3){try{calls[_0x9300('0x1e')](_0x36c9c3);recordings['newstate'](_0x36c9c3);}catch(_0x4970c7){utils[_0x9300('0x11')](_0x4970c7);}});ami['on']('hangup',function(_0x10b688){try{calls[_0x9300('0x1f')](_0x10b688);recordings[_0x9300('0x1f')](_0x10b688);dials[_0x9300('0x1f')](_0x10b688);agents[_0x9300('0x1f')](_0x10b688);queues[_0x9300('0x1f')](_0x10b688);}catch(_0x44e5ca){utils['error'](_0x44e5ca);}});ami['on'](_0x9300('0x20'),function(_0x1b4f7e){try{members[_0x9300('0x20')](_0x1b4f7e);}catch(_0x1ff1aa){utils[_0x9300('0x11')](_0x1ff1aa);}});ami['on']('blindtransfer',function(_0x136e83){try{queues[_0x9300('0x21')](_0x136e83);agents['blindtransfer'](_0x136e83);transfers['blindtransfer'](_0x136e83);}catch(_0x397a91){utils[_0x9300('0x11')](_0x397a91);}});ami['on'](_0x9300('0x22'),function(_0x346afa){try{queues['attendedtransfer'](_0x346afa);transfers[_0x9300('0x22')](_0x346afa);agents[_0x9300('0x22')](_0x346afa);calls[_0x9300('0x22')](_0x346afa);}catch(_0x4c5a7e){utils['error'](_0x4c5a7e);}});ami['on'](_0x9300('0x23'),function(_0x2e4835){try{queues[_0x9300('0x23')](_0x2e4835);recordings[_0x9300('0x23')](_0x2e4835);calls[_0x9300('0x23')](_0x2e4835);dials[_0x9300('0x23')](_0x2e4835);}catch(_0x36945d){utils[_0x9300('0x11')](_0x36945d);}});ami['on'](_0x9300('0x24'),function(_0x3d4432){try{calls[_0x9300('0x24')](_0x3d4432);recordings[_0x9300('0x24')](_0x3d4432);dials[_0x9300('0x24')](_0x3d4432);}catch(_0xfefb9b){utils[_0x9300('0x11')](_0xfefb9b);}});ami['on'](_0x9300('0x25'),function(_0xaf979){try{calls[_0x9300('0x25')](_0xaf979);recordings['newchannel'](_0xaf979);}catch(_0x872796){utils['error'](_0x872796);}});ami['on'](_0x9300('0x26'),function(_0x56a2e5){try{dials[_0x9300('0x26')](_0x56a2e5);}catch(_0x588169){utils[_0x9300('0x11')](_0x588169);}});ami['on']('dialend',function(_0x14079a){try{dials['dialend'](_0x14079a);}catch(_0xa4da6a){utils['error'](_0xa4da6a);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index e5dc7dd..c705447 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 _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 +var _0xf59f=['./utils','Local/_attended@transfer','info','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','some','devicestatechange','state','INUSE','BUSY','device','TALKING','now','NOT_INUSE','exitAt','diffTime','queue','cdr','source','data3','destination','destinationchannel','isNil','data1','lodash','util'];(function(_0x269ff3,_0x3c46c6){var _0x577252=function(_0x275800){while(--_0x275800){_0x269ff3['push'](_0x269ff3['shift']());}};_0x577252(++_0x3c46c6);}(_0xf59f,0xee));var _0xff59=function(_0xe71b04,_0x5e9a38){_0xe71b04=_0xe71b04-0x0;var _0x26485c=_0xf59f[_0xe71b04];return _0x26485c;};'use strict';var _=require(_0xff59('0x0'));var util=require(_0xff59('0x1'));var utils=require(_0xff59('0x2'));var members={};var exclude=[_0xff59('0x3'),'Queue:'];function writeDB(_0x11b66e){utils[_0xff59('0x4')](util[_0xff59('0x5')](_0xff59('0x6'),_0x11b66e[_0xff59('0x7')],_0x11b66e[_0xff59('0x8')],_0x11b66e[_0xff59('0x9')],_0x11b66e[_0xff59('0xa')],_0x11b66e[_0xff59('0xb')],_0x11b66e[_0xff59('0xc')]));if(_0x11b66e[_0xff59('0x8')]){utils[_0xff59('0xd')](_0x11b66e[_0xff59('0x8')])[_0xff59('0xe')](function(_0x41078b){if(_0x41078b){_0x11b66e[_0xff59('0xb')]=_0x41078b[_0xff59('0xf')];_0x11b66e[_0xff59('0x10')]=_0x41078b[_0xff59('0x10')];utils[_0xff59('0x11')](_0xff59('0x12'),_0x11b66e);}else{utils[_0xff59('0x13')](_0x11b66e[_0xff59('0x8')][_0xff59('0x14')]('/')[0x1])[_0xff59('0xe')](function(_0x16d0d2){if(_0x16d0d2){_0x11b66e[_0xff59('0xb')]=_0x16d0d2[_0xff59('0xf')];_0x11b66e[_0xff59('0x10')]=_0x16d0d2[_0xff59('0x10')];utils['request']('CreateMemberReport',_0x11b66e);}});}})['catch'](function(_0x4baf26){utils['error'](_0x4baf26);});}delete members[_0x11b66e['interface']];}function startsWith(_0x26639b,_0x3c6b14){return _[_0xff59('0x15')](_0x26639b,function(_0x2ab2f1){return _['startsWith'](_0x3c6b14,_0x2ab2f1);});}exports[_0xff59('0x16')]=function(_0x3c6b6e){switch(_0x3c6b6e[_0xff59('0x17')]){case _0xff59('0x18'):case _0xff59('0x19'):if(!startsWith(exclude,_0x3c6b6e[_0xff59('0x1a')])){members[_0x3c6b6e[_0xff59('0x1a')]]={'channel':'voice','interface':_0x3c6b6e[_0xff59('0x1a')],'type':_0xff59('0x1b'),'enterAt':utils[_0xff59('0x1c')](),'role':'agent'};}break;case _0xff59('0x1d'):if(!_['isNil'](members[_0x3c6b6e[_0xff59('0x1a')]])){members[_0x3c6b6e[_0xff59('0x1a')]][_0xff59('0x1e')]=utils[_0xff59('0x1c')]();members[_0x3c6b6e[_0xff59('0x1a')]]['duration']=utils[_0xff59('0x1f')](members[_0x3c6b6e[_0xff59('0x1a')]][_0xff59('0x1e')],members[_0x3c6b6e[_0xff59('0x1a')]]['enterAt']);if(members[_0x3c6b6e[_0xff59('0x1a')]][_0xff59('0x7')]){writeDB(members[_0x3c6b6e[_0xff59('0x1a')]]);}}default:break;}};exports['agentcomplete']=function(_0xa62e9f){if(!_['isNil'](members[_0xa62e9f['interface']])){members[_0xa62e9f[_0xff59('0x8')]]=_['assign'](members[_0xa62e9f['interface']],{'data4':_0xa62e9f[_0xff59('0x20')],'uniqueid':_0xa62e9f[_0xff59('0x7')]});}};exports[_0xff59('0x21')]=function(_0x5085d8){if(_0x5085d8['channel']){var _0x7e929a=_0x5085d8[_0xff59('0x9')][_0xff59('0x14')]('-')[0x0];if(!_['isNil'](members[_0x7e929a])){members[_0x7e929a]=_['assign'](members[_0x7e929a],{'data1':members[_0x7e929a]['data1']||_0x5085d8[_0xff59('0xc')],'data2':members[_0x7e929a][_0xff59('0xa')]||_0x5085d8[_0xff59('0x22')],'data3':members[_0x7e929a][_0xff59('0x23')]||_0x5085d8[_0xff59('0x24')],'uniqueid':members[_0x7e929a][_0xff59('0x7')]||_0x5085d8[_0xff59('0x7')]});if(members[_0x7e929a]['exitAt']){writeDB(members[_0x7e929a]);}}}if(_0x5085d8[_0xff59('0x25')]){var _0x52c6d0=_0x5085d8[_0xff59('0x25')]['split']('-')[0x0];if(!_[_0xff59('0x26')](members[_0x52c6d0])){members[_0x52c6d0]=_['assign'](members[_0x52c6d0],{'data1':members[_0x52c6d0][_0xff59('0x27')]||_0x5085d8['type'],'data2':members[_0x52c6d0][_0xff59('0xa')]||_0x5085d8[_0xff59('0x22')],'data3':members[_0x52c6d0]['data3']||_0x5085d8['destination'],'uniqueid':members[_0x52c6d0][_0xff59('0x7')]||_0x5085d8['uniqueid']});if(members[_0x52c6d0][_0xff59('0x1e')]){writeDB(members[_0x52c6d0]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index d6af733..2ad994a 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 _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 +var _0xbd3b=['musiconholdstart','musiconholdstartAt','musiconholdstop','diffTime','lodash','./utils','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','assign','position','now','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','varset','variable','queuestatus','value','CONTINUE','queuecallerexitAt','toUpperCase','queueposition','queuecallerabandonAt','EXITWITHKEY','ABANDONED','queuecallerleave','holdtime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','assigned','destaccountcode','lastAssignedTo','membername','reason','transfer','TRANSFER','COMPLETEDBY','transfereeuniqueid','transfertype','BLIND','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','origtransfererlinkedid','secondtransfererlinkedid','transferexten','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','transfertargetuniqueid','calleridname','mohtime','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','clone'];(function(_0x21d9af,_0x431b30){var _0x4b208b=function(_0x55bdf4){while(--_0x55bdf4){_0x21d9af['push'](_0x21d9af['shift']());}};_0x4b208b(++_0x431b30);}(_0xbd3b,0x9c));var _0xbbd3=function(_0xc8db6b,_0x320abd){_0xc8db6b=_0xc8db6b-0x0;var _0x12cb81=_0xbd3b[_0xc8db6b];return _0x12cb81;};'use strict';var _=require(_0xbbd3('0x0'));var util=require('util');var utils=require(_0xbbd3('0x1'));var queues={};function writeDB(_0x36cd9e){utils['info'](util[_0xbbd3('0x2')](_0xbbd3('0x3'),_0x36cd9e[_0xbbd3('0x4')],_0x36cd9e[_0xbbd3('0x5')],_0x36cd9e['queue'],_0x36cd9e['lastAssignedTo'],_0x36cd9e[_0xbbd3('0x6')],_0x36cd9e[_0xbbd3('0x7')],_0x36cd9e[_0xbbd3('0x8')]));if(_0x36cd9e[_0xbbd3('0x9')]){utils[_0xbbd3('0xa')](_0x36cd9e[_0xbbd3('0x9')])[_0xbbd3('0xb')](function(_0x41cdb7){if(_0x41cdb7){_0x36cd9e[_0xbbd3('0xc')]=_0x41cdb7['type'];}utils[_0xbbd3('0xd')]('CreateVoiceQueueReport',_0x36cd9e);});}else{utils[_0xbbd3('0xd')](_0xbbd3('0xe'),_0x36cd9e);}if(_0x36cd9e[_0xbbd3('0xf')]){delete queues[_0x36cd9e['transfereduniqueid']];}else{delete queues[_0x36cd9e['uniqueid']];}}exports['queuecallerjoin']=function(_0x5be7d5){queues[_0x5be7d5[_0xbbd3('0x4')]]=_[_0xbbd3('0x10')](_0x5be7d5,{'originalposition':_0x5be7d5[_0xbbd3('0x11')],'queuecallerjoinAt':utils[_0xbbd3('0x12')](),'mohtime':0x0});};exports[_0xbbd3('0x13')]=function(_0x126a06){if(!_[_0xbbd3('0x14')](queues[_0x126a06[_0xbbd3('0x4')]])){if(queues[_0x126a06[_0xbbd3('0x4')]][_0xbbd3('0x15')]){if(!queues[_0x126a06[_0xbbd3('0x4')]][_0xbbd3('0x16')]&&!queues[_0x126a06[_0xbbd3('0x4')]][_0xbbd3('0x17')]){queues[_0x126a06[_0xbbd3('0x4')]][_0xbbd3('0x18')]=!![];queues[_0x126a06[_0xbbd3('0x4')]][_0xbbd3('0x19')]=utils['now']();queues[_0x126a06[_0xbbd3('0x4')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}writeDB(queues[_0x126a06['uniqueid']]);}else{if(queues[_0x126a06[_0xbbd3('0x4')]][_0xbbd3('0xf')]){queues[queues[_0x126a06[_0xbbd3('0x4')]][_0xbbd3('0xf')]]=queues[_0x126a06['uniqueid']];queues[queues[_0x126a06[_0xbbd3('0x4')]]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x126a06[_0xbbd3('0x4')]];}}}};exports[_0xbbd3('0x1a')]=function(_0x49445f){if(!_[_0xbbd3('0x14')](_0x49445f[_0xbbd3('0x1b')][_0xbbd3('0x1c')])&&_0x49445f[_0xbbd3('0x1d')]['toUpperCase']()!==_0xbbd3('0x1e')){if(!_[_0xbbd3('0x14')](queues[_0x49445f[_0xbbd3('0x4')]])){queues[_0x49445f[_0xbbd3('0x4')]][_0xbbd3('0x16')]=![];queues[_0x49445f[_0xbbd3('0x4')]]['queuecallerabandonAt']=null;queues[_0x49445f['uniqueid']][_0xbbd3('0x17')]=!![];queues[_0x49445f[_0xbbd3('0x4')]][_0xbbd3('0x1f')]=utils[_0xbbd3('0x12')]();queues[_0x49445f[_0xbbd3('0x4')]][_0xbbd3('0x8')]=_0x49445f[_0xbbd3('0x1d')][_0xbbd3('0x20')]();writeDB(queues[_0x49445f[_0xbbd3('0x4')]]);}}else if(!_['isNil'](_0x49445f['variable'][_0xbbd3('0x21')])){if(!_[_0xbbd3('0x14')](queues[_0x49445f['uniqueid']])&&!queues[_0x49445f[_0xbbd3('0x4')]][_0xbbd3('0x16')]){queues[_0x49445f[_0xbbd3('0x4')]][_0xbbd3('0x16')]=![];queues[_0x49445f[_0xbbd3('0x4')]][_0xbbd3('0x22')]=null;queues[_0x49445f[_0xbbd3('0x4')]][_0xbbd3('0x17')]=!![];queues[_0x49445f[_0xbbd3('0x4')]][_0xbbd3('0x1f')]=utils[_0xbbd3('0x12')]();queues[_0x49445f[_0xbbd3('0x4')]][_0xbbd3('0x8')]=_0xbbd3('0x23');}}};exports[_0xbbd3('0x16')]=function(_0x4ebecf){if(!_[_0xbbd3('0x14')](queues[_0x4ebecf[_0xbbd3('0x4')]])){queues[_0x4ebecf[_0xbbd3('0x4')]][_0xbbd3('0x17')]=![];queues[_0x4ebecf['uniqueid']][_0xbbd3('0x1f')]=null;queues[_0x4ebecf[_0xbbd3('0x4')]][_0xbbd3('0x16')]=!![];queues[_0x4ebecf[_0xbbd3('0x4')]][_0xbbd3('0x22')]=utils['now']();queues[_0x4ebecf[_0xbbd3('0x4')]][_0xbbd3('0x8')]=_0xbbd3('0x24');}};exports[_0xbbd3('0x25')]=function(_0x30bb90){if(!_[_0xbbd3('0x14')](queues[_0x30bb90['uniqueid']])){queues[_0x30bb90[_0xbbd3('0x4')]][_0xbbd3('0x25')]=!![];queues[_0x30bb90['uniqueid']][_0xbbd3('0x15')]=utils['now']();queues[_0x30bb90[_0xbbd3('0x4')]][_0xbbd3('0x26')]=utils['diffTime'](queues[_0x30bb90[_0xbbd3('0x4')]]['queuecallerleaveAt'],queues[_0x30bb90[_0xbbd3('0x4')]][_0xbbd3('0x27')]);queues[_0x30bb90[_0xbbd3('0x4')]][_0xbbd3('0x11')]=_0x30bb90[_0xbbd3('0x11')];queues[_0x30bb90[_0xbbd3('0x4')]][_0xbbd3('0x28')]=_0x30bb90['count'];queues[_0x30bb90[_0xbbd3('0x4')]][_0xbbd3('0x29')]=_0x30bb90[_0xbbd3('0x29')];queues[_0x30bb90['uniqueid']][_0xbbd3('0x2a')]=_0x30bb90[_0xbbd3('0x2a')];}};exports[_0xbbd3('0x2b')]=function(_0x3f4a6c){if(!_[_0xbbd3('0x14')](queues[_0x3f4a6c[_0xbbd3('0x4')]])){queues[_0x3f4a6c['uniqueid']]['queuecallerabandon']=![];queues[_0x3f4a6c['uniqueid']][_0xbbd3('0x16')]=![];queues[_0x3f4a6c[_0xbbd3('0x4')]][_0xbbd3('0x22')]=null;queues[_0x3f4a6c[_0xbbd3('0x4')]][_0xbbd3('0x17')]=![];queues[_0x3f4a6c[_0xbbd3('0x4')]]['queuecallerexitreason']=null;queues[_0x3f4a6c[_0xbbd3('0x4')]]['queuecallerexitAt']=null;queues[_0x3f4a6c['uniqueid']][_0xbbd3('0x2c')]=!![];queues[_0x3f4a6c[_0xbbd3('0x4')]][_0xbbd3('0x7')]=_0x3f4a6c[_0xbbd3('0x2d')];queues[_0x3f4a6c['uniqueid']][_0xbbd3('0x2e')]=_0x3f4a6c[_0xbbd3('0x2f')];}};exports['agentcomplete']=function(_0xd4d17){if(!_['isNil'](queues[_0xd4d17[_0xbbd3('0x4')]])){if(queues[_0xd4d17[_0xbbd3('0x4')]][_0xbbd3('0x15')]){queues[_0xd4d17[_0xbbd3('0x4')]][_0xbbd3('0x16')]=![];queues[_0xd4d17[_0xbbd3('0x4')]][_0xbbd3('0x16')]=![];queues[_0xd4d17[_0xbbd3('0x4')]]['queuecallerabandonAt']=null;queues[_0xd4d17['uniqueid']][_0xbbd3('0x17')]=![];queues[_0xd4d17[_0xbbd3('0x4')]]['queuecallerexitAt']=null;queues[_0xd4d17['uniqueid']][_0xbbd3('0x2c')]=!![];queues[_0xd4d17[_0xbbd3('0x4')]][_0xbbd3('0x2e')]=_0xd4d17[_0xbbd3('0x2f')];queues[_0xd4d17[_0xbbd3('0x4')]][_0xbbd3('0x18')]=!![];queues[_0xd4d17[_0xbbd3('0x4')]][_0xbbd3('0x19')]=utils[_0xbbd3('0x12')]();if(_0xd4d17[_0xbbd3('0x30')]==_0xbbd3('0x31')){if(!queues[_0xd4d17[_0xbbd3('0x4')]]['transfer']){queues[_0xd4d17[_0xbbd3('0x4')]]['queuecallerexitreason']=_0xbbd3('0x32');}}else{queues[_0xd4d17[_0xbbd3('0x4')]][_0xbbd3('0x8')]=_0xbbd3('0x33')+_0xd4d17[_0xbbd3('0x30')][_0xbbd3('0x20')]();}writeDB(queues[_0xd4d17[_0xbbd3('0x4')]]);}}};exports['blindtransfer']=function(_0x3f6d82){if(!_[_0xbbd3('0x14')](queues[_0x3f6d82[_0xbbd3('0x34')]])){queues[_0x3f6d82[_0xbbd3('0x34')]][_0xbbd3('0x31')]=!![];queues[_0x3f6d82['transfereeuniqueid']][_0xbbd3('0x35')]=_0xbbd3('0x36');queues[_0x3f6d82[_0xbbd3('0x34')]]['transferexten']=_0x3f6d82[_0xbbd3('0x37')];queues[_0x3f6d82[_0xbbd3('0x34')]][_0xbbd3('0x38')]=_0x3f6d82['transfereeuniqueid'];queues[_0x3f6d82[_0xbbd3('0x34')]][_0xbbd3('0x8')]=_0xbbd3('0x39');}};exports[_0xbbd3('0x3a')]=function(_0x574f16){try{if(_0x574f16['origtransfereruniqueid']==_0x574f16[_0xbbd3('0x3b')]){if(!_['isNil'](queues[_0x574f16['secondtransfererlinkedid']])){queues[_0x574f16[_0xbbd3('0x3c')]]['transfer']=!![];queues[_0x574f16[_0xbbd3('0x3c')]][_0xbbd3('0x35')]='ATTENDED';queues[_0x574f16[_0xbbd3('0x3c')]][_0xbbd3('0x3d')]=_0x574f16['origtransfererexten'];queues[_0x574f16[_0xbbd3('0x3c')]][_0xbbd3('0x38')]=_0x574f16['origtransfereruniqueid'];queues[_0x574f16[_0xbbd3('0x3c')]]['queuecallerexitreason']=_0xbbd3('0x3e');}if(!_['isNil'](queues[_0x574f16[_0xbbd3('0x3b')]])){if(_0x574f16[_0xbbd3('0x3f')]&&queues[_0x574f16[_0xbbd3('0x3f')]]){queues[_0x574f16[_0xbbd3('0x3f')]][_0xbbd3('0x40')]=0x1;queues[_0x574f16[_0xbbd3('0x34')]]=_['clone'](queues[_0x574f16[_0xbbd3('0x3f')]]);queues[_0x574f16[_0xbbd3('0x34')]][_0xbbd3('0xf')]=_0x574f16[_0xbbd3('0x41')];queues[_0x574f16['transfereeuniqueid']][_0xbbd3('0x40')]=0x2;queues[_0x574f16[_0xbbd3('0x34')]]['calleridnum']=queues[_0x574f16[_0xbbd3('0x3c')]][_0xbbd3('0x6')];queues[_0x574f16[_0xbbd3('0x34')]][_0xbbd3('0x42')]=queues[_0x574f16['secondtransfererlinkedid']][_0xbbd3('0x42')];queues[_0x574f16[_0xbbd3('0x34')]][_0xbbd3('0x27')]=utils['now']();queues[_0x574f16['transfereeuniqueid']][_0xbbd3('0x15')]=utils[_0xbbd3('0x12')]();queues[_0x574f16[_0xbbd3('0x34')]]['holdtime']=0x0;queues[_0x574f16['transfereeuniqueid']][_0xbbd3('0x43')]=0x0;}else{queues[_0x574f16[_0xbbd3('0x3b')]][_0xbbd3('0xf')]=_0x574f16['secondtransfererlinkedid'];}}}else if(_0x574f16[_0xbbd3('0x44')]==_0x574f16[_0xbbd3('0x3c')]){if(!_[_0xbbd3('0x14')](queues[_0x574f16[_0xbbd3('0x3b')]])){queues[_0x574f16[_0xbbd3('0x3b')]][_0xbbd3('0x31')]=!![];queues[_0x574f16[_0xbbd3('0x3b')]][_0xbbd3('0x35')]='ATTENDED';queues[_0x574f16['origtransfererlinkedid']][_0xbbd3('0x3d')]=_0x574f16[_0xbbd3('0x45')];queues[_0x574f16[_0xbbd3('0x3b')]][_0xbbd3('0x38')]=_0x574f16[_0xbbd3('0x44')];queues[_0x574f16[_0xbbd3('0x3b')]][_0xbbd3('0x8')]=_0xbbd3('0x3e');}if(!_[_0xbbd3('0x14')](queues[_0x574f16[_0xbbd3('0x3c')]])){if(_0x574f16[_0xbbd3('0x46')]&&queues[_0x574f16[_0xbbd3('0x46')]]){queues[_0x574f16[_0xbbd3('0x46')]][_0xbbd3('0x40')]=0x1;queues[_0x574f16[_0xbbd3('0x41')]]=_[_0xbbd3('0x47')](queues[_0x574f16[_0xbbd3('0x46')]]);queues[_0x574f16[_0xbbd3('0x41')]][_0xbbd3('0xf')]=_0x574f16[_0xbbd3('0x41')];queues[_0x574f16[_0xbbd3('0x41')]][_0xbbd3('0x40')]=0x2;queues[_0x574f16['transfertargetuniqueid']][_0xbbd3('0x6')]=queues[_0x574f16[_0xbbd3('0x3b')]]['calleridnum'];queues[_0x574f16[_0xbbd3('0x41')]][_0xbbd3('0x42')]=queues[_0x574f16['origtransfererlinkedid']][_0xbbd3('0x42')];queues[_0x574f16['transfertargetuniqueid']][_0xbbd3('0x27')]=utils['now']();queues[_0x574f16['transfertargetuniqueid']][_0xbbd3('0x15')]=utils[_0xbbd3('0x12')]();queues[_0x574f16['transfertargetuniqueid']]['holdtime']=0x0;queues[_0x574f16['transfertargetuniqueid']][_0xbbd3('0x43')]=0x0;}else{queues[_0x574f16[_0xbbd3('0x3c')]][_0xbbd3('0xf')]=_0x574f16['origtransfererlinkedid'];}}}}catch(_0x216a99){utils['error'](_0x216a99['stack']);}};exports[_0xbbd3('0x48')]=function(_0x5e921b){if(!_[_0xbbd3('0x14')](queues[_0x5e921b[_0xbbd3('0x4')]])){queues[_0x5e921b[_0xbbd3('0x4')]][_0xbbd3('0x49')]=utils['now']();}};exports[_0xbbd3('0x4a')]=function(_0x1e50e3){if(!_[_0xbbd3('0x14')](queues[_0x1e50e3['uniqueid']])){if(!_[_0xbbd3('0x14')](queues[_0x1e50e3['uniqueid']][_0xbbd3('0x49')])){queues[_0x1e50e3[_0xbbd3('0x4')]]['mohtime']+=utils[_0xbbd3('0x4b')](utils['now'](),queues[_0x1e50e3[_0xbbd3('0x4')]]['musiconholdstartAt']);delete queues[_0x1e50e3[_0xbbd3('0x4')]][_0xbbd3('0x49')];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 7fcd9df..dfbe69a 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 _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 +var _0x34e8=['membername','name','UserId','CreateVoiceRecording','newchannel','uniqueid','linkedid','exten','context','channel','error','stack','newstate','isNil','channelstate','transfer','variable','mixmonitor_filename','value','.wav49','replace','.WAV','find','monitors','push','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','debug','getUserByInternal','accountcode','then'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x34e8,0x12c));var _0x834e=function(_0xfd1c81,_0x2c9a83){_0xfd1c81=_0xfd1c81-0x0;var _0x4f1f7b=_0x34e8[_0xfd1c81];return _0x4f1f7b;};'use strict';var _=require(_0x834e('0x0'));var utils=require(_0x834e('0x1'));var recordings={};function writeDB(_0x8b339){utils[_0x834e('0x2')](_0x8b339);if(_0x8b339['accountcode']){utils[_0x834e('0x3')](_0x8b339[_0x834e('0x4')])[_0x834e('0x5')](function(_0x31bf20){if(_0x31bf20){_0x8b339[_0x834e('0x6')]=_0x31bf20[_0x834e('0x7')];_0x8b339[_0x834e('0x8')]=_0x31bf20['id'];}utils['request'](_0x834e('0x9'),_0x8b339);});}else{utils['request'](_0x834e('0x9'),_0x8b339);}}exports[_0x834e('0xa')]=function(_0x3a3ef6){try{if(_0x3a3ef6[_0x834e('0xb')]==_0x3a3ef6[_0x834e('0xc')]){recordings[_0x3a3ef6[_0x834e('0xb')]]={'uniqueid':_0x3a3ef6[_0x834e('0xb')],'accountcode':_0x3a3ef6[_0x834e('0x4')],'exten':_0x3a3ef6[_0x834e('0xd')],'context':_0x3a3ef6[_0x834e('0xe')],'channel':_0x3a3ef6[_0x834e('0xf')],'monitors':[]};}}catch(_0x36e124){utils[_0x834e('0x10')](_0x36e124[_0x834e('0x11')]);}};exports[_0x834e('0x12')]=function(_0x1e00de){try{if(!_[_0x834e('0x13')](recordings[_0x1e00de['uniqueid']])&&_0x1e00de[_0x834e('0x14')]==0x6){}else if(!_[_0x834e('0x13')](recordings[_0x1e00de['linkedid']])&&_0x1e00de[_0x834e('0x14')]==0x6&&_0x1e00de[_0x834e('0xe')]!=_0x834e('0x15')){recordings[_0x1e00de[_0x834e('0xc')]]['accountcode']=_0x1e00de[_0x834e('0x4')];}}catch(_0x302cbd){utils['error'](_0x302cbd[_0x834e('0x11')]);}};exports['varset']=function(_0x38a8cd){try{if(!_[_0x834e('0x13')](_0x38a8cd['variable'])&&!_[_0x834e('0x13')](_0x38a8cd[_0x834e('0x16')][_0x834e('0x17')])){if(_['endsWith'](_0x38a8cd[_0x834e('0x18')],_0x834e('0x19'))){_0x38a8cd[_0x834e('0x18')]=_0x38a8cd[_0x834e('0x18')][_0x834e('0x1a')](_0x834e('0x19'),_0x834e('0x1b'));}if(recordings[_0x38a8cd['linkedid']]){var _0x2545b4=_[_0x834e('0x1c')](recordings[_0x38a8cd[_0x834e('0xc')]][_0x834e('0x1d')],{'value':_0x38a8cd['value']});if(_[_0x834e('0x13')](_0x2545b4)){recordings[_0x38a8cd[_0x834e('0xc')]]['monitors'][_0x834e('0x1e')]({'value':_0x38a8cd[_0x834e('0x18')]});}}}}catch(_0x8d406e){utils['error'](_0x8d406e['stack']);}};exports[_0x834e('0x1f')]=function(_0x34563b){try{if(!_['isNil'](recordings[_0x34563b[_0x834e('0xb')]])){recordings[_0x34563b[_0x834e('0xb')]]['calleridnum']=_0x34563b[_0x834e('0x20')];recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x21')]=_0x34563b['calleridname'];recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x22')]=_0x34563b['connectedlinenum'];recordings[_0x34563b['uniqueid']][_0x834e('0x23')]=_0x34563b['connectedlinename'];if(recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x24')]==_0x834e('0x25')&&recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x4')]){recordings[_0x34563b[_0x834e('0xb')]]['connectedlinenum']=recordings[_0x34563b['uniqueid']]['accountcode'];recordings[_0x34563b['uniqueid']][_0x834e('0x23')]='';}recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x1d')]['forEach'](_0xb5bc06=>{var _0x11f1ce=_[_0x834e('0x26')](recordings[_0x34563b[_0x834e('0xb')]]);_0x11f1ce[_0x834e('0x18')]=_0xb5bc06[_0x834e('0x18')];writeDB(_0x11f1ce);});delete recordings[_0x34563b[_0x834e('0xb')]];}}catch(_0xfaf716){utils[_0x834e('0x10')](_0xfaf716['stack']);}};exports[_0x834e('0x27')]=function(_0x5cad11){try{if(!_[_0x834e('0x13')](recordings[_0x5cad11[_0x834e('0xb')]])){if(_0x5cad11[_0x834e('0x28')][_0x834e('0x29')]()==_0x834e('0x2a')&&_[_0x834e('0x2b')](_0x5cad11[_0x834e('0x2c')][_0x834e('0x29')](),_0x834e('0x2d'))){var _0x12b2bc=_0x5cad11['appdata'][_0x834e('0x2e')]('=');var _0x2f408a=_0x12b2bc[0x0][_0x834e('0x2f')](_0x12b2bc[0x0][_0x834e('0x30')]('(')+0x1,_0x12b2bc[0x0]['lastIndexOf'](')'));var _0x3f88ad=_0x12b2bc[0x1];recordings[_0x5cad11[_0x834e('0xb')]][_0x2f408a]=_0x3f88ad;}}}catch(_0x4b12f5){utils['error'](_0x4b12f5['stack']);}};exports[_0x834e('0x31')]=function(_0x41bf4d){try{if(!_[_0x834e('0x13')](recordings[_0x41bf4d[_0x834e('0xb')]])){recordings[_0x41bf4d[_0x834e('0xb')]][_0x834e('0x32')]=_0x41bf4d['queue'];}}catch(_0x2c2d94){utils['error'](_0x2c2d94[_0x834e('0x11')]);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 7ef9b75..2393be1 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 _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 +var _0x5a53=['origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','transfereechannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','stack','lodash','util','./utils','info','format','TRANSFER|%s','type','request','CreateVoiceTransferReport','blindtransfer','blind','error','attendedtransfer','assign'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x5a53,0x1d2));var _0x35a5=function(_0x51b4ad,_0x182f4e){_0x51b4ad=_0x51b4ad-0x0;var _0x10bb0f=_0x5a53[_0x51b4ad];return _0x10bb0f;};'use strict';var _=require(_0x35a5('0x0'));var util=require(_0x35a5('0x1'));var utils=require(_0x35a5('0x2'));function writeDB(_0x417a7a){utils[_0x35a5('0x3')](util[_0x35a5('0x4')](_0x35a5('0x5'),_0x417a7a[_0x35a5('0x6')]));utils[_0x35a5('0x7')](_0x35a5('0x8'),_0x417a7a);}exports[_0x35a5('0x9')]=function(_0x517f58){try{_0x517f58[_0x35a5('0x6')]=_0x35a5('0xa');writeDB(_0x517f58);}catch(_0x17ec7f){utils[_0x35a5('0xb')](_0x17ec7f['stack']);}};exports[_0x35a5('0xc')]=function(_0x373810){try{_0x373810=_[_0x35a5('0xd')](_0x373810,{'transfererchannel':_0x373810['origtransfererchannel'],'transferercalleridnum':_0x373810['origtransferercalleridnum'],'transferercalleridname':_0x373810[_0x35a5('0xe')],'transfererconnectedlinenum':_0x373810[_0x35a5('0xf')],'transfererconnectedlinename':_0x373810[_0x35a5('0x10')],'transfereraccountcode':_0x373810['origtransfereraccountcode'],'transferercontext':_0x373810['secondtransferercontext'],'transfererexten':_0x373810['secondtransfererexten'],'transfererlinkedid':_0x373810[_0x35a5('0x11')],'context':_0x373810[_0x35a5('0x12')],'extension':_0x373810[_0x35a5('0x13')],'type':_0x35a5('0x14')});if(_['isNil'](_0x373810[_0x35a5('0x15')])){_0x373810=_[_0x35a5('0xd')](_0x373810,{'transfereechannel':_0x373810['transfertargetchannel'],'transfereecalleridnum':_0x373810[_0x35a5('0x16')],'transfereecalleridname':_0x373810[_0x35a5('0x17')],'transfereeconnectedlinenum':_0x373810[_0x35a5('0x18')],'transfereeconnectedlinename':_0x373810[_0x35a5('0x19')],'transfereeaccountcode':_0x373810[_0x35a5('0x1a')],'transfereecontext':_0x373810['transfertargetcontext'],'transfereeexten':_0x373810[_0x35a5('0x1b')],'transfereelinkedid':_0x373810[_0x35a5('0x1c')]});}writeDB(_0x373810);}catch(_0xa45a3b){utils[_0x35a5('0xb')](_0xa45a3b[_0x35a5('0x1d')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 5f7f4b2..5bd452d 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 _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 +var _0xfe2f=['acw','acwTimeout','GETVOICEQUEUEBYNAME|','NOTFOUND','addTime','add','format','subtract','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','isBefore','jayson/promise','moment','bluebird','client','http','../../config/logger','xdr','info','debug','stringify','error','stack','request','then','catch','GetUser','internal','name','interface','GETUSER|','result','length','FOUND','getUserByInternal','getUserByInterface','getUserByName','getVoiceQueueByName','GetVoiceQueue','type'];(function(_0x4ec62d,_0x4f46d6){var _0x3c1d7c=function(_0x1a6a68){while(--_0x1a6a68){_0x4ec62d['push'](_0x4ec62d['shift']());}};_0x3c1d7c(++_0x4f46d6);}(_0xfe2f,0xeb));var _0xffe2=function(_0x47f622,_0x108409){_0x47f622=_0x47f622-0x0;var _0x34358a=_0xfe2f[_0x47f622];return _0x34358a;};'use strict';var jayson=require(_0xffe2('0x0'));var moment=require(_0xffe2('0x1'));var BPromise=require(_0xffe2('0x2'));var client=jayson[_0xffe2('0x3')][_0xffe2('0x4')]({'port':0x2329});var logger=require(_0xffe2('0x5'))(_0xffe2('0x6'));exports[_0xffe2('0x7')]=function(_0x113f3c){logger[_0xffe2('0x7')](_0x113f3c);};exports[_0xffe2('0x8')]=function(_0x906827){logger['debug'](JSON[_0xffe2('0x9')](_0x906827));};exports[_0xffe2('0xa')]=function(_0x10253c){logger[_0xffe2('0xa')](_0x10253c[_0xffe2('0xb')]);};exports[_0xffe2('0xc')]=function(_0x10f137,_0x29b499){return client[_0xffe2('0xc')](_0x10f137,{'body':_0x29b499})[_0xffe2('0xd')](function(_0x5b4401){logger['debug'](JSON[_0xffe2('0x9')](_0x5b4401));})[_0xffe2('0xe')](function(_0x34253b){logger[_0xffe2('0xa')](_0x34253b[_0xffe2('0xb')]);});};function getUser(_0x57552a){return client['request'](_0xffe2('0xf'),{'options':{'raw':!![],'attributes':['id',_0xffe2('0x10'),_0xffe2('0x11'),_0xffe2('0x12')],'where':_0x57552a,'limit':0x1}})[_0xffe2('0xd')](function(_0x81dbc6){logger[_0xffe2('0x7')](_0xffe2('0x13')+JSON['stringify'](_0x57552a)+'|'+(_0x81dbc6[_0xffe2('0x14')][_0xffe2('0x15')]?_0xffe2('0x16'):'NOTFOUND'));return _0x81dbc6[_0xffe2('0x14')][_0xffe2('0x15')]?_0x81dbc6[_0xffe2('0x14')][0x0]:null;});}exports[_0xffe2('0x17')]=function(_0x1997d0){return new BPromise(function(_0x545b4e,_0x413b1d){if(_0x1997d0){return getUser({'internal':_0x1997d0})[_0xffe2('0xd')](function(_0x16b2e9){return _0x545b4e(_0x16b2e9);})[_0xffe2('0xe')](function(_0x146d73){logger[_0xffe2('0xa')](_0x146d73['stack']);return _0x545b4e(null);});}else{return _0x545b4e(null);}});};exports[_0xffe2('0x18')]=function(_0x3492f3){return new BPromise(function(_0x4e706f,_0x166861){if(_0x3492f3){return getUser({'interface':_0x3492f3})[_0xffe2('0xd')](function(_0x571c3a){return _0x4e706f(_0x571c3a);})[_0xffe2('0xe')](function(_0x5b3940){logger[_0xffe2('0xa')](_0x5b3940[_0xffe2('0xb')]);return _0x4e706f(null);});}else{return _0x4e706f(null);}});};exports[_0xffe2('0x19')]=function(_0x53a872){return new BPromise(function(_0x444d11,_0x332cee){if(_0x53a872){return getUser({'name':_0x53a872})[_0xffe2('0xd')](function(_0x167ec8){return _0x444d11(_0x167ec8);})[_0xffe2('0xe')](function(_0x22e01a){logger[_0xffe2('0xa')](_0x22e01a[_0xffe2('0xb')]);return _0x444d11(null);});}else{return _0x444d11(null);}});};exports[_0xffe2('0x1a')]=function(_0x433e11){return new BPromise(function(_0x3700aa,_0x11f105){if(_0x433e11){return client[_0xffe2('0xc')](_0xffe2('0x1b'),{'options':{'raw':!![],'attributes':['id',_0xffe2('0x11'),_0xffe2('0x1c'),_0xffe2('0x1d'),_0xffe2('0x1e')],'where':{'name':_0x433e11},'limit':0x1}})[_0xffe2('0xd')](function(_0x58c94a){logger['info'](_0xffe2('0x1f')+_0x433e11+'|'+(_0x58c94a[_0xffe2('0x14')][_0xffe2('0x15')]?_0xffe2('0x16'):_0xffe2('0x20')));return _0x3700aa(_0x58c94a[_0xffe2('0x14')][_0xffe2('0x15')]?_0x58c94a[_0xffe2('0x14')][0x0]:null);})[_0xffe2('0xe')](function(_0x4d5d30){logger['error'](_0x4d5d30['stack']);return _0x3700aa(null);});}else{return _0x3700aa(null);}});};exports[_0xffe2('0x21')]=function(_0x59a8d0,_0x38ac4f){return moment(_0x59a8d0)[_0xffe2('0x22')](_0x38ac4f,'seconds')[_0xffe2('0x23')]('YYYY-MM-DD\x20HH:mm:ss');};exports['subtractTime']=function(_0x3d09f4,_0x284702){return moment(_0x3d09f4)[_0xffe2('0x24')](_0x284702,'seconds')[_0xffe2('0x23')](_0xffe2('0x25'));};exports[_0xffe2('0x26')]=function(_0x1655b7,_0xe56841){return moment(_0x1655b7)[_0xffe2('0x27')](moment(_0xe56841),'seconds');};exports[_0xffe2('0x28')]=function(_0x676f83,_0x1eb856){return parseInt(_0x676f83,0xa)+parseInt(_0x1eb856,0xa);};exports[_0xffe2('0x29')]=function(){return moment()[_0xffe2('0x23')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xffe2('0x2a')]=function(_0x3ee1bd,_0x1d45e9){if(_0x1d45e9){return moment(_0x3ee1bd)['isAfter'](_0x1d45e9);}else{return!![];}};exports[_0xffe2('0x2b')]=function(_0x4d03bc,_0x26a2bc){if(_0x26a2bc){return moment(_0x4d03bc)[_0xffe2('0x2b')](_0x26a2bc);}else if(_0x4d03bc){return!![];}else{return![];}}; \ No newline at end of file